An open API service indexing awesome lists of open source software.

https://github.com/casoon/dragonfly


https://github.com/casoon/dragonfly

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

# @casoon/dragonfly

A modular, lightweight CSS framework and design system for modern web projects. While it is especially optimized for use with Astro JS, it is fully framework-agnostic and can be used in any web project. The library is developed by an author who primarily uses Astro JS, but it is not limited to that ecosystem. It is also optimized for LightningCSS and Container Queries, featuring a @layer-based architecture and comprehensive accessibility.

## Table of Contents
1. [Features](#features)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Goals and Requirements](#goals-and-requirements)
5. [Architecture](#architecture)
6. [CSS Layer System](#css-layer-system)
7. [Layer & File Structure](#layer--file-structure)
8. [Compatibility](#compatibility)
9. [Browser Compatibility Tests](#browser-compatibility-tests)
10. [Fonts](#fonts)
11. [Custom Components](#custom-components)
12. [Documentation](#documentation)
13. [Contributing](#contributing)
14. [License](#license)

## โœจ New Features & Improvements (v0.7.5)

- **๐Ÿ—๏ธ CSS Modernization Completed**: Complete migration from BEM notation to modern CSS Nesting for all components
- **โœ… 100% Lint-free Codebase**: All 234+ CSS files pass Lightning CSS tests without errors
- **๐Ÿงช Enhanced Testing Suite**: Comprehensive browser compatibility tests and automated CSS validation
- **๐Ÿ“ฆ Optimized Bundle Size**: Reduced CSS redundancy through modern syntax
- **๐ŸŽฏ Improved Developer Experience**: Consistent code structure and better maintainability
- **๐Ÿ”ง Modernized Architecture**: Use of CSS Nesting instead of BEM notation for better readability
- **๐ŸŽจ Enhanced Link Buttons**: 15+ new styling variants with extensive customization options

## Features

### ๐Ÿš€ Core Features
- **Comprehensive Theme System** with dark/light mode support
- **Enhanced Accessibility Components** for screen readers and keyboard users
- **Advanced Color Contrast System**
- **New Utility Classes** for width and height
- **Optimized Animation System** with new naming scheme and reduced redundancy
- **Responsive Design** with `.motion-safe`/`.motion-reduce` for `prefers-reduced-motion`
- **Modern Effects** including dialog and focus animations, staggered animations
- **Full Support** for dark mode and RTL layouts
- **Validation** with modern CSS
- **Improved Forms** with revised form system and consistent nomenclature
- **Optimized Layer Structure** with extended flex/grid utilities
- **Container Query Integration** with consistent logical properties
- **Fluid Typography** using fluid interpolation
- **CSS Nesting**: Modern CSS syntax instead of BEM notation for better readability and maintainability

## Installation

```bash
npm install @casoon/dragonfly
# or
yarn add @casoon/dragonfly
# or
pnpm add @casoon/dragonfly
```

> **๐Ÿ†• v0.7.5**: Completely modernized CSS codebase with 100% lint-free quality guarantee and CSS Nesting instead of BEM notation.

## Usage

### Standard Usage (Modular Approach with Lightning CSS)

This option is ideal for developers using Lightning CSS who need:
- Maximum control over CSS layers
- Selective component imports
- Custom optimization process
- Direct work with the layer system

**Basic:**
```html

```
**With Bundler:**
```js
import '@casoon/dragonfly/index.css';
```
**With Astro:**
```astro
import '@casoon/dragonfly/index.css';
```

### Bundled CSS Alternative

This option provides a pre-bundled and optimized version for:
- Simple integration without Lightning CSS configuration
- Quick usage via CDN (unpkg.com)
- Projects where loading time is more important than flexibility

**Direct HTML:**
```html

```

**With Bundler:**
```js
import '@casoon/dragonfly/dist/index.min.css';
```

**With Astro:**
```astro
import '@casoon/dragonfly/dist/index.min.css';
```

**Via unpkg.com CDN:**
```html

```

**Note about the unpkg.com version:**
The minified version contains basic functionality but may not include all effects and components. For specific components or effects, these can be loaded selectively:

```html

```

## Goals and Requirements

### 1. Design System โ€“ A Consistent, Scalable Foundation

**Goal:** Build a modular, consistent design system that can be reused across different projects.

**Requirements:**
- Systematic naming and structural organization for all tokens and components
- A token-based design foundation that uses CSS Custom Properties
- Theming support and extensibility through a layer-based architecture (e.g., tokens, utilities, components)

### 2. Design Principles โ€“ Clear Visual and Functional Rules

**Goal:** Ensure that all UI components follow shared principles to maintain coherence in appearance and behavior.

**Requirements:**
- Uniform rules for layout, spacing, typography, and sizing
- Components should be understandable and usable even without relying on external design tools
- Clear separation of presentation and logic in structure and styling

### 3. Functional Patterns โ€“ Reusable, Adaptive Component Blueprints

**Goal:** Provide abstract patterns for common interactions and functional behaviors.

**Requirements:**
- Modular component patterns like Dialog, Accordion, Dropdown, designed with minimal JavaScript
- Components should be easily configurable and adaptable to various use cases
- Accessibility (a11y) must be considered a first-class concern

### 4. Perceptual Patterns โ€“ Intuitive Feedback and Visual Communication

**Goal:** Implement perceptual cues that improve user understanding and feedback.

**Requirements:**
- Definition and support for component states like hover, focus, disabled, error, loading, success
- Utility classes or animations to support interactive transitions and effects
- All components should respond properly across screen sizes and devices (responsive design)

### 5. Shared Language โ€“ Unified Naming and API Convention

**Goal:** Promote a common language between design and development.

**Requirements:**
- Token names, components, and utilities should follow a consistent and documented naming convention
- Clear CSS class API (e.g., btn-primary, gap-md, card-lg) that is intuitive and predictable
- Terminology and structure should reflect a systemized mental model shared across the project

## Architecture

The library uses a clearly defined CSS layer architecture to avoid specificity conflicts and improve maintainability.

### Layer Hierarchy

```css
@layer reset, tokens, custom-properties, core, logical-properties, colors, color-mix, layout, layout-queries, typography, utilities, smooth-scroll, accessibility, icons, components, animations, effects, themes;
```

### Layer Structure
1. **reset**: Basic CSS resets for uniform browser rendering
2. **tokens**: Design tokens for colors, spacing, typography, etc.
3. **custom-properties**: CSS variable definitions
4. **core**: Core styles for basic elements
5. **layout**: Layout system with Flexbox and Grid
6. **typography**: Typography system
7. **utilities**: Utility classes
8. **components**: UI components
9. **animations**: Animation system
10. **effects**: Visual effects
11. **themes**: Theming system

A detailed description of the layer structure can be found in [LAYER-SYSTEM.md](LAYER-SYSTEM.md).

## CSS Layer System

### 1. Structured Layers
- Implementation of a clearly defined layer system to control CSS specificity
- Distinct separation and documentation of layers like reset, tokens, custom-properties, utilities, animations, themes, and components
- Centralized definitions: All layer definitions are managed in a central file (layers.css)

### 2. Design Tokens & Custom Properties
- Uniform design tokens: Definition of consistent design tokens for colors, spacing, typography, etc.
- Use of CSS Custom Properties for easy customization and maintenance of the design

### 3. Component Architecture
- Modular components: Development of over 35 reusable UI components including buttons, cards, inputs, modals, etc.
- Framework-agnostic: Components are independent of specific JavaScript frameworks and integrate easily into different projects
- Responsive design: All components are fully responsive and function across various screen sizes

### 4. Effects & Animations
- Visual effects: Implementation of effects like neon, glassmorphism, shadows, and 3D transformations
- Interactive states: Definition of states such as hover, focus, active, success, error, loading, etc.

### 5. Theming & Customization
- Customizable themes: Enable easy creation and integration of different themes by adjusting design tokens
- Dark/Light Mode: Support for light and dark design variants

### 6. Integration with Build Tools
- Compatibility: Ensuring compatibility with modern build tools like Webpack, Vite, and Astro
- Easy installation: Providing clear instructions for installing and integrating the library into projects

### 7. Documentation & Examples
- Comprehensive documentation: Detailed documentation with examples for each component and function is available at https://casoon.github.io/ui-docs/
- Interactive examples: The documentation site includes interactive examples demonstrating how to use various library features in real scenarios

### 8. Testing & Quality Assurance
- Lightning CSS testing: Comprehensive testing with Lightning CSS parser to ensure compatibility and proper CSS processing
- Automated linting: Implementation of Stylelint with custom rules to maintain CSS coding standards and best practices
- Accessibility validation: Automated tests for WCAG compliance and accessibility features
- Browser compatibility testing: Testing across major browsers to ensure consistent rendering and functionality

## Layer & File Structure

```
@casoon/dragonfly/
โ”œโ”€โ”€ index.css # Main file with layer imports
โ”œโ”€โ”€ dist/ # Contains bundled versions
โ”‚ โ”œโ”€โ”€ index.min.css # Minified bundle with all imports resolved
โ”‚ โ”œโ”€โ”€ index.min.css.map # Source map for debugging
โ”‚ โ”œโ”€โ”€ index.bundled.css # Non-minified bundle for development
โ”‚ โ”œโ”€โ”€ components.min.css # Minified bundle of UI components
โ”‚ โ”œโ”€โ”€ effects.min.css # Minified bundle of effects
โ”‚ โ”œโ”€โ”€ icons.min.css # Minified bundle of icons
โ”‚ โ””โ”€โ”€ themes.min.css # Minified bundle of themes
โ”œโ”€โ”€ core/ # Core styles and reset
โ”‚ โ”œโ”€โ”€ reset.css # CSS reset
โ”‚ โ”œโ”€โ”€ colors.css # Base colors
โ”‚ โ”œโ”€โ”€ color-mix.css # Color mixing utilities
โ”‚ โ”œโ”€โ”€ logical-properties.css # Logical properties
โ”‚ โ”œโ”€โ”€ smooth-scroll.css # Smooth scrolling
โ”‚ โ””โ”€โ”€ accessibility/ # Accessibility helpers
โ”‚ โ”œโ”€โ”€ aria.css # ARIA utilities
โ”‚ โ”œโ”€โ”€ contrast.css # Color contrast
โ”‚ โ”œโ”€โ”€ keyboard.css # Keyboard navigation
โ”‚ โ””โ”€โ”€ screenreader.css # Screen reader utilities
โ”œโ”€โ”€ layout/ # Layout system
โ”‚ โ”œโ”€โ”€ index.css # Layout imports
โ”‚ โ”œโ”€โ”€ responsive.css # Responsive breakpoints
โ”‚ โ”œโ”€โ”€ spacing.css # Spacing utilities
โ”‚ โ”œโ”€โ”€ flex-layouts.css # Flexbox utilities
โ”‚ โ”œโ”€โ”€ grid-system.css # Grid utilities
โ”‚ โ””โ”€โ”€ containers/ # Container system
โ”‚ โ”œโ”€โ”€ index.css # Container imports
โ”‚ โ”œโ”€โ”€ base.css # Basic container components
โ”‚ โ”œโ”€โ”€ position.css # Positioned containers with z-index
โ”‚ โ”œโ”€โ”€ responsive-containers.css # Responsive containers
โ”‚ โ”œโ”€โ”€ special.css # Special containers (scrollable, masonry)
โ”‚ โ”œโ”€โ”€ asymmetric.css # Split layouts and aspect ratio containers
โ”‚ โ”œโ”€โ”€ visual.css # Visual styling containers
โ”‚ โ”œโ”€โ”€ functional.css # Functional UI containers
โ”‚ โ”œโ”€โ”€ performance.css # Performance-optimized containers
โ”‚ โ””โ”€โ”€ a11y.css # Accessibility-optimized containers
โ”œโ”€โ”€ tokens/ # Design tokens
โ”‚ โ”œโ”€โ”€ index.css # Token imports
โ”‚ โ”œโ”€โ”€ colors/ # Color tokens
โ”‚ โ”œโ”€โ”€ spacing/ # Spacing tokens
โ”‚ โ”œโ”€โ”€ typography/ # Typography tokens
โ”‚ โ””โ”€โ”€ effects/ # Effect tokens
โ”œโ”€โ”€ typography/ # Typography system
โ”‚ โ”œโ”€โ”€ index.css # Typography imports
โ”‚ โ”œโ”€โ”€ typography.css # Typography styles
โ”‚ โ”œโ”€โ”€ hierarchy/ # Heading hierarchy
โ”‚ โ”œโ”€โ”€ baseline/ # Baseline grid
โ”‚ โ””โ”€โ”€ weights/ # Font weights
โ”œโ”€โ”€ utilities/ # Utility classes
โ”‚ โ”œโ”€โ”€ index.css # Utility imports
โ”‚ โ”œโ”€โ”€ helpers/ # Helper utilities
โ”‚ โ”œโ”€โ”€ mixins/ # CSS mixins
โ”‚ โ”œโ”€โ”€ variables/ # CSS variables
โ”‚ โ””โ”€โ”€ customize/ # Customization utilities
โ”œโ”€โ”€ themes/ # Theming system
โ”‚ โ”œโ”€โ”€ index.css # Theme imports
โ”‚ โ”œโ”€โ”€ base/ # Base theme
โ”‚ โ”œโ”€โ”€ mode/ # Light/dark modes
โ”‚ โ””โ”€โ”€ variants/ # Theme variants
โ”œโ”€โ”€ icons/ # Icon system
โ”‚ โ”œโ”€โ”€ index.css # Icon imports
โ”‚ โ”œโ”€โ”€ base.css # Icon base styles
โ”‚ โ””โ”€โ”€ [icon-sets]/ # Various icon sets
โ”œโ”€โ”€ fonts/ # Web fonts
โ”‚ โ”œโ”€โ”€ fonts.css # Main CSS file with all variables and utility classes
โ”‚ โ”œโ”€โ”€ README.md # Documentation
โ”‚ โ””โ”€โ”€ [font-name]/ # Directory for each font
โ”‚ โ”œโ”€โ”€ 400.css # CSS for regular weight
โ”‚ โ”œโ”€โ”€ 700.css # CSS for bold weight
โ”‚ โ”œโ”€โ”€ index.css # Imports all weights
โ”‚ โ””โ”€โ”€ *.woff2 # WOFF2 files
โ”œโ”€โ”€ ui/ # UI components
โ”‚ โ”œโ”€โ”€ index.css # UI imports
โ”‚ โ”œโ”€โ”€ content.css # Content & Link Button components
โ”‚ โ”œโ”€โ”€ forms.css # Form components & buttons
โ”‚ โ”œโ”€โ”€ components.css # Components collection
โ”‚ โ”œโ”€โ”€ components/ # Complex UI components
โ”‚ โ”œโ”€โ”€ layout/ # Layout components (grid, containers)
โ”‚ โ”œโ”€โ”€ menu/ # Menu & navigation components
โ”‚ โ”œโ”€โ”€ patterns/ # UI patterns
โ”‚ โ””โ”€โ”€ regions/ # Page regions (header, footer, sidebar)
โ”œโ”€โ”€ effects/ # Effects & interactions
โ”‚ โ”œโ”€โ”€ interaction/ # Interaction effects
โ”‚ โ”œโ”€โ”€ layout-effects/ # Layout effects
โ”‚ โ”œโ”€โ”€ motion/ # Motion effects
โ”‚ โ”œโ”€โ”€ particles/ # Particle effects
โ”‚ โ”œโ”€โ”€ themes/ # Theme effects
โ”‚ โ”œโ”€โ”€ typography/ # Typography effects
โ”‚ โ””โ”€โ”€ visual/ # Visual effects
โ””โ”€โ”€ js/ # JavaScript helpers
โ”œโ”€โ”€ theme-switcher.js # Theme switching logic
โ””โ”€โ”€ viewTransitions.js # View transition helpers
```

**Layer hierarchy (excerpt):**
```css
@layer reset, tokens, custom-properties, core, logical-properties, colors, color-mix, layout, layout-queries, typography, utilities, smooth-scroll, accessibility, icons, components, animations, effects, themes;
```
See the [Layer System Documentation](LAYER-SYSTEM.md) for more details.

## Web Fonts

The library includes a collection of optimized Google Fonts in WOFF2 format for better performance and privacy. Using self-hosted fonts eliminates external requests to Google's servers and reduces load times.

### Directory Structure

The fonts are organized in an improved structure:

```
/fonts/
โ”œโ”€โ”€ fonts.css # Main CSS file with all variables and utility classes
โ”œโ”€โ”€ README.md # Documentation
โ”‚
โ”œโ”€โ”€ roboto/ # Each font has its own directory
โ”‚ โ”œโ”€โ”€ 400.css # CSS for regular weight
โ”‚ โ”œโ”€โ”€ 700.css # CSS for bold weight
โ”‚ โ”œโ”€โ”€ index.css # Imports all weights
โ”‚ โ”œโ”€โ”€ roboto-regular.woff2 # WOFF2 file for regular weight
โ”‚ โ””โ”€โ”€ roboto-bold.woff2 # WOFF2 file for bold weight
```

### Using the Fonts

You can include the fonts in different ways:

```css
/* Only the CSS variables and utility classes, without the fonts themselves */
@import '@casoon/dragonfly/fonts/fonts.css';

/* A specific font with all weights */
@import '@casoon/dragonfly/fonts/roboto/index.css';

/* Only a specific weight of a font */
@import '@casoon/dragonfly/fonts/roboto/400.css';
```

For Astro projects, you can simply import the CSS files as shown above. Vite (used by Astro) or Webpack will automatically analyze the CSS and include the font files in your project's build without requiring any plugins or manual copying. For more information, see the [Fonts README](fonts/README.md).

### Included Fonts

The library includes the following Google Fonts:

- **Anton** - Bold display font for large headlines
- **Arimo** - Sans-serif font with good readability
- **Bebas Neue** - Condensed uppercase font
- **Cabin** - Humanist sans-serif with a touch of warmth
- **DM Sans** - Low-contrast geometric sans-serif
- **Dosis** - Rounded sans-serif with even stroke weights
- **Fira Sans** - Versatile, legible sans-serif
- **Inconsolata** - Monospace font for code
- **Inter** - Modern typeface designed for computer screens
- **Josefin Sans** - Elegant geometric sans-serif
- **Lato** - Balanced sans-serif with classical proportions
- **Merriweather** - Serif designed for screen readability
- **Montserrat** - Urban typeface inspired by old posters
- **Mukta** - Multi-script font with support for Devanagari
- **Noto Sans** - Part of Google's font family with broad language support
- **Nunito** - Well-balanced sans-serif with rounded terminals
- **Open Sans** - Neutral and friendly sans-serif
- **Oswald** - Condensed alternative to standards like Impact
- **Playfair Display** - Serif with high-contrast strokes
- **Poppins** - Geometric sans-serif with uniform stroke width
- **PT Sans** - Universal font for wide language support
- **Quicksand** - Display sans-serif with rounded terminals
- **Raleway** - Elegant sans-serif with a single thin weight
- **Roboto** - Default Android font with natural reading rhythm
- **Roboto Condensed** - Space-efficient version of Roboto
- **Source Sans Pro** - Adobe's first open-source font
- **Teko** - Modernist, condensed typeface
- **Titillium Web** - Sans-serif designed by students
- **Ubuntu** - The Ubuntu operating system font
- **Work Sans** - Optimized for on-screen text usage

## Container Query Example

```html



Sidebar

Main content



```

## Container Layout System

The library provides a comprehensive container layout system with various specialized container types:

### Basic Containers
```html

Content

Medium width container

Container with large padding

```

### Positioned Containers
```html

Sticks to the top

Fixed to the bottom

Centered absolutely

```

### Special Containers
```html


Content with controlled height and scrolling


Item 1

Item 2


```

### Advanced Container Features
- **Visual containers:** Apply shadows, borders, and visual styling
- **Functional containers:** Create toasts, modals, dropdowns, and tooltips
- **Performance containers:** Optimize rendering with content-visibility
- **Accessibility containers:** Enhance keyboard navigation and screen reader support
- **Container queries:** Component-specific responsive behavior

## Link Button Components

The library includes specialized Link Button components in `ui/content.css` that work parallel to form buttons but are optimized for content areas and navigation links.

### Basic Link Buttons
```html

Navigate

Primary Action


?
Help

```

### Button Variants
```html

Primary
Secondary
Tertiary
Success
Warning
Danger
Info
Link Style
```

### Button Sizes
```html

Extra Small
Small
Medium (default)
Large
Extra Large
```

### Advanced Features
```html


โ†’
Continue


โ˜ฐ

Loading...

Disabled
```

### Styling Variants

#### Outline Buttons
```html

Outline Primary
Outline Secondary
Outline Success
Outline Danger
```

#### Ghost Buttons
```html

Ghost Primary
Ghost Success
Ghost Danger
```

#### Gradient Buttons
```html

Gradient Primary
Gradient Secondary
Gradient Success
Rainbow Gradient
```

#### Border Variants
```html

Thick Border
Dashed Border
Dotted Border
```

#### Border Radius Variants
```html

No Radius
Small Radius
Large Radius
Extra Large Radius
Fully Rounded
```

#### Shadow Effects
```html

With Shadow
Large Shadow
Inner Shadow
```

#### Glow Effects
```html

Glowing Primary
Glowing Success
Glowing Danger
```

#### Animated Buttons
```html

Scale on Hover
Bounce Effect
Pulse Effect
```

#### Special Effects
```html

Neumorphism
Glass Effect
Minimal Style
```

#### Layout Options
```html

Full Width Button
```

### Combining Variants
```html


Ultimate Button


โœ“
Success Action


Stylized Danger

```

### Key Features
- **Parallel to Form Buttons:** Works alongside `ui/forms.css` buttons without conflicts
- **Content Optimized:** Specifically designed for content areas and navigation
- **Full Accessibility:** Focus states, ARIA support, keyboard navigation
- **Modern CSS:** Uses CSS Nesting instead of BEM notation
- **Extensive Styling:** 15+ different styling variants and combinations
- **Visual Effects:** Gradients, shadows, glow, neumorphism, glass effects
- **Animations:** Bounce, pulse, scale, and custom hover effects
- **Border Options:** Solid, dashed, dotted, thick borders with various radius options
- **Layout Flexibility:** Full-width options and responsive behavior
- **Icon Support:** Built-in icon handling with proper spacing
- **State Management:** Loading, disabled, and focus states included

## Compatibility

The library uses progressive enhancement and fallback strategies to ensure broad browser compatibility:

- **Modern Browsers**: Full support for Chrome/Edge 90+, Firefox 90+, Safari 15+
- **Older Browsers**: Core functionality works in older browsers through fallbacks
- **Feature Detection**: Uses `@supports` rules instead of browser detection
- **CSS Variables**: Fallbacks for browsers without CSS Custom Properties
- **Container Queries**: Media Query fallbacks for older browsers
- **Color Functions**: RGB/HSL fallbacks for browsers without OKLCH support
- **Interpolate-size**: Graceful degradation for browsers without fluid sizing

### Known Compatibility Issues

#### Viewport Units (svh, svw)

**Affected Browsers:**
- Safari < 15.4
- Chrome < 108
- Firefox < 101

**Issue:** Small Viewport Units are not supported.

**Solution:** The library implements a fallback using regular viewport units (vh, vw) with CSS feature detection:

```css
@supports not (height: 1svh) {
.use-svh {
height: 100vh; /* Fallback */
}
}

@supports (height: 1svh) {
.use-svh {
height: 100svh;
}
}
```

#### Container Queries

**Affected Browsers:**
- Safari < 16
- Chrome < 105
- Firefox < 110

**Issue:** Container Queries are not supported.

**Solution:** The library uses Media Queries as fallbacks and provides a `no-container-queries` class for targeted styling.

## Browser Compatibility Tests

The library includes a browser compatibility test suite that covers:

- Viewport Units (vw, vh, svw, svh, lvw, lvh, dvw, dvh)
- Theme System with Dark/Light Mode
- Accessibility Features (focus rings, skip links, screen reader compatibility)
- CSS Feature Support Detection (container queries, layers, custom properties)
- Media Query Support (prefers-color-scheme, prefers-reduced-motion)

The tests are designed for compatibility with the following browsers:
- Modern browsers (Chrome, Firefox, Safari, Edge - latest versions)
- Older browsers (Chrome, Firefox, Safari, Edge - version 90+)

To run the tests:
```bash
# Start a local server
npx serve

# Access the test suite
# http://localhost:3000/tests/browser-compatibility/
```

The test files include:
- `viewport-units-test.html` - Tests for viewport unit implementation
- `theme-system-test.html` - Tests for theme switching and persistence
- `accessibility-test.html` - Tests for accessibility features

The test suite provides browser information and documents compatibility issues in `compatibility-issues.md`, helping developers identify and address browser-specific challenges when using the library.

## Fonts

The library includes a collection of optimized Google Fonts in WOFF2 format for better performance and privacy. Using self-hosted fonts eliminates external requests to Google's servers and reduces load times.

### Directory Structure

The fonts are organized in an improved structure:

```
/fonts/
โ”œโ”€โ”€ fonts.css # Main CSS file with all variables and utility classes
โ”œโ”€โ”€ README.md # Documentation
โ”‚
โ”œโ”€โ”€ roboto/ # Each font has its own directory
โ”‚ โ”œโ”€โ”€ 400.css # CSS for regular weight
โ”‚ โ”œโ”€โ”€ 700.css # CSS for bold weight
โ”‚ โ”œโ”€โ”€ index.css # Imports all weights
โ”‚ โ”œโ”€โ”€ roboto-regular.woff2 # WOFF2 file for regular weight
โ”‚ โ””โ”€โ”€ roboto-bold.woff2 # WOFF2 file for bold weight
```

### Using the Fonts

You can include the fonts in different ways:

```css
/* Only the CSS variables and utility classes, without the fonts themselves */
@import '@casoon/dragonfly/fonts/fonts.css';

/* A specific font with all weights */
@import '@casoon/dragonfly/fonts/roboto/index.css';

/* Only a specific weight of a font */
@import '@casoon/dragonfly/fonts/roboto/400.css';
```

For Astro projects, you can simply import the CSS files as shown above. Vite (used by Astro) or Webpack will automatically analyze the CSS and include the font files in your project's build without requiring any plugins or manual copying.

## Custom Components

You can add your own components in the `components` layer:
```css
@layer components {
.my-component {
padding: var(--space-4);
color: var(--color-primary);
border-radius: var(--radius-md);
}
}
```

## Compatibility

The library employs progressive enhancement and fallback strategies to ensure wide browser compatibility:

- **Modern Browsers**: Full support for Chrome/Edge 90+, Firefox 90+, Safari 15+
- **Older Browsers**: Core functionality works in older browsers through fallbacks
- **Feature Detection**: Uses `@supports` rules instead of browser detection
- **CSS Variables**: Fallbacks provided for browsers without CSS Custom Properties
- **Container Queries**: Media Query fallbacks for older browsers
- **Color Functions**: RGB/HSL fallbacks for browsers without OKLCH support
- **interpolate-size**: Graceful degradation for browsers without fluid sizing

For detailed compatibility information, browser support charts, and implemented fallback strategies, see the [Documentation](DOCUMENTATION.md).

## Testing

### ๐Ÿงช Enhanced Testing Features (v0.7.5)
- **โœ… 100% Lint-free CSS Codebase**: All 234+ CSS files pass Stylelint tests without errors
- **๐Ÿ”ง Advanced CSS Validation**: Systematic verification against modern CSS standards with Stylelint
- **โšก JavaScript Quality Assurance**: Modern JavaScript linting and formatting with Biome
- **๐Ÿ“Š Hybrid Linting Approach**: Specialized tools for each language (Stylelint for CSS, Biome for JS)
- **๐Ÿš€ Optimized Performance Tests**: Faster test execution through modern syntax

### Linting & Testing Commands
```bash
# Run all tests (CSS + JS Lint + Lightning CSS)
npm run test:all

# Combined linting (CSS + JavaScript)
npm run lint

# CSS linting only (Stylelint)
npm run lint:css

# JavaScript linting only (Biome)
npm run lint:js

# Auto-fix CSS issues
npm run lint:css:fix

# Auto-fix JavaScript issues
npm run lint:js:fix

# Format JavaScript code
npm run format:js

# Lightning CSS tests only
npm run test:lightningcss
```

### Quality Assurance Results
- **234+ CSS Files**: All successfully validated with Stylelint
- **28 JavaScript Files**: Linted with Biome for modern code quality
- **0 CSS Lint Errors**: Completely error-free CSS codebase
- **Hybrid Tooling**: Best-in-class tools for each language
- **Modern CSS Features**: Container Queries, CSS Nesting, CSS Layers fully supported
- **Modern JavaScript**: ES6+, Node.js protocols, optimized patterns
- **Cross-Browser Compatibility**: Tested on Chrome, Firefox, Safari, Edge

### Browser Compatibility Tests
The library includes a browser compatibility testing suite that covers:

- Viewport Units (vw, vh, svw, svh, lvw, lvh, dvw, dvh)
- Theme System with Dark/Light Mode
- Accessibility Features (focus rings, skip links, screen reader compatibility)
- CSS Feature Support Detection (container queries, layers, custom properties)
- Media Query Support (prefers-color-scheme, prefers-reduced-motion)

The tests are designed to ensure compatibility across:
- Modern browsers (Chrome, Firefox, Safari, Edge - latest versions)
- Older browsers (Chrome, Firefox, Safari, Edge - version 90+)

To run the tests:
```bash
# Start a local server
npx serve

# Access the test suite
# http://localhost:3000/tests/browser-compatibility/
```

The test files include:
- `viewport-units-test.html` - Tests for viewport unit implementation
- `theme-system-test.html` - Tests for theme switching and persistence
- `accessibility-test.html` - Tests for accessibility features

The test suite provides browser information and documents compatibility issues in `compatibility-issues.md`, helping developers identify and address browser-specific challenges when using the library.

### Container Compatibility Tests
Additional tests for container queries and related layout features are available in the `tests/container-compatibility` directory.

## Documentation

The library comes with comprehensive documentation to help you get started:

- **[DOCUMENTATION.md](DOCUMENTATION.md)** - Comprehensive documentation with architecture, goals and compatibility information
- **[STYLE-GUIDE.md](STYLE-GUIDE.md)** - Detailed style guide for using the library
- **[LAYER-SYSTEM.md](LAYER-SYSTEM.md)** - Explanation of the CSS layer system
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Guidelines for contributing to the project
- **[PUBLISHING.md](PUBLISHING.md)** - Information about the publishing process
- **[GOOGLE-FONTS-LICENSE.md](GOOGLE-FONTS-LICENSE.md)** - License information for the Google Fonts used
- **[ICONS-LICENSE.md](ICONS-LICENSE.md)** - License information for the icons used

## License
MIT

## Contributing
Contributions welcome! See [Contribution Guidelines](CONTRIBUTING.md).