From 61f2639e47c93a2727697018b8a205fecd373004 Mon Sep 17 00:00:00 2001 From: Micah Allen Date: Tue, 13 Feb 2024 17:56:35 -0500 Subject: [PATCH 1/3] add pre initialize hook --- lib/component.js | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/component.js b/lib/component.js index 2cae842c..3be13057 100644 --- a/lib/component.js +++ b/lib/component.js @@ -470,6 +470,8 @@ class Component extends WebComponent { } } + this.dispatchEvent(new CustomEvent(`preComponentInitialized`)); + this.domPatcher = new DOMPatcher(this.state, this._render.bind(this), { updateMode: this.getConfig(`updateSync`) ? `sync` : `async`, postRenderCallback: this.postRenderCallback, diff --git a/package.json b/package.json index 5cc3f468..31d7d61b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "panel", - "version": "6.1.2", + "version": "6.2.0", "description": "Web Components with Virtual DOM: lightweight composable web apps", "main": "build/index.js", "types": "lib/index.d.ts", From ae19ca488820adeaa97c8acc0e65378a922585da Mon Sep 17 00:00:00 2001 From: Micah Allen Date: Tue, 13 Feb 2024 18:47:48 -0500 Subject: [PATCH 2/3] bubble event --- lib/component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/component.js b/lib/component.js index 3be13057..54a43292 100644 --- a/lib/component.js +++ b/lib/component.js @@ -470,7 +470,7 @@ class Component extends WebComponent { } } - this.dispatchEvent(new CustomEvent(`preComponentInitialized`)); + this.dispatchEvent(new CustomEvent(`preComponentInitialized`, {bubbles: true, composed: true})); this.domPatcher = new DOMPatcher(this.state, this._render.bind(this), { updateMode: this.getConfig(`updateSync`) ? `sync` : `async`, From 167d5d3076ca123b991ab9d51cd8d3daabd873f3 Mon Sep 17 00:00:00 2001 From: Micah Allen Date: Wed, 14 Feb 2024 10:12:06 -0500 Subject: [PATCH 3/3] add el to detail --- lib/component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/component.js b/lib/component.js index 54a43292..088335a2 100644 --- a/lib/component.js +++ b/lib/component.js @@ -470,7 +470,7 @@ class Component extends WebComponent { } } - this.dispatchEvent(new CustomEvent(`preComponentInitialized`, {bubbles: true, composed: true})); + this.dispatchEvent(new CustomEvent(`preComponentInitialized`, {detail: {el: this}, bubbles: true, composed: true})); this.domPatcher = new DOMPatcher(this.state, this._render.bind(this), { updateMode: this.getConfig(`updateSync`) ? `sync` : `async`,