@pb33f/cowboy-components 0.7.5 → 0.7.7

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.
Files changed (64) hide show
  1. package/dist/components/auth/login-button.d.ts +3 -0
  2. package/dist/components/auth/login-button.js +29 -8
  3. package/dist/components/auth/login-panel.d.ts +2 -1
  4. package/dist/components/auth/login-panel.js +3 -2
  5. package/dist/components/auth/oauth-login.d.ts +1 -0
  6. package/dist/components/auth/oauth-login.js +11 -5
  7. package/dist/components/editor/editor-breadcrumb.css.js +1 -1
  8. package/dist/components/model-renderer/rendered-node.d.ts +2 -0
  9. package/dist/components/model-renderer/rendered-node.js +18 -0
  10. package/dist/components/model-renderer/responses.d.ts +11 -0
  11. package/dist/components/model-renderer/responses.js +46 -0
  12. package/dist/components/model-tree/tree.js +1 -1
  13. package/dist/components/paginator/paginator.css.js +1 -1
  14. package/dist/components/paginator/paginator.d.ts +2 -0
  15. package/dist/components/paginator/paginator.js +6 -6
  16. package/dist/components/problems-overview/problems-overview.js +6 -0
  17. package/dist/components/rodeo/rodeo.js +1 -1
  18. package/dist/components/the-doctor/sparks.d.ts +1 -0
  19. package/dist/components/the-doctor/sparks.js +36 -21
  20. package/dist/components/the-doctor/status-bar.css.js +10 -8
  21. package/dist/components/the-doctor/status-bar.d.ts +2 -0
  22. package/dist/components/the-doctor/status-bar.js +18 -8
  23. package/dist/components/the-doctor/the-doctor.css.js +1 -1
  24. package/dist/components/the-doctor/the-doctor.d.ts +113 -120
  25. package/dist/components/the-doctor/the-doctor.js +141 -1735
  26. package/dist/components/the-doctor/upload-archive.d.ts +1 -0
  27. package/dist/components/the-doctor/upload-archive.js +29 -12
  28. package/dist/controllers/{auth.d.ts → auth-controller.d.ts} +11 -6
  29. package/dist/controllers/auth-controller.js +165 -0
  30. package/dist/controllers/broker-controller.d.ts +22 -0
  31. package/dist/controllers/broker-controller.js +107 -0
  32. package/dist/controllers/diagnostic-controller.d.ts +6 -0
  33. package/dist/controllers/diagnostic-controller.js +262 -0
  34. package/dist/controllers/docs-controller.d.ts +8 -0
  35. package/dist/controllers/docs-controller.js +144 -0
  36. package/dist/controllers/model-controller.d.ts +8 -0
  37. package/dist/controllers/model-controller.js +87 -0
  38. package/dist/controllers/node-clicker-controller.d.ts +11 -0
  39. package/dist/controllers/node-clicker-controller.js +362 -0
  40. package/dist/controllers/problem-controller.d.ts +7 -0
  41. package/dist/controllers/problem-controller.js +46 -0
  42. package/dist/controllers/rolodex-controller.d.ts +10 -0
  43. package/dist/controllers/rolodex-controller.js +126 -0
  44. package/dist/controllers/rule-controller.d.ts +19 -0
  45. package/dist/controllers/rule-controller.js +264 -0
  46. package/dist/controllers/spec-controller.d.ts +8 -0
  47. package/dist/controllers/spec-controller.js +78 -0
  48. package/dist/controllers/state-controller.d.ts +9 -0
  49. package/dist/controllers/state-controller.js +279 -0
  50. package/dist/cowboy-components.umd.cjs +768 -736
  51. package/dist/css/pb33f-theme.css +1 -0
  52. package/dist/css/shared.css.js +5 -0
  53. package/dist/events/doctor.d.ts +12 -0
  54. package/dist/events/doctor.js +4 -0
  55. package/dist/model/api-response.d.ts +7 -0
  56. package/dist/model/api-response.js +2 -0
  57. package/dist/services/auth-service.d.ts +1 -0
  58. package/dist/services/auth-service.js +28 -0
  59. package/dist/services/linting-service.js +11 -2
  60. package/dist/services/model-service.d.ts +2 -1
  61. package/dist/services/model-service.js +31 -5
  62. package/dist/style.css +1 -1
  63. package/package.json +1 -1
  64. package/dist/controllers/auth.js +0 -101
@@ -6,9 +6,12 @@ export declare class LoginButton extends LitElement {
6
6
  authDialog: SlDialog;
7
7
  title: string;
8
8
  buttonLabel: string;
9
+ redirectUrl: string;
10
+ textLink: boolean;
9
11
  oauthLogin: OAuthLogin;
10
12
  private controller;
11
13
  constructor();
14
+ updated(): void;
12
15
  render(): import("lit-html").TemplateResult<1>;
13
16
  anonView(): import("lit-html").TemplateResult<1>;
14
17
  hide(): void;
@@ -6,18 +6,26 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement } from "lit";
8
8
  import { customElement, property, query } from "lit/decorators.js";
9
- import { AuthController } from "../../controllers/auth";
9
+ import { AuthController } from "../../controllers/auth-controller";
10
10
  import buttonCss from "../../css/button.css";
11
11
  import modalCss from "../../css/modal.css";
12
12
  import loginButtonCss from "./login-button.css";
13
13
  import tooltipCss from "../../css/tooltip.css";
14
14
  import { LogoutRequested } from "../../events/doctor";
15
+ import linksCss from "../../css/links.css";
15
16
  let LoginButton = class LoginButton extends LitElement {
16
17
  constructor() {
17
18
  super();
18
19
  this.controller = new AuthController(this);
19
20
  this.title = 'authenticate';
20
21
  this.buttonLabel = 'Authenticate';
22
+ this.redirectUrl = '';
23
+ this.textLink = false;
24
+ }
25
+ updated() {
26
+ if (this.oauthLogin) {
27
+ this.oauthLogin.redirectURL = this.redirectUrl;
28
+ }
21
29
  }
22
30
  render() {
23
31
  let out = this.anonView();
@@ -27,11 +35,15 @@ let LoginButton = class LoginButton extends LitElement {
27
35
  return out;
28
36
  }
29
37
  anonView() {
38
+ let action = html ` <sl-button @click="${this.openAuthModal}">
39
+ <sl-icon name="key" slot="prefix" style="font-size: 1rem"></sl-icon>
40
+ ${this.buttonLabel}
41
+ </sl-button>`;
42
+ if (this.textLink) {
43
+ action = html `<a href="#" @click="${this.openAuthModal}"><strong>${this.buttonLabel}</strong></a>`;
44
+ }
30
45
  return html `
31
- <sl-button @click="${this.openAuthModal}">
32
- <sl-icon name="key" slot="prefix" style="font-size: 1rem"></sl-icon>
33
- ${this.buttonLabel}
34
- </sl-button>
46
+ ${action}
35
47
  <sl-dialog id="auth-dialog" style="--width: 600px" no-header>
36
48
  <div style="padding-top: 20px;">
37
49
  <pb33f-oauth-login title="${this.title}"></pb33f-oauth-login>
@@ -65,8 +77,11 @@ let LoginButton = class LoginButton extends LitElement {
65
77
  `;
66
78
  }
67
79
  logout() {
68
- this.dispatchEvent(new Event(LogoutRequested, {
69
- bubbles: true, composed: true
80
+ this.dispatchEvent(new CustomEvent(LogoutRequested, {
81
+ bubbles: true, composed: true,
82
+ detail: {
83
+ redirectURL: this.redirectUrl
84
+ }
70
85
  }));
71
86
  }
72
87
  openAuthModal() {
@@ -75,7 +90,7 @@ let LoginButton = class LoginButton extends LitElement {
75
90
  this.authDialog.show();
76
91
  }
77
92
  };
78
- LoginButton.styles = [tooltipCss, buttonCss, modalCss, loginButtonCss];
93
+ LoginButton.styles = [tooltipCss, buttonCss, modalCss, loginButtonCss, linksCss];
79
94
  __decorate([
80
95
  query('#auth-dialog')
81
96
  ], LoginButton.prototype, "authDialog", void 0);
@@ -85,6 +100,12 @@ __decorate([
85
100
  __decorate([
86
101
  property()
87
102
  ], LoginButton.prototype, "buttonLabel", void 0);
103
+ __decorate([
104
+ property()
105
+ ], LoginButton.prototype, "redirectUrl", void 0);
106
+ __decorate([
107
+ property({ type: Boolean })
108
+ ], LoginButton.prototype, "textLink", void 0);
88
109
  __decorate([
89
110
  query('pb33f-oauth-login')
90
111
  ], LoginButton.prototype, "oauthLogin", void 0);
@@ -1,9 +1,10 @@
1
1
  import { LitElement } from "lit";
2
+ import { AuthController } from "../../controllers/auth-controller";
2
3
  export declare class LoginPanel extends LitElement {
3
4
  static styles: import("lit").CSSResult[];
4
5
  title: string;
5
6
  redirect: string;
6
- private controller;
7
+ controller: AuthController;
7
8
  constructor();
8
9
  willUpdate(): void;
9
10
  render(): import("lit-html").TemplateResult<1> | undefined;
@@ -6,12 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement } from "lit";
8
8
  import { customElement, property } from "lit/decorators.js";
9
- import { AuthController } from "../../controllers/auth";
10
9
  import loginButtonCss from "./login-button.css";
11
10
  let LoginPanel = class LoginPanel extends LitElement {
12
11
  constructor() {
13
12
  super();
14
- this.controller = new AuthController(this);
15
13
  this.title = 'authenticate';
16
14
  this.redirect = '/';
17
15
  }
@@ -40,6 +38,9 @@ __decorate([
40
38
  __decorate([
41
39
  property()
42
40
  ], LoginPanel.prototype, "redirect", void 0);
41
+ __decorate([
42
+ property()
43
+ ], LoginPanel.prototype, "controller", void 0);
43
44
  LoginPanel = __decorate([
44
45
  customElement('pb33f-login-panel')
45
46
  ], LoginPanel);
@@ -6,6 +6,7 @@ export declare class OAuthLogin extends LitElement {
6
6
  static styles: import("lit").CSSResult[];
7
7
  title: string;
8
8
  instruction: string;
9
+ redirectURL: string;
9
10
  mintravel: number;
10
11
  maxtravel: number;
11
12
  spin: number;
@@ -22,17 +22,20 @@ let OAuthLogin = class OAuthLogin extends LitElement {
22
22
  this.animateBox = false;
23
23
  }
24
24
  githubLogin() {
25
- this.mintravel = 1000;
26
- this.maxtravel = 1500;
27
- this.spin = 150;
25
+ this.mintravel = 800;
26
+ this.maxtravel = 1200;
27
+ this.spin = 170;
28
28
  this.orbs = false;
29
29
  this.githubButton.style.animation = 'spinFade 1s ease-out forwards';
30
30
  this.githubButton.disabled = true;
31
31
  this.instruction = 'hold on, accessing the grid...';
32
32
  setTimeout(() => {
33
- this.dispatchEvent(new Event(AuthenticationGithubRequested, {
33
+ this.dispatchEvent(new CustomEvent(AuthenticationGithubRequested, {
34
34
  bubbles: true,
35
35
  composed: true,
36
+ detail: {
37
+ redirectURL: this.redirectURL
38
+ }
36
39
  }));
37
40
  }, 2000);
38
41
  }
@@ -59,7 +62,7 @@ let OAuthLogin = class OAuthLogin extends LitElement {
59
62
 
60
63
  </div>
61
64
 
62
- </div>
65
+ </div>
63
66
  </pb33f-electric-box>
64
67
  </div>`;
65
68
  }
@@ -71,6 +74,9 @@ __decorate([
71
74
  __decorate([
72
75
  property()
73
76
  ], OAuthLogin.prototype, "instruction", void 0);
77
+ __decorate([
78
+ property()
79
+ ], OAuthLogin.prototype, "redirectURL", void 0);
74
80
  __decorate([
75
81
  state()
76
82
  ], OAuthLogin.prototype, "mintravel", void 0);
@@ -7,7 +7,7 @@ export default css `
7
7
  width: 100%;
8
8
  bottom: 10px;
9
9
  font-size: 0.8rem;
10
- z-index: 102;
10
+ z-index: 9;
11
11
  }
12
12
 
13
13
  .sep {
@@ -19,6 +19,7 @@ import './license.js';
19
19
  import './info.js';
20
20
  import './tag.js';
21
21
  import './document.js';
22
+ import './responses.js';
22
23
  import '../model-icon/model-icon.js';
23
24
  import { TemplateResult } from "lit";
24
25
  import './rendered-property.js';
@@ -29,6 +30,7 @@ export declare class RenderedNodeComponent extends HasExamples {
29
30
  node: Node;
30
31
  renderProblems: boolean;
31
32
  render(): TemplateResult<1>;
33
+ renderLocation(): TemplateResult;
32
34
  renderPath(): TemplateResult;
33
35
  renderLabel(objectType: string): TemplateResult;
34
36
  }
@@ -25,6 +25,7 @@ import './license.js';
25
25
  import './info.js';
26
26
  import './tag.js';
27
27
  import './document.js';
28
+ import './responses.js';
28
29
  import '../model-icon/model-icon.js';
29
30
  import { customElement, property } from "lit/decorators.js";
30
31
  import { html } from "lit";
@@ -34,6 +35,7 @@ import sharedCss from "../../css/shared.css.js";
34
35
  import { HasExamples } from "./clickable-ref";
35
36
  import modelSharedCss from "./model-shared.css";
36
37
  import { NodeType } from "../../model/node_type";
38
+ import { IconSize } from "../model-icon/model-icon";
37
39
  let RenderedNodeComponent = class RenderedNodeComponent extends HasExamples {
38
40
  render() {
39
41
  if (!this.node) {
@@ -80,6 +82,10 @@ let RenderedNodeComponent = class RenderedNodeComponent extends HasExamples {
80
82
  this.renderProblems = true;
81
83
  renderedNode = html `<pb33f-rendered-response-node .response=${this.node.instance} .changes=${this.node.timeline} name="${this.node.label}"></pb33f-rendered-response-node>`;
82
84
  break;
85
+ case NodeType.RESPONSES:
86
+ this.renderProblems = true;
87
+ renderedNode = html `<pb33f-rendered-responses-node .responses=${this.node.instance} name="${this.node.label}"></pb33f-rendered-responses-node>`;
88
+ break;
83
89
  case NodeType.OPERATION:
84
90
  this.renderProblems = true;
85
91
  renderedNode = html `<pb33f-rendered-operation-node .operation=${this.node.instance} .changes=${this.node.timeline} name="${this.node.label}"></pb33f-rendered-operation-node>`;
@@ -159,6 +165,7 @@ let RenderedNodeComponent = class RenderedNodeComponent extends HasExamples {
159
165
  <h3>${this.renderLabel(this.node.label)}</h3>
160
166
  ${this.renderPath()}
161
167
  <hr/>
168
+ ${this.renderLocation()}
162
169
  <div class="rendered-node-container">
163
170
  ${renderedNode}
164
171
  ${vacuumResults}
@@ -166,6 +173,17 @@ let RenderedNodeComponent = class RenderedNodeComponent extends HasExamples {
166
173
  </div>
167
174
  `;
168
175
  }
176
+ renderLocation() {
177
+ if (this.node.origin && this.node.origin != "/root.yaml") {
178
+ return html `
179
+ <div class="origin-location">
180
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.ROLODEX_FILE}"></pb33f-model-icon>
181
+ Origin: <strong>${this.node.origin}</strong>
182
+ </div>
183
+ <hr/>`;
184
+ }
185
+ return html ``;
186
+ }
169
187
  renderPath() {
170
188
  if (this.node.type === NodeType.DOCUMENT) {
171
189
  return html ``;
@@ -0,0 +1,11 @@
1
+ import './response.js';
2
+ import { ClickableRef } from "./clickable-ref.js";
3
+ import { HasRef } from "../../model/schema.js";
4
+ export declare class RenderedResponsesNodeComponent extends ClickableRef {
5
+ static styles: never[];
6
+ responses: {
7
+ [key: string]: Response | HasRef;
8
+ };
9
+ name: string;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ }
@@ -0,0 +1,46 @@
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 './response.js';
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { html } from "lit";
10
+ import { ClickableRef } from "./clickable-ref.js";
11
+ let RenderedResponsesNodeComponent = class RenderedResponsesNodeComponent extends ClickableRef {
12
+ render() {
13
+ // let references = html``
14
+ let responses = html ``;
15
+ if (this.responses) {
16
+ responses = html `
17
+ <div id="responses">
18
+ ${Object.keys(this.responses).map(key => {
19
+ return html `
20
+ <div class="margin-bottom" style="font-size: 0.8rem">
21
+ <div style="margin-bottom: 10px; font-size: 1rem">
22
+ <pb33f-rendered-response-node .response=${this.responses[key]}
23
+ name="${key}"></pb33f-rendered-response-node>
24
+ </div>
25
+ </div>`;
26
+ })}
27
+ </div>
28
+ `;
29
+ }
30
+ return html `
31
+ ${responses}
32
+ ${super.renderChanges()}
33
+ `;
34
+ }
35
+ };
36
+ RenderedResponsesNodeComponent.styles = [];
37
+ __decorate([
38
+ property()
39
+ ], RenderedResponsesNodeComponent.prototype, "responses", void 0);
40
+ __decorate([
41
+ property()
42
+ ], RenderedResponsesNodeComponent.prototype, "name", void 0);
43
+ RenderedResponsesNodeComponent = __decorate([
44
+ customElement('pb33f-rendered-responses-node')
45
+ ], RenderedResponsesNodeComponent);
46
+ export { RenderedResponsesNodeComponent };
@@ -124,7 +124,7 @@ let ModelTree = class ModelTree extends LitElement {
124
124
  let selected = null;
125
125
  for (let i = 0; i < treeItems?.length; i++) {
126
126
  const item = treeItems[i];
127
- item.selected = item.id === `model-${nodeId}`;
127
+ item.selected = (item.id === `model-${nodeId}` || item.dataset.hashid === `${nodeId}`);
128
128
  if (item.selected) {
129
129
  selected = item;
130
130
  item.expanded = true;
@@ -25,7 +25,7 @@ export default css `
25
25
 
26
26
  .no-values {
27
27
  height: 600px;
28
- width: 500px;
28
+ width: 70%;
29
29
  margin: 0 auto;
30
30
  padding-top: 50px;
31
31
  text-align: center;
@@ -21,5 +21,7 @@ export declare class Paginator extends LitElement {
21
21
  previousPage(event: CustomEvent): void;
22
22
  calcTotalPages(): number;
23
23
  protected willUpdate(): void;
24
+ startSparks(): void;
25
+ stopSparks(): void;
24
26
  render(): import("lit-html").TemplateResult<1>;
25
27
  }
@@ -83,15 +83,15 @@ let Paginator = class Paginator extends LitElement {
83
83
  }
84
84
  this.renderValues = this.values?.slice(this.paginatorNavigator.getRangeStart(), this.paginatorNavigator.getRangeEnd());
85
85
  }
86
+ startSparks() {
87
+ this.sparks.startAnimation();
88
+ }
89
+ stopSparks() {
90
+ this.sparks.stopAnimation();
91
+ }
86
92
  render() {
87
93
  this.sparks.isError = this.invalid;
88
- if (this.sparks.animating) {
89
- this.sparks.stopAnimation();
90
- }
91
94
  if (this.renderValues?.length === 0 || !this.renderValues) {
92
- if (!this.sparks.animating) {
93
- this.sparks.startAnimation();
94
- }
95
95
  if (!this.hideSparks) {
96
96
  return html `
97
97
  <div class="no-values ${this.invalid ? 'error' : ''}" style="position: relative">
@@ -73,6 +73,12 @@ let ProblemsOverview = class ProblemsOverview extends LitElement {
73
73
  this.problemOverviewGroups = this.buildProblemOverviewGroups(value);
74
74
  this.paginator.values = this.problemOverviewGroups;
75
75
  this.paginator.itemsPerPage = 10;
76
+ if (this.problemList.length <= 0) {
77
+ this.paginator.startSparks();
78
+ }
79
+ else {
80
+ this.paginator.stopSparks();
81
+ }
76
82
  }
77
83
  render() {
78
84
  if (this.unavailable) {
@@ -15,7 +15,7 @@ import './users.js';
15
15
  import { CreateBus } from "@pb33f/ranch";
16
16
  import { Command, DoctorServiceChannel, isBrokerResponse, QueuePrefix, TopicPrefix, RodeoServiceChannel, isPlatformEvent } from "../../model/channels.js";
17
17
  import { LintingService } from "../../services/linting-service.js";
18
- import { AuthController } from "../../controllers/auth.js";
18
+ import { AuthController } from "../../controllers/auth-controller";
19
19
  import { RodeoService } from "../../services/rodeo-service.js";
20
20
  import { RodeoRoundup } from "./roundup.js";
21
21
  import { PlatformEventType } from "../../model/platform-events.js";
@@ -6,6 +6,7 @@ export declare class PixelSparks extends LitElement {
6
6
  private ctx;
7
7
  private canvas;
8
8
  private animationTimer;
9
+ private animationFrameId;
9
10
  isError: boolean;
10
11
  animating: boolean;
11
12
  static styles: import("lit").CSSResult;
@@ -9,9 +9,10 @@ import { css, html, LitElement } from "lit";
9
9
  let PixelSparks = class PixelSparks extends LitElement {
10
10
  constructor() {
11
11
  super();
12
+ this.animationFrameId = null;
12
13
  this.sparkArray = [];
13
- this.gravity = 0.0001;
14
- this.spawnRate = 70;
14
+ this.gravity = 0.005;
15
+ this.spawnRate = 50;
15
16
  this.isError = false;
16
17
  this.animating = false;
17
18
  }
@@ -26,39 +27,52 @@ let PixelSparks = class PixelSparks extends LitElement {
26
27
  }
27
28
  }
28
29
  startAnimation() {
30
+ // Only start if not already animating
29
31
  if (!this.animating) {
30
32
  this.animationTimer = setInterval(() => this.spawnSpark(), 1000 / this.spawnRate);
31
- this.animateSparks();
32
33
  this.animating = true;
34
+ this.animateSparks();
33
35
  }
34
36
  }
35
37
  stopAnimation() {
36
- if (this.animating) {
37
- clearInterval(this.animationTimer);
38
- this.animating = false;
38
+ this.animating = false;
39
+ clearInterval(this.animationTimer);
40
+ // Cancel any pending animation frame
41
+ if (this.animationFrameId !== null) {
42
+ cancelAnimationFrame(this.animationFrameId);
43
+ this.animationFrameId = null;
44
+ }
45
+ this.sparkArray = [];
46
+ // Clear the canvas one last time
47
+ if (this.ctx && this.canvas) {
48
+ this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
39
49
  }
40
50
  }
41
51
  getRandomBetween(min, max) {
42
52
  return Math.random() * (max - min) + min;
43
53
  }
44
54
  spawnSpark() {
45
- let color = Math.random() > 0.5 ? 'rgb(248, 58, 255)' : 'rgb(98, 196, 255)';
46
- if (this.isError) {
47
- // create a color between
48
- color = Math.random() > 0.5 ? 'rgb(255, 60, 116)' : 'rgb(157, 26, 65)';
55
+ if (this.animating) {
56
+ let color = Math.random() > 0.5 ? 'rgb(248, 58, 255)' : 'rgb(98, 196, 255)';
57
+ if (this.isError) {
58
+ // create a color between
59
+ color = Math.random() > 0.5 ? 'rgb(255, 60, 116)' : 'rgb(157, 26, 65)';
60
+ }
61
+ this.sparkArray.push({
62
+ x: Math.random() * this.canvas.width,
63
+ y: -2,
64
+ size: 1,
65
+ color: color,
66
+ velocityY: this.getRandomBetween(0.05, 0.3),
67
+ lifetime: 150,
68
+ initialLifetime: 150,
69
+ opacity: 1
70
+ });
49
71
  }
50
- this.sparkArray.push({
51
- x: Math.random() * this.canvas.width,
52
- y: -2,
53
- size: 1,
54
- color: color,
55
- velocityY: this.getRandomBetween(0.05, 0.3),
56
- lifetime: 300,
57
- initialLifetime: 300,
58
- opacity: 1
59
- });
60
72
  }
61
73
  animateSparks() {
74
+ if (!this.animating)
75
+ return;
62
76
  this.ctx?.clearRect(0, 0, this.canvas?.width, this.canvas?.height);
63
77
  this.sparkArray = this.sparkArray.filter(spark => spark.lifetime > 0);
64
78
  for (let spark of this.sparkArray) {
@@ -68,7 +82,8 @@ let PixelSparks = class PixelSparks extends LitElement {
68
82
  spark.lifetime--;
69
83
  spark.opacity = spark.lifetime / spark.initialLifetime;
70
84
  }
71
- requestAnimationFrame(() => this.animateSparks());
85
+ // Store the ID so we can cancel it later
86
+ this.animationFrameId = requestAnimationFrame(() => this.animateSparks());
72
87
  }
73
88
  drawSpark(spark) {
74
89
  this.ctx.globalAlpha = spark.opacity; // Set transparency level
@@ -4,14 +4,14 @@ export default css `
4
4
  position: absolute;
5
5
  bottom: 8px;
6
6
  left: 0;
7
- width: 100%;
8
- height: 20px;
7
+ width: calc(100% - 6px);
8
+ height: 22px;
9
9
  background: var(--background-color);
10
- border: 1px dashed var(--secondary-color);
10
+ border-top: 1px dashed var(--secondary-color);
11
11
  z-index: 100;
12
12
  border-bottom: none;
13
- font-size: 0.8rem;
14
- padding: 4px 0 0 5px;
13
+ font-size: 0.9rem;
14
+ padding: 4px 0 2px 5px;
15
15
  vertical-align: middle;
16
16
 
17
17
  }
@@ -27,18 +27,20 @@ export default css `
27
27
  }
28
28
 
29
29
  .error-icon {
30
- color: var(--error-color);
30
+ color: var(--font-color);
31
31
  vertical-align: middle;
32
32
  }
33
33
 
34
34
  .warning {
35
- border: 1px dashed var(--warn-color);
35
+ border-top: 1px dashed var(--warn-color);
36
36
  border-bottom: none;
37
37
  }
38
38
 
39
39
  .error {
40
- border: 1px dashed var(--error-color);
40
+ border-top: 1px solid var(--error-color);
41
+ background-color: var(--error-color-dimmed);
41
42
  border-bottom: none;
43
+ color: var(--font-color)
42
44
  }
43
45
 
44
46
  strong {
@@ -4,9 +4,11 @@ export declare class StatusBar extends LitElement {
4
4
  static styles: import("lit").CSSResult[];
5
5
  visible: boolean;
6
6
  callsRemaining: number;
7
+ authenticated: boolean;
7
8
  dialog: SlDialog;
8
9
  constructor();
9
10
  openDialog(): void;
10
11
  closeDialog(): void;
12
+ authenticate(): void;
11
13
  render(): import("lit-html").TemplateResult<1> | undefined;
12
14
  }
@@ -9,11 +9,14 @@ import { html, LitElement } from "lit";
9
9
  import buttonCss from "../../css/button.css.js";
10
10
  import statusBarCss from "./status-bar.css.js";
11
11
  import linksCss from "../../css/links.css.js";
12
+ import dialogCss from "../../css/dialog.css";
13
+ import { OpenAuthentication } from "../../events/doctor";
12
14
  let StatusBar = class StatusBar extends LitElement {
13
15
  constructor() {
14
16
  super();
15
17
  this.visible = false;
16
18
  this.callsRemaining = 0;
19
+ this.authenticated = false;
17
20
  }
18
21
  openDialog() {
19
22
  this.dialog.show();
@@ -21,6 +24,11 @@ let StatusBar = class StatusBar extends LitElement {
21
24
  closeDialog() {
22
25
  this.dialog.hide();
23
26
  }
27
+ authenticate() {
28
+ this.dispatchEvent(new Event(OpenAuthentication, {
29
+ bubbles: true
30
+ }));
31
+ }
24
32
  render() {
25
33
  if (this.visible) {
26
34
  let clazz = '';
@@ -41,28 +49,30 @@ let StatusBar = class StatusBar extends LitElement {
41
49
  }
42
50
  return html `
43
51
  <div class="status-bar ${clazz}">
44
- <sl-dialog label="Credit upgrade coming soon!" class="dialog-overview">
45
- <p>To get more credit for the doctor, you will need to create an account. This feature is coming soon.</p>
46
- <p>
47
- In the meantime please wait 24 hours for your credit to be reset.
52
+ <sl-dialog label="Purchase Credit" class="dialog-overview">
53
+ <p>Still working on this, coming soon!
48
54
  </p>
49
55
  <sl-button slot="footer" variant="primary" @click="${this.closeDialog}">Close</sl-button>
50
56
  </sl-dialog>
51
57
  <sl-icon name="${icon}" class="${clazzIcon}"></sl-icon>
52
- <span class="status-text">Credits remaining: <strong>${this.callsRemaining}</strong></span> |
53
- <span class="action-text">${actionText}</span>
54
- ${this.callsRemaining <= 0 ? html ` | <a href="#" @click="${this.openDialog}"><strong>Get more credit</strong></a>` : ''}
58
+ <span class="status-text"><strong>Credits remaining: ${this.callsRemaining}</strong></span> |
59
+ <span class="action-text"><strong>${actionText}</strong></span>
60
+ ${this.callsRemaining <= 0 && !this.authenticated ? html `| <pb33f-login-button title="Get More Credit" buttonLabel="Authenticate for more credit" textLink></pb33f-login-button>` : ''}
61
+ ${this.callsRemaining <= 0 && this.authenticated ? html `| <a href="#" @click="${this.openDialog}"><strong>Purchase Credit</strong></a>` : ''}
55
62
  </div>`;
56
63
  }
57
64
  }
58
65
  };
59
- StatusBar.styles = [statusBarCss, linksCss, buttonCss];
66
+ StatusBar.styles = [statusBarCss, linksCss, buttonCss, dialogCss];
60
67
  __decorate([
61
68
  property({ type: Boolean })
62
69
  ], StatusBar.prototype, "visible", void 0);
63
70
  __decorate([
64
71
  property({ type: Number })
65
72
  ], StatusBar.prototype, "callsRemaining", void 0);
73
+ __decorate([
74
+ property({ type: Boolean })
75
+ ], StatusBar.prototype, "authenticated", void 0);
66
76
  __decorate([
67
77
  query('sl-dialog')
68
78
  ], StatusBar.prototype, "dialog", void 0);
@@ -32,7 +32,7 @@ export default css `
32
32
 
33
33
  .problems-data {
34
34
  height: min-content;
35
- max-height: calc(100vh - 50px);
35
+ max-height: calc(100vh - 75px);
36
36
  }
37
37
 
38
38