@pb33f/cowboy-components 0.2.0 → 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.
- package/dist/components/manage-ruleset/manage-ruleset.d.ts +5 -1
- package/dist/components/manage-ruleset/manage-ruleset.js +27 -5
- package/dist/components/the-doctor/the-doctor.css.js +2 -2
- package/dist/components/the-doctor/the-doctor.d.ts +2 -1
- package/dist/components/the-doctor/the-doctor.js +10 -5
- package/dist/cowboy-components.umd.cjs +132 -132
- package/dist/events/doctor.d.ts +4 -0
- package/dist/events/doctor.js +1 -0
- package/package.json +1 -1
|
@@ -6,6 +6,10 @@ import { RuleComponent } from "./rule.js";
|
|
|
6
6
|
import { Rule, RuleConfig, RuleSet } from "../../model/vacuum_rule.js";
|
|
7
7
|
import { SlButton, SlDialog, SlRadioButton, SlRadioGroup, SlSwitch } from "@shoelace-style/shoelace";
|
|
8
8
|
import { RuleError } from "../../model/errors.js";
|
|
9
|
+
export declare const defaultRuleset = "default";
|
|
10
|
+
export declare const owaspRuleset = "owasp";
|
|
11
|
+
export declare const allRuleset = "all";
|
|
12
|
+
export declare const customRuleset = "custom";
|
|
9
13
|
export declare class ManageRuleset extends LitElement {
|
|
10
14
|
static styles: import("lit").CSSResult[];
|
|
11
15
|
saveButton: SlButton;
|
|
@@ -34,7 +38,7 @@ export declare class ManageRuleset extends LitElement {
|
|
|
34
38
|
constructor();
|
|
35
39
|
private rulesetUpdated;
|
|
36
40
|
private exportRuleset;
|
|
37
|
-
|
|
41
|
+
compileRuleset(): void;
|
|
38
42
|
clearRuleProblems(): void;
|
|
39
43
|
processBadRules(ruleError: RuleError[]): void;
|
|
40
44
|
rulesetSaved(ruleset: RuleSet, returnedRuleset: RuleSet): void;
|
|
@@ -13,15 +13,15 @@ import manageRulesetCss from "./manage-ruleset.css.js";
|
|
|
13
13
|
import { RuleComponent } from "./rule.js";
|
|
14
14
|
import buttonCss from "../../css/button.css.js";
|
|
15
15
|
import spinnerCss from "../../css/spinner.css.js";
|
|
16
|
-
import { AddToast, CustomRulesetEnabled, ExportRuleset, RulesetDirty, RulesetSaved } from "../../events/doctor.js";
|
|
16
|
+
import { AddToast, BuiltInRulesetChanged, CustomRulesetEnabled, ExportRuleset, RulesetDirty, RulesetSaved } from "../../events/doctor.js";
|
|
17
17
|
import modalCss from "../../css/modal.css.js";
|
|
18
18
|
import { RulesetService } from "../../services/ruleset-service.js";
|
|
19
19
|
import { ToastType } from "../../model/toast.js";
|
|
20
20
|
import radioGroupsCss from "../../css/radiogroups.css.js";
|
|
21
|
-
const defaultRuleset = "default";
|
|
22
|
-
const owaspRuleset = "owasp";
|
|
23
|
-
const allRuleset = "all";
|
|
24
|
-
const customRuleset = "custom";
|
|
21
|
+
export const defaultRuleset = "default";
|
|
22
|
+
export const owaspRuleset = "owasp";
|
|
23
|
+
export const allRuleset = "all";
|
|
24
|
+
export const customRuleset = "custom";
|
|
25
25
|
let ManageRuleset = class ManageRuleset extends LitElement {
|
|
26
26
|
constructor() {
|
|
27
27
|
super();
|
|
@@ -345,20 +345,42 @@ let ManageRuleset = class ManageRuleset extends LitElement {
|
|
|
345
345
|
case defaultRuleset:
|
|
346
346
|
this._activeRuleset = this._defaultRules;
|
|
347
347
|
this.currentRuleset = defaultRuleset;
|
|
348
|
+
this.dispatchEvent(new CustomEvent(BuiltInRulesetChanged, {
|
|
349
|
+
bubbles: true,
|
|
350
|
+
composed: true,
|
|
351
|
+
detail: {
|
|
352
|
+
ruleset: defaultRuleset
|
|
353
|
+
}
|
|
354
|
+
}));
|
|
348
355
|
break;
|
|
349
356
|
case owaspRuleset:
|
|
350
357
|
this._activeRuleset = this._owaspRules;
|
|
351
358
|
this.currentRuleset = owaspRuleset;
|
|
359
|
+
this.dispatchEvent(new CustomEvent(BuiltInRulesetChanged, {
|
|
360
|
+
bubbles: true,
|
|
361
|
+
composed: true,
|
|
362
|
+
detail: {
|
|
363
|
+
ruleset: owaspRuleset
|
|
364
|
+
}
|
|
365
|
+
}));
|
|
352
366
|
break;
|
|
353
367
|
case allRuleset:
|
|
354
368
|
this._activeRuleset = this._allRules;
|
|
355
369
|
this.currentRuleset = allRuleset;
|
|
370
|
+
this.dispatchEvent(new CustomEvent(BuiltInRulesetChanged, {
|
|
371
|
+
bubbles: true,
|
|
372
|
+
composed: true,
|
|
373
|
+
detail: {
|
|
374
|
+
ruleset: allRuleset
|
|
375
|
+
}
|
|
376
|
+
}));
|
|
356
377
|
break;
|
|
357
378
|
case customRuleset:
|
|
358
379
|
this._activeRuleset = this._customRules;
|
|
359
380
|
this.currentRuleset = customRuleset;
|
|
360
381
|
break;
|
|
361
382
|
}
|
|
383
|
+
this.compileRuleset();
|
|
362
384
|
}
|
|
363
385
|
buildRulesets() {
|
|
364
386
|
this._defaultRules = [];
|
|
@@ -177,7 +177,7 @@ export default css `
|
|
|
177
177
|
|
|
178
178
|
.spinner-draw-closed {
|
|
179
179
|
top: 35px;
|
|
180
|
-
right:
|
|
180
|
+
right: 8px;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
pb33f-toast-manager {
|
|
@@ -219,7 +219,7 @@ export default css `
|
|
|
219
219
|
}
|
|
220
220
|
.collapse-side {
|
|
221
221
|
position: absolute;
|
|
222
|
-
right:
|
|
222
|
+
right: 5px;
|
|
223
223
|
top: 0;
|
|
224
224
|
padding: 0;
|
|
225
225
|
color: var(--secondary-color);
|
|
@@ -108,7 +108,8 @@ export declare class TheDoctor extends LitElement {
|
|
|
108
108
|
private fetchDocs;
|
|
109
109
|
fetchRulesetMap(): void;
|
|
110
110
|
ruleClicked(evt: CustomEvent<RuleClickedEvent>): void;
|
|
111
|
-
|
|
111
|
+
builtInRulesetSelected(): void;
|
|
112
|
+
rulesetManuallyChanged(): void;
|
|
112
113
|
specChanged(event: CustomEvent<EditorUpdatedEvent>): void;
|
|
113
114
|
boostrap(): void;
|
|
114
115
|
exportJSON(): void;
|
|
@@ -15,7 +15,7 @@ import '@shoelace-style/shoelace/dist/components/badge/badge.js';
|
|
|
15
15
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
16
16
|
import { html, LitElement } from "lit";
|
|
17
17
|
import { SpecEditor } from "../editor/editor.js";
|
|
18
|
-
import { ActiveView, AddToast, CustomRulesetEnabled, EditorClicked, EditorUpdated, ExportRuleset, OpenProblemDrawer, ProblemClicked, ProblemRuleFilterChangedManual, RuleViolationClicked, RulesetSaved, RuleClicked } from "../../events/doctor.js";
|
|
18
|
+
import { ActiveView, AddToast, CustomRulesetEnabled, EditorClicked, EditorUpdated, ExportRuleset, OpenProblemDrawer, ProblemClicked, ProblemRuleFilterChangedManual, RuleViolationClicked, RulesetSaved, RuleClicked, BuiltInRulesetChanged, } from "../../events/doctor.js";
|
|
19
19
|
import { ProblemDetailsDrawer, ProblemDrawerEventType } from "../problem-list/details-drawer.js";
|
|
20
20
|
import { CreateBagManager } from "@pb33f/saddlebag";
|
|
21
21
|
import { LintingService } from "../../services/linting-service.js";
|
|
@@ -110,6 +110,8 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
110
110
|
this.addEventListener(ExportRuleset, this.exportRuleset);
|
|
111
111
|
// @ts-ignore
|
|
112
112
|
this.addEventListener(RuleClicked, this.ruleClicked);
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
this.addEventListener(BuiltInRulesetChanged, this.builtInRulesetSelected);
|
|
113
115
|
// hijack navigation buttons.
|
|
114
116
|
window.addEventListener('popstate', (e) => {
|
|
115
117
|
const state = e.state;
|
|
@@ -668,7 +670,10 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
668
670
|
}
|
|
669
671
|
}
|
|
670
672
|
}
|
|
671
|
-
|
|
673
|
+
builtInRulesetSelected() {
|
|
674
|
+
// todo
|
|
675
|
+
}
|
|
676
|
+
rulesetManuallyChanged() {
|
|
672
677
|
clearTimeout(this.bounceId);
|
|
673
678
|
this.bounceId = window.setTimeout(() => {
|
|
674
679
|
const ruleset = this.rulesetEditor.editor?.getValue();
|
|
@@ -747,7 +752,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
747
752
|
specChanged(event) {
|
|
748
753
|
const editor = this.editorMap.get(event.detail.id);
|
|
749
754
|
if (editor && event.detail.id === 'ruleset') {
|
|
750
|
-
this.
|
|
755
|
+
this.rulesetManuallyChanged();
|
|
751
756
|
return;
|
|
752
757
|
}
|
|
753
758
|
if (this.docBag) {
|
|
@@ -844,8 +849,8 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
844
849
|
if (splitPanel) {
|
|
845
850
|
this.collapseButton.name = "chevron-bar-left";
|
|
846
851
|
this.problemsDataDiv.style.display = "none";
|
|
847
|
-
splitPanel.style.setProperty('--min', '
|
|
848
|
-
splitPanel.style.setProperty('--max', 'calc(100vw -
|
|
852
|
+
splitPanel.style.setProperty('--min', '40px');
|
|
853
|
+
splitPanel.style.setProperty('--max', 'calc(100vw - 40px)');
|
|
849
854
|
splitPanel.position = 100;
|
|
850
855
|
splitPanel.disabled = true;
|
|
851
856
|
this.splitDivider.style.display = "none";
|