revojs 0.0.60 → 0.0.61
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/dist/index.js
CHANGED
|
@@ -111,15 +111,9 @@ var Scope = class extends EventTarget {
|
|
|
111
111
|
context;
|
|
112
112
|
constructor(parentScope) {
|
|
113
113
|
super();
|
|
114
|
-
this.context = /* @__PURE__ */ new Map();
|
|
115
|
-
this.setParentScope(parentScope);
|
|
116
|
-
}
|
|
117
|
-
getParentScope() {
|
|
118
|
-
return this.parentScope;
|
|
119
|
-
}
|
|
120
|
-
setParentScope(parentScope) {
|
|
121
114
|
this.parentScope = parentScope;
|
|
122
|
-
|
|
115
|
+
this.parentScope?.onStop(() => this.stop());
|
|
116
|
+
this.context = /* @__PURE__ */ new Map();
|
|
123
117
|
}
|
|
124
118
|
getContext(input) {
|
|
125
119
|
let scope = this;
|
|
@@ -160,7 +154,13 @@ var Handler = class Handler {
|
|
|
160
154
|
const set = computes.get(key) ?? /* @__PURE__ */ new Set();
|
|
161
155
|
computes.set(key, set.add(compute));
|
|
162
156
|
targets.set(target, computes);
|
|
163
|
-
compute.
|
|
157
|
+
compute.parentScope?.onStop(() => {
|
|
158
|
+
set.delete(compute);
|
|
159
|
+
if (set.size === 0) {
|
|
160
|
+
computes.delete(key);
|
|
161
|
+
if (computes.size === 0) targets.delete(target);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
164
|
}
|
|
165
165
|
const value = Reflect.get(target, key);
|
|
166
166
|
if (value) {
|
|
@@ -416,7 +416,7 @@ const toCustomElement = (Component) => {
|
|
|
416
416
|
return findParentScope(node.parentNode);
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
|
-
this.component.scope.
|
|
419
|
+
this.component.scope.parentScope = findParentScope(this.parentNode);
|
|
420
420
|
if (this.component.shadowRoot) rootNode = this.shadowRoot ?? this.attachShadow(this.component.shadowRoot);
|
|
421
421
|
for (const [name, event] of Object.entries(Component.$events)) Reflect.set(this.component.events, name, (value) => {
|
|
422
422
|
if (value instanceof Event) return;
|
package/dist/presets/bun.js
CHANGED
|
@@ -9,15 +9,9 @@ var Scope = class extends EventTarget {
|
|
|
9
9
|
context;
|
|
10
10
|
constructor(parentScope) {
|
|
11
11
|
super();
|
|
12
|
-
this.context = /* @__PURE__ */ new Map();
|
|
13
|
-
this.setParentScope(parentScope);
|
|
14
|
-
}
|
|
15
|
-
getParentScope() {
|
|
16
|
-
return this.parentScope;
|
|
17
|
-
}
|
|
18
|
-
setParentScope(parentScope) {
|
|
19
12
|
this.parentScope = parentScope;
|
|
20
|
-
|
|
13
|
+
this.parentScope?.onStop(() => this.stop());
|
|
14
|
+
this.context = /* @__PURE__ */ new Map();
|
|
21
15
|
}
|
|
22
16
|
getContext(input) {
|
|
23
17
|
let scope = this;
|
package/dist/signals/index.d.ts
CHANGED
|
@@ -10,11 +10,9 @@ export declare class StopEvent extends Event {
|
|
|
10
10
|
constructor();
|
|
11
11
|
}
|
|
12
12
|
export declare class Scope extends EventTarget {
|
|
13
|
-
|
|
13
|
+
parentScope?: Scope;
|
|
14
14
|
readonly context: Map<string, unknown>;
|
|
15
15
|
constructor(parentScope?: Scope);
|
|
16
|
-
getParentScope(): Scope | undefined;
|
|
17
|
-
setParentScope(parentScope?: Scope): void | undefined;
|
|
18
16
|
getContext<T>(input: Descriptor<T>): T;
|
|
19
17
|
setContext<T>(input: Descriptor<T>, value: T): void;
|
|
20
18
|
onStop(input: (event: StopEvent) => void): void;
|