Skip to content

Commit 47553a9

Browse files
committed
refactor docs
1 parent 6ea20fd commit 47553a9

14 files changed

Lines changed: 684 additions & 402 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The **Shadow Objects Framework** is a reactive library designed to decouple busi
3333
- **`packages/shadow-objects/`**: The main framework library. Deployment package: `@spearwolf/shadow-objects`.
3434
- **`packages/shadow-objects/docs/`**: **The authoritative source of documentation.** Contains Fundamentals, Guides, and API references.
3535
- **`packages/shae-offscreen-canvas/`**: An offscreen canvas as custom HTML element based on shadow-objects.
36+
- **`packages/skills/`**: Agent Skills for AI assistants to help with shadow-objects development.
3637
- **`packages/shadow-objects-testing/`**: Functional tests.
3738
- **`packages/shadow-objects-e2e/`**: Blackbox / E2E tests.
3839

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ This repository is a monorepo managed with [nx](https://nx.dev/) and [pnpm](http
5050
| :--- | :--- |
5151
| **[`shadow-objects`](packages/shadow-objects/)** | The heart. The core library of the framework. |
5252
| **[`shae-offscreen-canvas`](packages/shae-offscreen-canvas/)** | A Custom Element implementing an **Offscreen Canvas** – demonstrates the power of `shadow-objects` for graphics applications. |
53+
| **[`skills`](packages/skills/)** | **Agent Skills** for AI assistants to help with `shadow-objects` development. |
5354

5455
### Testing & Quality Assurance
5556

packages/shadow-objects/docs-legacy/src-in-the-dark-ShadowObjectsGuide.md

Lines changed: 0 additions & 75 deletions
This file was deleted.

packages/shadow-objects/docs-legacy/src-view-ComponentContext.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/shadow-objects/docs-legacy/src-view-ShadowEnv.md

Lines changed: 0 additions & 113 deletions
This file was deleted.

packages/shadow-objects/docs-legacy/src-view-ViewComponent.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

packages/shadow-objects/docs/01-concepts/03-lifecycle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function MyLogic({
7575

7676
createEffect(() => {
7777
// RUNTIME: Runs whenever 'title' or 'count' changes
78-
console.log(`Title: ${title()}, Count: ${count()}`);
78+
console.log(`Title: ${title()}, Count: ${count.get()}`);
7979
});
8080

8181
// SETUP: Listen for View events

packages/shadow-objects/docs/01-concepts/04-entity-tree-context-events.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ Events dispatched by the View Component are automatically forwarded to the corre
9797
Shadow Objects attached to the same Entity can communicate via events.
9898

9999
```typescript
100-
import {emit} from '@spearwolf/eventize';
101-
102100
// Feature A
103101
export function FeatureA({on}: ShadowObjectCreationAPI) {
104102
// Listen for event from Feature B
@@ -108,9 +106,9 @@ export function FeatureA({on}: ShadowObjectCreationAPI) {
108106
}
109107

110108
// Feature B
111-
export function FeatureB({entity}: ShadowObjectCreationAPI) {
109+
export function FeatureB({emit}: ShadowObjectCreationAPI) {
112110
// Emit event via the entity
113-
emit(entity, 'data-loaded', {id: 123});
111+
emit('data-loaded', {id: 123});
114112
}
115113
```
116114

@@ -119,9 +117,7 @@ export function FeatureB({entity}: ShadowObjectCreationAPI) {
119117
You can broadcast events to all descendant Entities using the `traverse` helper. This is useful for "global" updates like a frame tick or a resize event.
120118

121119
```typescript
122-
import {emit} from '@spearwolf/eventize';
123-
124-
export function StageController({entity, on}: ShadowObjectCreationAPI) {
120+
export function StageController({emit, entity, on}: ShadowObjectCreationAPI) {
125121
// Example: Broadcast a 'frame-update' event to the entire subtree
126122
on('tick', (deltaTime) => {
127123
entity.traverse((e) => {

packages/shadow-objects/docs/02-guides/02-creating-shadow-objects.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,16 @@ Communication isn't just data syncing; it's also about events.
127127

128128
### Listening to View Events
129129

130-
When the View Component dispatches an event (e.g., via `component.dispatchShadowObjectsEvent('submit', { secret: '999' })`), you receive it on the entity.
130+
When the View Component dispatches an event (e.g., via `component.dispatchShadowObjectsEvent('submit', { secret: '999' })`), you receive it via the `onViewEvent` callback.
131131

132132
```typescript
133-
import { onViewEvent } from '@spearwolf/shadow-objects/shadow-objects.js';
134-
135-
// entity is used as event source by default
136-
on(onViewEvent, (type, data) => {
137-
if (type === 'submit') {
138-
submitForm(data);
139-
}
140-
});
133+
export function FormLogic({ onViewEvent }: ShadowObjectCreationAPI) {
134+
onViewEvent((type, data) => {
135+
if (type === 'submit') {
136+
submitForm(data);
137+
}
138+
});
139+
}
141140
```
142141

143142
### Emitting Events to the View

0 commit comments

Comments
 (0)