be-hive 0.0.76 → 0.0.78
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/README.md +11 -0
- package/be-hive.js +16 -8
- package/be-hive.ts +15 -8
- package/package.json +4 -4
- package/playwright.config.ts +4 -4
- package/types.d.ts +2 -0
- package/playwright.config.js +0 -28
package/README.md
CHANGED
|
@@ -58,6 +58,17 @@ If the inherited behiviors are all just too odious to inherit, there's an option
|
|
|
58
58
|
</be-hive>
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
## Adding back a personality trait [Untested]
|
|
62
|
+
|
|
63
|
+
If one Shadow DOM blocks an inherited behivior, child Shadow DOMs can bring it back within their (and descendent) shadow DOM realms thusly:
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<be-hive overrides='{
|
|
67
|
+
"be-disobedient-without-facing-the-consequences": {
|
|
68
|
+
"unblock": "true"
|
|
69
|
+
}
|
|
70
|
+
}'></be-hive>
|
|
71
|
+
```
|
|
61
72
|
|
|
62
73
|
## API
|
|
63
74
|
|
package/be-hive.js
CHANGED
|
@@ -2,9 +2,9 @@ export class BeHive extends HTMLElement {
|
|
|
2
2
|
constructor() {
|
|
3
3
|
super();
|
|
4
4
|
this.registeredBehaviors = {};
|
|
5
|
+
this.hidden = true;
|
|
5
6
|
}
|
|
6
7
|
connectedCallback() {
|
|
7
|
-
this.style.display = 'none';
|
|
8
8
|
const overridesAttr = this.getAttribute('overrides');
|
|
9
9
|
if (overridesAttr !== null) {
|
|
10
10
|
this.overrides = JSON.parse(overridesAttr);
|
|
@@ -15,9 +15,6 @@ export class BeHive extends HTMLElement {
|
|
|
15
15
|
this.#getInheritedBehaviors();
|
|
16
16
|
}
|
|
17
17
|
#getInheritedBehaviors() {
|
|
18
|
-
const beSevered = this.getAttribute('be-severed');
|
|
19
|
-
if (beSevered !== null)
|
|
20
|
-
return;
|
|
21
18
|
const rn = this.getRootNode();
|
|
22
19
|
const host = rn.host;
|
|
23
20
|
if (!host)
|
|
@@ -41,22 +38,33 @@ export class BeHive extends HTMLElement {
|
|
|
41
38
|
const override = this.overrides[parentInstanceLocalName];
|
|
42
39
|
let newInstanceTagName = parentInstanceLocalName;
|
|
43
40
|
let newIfWantsToBe = parentInstance.ifWantsToBe;
|
|
41
|
+
let newDisabled = parentInstance.disabled;
|
|
44
42
|
if (override !== undefined) {
|
|
45
|
-
const { ifWantsToBe, block } = override;
|
|
46
|
-
if (block)
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const { ifWantsToBe, block, unblock } = override;
|
|
44
|
+
if (block) {
|
|
45
|
+
newDisabled = true;
|
|
46
|
+
}
|
|
47
|
+
else if (unblock) {
|
|
48
|
+
newDisabled = false;
|
|
49
|
+
}
|
|
50
|
+
if (ifWantsToBe) {
|
|
49
51
|
newIfWantsToBe = ifWantsToBe;
|
|
50
52
|
newInstanceTagName = 'be-' + ifWantsToBe;
|
|
51
53
|
}
|
|
52
54
|
}
|
|
55
|
+
const beSevered = this.hasAttribute('be-severed');
|
|
56
|
+
if (beSevered)
|
|
57
|
+
newDisabled = true;
|
|
53
58
|
const newBehaviorEl = document.createElement(parentInstanceLocalName);
|
|
54
59
|
newBehaviorEl.setAttribute('if-wants-to-be', newIfWantsToBe);
|
|
55
60
|
newBehaviorEl.setAttribute('upgrade', parentInstance.upgrade);
|
|
61
|
+
if (newDisabled)
|
|
62
|
+
newBehaviorEl.setAttribute('disabled', '');
|
|
56
63
|
this.appendChild(newBehaviorEl);
|
|
57
64
|
const newRegisteredBehavior = {
|
|
58
65
|
...parentInstance,
|
|
59
66
|
ifWantsToBe: newIfWantsToBe,
|
|
67
|
+
disabled: newDisabled,
|
|
60
68
|
};
|
|
61
69
|
this.registeredBehaviors[parentInstanceLocalName] = newRegisteredBehavior;
|
|
62
70
|
this.dispatchEvent(new CustomEvent('latest-behavior-changed', {
|
package/be-hive.ts
CHANGED
|
@@ -3,9 +3,9 @@ export class BeHive extends HTMLElement{
|
|
|
3
3
|
constructor(){
|
|
4
4
|
super();
|
|
5
5
|
this.registeredBehaviors = {};
|
|
6
|
+
this.hidden = true;
|
|
6
7
|
}
|
|
7
8
|
connectedCallback(){
|
|
8
|
-
this.style.display = 'none';
|
|
9
9
|
const overridesAttr = this.getAttribute('overrides');
|
|
10
10
|
if(overridesAttr !== null){
|
|
11
11
|
this.overrides = JSON.parse(overridesAttr);
|
|
@@ -17,8 +17,6 @@ export class BeHive extends HTMLElement{
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
#getInheritedBehaviors(){
|
|
20
|
-
const beSevered = this.getAttribute('be-severed');
|
|
21
|
-
if(beSevered !== null) return;
|
|
22
20
|
const rn = this.getRootNode();
|
|
23
21
|
const host = (<any>rn).host;
|
|
24
22
|
if(!host) return;
|
|
@@ -42,23 +40,32 @@ export class BeHive extends HTMLElement{
|
|
|
42
40
|
const override = this.overrides[parentInstanceLocalName];
|
|
43
41
|
let newInstanceTagName = parentInstanceLocalName;
|
|
44
42
|
let newIfWantsToBe = parentInstance.ifWantsToBe;
|
|
43
|
+
let newDisabled = parentInstance.disabled;
|
|
44
|
+
|
|
45
45
|
if(override !== undefined){
|
|
46
|
-
const {ifWantsToBe, block} = override;
|
|
47
|
-
if(block)
|
|
48
|
-
|
|
46
|
+
const {ifWantsToBe, block, unblock} = override;
|
|
47
|
+
if(block) {
|
|
48
|
+
newDisabled = true;
|
|
49
|
+
} else if(unblock){
|
|
50
|
+
newDisabled = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if(ifWantsToBe){
|
|
49
54
|
newIfWantsToBe = ifWantsToBe;
|
|
50
55
|
newInstanceTagName = 'be-' + ifWantsToBe;
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
|
-
|
|
58
|
+
const beSevered = this.hasAttribute('be-severed');
|
|
59
|
+
if(beSevered) newDisabled = true;
|
|
54
60
|
const newBehaviorEl = document.createElement(parentInstanceLocalName);
|
|
55
61
|
newBehaviorEl.setAttribute('if-wants-to-be', newIfWantsToBe);
|
|
56
62
|
newBehaviorEl.setAttribute('upgrade', parentInstance.upgrade);
|
|
63
|
+
if(newDisabled) newBehaviorEl.setAttribute('disabled', '');
|
|
57
64
|
this.appendChild(newBehaviorEl);
|
|
58
65
|
const newRegisteredBehavior: BehaviorKeys = {
|
|
59
66
|
...parentInstance,
|
|
60
67
|
ifWantsToBe: newIfWantsToBe,
|
|
61
|
-
|
|
68
|
+
disabled: newDisabled,
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
this.registeredBehaviors[parentInstanceLocalName] = newRegisteredBehavior;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "be-hive",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.78",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"web-components",
|
|
6
6
|
"web-component",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@playwright/test": "1.27.1",
|
|
32
32
|
"@skypack/package-check": "0.2.2",
|
|
33
|
-
"may-it-serve": "0.0.
|
|
33
|
+
"may-it-serve": "0.0.4",
|
|
34
34
|
"@custom-elements-manifest/analyzer": "0.6.4",
|
|
35
35
|
"xtal-shell": "0.0.27",
|
|
36
|
-
"be-functional": "0.0.
|
|
37
|
-
"be-exportable": "0.0.
|
|
36
|
+
"be-functional": "0.0.17",
|
|
37
|
+
"be-exportable": "0.0.50"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
package/playwright.config.ts
CHANGED
|
@@ -11,10 +11,10 @@ const config: PlaywrightTestConfig = {
|
|
|
11
11
|
baseURL: 'http://localhost:3030/',
|
|
12
12
|
},
|
|
13
13
|
projects: [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
{
|
|
15
|
+
name: 'chromium',
|
|
16
|
+
use: { ...devices['Desktop Chrome'] },
|
|
17
|
+
},
|
|
18
18
|
// {
|
|
19
19
|
// name: 'firefox',
|
|
20
20
|
// use: { ...devices['Desktop Firefox'] },
|
package/types.d.ts
CHANGED
package/playwright.config.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// playwright.config.ts
|
|
2
|
-
import { devices } from '@playwright/test';
|
|
3
|
-
const config = {
|
|
4
|
-
webServer: {
|
|
5
|
-
command: 'npm run serve',
|
|
6
|
-
url: 'http://localhost:3030/',
|
|
7
|
-
timeout: 120 * 1000,
|
|
8
|
-
reuseExistingServer: !process.env.CI,
|
|
9
|
-
},
|
|
10
|
-
use: {
|
|
11
|
-
baseURL: 'http://localhost:3030/',
|
|
12
|
-
},
|
|
13
|
-
projects: [
|
|
14
|
-
{
|
|
15
|
-
name: 'chromium',
|
|
16
|
-
use: { ...devices['Desktop Chrome'] },
|
|
17
|
-
},
|
|
18
|
-
// {
|
|
19
|
-
// name: 'firefox',
|
|
20
|
-
// use: { ...devices['Desktop Firefox'] },
|
|
21
|
-
// },
|
|
22
|
-
// {
|
|
23
|
-
// name: 'webkit',
|
|
24
|
-
// use: { ...devices['Desktop Safari'] },
|
|
25
|
-
// },
|
|
26
|
-
],
|
|
27
|
-
};
|
|
28
|
-
export default config;
|