|
1 | 1 | # shadow-objects |
2 | 2 |
|
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 🧛 |
4 | 4 |
|
5 | 5 | > [!WARNING] |
6 | 6 | > 🚀 This is a highly experimental framework that is slowly maturing. Use at your own risk. 🔥 |
7 | 7 |
|
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 | + |
| 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 |
9 | 34 |
|
10 | 35 | **The complete and authoritative documentation is located in the [`packages/shadow-objects/docs/`](packages/shadow-objects/docs/) directory.** |
11 | 36 |
|
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 | +--- |
15 | 42 |
|
16 | | -## 🏗️ Project Structure |
| 43 | +## 🏗️ Project Structure (Monorepo) |
17 | 44 |
|
18 | 45 | This repository is a monorepo managed with [nx](https://nx.dev/) and [pnpm](https://pnpm.io/). |
19 | 46 |
|
| 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 | + |
20 | 56 | | Package | Description | |
21 | 57 | | :--- | :--- | |
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**. | |
24 | 58 | | **[`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 | +--- |
26 | 62 |
|
27 | 63 | ## ⚡ Available Scripts |
28 | 64 |
|
29 | 65 | Run these commands from the root directory: |
30 | 66 |
|
31 | 67 | | Command | Description | |
32 | 68 | | :--- | :--- | |
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. | |
34 | 70 | | `pnpm start` | Starts the **shae-offscreen-canvas** demo server. | |
35 | 71 | | `pnpm test` | Runs all tests (Unit, Integration, E2E) across all packages. | |
36 | 72 | | `pnpm test:ci` | Runs tests excluding E2E (faster, for CI pipelines). | |
37 | 73 | | `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 | +--- |
40 | 78 |
|
41 | 79 | ## ⚙️ Development Setup |
42 | 80 |
|
43 | 81 | 1. **Prerequisites:** Node.js >=20.12.2, pnpm >=9.1.2 |
44 | | -2. **Install dependencies:** |
| 82 | +2. **Install Dependencies:** |
45 | 83 | ```sh |
46 | 84 | pnpm install |
47 | 85 | ``` |
48 | | -3. **Install Playwright browsers (for E2E):** |
| 86 | +3. **Install Playwright Browsers (for E2E Tests):** |
49 | 87 | ```sh |
50 | 88 | cd packages/shadow-objects-e2e |
51 | 89 | pnpm exec playwright install chromium firefox |
|
0 commit comments