be-hive 0.0.69 → 0.0.71
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/getLocalName.js +23 -0
- package/getLocalName.ts +25 -0
- package/package.json +8 -6
- package/tsconfig.json +2 -1
package/getLocalName.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function getLocalName(peerCitizen, decoratorName) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
const rn = peerCitizen.getRootNode();
|
|
4
|
+
const bh = rn.querySelector('be-hive');
|
|
5
|
+
if (bh === null) {
|
|
6
|
+
reject('404');
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const wc = bh.querySelector(decoratorName);
|
|
10
|
+
if (wc !== null) {
|
|
11
|
+
resolve(bh.ifWantsToBe);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const controller = new AbortController();
|
|
15
|
+
bh.addEventListener('latest-behavior-changed', e => {
|
|
16
|
+
const detail = e.detail;
|
|
17
|
+
if (detail.localName === decoratorName) {
|
|
18
|
+
resolve(detail.ifWantsToBe);
|
|
19
|
+
controller.abort();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
package/getLocalName.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function getLocalName(peerCitizen: Element, decoratorName: string): Promise<string>{
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
const rn = peerCitizen.getRootNode() as Element;
|
|
4
|
+
const bh = rn.querySelector('be-hive');
|
|
5
|
+
if(bh === null) {
|
|
6
|
+
reject('404');
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const wc = bh.querySelector(decoratorName);
|
|
11
|
+
if(wc !== null){
|
|
12
|
+
resolve((<any>bh).ifWantsToBe);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
bh.addEventListener('latest-behavior-changed', e => {
|
|
17
|
+
const detail = (e as CustomEvent).detail;
|
|
18
|
+
if(detail.localName === decoratorName){
|
|
19
|
+
resolve(detail.ifWantsToBe);
|
|
20
|
+
controller.abort();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "be-hive",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"web-components",
|
|
6
6
|
"web-component",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
".": "./be-hive.js",
|
|
15
15
|
"./be-hive.js": "./be-hive.js",
|
|
16
16
|
"./register.js": "./register.js",
|
|
17
|
-
"./beatify.js": "./beatify.js"
|
|
17
|
+
"./beatify.js": "./beatify.js",
|
|
18
|
+
"./getLocalName.js": "./getLocalName.js"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"*.*"
|
|
@@ -27,16 +28,17 @@
|
|
|
27
28
|
"doc": "custom-elements-manifest analyze"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"trans-render": "0.0.
|
|
31
|
-
"be-decorated": "0.0.
|
|
31
|
+
"trans-render": "0.0.619",
|
|
32
|
+
"be-decorated": "0.0.165"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@playwright/test": "1.26.
|
|
35
|
+
"@playwright/test": "1.26.1",
|
|
35
36
|
"@skypack/package-check": "0.2.2",
|
|
36
37
|
"may-it-serve": "0.0.2",
|
|
37
38
|
"@custom-elements-manifest/analyzer": "0.6.4",
|
|
38
39
|
"xtal-editor": "0.0.196",
|
|
39
|
-
"xtal-shell": "0.0.27"
|
|
40
|
+
"xtal-shell": "0.0.27",
|
|
41
|
+
"be-functional": "0.0.13"
|
|
40
42
|
},
|
|
41
43
|
"repository": {
|
|
42
44
|
"type": "git",
|