revojs 0.0.53 → 0.0.55

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.
@@ -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>, scope?: Scope): Component<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(scope) {
113
+ constructor(parentScope) {
114
114
  super();
115
- this.parentScope = scope;
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, scope) {
370
- this.scope = new Scope(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;
@@ -393,6 +393,7 @@ const toCustomElement = (Component) => {
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
  };
@@ -1,4 +1,4 @@
1
- import { RUNTIME_CONTEXT, Scope } from "./runtime-CnZe26-A.js";
1
+ import { RUNTIME_CONTEXT, Scope } from "./runtime-C9LNWVm0.js";
2
2
  import { runtime } from "#virtual/runtime";
3
3
  import { serve } from "bun";
4
4
 
@@ -1,4 +1,4 @@
1
- import { RUNTIME_CONTEXT, Scope } from "./runtime-CnZe26-A.js";
1
+ import { RUNTIME_CONTEXT, Scope } from "./runtime-C9LNWVm0.js";
2
2
  import { runtime } from "#virtual/runtime";
3
3
 
4
4
  //#region src/presets/cloudflare.ts
@@ -7,9 +7,9 @@ var StopEvent = class extends Event {
7
7
  var Scope = class extends EventTarget {
8
8
  parentScope;
9
9
  context;
10
- constructor(scope) {
10
+ constructor(parentScope) {
11
11
  super();
12
- this.parentScope = scope;
12
+ this.parentScope = parentScope;
13
13
  this.context = new Map();
14
14
  }
15
15
  getContext(input) {
@@ -12,7 +12,7 @@ export declare class StopEvent extends Event {
12
12
  export declare class Scope extends EventTarget {
13
13
  parentScope?: Scope;
14
14
  readonly context: Map<string, unknown>;
15
- constructor(scope?: Scope);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",