@trunkjs/element-relocator 1.0.2 → 1.0.4
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/index.d.ts +2 -2
- package/index.js +10 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export declare class TjElementRelocatorElement extends HTMLElement {
|
|
|
3
3
|
private sourceElement;
|
|
4
4
|
private targetElement;
|
|
5
5
|
private sourceObserver;
|
|
6
|
-
connectedCallback(): void
|
|
6
|
+
connectedCallback(): Promise<void>;
|
|
7
7
|
disconnectedCallback(): void;
|
|
8
|
-
attributeChangedCallback(): void
|
|
8
|
+
attributeChangedCallback(): Promise<void>;
|
|
9
9
|
private sync;
|
|
10
10
|
private querySelectorInDocument;
|
|
11
11
|
private observeSource;
|
package/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { waitForReady as c } from "@trunkjs/browser-utils";
|
|
2
|
+
const n = "relocate", l = "<tj-element-relocator> warning";
|
|
3
|
+
class u extends HTMLElement {
|
|
3
4
|
constructor() {
|
|
4
5
|
super(...arguments), this.sourceElement = null, this.targetElement = null, this.sourceObserver = null;
|
|
5
6
|
}
|
|
6
7
|
static get observedAttributes() {
|
|
7
8
|
return ["class", "source", "target"];
|
|
8
9
|
}
|
|
9
|
-
connectedCallback() {
|
|
10
|
-
this.sync();
|
|
10
|
+
async connectedCallback() {
|
|
11
|
+
await c(), this.sync();
|
|
11
12
|
}
|
|
12
13
|
disconnectedCallback() {
|
|
13
14
|
this.restore(), this.sourceElement = null, this.targetElement = null;
|
|
14
15
|
}
|
|
15
|
-
attributeChangedCallback() {
|
|
16
|
-
this.isConnected && this.sync();
|
|
16
|
+
async attributeChangedCallback() {
|
|
17
|
+
await c(), this.isConnected && this.sync();
|
|
17
18
|
}
|
|
18
19
|
sync() {
|
|
19
20
|
var i, o;
|
|
@@ -58,7 +59,7 @@ class l extends HTMLElement {
|
|
|
58
59
|
(e = this.sourceObserver) == null || e.disconnect(), this.sourceObserver = null;
|
|
59
60
|
}
|
|
60
61
|
warn(e) {
|
|
61
|
-
console.warn(
|
|
62
|
+
console.warn(l, { reason: e, element: this });
|
|
62
63
|
}
|
|
63
64
|
warnAboutUnsupportedClasses() {
|
|
64
65
|
const e = Array.from(this.classList).filter(
|
|
@@ -67,7 +68,7 @@ class l extends HTMLElement {
|
|
|
67
68
|
e.length && this.warn(`Unsupported classes: ${e.join(", ")}.`);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
customElements.get("tj-element-relocator") || customElements.define("tj-element-relocator",
|
|
71
|
+
customElements.get("tj-element-relocator") || customElements.define("tj-element-relocator", u);
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
+
u as TjElementRelocatorElement
|
|
73
74
|
};
|