@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,117 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ .rule {
4
+ display: flex;
5
+ margin: 10px 0 5px 0;
6
+ }
7
+
8
+ .rule-docs {
9
+ float: right;
10
+ display: inline-block;
11
+ padding-left: 10px;
12
+ padding-top: 5px;
13
+ font-size: 0.8rem;
14
+ }
15
+
16
+ .error-message {
17
+ font-size: 0.8rem;
18
+ }
19
+
20
+ .check {
21
+ width: 30px;
22
+ padding-top: 5px;
23
+ }
24
+
25
+ .details {
26
+ display: block;
27
+ width: calc(100% - 30px);
28
+ }
29
+
30
+ form {
31
+ display: block;
32
+ }
33
+
34
+ .rule-actions {
35
+ display: grid;
36
+ grid: auto / 70px 1fr;
37
+ gap: 30px;
38
+ margin-top: 20px;
39
+ padding-top: 10px;
40
+ border-top: 1px dashed var(--secondary-color-dimmer);
41
+ }
42
+
43
+ .rule-actions label {
44
+ text-align: right;
45
+ font-size: 0.8rem;
46
+ }
47
+
48
+ .label-on-left::part(form-control-help-text) {
49
+ grid-column-start: 2;
50
+ }
51
+
52
+ .actions {
53
+ width: 100%;
54
+ }
55
+
56
+ sl-details::part(base) {
57
+ font-size: 0.9rem;
58
+ border-radius: 0;
59
+ background-color: var(--background-color);
60
+ padding: 0 0 0 10px;
61
+ }
62
+
63
+ sl-details::part(header) {
64
+ font-size: 0.9rem;
65
+ padding: 5px;
66
+ font-family: var(--font-stack-bold), monospace;
67
+ }
68
+
69
+ sl-details.error-rule::part(base) {
70
+ font-size: 0.9rem;
71
+ border-radius: 0;
72
+ background-color: var(--background-color);
73
+ border: 1px solid var(--error-color);
74
+ padding: 0 0 0 10px;
75
+ }
76
+
77
+ .error-col {
78
+ margin-right: 10px;
79
+ font-size: 1.2rem;
80
+ padding-top: 5px;
81
+ }
82
+
83
+ sl-details.error::part(body) {
84
+ color: var(--font-color);
85
+ }
86
+ h4 {
87
+ margin-top: 0;
88
+ padding-top: 0;
89
+ }
90
+
91
+ .error-box {
92
+ border: 1px dashed var(--error-color);
93
+ padding: 10px;
94
+ margin-bottom: 20px;
95
+ }
96
+
97
+ .warning {
98
+ color: var(--warn-color);
99
+ }
100
+
101
+ .info {
102
+ color: var(--primary-color);
103
+ }
104
+
105
+ .error {
106
+ color: var(--error-color);
107
+ }
108
+
109
+ .actions sl-button {
110
+ float: right;
111
+ }
112
+
113
+ .hidden {
114
+ display: none;
115
+ }
116
+
117
+ `;
@@ -0,0 +1,31 @@
1
+ import '@shoelace-style/shoelace/dist/components/checkbox/checkbox.js';
2
+ import '@shoelace-style/shoelace/dist/components/select/select.js';
3
+ import '@shoelace-style/shoelace/dist/components/option/option.js';
4
+ import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
5
+ import '@shoelace-style/shoelace/dist/components/radio/radio.js';
6
+ import { LitElement } from "lit";
7
+ import "./rule-action.js";
8
+ import { Rule } from "../../model/vacuum_rule.js";
9
+ import { SlDetails } from "@shoelace-style/shoelace";
10
+ export declare class RuleComponent extends LitElement {
11
+ static styles: import("lit").CSSResult[];
12
+ rule: Rule;
13
+ error: boolean;
14
+ details: SlDetails;
15
+ ruleId: string;
16
+ open: boolean;
17
+ custom: boolean;
18
+ ruleActive: boolean;
19
+ ruleErrorMessage: string[];
20
+ ruleErrorFunction: string[];
21
+ ruleErrorFunctionOption: string[];
22
+ private readonly ruleInput;
23
+ constructor(rule: Rule, id: string, custom: boolean);
24
+ nameUpdated(name: string): void;
25
+ dirty(): void;
26
+ toggleRule(): void;
27
+ close(): void;
28
+ show(): void;
29
+ opened(): void;
30
+ render(): import("lit-html").TemplateResult<1>;
31
+ }
@@ -0,0 +1,153 @@
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 '@shoelace-style/shoelace/dist/components/checkbox/checkbox.js';
8
+ import '@shoelace-style/shoelace/dist/components/select/select.js';
9
+ import '@shoelace-style/shoelace/dist/components/option/option.js';
10
+ import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
11
+ import '@shoelace-style/shoelace/dist/components/radio/radio.js';
12
+ import { customElement, property, query, state } from "lit/decorators.js";
13
+ import { html, LitElement } from "lit";
14
+ import ruleCss from "./rule.css.js";
15
+ import formsCss from "../../css/forms.css.js";
16
+ import buttonCss from "../../css/button.css.js";
17
+ import "./rule-action.js";
18
+ import { RuleClicked, RuleNameUpdated, RulesetDirty } from "../../events/doctor.js";
19
+ import { RuleInputComponent } from "./rule-input.js";
20
+ import linksCss from "../../css/links.css.js";
21
+ import listsCss from "../../css/lists.css.js";
22
+ let RuleComponent = class RuleComponent extends LitElement {
23
+ constructor(rule, id, custom) {
24
+ super();
25
+ this.rule = rule;
26
+ this.ruleId = id;
27
+ this.ruleActive = true;
28
+ this.custom = custom;
29
+ this.error = false;
30
+ this.ruleInput = new RuleInputComponent(this.rule, this, this.custom);
31
+ this.ruleErrorFunction = [];
32
+ this.ruleErrorFunctionOption = [];
33
+ this.ruleErrorMessage = [];
34
+ //@ts-ignore
35
+ this.ruleInput.addEventListener(RuleNameUpdated, (evt) => {
36
+ this.nameUpdated(evt.detail.name);
37
+ });
38
+ }
39
+ nameUpdated(name) {
40
+ this.rule.id = name;
41
+ this.ruleId = name;
42
+ this.requestUpdate();
43
+ }
44
+ dirty() {
45
+ this.dispatchEvent(new CustomEvent(RulesetDirty, {
46
+ bubbles: true,
47
+ composed: true,
48
+ detail: {
49
+ rule: this
50
+ }
51
+ }));
52
+ }
53
+ toggleRule() {
54
+ this.ruleActive = !this.ruleActive;
55
+ this.dirty();
56
+ }
57
+ close() {
58
+ this.open = false;
59
+ this.details.open = false;
60
+ }
61
+ show() {
62
+ this.open = true;
63
+ this.details.open = true;
64
+ }
65
+ opened() {
66
+ this.open = true;
67
+ this.dispatchEvent(new CustomEvent(RuleClicked, {
68
+ bubbles: true,
69
+ composed: true,
70
+ detail: {
71
+ ruleId: this.ruleId
72
+ }
73
+ }));
74
+ }
75
+ render() {
76
+ if (!this.rule) {
77
+ return html ``;
78
+ }
79
+ let errorCol = html ``;
80
+ if (this.error) {
81
+ this.ruleInput.error = true;
82
+ this.ruleInput.ruleErrorFunction = this.ruleErrorFunction;
83
+ this.ruleInput.ruleErrorFunctionOption = this.ruleErrorFunctionOption;
84
+ errorCol = html `
85
+ <div class="error-col error"><sl-icon name="exclamation-square"></sl-icon></div>`;
86
+ }
87
+ else {
88
+ this.ruleInput.error = false;
89
+ this.ruleInput.ruleErrorFunctionOption = [];
90
+ this.ruleInput.ruleErrorFunction = [];
91
+ }
92
+ let errorBox = html ``;
93
+ if (this.error) {
94
+ let errorMessages = html ``;
95
+ if (this.ruleErrorMessage.length > 0) {
96
+ errorMessages = [];
97
+ for (let i = 0; i < this.ruleErrorMessage.length; i++) {
98
+ errorMessages.push(html `<li>${this.ruleErrorMessage[i]}</li>`);
99
+ }
100
+ }
101
+ errorBox = html `
102
+ <div class="error-box">
103
+ <div class="error-message">
104
+ <h4 class="error">Something is wrong with this rule:</h4>
105
+ <ul>
106
+ ${errorMessages}
107
+ </ul>
108
+ </div>
109
+ </div>`;
110
+ }
111
+ return html `
112
+ <div class="rule">
113
+ <div class="check">
114
+ <sl-checkbox @sl-change="${this.toggleRule}" ?checked=${this.ruleActive}></sl-checkbox>
115
+ </div>
116
+ ${errorCol}
117
+ <div class="details">
118
+ <sl-details summary="${this.rule.id}"
119
+ class="${this.error ? 'error-rule' : ''}" @sl-show="${this.opened}">
120
+ ${errorBox}
121
+ ${this.ruleInput}
122
+ </sl-details>
123
+ </div>
124
+ </div>
125
+ `;
126
+ }
127
+ };
128
+ RuleComponent.styles = [linksCss, buttonCss, ruleCss, formsCss, listsCss];
129
+ __decorate([
130
+ state()
131
+ ], RuleComponent.prototype, "rule", void 0);
132
+ __decorate([
133
+ property({ type: Boolean })
134
+ ], RuleComponent.prototype, "error", void 0);
135
+ __decorate([
136
+ query('sl-details')
137
+ ], RuleComponent.prototype, "details", void 0);
138
+ __decorate([
139
+ property({ type: Boolean })
140
+ ], RuleComponent.prototype, "open", void 0);
141
+ __decorate([
142
+ property({ type: Boolean })
143
+ ], RuleComponent.prototype, "custom", void 0);
144
+ __decorate([
145
+ property()
146
+ ], RuleComponent.prototype, "ruleActive", void 0);
147
+ __decorate([
148
+ property()
149
+ ], RuleComponent.prototype, "ruleErrorMessage", void 0);
150
+ RuleComponent = __decorate([
151
+ customElement('pb33f-rule')
152
+ ], RuleComponent);
153
+ export { RuleComponent };
@@ -3,7 +3,8 @@ import { LitElement, TemplateResult } from "lit";
3
3
  import { SlDrawer } from "@shoelace-style/shoelace";
4
4
  export declare enum ProblemDrawerEventType {
5
5
  RULE_DOCS = "ruleDocs",
6
- HOW_TO_FIX = "howToFix"
6
+ HOW_TO_FIX = "howToFix",
7
+ FUNCTION_DOCS = "functionDocs"
7
8
  }
8
9
  export interface ProblemDrawerEvent {
9
10
  type: ProblemDrawerEventType;
@@ -15,6 +15,7 @@ export var ProblemDrawerEventType;
15
15
  (function (ProblemDrawerEventType) {
16
16
  ProblemDrawerEventType["RULE_DOCS"] = "ruleDocs";
17
17
  ProblemDrawerEventType["HOW_TO_FIX"] = "howToFix";
18
+ ProblemDrawerEventType["FUNCTION_DOCS"] = "functionDocs";
18
19
  })(ProblemDrawerEventType || (ProblemDrawerEventType = {}));
19
20
  let ProblemDetailsDrawer = class ProblemDetailsDrawer extends LitElement {
20
21
  constructor() {
@@ -43,6 +44,12 @@ let ProblemDetailsDrawer = class ProblemDetailsDrawer extends LitElement {
43
44
  <h3>How to fix this problem</h3>
44
45
  ${event.body}`;
45
46
  break;
47
+ case ProblemDrawerEventType.FUNCTION_DOCS:
48
+ if (event.rule) {
49
+ this.label = 'Function: ' + event.rule;
50
+ this.content = html `${unsafeHTML(event.body)}`;
51
+ }
52
+ break;
46
53
  }
47
54
  this.requestUpdate();
48
55
  if (this.drawer != null) {
@@ -27,8 +27,7 @@ export default css `
27
27
  font-size: 0.7rem;
28
28
  overflow-x: hidden;
29
29
  }
30
-
31
-
30
+
32
31
  sl-menu{
33
32
  border: 1px solid var(--primary-color);
34
33
  border-radius: 0;
@@ -62,6 +61,6 @@ export default css `
62
61
  border-radius: 0;
63
62
  height: 16px;
64
63
  padding: 0 0 0 5px;
65
-
66
64
  }
65
+
67
66
  `;
@@ -82,7 +82,6 @@ export default css `
82
82
 
83
83
  .selected-sibling {
84
84
  color: var(--primary-color);
85
- //border-bottom: 1px solid var(--primary-color);
86
85
  background-color: var(--primary-color-verylowalpha);
87
86
  }
88
87
 
@@ -141,8 +140,7 @@ export default css `
141
140
  pb33f-render-json-path.selectedPath::part(path) {
142
141
  color: var(--font-color);
143
142
  }
144
-
145
-
143
+
146
144
  code {
147
145
  font-family: var(--font-stack), monospace;
148
146
  border: none;
@@ -52,7 +52,7 @@ let ProblemItem = class ProblemItem extends LitElement {
52
52
  updated() {
53
53
  if (this.selected && this.scrollOnUpdate) {
54
54
  requestAnimationFrame(() => {
55
- this.scrollIntoView();
55
+ this.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
56
56
  });
57
57
  this.scrollOnUpdate = true;
58
58
  }
@@ -1,7 +1,5 @@
1
1
  import { css } from "lit";
2
2
  export default css `
3
-
4
-
5
3
  .main-view {
6
4
  height: 200px;
7
5
  width: calc(100% - 2px);
@@ -14,16 +12,11 @@ export default css `
14
12
 
15
13
  .problem-list-container {
16
14
  position: relative;
17
- //height: calc(100vh - 180px);
18
-
19
15
  }
20
16
 
21
17
  .problem-list {
22
18
  position: relative;
23
19
  width: 100%;
24
-
25
-
26
-
27
20
  }
28
21
 
29
22
  .problem-list::-webkit-scrollbar {
@@ -53,7 +46,4 @@ export default css `
53
46
  background: var(--secondary-color-lowalpha);
54
47
  padding: var(--global-padding);
55
48
  }
56
-
57
-
58
-
59
49
  `;
@@ -194,7 +194,6 @@ let ProblemList = class ProblemList extends LitElement {
194
194
  this.requestUpdate();
195
195
  }
196
196
  problemClicked(event) {
197
- //event.stopPropagation()
198
197
  this.mainView.problems = [event.detail.problem];
199
198
  this.lineClicked(event.detail.problem.line, false, event.detail.problem.idx);
200
199
  this.paginator.activeIndex = event.detail.problem.resultIndex;
@@ -12,5 +12,4 @@ export default css `
12
12
  font-family: var(--font-stack-bold), monospace;
13
13
  text-shadow: 0 0 1rem var(--primary-color);
14
14
  }
15
-
16
15
  `;
@@ -59,8 +59,7 @@ export default css `
59
59
  display: flex;
60
60
  flex-direction: row;
61
61
  }
62
-
63
-
62
+
64
63
  .line {
65
64
  color: var(--font-color-sub1)
66
65
  }
@@ -83,7 +82,6 @@ export default css `
83
82
  font-size: 0.7rem;
84
83
  }
85
84
 
86
-
87
85
  @media only screen and (max-width: 1100px) {
88
86
  .group-rank {
89
87
  display: none;
@@ -8,7 +8,7 @@ import { customElement, property } from "lit/decorators.js";
8
8
  import { html, LitElement } from "lit";
9
9
  import problemOverviewGroupCss from "./problem-overview-group.css.js";
10
10
  import { ProblemDrawerEventType } from "../problem-list/details-drawer.js";
11
- import { OpenProblemDrawer, ProblemClicked, RuleClicked } from "../../events/doctor.js";
11
+ import { OpenProblemDrawer, ProblemClicked, RuleViolationClicked } from "../../events/doctor.js";
12
12
  import sharedCss from "../../css/shared.css.js";
13
13
  import buttonCss from "../../css/button.css.js";
14
14
  import { ProblemItem } from "../problem-list/problem-item.js";
@@ -27,7 +27,7 @@ let ProblemOverviewGroup = class ProblemOverviewGroup extends LitElement {
27
27
  }));
28
28
  }
29
29
  selectRule() {
30
- this.dispatchEvent(new CustomEvent(RuleClicked, {
30
+ this.dispatchEvent(new CustomEvent(RuleViolationClicked, {
31
31
  bubbles: true,
32
32
  composed: true,
33
33
  detail: {
@@ -4,7 +4,6 @@ export default css `
4
4
  --border-color: var(--secondary-color);
5
5
  --border-radius: 0;
6
6
  --border-width: 1px;
7
-
8
7
  --padding: 5px;
9
8
  flex-grow: 1;
10
9
  margin-left: 10px;
@@ -23,7 +22,6 @@ export default css `
23
22
  --border-color: var(--background-color)
24
23
  }
25
24
 
26
-
27
25
  h3 {
28
26
  margin-top: 10px;
29
27
  margin-bottom: 10px;
@@ -36,7 +34,6 @@ export default css `
36
34
  border-bottom: 1px dashed var(--secondary-color);
37
35
  }
38
36
 
39
-
40
37
  .statistics sl-card:first-child {
41
38
  margin-left: 0;
42
39
  }
@@ -64,6 +61,4 @@ export default css `
64
61
  display: none;
65
62
  }
66
63
  }
67
-
68
-
69
64
  `;
@@ -1,6 +1,5 @@
1
1
  import { css } from "lit";
2
2
  export default css `
3
-
4
3
  h3.rule-violations {
5
4
  border-top: 1px dashed var(--secondary-color);
6
5
  margin-top: 0;
@@ -12,12 +11,10 @@ export default css `
12
11
  overflow-y: auto;
13
12
  }
14
13
 
15
-
16
14
  pb33f-paginator-navigation::part(values) {
17
15
  max-height: calc(100vh - 450px);
18
16
  }
19
17
 
20
-
21
18
  .paginator::part(values) {
22
19
  background-color: red;
23
20
 
@@ -33,7 +30,6 @@ export default css `
33
30
  font-size: 6rem;
34
31
  text-align: center;
35
32
  color: var(--error-color);
36
-
37
33
  }
38
34
 
39
35
  .unavailable p {