ProteusJS v2.0.0 Documentationο
Welcome to ProteusJS v2.0.0 - the major evolution featuring modern web platform APIs, enhanced accessibility, performance scheduling, and PWA capabilities.
π Whatβs New in v2.0.0ο
ProteusJS v2.0.0 represents a complete architectural transformation with:
Modern Web Platform APIs: Navigation API, View Transitions, Popover API, Scheduler API
Enhanced Accessibility: WAI-ARIA APG compliance with automated testing
Performance Scheduling: Intelligent task scheduling and yielding
PWA Capabilities: File System Access, Badging, Web Share, Background Sync
Intelligent Prefetching: Speculation Rules with behavior-based optimization
Breaking Changes: Clean API design with comprehensive migration tools
π¦ Package Architectureο
v2.0.0 introduces a modular package architecture:
Core Packagesο
Package |
Description |
Size |
APIs |
|---|---|---|---|
|
Main library with legacy modules |
~25KB |
Core utilities, legacy APIs |
|
Navigation API router |
~6KB |
Navigation API, History fallback |
|
View Transitions helpers |
~4KB |
View Transitions API |
|
Popover & positioning |
~10KB |
Popover API, CSS Anchor Positioning |
|
Performance scheduling |
~6KB |
Scheduler API, task management |
|
PWA integration |
~12KB |
File System, Badging, Web Share |
|
Intelligent prefetching |
~5KB |
Speculation Rules API |
Utility Packagesο
Package |
Description |
Purpose |
|---|---|---|
|
Migration tools |
v1βv2 automated migration |
|
Command line tools |
Development utilities |
|
ESLint rules |
Code quality enforcement |
|
Vite integration |
Build tool optimization |
π Quick Startο
Installationο
# Install core library
npm install @sc4rfurryx/proteusjs@2.0.0
# Install specific packages as needed
npm install @sc4rfurryx/proteusjs-router
npm install @sc4rfurryx/proteusjs-transitions
npm install @sc4rfurryx/proteusjs-layer
npm install @sc4rfurryx/proteusjs-schedule
npm install @sc4rfurryx/proteusjs-pwa
npm install @sc4rfurryx/proteusjs-speculate
CDN Usageο
<!-- Core library -->
<script type="module">
import { ProteusJS } from 'https://cdn.jsdelivr.net/npm/@sc4rfurryx/proteusjs@2.0.0/dist/proteus.esm.js';
</script>
<!-- Individual packages -->
<script type="module">
import { navigate } from 'https://cdn.jsdelivr.net/npm/@sc4rfurryx/proteusjs-router@2.0.0/dist/index.esm.js';
import { viewTransition } from 'https://cdn.jsdelivr.net/npm/@sc4rfurryx/proteusjs-transitions@2.0.0/dist/index.esm.js';
</script>
Basic Usageο
// Navigation with View Transitions
import { navigate } from '@sc4rfurryx/proteusjs-router';
import { slideTransition } from '@sc4rfurryx/proteusjs-transitions';
// Navigate with smooth transition
await navigate('/about', {
transition: { name: 'slide', duration: 300 }
});
// Or use explicit transition
await slideTransition('right', () => {
// Update DOM
document.getElementById('content').innerHTML = newContent;
});
// Popover with native API
import { popover } from '@sc4rfurryx/proteusjs-layer';
const controller = popover(triggerElement, contentElement, {
placement: 'bottom',
trigger: 'click'
});
controller.show();
// Performance scheduling
import { postTask, processInChunks } from '@sc4rfurryx/proteusjs-schedule';
// Schedule high-priority task
await postTask(() => {
// Critical work
}, { priority: 'user-blocking' });
// Process large dataset with yielding
await processInChunks(largeArray, (item) => {
return processItem(item);
}, {
chunkSize: 100,
yieldInterval: 5
});
π Migration from v1.xο
Automated Migrationο
# Install migration tool
npm install -g @sc4rfurryx/proteusjs-codemods
# Run automated migration
proteusjs-migrate migrate ./src
# Preview changes without modifying files
proteusjs-migrate migrate ./src --dry-run
Manual Migration Stepsο
Update Dependencies
npm uninstall @sc4rfurryx/proteusjs@1.x npm install @sc4rfurryx/proteusjs@2.0.0
Update Imports
// Before (v1.x) import { ProteusJS } from '@sc4rfurryx/proteusjs'; import { transition } from '@sc4rfurryx/proteusjs/transitions'; // After (v2.0.0) import { ProteusJS } from '@sc4rfurryx/proteusjs'; import { navigate } from '@sc4rfurryx/proteusjs-router'; import { viewTransition } from '@sc4rfurryx/proteusjs-transitions';
Update API Calls
// Before (v1.x) const proteus = new ProteusJS(); proteus.navigate('/page'); // After (v2.0.0) import { navigate } from '@sc4rfurryx/proteusjs-router'; await navigate('/page');
π Documentation Structureο
Getting Started - Installation and basic usage
API Reference - Complete API documentation
Migration Guide - v1βv2 upgrade instructions
Examples - Code examples and tutorials
Browser Support - Compatibility information
Performance - Optimization guidelines
Package Documentationο
π Browser Supportο
ProteusJS v2.0.0 targets Web Platform Baseline with graceful fallbacks:
Feature |
Chrome |
Firefox |
Safari |
Edge |
|---|---|---|---|---|
Navigation API |
102+ |
β (fallback) |
β (fallback) |
102+ |
View Transitions |
111+ |
β (fallback) |
β (fallback) |
111+ |
Popover API |
114+ |
β (fallback) |
17+ |
114+ |
CSS Anchor Positioning |
125+ |
β (fallback) |
β (fallback) |
125+ |
Scheduler API |
94+ |
β (fallback) |
β (fallback) |
94+ |
File System Access |
86+ |
β (fallback) |
β (fallback) |
86+ |
Speculation Rules |
103+ |
β (fallback) |
β (fallback) |
103+ |
Fallback Strategy: All features gracefully degrade with polyfills or alternative implementations.
π― Performanceο
Bundle Sizes (Gzipped)ο
Total v2.0.0: ~43KB (all packages)
Core only: ~25KB
Individual packages: 4-12KB each
Tree-shaking: Import only what you need
Performance Targetsο
Navigation: <5ms average
View Transitions: <10ms average
Popover Creation: <3ms average
Task Scheduling: <2ms average
File Operations: <15ms average
π§ͺ Testingο
ProteusJS v2.0.0 includes comprehensive testing:
# Run all tests
npm run test:all
# Run with coverage
npm run test:all:coverage
# Run performance benchmarks
npm run benchmark
# Run accessibility audits
npm run accessibility
π€ Contributingο
See CONTRIBUTING.md for development guidelines.
π Licenseο
MIT License - see LICENSE for details.
Ready to upgrade? Start with the Migration Guide or explore the API Reference for detailed documentation.