@spearwolf/shadow-objects 0.30.2 → 0.31.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 +18 -0
- package/bundle.js +13 -13
- package/package.json +3 -3
- package/src/bundle.js +4 -4
- package/src/bundle.js.map +7 -1
- package/src/constants.js +53 -40
- package/src/constants.js.map +7 -1
- package/src/create-worker.bundle.js +6 -8
- package/src/create-worker.bundle.js.map +7 -1
- package/src/create-worker.js +5 -2
- package/src/create-worker.js.map +7 -1
- package/src/elements/ShaeElement.js +57 -54
- package/src/elements/ShaeElement.js.map +7 -1
- package/src/elements/ShaeEntElement.d.ts.map +1 -1
- package/src/elements/ShaeEntElement.js +320 -341
- package/src/elements/ShaeEntElement.js.map +7 -1
- package/src/elements/ShaePropElement.js +312 -320
- package/src/elements/ShaePropElement.js.map +7 -1
- package/src/elements/ShaeWorkerElement.js +234 -229
- package/src/elements/ShaeWorkerElement.js.map +7 -1
- package/src/elements/constants.js +37 -22
- package/src/elements/constants.js.map +7 -1
- package/src/elements/events.d.ts +1 -1
- package/src/elements/events.d.ts.map +1 -1
- package/src/elements/events.js +1 -2
- package/src/elements/events.js.map +7 -1
- package/src/elements.js +4 -4
- package/src/elements.js.map +7 -1
- package/src/in-the-dark/Entity.d.ts +1 -1
- package/src/in-the-dark/Entity.d.ts.map +1 -1
- package/src/in-the-dark/Entity.js +299 -293
- package/src/in-the-dark/Entity.js.map +7 -1
- package/src/in-the-dark/Kernel.d.ts.map +1 -1
- package/src/in-the-dark/Kernel.js +556 -533
- package/src/in-the-dark/Kernel.js.map +7 -1
- package/src/in-the-dark/Registry.d.ts.map +1 -1
- package/src/in-the-dark/Registry.js +101 -104
- package/src/in-the-dark/Registry.js.map +7 -1
- package/src/in-the-dark/ShadowObject.d.ts.map +1 -1
- package/src/in-the-dark/ShadowObject.js +21 -23
- package/src/in-the-dark/ShadowObject.js.map +7 -1
- package/src/in-the-dark/SignalsPath.d.ts.map +1 -1
- package/src/in-the-dark/SignalsPath.js +139 -123
- package/src/in-the-dark/SignalsPath.js.map +7 -1
- package/src/in-the-dark/events.js +11 -9
- package/src/in-the-dark/events.js.map +7 -1
- package/src/in-the-dark/importModule.js +31 -29
- package/src/in-the-dark/importModule.js.map +7 -1
- package/src/index.d.ts +2 -2
- package/src/index.d.ts.map +1 -1
- package/src/index.js +14 -14
- package/src/index.js.map +7 -1
- package/src/shadow-objects.js +6 -6
- package/src/shadow-objects.js.map +7 -1
- package/src/shadow-objects.worker.js +3 -3
- package/src/shadow-objects.worker.js.map +7 -1
- package/src/shae-ent.js +3 -3
- package/src/shae-ent.js.map +7 -1
- package/src/shae-prop.js +3 -3
- package/src/shae-prop.js.map +7 -1
- package/src/shae-worker.js +3 -3
- package/src/shae-worker.js.map +7 -1
- package/src/types.d.ts +3 -2
- package/src/types.d.ts.map +1 -1
- package/src/types.js +1 -2
- package/src/types.js.map +7 -1
- package/src/utils/ConsoleLogger.js +179 -185
- package/src/utils/ConsoleLogger.js.map +7 -1
- package/src/utils/FrameLoop.js +41 -40
- package/src/utils/FrameLoop.js.map +7 -1
- package/src/utils/array-utils.js +22 -24
- package/src/utils/array-utils.js.map +7 -1
- package/src/utils/attr-utils.js +15 -11
- package/src/utils/attr-utils.js.map +7 -1
- package/src/utils/constants.js +5 -2
- package/src/utils/constants.js.map +7 -1
- package/src/utils/generateUUID.d.ts.map +1 -1
- package/src/utils/generateUUID.js +269 -32
- package/src/utils/generateUUID.js.map +7 -1
- package/src/utils/props-utils.js +34 -43
- package/src/utils/props-utils.js.map +7 -1
- package/src/utils/toMaybe.js +5 -2
- package/src/utils/toMaybe.js.map +7 -1
- package/src/utils/toNamespace.js +6 -3
- package/src/utils/toNamespace.js.map +7 -1
- package/src/utils/toUrlString.js +9 -6
- package/src/utils/toUrlString.js.map +7 -1
- package/src/utils/waitForMessageOfType.js +30 -32
- package/src/utils/waitForMessageOfType.js.map +7 -1
- package/src/view/ComponentChanges.d.ts +1 -1
- package/src/view/ComponentChanges.d.ts.map +1 -1
- package/src/view/ComponentChanges.js +249 -251
- package/src/view/ComponentChanges.js.map +7 -1
- package/src/view/ComponentContext.d.ts.map +1 -1
- package/src/view/ComponentContext.js +303 -331
- package/src/view/ComponentContext.js.map +7 -1
- package/src/view/ComponentMemory.d.ts +1 -0
- package/src/view/ComponentMemory.d.ts.map +1 -1
- package/src/view/ComponentMemory.js +73 -76
- package/src/view/ComponentMemory.js.map +7 -1
- package/src/view/IShadowObjectEnvProxy.js +1 -2
- package/src/view/IShadowObjectEnvProxy.js.map +7 -1
- package/src/view/LocalShadowObjectEnv.d.ts.map +1 -1
- package/src/view/LocalShadowObjectEnv.js +57 -52
- package/src/view/LocalShadowObjectEnv.js.map +7 -1
- package/src/view/RemoteWorkerEnv.js +134 -123
- package/src/view/RemoteWorkerEnv.js.map +7 -1
- package/src/view/ShadowEnv.d.ts.map +1 -1
- package/src/view/ShadowEnv.js +232 -228
- package/src/view/ShadowEnv.js.map +7 -1
- package/src/view/ViewComponent.d.ts +9 -0
- package/src/view/ViewComponent.d.ts.map +1 -1
- package/src/view/ViewComponent.js +142 -130
- package/src/view/ViewComponent.js.map +7 -1
- package/src/view/cloneChangeTrail.js +13 -11
- package/src/view/cloneChangeTrail.js.map +7 -1
- package/src/worker/MessageRouter.d.ts.map +1 -1
- package/src/worker/MessageRouter.js +78 -67
- package/src/worker/MessageRouter.js.map +7 -1
- package/src/worker/WorkerRuntime.js +22 -21
- package/src/worker/WorkerRuntime.js.map +7 -1
- package/tsconfig.lib.tsbuildinfo +0 -1
package/src/view/ShadowEnv.js
CHANGED
|
@@ -1,232 +1,236 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
5
|
+
var __typeError = (msg) => {
|
|
6
|
+
throw TypeError(msg);
|
|
7
|
+
};
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
|
|
11
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
12
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
13
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
14
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
15
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
16
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
17
|
+
return value;
|
|
27
18
|
};
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
20
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
21
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
22
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
23
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
24
|
+
return __privateGet(this, extra);
|
|
25
|
+
}, set [name](x) {
|
|
26
|
+
return __privateSet(this, extra, x);
|
|
27
|
+
} }, name));
|
|
28
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
29
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
30
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
31
|
+
if (k) {
|
|
32
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
33
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
34
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
37
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
38
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
39
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
40
|
+
}
|
|
41
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
34
42
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
#comCtx;
|
|
66
|
-
#shaObjEnvProxy;
|
|
67
|
-
#syncScheduled;
|
|
68
|
-
#syncAfterContextCreated;
|
|
69
|
-
#syncWaitForConfirmation;
|
|
70
|
-
#afterNextSync;
|
|
71
|
-
#viewReady_accessor_storage;
|
|
72
|
-
get viewReady() { return this.#viewReady_accessor_storage; }
|
|
73
|
-
set viewReady(value) { this.#viewReady_accessor_storage = value; }
|
|
74
|
-
#proxyReady_accessor_storage;
|
|
75
|
-
get proxyReady() { return this.#proxyReady_accessor_storage; }
|
|
76
|
-
set proxyReady(value) { this.#proxyReady_accessor_storage = value; }
|
|
77
|
-
#isDestroyed;
|
|
78
|
-
get isDestroyed() {
|
|
79
|
-
return this.#isDestroyed;
|
|
80
|
-
}
|
|
81
|
-
constructor() {
|
|
82
|
-
this.#syncScheduled = false;
|
|
83
|
-
this.#syncAfterContextCreated = false;
|
|
84
|
-
this.#syncWaitForConfirmation = false;
|
|
85
|
-
this.logger = new ConsoleLogger('ShadowEnv');
|
|
86
|
-
this.ns$ = createSignal();
|
|
87
|
-
this.#viewReady_accessor_storage = __runInitializers(this, _viewReady_initializers, false);
|
|
88
|
-
this.#proxyReady_accessor_storage = (__runInitializers(this, _viewReady_extraInitializers), __runInitializers(this, _proxyReady_initializers, false));
|
|
89
|
-
this.#isDestroyed = (__runInitializers(this, _proxyReady_extraInitializers), false);
|
|
90
|
-
this.ready = async () => {
|
|
91
|
-
return this.isReady ? this : onceAsync(this, ShadowEnv.ContextCreated);
|
|
92
|
-
};
|
|
93
|
-
this.#syncIfScheduled = () => {
|
|
94
|
-
if (this.#syncScheduled) {
|
|
95
|
-
this.#syncNow();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
retain(this, ShadowEnv.ContextCreated);
|
|
99
|
-
on(this, ShadowEnv.ContextLost, Priority.AAA, () => {
|
|
100
|
-
retainClear(this, ShadowEnv.ContextCreated);
|
|
101
|
-
});
|
|
102
|
-
createEffect(() => {
|
|
103
|
-
if (this.viewReady && this.proxyReady) {
|
|
104
|
-
this.view.reCreateChanges();
|
|
105
|
-
emit(this, ShadowEnv.ContextCreated, this);
|
|
106
|
-
if (this.#syncAfterContextCreated) {
|
|
107
|
-
this.#syncAfterContextCreated = false;
|
|
108
|
-
this.#syncNow();
|
|
109
|
-
}
|
|
110
|
-
return () => {
|
|
111
|
-
emit(this, ShadowEnv.ContextLost, this);
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}, [findObjectSignalByName(this, 'viewReady'), findObjectSignalByName(this, 'proxyReady')]);
|
|
115
|
-
}
|
|
116
|
-
get view() {
|
|
117
|
-
return this.#comCtx;
|
|
118
|
-
}
|
|
119
|
-
set view(ctx) {
|
|
120
|
-
if (ctx !== this.#comCtx) {
|
|
121
|
-
if (this.#comCtx && this.#comCtx.ns && globalThis.__shadowEnvs) {
|
|
122
|
-
globalThis.__shadowEnvs.delete(this.#comCtx.ns);
|
|
123
|
-
}
|
|
124
|
-
this.#comCtx = ctx ?? undefined;
|
|
125
|
-
if (this.#comCtx && this.#comCtx.ns) {
|
|
126
|
-
globalThis.__shadowEnvs ??= new Map();
|
|
127
|
-
if (globalThis.__shadowEnvs.has(this.#comCtx.ns) && globalThis.__shadowEnvs.get(this.#comCtx.ns) !== this) {
|
|
128
|
-
if (this.logger.isWarn) {
|
|
129
|
-
this.logger.warn('overwrite a namespace already in use', this.#comCtx.ns, globalThis.__shadowEnvs.get(this.#comCtx.ns));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
globalThis.__shadowEnvs.set(this.#comCtx.ns, this);
|
|
133
|
-
}
|
|
134
|
-
this.viewReady = Boolean(ctx);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
get envProxy() {
|
|
138
|
-
return this.#shaObjEnvProxy;
|
|
139
|
-
}
|
|
140
|
-
set envProxy(proxy) {
|
|
141
|
-
if (proxy !== this.#shaObjEnvProxy) {
|
|
142
|
-
const prevProxy = this.#shaObjEnvProxy;
|
|
143
|
-
this.#shaObjEnvProxy = proxy ?? undefined;
|
|
144
|
-
if (this.#shaObjEnvProxy) {
|
|
145
|
-
this.#shaObjEnvProxy.onMessageToView = this.#onMessageToView.bind(this);
|
|
146
|
-
}
|
|
147
|
-
if (prevProxy) {
|
|
148
|
-
prevProxy.destroy();
|
|
149
|
-
}
|
|
150
|
-
this.proxyReady = false;
|
|
151
|
-
proxy
|
|
152
|
-
?.start()
|
|
153
|
-
.then(() => {
|
|
154
|
-
this.proxyReady = true;
|
|
155
|
-
})
|
|
156
|
-
.catch((error) => {
|
|
157
|
-
this.logger.error('failed to start envProxy', error);
|
|
158
|
-
this.proxyReady = false;
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
get isReady() {
|
|
163
|
-
return Boolean(this.#comCtx && this.#shaObjEnvProxy && this.proxyReady && !this.isDestroyed);
|
|
164
|
-
}
|
|
165
|
-
sync() {
|
|
166
|
-
if (!this.isReady) {
|
|
167
|
-
this.#syncAfterContextCreated = true;
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (this.#syncScheduled)
|
|
171
|
-
return;
|
|
172
|
-
this.#syncScheduled = true;
|
|
173
|
-
queueMicrotask(this.#syncIfScheduled);
|
|
174
|
-
}
|
|
175
|
-
syncWait() {
|
|
176
|
-
this.#syncWaitForConfirmation = true;
|
|
177
|
-
this.sync();
|
|
178
|
-
if (this.#afterNextSync)
|
|
179
|
-
return this.#afterNextSync;
|
|
180
|
-
this.#afterNextSync = onceAsync(this, ShadowEnv.AfterSync).then((changeTrail) => {
|
|
181
|
-
this.#afterNextSync = undefined;
|
|
182
|
-
return changeTrail;
|
|
183
|
-
});
|
|
184
|
-
return this.#afterNextSync;
|
|
185
|
-
}
|
|
186
|
-
destroy() {
|
|
187
|
-
const ns = this.#comCtx?.ns;
|
|
188
|
-
this.envProxy?.destroy();
|
|
189
|
-
this.envProxy = undefined;
|
|
190
|
-
this.view = undefined;
|
|
191
|
-
if (ns) {
|
|
192
|
-
if (globalThis.__shadowEnvs.has(ns)) {
|
|
193
|
-
if (globalThis.__shadowEnvs.get(ns) === this) {
|
|
194
|
-
globalThis.__shadowEnvs.delete(ns);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
destroyObjectSignals(this);
|
|
199
|
-
off(this);
|
|
200
|
-
this.#isDestroyed = true;
|
|
201
|
-
Object.freeze(this);
|
|
202
|
-
}
|
|
203
|
-
#syncIfScheduled;
|
|
204
|
-
async #syncNow() {
|
|
205
|
-
this.#syncScheduled = false;
|
|
206
|
-
if (this.isReady) {
|
|
207
|
-
const data = this.view.buildChangeTrails();
|
|
208
|
-
if (data.length > 0) {
|
|
209
|
-
try {
|
|
210
|
-
const waitForConfirmation = this.#syncWaitForConfirmation;
|
|
211
|
-
this.#syncWaitForConfirmation = false;
|
|
212
|
-
await this.envProxy.applyChangeTrail(data, waitForConfirmation);
|
|
213
|
-
}
|
|
214
|
-
catch (error) {
|
|
215
|
-
this.logger.error('failed to apply change trail', error);
|
|
216
|
-
}
|
|
217
|
-
finally {
|
|
218
|
-
emit(this, ShadowEnv.AfterSync, data);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
#onMessageToView(event) {
|
|
224
|
-
if (this.logger.isDebug) {
|
|
225
|
-
this.logger.debug('onMessageToView', event.type, event.data);
|
|
226
|
-
}
|
|
227
|
-
this.view?.dispatchMessage(event.uuid, event.type, event.data, event.traverseChildren);
|
|
228
|
-
}
|
|
43
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
44
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
45
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
46
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
47
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
48
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
49
|
+
var _proxyReady_dec, _viewReady_dec, _comCtx, _shaObjEnvProxy, _syncScheduled, _syncAfterContextCreated, _syncWaitForConfirmation, _afterNextSync, _init, _viewReady, _proxyReady, _isDestroyed, _syncIfScheduled, _ShadowEnv_instances, syncNow_fn, onMessageToView_fn;
|
|
50
|
+
import { emit, off, on, onceAsync, Priority, retain, retainClear } from "@spearwolf/eventize";
|
|
51
|
+
import { createEffect, createSignal, destroyObjectSignals, findObjectSignalByName } from "@spearwolf/signalize";
|
|
52
|
+
import { signal } from "@spearwolf/signalize/decorators";
|
|
53
|
+
import { ConsoleLogger } from "../utils/ConsoleLogger.js";
|
|
54
|
+
import { ComponentContext } from "./ComponentContext.js";
|
|
55
|
+
_viewReady_dec = [signal()], _proxyReady_dec = [signal()];
|
|
56
|
+
const _ShadowEnv = class _ShadowEnv {
|
|
57
|
+
constructor() {
|
|
58
|
+
__privateAdd(this, _ShadowEnv_instances);
|
|
59
|
+
__privateAdd(this, _comCtx);
|
|
60
|
+
__privateAdd(this, _shaObjEnvProxy);
|
|
61
|
+
__privateAdd(this, _syncScheduled, false);
|
|
62
|
+
__privateAdd(this, _syncAfterContextCreated, false);
|
|
63
|
+
__privateAdd(this, _syncWaitForConfirmation, false);
|
|
64
|
+
__privateAdd(this, _afterNextSync);
|
|
65
|
+
this.logger = new ConsoleLogger("ShadowEnv");
|
|
66
|
+
this.ns$ = createSignal();
|
|
67
|
+
__privateAdd(this, _viewReady, __runInitializers(_init, 8, this, false)), __runInitializers(_init, 11, this);
|
|
68
|
+
__privateAdd(this, _proxyReady, __runInitializers(_init, 12, this, false)), __runInitializers(_init, 15, this);
|
|
69
|
+
__privateAdd(this, _isDestroyed, false);
|
|
70
|
+
this.ready = async () => {
|
|
71
|
+
return this.isReady ? this : onceAsync(this, _ShadowEnv.ContextCreated);
|
|
229
72
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
73
|
+
__privateAdd(this, _syncIfScheduled, () => {
|
|
74
|
+
if (__privateGet(this, _syncScheduled)) {
|
|
75
|
+
__privateMethod(this, _ShadowEnv_instances, syncNow_fn).call(this);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const self = this;
|
|
79
|
+
retain(self, _ShadowEnv.ContextCreated);
|
|
80
|
+
on(self, _ShadowEnv.ContextLost, Priority.AAA, () => {
|
|
81
|
+
retainClear(self, _ShadowEnv.ContextCreated);
|
|
82
|
+
});
|
|
83
|
+
createEffect(() => {
|
|
84
|
+
if (this.viewReady && this.proxyReady) {
|
|
85
|
+
this.view.reCreateChanges();
|
|
86
|
+
emit(self, _ShadowEnv.ContextCreated, self);
|
|
87
|
+
if (__privateGet(this, _syncAfterContextCreated)) {
|
|
88
|
+
__privateSet(this, _syncAfterContextCreated, false);
|
|
89
|
+
__privateMethod(this, _ShadowEnv_instances, syncNow_fn).call(this);
|
|
90
|
+
}
|
|
91
|
+
return () => {
|
|
92
|
+
emit(self, _ShadowEnv.ContextLost, self);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}, [findObjectSignalByName(this, "viewReady"), findObjectSignalByName(this, "proxyReady")]);
|
|
96
|
+
}
|
|
97
|
+
static get(ns) {
|
|
98
|
+
if (ns == null) return void 0;
|
|
99
|
+
return globalThis.__shadowEnvs?.get(ns);
|
|
100
|
+
}
|
|
101
|
+
get isDestroyed() {
|
|
102
|
+
return __privateGet(this, _isDestroyed);
|
|
103
|
+
}
|
|
104
|
+
get view() {
|
|
105
|
+
return __privateGet(this, _comCtx);
|
|
106
|
+
}
|
|
107
|
+
set view(ctx) {
|
|
108
|
+
if (ctx !== __privateGet(this, _comCtx)) {
|
|
109
|
+
if (__privateGet(this, _comCtx) && __privateGet(this, _comCtx).ns && globalThis.__shadowEnvs) {
|
|
110
|
+
globalThis.__shadowEnvs.delete(__privateGet(this, _comCtx).ns);
|
|
111
|
+
}
|
|
112
|
+
__privateSet(this, _comCtx, ctx ?? void 0);
|
|
113
|
+
if (__privateGet(this, _comCtx) && __privateGet(this, _comCtx).ns) {
|
|
114
|
+
globalThis.__shadowEnvs ??= /* @__PURE__ */ new Map();
|
|
115
|
+
if (globalThis.__shadowEnvs.has(__privateGet(this, _comCtx).ns) && globalThis.__shadowEnvs.get(__privateGet(this, _comCtx).ns) !== this) {
|
|
116
|
+
if (this.logger.isWarn) {
|
|
117
|
+
this.logger.warn(
|
|
118
|
+
"overwrite a namespace already in use",
|
|
119
|
+
__privateGet(this, _comCtx).ns,
|
|
120
|
+
globalThis.__shadowEnvs.get(__privateGet(this, _comCtx).ns)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
globalThis.__shadowEnvs.set(__privateGet(this, _comCtx).ns, this);
|
|
125
|
+
}
|
|
126
|
+
this.viewReady = Boolean(ctx);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
get envProxy() {
|
|
130
|
+
return __privateGet(this, _shaObjEnvProxy);
|
|
131
|
+
}
|
|
132
|
+
set envProxy(proxy) {
|
|
133
|
+
if (proxy !== __privateGet(this, _shaObjEnvProxy)) {
|
|
134
|
+
const prevProxy = __privateGet(this, _shaObjEnvProxy);
|
|
135
|
+
__privateSet(this, _shaObjEnvProxy, proxy ?? void 0);
|
|
136
|
+
if (__privateGet(this, _shaObjEnvProxy)) {
|
|
137
|
+
__privateGet(this, _shaObjEnvProxy).onMessageToView = __privateMethod(this, _ShadowEnv_instances, onMessageToView_fn).bind(this);
|
|
138
|
+
}
|
|
139
|
+
if (prevProxy) {
|
|
140
|
+
prevProxy.destroy();
|
|
141
|
+
}
|
|
142
|
+
this.proxyReady = false;
|
|
143
|
+
proxy?.start().then(() => {
|
|
144
|
+
this.proxyReady = true;
|
|
145
|
+
}).catch((error) => {
|
|
146
|
+
this.logger.error("failed to start envProxy", error);
|
|
147
|
+
this.proxyReady = false;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
get isReady() {
|
|
152
|
+
return Boolean(__privateGet(this, _comCtx) && __privateGet(this, _shaObjEnvProxy) && this.proxyReady && !this.isDestroyed);
|
|
153
|
+
}
|
|
154
|
+
sync() {
|
|
155
|
+
if (!this.isReady) {
|
|
156
|
+
__privateSet(this, _syncAfterContextCreated, true);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (__privateGet(this, _syncScheduled)) return;
|
|
160
|
+
__privateSet(this, _syncScheduled, true);
|
|
161
|
+
queueMicrotask(__privateGet(this, _syncIfScheduled));
|
|
162
|
+
}
|
|
163
|
+
syncWait() {
|
|
164
|
+
__privateSet(this, _syncWaitForConfirmation, true);
|
|
165
|
+
this.sync();
|
|
166
|
+
if (__privateGet(this, _afterNextSync)) return __privateGet(this, _afterNextSync);
|
|
167
|
+
__privateSet(this, _afterNextSync, onceAsync(this, _ShadowEnv.AfterSync).then((changeTrail) => {
|
|
168
|
+
__privateSet(this, _afterNextSync, void 0);
|
|
169
|
+
return changeTrail;
|
|
170
|
+
}));
|
|
171
|
+
return __privateGet(this, _afterNextSync);
|
|
172
|
+
}
|
|
173
|
+
destroy() {
|
|
174
|
+
const ns = __privateGet(this, _comCtx)?.ns;
|
|
175
|
+
this.envProxy?.destroy();
|
|
176
|
+
this.envProxy = void 0;
|
|
177
|
+
this.view = void 0;
|
|
178
|
+
if (ns) {
|
|
179
|
+
if (globalThis.__shadowEnvs.has(ns)) {
|
|
180
|
+
if (globalThis.__shadowEnvs.get(ns) === this) {
|
|
181
|
+
globalThis.__shadowEnvs.delete(ns);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
destroyObjectSignals(this);
|
|
186
|
+
off(this);
|
|
187
|
+
__privateSet(this, _isDestroyed, true);
|
|
188
|
+
Object.freeze(this);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
_init = __decoratorStart(null);
|
|
192
|
+
_comCtx = new WeakMap();
|
|
193
|
+
_shaObjEnvProxy = new WeakMap();
|
|
194
|
+
_syncScheduled = new WeakMap();
|
|
195
|
+
_syncAfterContextCreated = new WeakMap();
|
|
196
|
+
_syncWaitForConfirmation = new WeakMap();
|
|
197
|
+
_afterNextSync = new WeakMap();
|
|
198
|
+
_viewReady = new WeakMap();
|
|
199
|
+
_proxyReady = new WeakMap();
|
|
200
|
+
_isDestroyed = new WeakMap();
|
|
201
|
+
_syncIfScheduled = new WeakMap();
|
|
202
|
+
_ShadowEnv_instances = new WeakSet();
|
|
203
|
+
syncNow_fn = async function() {
|
|
204
|
+
__privateSet(this, _syncScheduled, false);
|
|
205
|
+
if (this.isReady) {
|
|
206
|
+
const data = this.view.buildChangeTrails();
|
|
207
|
+
if (data.length > 0) {
|
|
208
|
+
try {
|
|
209
|
+
const waitForConfirmation = __privateGet(this, _syncWaitForConfirmation);
|
|
210
|
+
__privateSet(this, _syncWaitForConfirmation, false);
|
|
211
|
+
await this.envProxy.applyChangeTrail(data, waitForConfirmation);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
this.logger.error("failed to apply change trail", error);
|
|
214
|
+
} finally {
|
|
215
|
+
emit(this, _ShadowEnv.AfterSync, data);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
onMessageToView_fn = function(event) {
|
|
221
|
+
if (this.logger.isDebug) {
|
|
222
|
+
this.logger.debug("onMessageToView", event.type, event.data);
|
|
223
|
+
}
|
|
224
|
+
this.view?.dispatchMessage(event.uuid, event.type, event.data, event.traverseChildren);
|
|
225
|
+
};
|
|
226
|
+
__decorateElement(_init, 4, "viewReady", _viewReady_dec, _ShadowEnv, _viewReady);
|
|
227
|
+
__decorateElement(_init, 4, "proxyReady", _proxyReady_dec, _ShadowEnv, _proxyReady);
|
|
228
|
+
__decoratorMetadata(_init, _ShadowEnv);
|
|
229
|
+
_ShadowEnv.AfterSync = "afterSync";
|
|
230
|
+
_ShadowEnv.ContextLost = "contextLost";
|
|
231
|
+
_ShadowEnv.ContextCreated = "contextCreated";
|
|
232
|
+
let ShadowEnv = _ShadowEnv;
|
|
233
|
+
export {
|
|
234
|
+
ShadowEnv
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=ShadowEnv.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/view/ShadowEnv.ts"],
|
|
4
|
+
"sourcesContent": ["import {emit, off, on, onceAsync, Priority, retain, retainClear} from '@spearwolf/eventize';\nimport {createEffect, createSignal, destroyObjectSignals, findObjectSignalByName} from '@spearwolf/signalize';\nimport {signal} from '@spearwolf/signalize/decorators';\nimport type {MessageToViewEvent} from '../shadow-objects.js';\nimport type {ChangeTrailType, NamespaceType} from '../types.js';\nimport {ConsoleLogger} from '../utils/ConsoleLogger.js';\nimport {ComponentContext} from './ComponentContext.js';\nimport type {IShadowObjectEnvProxy} from './IShadowObjectEnvProxy.js';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __shadowEnvs: Map<NamespaceType, ShadowEnv> | undefined;\n}\n\nexport class ShadowEnv {\n static AfterSync = 'afterSync';\n static ContextLost = 'contextLost';\n static ContextCreated = 'contextCreated';\n\n static get(ns: NamespaceType): ShadowEnv | undefined {\n if (ns == null) return undefined;\n return globalThis.__shadowEnvs?.get(ns);\n }\n\n #comCtx?: ComponentContext;\n #shaObjEnvProxy?: IShadowObjectEnvProxy;\n #syncScheduled = false;\n #syncAfterContextCreated = false;\n #syncWaitForConfirmation = false;\n #afterNextSync?: Promise<ChangeTrailType>;\n\n readonly logger = new ConsoleLogger('ShadowEnv');\n\n readonly ns$ = createSignal<NamespaceType | undefined>();\n\n @signal() accessor viewReady = false;\n @signal() accessor proxyReady = false;\n\n #isDestroyed = false;\n\n get isDestroyed() {\n return this.#isDestroyed;\n }\n\n constructor() {\n const self = this as ShadowEnv;\n retain(self, ShadowEnv.ContextCreated);\n\n on(self, ShadowEnv.ContextLost, Priority.AAA, () => {\n retainClear(self, ShadowEnv.ContextCreated);\n });\n\n createEffect(() => {\n if (this.viewReady && this.proxyReady) {\n this.view!.reCreateChanges();\n emit(self, ShadowEnv.ContextCreated, self);\n if (this.#syncAfterContextCreated) {\n this.#syncAfterContextCreated = false;\n this.#syncNow();\n }\n return () => {\n emit(self, ShadowEnv.ContextLost, self);\n };\n }\n }, [findObjectSignalByName(this, 'viewReady'), findObjectSignalByName(this, 'proxyReady')]);\n }\n\n get view(): ComponentContext | undefined {\n return this.#comCtx;\n }\n\n set view(ctx: ComponentContext | null | undefined) {\n if (ctx !== this.#comCtx) {\n if (this.#comCtx && this.#comCtx.ns && globalThis.__shadowEnvs) {\n globalThis.__shadowEnvs.delete(this.#comCtx.ns);\n }\n\n this.#comCtx = ctx ?? undefined;\n\n if (this.#comCtx && this.#comCtx.ns) {\n globalThis.__shadowEnvs ??= new Map();\n if (globalThis.__shadowEnvs.has(this.#comCtx.ns) && globalThis.__shadowEnvs.get(this.#comCtx.ns) !== this) {\n if (this.logger.isWarn) {\n this.logger.warn(\n 'overwrite a namespace already in use',\n this.#comCtx.ns,\n globalThis.__shadowEnvs.get(this.#comCtx.ns),\n );\n }\n }\n globalThis.__shadowEnvs.set(this.#comCtx.ns, this);\n }\n\n this.viewReady = Boolean(ctx);\n }\n }\n\n get envProxy(): IShadowObjectEnvProxy | undefined {\n return this.#shaObjEnvProxy;\n }\n\n set envProxy(proxy: IShadowObjectEnvProxy | null | undefined) {\n if (proxy !== this.#shaObjEnvProxy) {\n const prevProxy = this.#shaObjEnvProxy;\n this.#shaObjEnvProxy = proxy ?? undefined;\n\n if (this.#shaObjEnvProxy) {\n this.#shaObjEnvProxy.onMessageToView = this.#onMessageToView.bind(this);\n }\n\n if (prevProxy) {\n prevProxy.destroy();\n }\n\n this.proxyReady = false;\n\n proxy\n ?.start()\n .then(() => {\n this.proxyReady = true;\n })\n .catch((error) => {\n this.logger.error('failed to start envProxy', error);\n this.proxyReady = false;\n });\n }\n }\n\n get isReady(): boolean {\n return Boolean(this.#comCtx && this.#shaObjEnvProxy && this.proxyReady && !this.isDestroyed);\n }\n\n readonly ready = async (): Promise<ShadowEnv> => {\n return this.isReady ? this : onceAsync(this as ShadowEnv, ShadowEnv.ContextCreated);\n };\n\n sync(): void {\n if (!this.isReady) {\n this.#syncAfterContextCreated = true;\n return;\n }\n if (this.#syncScheduled) return;\n this.#syncScheduled = true;\n queueMicrotask(this.#syncIfScheduled);\n }\n\n syncWait(): Promise<ChangeTrailType> {\n this.#syncWaitForConfirmation = true;\n this.sync();\n if (this.#afterNextSync) return this.#afterNextSync;\n this.#afterNextSync = onceAsync<ChangeTrailType>(this as ShadowEnv, ShadowEnv.AfterSync).then((changeTrail) => {\n this.#afterNextSync = undefined;\n return changeTrail;\n });\n return this.#afterNextSync;\n }\n\n destroy() {\n const ns = this.#comCtx?.ns;\n\n this.envProxy?.destroy();\n this.envProxy = undefined;\n this.view = undefined;\n\n if (ns) {\n if (globalThis.__shadowEnvs.has(ns)) {\n if (globalThis.__shadowEnvs.get(ns) === this) {\n globalThis.__shadowEnvs.delete(ns);\n }\n }\n }\n\n destroyObjectSignals(this);\n off(this);\n\n this.#isDestroyed = true;\n Object.freeze(this);\n }\n\n #syncIfScheduled = () => {\n if (this.#syncScheduled) {\n this.#syncNow();\n }\n };\n\n async #syncNow() {\n this.#syncScheduled = false;\n if (this.isReady) {\n const data = this.view!.buildChangeTrails();\n if (data.length > 0) {\n try {\n const waitForConfirmation = this.#syncWaitForConfirmation;\n this.#syncWaitForConfirmation = false;\n await this.envProxy!.applyChangeTrail(data, waitForConfirmation);\n } catch (error) {\n this.logger.error('failed to apply change trail', error);\n } finally {\n emit(this as ShadowEnv, ShadowEnv.AfterSync, data);\n }\n }\n }\n }\n\n #onMessageToView(event: Omit<MessageToViewEvent, 'transferables'>) {\n if (this.logger.isDebug) {\n this.logger.debug('onMessageToView', event.type, event.data);\n }\n this.view?.dispatchMessage(event.uuid, event.type, event.data, event.traverseChildren);\n }\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAQ,MAAM,KAAK,IAAI,WAAW,UAAU,QAAQ,mBAAkB;AACtE,SAAQ,cAAc,cAAc,sBAAsB,8BAA6B;AACvF,SAAQ,cAAa;AAGrB,SAAQ,qBAAoB;AAC5B,SAAQ,wBAAuB;AA6B7B,kBAAC,OAAO,IACR,mBAAC,OAAO;AAtBH,MAAM,aAAN,MAAM,WAAU;AAAA,EA8BrB,cAAc;AA9BT;AAUL;AACA;AACA,uCAAiB;AACjB,iDAA2B;AAC3B,iDAA2B;AAC3B;AAEA,SAAS,SAAS,IAAI,cAAc,WAAW;AAE/C,SAAS,MAAM,aAAwC;AAE7C,uBAAS,YAAY,kBAArB,gBAAqB,SAArB;AACA,uBAAS,aAAa,kBAAtB,iBAAsB,S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AAM,gBAAgB,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,gBAAgB;AACvF;AA7KU,4BAAS,aAAnB,gBArBW,YAqBQ;AACT,4BAAS,cAAnB,iBAtBW,YAsBQ;AAtBd,2BAAM;AAAA,WACJ,YAAY;AADR,WAEJ,cAAc;AAFV,WAGJ,iBAAiB;AAHnB,IAAM,YAAN;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -15,11 +15,20 @@ export declare class ViewComponent {
|
|
|
15
15
|
*/
|
|
16
16
|
get order(): number;
|
|
17
17
|
set order(order: number | null | undefined);
|
|
18
|
+
/**
|
|
19
|
+
* Whether the corresponding entity should be destroyed when its parent entity is destroyed.
|
|
20
|
+
*
|
|
21
|
+
* Set via the constructor option of the same name; immutable after creation.
|
|
22
|
+
* Children that opt out (the default) are promoted to root entities when their
|
|
23
|
+
* parent is destroyed, so they remain reachable.
|
|
24
|
+
*/
|
|
25
|
+
get autoDestructionOnParentRemoval(): boolean;
|
|
18
26
|
constructor(token: string, options?: {
|
|
19
27
|
parent?: ViewComponent;
|
|
20
28
|
order?: number;
|
|
21
29
|
context?: ComponentContext;
|
|
22
30
|
uuid?: string;
|
|
31
|
+
autoDestructionOnParentRemoval?: boolean;
|
|
23
32
|
});
|
|
24
33
|
isChildOf(parent: ViewComponent): boolean;
|
|
25
34
|
removeFromParent(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewComponent.d.ts","sourceRoot":"","sources":["../../../src/view/ViewComponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AASvD,qBAAa,aAAa;;
|
|
1
|
+
{"version":3,"file":"ViewComponent.d.ts","sourceRoot":"","sources":["../../../src/view/ViewComponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AASvD,qBAAa,aAAa;;IAWxB,IAAI,IAAI,WAEP;IAED,I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