# vectordxy/stayedcss architecture

> Architecture diagram of the GitHub repository vectordxy/stayedcss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vectordxy/stayedcss
- Repository: https://github.com/vectordxy/stayedcss

## Overview

##### Main Components

a) Core Processing Layer:
- Style Generation System (/src/styles/generate)
- Syntax Processing System (/src/styles/syntax)
- Type System (/src/types)

b) Client Integration Layer:
- Client API (/src/main/client/api)
- Static API (/src/main/static/api)

c) Style Processing Pipeline:
- Style Generation
- Syntax Checking
- CSS Output

**┌─ Application Layer ─────────────────┐**
- Next.js App (Server/Client Components) │
- ┬────────────────────┘
- ↓
**┌─ StayedCSS API Layer ──────────────┐**
- useStyle()                       │
- useClientStyle()                 │
- changeScreenMode()               │
- ┬────────────────────┘
- ↓
**┌─ Processing Layer ────────────────┐**
- ┌─ Style Generation ─┐           │
- Class Names      │           │
- Style Rules      │           │
- ┘            │
- ┌─ Syntax Processing ┐          │
- Combinators      │          │
- Pseudo Classes   │          │
- Media Queries    │          │
- ┘            │
- ┬────────────────┘
- ↓
**┌─ Output Layer ──────────────────┐**
- Static CSS Generation           │
- ┘

##### Important Relationships

- Flow of style processing from input through syntax checking to final CSS generation
- Separation between server and client components
- Dark mode transition handling

##### Technical Details

- Support for CSS-like syntax
- Breakpoint handling system
- Media query processing
- Pseudo-class/element support
- Component ID management
- Static/Dynamic style generation

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef api fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef output fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Application Layer
    AppLayer["Next.js App (Server/Client Components)"]:::external

    %% API Layer
    subgraph APILayer["API Layer"]
        ClientAPI["Client API"]:::api
        StaticAPI["Static API"]:::api
        
        %% Client API Components
        UseClientStyle["useClientStyle"]:::api
        ChangeMode["changeScreenMode"]:::api
        SaveMode["saveScreenMode"]:::api
        
        %% Static API Components
        UseStyle["useStyle"]:::api
        RequestStyles["requestStyles"]:::api
    end

    %% Processing Layer
    subgraph ProcessingLayer["Processing Layer"]
        %% Syntax System
        SyntaxSystem["Syntax Processing System"]:::processing
        
        %% Style Generation
        StyleGen["Style Generation System"]:::processing
        
        %% File Processing
        FileProcess["File Processing System"]:::processing
        
        %% Type System
        TypeSystem["Type System"]:::processing
        
        %% Syntax Checkers
        Combinators["Combinator Checker"]:::processing
        PseudoClasses["Pseudo Classes Checker"]:::processing
        PseudoElements["Pseudo Elements Checker"]:::processing
        Units["Units Checker"]:::processing
    end

    %% Output Layer
    OutputCSS["Generated Static CSS"]:::output

    %% Relationships
    AppLayer --> ClientAPI
    AppLayer --> StaticAPI
    
    ClientAPI --> SyntaxSystem
    StaticAPI --> SyntaxSystem
    
    SyntaxSystem --> StyleGen
    StyleGen --> OutputCSS
    
    FileProcess --> StyleGen
    TypeSystem --> StyleGen
    TypeSystem --> SyntaxSystem

    %% Click Events
    click StyleGen "https://github.com/vectordxy/stayedcss/tree/main//src/styles/generate"
    click SyntaxSystem "https://github.com/vectordxy/stayedcss/tree/main//src/styles/syntax"
    click TypeSystem "https://github.com/vectordxy/stayedcss/tree/main//src/types"
    click ClientAPI "https://github.com/vectordxy/stayedcss/tree/main//src/main/client/api"
    click StaticAPI "https://github.com/vectordxy/stayedcss/tree/main//src/main/static/api"
    click UseClientStyle "https://github.com/vectordxy/stayedcss/blob/main//src/main/client/api/useClientStyle.ts"
    click ChangeMode "https://github.com/vectordxy/stayedcss/blob/main//src/main/client/api/changeScreenMode.ts"
    click SaveMode "https://github.com/vectordxy/stayedcss/blob/main//src/main/client/api/saveScreenMode.ts"
    click UseStyle "https://github.com/vectordxy/stayedcss/blob/main//src/main/static/api/useStyle.ts"
    click RequestStyles "https://github.com/vectordxy/stayedcss/blob/main//src/main/static/api/requestStyles.ts"
    click FileProcess "https://github.com/vectordxy/stayedcss/tree/main//src/styles/generate/utils/files"
    click Combinators "https://github.com/vectordxy/stayedcss/blob/main//src/styles/syntax/checker/checkCombinators.ts"
    click PseudoClasses "https://github.com/vectordxy/stayedcss/blob/main//src/styles/syntax/checker/checkPseudoClasses.ts"
    click PseudoElements "https://github.com/vectordxy/stayedcss/blob/main//src/styles/syntax/checker/checkPseudoElements.ts"
    click Units "https://github.com/vectordxy/stayedcss/blob/main//src/styles/syntax/checker/checkUnits.ts"

    %% Legend
    subgraph Legend
        API["API Component"]:::api
        Process["Processing Component"]:::processing
        Out["Output Component"]:::output
        Ext["External System"]:::external
    end
```
