Skip to content

Commit def7432

Browse files
docs: add PIE Elements NG project overview
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 8cb3972 commit def7432

2 files changed

Lines changed: 107 additions & 0 deletions

File tree

569 KB
Loading

docs/why-a-new-project.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Why a New Project?
2+
3+
PIE Elements NG is the modern home for PIE element development. It brings assessment element implementations, shared PIE libraries, framework-independent contracts, demo tooling, quality checks, and release automation into one developer experience.
4+
5+
The project exists because the older PIE development model required developers to understand separate element and library projects, legacy module formats, generated demo folders, and custom build conventions before they could make useful changes. PIE Elements NG keeps compatibility with the existing PIE ecosystem while giving new work a cleaner ESM-first foundation.
6+
7+
## What the Project Covers
8+
9+
PIE Elements NG covers the code and workflows needed to build, test, preview, and release PIE question types:
10+
11+
- **Element packages**: student delivery views, authoring views, controllers, and print views for individual assessment interactions.
12+
- **Shared PIE libraries**: reusable rendering, authoring, math, feedback, styling, and utility packages used across elements.
13+
- **Core contracts**: the common model, session, environment, controller, and event shapes that let players and elements communicate consistently.
14+
- **Player and demo tooling**: local surfaces for exercising delivery, authoring, evaluation, and print behavior without creating one demo app per element.
15+
- **Quality and release workflows**: unit tests, browser tests, accessibility checks, IIFE/runtime checks, package verification, Changesets, and CI-driven publishing.
16+
17+
## Architecture at a Glance
18+
19+
![PIE Elements NG architecture](./img/why-new-project-pie-elements-ng-1-1778213475864.jpg)
20+
21+
## How It Differs From the Legacy Model
22+
23+
| Area | Legacy model | PIE Elements NG model |
24+
| --- | --- | --- |
25+
| Daily development | Developers often had to reason across separate element and library projects. | Most work happens from one monorepo with workspace-linked packages. |
26+
| Module format | CommonJS and bespoke bundling patterns were common. | Packages are ESM-first and built with standard modern tooling. |
27+
| Build tools | Custom scripts and specialized PIE build conventions. | Vite for package builds, Bun for package management, Turbo for workspace orchestration, Biome for formatting/linting. |
28+
| Demos | Per-element generated demo folders. | One shared demo app can load any supported element. |
29+
| Framework direction | Primarily React-oriented. | React-backed packages are maintained through sync, while new NG implementations can be built natively with Svelte or other web-component-friendly approaches. |
30+
| Package shape | Student, authoring, controller, and print concerns were not always peers. | Element packages use a more predictable shape: delivery, authoring, controller, and print are treated as peer surfaces. |
31+
32+
## Package Families
33+
34+
You do not need to memorize the repository layout to understand the project. Conceptually, it has these package families:
35+
36+
- **React-backed elements**: existing production-oriented element implementations brought forward into the modern packaging and tooling model.
37+
- **Svelte-native elements**: new NG element implementations that use Svelte 5 and web components directly.
38+
- **PIE libraries**: shared UI, authoring, math, graphing, feedback, and utility packages that used to be thought of as a separate layer.
39+
- **Shared infrastructure**: event helpers, controller utilities, bundler compatibility, math rendering, feedback behavior, test helpers, and theme support.
40+
- **Core package**: framework-neutral PIE types, events, and common utilities.
41+
- **Apps and players**: internal demo and test applications plus element-level player surfaces for development, documentation, print preview, and advanced embedding.
42+
- **CLI and scripts**: commands for demos, upstream sync, package generation, docs generation, controller verification, dependency checks, and releases.
43+
44+
## Developer Workflow
45+
46+
For normal development, the workflow is intentionally small:
47+
48+
```bash
49+
bun install
50+
bun run build
51+
bun run dev:demo multiple-choice
52+
bun run test
53+
bun run lint
54+
```
55+
56+
The shared demo command starts a single-element development surface where developers can inspect model/session behavior, delivery modes, authoring behavior, print behavior where available, and browser/runtime integration.
57+
58+
## Maintainer Workflow
59+
60+
React-backed elements and React shared libraries are synced from the legacy source of record. That means they should not be edited directly in this project for normal feature work. Maintainers bring those updates in through the project CLI, which analyzes upstream changes, rewrites package structure as needed, verifies compatibility, and commits the transformed result here.
61+
62+
```bash
63+
bun run upstream:status
64+
bun run upstream:update
65+
bun run verify:runtime-support
66+
bun run cli verify:controllers
67+
bun run cli docs:verify
68+
```
69+
70+
New NG-native elements, shared infrastructure, demo tooling, accessibility workflows, and release automation are developed directly in this project.
71+
72+
## Players and Print
73+
74+
The project includes an element-level player that is useful for development, testing, documentation, single-element previews, and print-view validation. Production applications usually render complete assessment items through item-level player stacks, because a production item may include passages, multiple elements, markup, rubrics, and application-level orchestration.
75+
76+
Print support follows the same principle: each element owns its print-specific transformations and view, while players decide how to load and orchestrate those views for a given use case.
77+
78+
## Product and Accessibility Work
79+
80+
PIE Elements NG is not only an engineering packaging project. It also gives product, accessibility, QA, and engineering a shared place to coordinate element behavior:
81+
82+
- **Product requirements** describe proposed or accepted behavior changes before implementation when a change affects an element contract or authoring surface.
83+
- **Accessibility planning** tracks WCAG 2.2 AA expectations, automated versus manual validation boundaries, and element-level remediation notes.
84+
- **Jira** owns sprint state, assignments, and delivery tracking.
85+
- **Confluence** is used for stakeholder-friendly summaries and program rollups, not as the canonical source for code contracts.
86+
87+
## Release and Quality Model
88+
89+
Packages are released through Changesets and CI. The release workflow builds the workspace, verifies runtime support, checks controller exports, verifies generated docs, and publishes only the packages selected by the release plan plus packages affected by dependency propagation.
90+
91+
The quality model includes unit tests, browser/e2e tests, accessibility checks, IIFE/runtime compatibility checks, dependency integrity verification, and documentation verification. The goal is to test elements as publishable packages, not only as local source code.
92+
93+
## Current Status
94+
95+
PIE Elements NG is an active modernization project. The current baseline includes a broad set of React-backed PIE elements and shared libraries, new Svelte-native element work, a modern demo app, core package contracts, sync tooling, accessibility planning, and release automation. Existing production consumers can continue using legacy-compatible paths while new development moves toward the NG architecture.
96+
97+
## Quick Reference
98+
99+
| Need | Use |
100+
| --- | --- |
101+
| Install dependencies | `bun install` |
102+
| Build packages | `bun run build` |
103+
| Open an element demo | `bun run dev:demo <element-name>` |
104+
| Run unit tests | `bun run test` |
105+
| Run lint checks | `bun run lint` |
106+
| Check upstream sync status | `bun run upstream:status` |
107+
| Create a package changeset | `bun run changeset:plan -- --packages <package> --type patch --summary "..."` |

0 commit comments

Comments
 (0)