Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokenize: grid-template-areas #1523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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-tokenizer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to CSS Tokenizer

### Unreleased (minor)

- Add `tokenizeGridTemplateAreas` for `grid-template-areas` strings.

### 3.0.3

_October 25, 2024_
Expand Down
2 changes: 1 addition & 1 deletion packages/css-tokenizer/dist/index.cjs

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions packages/css-tokenizer/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ export declare function cloneTokens(tokens: Array<CSSToken>): Array<CSSToken>;
*/
export declare type CSSToken = TokenAtKeyword | TokenBadString | TokenBadURL | TokenCDC | TokenCDO | TokenColon | TokenComma | TokenComment | TokenDelim | TokenDimension | TokenEOF | TokenFunction | TokenHash | TokenIdent | TokenNumber | TokenPercentage | TokenSemicolon | TokenString | TokenURL | TokenWhitespace | TokenOpenParen | TokenCloseParen | TokenOpenSquare | TokenCloseSquare | TokenOpenCurly | TokenCloseCurly | TokenUnicodeRange;

export declare interface GridTemplateAreasTokenNamedCell {
type: TokenTypeGridTemplateAreas.NamedCell;
/**
* The name of the cell
*/
value: string;
}

export declare interface GridTemplateAreasTokenNullCell {
type: TokenTypeGridTemplateAreas.NullCell;
/**
* The dots representing the null cell
*/
value: string;
}

export declare interface GridTemplateAreasTokenTrash {
type: TokenTypeGridTemplateAreas.Trash;
/**
* The incorrect cell value
*/
value: string;
}

/**
* The type of hash token
*/
Expand Down Expand Up @@ -380,6 +404,13 @@ export declare function tokenize(input: {
onParseError?: (error: ParseError) => void;
}): Array<CSSToken>;

/**
* Tokenize a CSS string describing grid template areas into a list of tokens.
*/
export declare function tokenizeGridTemplateAreas(input: {
valueOf(): string;
}): Array<GridTemplateAreasTokenNamedCell | GridTemplateAreasTokenNullCell | GridTemplateAreasTokenTrash>;

/**
* Create a tokenizer for a CSS string.
*/
Expand Down Expand Up @@ -573,6 +604,17 @@ export declare enum TokenType {
UnicodeRange = "unicode-range-token"
}

/**
* All possible CSS token types for grid template areas
*
* @see {@link https://drafts.csswg.org/css-grid/#valdef-grid-template-areas-string}
*/
export declare enum TokenTypeGridTemplateAreas {
NamedCell = "named-cell-token",
NullCell = "null-cell-token",
Trash = "trash-token"
}

export declare interface TokenUnicodeRange extends Token<TokenType.UnicodeRange, {
startOfRange: number;
endOfRange: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/css-tokenizer/dist/index.mjs

Large diffs are not rendered by default.

Loading
Loading