revojs 0.0.53 → 0.0.54
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/html/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface ComponentConstructor<TEvents extends Events, TAttributes extend
|
|
|
61
61
|
$events: TEvents;
|
|
62
62
|
$attributes: TAttributes;
|
|
63
63
|
$styles: Array<string>;
|
|
64
|
-
new (input?: Input<TEvents, TAttributes>,
|
|
64
|
+
new (input?: Input<TEvents, TAttributes>, parentScope?: Scope): Component<TEvents, TAttributes>;
|
|
65
65
|
}
|
|
66
66
|
export interface CustomElement<TEvents extends Events, TAttributes extends Attributes> extends HTMLElement {
|
|
67
67
|
readonly component: Component<TEvents, TAttributes>;
|
package/dist/index.js
CHANGED
|
@@ -110,9 +110,9 @@ var StopEvent = class extends Event {
|
|
|
110
110
|
var Scope = class extends EventTarget {
|
|
111
111
|
parentScope;
|
|
112
112
|
context;
|
|
113
|
-
constructor(
|
|
113
|
+
constructor(parentScope) {
|
|
114
114
|
super();
|
|
115
|
-
this.parentScope =
|
|
115
|
+
this.parentScope = parentScope;
|
|
116
116
|
this.context = new Map();
|
|
117
117
|
}
|
|
118
118
|
getContext(input) {
|
|
@@ -366,8 +366,8 @@ const defineComponent = (options) => {
|
|
|
366
366
|
events;
|
|
367
367
|
attributes;
|
|
368
368
|
shadowRoot;
|
|
369
|
-
constructor(input,
|
|
370
|
-
this.scope = new Scope(
|
|
369
|
+
constructor(input, parentScope) {
|
|
370
|
+
this.scope = new Scope(parentScope);
|
|
371
371
|
this.events = Object.keys(options.events ?? {}).reduce((output, name) => {
|
|
372
372
|
Reflect.set(output, name, input?.[name], output);
|
|
373
373
|
return output;
|
|
@@ -386,18 +386,22 @@ const defineComponent = (options) => {
|
|
|
386
386
|
const toCustomElement = (Component) => {
|
|
387
387
|
return class extends HTMLElement {
|
|
388
388
|
static formAssociated = true;
|
|
389
|
-
component
|
|
390
|
-
internals
|
|
391
|
-
|
|
392
|
-
|
|
389
|
+
component;
|
|
390
|
+
internals;
|
|
391
|
+
constructor() {
|
|
392
|
+
super();
|
|
393
393
|
const findParent = (node) => {
|
|
394
394
|
if (node) {
|
|
395
395
|
if ("component" in node) return node;
|
|
396
|
+
if (node instanceof ShadowRoot) return findParent(node.host);
|
|
396
397
|
return findParent(node.parentNode);
|
|
397
398
|
}
|
|
398
399
|
};
|
|
399
|
-
|
|
400
|
-
|
|
400
|
+
this.component = new Component(void 0, findParent(this.parentNode)?.component.scope);
|
|
401
|
+
this.internals = this.attachInternals();
|
|
402
|
+
}
|
|
403
|
+
async connectedCallback() {
|
|
404
|
+
let rootNode = this;
|
|
401
405
|
if (this.component.shadowRoot) rootNode = this.shadowRoot ?? this.attachShadow(this.component.shadowRoot);
|
|
402
406
|
for (const [name, event] of Object.entries(Component.$events)) Reflect.set(this.component.events, name, (value) => {
|
|
403
407
|
if (value instanceof Event) return;
|
package/dist/presets/bun.js
CHANGED
|
@@ -7,9 +7,9 @@ var StopEvent = class extends Event {
|
|
|
7
7
|
var Scope = class extends EventTarget {
|
|
8
8
|
parentScope;
|
|
9
9
|
context;
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(parentScope) {
|
|
11
11
|
super();
|
|
12
|
-
this.parentScope =
|
|
12
|
+
this.parentScope = parentScope;
|
|
13
13
|
this.context = new Map();
|
|
14
14
|
}
|
|
15
15
|
getContext(input) {
|
package/dist/signals/index.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ export declare class StopEvent extends Event {
|
|
|
10
10
|
constructor();
|
|
11
11
|
}
|
|
12
12
|
export declare class Scope extends EventTarget {
|
|
13
|
-
parentScope?: Scope;
|
|
13
|
+
readonly parentScope?: Scope;
|
|
14
14
|
readonly context: Map<string, unknown>;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(parentScope?: Scope);
|
|
16
16
|
getContext<T>(input: Descriptor<T>): T;
|
|
17
17
|
setContext<T>(input: Descriptor<T>, value: T): void;
|
|
18
18
|
onStop(input: (event: StopEvent) => void): void;
|