Skip to content

v1.2.0 - Performance, Accessibility & Advanced Features

Choose a tag to compare

@toozuuu toozuuu released this 10 Dec 14:05
· 26 commits to main since this release

🚀 TokiForge v1.2.0

Release Date: December 10, 2025

This major release introduces performance optimizations, accessibility features, advanced token capabilities, and new integrations to make TokiForge more powerful and accessible than ever.


✨ Performance Optimizations

Caching System

  • Built-in caching support in ThemeRuntime with multiple strategies:
    • Memory cache: Fastest, RAM-based storage (lost on page reload)
    • localStorage: Persistent storage with ~5MB limit
    • IndexedDB: Large capacity async storage for massive token sets
    • Service Worker: Offline support with stale-while-revalidate pattern
  • Multi-tier caching with CacheManager for optimal performance
  • Automatic cache management with TTL (Time To Live) and size limits
  • Configurable cache strategies per theme configuration

Lazy Loading

  • Progressive token chunk loading to reduce initial bundle size
  • On-demand loading with loadChunk() method for specific token categories
  • CDN support for token distribution (jsDelivr, unpkg, etc.)
  • Preloading capabilities for chunks that will be needed soon
  • Chunk status checking with isChunkLoaded() method
  • Configurable timeouts and retries for reliable token loading

Compression

  • Gzip and Brotli compression utilities for token data
  • Base64 encoding support for localStorage storage
  • Automatic compression when storing tokens in localStorage
  • Compression ratio tracking to monitor storage efficiency
  • Decompression utilities for seamless token restoration

♿ Accessibility Features

High Contrast Mode

  • Automatic system preference detection via prefers-contrast: high and forced-colors: active
  • WCAG AAA compliant color enhancement
  • Theme variant support for high contrast themes
  • Manual control via getAccessibilityPreferences() API

Reduced Motion

  • Respects prefers-reduced-motion: reduce system preference
  • Automatic CSS injection to disable animations and transitions
  • Configurable transition disabling per theme
  • System preference watching for real-time updates

Color Blind Support

  • Three color vision deficiency types:
    • Protanopia: Red-green color blindness (red deficiency)
    • Deuteranopia: Red-green color blindness (green deficiency)
    • Tritanopia: Blue-yellow color blindness
  • Automatic color transformations for accessible color palettes
  • Manual mode control via setColorBlindMode() API
  • Real-time color adjustments without theme reload

Font Size Scaling

  • System preference detection for user font size preferences
  • Manual scaling control (0.5x to 3.0x multiplier)
  • Configurable base font size for consistent scaling
  • Dynamic font size updates via setFontSizeScale() API

🔧 Advanced Token Features

Token Functions

Compute token values dynamically using built-in or custom functions:

Color Functions:

  • darken(color, amount) - Darken colors by percentage
  • lighten(color, amount) - Lighten colors by percentage
  • mix(color1, color2, weight) - Mix two colors with weight
  • alpha(color, alpha) - Add alpha channel to colors

Math Functions:

  • add(...values) - Add multiple values
  • subtract(a, b) - Subtract values
  • multiply(...values) - Multiply values
  • divide(a, b) - Divide values

Unit Functions:

  • px(value) - Convert to pixels
  • rem(value) - Convert to rem units
  • em(value) - Convert to em units

Custom Functions:

  • Register custom functions via TokenFunctions.register()
  • Support for custom logic and transformations

Token Expressions

Use mathematical expressions in token values:

  • Basic operations: +, -, *, / with parentheses grouping
  • CSS calc() support for complex calculations
  • Token reference integration in expressions
  • Automatic expression processing during token parsing

References with Fallbacks

Safe token references with fallback support:

  • Syntax: {token.path || fallback}
  • Multiple fallback levels: {token.primary || {token.secondary} || #000000}
  • Type-safe fallbacks for strings, numbers, and references
  • Automatic fallback resolution during token parsing

Token Scoping

Component-scoped tokens for isolated theming:

  • Create scoped token sets with TokenScoping.createScope()
  • Extract component tokens from global token sets
  • Apply scope metadata for component isolation
  • Namespace support for component-specific tokens

Theming API

Programmatic theme creation and management:

  • Fluent builder pattern with ThemeBuilder
  • Theme extension and overriding capabilities
  • Variant creation from base themes
  • Token addition via addToken() and addTokens() methods
  • Theme configuration generation with createThemeConfig()

Validation Plugins

Custom validation rules for tokens:

  • Plugin registration system via ValidationPluginManager
  • Token-level validation with custom rules
  • Global validation support for entire token sets
  • Error reporting with detailed validation messages

Transformation Pipeline

Transform tokens before export:

  • Chainable transformations with TransformationPipeline
  • Built-in transformations:
    • flatten - Flatten nested token structures
    • expandReferences - Expand token references
    • removeDeprecated - Remove deprecated tokens
    • addNamespace - Add namespace prefix to tokens
  • Custom transformation steps for specific use cases
  • Async transformation support for complex operations

🔌 New Integrations

Storybook Addon

Theme management directly in Storybook:

  • Theme switcher in Storybook toolbar
  • Token viewer panel for inspecting tokens
  • Automatic theme initialization in stories
  • Decorator support via withTokiForge()
  • Parameter configuration for theme settings

Enhanced Figma Sync

Improved Figma integration with advanced features:

  • Conflict resolution strategies (local, remote, merge)
  • Sync status detection for added, modified, and removed tokens
  • Better error handling with detailed error messages
  • Token comparison with FigmaDiff class
  • JSON export for diff results

Design Tool Adapters

Support for popular design tools:

  • Sketch adapter for export/import tokens
  • Adobe XD adapter for design token sync
  • Color style conversion between tools and TokiForge
  • Plugin-ready architecture for design tool plugins

CMS Integration

Headless CMS support for token management:

  • Contentful adapter with token fetching and watching
  • Strapi adapter with push/pull capabilities
  • Sanity adapter for Sanity CMS integration
  • Custom adapter base class for creating your own CMS adapters
  • Real-time token updates via watch mechanisms

Design System Tools

Integration with design system platforms:

  • Zeroheight adapter for pushing/pulling tokens
  • InVision DSM adapter for design system sync
  • Sync with merge strategies for conflict resolution
  • API integration for automated token synchronization

📚 Documentation Updates

  • ✅ New guide: Performance Optimization - Learn about caching, lazy loading, and compression
  • ✅ New guide: Accessibility Features - Complete guide to accessibility features
  • ✅ New guide: Advanced Token Features - Deep dive into functions, expressions, and scoping
  • ✅ New guide: Integrations - How to integrate with Storybook, Figma, CMS, and design tools
  • ✅ Updated API documentation for all new features
  • ✅ Updated examples with new feature demonstrations

🎯 Migration Guide

Upgrading from v1.1.2

  1. Update dependencies:

    npm install @tokiforge/core@^1.2.0 @tokiforge/react@^1.2.0

    ... update other packages as needed

    1. Enable new features (optional):t
      const theme = new ThemeRuntime({
      themes: [...],
      performance: {
      cache: { strategy: 'localStorage', ttl: 3600 },
      loading: { source: '/tokens', lazy: true },
      },
      accessibility: {
      highContrast: { autoDetect: true },
      reducedMotion: { autoDetect: true },
      },
      });
    2. No breaking changes - All existing code continues to work!

📦 Package Updates

All packages have been updated to v1.2.0:

  • @tokiforge/core@1.2.0
  • @tokiforge/react@1.2.0
  • @tokiforge/vue@1.2.0
  • @tokiforge/svelte@1.2.0
  • @tokiforge/angular@1.2.0
  • @tokiforge/tailwind@1.2.0
  • @tokiforge/figma@1.2.0
  • @tokiforge/storybook@1.2.0
  • tokiforge-cli@1.2.0

🙏 Thank You

Thank you to all contributors and users who helped make this release possible!


Full Changelog: v1.1.2...v1.2.0

Documentation: https://tokiforge.dev

Installation: npm install @tokiforge/core