mount-observer 0.0.60 → 0.0.61
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/Newish.js +1 -1
- package/Newish.ts +1 -1
- package/package.json +1 -1
- package/refid/getIsh.js +14 -6
- package/refid/getIsh.ts +15 -5
- package/refid/regIsh.js +3 -1
- package/refid/regIsh.ts +3 -1
package/Newish.js
CHANGED
|
@@ -25,7 +25,7 @@ export class Newish {
|
|
|
25
25
|
if (enhancedElement[attached] === true)
|
|
26
26
|
return;
|
|
27
27
|
enhancedElement[attached] = true;
|
|
28
|
-
const ctr = getIsh(enhancedElement.isConnected ? enhancedElement : target, itemscope);
|
|
28
|
+
const ctr = await getIsh(enhancedElement.isConnected ? enhancedElement : target, itemscope);
|
|
29
29
|
const initPropVals = enhancedElement['ish'];
|
|
30
30
|
if (enhancedElement instanceof HTMLElement) {
|
|
31
31
|
if (enhancedElement.dataset.ish) {
|
package/Newish.ts
CHANGED
|
@@ -34,7 +34,7 @@ export class Newish implements EventListenerObject {
|
|
|
34
34
|
){
|
|
35
35
|
if((<any>enhancedElement)[attached] === true) return;
|
|
36
36
|
(<any>enhancedElement)[attached] = true;
|
|
37
|
-
const ctr = getIsh(enhancedElement.isConnected ? enhancedElement :target, itemscope)! as any;
|
|
37
|
+
const ctr = await getIsh(enhancedElement.isConnected ? enhancedElement :target, itemscope)! as any;
|
|
38
38
|
|
|
39
39
|
const initPropVals = (<any>enhancedElement)['ish'];
|
|
40
40
|
if(enhancedElement instanceof HTMLElement){
|
package/package.json
CHANGED
package/refid/getIsh.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sym } from './regIsh.js';
|
|
2
|
-
export function getIsh(scope, name) {
|
|
1
|
+
import { sym, guid } from './regIsh.js';
|
|
2
|
+
export async function getIsh(scope, name) {
|
|
3
3
|
let test = scope;
|
|
4
4
|
while (true) {
|
|
5
5
|
const map = test[sym];
|
|
@@ -8,8 +8,9 @@ export function getIsh(scope, name) {
|
|
|
8
8
|
return map.get(name);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
if (test === document)
|
|
12
|
-
|
|
11
|
+
if (test === document) {
|
|
12
|
+
return await watch(scope, name);
|
|
13
|
+
}
|
|
13
14
|
if (test instanceof ShadowRoot) {
|
|
14
15
|
test = test.host;
|
|
15
16
|
continue;
|
|
@@ -21,7 +22,14 @@ export function getIsh(scope, name) {
|
|
|
21
22
|
}
|
|
22
23
|
const lastTest = test;
|
|
23
24
|
test = test.getRootNode();
|
|
24
|
-
if (test === lastTest)
|
|
25
|
-
|
|
25
|
+
if (test === lastTest) {
|
|
26
|
+
return await watch(scope, name);
|
|
27
|
+
}
|
|
28
|
+
;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
31
|
+
async function watch(scope, name) {
|
|
32
|
+
const { waitForEvent } = await import('../waitForEvent.js');
|
|
33
|
+
await waitForEvent(document, guid);
|
|
34
|
+
return await getIsh(scope, name);
|
|
35
|
+
}
|
package/refid/getIsh.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {sym} from './regIsh.js';
|
|
1
|
+
import {sym, guid} from './regIsh.js';
|
|
2
2
|
import {IshCtr} from '../ts-refs/mount-observer/types.js';
|
|
3
|
-
export function getIsh(scope: Element | ShadowRoot | Document | Node, name: string){
|
|
3
|
+
export async function getIsh(scope: Element | ShadowRoot | Document | Node, name: string): Promise<IshCtr>{
|
|
4
4
|
let test = scope as any;
|
|
5
5
|
|
|
6
6
|
while(true){
|
|
7
7
|
const map = test[sym] as Map<string, IshCtr>;
|
|
8
8
|
if(map !== undefined){
|
|
9
9
|
if(map.has(name)){
|
|
10
|
-
return map.get(name)
|
|
10
|
+
return map.get(name)!;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
if(test === document)
|
|
13
|
+
if(test === document){
|
|
14
|
+
return await watch(scope, name);
|
|
15
|
+
}
|
|
14
16
|
if(test instanceof ShadowRoot){
|
|
15
17
|
test = test.host;
|
|
16
18
|
continue;
|
|
@@ -22,6 +24,14 @@ export function getIsh(scope: Element | ShadowRoot | Document | Node, name: stri
|
|
|
22
24
|
}
|
|
23
25
|
const lastTest = test;
|
|
24
26
|
test = test.getRootNode();
|
|
25
|
-
if(test === lastTest)
|
|
27
|
+
if(test === lastTest) {
|
|
28
|
+
return await watch(scope, name);
|
|
29
|
+
};
|
|
26
30
|
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function watch(scope: Element | ShadowRoot | Document | Node, name: string){
|
|
34
|
+
const {waitForEvent} = await import('../waitForEvent.js');
|
|
35
|
+
await waitForEvent(document, guid);
|
|
36
|
+
return await getIsh(scope, name);
|
|
27
37
|
}
|
package/refid/regIsh.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const guid = 'La8Cx9vHsUOd03WomqdnPw';
|
|
2
|
+
export const sym = Symbol.for(guid);
|
|
2
3
|
export function regIsh(scope, name, ctr) {
|
|
3
4
|
let map = scope[sym];
|
|
4
5
|
if (map === undefined) {
|
|
@@ -9,4 +10,5 @@ export function regIsh(scope, name, ctr) {
|
|
|
9
10
|
throw 403;
|
|
10
11
|
}
|
|
11
12
|
map.set(name, ctr);
|
|
13
|
+
document.dispatchEvent(new Event(guid));
|
|
12
14
|
}
|
package/refid/regIsh.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {IshCtr} from '../ts-refs/mount-observer/types';
|
|
2
|
-
export const
|
|
2
|
+
export const guid = 'La8Cx9vHsUOd03WomqdnPw'
|
|
3
|
+
export const sym = Symbol.for(guid);
|
|
3
4
|
|
|
4
5
|
export function regIsh(scope: Element | ShadowRoot | Document, name: string, ctr:IshCtr){
|
|
5
6
|
let map = (<any>scope)[sym] as Map<string, IshCtr>;
|
|
@@ -11,4 +12,5 @@ export function regIsh(scope: Element | ShadowRoot | Document, name: string, ctr
|
|
|
11
12
|
throw 403;
|
|
12
13
|
}
|
|
13
14
|
map.set(name, ctr);
|
|
15
|
+
document.dispatchEvent(new Event(guid));
|
|
14
16
|
}
|