@pb33f/cowboy-components 0.5.4 → 0.5.6
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/assets/{css.worker-CTSQecos.js → css.worker-Byh--afc.js} +1 -1
- package/dist/assets/{html.worker-C1BIaUKh.js → html.worker-DArWg-Dy.js} +1 -1
- package/dist/assets/{json.worker-BCyBlh8h.js → json.worker-heCfXoJw.js} +1 -1
- package/dist/components/auth/login-button.css.d.ts +2 -0
- package/dist/components/auth/login-button.css.js +60 -0
- package/dist/components/auth/login-button.d.ts +16 -0
- package/dist/components/auth/login-button.js +87 -0
- package/dist/components/auth/login-panel.d.ts +10 -0
- package/dist/components/auth/login-panel.js +46 -0
- package/dist/components/auth/oauth-login.css.d.ts +2 -0
- package/dist/components/auth/oauth-login.css.js +107 -0
- package/dist/components/auth/oauth-login.d.ts +17 -0
- package/dist/components/auth/oauth-login.js +93 -0
- package/dist/components/electric-box/electric-box.css.d.ts +2 -0
- package/dist/components/electric-box/electric-box.css.js +23 -0
- package/dist/components/electric-box/electric-box.d.ts +37 -0
- package/dist/components/electric-box/electric-box.js +336 -0
- package/dist/components/logo-wall/logo-wall.css.d.ts +2 -0
- package/dist/components/logo-wall/logo-wall.css.js +57 -0
- package/dist/components/logo-wall/logowall.d.ts +26 -0
- package/dist/components/logo-wall/logowall.js +378 -0
- package/dist/components/model-renderer/example.js +1 -0
- package/dist/components/model-renderer/schema.d.ts +4 -3
- package/dist/components/model-renderer/schema.js +54 -1
- package/dist/components/paginator/paginator.css.js +1 -1
- package/dist/components/rodeo/rodeo-nav.css.d.ts +2 -0
- package/dist/components/rodeo/rodeo-nav.css.js +13 -0
- package/dist/components/rodeo/rodeo-nav.d.ts +6 -0
- package/dist/components/rodeo/rodeo-nav.js +31 -0
- package/dist/components/rodeo/rodeo.css.d.ts +2 -0
- package/dist/components/rodeo/rodeo.css.js +17 -0
- package/dist/components/rodeo/rodeo.d.ts +10 -0
- package/dist/components/rodeo/rodeo.js +41 -0
- package/dist/components/rodeo/roundup.d.ts +4 -0
- package/dist/components/rodeo/roundup.js +18 -0
- package/dist/components/rodeo/users.d.ts +4 -0
- package/dist/components/rodeo/users.js +17 -0
- package/dist/components/the-doctor/the-doctor.css.js +5 -1
- package/dist/components/the-doctor/the-doctor.d.ts +6 -0
- package/dist/components/the-doctor/the-doctor.js +37 -11
- package/dist/controllers/auth.d.ts +14 -0
- package/dist/controllers/auth.js +46 -0
- package/dist/cowboy-components.d.ts +4 -0
- package/dist/cowboy-components.js +4 -0
- package/dist/cowboy-components.umd.cjs +1859 -1249
- package/dist/css/button.css.js +1 -2
- package/dist/events/doctor.d.ts +2 -0
- package/dist/events/doctor.js +2 -0
- package/dist/model/auth.d.ts +8 -0
- package/dist/model/auth.js +1 -0
- package/dist/model/schema.d.ts +1 -1
- package/dist/rodeo.d.ts +5 -0
- package/dist/rodeo.js +9 -0
- package/dist/services/auth-service.d.ts +5 -0
- package/dist/services/auth-service.js +24 -0
- package/package.json +4 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `
|
|
3
|
+
:host {
|
|
4
|
+
height: 100%;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
.auth-container {
|
|
8
|
+
height: 288px;
|
|
9
|
+
width: 488px;
|
|
10
|
+
}
|
|
11
|
+
.auth-title {
|
|
12
|
+
width: 100%;
|
|
13
|
+
text-align: center;
|
|
14
|
+
font-size: 1.6rem;
|
|
15
|
+
font-family: var(--font-stack-bold),serif;
|
|
16
|
+
height: 45px;
|
|
17
|
+
padding-top: 10px;
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
border-bottom: 1px solid var(--secondary-color);
|
|
20
|
+
color: var(--secondary-color);
|
|
21
|
+
text-shadow: 0 0 10px var(--secondary-color);
|
|
22
|
+
backdrop-filter: blur(2px);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.auth-provider-choice {
|
|
26
|
+
height: 180px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
padding-top: 40px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.select-provider {
|
|
32
|
+
display: block;
|
|
33
|
+
font-size: 1rem;
|
|
34
|
+
margin-bottom: 30px;
|
|
35
|
+
font-family: var(--font-stack-bold),serif;
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
sl-button::part(base) {
|
|
40
|
+
width: 200px;
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#github-button {
|
|
45
|
+
|
|
46
|
+
/* Ensure this triggers GPU acceleration */
|
|
47
|
+
will-change: transform, opacity;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes spinFade {
|
|
51
|
+
0% {
|
|
52
|
+
transform: rotate(0deg) scale(1) skew(0deg, 0deg);
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
100% {
|
|
56
|
+
transform: rotate(720deg) scale(0.1) skew(40deg, -40deg);
|
|
57
|
+
opacity: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.title::after {
|
|
62
|
+
content: "";
|
|
63
|
+
-webkit-animation: cursor .8s infinite;
|
|
64
|
+
animation: cursor .8s infinite;
|
|
65
|
+
background: var(--secondary-color);
|
|
66
|
+
border-radius: 0;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
height: 25px;
|
|
69
|
+
margin-left: -5px;
|
|
70
|
+
width: 3px;
|
|
71
|
+
bottom: -3px;
|
|
72
|
+
position: relative;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@-webkit-keyframes cursor {
|
|
80
|
+
0% {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
50% {
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
to {
|
|
89
|
+
opacity: 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@keyframes cursor {
|
|
94
|
+
0% {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
50% {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
to {
|
|
103
|
+
opacity: 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
\`
|
|
107
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import '../electric-box/electric-box.js';
|
|
3
|
+
import { SlAnimation, SlButton } from "@shoelace-style/shoelace";
|
|
4
|
+
export declare class OAuthLogin extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
title: string;
|
|
7
|
+
instruction: string;
|
|
8
|
+
mintravel: number;
|
|
9
|
+
maxtravel: number;
|
|
10
|
+
spin: number;
|
|
11
|
+
orbs: boolean;
|
|
12
|
+
buttonAnimation: SlAnimation;
|
|
13
|
+
githubButton: SlButton;
|
|
14
|
+
constructor();
|
|
15
|
+
githubLogin(): void;
|
|
16
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from "lit";
|
|
8
|
+
import { customElement, property, query, state } from "lit/decorators.js";
|
|
9
|
+
import oauthLoginCss from "./oauth-login.css";
|
|
10
|
+
import buttonCss from "../../css/button.css";
|
|
11
|
+
import '../electric-box/electric-box.js';
|
|
12
|
+
import { AuthenticationGithubRequested } from "../../events/doctor";
|
|
13
|
+
let OAuthLogin = class OAuthLogin extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.title = 'authentication required';
|
|
17
|
+
this.instruction = 'select service provider';
|
|
18
|
+
this.mintravel = 3500;
|
|
19
|
+
this.maxtravel = 6500;
|
|
20
|
+
this.spin = 20;
|
|
21
|
+
this.orbs = true;
|
|
22
|
+
}
|
|
23
|
+
githubLogin() {
|
|
24
|
+
this.mintravel = 1000;
|
|
25
|
+
this.maxtravel = 1500;
|
|
26
|
+
this.spin = 150;
|
|
27
|
+
this.orbs = false;
|
|
28
|
+
this.githubButton.style.animation = 'spinFade 1s ease-out forwards';
|
|
29
|
+
this.githubButton.disabled = true;
|
|
30
|
+
this.instruction = 'hold on, accessing the grid...';
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
this.dispatchEvent(new Event(AuthenticationGithubRequested, {
|
|
33
|
+
bubbles: true,
|
|
34
|
+
composed: true,
|
|
35
|
+
}));
|
|
36
|
+
}, 2000);
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return html `
|
|
40
|
+
<div style="width: 500px; height: 280px; margin: 0 auto;">
|
|
41
|
+
<pb33f-electric-box .orbs="${this.orbs}"
|
|
42
|
+
spin spinamount="${this.spin}"
|
|
43
|
+
mintraveltime="${this.mintravel}"
|
|
44
|
+
maxtraveltime="${this.maxtravel}"
|
|
45
|
+
height=288>
|
|
46
|
+
<div class="auth-container">
|
|
47
|
+
<div class="auth-title">
|
|
48
|
+
<span class="title">${this.title}<span>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="auth-provider-choice">
|
|
51
|
+
<span class="select-provider">${this.instruction}</span>
|
|
52
|
+
|
|
53
|
+
<sl-button @click="${this.githubLogin}" id="github-button">
|
|
54
|
+
<sl-icon name="github" slot="prefix"></sl-icon>
|
|
55
|
+
GitHub
|
|
56
|
+
</sl-button>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
</pb33f-electric-box>
|
|
62
|
+
</div>`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
OAuthLogin.styles = [oauthLoginCss, buttonCss];
|
|
66
|
+
__decorate([
|
|
67
|
+
property()
|
|
68
|
+
], OAuthLogin.prototype, "title", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
property()
|
|
71
|
+
], OAuthLogin.prototype, "instruction", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
state()
|
|
74
|
+
], OAuthLogin.prototype, "mintravel", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
state()
|
|
77
|
+
], OAuthLogin.prototype, "maxtravel", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
state()
|
|
80
|
+
], OAuthLogin.prototype, "spin", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
state()
|
|
83
|
+
], OAuthLogin.prototype, "orbs", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
query('#button-anim')
|
|
86
|
+
], OAuthLogin.prototype, "buttonAnimation", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
query('#github-button')
|
|
89
|
+
], OAuthLogin.prototype, "githubButton", void 0);
|
|
90
|
+
OAuthLogin = __decorate([
|
|
91
|
+
customElement("pb33f-oauth-login")
|
|
92
|
+
], OAuthLogin);
|
|
93
|
+
export { OAuthLogin };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
#container {
|
|
9
|
+
height: 100%;
|
|
10
|
+
width: 100%;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
#box-content{
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
padding: 5px;
|
|
17
|
+
//width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
svg {
|
|
21
|
+
z-index: 11;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from "lit";
|
|
2
|
+
import Snap from "snapsvg-cjs";
|
|
3
|
+
export declare class ElectricBox extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
spin: boolean;
|
|
6
|
+
spinamount: number;
|
|
7
|
+
squares: boolean;
|
|
8
|
+
orbs: boolean;
|
|
9
|
+
mintraveltime: number;
|
|
10
|
+
maxtraveltime: number;
|
|
11
|
+
height: number;
|
|
12
|
+
heroView: boolean;
|
|
13
|
+
color: string;
|
|
14
|
+
private container;
|
|
15
|
+
private orbPath;
|
|
16
|
+
private orbGroup;
|
|
17
|
+
private orb;
|
|
18
|
+
private svgWidth;
|
|
19
|
+
private svgHeight;
|
|
20
|
+
private pixelConfig;
|
|
21
|
+
private activePixelCount;
|
|
22
|
+
private pixelSpawnTimer;
|
|
23
|
+
private orbTimer;
|
|
24
|
+
constructor();
|
|
25
|
+
render(): TemplateResult;
|
|
26
|
+
protected firstUpdated(): void;
|
|
27
|
+
protected willUpdate(): void;
|
|
28
|
+
disconnectedCallback(): void;
|
|
29
|
+
private getRandomBorderPosition;
|
|
30
|
+
private spawnPixel;
|
|
31
|
+
private animatePixelToCenter;
|
|
32
|
+
private spawnOrb;
|
|
33
|
+
pulseOnce(orb: Snap.Element): void;
|
|
34
|
+
private loopAroundPath;
|
|
35
|
+
private getRandomValue;
|
|
36
|
+
private renderColorStops;
|
|
37
|
+
}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, property } from "lit/decorators.js";
|
|
8
|
+
import { html, LitElement, svg } from "lit";
|
|
9
|
+
import Snap from "snapsvg-cjs";
|
|
10
|
+
import oauthModalCss from "./electric-box.css.js";
|
|
11
|
+
let ElectricBox = class ElectricBox extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.svgWidth = 0;
|
|
15
|
+
this.svgHeight = 0;
|
|
16
|
+
this.activePixelCount = 0;
|
|
17
|
+
this.spin = false;
|
|
18
|
+
this.spinamount = 20;
|
|
19
|
+
this.squares = false;
|
|
20
|
+
this.orbs = false;
|
|
21
|
+
this.color = 'var(--secondary-color)';
|
|
22
|
+
this.mintraveltime = 1000;
|
|
23
|
+
this.maxtraveltime = 4000;
|
|
24
|
+
this.heroView = false;
|
|
25
|
+
this.height = 500;
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html `
|
|
29
|
+
<div id="container">
|
|
30
|
+
<div id="box-content">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<svg
|
|
35
|
+
id="electric-box"
|
|
36
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
37
|
+
width="100%"
|
|
38
|
+
height="${this.height}px"
|
|
39
|
+
preserveAspectRatio="none"
|
|
40
|
+
>
|
|
41
|
+
<defs>
|
|
42
|
+
<radialGradient id="radial-gradient" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox">
|
|
43
|
+
${this.renderColorStops()}
|
|
44
|
+
</radialGradient>
|
|
45
|
+
</defs>
|
|
46
|
+
|
|
47
|
+
<g id="box-group">
|
|
48
|
+
<path id="orb-path" fill="none" stroke="${this.color}" stroke-width="5" />
|
|
49
|
+
</g>
|
|
50
|
+
<g id="orb-group">
|
|
51
|
+
<circle
|
|
52
|
+
id="orb-circle"
|
|
53
|
+
cx="100"
|
|
54
|
+
cy="100"
|
|
55
|
+
r="20"
|
|
56
|
+
style="fill: url(#radial-gradient); display: none;"
|
|
57
|
+
/>
|
|
58
|
+
</g>
|
|
59
|
+
</svg>
|
|
60
|
+
</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
firstUpdated() {
|
|
64
|
+
const containerDiv = this.shadowRoot.getElementById("container");
|
|
65
|
+
if (!containerDiv)
|
|
66
|
+
return;
|
|
67
|
+
this.pixelConfig = {
|
|
68
|
+
pixelColor: this.color,
|
|
69
|
+
pixelSize: 1,
|
|
70
|
+
spawnIntervalMs: 20,
|
|
71
|
+
minTravelMs: this.mintraveltime,
|
|
72
|
+
maxTravelMs: this.maxtraveltime,
|
|
73
|
+
maxActivePixels: 5000
|
|
74
|
+
};
|
|
75
|
+
const rect = containerDiv.getBoundingClientRect();
|
|
76
|
+
this.svgWidth = Math.floor(rect.width);
|
|
77
|
+
this.svgHeight = Math.floor(rect.height);
|
|
78
|
+
if (this.svgHeight <= 0) {
|
|
79
|
+
this.svgHeight = 280;
|
|
80
|
+
}
|
|
81
|
+
if (this.svgWidth <= 0) {
|
|
82
|
+
this.svgWidth = 500;
|
|
83
|
+
}
|
|
84
|
+
const heroPath = `M 0,0 H ${this.svgWidth} M 0,${this.svgHeight} H ${this.svgWidth}`;
|
|
85
|
+
const regularPath = `M 0,0 H ${this.svgWidth} V ${this.svgHeight} H 0 Z`;
|
|
86
|
+
const dynamicPath = this.heroView ? heroPath : regularPath;
|
|
87
|
+
this.container = Snap(this.shadowRoot.querySelector("#electric-box"));
|
|
88
|
+
this.container.attr({ viewBox: `0 0 ${this.svgWidth} ${this.svgHeight}` });
|
|
89
|
+
this.orbPath = this.container.select("#orb-path");
|
|
90
|
+
this.orbPath.attr({ d: dynamicPath });
|
|
91
|
+
this.orbGroup = this.container.select("#orb-group");
|
|
92
|
+
this.orb = this.container.select("#orb-circle");
|
|
93
|
+
this.orb.attr({ display: "none" });
|
|
94
|
+
if (this.orbs) {
|
|
95
|
+
this.orbTimer = setInterval(() => {
|
|
96
|
+
this.spawnOrb();
|
|
97
|
+
}, 500);
|
|
98
|
+
}
|
|
99
|
+
this.pixelSpawnTimer = setInterval(() => {
|
|
100
|
+
if (this.activePixelCount < this.pixelConfig.maxActivePixels) {
|
|
101
|
+
this.spawnPixel();
|
|
102
|
+
}
|
|
103
|
+
}, this.pixelConfig.spawnIntervalMs);
|
|
104
|
+
}
|
|
105
|
+
willUpdate() {
|
|
106
|
+
if (this.orbTimer && !this.orbs) {
|
|
107
|
+
clearInterval(this.orbTimer);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
disconnectedCallback() {
|
|
111
|
+
super.disconnectedCallback();
|
|
112
|
+
if (this.pixelSpawnTimer) {
|
|
113
|
+
clearInterval(this.pixelSpawnTimer);
|
|
114
|
+
}
|
|
115
|
+
if (this.orbTimer) {
|
|
116
|
+
clearInterval(this.orbTimer);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
getRandomBorderPosition() {
|
|
120
|
+
// If heroView is true, only spawn pixels on the top (edge 0) or bottom (edge 1)
|
|
121
|
+
if (this.heroView) {
|
|
122
|
+
const topOrBottom = Math.random() < 0.5 ? 0 : 1;
|
|
123
|
+
if (topOrBottom === 0) {
|
|
124
|
+
// Top edge
|
|
125
|
+
return { x: Math.random() * this.svgWidth, y: 0 };
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Bottom edge
|
|
129
|
+
return { x: Math.random() * this.svgWidth, y: this.svgHeight };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const edge = Math.floor(Math.random() * 4);
|
|
133
|
+
let x = 0, y = 0;
|
|
134
|
+
switch (edge) {
|
|
135
|
+
case 0:
|
|
136
|
+
x = Math.random() * this.svgWidth;
|
|
137
|
+
y = 0;
|
|
138
|
+
break;
|
|
139
|
+
case 1:
|
|
140
|
+
x = this.svgWidth;
|
|
141
|
+
y = Math.random() * this.svgHeight;
|
|
142
|
+
break;
|
|
143
|
+
case 2:
|
|
144
|
+
x = Math.random() * this.svgWidth;
|
|
145
|
+
y = this.svgHeight;
|
|
146
|
+
break;
|
|
147
|
+
case 3:
|
|
148
|
+
x = 0;
|
|
149
|
+
y = Math.random() * this.svgHeight;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
return { x, y };
|
|
153
|
+
}
|
|
154
|
+
spawnPixel() {
|
|
155
|
+
const { x, y } = this.getRandomBorderPosition();
|
|
156
|
+
let newPixel;
|
|
157
|
+
if (Math.random() < 0.1) {
|
|
158
|
+
if (this.squares) {
|
|
159
|
+
newPixel = this.container.rect(x - (this.pixelConfig.pixelSize + 6) / 2, y - (this.pixelConfig.pixelSize + 6) / 2, this.pixelConfig.pixelSize + 6, this.pixelConfig.pixelSize + 6);
|
|
160
|
+
newPixel.attr({
|
|
161
|
+
opacity: 1,
|
|
162
|
+
fill: "url(#radial-gradient)"
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
newPixel = this.container.circle(x, y, this.pixelConfig.pixelSize + 6);
|
|
167
|
+
newPixel.attr({
|
|
168
|
+
opacity: 1,
|
|
169
|
+
fill: "url(#radial-gradient)"
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
if (this.squares) {
|
|
175
|
+
newPixel = this.container.rect(x - this.pixelConfig.pixelSize / 2, y - this.pixelConfig.pixelSize / 2, this.pixelConfig.pixelSize, this.pixelConfig.pixelSize);
|
|
176
|
+
newPixel.attr({
|
|
177
|
+
fill: this.pixelConfig.pixelColor,
|
|
178
|
+
opacity: 1
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
newPixel = this.container.circle(x, y, this.pixelConfig.pixelSize);
|
|
183
|
+
newPixel.attr({
|
|
184
|
+
fill: this.pixelConfig.pixelColor,
|
|
185
|
+
opacity: 1
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
this.activePixelCount++;
|
|
190
|
+
this.animatePixelToCenter(newPixel);
|
|
191
|
+
}
|
|
192
|
+
animatePixelToCenter(pixel) {
|
|
193
|
+
const travelTime = this.getRandomValue(this.maxtraveltime, this.maxtraveltime);
|
|
194
|
+
const centerX = this.svgWidth / 2;
|
|
195
|
+
const centerY = this.svgHeight / 2;
|
|
196
|
+
const fadeStart = 0.2;
|
|
197
|
+
const fadeDuration = 0.4;
|
|
198
|
+
const fadeEnd = fadeStart + fadeDuration;
|
|
199
|
+
let startX = 0;
|
|
200
|
+
let startY = 0;
|
|
201
|
+
if (this.squares) {
|
|
202
|
+
startX = +pixel.attr("x") + (+pixel.attr("width") / 2);
|
|
203
|
+
startY = +pixel.attr("y") + (+pixel.attr("height") / 2);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
startX = +pixel.attr("cx");
|
|
207
|
+
startY = +pixel.attr("cy");
|
|
208
|
+
}
|
|
209
|
+
Snap.animate(0, 1, (t) => {
|
|
210
|
+
const x = startX + (centerX - startX) * t;
|
|
211
|
+
const y = startY + (centerY - startY) * t;
|
|
212
|
+
let opacity = 1;
|
|
213
|
+
if (t >= fadeEnd) {
|
|
214
|
+
opacity = 0;
|
|
215
|
+
}
|
|
216
|
+
else if (t >= fadeStart) {
|
|
217
|
+
opacity = 1 - ((t - fadeStart) / fadeDuration);
|
|
218
|
+
}
|
|
219
|
+
if (this.squares) {
|
|
220
|
+
const halfW = +pixel.attr("width") / 2;
|
|
221
|
+
const halfH = +pixel.attr("height") / 2;
|
|
222
|
+
pixel.attr({ x: x - halfW, y: y - halfH, opacity });
|
|
223
|
+
if (this.spin) {
|
|
224
|
+
const angle = t * this.spinamount;
|
|
225
|
+
pixel.transform(`r${angle},${x},${y}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
pixel.attr({ cx: x, cy: y, opacity });
|
|
230
|
+
if (this.spin) {
|
|
231
|
+
const angle = t * this.spinamount;
|
|
232
|
+
pixel.transform(`r${angle},${centerX},${centerY}`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}, travelTime, mina.easeinout, () => {
|
|
236
|
+
pixel.remove();
|
|
237
|
+
this.activePixelCount--;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
spawnOrb() {
|
|
241
|
+
if (!this.orb || !this.orbPath)
|
|
242
|
+
return;
|
|
243
|
+
const totalLength = this.orbPath.getTotalLength();
|
|
244
|
+
const randomDistance = Math.random() * totalLength;
|
|
245
|
+
const point = this.orbPath.getPointAtLength(randomDistance);
|
|
246
|
+
const clonedOrb = this.orb.clone();
|
|
247
|
+
this.orbGroup.add(clonedOrb);
|
|
248
|
+
clonedOrb.attr({
|
|
249
|
+
cx: point.x,
|
|
250
|
+
cy: point.y,
|
|
251
|
+
opacity: "0",
|
|
252
|
+
display: "block"
|
|
253
|
+
});
|
|
254
|
+
this.pulseOnce(clonedOrb);
|
|
255
|
+
this.loopAroundPath(clonedOrb);
|
|
256
|
+
}
|
|
257
|
+
pulseOnce(orb) {
|
|
258
|
+
orb.animate({ opacity: 1 }, this.getRandomValue(200, 800), mina.easeinout, () => {
|
|
259
|
+
orb.animate({ opacity: 0 }, this.getRandomValue(1500, 3000), mina.easeinout, () => {
|
|
260
|
+
orb.remove();
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
loopAroundPath(orb) {
|
|
265
|
+
const totalLength = this.orbPath.getTotalLength();
|
|
266
|
+
const randomStart = Math.random() * totalLength;
|
|
267
|
+
const directionIsCW = Math.random() < 0.5;
|
|
268
|
+
let lapsDone = 0;
|
|
269
|
+
const maxLaps = 2;
|
|
270
|
+
const animateOneLap = (startDistance) => {
|
|
271
|
+
const endDistance = directionIsCW
|
|
272
|
+
? startDistance + totalLength
|
|
273
|
+
: startDistance - totalLength;
|
|
274
|
+
Snap.animate(startDistance, endDistance, (val) => {
|
|
275
|
+
const modVal = ((val % totalLength) + totalLength) % totalLength;
|
|
276
|
+
const p = this.orbPath.getPointAtLength(modVal);
|
|
277
|
+
orb.attr({ cx: p.x, cy: p.y });
|
|
278
|
+
}, this.getRandomValue(2200, 4500), mina.easeinout, () => {
|
|
279
|
+
lapsDone++;
|
|
280
|
+
if (lapsDone < maxLaps) {
|
|
281
|
+
animateOneLap(endDistance);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
orb.remove();
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
animateOneLap(randomStart);
|
|
289
|
+
}
|
|
290
|
+
getRandomValue(min, max) {
|
|
291
|
+
min = Math.ceil(min);
|
|
292
|
+
max = Math.floor(max);
|
|
293
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
294
|
+
}
|
|
295
|
+
renderColorStops() {
|
|
296
|
+
return svg `
|
|
297
|
+
<stop offset="0%" stop-color="#fff" stop-opacity="1"/>
|
|
298
|
+
<stop offset="20%" stop-color="${this.color}" stop-opacity="0.8"/>
|
|
299
|
+
<stop offset="50%" stop-color="${this.color}" stop-opacity="0.4"/>
|
|
300
|
+
<stop offset="40%" stop-color="${this.color}" stop-opacity="0.2"/>
|
|
301
|
+
<stop offset="100%" stop-color="${this.color}" stop-opacity="0"/>
|
|
302
|
+
`;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
ElectricBox.styles = [oauthModalCss];
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ type: Boolean })
|
|
308
|
+
], ElectricBox.prototype, "spin", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ type: Number })
|
|
311
|
+
], ElectricBox.prototype, "spinamount", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
property({ type: Boolean })
|
|
314
|
+
], ElectricBox.prototype, "squares", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ type: Boolean })
|
|
317
|
+
], ElectricBox.prototype, "orbs", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: Number })
|
|
320
|
+
], ElectricBox.prototype, "mintraveltime", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: Number })
|
|
323
|
+
], ElectricBox.prototype, "maxtraveltime", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: Number })
|
|
326
|
+
], ElectricBox.prototype, "height", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: Boolean })
|
|
329
|
+
], ElectricBox.prototype, "heroView", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
property()
|
|
332
|
+
], ElectricBox.prototype, "color", void 0);
|
|
333
|
+
ElectricBox = __decorate([
|
|
334
|
+
customElement("pb33f-electric-box")
|
|
335
|
+
], ElectricBox);
|
|
336
|
+
export { ElectricBox };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `
|
|
3
|
+
|
|
4
|
+
h2 {
|
|
5
|
+
color: var(--secondary-color);
|
|
6
|
+
text-align: center;
|
|
7
|
+
text-shadow: 0 0 20px var(--secondary-color);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.logo-container {
|
|
11
|
+
width: calc(100% - 200px);
|
|
12
|
+
height: calc(100% - 12px);
|
|
13
|
+
margin-left: 100px;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
align-items: center;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
justify-content: space-evenly;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.logo {
|
|
22
|
+
width: 200px;
|
|
23
|
+
padding: 0 40px 0 40px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
svg {
|
|
27
|
+
overflow: visible;
|
|
28
|
+
transition: filter 300ms ease-in-out;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
svg:hover {
|
|
33
|
+
animation: pulse-glow 300ms infinite alternate;
|
|
34
|
+
filter: drop-shadow(0 0 20px var(--primary-color));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes pulse-glow {
|
|
38
|
+
0% {
|
|
39
|
+
filter: drop-shadow(0 0 10px var(--primary-color));
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
filter: drop-shadow(0 0 10px var(--primary-color-lowalpha));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@media only screen and (max-width: 1280px) {
|
|
47
|
+
.logo {
|
|
48
|
+
width: 120px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.logo-container {
|
|
52
|
+
width: calc(100% - 50px);
|
|
53
|
+
margin-left: 25px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
`;
|