Skip to content

Commit c116485

Browse files
committed
docs: update README with enhanced mental model and add shadow theater diagram
1 parent 3920ad8 commit c116485

File tree

2 files changed

+123
-14
lines changed

2 files changed

+123
-14
lines changed

README.md

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,89 @@
11
# shadow-objects
22

3-
A reactive entity←component framework that feels home in the shadows 🧛
3+
A reactive Entity←Component Framework that feels at home in the shadows 🧛
44

55
> [!WARNING]
66
> 🚀 This is a highly experimental framework that is slowly maturing. Use at your own risk. 🔥
77
8-
## Documentation 📚
8+
---
9+
10+
## 🎭 The Mental Model: The Shadow Theater
11+
12+
Imagine a **web application** like a classic **Shadow Theater**:
13+
14+
* **The Screen (View):** What the user sees – the DOM elements and UI components.
15+
* **The Puppets (Entities):** The abstract objects in the background representing the actual scene.
16+
* **The Puppeteer (Shadow Object):** The logic pulling the strings. The puppeteer decides how the puppets move but remains invisible to the audience.
17+
18+
**The Problem with Traditional Frameworks:**
19+
Logic (puppeteer) and presentation (screen) are often mixed in the same thread (Main Thread). In complex applications, this leads to performance bottlenecks because UI rendering blocks business logic – and vice versa.
20+
21+
**The Solution by `shadow-objects`:**
22+
We separate the worlds strictly.
23+
24+
![The Shadow Theater Model](packages/shadow-objects/docs/shadow-theater.svg)
25+
26+
1. **In the Light (Main Thread):** The dumb View. It only displays and forwards events.
27+
2. **In the Shadow (Web Worker):** The smart Logic. This is where **Entities** and **Shadow Objects** live. They process data, calculate states, and "project" the result back onto the screen.
28+
29+
Through this architecture, your application logic runs parallel to the UI, decoupled and reactive.
30+
31+
---
32+
33+
## 📚 Documentation
934

1035
**The complete and authoritative documentation is located in the [`packages/shadow-objects/docs/`](packages/shadow-objects/docs/) directory.**
1136

12-
* [**Fundamentals**](packages/shadow-objects/docs/01-fundamentals/): Understand the mental model, architecture, and lifecycle.
13-
* [**Guides**](packages/shadow-objects/docs/02-guides/): Step-by-step instructions.
14-
* [**API Reference**](packages/shadow-objects/docs/03-api/): Detailed API docs.
37+
* [**Fundamentals**](packages/shadow-objects/docs/01-concepts/): Understand the mental model, architecture, and lifecycle in detail.
38+
* [**Guides**](packages/shadow-objects/docs/02-guides/): Step-by-step instructions for getting started.
39+
* [**API Reference**](packages/shadow-objects/docs/03-api/): Detailed description of the interfaces.
40+
41+
---
1542

16-
## 🏗️ Project Structure
43+
## 🏗️ Project Structure (Monorepo)
1744

1845
This repository is a monorepo managed with [nx](https://nx.dev/) and [pnpm](https://pnpm.io/).
1946

47+
### Core Packages
48+
49+
| Package | Description |
50+
| :--- | :--- |
51+
| **[`shadow-objects`](packages/shadow-objects/)** | The heart. The core library of the framework. |
52+
| **[`shae-offscreen-canvas`](packages/shae-offscreen-canvas/)** | A Custom Element implementing an **Offscreen Canvas** – demonstrates the power of `shadow-objects` for graphics applications. |
53+
54+
### Testing & Quality Assurance
55+
2056
| Package | Description |
2157
| :--- | :--- |
22-
| **[`shadow-objects`](packages/shadow-objects/)** | The core framework library. |
23-
| **[`shae-offscreen-canvas`](packages/shae-offscreen-canvas/)** | A custom HTML element implementing an **offscreen canvas**. |
2458
| **[`shadow-objects-testing`](packages/shadow-objects-testing/)** | Functional and integration tests. |
25-
| **[`shadow-objects-e2e`](packages/shadow-objects-e2e/)** | End-to-end tests using [Playwright](https://playwright.dev/). |
59+
| **[`shadow-objects-e2e`](packages/shadow-objects-e2e/)** | End-to-End tests using [Playwright](https://playwright.dev/). |
60+
61+
---
2662

2763
## ⚡ Available Scripts
2864

2965
Run these commands from the root directory:
3066

3167
| Command | Description |
3268
| :--- | :--- |
33-
| `pnpm cbt` | **Clean, Build, Test.** Runs a full clean build and test cycle for the entire workspace. |
69+
| `pnpm cbt` | **Clean, Build, Test.** Runs a full cycle: clean, build, and test the entire workspace. |
3470
| `pnpm start` | Starts the **shae-offscreen-canvas** demo server. |
3571
| `pnpm test` | Runs all tests (Unit, Integration, E2E) across all packages. |
3672
| `pnpm test:ci` | Runs tests excluding E2E (faster, for CI pipelines). |
3773
| `pnpm build` | Builds all packages. |
38-
| `pnpm lint` | Runs linting across the workspace. |
39-
| `pnpm clean` | Cleans all build artifacts (`dist`, `build` folders). |
74+
| `pnpm lint` | Runs linter across the entire workspace. |
75+
| `pnpm clean` | Deletes all build artifacts (`dist`, `build` folders). |
76+
77+
---
4078

4179
## ⚙️ Development Setup
4280

4381
1. **Prerequisites:** Node.js >=20.12.2, pnpm >=9.1.2
44-
2. **Install dependencies:**
82+
2. **Install Dependencies:**
4583
```sh
4684
pnpm install
4785
```
48-
3. **Install Playwright browsers (for E2E):**
86+
3. **Install Playwright Browsers (for E2E Tests):**
4987
```sh
5088
cd packages/shadow-objects-e2e
5189
pnpm exec playwright install chromium firefox
Lines changed: 71 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)