JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 452
  • Score
    100M100P100Q73052F
  • License MIT

Modular, lightweight CSS framework and design system for modern web projects. Optimized for Astro JS, LightningCSS and Container Queries with @layer-based architecture and comprehensive accessibility.

Package Exports

  • @casoon/dragonfly
  • @casoon/dragonfly/index.css

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@casoon/dragonfly) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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
  2. Installation
  3. Usage
  4. Goals and Requirements
  5. Architecture
  6. CSS Layer System
  7. Layer & File Structure
  8. Compatibility
  9. Browser Compatibility Tests
  10. Fonts
  11. Custom Components
  12. Documentation
  13. Contributing
  14. 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

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:

<link rel="stylesheet" href="path/to/@casoon/dragonfly/index.css">

With Bundler:

import '@casoon/dragonfly/index.css';

With 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:

<link rel="stylesheet" href="path/to/@casoon/dragonfly/dist/index.min.css">

With Bundler:

import '@casoon/dragonfly/dist/index.min.css';

With Astro:

import '@casoon/dragonfly/dist/index.min.css';

Via unpkg.com CDN:

<link rel="stylesheet" href="https://unpkg.com/@casoon/dragonfly/dist/index.min.css">

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:

<!-- Base CSS -->
<link rel="stylesheet" href="https://unpkg.com/@casoon/dragonfly/dist/index.min.css">
<!-- Additional components as needed -->
<link rel="stylesheet" href="https://unpkg.com/@casoon/dragonfly/effects/visual/shadows.css">
<link rel="stylesheet" href="https://unpkg.com/@casoon/dragonfly/ui/components/card.css">

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

@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.

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):

@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 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:

/* 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.

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

<div class="container-query">
  <div class="layout-flex sm:flex-row md:gap-6 lg:flex-nowrap">
    <div class="sm:flex-basis-1-3">Sidebar</div>
    <div class="sm:flex-basis-2-3">Main content</div>
  </div>
</div>

Container Layout System

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

Basic Containers

<!-- Standard container with centered content and responsive padding -->
<div class="container">Content</div>

<!-- Container with specific size constraint -->
<div class="container container-md">Medium width container</div>

<!-- Container with custom padding -->
<div class="container container-padding-lg">Container with large padding</div>

Positioned Containers

<!-- Sticky containers -->
<div class="container-sticky-top">Sticks to the top</div>

<!-- Fixed containers -->
<div class="container-fixed-bottom">Fixed to the bottom</div>

<!-- Absolute containers -->
<div class="container-absolute-center">Centered absolutely</div>

Special Containers

<!-- Scrollable container -->
<div class="container-scrollable-md">
  Content with controlled height and scrolling
</div>

<!-- Masonry layout -->
<div class="container-masonry-3">
  <div class="masonry-item">Item 1</div>
  <div class="masonry-item">Item 2</div>
</div>

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

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 button -->
<a href="/page" class="link-button">Navigate</a>

<!-- Primary action link -->
<a href="/action" class="link-button primary">Primary Action</a>

<!-- Secondary link with icon -->
<a href="/help" class="link-button secondary with-icon">
  <span class="icon">?</span>
  Help
</a>

Button Variants

<!-- All available variants -->
<a href="#" class="link-button primary">Primary</a>
<a href="#" class="link-button secondary">Secondary</a>
<a href="#" class="link-button tertiary">Tertiary</a>
<a href="#" class="link-button success">Success</a>
<a href="#" class="link-button warning">Warning</a>
<a href="#" class="link-button danger">Danger</a>
<a href="#" class="link-button info">Info</a>
<a href="#" class="link-button link">Link Style</a>

Button Sizes

<!-- Size variants -->
<a href="#" class="link-button xs">Extra Small</a>
<a href="#" class="link-button sm">Small</a>
<a href="#" class="link-button md">Medium (default)</a>
<a href="#" class="link-button lg">Large</a>
<a href="#" class="link-button xl">Extra Large</a>

Advanced Features

<!-- Icon support -->
<a href="#" class="link-button primary with-icon">
  <span class="icon">โ†’</span>
  Continue
</a>

<!-- Icon-only button -->
<a href="#" class="link-button icon-only" aria-label="Menu">
  <span class="icon">โ˜ฐ</span>
</a>

<!-- Loading state -->
<a href="#" class="link-button primary loading">Loading...</a>

<!-- Disabled state -->
<a href="#" class="link-button disabled">Disabled</a>

Styling Variants

Outline Buttons

<!-- Outline variants with hover fill effect -->
<a href="#" class="link-button outline primary">Outline Primary</a>
<a href="#" class="link-button outline secondary">Outline Secondary</a>
<a href="#" class="link-button outline success">Outline Success</a>
<a href="#" class="link-button outline danger">Outline Danger</a>

Ghost Buttons

<!-- Subtle ghost buttons with transparent backgrounds -->
<a href="#" class="link-button ghost primary">Ghost Primary</a>
<a href="#" class="link-button ghost success">Ghost Success</a>
<a href="#" class="link-button ghost danger">Ghost Danger</a>

Gradient Buttons

<!-- Beautiful gradient effects -->
<a href="#" class="link-button gradient primary">Gradient Primary</a>
<a href="#" class="link-button gradient secondary">Gradient Secondary</a>
<a href="#" class="link-button gradient success">Gradient Success</a>
<a href="#" class="link-button gradient rainbow">Rainbow Gradient</a>

Border Variants

<!-- Different border styles -->
<a href="#" class="link-button border-thick primary">Thick Border</a>
<a href="#" class="link-button border-dashed primary">Dashed Border</a>
<a href="#" class="link-button border-dotted primary">Dotted Border</a>

Border Radius Variants

<!-- Border radius options -->
<a href="#" class="link-button rounded-none">No Radius</a>
<a href="#" class="link-button rounded-sm">Small Radius</a>
<a href="#" class="link-button rounded-lg">Large Radius</a>
<a href="#" class="link-button rounded-xl">Extra Large Radius</a>
<a href="#" class="link-button rounded-full">Fully Rounded</a>

Shadow Effects

<!-- Shadow variants for depth -->
<a href="#" class="link-button primary shadow">With Shadow</a>
<a href="#" class="link-button primary shadow-lg">Large Shadow</a>
<a href="#" class="link-button primary shadow-inner">Inner Shadow</a>

Glow Effects

<!-- Glowing buttons for attention -->
<a href="#" class="link-button primary glow">Glowing Primary</a>
<a href="#" class="link-button success glow">Glowing Success</a>
<a href="#" class="link-button danger glow">Glowing Danger</a>

Animated Buttons

<!-- Interactive animations -->
<a href="#" class="link-button primary animated">Scale on Hover</a>
<a href="#" class="link-button primary bounce">Bounce Effect</a>
<a href="#" class="link-button primary pulse">Pulse Effect</a>

Special Effects

<!-- Modern design effects -->
<a href="#" class="link-button neumorphism">Neumorphism</a>
<a href="#" class="link-button glass">Glass Effect</a>
<a href="#" class="link-button minimal">Minimal Style</a>

Layout Options

<!-- Full width button -->
<a href="#" class="link-button primary full-width">Full Width Button</a>

Combining Variants

<!-- Mix and match for unique styles -->
<a href="#" class="link-button primary gradient shadow-lg rounded-lg animated">
  Ultimate Button
</a>

<a href="#" class="link-button outline success rounded-full with-icon glow">
  <span class="icon">โœ“</span>
  Success Action
</a>

<a href="#" class="link-button ghost danger lg border-dashed">
  Stylized Danger
</a>

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:

@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:

# 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:

/* 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:

@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.

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

# 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:

# 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:

License

MIT

Contributing

Contributions welcome! See Contribution Guidelines.