Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d1e768b
temp. add migration doc
bartveneman Nov 29, 2025
aba735a
refactor: extract CSSNode to abstract base class
bartveneman Nov 29, 2025
8e5faf0
feat: add node type guards and helpers
bartveneman Nov 29, 2025
92dd0a5
refactor: add factory pattern to CSSNode
bartveneman Nov 29, 2025
b35e4dd
feat: add StylesheetNode class
bartveneman Nov 29, 2025
6034bcb
feat: add CommentNode class
bartveneman Nov 29, 2025
2b12280
feat: add BlockNode class and fix traversal
bartveneman Nov 29, 2025
7bbb660
feat: add DeclarationNode class
bartveneman Nov 29, 2025
edb9403
feat: add AtRuleNode class
bartveneman Nov 29, 2025
7e39e27
feat: add StyleRuleNode class
bartveneman Nov 29, 2025
2d19a5b
feat: add SelectorNode class
bartveneman Nov 29, 2025
4c690aa
feat: add simple value node classes
bartveneman Nov 29, 2025
43d637a
feat: add complex value node classes
bartveneman Nov 29, 2025
526c468
feat: add simple selector node classes
bartveneman Nov 29, 2025
c6aa74c
feat: add named selector node classes
bartveneman Nov 29, 2025
3c7a179
feat: add attribute selector node class
bartveneman Nov 29, 2025
191c450
feat: add pseudo selector node classes
bartveneman Nov 29, 2025
d11069c
feat: add nth selector node classes
bartveneman Nov 29, 2025
732e81a
feat: add media prelude node classes
bartveneman Nov 29, 2025
4053c0b
feat: add container and supports prelude node classes
bartveneman Nov 29, 2025
3d9bc79
feat: add import prelude node classes
bartveneman Nov 29, 2025
e264ddd
feat: update parse function return type to StylesheetNode
bartveneman Nov 29, 2025
bfdee55
feat: add barrel export file for all node classes
bartveneman Nov 29, 2025
75aa560
feat: add package export for nodes barrel file
bartveneman Nov 29, 2025
1410596
feat: update walk() function with type-specific documentation
bartveneman Nov 29, 2025
8c55012
docs: complete Batch 25 - migration finished (25/25)
bartveneman Nov 29, 2025
e0f4c59
fix: resolve TypeScript errors with type-specific node classes
bartveneman Nov 29, 2025
f8298a6
feat: make tree traversal return type-specific nodes
bartveneman Nov 29, 2025
7f6bb1e
Fix type-specific node creation and property implementations
bartveneman Nov 29, 2025
95b6807
Fix TypeScript errors by updating type aliases to AnyNode
bartveneman Nov 29, 2025
ecece74
better types
bartveneman Nov 29, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.md
!API.md
!README.md
!MIGRATION-TYPED-NODES.md
dist
coverage
.claude/settings.local.json
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
"./parse-anplusb": {
"types": "./dist/parse-anplusb.d.ts",
"import": "./dist/parse-anplusb.js"
},
"./nodes": {
"types": "./dist/nodes/index.d.ts",
"import": "./dist/nodes/index.js"
}
},
"files": [
Expand Down
6 changes: 3 additions & 3 deletions src/anplusb-parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { describe, it, expect } from 'vitest'
import { ANplusBParser } from './anplusb-parser'
import { CSSDataArena, NODE_SELECTOR_NTH } from './arena'
import { CSSNode } from './css-node'
import { CSSNode, SelectorNthNode } from './css-node'

// Helper to parse An+B expression
function parse_anplusb(expr: string): CSSNode | null {
function parse_anplusb(expr: string): SelectorNthNode | null {
const arena = new CSSDataArena(64)
const parser = new ANplusBParser(arena, expr)
const nodeIndex = parser.parse_anplusb(0, expr.length)

if (nodeIndex === null) return null
return new CSSNode(arena, expr, nodeIndex)
return CSSNode.from(arena, expr, nodeIndex) as SelectorNthNode
}

describe('ANplusBParser', () => {
Expand Down
Loading
Loading