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

https://github.com/dev-ignis/forge


https://github.com/dev-ignis/forge

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# @nexcraft/forge

[![npm version](https://img.shields.io/npm/v/@nexcraft/forge.svg)](https://www.npmjs.com/package/@nexcraft/forge)
[![Bundle Size](https://img.shields.io/badge/bundle%20size-<10KB-brightgreen.svg)](https://bundlephobia.com/package/@nexcraft/forge)
[![Test Coverage](https://img.shields.io/badge/coverage-86.4%25-brightgreen.svg)](./coverage)
[![WCAG 2.1 AA](https://img.shields.io/badge/WCAG%202.1-AA-blue.svg)](https://www.w3.org/WAI/WCAG21/quickref/)
[![AI-Ready](https://img.shields.io/badge/AI-Ready-purple.svg)](./docs/ai-metadata-system.md)
[![Performance Monitored](https://img.shields.io/badge/Performance-Monitored-orange.svg)](./docs/performance-monitoring.md)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)

> **"Write Once, Use Forever"** - A future-proof UI component library built on web standards that will outlive framework trends.

**The ONLY component library with built-in AI metadata, design token bridge, and real-time performance dashboard.** Every component knows its state, explains its actions, and monitors its own performance with a visual dashboard. Plus, import design tokens from any system (Figma, Tailwind, Material Design) with zero configuration - making it perfect for AI-powered applications and design-system-driven development.

## ๐ŸŽฏ Why Choose @nexcraft/forge?

### ๐Ÿ†š **The Competition Can't Do This:**
```javascript
// Other Libraries: Components are "dumb"
Click // That's it.

// @nexcraft/forge: Components are intelligent!
const button = document.querySelector('forge-button');

// ๐Ÿค– AI Integration Built-In
button.explainState() // "Button is primary variant, enabled, ready for interaction"
button.getPossibleActions() // [{name: 'click', available: true, description: '...'}]
button.aiState // {variant: 'primary', disabled: false, renderTime: 0.8ms}

// ๐ŸŽจ Design System Integration (Industry First!)
import { TokenBridge } from '@nexcraft/forge/utils';
const bridge = TokenBridge.fromFigma(figmaTokens); // Import from ANY design system!
const css = bridge.toCSSProperties(); // Automatic CSS generation
// Works with Figma, Tailwind, Material Design, and more!

// โšก Performance Self-Monitoring
button.setAttribute('max-render-ms', '2'); // Auto-optimizes if slow!
button.performanceMode = 'auto'; // Degrades gracefully on slow devices

// ๐ŸŽจ True Style Isolation (Shadow DOM)
// Your styles NEVER conflict, GUARANTEED
```

### ๐Ÿ’ก **Real-World Benefits:**
- **AI Apps**: Components provide context to LLMs automatically
- **Design Systems**: Import tokens from Figma, Tailwind, Material Design automatically
- **Performance**: Self-optimizing components that never slow down
- **Migration**: Move from React to Vue to Angular without changing components
- **Micro-frontends**: Multiple versions coexist without conflicts
- **Future-proof**: Built on web standards, not framework trends

## ๐Ÿš€ Quick Start (30 Seconds!)

### Option 1: Zero-Config CDN (Instant!)
```html

Click Me

```

### Option 2: NPM Installation
```bash
npm install @nexcraft/forge
```

#### Works with EVERY Framework (Same Code!)
```javascript
// Import once, use everywhere
import '@nexcraft/forge';

// React Example
function App() {
const button = useRef();

useEffect(() => {
// Access AI features!
console.log(button.current.explainState());
}, []);

return Click
}

// Vue Example

Click

// Angular Example
Click

// Vanilla JS - Full Power!
const btn = document.querySelector('forge-button');
console.log(btn.getPossibleActions()); // AI-ready!
```

### Development Setup
```bash
# Clone and setup
git clone https://github.com/nexcraft/forge.git
cd forge
npm install

# Start development
npm run dev # Component development
npm run storybook # Interactive documentation
npm run test # Run tests
```

## ๐Ÿ“š Documentation

### Getting Started
- **[Quick Start Guide](./plans/quick-start-guide.md)** - Get your first component running in 4 hours
- **[Unique Value Proposition](./plans/unique-value-proposition.md)** - Why @nexcraft/forge is different
- **[Component Architecture](./plans/architecture/component-architecture.md)** - Learn our patterns and conventions

### Core Features
- **[๐ŸŽจ Token Bridge Complete Guide](./docs/theming/token-bridge-guide.md)** - Import design tokens from any system
- **[๐ŸŽจ Token Bridge API Reference](./docs/theming/token-bridge-api.md)** - Complete API documentation
- **[๐Ÿ”„ Token Bridge Migration Guide](./docs/theming/token-migration-guide.md)** - Migrate from existing token systems
- **[โšก Performance Dashboard Guide](./docs/guides/performance-dashboard-guide.md)** - Real-time performance monitoring and dashboard
- **[โšก Performance Dashboard API](./docs/performance-dashboard-api.md)** - Complete Performance Dashboard API
- **[โšก Performance Monitoring](./docs/performance-monitoring.md)** - Advanced performance monitoring system

### Architecture & Planning
- **[Implementation Roadmap](./plans/implementation-roadmap.md)** - 6-month development timeline with all differentiators
- **[Architecture Decision Records](./plans/adrs/)** - 14 key technical decisions including AI-ready components
- **[Technology Stack](./plans/architecture/technology-stack.md)** - Core technology choices

## โœจ The "Shiny" Stuff - What Makes Us Special

### ๐Ÿค– **AI-Ready Components** (Industry First!)
Every single component can talk to AI systems out of the box:
```javascript
const button = document.querySelector('forge-button');

// Ask component to explain itself
console.log(button.explainState());
// "Button is enabled and primary variant. Not loading. Ready for click interaction."

// Get possible actions for AI agents
console.log(button.getPossibleActions());
// [{ name: 'click', description: 'Trigger button action', available: true }]

// Access real-time state for AI context
console.log(button.aiState);
// { variant: 'primary', disabled: false, loading: false, renderTime: 0.8ms }
```

### ๐ŸŽจ **Design Token Bridge** (Industry First!)
Import design tokens from ANY design system with zero configuration:
```javascript
import { TokenBridge } from '@nexcraft/forge/utils';

// Import from Figma, Tailwind, Material Design, or any design system
const bridge = TokenBridge.fromFigma(figmaTokens);
const css = bridge.toCSSProperties();

// Automatic CSS generation - always in sync with your design system!
// :root { --forge-brand-primary-500: #3b82f6; }
```

### โšก **Performance Dashboard** (Unique Feature!)
Real-time performance monitoring with visual dashboard:
```html

Self-optimizing tooltip with real-time metrics!

```

```javascript
// Programmatic access to performance data
import { performanceDashboard } from '@nexcraft/forge/utils';

const metrics = performanceDashboard.getAllMetrics();
const slowComponents = performanceDashboard.getSlowComponents(16);
// Real-time performance insights for every component!
```

### ๐ŸŽฏ **True Differentiators**
| Feature | @nexcraft/forge | Other Libraries |
|---------|-----------------|-----------------|
| **AI Metadata** | โœ… Built into every component | โŒ Not available |
| **Design Token Bridge** | โœ… Import from any design system | โŒ Manual token management |
| **Performance Dashboard** | โœ… Real-time visual dashboard + auto-degradation | โŒ External tools needed |
| **Framework Independence** | โœ… True Web Components | โš ๏ธ Framework wrappers |
| **Style Isolation** | โœ… Shadow DOM guaranteed | โš ๏ธ CSS-in-JS conflicts |
| **Bundle Size** | โœ… <10KB per component | โŒ 50-200KB typical |
| **Future Proof** | โœ… Web standards forever | โš ๏ธ Framework dependent |

### ๐Ÿš€ **Zero-Config Magic**
```html

Click Me

```

## ๐Ÿ—๏ธ Architecture

### Core Technologies
- **[Lit 3.2.0](https://lit.dev/)** - Web Components framework
- **[TypeScript 5.3.3](https://www.typescriptlang.org/)** - Type safety
- **[Vite 5.0.10](https://vitejs.dev/)** - Build tool and dev server
- **[Storybook 7.x](https://storybook.js.org/)** - Component development environment

### Key Principles
1. **Web Standards First** - Built on Custom Elements, Shadow DOM, and CSS Custom Properties
2. **True Encapsulation** - Shadow DOM ensures style isolation
3. **Properties Down, Events Up** - Unidirectional data flow
4. **Composition Over Configuration** - Small, focused, composable components

## ๐Ÿ“ฆ Components Showcase

### ๐Ÿ›๏ธ **Organism Components** (Phase 3 - Production Ready!)
Complex, full-featured components built from atoms and molecules:

| Component | AI Features | Performance Features | Unique Capabilities |
|-----------|-------------|---------------------|-------------------|
| **๐Ÿ“ Tabs** | Tab prediction | Lazy panel loading | Drag-to-reorder, closeable tabs, keyboard nav |
| **๐Ÿ”ข Pagination** | Page suggestion | Optimized renders | Multiple modes, customizable sizes |
| **๐Ÿฆญ Navigation Bar** | Smart menus | Responsive modes | Mobile drawer, user actions, search |
| **๐Ÿ“Š Data Table** | Sort prediction | Virtual scrolling | Multi-sort, selection, expandable rows |
| **๐ŸŽต Accordion** | Panel management | Lazy content | Multi-expand, animations, icons |
| **๐ŸŒณ Tree View** | Node navigation | Lazy loading | Drag-drop, checkboxes, search |

### ๐ŸŒŸ **Molecule Components** (Phase 2 - Production Ready!)
Advanced components that combine atoms:

| Component | AI Features | Performance Features | Unique Capabilities |
|-----------|-------------|---------------------|-------------------|
| **๐ŸŽฏ Tooltip** | Self-positioning AI | <1ms render | Smart viewport detection, auto-repositioning |
| **๐Ÿ“… DatePicker** | Date prediction | Lazy calendar | i18n support, range selection, constraints |
| **๐Ÿ”ฝ Dropdown** | Action suggestions | Virtual scrolling | Nested menus, keyboard nav, groups |
| **๐Ÿ“ FormField** | Validation AI | Input optimization | Floating labels, inline variants |
| **๐ŸŽญ Modal** | Focus management | Stacking optimization | Focus trap, backdrop blur, size variants |
| **๐Ÿ—‚๏ธ MultiSelect** | Smart filtering | Bulk operations | Tag display, search highlighting |
| **๐Ÿƒ Card** | Content analysis | Elevation shadows | 6 levels, media support, skeleton states |

### โš™๏ธ **Atomic Components** (Phase 1 - Foundation)
Foundation components with comprehensive test coverage:

| Component | Test Coverage | Key Features |
|-----------|--------------|--------------|
| **Button** | 92.38% | 5 variants, ripple effect, loading states |
| **Input** | 84.56% | 7 types, validation, clearable |
| **Icon** | 78.38% | Registry system, lazy loading |
| **Alert** | 97.02% | Auto-dismiss, animations |
| **Checkbox** | 98.50% | Indeterminate state |
| **Badge** | 100% | Count/dot modes, positions |
| **Switch** | 98.50% | Loading state, custom labels |
| **RadioGroup** | 93.79% | Group management, keyboard nav |
| **Select** | 84.69% | Search/filter, groups |

### ๐Ÿ“Š **Component Stats**
- **Total Components**: 22 production-ready (9 atoms + 7 molecules + 6 organisms)
- **Overall Test Coverage**: 86.4%
- **Total Tests**: 860 passing (100% pass rate)
- **Performance**: All components <2ms render
- **Accessibility**: 100% WCAG 2.1 AA compliant
- **AI Coverage**: 100% metadata implementation
- **ADR Compliance**: 100% compliant with all 16 ADRs

### Roadmap
See our **[Implementation Roadmap](./plans/implementation-roadmap.md)** for the complete component timeline.

## ๐Ÿงช Testing

```bash
# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Visual regression
npm run test:visual

# All tests
npm run test:all
```

Our comprehensive testing strategy includes:
- โœ… Unit tests (90%+ coverage)
- โœ… Visual regression (Chromatic)
- โœ… Cross-framework E2E tests
- โœ… Accessibility audits
- โœ… Performance benchmarks

## ๐Ÿค Contributing

We welcome contributions! Please see our **[Contributing Guide](./docs/CONTRIBUTING.md)** for details.

### Quick Commands
```bash
# Generate a new component
npm run generate:component MyComponent atoms

# Run linting
npm run lint

# Run type checking
npm run type-check

# Run all tests
npm run test:all
```

## ๐Ÿ“Š Performance & Quality Metrics

### ๐Ÿ† **Phase 3 Complete - Production Ready!**
| Metric | Target | Current | Status |
|--------|--------|---------|--------|
| **AI Metadata Coverage** | 100% | **100%** | โœ… ACHIEVED |
| **Performance Monitoring** | Built-in | **Fully Implemented** | โœ… ACHIEVED |
| **Atom Components** | 9 core | **9/9** | โœ… COMPLETED |
| **Molecule Components** | 7 planned | **7/7** | โœ… COMPLETED |
| **Organism Components** | 6 planned | **6/6** | โœ… COMPLETED |
| **Test Coverage** | >80% | **86.4%** | โœ… ACHIEVED |
| **Total Tests** | 500+ | **860 passing** | โœ… EXCEEDED |
| **Bundle Size (per component)** | <10KB | **<10KB** | โœ… ACHIEVED |
| **Component Render** | <2ms | **<1ms** | โœ… EXCEEDED |
| **Accessibility** | WCAG 2.1 AA | **100% Compliant** | โœ… ACHIEVED |
| **ADR Compliance** | Full | **100% Compliant** | โœ… ACHIEVED |

### ๐Ÿš€ **Why This Matters**
- **86.4% Test Coverage**: Your components won't break in production
- **<1ms Render Time**: Faster than the human eye can perceive
- **100% AI Coverage**: Every component can talk to ChatGPT, Claude, Copilot
- **860 Tests**: More tests than most production apps
- **22 Production Components**: 9 atoms, 7 molecules, 6 organisms - all production-ready

## ๐Ÿ“„ License

MIT ยฉ Nexcraft Team

## ๐Ÿ”— Links

- **[NPM Package](https://www.npmjs.com/package/@nexcraft/forge)** - Published package
- **[GitHub](https://github.com/nexcraft/forge)** - Source code
- **[Storybook](https://nexcraft.github.io/forge)** - Live component playground (Coming Soon)
- **[Documentation](./plans/)** - Complete planning documentation

## ๐Ÿ’ก Philosophy & Vision

> **"Write Once, Use Forever"**
>
> In 2034, React might be legacy, Vue could be vintage, and Angular may be ancient.
> But your @nexcraft/forge components? They'll still be running perfectly.

### ๐ŸŽญ **The Problem We Solve**
Every 3-5 years, teams rewrite their UI components for the latest framework. It's a **$100B industry problem**.

### ๐Ÿ›ก๏ธ **Our Solution**
Build on **web standards** that browsers will support forever. Add **AI intelligence** and **performance monitoring** that no other library offers.

### ๐Ÿ“ˆ **The Business Case**
```javascript
// Traditional Approach (2019-2034)
Year 2019: Build components in React 16 // Cost: $500K
Year 2022: Migrate to React 18 // Cost: $200K
Year 2025: Rewrite for React Server Components // Cost: $400K
Year 2028: Migrate to NewFramework.js // Cost: $500K
Year 2031: Rewrite again... // Cost: $500K
// Total: $2.1M + maintenance

// @nexcraft/forge Approach
Year 2024: Build components once // Cost: $500K
Year 2034: Still working perfectly // Cost: $0
// Total: $500K + minimal maintenance

// ROI: 320% cost savings + no technical debt
```

### ๐Ÿš€ **Join the Revolution**
Stop rewriting. Start building components that outlive frameworks.