@spearwolf/shadow-objects 0.6.0 → 0.8.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/README.md +28 -57
- package/bundle.js +4 -4
- package/package.json +7 -3
- package/src/create-worker.bundle.d.ts.map +1 -1
- package/src/create-worker.bundle.js +4 -2
- package/src/create-worker.bundle.js.map +1 -1
- package/src/elements/ShaeElement.d.ts +5 -5
- package/src/elements/ShaeElement.d.ts.map +1 -1
- package/src/elements/ShaeElement.js +22 -17
- package/src/elements/ShaeElement.js.map +1 -1
- package/src/elements/ShaeEntElement.d.ts.map +1 -1
- package/src/elements/ShaeEntElement.js +6 -8
- package/src/elements/ShaeEntElement.js.map +1 -1
- package/src/elements/ShaeWorkerElement.d.ts +4 -0
- package/src/elements/ShaeWorkerElement.d.ts.map +1 -1
- package/src/elements/ShaeWorkerElement.js +3 -8
- package/src/elements/ShaeWorkerElement.js.map +1 -1
- package/src/elements.d.ts +4 -0
- package/src/elements.d.ts.map +1 -0
- package/src/elements.js +4 -0
- package/src/elements.js.map +1 -0
- package/src/entities/Entity.d.ts.map +1 -1
- package/src/entities/Entity.js +6 -7
- package/src/entities/Entity.js.map +1 -1
- package/src/entities/ShadowObject.d.ts.map +1 -1
- package/src/entities/SignalsPath.d.ts +1 -1
- package/src/entities/SignalsPath.d.ts.map +1 -1
- package/src/entities/SignalsPath.js +2 -1
- package/src/entities/SignalsPath.js.map +1 -1
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +1 -1
- package/src/index.js +0 -6
- package/src/index.js.map +1 -1
- package/src/utils/ConsoleLogger.d.ts.map +1 -1
- package/src/utils/attr-utils.d.ts.map +1 -1
- package/src/utils/props-utils.d.ts.map +1 -1
- package/src/utils/toNamespace.d.ts.map +1 -1
- package/src/utils/toUrlString.d.ts.map +1 -1
- package/src/utils/waitForMessageOfType.d.ts.map +1 -1
- package/src/view/RemoteWorkerEnv.d.ts +1 -1
- package/src/view/RemoteWorkerEnv.d.ts.map +1 -1
- package/src/view/RemoteWorkerEnv.js +8 -8
- package/src/view/RemoteWorkerEnv.js.map +1 -1
- package/src/view/ViewComponent.d.ts +1 -1
- package/src/view/ViewComponent.js +2 -2
- package/src/worker/WorkerRuntime.d.ts.map +1 -1
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/src/entities/SignalsMap.d.ts +0 -12
- package/src/entities/SignalsMap.d.ts.map +0 -1
- package/src/entities/SignalsMap.js +0 -35
- package/src/entities/SignalsMap.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,69 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
_hi! welcome to .._
|
|
2
|
+
# shadow-objects 🧛
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
## Introduction
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
_Shadow-objects_ is a standalone entity component framework.
|
|
7
|
+
The original idea is visualized in this overview:
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Quick Tour
|
|
11
|
-
|
|
12
|
-
### Offloading to Web Workers :construction_worker:
|
|
13
|
-
|
|
14
|
-
shadow-objects takes the heavy lifting off your main thread and moves it to web workers. This means your components stay light and breezy, just like a hibiscus flower in the wind. :hibiscus:
|
|
15
|
-
|
|
16
|
-
### Entities :ghost:
|
|
17
|
-
|
|
18
|
-
Yes, we've got entities too! In shadow-objects, an _entity_ belongs to a _view-component_, but it lives in a _web worker_. That's why we call them _shadow-entities_. They're like the secret agents of your app, working behind the scenes in their own separate world.
|
|
19
|
-
|
|
20
|
-
### Shadow Objects :package:
|
|
21
|
-
|
|
22
|
-
The _shadow-objects_ are simple functions or classes created by the user (you!) and form logical units of code in which the real work is done behind the scenes.
|
|
23
|
-
|
|
24
|
-
Shadow-objects reside within the context of an entity and have access to the entity's properties and events, which mirror the properties and events of the view-components.
|
|
25
|
-
|
|
26
|
-
Any number of independent shadow-objects can be attached to an entity.
|
|
27
|
-
|
|
28
|
-
Shadow-objects can also provide any _context_ to other shadow-objects:
|
|
29
|
-
- a _context_ has a name and can consist of any JavaScript value or object.
|
|
30
|
-
- a _context_ is inherited by subtrees through the hierarchy of entities.
|
|
9
|
+

|
|
31
10
|
|
|
11
|
+
> _ents_ is short for latin _"entitatis"_, which translates to _"shadow entities"_
|
|
32
12
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
A `<view-component/>` is a virtual component in the view that serves as an access point for the entities.
|
|
37
|
-
|
|
38
|
-
The _shadow-ents_ package provides the custom element `<shadow-objects>` as view component. As a HTML element in the DOM, these might form their own hierarchy.
|
|
39
|
-
This hierarchy is mirrored by the entities in the worker, keeping everything in sync.
|
|
40
|
-
|
|
41
|
-
In the future, implementations as _react_ or _angular_ components are also conceivable.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Component Context :brain:
|
|
45
|
-
|
|
46
|
-
The _component-context_ is the root of a view-component hierarchy. It's like the conductor of an orchestra, creating a web worker and making sure the entities and their components are in harmony.
|
|
47
|
-
|
|
48
|
-
### Kernel :nut_and_bolt:
|
|
49
|
-
|
|
50
|
-
Inside the worker, there's the _kernel_. It's the counterpart to the component-context, taking care of the lifecycle of the entities and their _shadow-objects_.
|
|
51
|
-
|
|
52
|
-
### Tokens :label:
|
|
13
|
+
> [!IMPORTANT]
|
|
14
|
+
> _Dear adventurer, be warned: everything here is highly experimental and in active development and constant flux!_
|
|
53
15
|
|
|
54
|
-
|
|
16
|
+
The components are created in the view space. Hierarchical. In your browser. There is a JavaScript API for this. But to keep things simple, there are also ready-to-use web components.
|
|
55
17
|
|
|
56
|
-
|
|
18
|
+
```html
|
|
19
|
+
<shae-worker-env local? src="./my-personal-shadow-objects.js" />
|
|
57
20
|
|
|
58
|
-
|
|
21
|
+
<shae-ent ns? token="foo">
|
|
22
|
+
<shae-ent ns? token="bar">
|
|
23
|
+
<shae-prop name="myNumbers" value="1 2 3" type="integer[]" />
|
|
24
|
+
</shae-ent>
|
|
25
|
+
</shae-ent>
|
|
26
|
+
```
|
|
59
27
|
|
|
60
|
-
|
|
28
|
+
> [!WARNING]
|
|
29
|
+
> Sorry, at this point there should be a precise and crisp introduction to the concepts of the framework, but unfortunately this is not currently available.
|
|
30
|
+
> Instead of that, a few insights into the implementation will follow
|
|
61
31
|
|
|
62
|
-
|
|
32
|
+
TODO ... add documentation here ... !
|
|
63
33
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- [ComponentContext](./src/view/ComponentContext.md)
|
|
67
|
-
- [ViewComponent](./src/view/ViewComponent.md)
|
|
34
|
+
Here is the big class graph overview:
|
|
35
|
+

|
|
68
36
|
|
|
69
|
-
|
|
37
|
+
More in-depth docs here:
|
|
38
|
+
- [ShadowEnv](https://github.com/spearwolf/shadow-objects/blob/main/packages/shadow-objects/src/view/README.md)
|
|
39
|
+
- [ComponentContext](https://github.com/spearwolf/shadow-objects/blob/main/packages/shadow-objects/src/view/ComponentContext.md)
|
|
40
|
+
- [ViewComponent](https://github.com/spearwolf/shadow-objects/blob/main/packages/shadow-objects/src/view/ViewComponent.md)
|