revojs 0.0.54 → 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.
package/dist/index.js CHANGED
@@ -386,10 +386,10 @@ const defineComponent = (options) => {
386
386
  const toCustomElement = (Component) => {
387
387
  return class extends HTMLElement {
388
388
  static formAssociated = true;
389
- component;
390
- internals;
391
- constructor() {
392
- super();
389
+ component = new Component();
390
+ internals = this.attachInternals();
391
+ async connectedCallback() {
392
+ let rootNode = this;
393
393
  const findParent = (node) => {
394
394
  if (node) {
395
395
  if ("component" in node) return node;
@@ -397,11 +397,8 @@ const toCustomElement = (Component) => {
397
397
  return findParent(node.parentNode);
398
398
  }
399
399
  };
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;
400
+ const parentNode = findParent(this.parentNode);
401
+ if (parentNode) this.component.scope.parentScope = parentNode.component.scope;
405
402
  if (this.component.shadowRoot) rootNode = this.shadowRoot ?? this.attachShadow(this.component.shadowRoot);
406
403
  for (const [name, event] of Object.entries(Component.$events)) Reflect.set(this.component.events, name, (value) => {
407
404
  if (value instanceof Event) return;
@@ -10,7 +10,7 @@ export declare class StopEvent extends Event {
10
10
  constructor();
11
11
  }
12
12
  export declare class Scope extends EventTarget {
13
- readonly parentScope?: Scope;
13
+ parentScope?: Scope;
14
14
  readonly context: Map<string, unknown>;
15
15
  constructor(parentScope?: Scope);
16
16
  getContext<T>(input: Descriptor<T>): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",