Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: honojs/hono
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.12.10
Choose a base ref
...
head repository: honojs/hono
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.12.11
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Apr 4, 2026

  1. feat(css): add classNameSlug option to createCssContext (#4834)

    * feat(css): add classNameSlug option to createCssContext
    
    Add an optional classNameSlug function to createCssContext that lets
    users customize generated CSS class names instead of the default
    hash-based 'css-1234567890' format.
    
    The function receives (hash, label, styleString) and returns the desired
    class name string. This enables readable, debug-friendly class names
    like 'h-hero-section' while preserving hash-based uniqueness.
    
    Addresses review feedback:
    - Move ClassNameSlug type near CssVariableType exports
    - Rename third parameter from css to styleString
    - Propagate classNameSlug to keyframesCommon and viewTransitionCommon
    - Add classNameSlug support to DOM-side createCssContext
    - Add TSDoc documentation
    
    Closes #4577
    
    * fix(css): sanitize and normalize classNameSlug output
    
    Normalize and sanitize the return value of classNameSlug to prevent
    CSS injection and improve readability:
    
    - Trim leading/trailing whitespace
    - Collapse whitespace sequences to hyphens (e.g. 'ultra fast' -> 'ultra-fast')
    - Strip characters outside [a-zA-Z0-9_-]
    - Fall back to hash if result is empty
    
    Addresses review feedback from yusukebe and usualoma regarding
    potential CSS injection through malicious classNameSlug functions.
    
    * feat(css): add onInvalidSlug and unify server/DOM contexts
    
    Add strict CSS identifier validation for classNameSlug output and
    onInvalidSlug callback for invalid slugs, unified across server
    and DOM-side createCssContext.
    
    - Replace sanitizeClassName with validateClassName/validateKeyframeName
      (rejects digit-leading names and reserved @Keyframes keywords)
    - Add onInvalidSlug option (defaults to console.warn)
    - Normalize labels (trim + hyphenate) before passing to classNameSlug
    
    * feat(css): refine classNameSlug with strict validation and onInvalidSlug
    
    Refine classNameSlug implementation by replacing sanitization with
    strict validation and adding an onInvalidSlug callback.
    
    - Add isValidClassName and isValidKeyframeName for strict identifier
      checks (^?-?[_a-zA-Z][_a-zA-Z0-9-]*$).
    - Reject CSS-wide reserved keywords for @Keyframes animation names.
    - Pre-normalize labels (trim + hyphenate) before passing to classNameSlug.
    - Add optional onInvalidSlug callback to createCssContext for custom
      error handling (defaults to console.warn).
    - Ensure parity between SSR and DOM-side createCssContext.
    - Ensure the default path remains zero-overhead when classNameSlug is unused.
    
    * test: remove .trim() usage in classNameSlug test
    flow-pie authored Apr 4, 2026
    Configuration menu
    Copy the full SHA
    f82aba8 View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2026

  1. 4.12.11

    yusukebe committed Apr 6, 2026
    Configuration menu
    Copy the full SHA
    2c403c6 View commit details
    Browse the repository at this point in the history
Loading