# tancredi/fantasticon architecture

> Architecture diagram of the GitHub repository tancredi/fantasticon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tancredi/fantasticon
- Repository: https://github.com/tancredi/fantasticon

## Overview

##### Main Components

a. Input Layer:
- SVG Files Input Directory
- Configuration System (.fantasticonrc files)
- CLI Interface

b. Core Processing Layer:
- Configuration Parser
- Runner System
- Asset Generation Pipeline

c. Generators Layer:
- Font Generators (TTF, WOFF, WOFF2, EOT, SVG)
- Asset Generators (CSS, SCSS, SASS, HTML, JSON, TypeScript)

d. Utility Layer:
- File System Operations
- Template Processing
- Asset Utilities
- Validation Systems

**┌─ Input Layer ─────┐     ┌─ Core Layer ──────┐     ┌─ Output Layer ────┐**
- CLI Interface   │ --> │ - Config Parser   │ --> │ - Font Files      │
- Config Files    │     │ - Runner          │     │ - Style Sheets    │
- SVG Directory   │     │ - Asset Generator │     │ - Type Definitions│
- ┬─┘     └─────────────────┬─┘     └─────────────────┬─┘

- > Utility Layer <─────────────────────────┘
- FS Operations
- Templates
- Validation

##### Key Relationships to Highlight

a. Data Flow:
- SVG Files → Configuration Parser → Asset Generation
- Configuration → Runner → Output Files
- Templates → Asset Generation → Final Assets

b. Dependencies:
- CLI depends on Configuration Parser
- Generators depend on Utility Layer
- Asset Generation depends on Font Generation

##### Important Details

a. Supported Input Types:
- SVG files
- Configuration files (.fantasticonrc)

b. Output Asset Types:
- Fonts: TTF, WOFF, WOFF2, EOT, SVG
- Assets: CSS, SCSS, SASS, HTML, JSON, TS

c. Configuration Options:
- Font options (height, descent, normalize)
- Asset options (templates, formats)
- Path options

##### Implementation Notes

- The modular nature of the generator system
- The extensibility of asset types
- The configuration flexibility
- The template-based generation system

## Diagram (Mermaid)

```mermaid
graph TB
    %% Input Layer
    subgraph Input
        CLI["CLI Interface"]:::input
        Config["Configuration System"]:::input
        SVG["SVG Files Input"]:::input
    end

    %% Core Layer
    subgraph Core
        Parser["Configuration Parser"]:::core
        Runner["Runner System"]:::core
        AssetGen["Asset Generation Pipeline"]:::core
    end

    %% Generators Layer
    subgraph Generators
        subgraph FontGen["Font Generators"]
            TTF["TTF"]:::generator
            WOFF["WOFF"]:::generator
            WOFF2["WOFF2"]:::generator
            EOT["EOT"]:::generator
            SVGFont["SVG Font"]:::generator
        end

        subgraph AssetGen2["Asset Generators"]
            CSS["CSS"]:::generator
            SCSS["SCSS"]:::generator
            SASS["SASS"]:::generator
            HTML["HTML"]:::generator
            JSON["JSON"]:::generator
            TS["TypeScript"]:::generator
        end
    end

    %% Utility Layer
    subgraph Utils
        FSOps["File System Operations"]:::utility
        Template["Template Processing"]:::utility
        AssetUtil["Asset Utilities"]:::utility
        Validation["Validation Systems"]:::utility
    end

    %% Templates
    subgraph Templates
        CSSTemp["CSS Template"]:::template
        SCSSTemp["SCSS Template"]:::template
        SASSTemp["SASS Template"]:::template
        HTMLTemp["HTML Template"]:::template
    end

    %% Relationships
    CLI --> Parser
    Config --> Parser
    SVG --> Runner
    Parser --> Runner
    Runner --> AssetGen
    AssetGen --> FontGen
    AssetGen --> AssetGen2
    Template --> AssetGen2
    Templates --> Template

    %% Utility Dependencies
    FSOps --> Runner
    FSOps --> AssetGen
    Template --> AssetGen2
    AssetUtil --> AssetGen
    Validation --> Parser
    Validation --> Runner

    %% Click Events
    click CLI "https://github.com/tancredi/fantasticon/blob/master/src/cli/index.ts"
    click Config "https://github.com/tancredi/fantasticon/blob/master/src/cli/config-loader.ts"
    click Parser "https://github.com/tancredi/fantasticon/blob/master/src/core/config-parser.ts"
    click Runner "https://github.com/tancredi/fantasticon/blob/master/src/core/runner.ts"
    click AssetGen "https://github.com/tancredi/fantasticon/blob/master/src/generators/generate-assets.ts"
    click TTF "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/ttf.ts"
    click WOFF "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/woff.ts"
    click WOFF2 "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/woff2.ts"
    click EOT "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/eot.ts"
    click SVGFont "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/svg.ts"
    click CSS "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/css.ts"
    click SCSS "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/scss.ts"
    click SASS "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/sass.ts"
    click HTML "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/html.ts"
    click JSON "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/json.ts"
    click TS "https://github.com/tancredi/fantasticon/blob/master/src/generators/asset-types/ts.ts"
    click FSOps "https://github.com/tancredi/fantasticon/blob/master/src/utils/fs-async.ts"
    click Template "https://github.com/tancredi/fantasticon/blob/master/src/utils/template.ts"
    click AssetUtil "https://github.com/tancredi/fantasticon/blob/master/src/utils/assets.ts"
    click Validation "https://github.com/tancredi/fantasticon/blob/master/src/utils/validation.ts"
    click CSSTemp "https://github.com/tancredi/fantasticon/blob/master/templates/css.hbs"
    click SCSSTemp "https://github.com/tancredi/fantasticon/blob/master/templates/scss.hbs"
    click SASSTemp "https://github.com/tancredi/fantasticon/blob/master/templates/sass.hbs"
    click HTMLTemp "https://github.com/tancredi/fantasticon/blob/master/templates/html.hbs"

    %% Styles
    classDef input fill:#a8d1ff,stroke:#333,stroke-width:1px
    classDef core fill:#90EE90,stroke:#333,stroke-width:1px
    classDef generator fill:#FFB347,stroke:#333,stroke-width:1px
    classDef utility fill:#E6E6E6,stroke:#333,stroke-width:1px
    classDef template fill:#DDA0DD,stroke:#333,stroke-width:1px

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Components"]:::core
        L3["Generators"]:::generator
        L4["Utilities"]:::utility
        L5["Templates"]:::template
    end
```
