Modern PIE (Platform Independent Elements) implementation built with Svelte 5, Bun, and Turbo.
This monorepo contains PIE-compliant assessment elements built with modern tooling:
- Svelte 5 with Runes for UI components
- Bun for fast package management and testing
- Turbo for optimized monorepo builds
- TypeScript throughout for type safety
- Vite for lightning-fast builds
- Biome for linting and formatting
- Playwright for E2E testing
PIE (Platform Independent Elements) is a specification for building portable, interactive assessment items that work across different platforms.
Unlike the original pie-elements, this project uses a unified component architecture where each element is a single component that handles all modes:
- Controller - Server/client-side logic for transformations and scoring
- Student Interaction (gather mode) - Interactive component for learners answering questions
- Preview (view mode) - Read-only display without interaction
- Evaluation (evaluate mode) - Show scoring, feedback, and correct answers
- Authoring (configure mode) - Rich text editing and configuration UI for educators
Key Difference: Instead of three separate npm packages (@pie-element/X, @pie-element/X-configure, @pie-element/X-controller), we have ONE package per element with mode-switching capabilities.
This project aims for complete feature parity with the original pie-elements framework, including:
Core Features:
- ✅ All QTI 2.2 interaction types (21 total)
- ✅ Rich text editing with TipTap (math support via MathLive + KaTeX)
- ✅ Full authoring/configuration UI
- ✅ Student interaction modes (gather/view/evaluate)
- ✅ WCAG 2.2 Level AA accessibility compliance
Optional Features:
- 📋 Print mode (optional but recommended) - Static rendering for paper tests and answer keys
- 📋 Mini players (optional) - Compact preview components for item browsing
- 🚧 Advanced features (audio, keyboard shortcuts, custom styling)
pie-elements-ng/
├── packages/
│ ├── core/ # Core PIE interfaces
│ ├── multiple-choice/ # Multiple choice element
│ └── lib-*/ # Shared libraries
└── apps/
└── example/ # SvelteKit demo app
- Bun 1.1.42 or later
- Node.js 20.0.0 or later (for compatibility)
bun install# Run all packages in dev mode
bun run dev
# Run example app only
cd apps/example
bun run dev# Build all packages
bun run build# Run unit tests
bun run test
# Run E2E tests
bun run test:e2e
# Run evaluation system (comprehensive YAML-driven tests)
bun run evals # All evaluations
bun run evals:svelte # Svelte elements only
bun run evals:react # React elements only
bun run evals:ui # Interactive UI mode
bun run evals:headed # Headed browser mode# Check code
bun run lint
# Auto-fix issues
bun run lint:fix# TODO: CLI coming soon
bun run create-element <element-name>PIE Elements NG includes a comprehensive YAML-driven evaluation system for testing elements across 10 dimensions:
- Rendering - Display correctness in all modes
- Interactions - User input handling
- Accessibility - WCAG 2.2 Level AA compliance
- State Management - Session/model changes
- Scoring - Outcome calculations
- Browser Compatibility - Cross-browser support
- Performance - Load time and responsiveness
- Configuration - Config option application
- Error Handling - Invalid input handling
- Testing - Unit test coverage
# Run all evaluations
bun run evals
# Run with UI for debugging
bun run evals:uiSee docs/evals/CONTRIBUTING.md for the complete guide.
Quick example:
version: 1
component:
element: "@pie-element/multiple-choice"
framework: "svelte"
evals:
- id: "mc/simple/correct-answer"
severity: "error"
intent: "Validates correct answer yields score of 1.0"
steps:
- action: navigate
path: "/multiple-choice"
- action: click
target:
description: "Correct choice"
hint: 'input[value="A"]'
- action: axe
expected:
maxViolations: 0
wcagLevel: "AA"For more details, see:
- USAGE.md - Quick start guide with installation and usage examples
- API_REFERENCE.md - Complete API documentation for all interfaces and props
- ARCHITECTURE.md - System design and unified component architecture
- CONTRIBUTING.md - Contributing guidelines and development setup
- testing.md - Testing strategy and tools
- ACCESSIBILITY.md - WCAG 2.2 Level AA compliance and testing
- THEMING.md - Customization with DaisyUI themes and CSS variables
- TROUBLESHOOTING.md - Common issues and solutions
- rich-text-editor.md - TipTap editor usage and integration
- PUBLISHING.md - Release workflow and publishing to npm
- web-components-strategy.md - Web Components distribution strategy
- print-mode.md - Print mode implementation guide
- mini-players.md - Compact preview components guide
- evals/README.md - Evaluation system overview
- evals/CONTRIBUTING.md - Writing evaluation specs
- evals/STYLE-TESTING.md - Style and visual regression testing
- migration/UPSTREAM_SYNC_GUIDE.md - Complete guide for syncing from upstream pie-elements and pie-lib
See CONTRIBUTING.md for guidelines on contributing to this project.
MIT