Skip to content

Track animation names in CSS analysis#608

Merged
bartveneman merged 2 commits into
mainfrom
claude/awesome-ramanujan-mvJCP
May 28, 2026
Merged

Track animation names in CSS analysis#608
bartveneman merged 2 commits into
mainfrom
claude/awesome-ramanujan-mvJCP

Conversation

@bartveneman
Copy link
Copy Markdown
Member

Summary

This PR adds tracking and analysis of animation names used in CSS animations, complementing the existing analysis of animation durations and timing functions.

Key Changes

  • New animation name collection: Added animationNames collection to track all animation names used in stylesheets
  • Enhanced analyzeAnimation function: Extended to emit name type items for animation identifiers while filtering out reserved keywords (direction, fill-mode, play-state, iteration-count, and timing-function keywords)
  • Support for both animation and animation-name properties:
    • Extracts names from animation shorthand property
    • Extracts names from dedicated animation-name property
  • Updated output structure: Added names field to animations object in analysis results, containing total count, unique count, and uniqueness ratio
  • Comprehensive test coverage: Added 10 new tests covering various animation name scenarios including edge cases with reserved keywords and custom property names

Implementation Details

  • Created ANIMATION_NON_NAME_KEYWORDS set to distinguish animation names from other valid animation shorthand keywords
  • Animation names are only collected when the property is animation or animation-name (not for transition)
  • Properly handles both standard animation names and custom property names (e.g., --my-name)
  • Maintains consistency with existing collection patterns for durations and timing functions

https://claude.ai/code/session_01HVDNrfgMVDeSY69NYHoYH2

claude added 2 commits May 28, 2026 09:20
Adds { type: 'name', value: Node } to the items emitted by analyzeAnimation
so consumers can extract animation names from shorthand values without
maintaining their own keyword exclusion list.

A new ANIMATION_NON_NAME_KEYWORDS set covers direction, fill-mode,
play-state and iteration-count reserved words; any remaining identifier
that doesn't match timing keywords or global CSS keywords is emitted as name.

Closes #604
Adds values.animations.names to the analyze() output. Names are collected
from the `animation` shorthand (via the new name callback from analyzeAnimation)
and from the `animation-name` longhand property. Dashed-idents like --my-name
are valid animation names and are collected as-is (case preserved).
Transition property names are excluded since they go through the same
shorthand handler but with a different property.
@codecov-commenter
Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 750 bytes (0.94%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
analyzeCss-esm 80.54kB 750 bytes (0.94%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: analyzeCss-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.js 431 bytes 33.61kB 1.3%
index.d.ts 33 bytes 14.66kB 0.23%
browserhacks-D2pBB19t.js (New) 9.26kB 9.26kB 100.0% 🚀
browserhacks-BZeV9_0h.js (Deleted) -8.97kB 0 bytes -100.0% 🗑️

Files in index.js:

  • ./src/index.ts → Total Size: 26.95kB

Files in browserhacks-D2pBB19t.js:

  • ./src/values/animations.ts → Total Size: 1.12kB

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.25%. Comparing base (f175af0) to head (9f333f4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/index.ts 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #608      +/-   ##
==========================================
- Coverage   94.48%   94.25%   -0.24%     
==========================================
  Files          18       18              
  Lines        1016     1027      +11     
  Branches      321      325       +4     
==========================================
+ Hits          960      968       +8     
- Misses         46       48       +2     
- Partials       10       11       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bartveneman bartveneman merged commit a62585d into main May 28, 2026
5 checks passed
@bartveneman bartveneman deleted the claude/awesome-ramanujan-mvJCP branch May 28, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants