@spearwolf/shadow-objects 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,9 +5,39 @@ All notable changes to [@spearwolf/shadow-objects](https://github.com/spearwolf/
5
5
  The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## unreleased
8
+ ## [0.28.0] - 2026-01-20
9
+
10
+ - **API Update:** `on()` and `once()` in `ShadowObjectCreationAPI` now support an implicit event source.
11
+ - If the first argument is a `string`, `symbol`, or `[]`, the `entity` is automatically used as the event source.
12
+ - Example: `on('eventName', callback)` is equivalent to `on(entity, 'eventName', callback)`.
13
+ - This simplifies the common case of listening to entity events.
14
+ - **API Update:** introduce `onViewEvent()` in `ShadowObjectCreationAPI`
15
+ - Simplifies listening to view events dispatched to the entity.
16
+ - Example:
17
+ ```typescript
18
+ onViewEvent((type, data) => {
19
+ if (type === 'my-event') {
20
+ // handle event
21
+ }
22
+ });
23
+ ```
24
+ - **Refactor** the `EntityApi` type
25
+ - **Refactor** the `useProperties` supports type maps now
26
+ - **Documentation:** Comprehensive update to the documentation structure and content.
9
27
 
10
- - sharpen the `EntityApi` type definitions
28
+ ### ⚠️ Breaking Changes
29
+ - The _entity_ events `onCreate`, `onDestroy`, `onParentChanged` and `onViewEvent` changed to _symbols_.
30
+ - Update your event listeners accordingly:
31
+ - import the event symbols from the package:
32
+ ```typescript
33
+ import { onCreate, onDestroy, onParentChanged, onViewEvent } from '@spearwolf/shadow-objects/shadow-objects.js';
34
+ ```
35
+ - _Functional Shadow-Objects:_
36
+ - **Before:** `on(entity, 'onCreate', ...)`
37
+ - **After:** `on(onCreate, ...)`
38
+ - _Class-based Shadow-Objects:_
39
+ - **Before:** `onCreate(entity)`
40
+ - **After:** `[onCreate](entity)`
11
41
 
12
42
  ## [0.27.0] - 2026-01-19
13
43
 
package/README.md CHANGED
@@ -1,51 +1,18 @@
1
- # Shadow Objects Framework 🧛
1
+ # Shadow Objects Framework
2
2
 
3
- The **Shadow Objects Framework** is a reactive library designed to decouple business logic and state management from the UI rendering layer. It allows your application logic to run "in the dark" (typically in a Web Worker), mirroring the view hierarchy of your application.
3
+ This package contains the core library for the **Shadow Objects Framework**.
4
4
 
5
- > [!WARNING]
6
- > 🚀 This is a highly experimental framework that is slowly maturing. Use at your own risk. 🔥
5
+ **👉 [Read the Documentation](./docs/README.md)**
7
6
 
8
- ## Documentation
7
+ ## Contents
9
8
 
10
- **👉 The complete and authoritative documentation is located in the [docs/](./docs/) directory.**
9
+ * [**Concepts**](./docs/01-concepts/): Understand the mental model, architecture, and lifecycle.
10
+ * [**Guides**](./docs/02-guides/): Step-by-step instructions.
11
+ * [**API Reference**](./docs/03-api/): Detailed API docs.
12
+ * [**Best Practices & Patterns**](./docs/04-patterns/): Idiomatic usage and design patterns.
11
13
 
12
- * [**Fundamentals**](./docs/01-fundamentals/): Understand the mental model, architecture, and lifecycle.
13
- * [**Guides**](./docs/02-guides/): Step-by-step instructions for getting started and building with Shadow Objects.
14
- * [**API Reference**](./docs/03-api/): Detailed API documentation for Shadow Objects and the Registry.
15
-
16
- ## Overview
17
-
18
- ### What is it?
19
-
20
- Shadow Objects creates a strict separation between the **View** (what the user sees) and the **Logic** (how the application behaves).
21
-
22
- * **View (Browser Window):** Handles rendering and user input. It remains lightweight and "dumb".
23
- * **Logic (Web Worker):** Manages state, side effects, and business rules. It is organized as "Shadow Objects" that are attached to abstract "Entities".
24
-
25
- ### Installation
26
-
27
- The framework is available as an npm package:
14
+ ## Installation
28
15
 
29
16
  ```bash
30
17
  npm install @spearwolf/shadow-objects
31
18
  ```
32
-
33
- ### Integration
34
-
35
- To integrate Shadow Objects into your project, you connect the View to your Logic using tokens.
36
-
37
- 1. **Define Logic**: Write your Shadow Objects (logic units) using the functional API.
38
- 2. **Register**: Map your Shadow Objects to **Tokens** in a module definition.
39
- 3. **Connect View**: Use the provided Web Components to load your module and build your UI hierarchy.
40
-
41
- ```html
42
- <!-- 1. Initialize the Environment & Load Logic -->
43
- <shae-worker src="./my-logic-module.js"></shae-worker>
44
-
45
- <!-- 2. Create Entities in the View -->
46
- <shae-ent token="my-feature">
47
- <!-- The framework automatically instantiates the Shadow Object mapped to "my-feature" in the worker -->
48
- </shae-ent>
49
- ```
50
-
51
- For detailed setup instructions, please refer to the [Getting Started](./docs/02-guides/01-getting-started.md) guide.