@spearwolf/shadow-objects 0.24.0 → 0.26.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 +11 -1
- package/README.md +9 -10
- package/bundle.js +3 -3
- package/package.json +1 -1
- package/src/elements/ShaeEntElement.d.ts.map +1 -1
- package/src/elements/ShaeEntElement.js +1 -0
- package/src/elements/ShaeEntElement.js.map +1 -1
- package/src/elements/ShaePropElement.d.ts.map +1 -1
- package/src/elements/ShaePropElement.js +1 -0
- package/src/elements/ShaePropElement.js.map +1 -1
- package/src/elements/ShaeWorkerElement.d.ts.map +1 -1
- package/src/elements/ShaeWorkerElement.js +1 -0
- package/src/elements/ShaeWorkerElement.js.map +1 -1
- package/src/in-the-dark/Kernel.d.ts.map +1 -1
- package/src/in-the-dark/Kernel.js +50 -30
- package/src/in-the-dark/Kernel.js.map +1 -1
- package/src/types.d.ts +7 -3
- package/src/types.d.ts.map +1 -1
- package/src/types.js +1 -1
- package/src/types.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ 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
|
+
## [0.26.0] - 2026-01-08
|
|
9
|
+
|
|
10
|
+
- `provideContext()` and `provideGlobalContext()` expect as third argument now an option object `{compare?, clearOnDestroy?}`
|
|
11
|
+
- the old way (third argument as `isEqual` callback) will continue to work but is now deprecated!
|
|
12
|
+
- both `provide*Context()` features will now clear the context value to _undefined_ on shadow-object destruction by default
|
|
13
|
+
- opt out via `{clearOnDestroy: false}`
|
|
14
|
+
|
|
15
|
+
## [0.25.0] - 2025-12-31
|
|
16
|
+
|
|
17
|
+
- use `display: contents` style for all shadow object host elements to avoid layout issues
|
|
18
|
+
|
|
8
19
|
## [0.24.0] - 2025-11-27
|
|
9
20
|
|
|
10
21
|
- renamed interface `ShadowObjectParams` to `ShadowObjectCreationAPI` for clarity and consistency with the concept of the _Shadow Object Creation API_
|
|
@@ -16,4 +27,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
27
|
- added the `useProperties()` function
|
|
17
28
|
- added the `useResource()` function
|
|
18
29
|
- added lots of new tests and improved code coverage
|
|
19
|
-
|
package/README.md
CHANGED
|
@@ -46,28 +46,27 @@ import { ShadowObjectCreationAPI } from "@spearwolf/shadow-objects";
|
|
|
46
46
|
|
|
47
47
|
export function MyShadowObject({
|
|
48
48
|
useProperty,
|
|
49
|
-
useContext,
|
|
50
49
|
createEffect,
|
|
51
|
-
on,
|
|
52
50
|
onDestroy
|
|
53
51
|
}: ShadowObjectCreationAPI) {
|
|
54
52
|
|
|
55
|
-
//
|
|
53
|
+
// Read Properties
|
|
56
54
|
const title = useProperty("title");
|
|
57
55
|
|
|
58
|
-
//
|
|
56
|
+
// React to changes
|
|
59
57
|
createEffect(() => {
|
|
60
58
|
console.log("Title is now:", title());
|
|
61
59
|
});
|
|
62
60
|
|
|
63
|
-
//
|
|
61
|
+
// Handle Lifecycle
|
|
64
62
|
onDestroy(() => {
|
|
65
63
|
console.log("Shadow Object destroyed");
|
|
66
64
|
});
|
|
67
65
|
|
|
68
|
-
//
|
|
66
|
+
// Return public methods (optional)
|
|
67
|
+
// These can be called by events (more on that later)
|
|
69
68
|
return {
|
|
70
|
-
|
|
69
|
+
doSomething() { /* ... */ }
|
|
71
70
|
};
|
|
72
71
|
}
|
|
73
72
|
```
|
|
@@ -144,12 +143,12 @@ In your HTML or View layer, you use the provided Web Components to create the En
|
|
|
144
143
|
<shae-worker-env src="./my-module.js"></shae-worker-env>
|
|
145
144
|
|
|
146
145
|
<!-- 2. Create Entities -->
|
|
147
|
-
<shae-ent token="my-
|
|
146
|
+
<shae-ent token="my-entity">
|
|
148
147
|
<!-- Properties -->
|
|
149
148
|
<shae-prop name="title" value="Hello World"></shae-prop>
|
|
150
149
|
|
|
151
150
|
<!-- Nested Entities -->
|
|
152
|
-
<shae-ent token="child-
|
|
151
|
+
<shae-ent token="child-entity"></shae-ent>
|
|
153
152
|
</shae-ent>
|
|
154
153
|
```
|
|
155
154
|
|
|
@@ -159,7 +158,7 @@ In your HTML or View layer, you use the provided Web Components to create the En
|
|
|
159
158
|
|
|
160
159
|
### Lifecycle
|
|
161
160
|
|
|
162
|
-
1. **Creation**: When an Entity is created (e.g., `<shae-ent>` connects), the Kernel looks up its Token in the Registry.
|
|
161
|
+
1. **Creation**: When an Entity is created (e.g., `<shae-ent>` connects to the document), the Kernel looks up its Token in the Registry.
|
|
163
162
|
2. **Instantiation**: The Kernel instantiates all Shadow Objects associated with that Token (and its routes).
|
|
164
163
|
3. **Execution**: The Shadow Object function runs, setting up signals, effects, and context providers.
|
|
165
164
|
4. **Updates**:
|