@proximus/lavender-modal 2.0.0-alpha.59 → 2.0.0-alpha.60

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/Modal.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare class Modal extends HTMLElement {
11
11
  private onOpenClick;
12
12
  private onCloseClick;
13
13
  private commandButtonCleanups;
14
+ private opener;
14
15
  private openerElement;
15
16
  private closerElement;
16
17
  template: string;
package/dist/index.es.js CHANGED
@@ -9,7 +9,7 @@ r.replaceSync(a);
9
9
  const l = "px.lavender.modal.close", c = ["", "info", "success", "error", "warning"];
10
10
  class d extends HTMLElement {
11
11
  constructor() {
12
- super(), this.onOpenClick = () => this.show(), this.onCloseClick = () => this.close(), this.commandButtonCleanups = [], this.openerElement = null, this.closerElement = null, this.template = `<dialog>
12
+ super(), this.onOpenClick = () => this.show(), this.onCloseClick = () => this.close(), this.commandButtonCleanups = [], this.opener = null, this.openerElement = null, this.closerElement = null, this.template = `<dialog>
13
13
  <div id="container">
14
14
  <div id="content-container">
15
15
  <px-vstack gap="default" >
@@ -135,11 +135,16 @@ class d extends HTMLElement {
135
135
  }
136
136
  addOpenListener() {
137
137
  var t;
138
- this.removeOpenListener(), this.openerElement = this.$opener, (t = this.openerElement) == null || t.addEventListener("click", this.onOpenClick);
138
+ this.removeOpenListener(), this.$opener ? (this.openerElement = this.$opener, this.openerElement.addEventListener("click", this.onOpenClick)) : ((t = this.opener) == null || t.disconnect(), this.opener = new MutationObserver(() => {
139
+ this.$opener && (this.opener.disconnect(), this.opener = null, this.addOpenListener());
140
+ }), this.opener.observe(document.body, {
141
+ childList: !0,
142
+ subtree: !0
143
+ }));
139
144
  }
140
145
  removeOpenListener() {
141
- var t;
142
- (t = this.openerElement) == null || t.removeEventListener("click", this.onOpenClick), this.openerElement = null;
146
+ var t, e;
147
+ (t = this.opener) == null || t.disconnect(), this.opener = null, (e = this.openerElement) == null || e.removeEventListener("click", this.onOpenClick), this.openerElement = null;
143
148
  }
144
149
  addCloseListener(t) {
145
150
  var e, o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-modal",
3
- "version": "2.0.0-alpha.59",
3
+ "version": "2.0.0-alpha.60",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",