@pb33f/cowboy-components 0.1.16 → 0.2.1

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 (74) hide show
  1. package/dist/assets/rule-documentation.worker-D39NS8Lx.js +1 -0
  2. package/dist/components/editor/editor.d.ts +2 -0
  3. package/dist/components/editor/editor.js +6 -4
  4. package/dist/components/error-banner/error-banner.css.js +1 -1
  5. package/dist/components/manage-ruleset/function-option.css.d.ts +2 -0
  6. package/dist/components/manage-ruleset/function-option.css.js +38 -0
  7. package/dist/components/manage-ruleset/function-option.d.ts +19 -0
  8. package/dist/components/manage-ruleset/function-option.js +117 -0
  9. package/dist/components/manage-ruleset/manage-ruleset.css.d.ts +2 -0
  10. package/dist/components/manage-ruleset/manage-ruleset.css.js +75 -0
  11. package/dist/components/manage-ruleset/manage-ruleset.d.ts +66 -0
  12. package/dist/components/manage-ruleset/manage-ruleset.js +597 -0
  13. package/dist/components/manage-ruleset/rule-action.css.d.ts +2 -0
  14. package/dist/components/manage-ruleset/rule-action.css.js +56 -0
  15. package/dist/components/manage-ruleset/rule-action.d.ts +37 -0
  16. package/dist/components/manage-ruleset/rule-action.js +351 -0
  17. package/dist/components/manage-ruleset/rule-input.d.ts +38 -0
  18. package/dist/components/manage-ruleset/rule-input.js +296 -0
  19. package/dist/components/manage-ruleset/rule.css.d.ts +2 -0
  20. package/dist/components/manage-ruleset/rule.css.js +117 -0
  21. package/dist/components/manage-ruleset/rule.d.ts +31 -0
  22. package/dist/components/manage-ruleset/rule.js +153 -0
  23. package/dist/components/problem-list/details-drawer.d.ts +2 -1
  24. package/dist/components/problem-list/details-drawer.js +7 -0
  25. package/dist/components/problem-list/filter.css.js +2 -3
  26. package/dist/components/problem-list/problem-item.css.js +1 -3
  27. package/dist/components/problem-list/problem-item.js +1 -1
  28. package/dist/components/problem-list/problem-list.css.js +0 -10
  29. package/dist/components/problem-list/problem-list.js +0 -1
  30. package/dist/components/problems-overview/document-statistic.css.js +0 -1
  31. package/dist/components/problems-overview/problem-overview-group.css.js +1 -3
  32. package/dist/components/problems-overview/problem-overview-group.js +2 -2
  33. package/dist/components/problems-overview/problem-statistics.css.js +0 -5
  34. package/dist/components/problems-overview/problems-overview.css.js +0 -4
  35. package/dist/components/the-doctor/the-doctor.css.js +99 -27
  36. package/dist/components/the-doctor/the-doctor.d.ts +66 -8
  37. package/dist/components/the-doctor/the-doctor.js +668 -63
  38. package/dist/components/toast/toast-component.css.d.ts +2 -0
  39. package/dist/components/toast/toast-component.css.js +151 -0
  40. package/dist/components/toast/toast-component.d.ts +19 -0
  41. package/dist/components/toast/toast-component.js +116 -0
  42. package/dist/components/toast/toast-manager.d.ts +13 -0
  43. package/dist/components/toast/toast-manager.js +54 -0
  44. package/dist/cowboy-components.umd.cjs +1375 -372
  45. package/dist/css/button.css.js +46 -0
  46. package/dist/css/dialog.css.d.ts +2 -0
  47. package/dist/css/dialog.css.js +11 -0
  48. package/dist/css/forms.css.d.ts +2 -0
  49. package/dist/css/forms.css.js +123 -0
  50. package/dist/css/modal.css.d.ts +2 -0
  51. package/dist/css/modal.css.js +15 -0
  52. package/dist/css/pb33f-theme.css +1 -0
  53. package/dist/css/radiogroups.css.d.ts +2 -0
  54. package/dist/css/radiogroups.css.js +26 -0
  55. package/dist/css/spinner.css.d.ts +2 -0
  56. package/dist/css/spinner.css.js +42 -0
  57. package/dist/events/doctor.d.ts +61 -3
  58. package/dist/events/doctor.js +14 -1
  59. package/dist/model/errors.d.ts +10 -0
  60. package/dist/model/rule_documentation.d.ts +8 -2
  61. package/dist/model/rule_documentation.js +5 -1
  62. package/dist/model/toast.d.ts +15 -0
  63. package/dist/model/toast.js +9 -0
  64. package/dist/model/vacuum_rule.d.ts +58 -0
  65. package/dist/model/vacuum_rule.js +1 -0
  66. package/dist/services/linting-service.d.ts +1 -1
  67. package/dist/services/linting-service.js +2 -6
  68. package/dist/services/ruleset-service.d.ts +17 -0
  69. package/dist/services/ruleset-service.js +316 -0
  70. package/dist/style.css +1 -1
  71. package/dist/workers/rule-documentation.worker.d.ts +7 -4
  72. package/dist/workers/rule-documentation.worker.js +93 -2
  73. package/package.json +1 -1
  74. package/dist/assets/rule-documentation.worker-BFIxMBU8.js +0 -1
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,151 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+
4
+ .toast {
5
+ background-color: var(--background-color);
6
+ color: var(--font-color);
7
+ border: 1px dashed var(--secondary-color);
8
+ border-radius: 0;
9
+ font-family: var(--font-stack), monospace;
10
+ width: calc(80% - 1px);
11
+ height:150px;
12
+ opacity: 1;
13
+ transform: translateX(calc(120% + 20px));
14
+ transition: all 0.2s cubic-bezier(0.68, -0.55, 0.25, 1.35);
15
+ position: relative;
16
+ margin-bottom: 10px;
17
+ pointer-events: all;
18
+ z-index: 101;
19
+ }
20
+
21
+ .active {
22
+ transform: translateX(22%);
23
+ }
24
+
25
+ .done {
26
+ transform: translateX(calc(120% + 20px));
27
+ transition: all 0.3s cubic-bezier(0.68, -0.55, 0.25, 1.35);
28
+
29
+ }
30
+
31
+ .toast-timer {
32
+ width: 100%;
33
+ height: 3px;
34
+ background-color: var(--primary-color);
35
+ position: absolute;
36
+ bottom: -1px;
37
+ }
38
+
39
+ @keyframes progress {
40
+ 100%{
41
+ width: 0;
42
+ }
43
+ }
44
+
45
+ .icon {
46
+ width: 28px;
47
+ font-size: 1.6rem;
48
+ margin-right: 10px;
49
+ color: var(--primary-color);
50
+ }
51
+
52
+ h3 {
53
+ margin-top: 0;
54
+ padding-top: 0;
55
+ }
56
+
57
+ p {
58
+ font-size: 0.9rem;
59
+ }
60
+
61
+ .toast-info {
62
+ border-color: var(--primary-color);
63
+ }
64
+
65
+ .toast-warning {
66
+ border-color: var(--warn-color);
67
+ }
68
+
69
+ .toast-error {
70
+ border-color: var(--error-color);
71
+ background-color: var(--error-color-dark);
72
+ }
73
+
74
+ .toast-success {
75
+ border-color: var(--terminal-text);
76
+ }
77
+
78
+ .info {
79
+ color: var(--primary-color);
80
+ }
81
+
82
+ .scoredown {
83
+ color: var(--font-color-sub1);
84
+ }
85
+
86
+ .scoreup {
87
+ color: var(--terminal-text);
88
+ }
89
+
90
+ .toast-scoredown {
91
+ border-color: var(--font-color-sub1);
92
+ }
93
+
94
+ .toast-scoreup {
95
+ border-color: var(--terminal-text);
96
+ }
97
+
98
+
99
+ .info {
100
+ color: var(--primary-color);
101
+ }
102
+
103
+ .warning {
104
+ color: var(--warn-color);
105
+ }
106
+
107
+ .error {
108
+ color: var(--error-color);
109
+ }
110
+
111
+ .success {
112
+ color: var(--terminal-text);
113
+ }
114
+
115
+ .timer-scoredown {
116
+ background-color: var(--font-color-sub1);
117
+ }
118
+
119
+ .timer-scoreup {
120
+ background-color: var(--terminal-text);
121
+ }
122
+
123
+ .timer-info {
124
+ background-color: var(--primary-color);
125
+ }
126
+
127
+ .timer-warning {
128
+ background-color: var(--warn-color);
129
+ }
130
+
131
+ .timer-error {
132
+ background-color: var(--error-color);
133
+ }
134
+
135
+ .timer-success {
136
+ background-color: var(--terminal-text);
137
+ }
138
+
139
+ .toast-close {
140
+ position: absolute;
141
+ top: 0;
142
+ right: 0;
143
+ font-size: 1.3rem;
144
+ }
145
+
146
+ .toast-body {
147
+ padding: 10px;
148
+ font-size: 0.9rem;
149
+ display: flex;
150
+ }
151
+ `;
@@ -0,0 +1,19 @@
1
+ import { LitElement } from "lit";
2
+ import { Toast } from '../../model/toast.js';
3
+ import "@shoelace-style/shoelace/dist/components/icon-button/icon-button.js";
4
+ export declare class ToastComponent extends LitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ toast: Toast;
7
+ toastElement: HTMLElement;
8
+ toastTimer: HTMLElement;
9
+ isActive: boolean;
10
+ closeTimer: any;
11
+ secondTimer: any;
12
+ secondsLeft: number;
13
+ toastLife: number;
14
+ constructor(toast?: Toast);
15
+ close(): void;
16
+ activate(): void;
17
+ renderIcon(): import("lit-html").TemplateResult<1>;
18
+ render(): import("lit-html").TemplateResult<1>;
19
+ }
@@ -0,0 +1,116 @@
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, query } from "lit/decorators.js";
8
+ import { html, LitElement } from "lit";
9
+ import { ToastType } from '../../model/toast.js';
10
+ import toastComponentCss from "./toast-component.css.js";
11
+ import "@shoelace-style/shoelace/dist/components/icon-button/icon-button.js";
12
+ import { ToastExpired } from "../../events/doctor.js";
13
+ let ToastComponent = class ToastComponent extends LitElement {
14
+ constructor(toast) {
15
+ super();
16
+ this.toastLife = 5;
17
+ if (toast) {
18
+ this.toast = toast;
19
+ }
20
+ this.secondsLeft = this.toastLife;
21
+ }
22
+ close() {
23
+ this.toastElement.classList.remove('active');
24
+ this.toastTimer?.remove();
25
+ this.dispatchEvent(new CustomEvent(ToastExpired, {
26
+ bubbles: true,
27
+ composed: true,
28
+ detail: {
29
+ toastId: this.toast.id
30
+ }
31
+ }));
32
+ }
33
+ activate() {
34
+ if (!this.isActive) {
35
+ this.secondTimer = setInterval(() => {
36
+ this.secondsLeft--;
37
+ if (this.toastTimer)
38
+ this.toastTimer.style.width = `${this.secondsLeft * 100 / this.toastLife}%`;
39
+ }, 1000);
40
+ this.closeTimer = setTimeout(() => {
41
+ this.close();
42
+ clearInterval(this.secondTimer);
43
+ }, this.toastLife * 1000);
44
+ }
45
+ else {
46
+ if (this.toastTimer) {
47
+ this.toastTimer.style.width = `${this.secondsLeft * 100 / this.toastLife}%`;
48
+ }
49
+ return;
50
+ }
51
+ this.isActive = true;
52
+ }
53
+ renderIcon() {
54
+ switch (this.toast.type) {
55
+ case ToastType.INFO:
56
+ return html `
57
+ <sl-icon name="info-square"></sl-icon>`;
58
+ case ToastType.SUCCESS:
59
+ return html `
60
+ <sl-icon name="check-square"></sl-icon>`;
61
+ case ToastType.ERROR:
62
+ return html `
63
+ <sl-icon name="x-square"></sl-icon>`;
64
+ case ToastType.WARNING:
65
+ return html `
66
+ <sl-icon name="exclamation-triangle"></sl-icon>`;
67
+ case ToastType.SCOREDOWN:
68
+ return html `
69
+ <sl-icon name="arrow-down"></sl-icon>`;
70
+ case ToastType.SCOREUP:
71
+ return html `
72
+ <sl-icon name="arrow-up"></sl-icon>`;
73
+ default:
74
+ return html `
75
+ <sl-icon name="info-square"></sl-icon>`;
76
+ }
77
+ }
78
+ render() {
79
+ return html `
80
+ <div class="toast ${this.isActive ? 'active' : ''} toast-${this.toast.type}">
81
+ <div class="toast-body">
82
+ <div class="icon ${this.toast.type}">
83
+ ${this.renderIcon()}
84
+ </div>
85
+ <div class="details">
86
+ <h3 class="${this.toast.type}">${this.toast.title}</h3>
87
+ <p>${this.toast.body}</p>
88
+ </div>
89
+ </div>
90
+ <div class="toast-close ${this.toast.type}">
91
+ <sl-icon-button class="${this.toast.type}" name="x-lg" label="close"
92
+ @click="${this.close}"></sl-icon-button>
93
+ </div>
94
+ <div class="toast-timer timer-${this.toast.type}">
95
+ </div>
96
+ </div>
97
+ `;
98
+ }
99
+ };
100
+ ToastComponent.styles = [toastComponentCss];
101
+ __decorate([
102
+ property()
103
+ ], ToastComponent.prototype, "toast", void 0);
104
+ __decorate([
105
+ query('.toast')
106
+ ], ToastComponent.prototype, "toastElement", void 0);
107
+ __decorate([
108
+ query('.toast-timer')
109
+ ], ToastComponent.prototype, "toastTimer", void 0);
110
+ __decorate([
111
+ property()
112
+ ], ToastComponent.prototype, "isActive", void 0);
113
+ ToastComponent = __decorate([
114
+ customElement('pb33f-toast')
115
+ ], ToastComponent);
116
+ export { ToastComponent };
@@ -0,0 +1,13 @@
1
+ import { LitElement } from "lit";
2
+ import { ToastComponent } from "./toast-component.js";
3
+ import { Toast } from "../../model/toast.js";
4
+ import { AddToastEvent, ToastExpiredEvent } from "../../events/doctor.js";
5
+ export declare class ToastManager extends LitElement {
6
+ toasts: ToastComponent[];
7
+ constructor();
8
+ removeToast(evt: CustomEvent<ToastExpiredEvent>): void;
9
+ addToastManually(toast: Toast): void;
10
+ addToast(evt: CustomEvent<AddToastEvent>): void;
11
+ updated(): void;
12
+ render(): import("lit-html").TemplateResult<1>;
13
+ }
@@ -0,0 +1,54 @@
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 } from "lit";
9
+ import { ToastComponent } from "./toast-component.js";
10
+ import { AddToast, ToastExpired } from "../../events/doctor.js";
11
+ let ToastManager = class ToastManager extends LitElement {
12
+ constructor() {
13
+ super();
14
+ this.toasts = [];
15
+ // @ts-ignore
16
+ this.addEventListener(ToastExpired, this.removeToast);
17
+ // @ts-ignore
18
+ this.addEventListener(AddToast, this.addToast);
19
+ }
20
+ removeToast(evt) {
21
+ setTimeout(() => {
22
+ this.toasts = this.toasts.filter(toast => toast.toast.id !== evt.detail.toastId);
23
+ }, 500);
24
+ }
25
+ addToastManually(toast) {
26
+ this.toasts.unshift(new ToastComponent(toast));
27
+ this.requestUpdate();
28
+ }
29
+ addToast(evt) {
30
+ this.toasts.unshift(new ToastComponent(evt.detail.toast));
31
+ this.requestUpdate();
32
+ }
33
+ updated() {
34
+ this.toasts?.forEach(toast => {
35
+ setTimeout(() => {
36
+ toast.activate();
37
+ }, 200);
38
+ });
39
+ }
40
+ render() {
41
+ return html `
42
+ <div class="toast-manager">
43
+ ${this.toasts?.map(toast => html `${toast}`)}
44
+ </div>
45
+ `;
46
+ }
47
+ };
48
+ __decorate([
49
+ property()
50
+ ], ToastManager.prototype, "toasts", void 0);
51
+ ToastManager = __decorate([
52
+ customElement('pb33f-toast-manager')
53
+ ], ToastManager);
54
+ export { ToastManager };