@pb33f/cowboy-components 0.0.14 → 0.1.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/abap-DXvTa7XC.js +1404 -0
- package/dist/apex-DsQH3mjJ.js +332 -0
- package/dist/assets/css.worker-B_qZXUzt.js +84 -0
- package/dist/assets/editor.worker-HEmB0D7P.js +11 -0
- package/dist/assets/html.worker-D3WUrk8Q.js +458 -0
- package/dist/assets/json.worker-CAhUaBo4.js +42 -0
- package/dist/assets/rule-documentation.worker-BFIxMBU8.js +1 -0
- package/dist/assets/search-problems.worker-VJi4P9Gj.js +1 -0
- package/dist/azcli-Cir32SBk.js +74 -0
- package/dist/bat-BsNExolo.js +106 -0
- package/dist/bicep-2KcKzeQF.js +108 -0
- package/dist/cameligo-D0ezznwE.js +180 -0
- package/dist/clojure-DxYzAIlu.js +767 -0
- package/dist/coffee-DgiPTF3g.js +238 -0
- package/dist/components/editor/editor.d.ts +27 -0
- package/dist/components/editor/editor.js +192 -0
- package/dist/components/error-banner/error-banner.css.d.ts +2 -0
- package/dist/components/error-banner/error-banner.css.js +23 -0
- package/dist/components/error-banner/error-banner.d.ts +9 -0
- package/dist/components/error-banner/error-banner.js +40 -0
- package/dist/components/mailing-list/mailing-list.js +1 -1
- package/dist/components/paginator/paginator-events.d.ts +4 -0
- package/dist/components/paginator/paginator-events.js +4 -0
- package/dist/components/paginator/paginator-navigator.css.d.ts +2 -0
- package/dist/components/paginator/paginator-navigator.css.js +35 -0
- package/dist/components/paginator/paginator-navigator.d.ts +27 -0
- package/dist/components/paginator/paginator-navigator.js +168 -0
- package/dist/components/paginator/paginator.css.d.ts +2 -0
- package/dist/components/paginator/paginator.css.js +38 -0
- package/dist/components/paginator/paginator.d.ts +22 -0
- package/dist/components/paginator/paginator.js +122 -0
- package/dist/components/percent-bar/percent-bar.css.d.ts +2 -0
- package/dist/components/percent-bar/percent-bar.css.js +65 -0
- package/dist/components/percent-bar/percent-bar.d.ts +11 -0
- package/dist/components/percent-bar/percent-bar.js +85 -0
- package/dist/components/problem-list/details-drawer.css.d.ts +2 -0
- package/dist/components/problem-list/details-drawer.css.js +42 -0
- package/dist/components/problem-list/details-drawer.d.ts +22 -0
- package/dist/components/problem-list/details-drawer.js +66 -0
- package/dist/components/problem-list/filter.css.d.ts +2 -0
- package/dist/components/problem-list/filter.css.js +67 -0
- package/dist/components/problem-list/problem-item.css.d.ts +2 -0
- package/dist/components/problem-list/problem-item.css.js +170 -0
- package/dist/components/problem-list/problem-item.d.ts +27 -0
- package/dist/components/problem-list/problem-item.js +126 -0
- package/dist/components/problem-list/problem-label-view-filter.css.d.ts +2 -0
- package/dist/components/problem-list/problem-label-view-filter.css.js +6 -0
- package/dist/components/problem-list/problem-label-view-filter.d.ts +18 -0
- package/dist/components/problem-list/problem-label-view-filter.js +66 -0
- package/dist/components/problem-list/problem-list.css.d.ts +2 -0
- package/dist/components/problem-list/problem-list.css.js +59 -0
- package/dist/components/problem-list/problem-list.d.ts +37 -0
- package/dist/components/problem-list/problem-list.js +334 -0
- package/dist/components/problem-list/problem-mainview.css.d.ts +2 -0
- package/dist/components/problem-list/problem-mainview.css.js +100 -0
- package/dist/components/problem-list/problem-mainview.d.ts +20 -0
- package/dist/components/problem-list/problem-mainview.js +126 -0
- package/dist/components/problem-list/problem-rule-filter.d.ts +13 -0
- package/dist/components/problem-list/problem-rule-filter.js +67 -0
- package/dist/components/problem-list/problem-search-filter.d.ts +13 -0
- package/dist/components/problem-list/problem-search-filter.js +45 -0
- package/dist/components/problem-list/problem-sort-filter.d.ts +19 -0
- package/dist/components/problem-list/problem-sort-filter.js +67 -0
- package/dist/components/problem-list/problem-toolbar.css.d.ts +2 -0
- package/dist/components/problem-list/problem-toolbar.css.js +41 -0
- package/dist/components/problem-list/problem-toolbar.d.ts +14 -0
- package/dist/components/problem-list/problem-toolbar.js +63 -0
- package/dist/components/problem-list/shared.css.d.ts +2 -0
- package/dist/components/problem-list/shared.css.js +91 -0
- package/dist/components/problems-overview/diagnostic-evaluation.css.d.ts +2 -0
- package/dist/components/problems-overview/diagnostic-evaluation.css.js +178 -0
- package/dist/components/problems-overview/diagnostic-evaluation.d.ts +13 -0
- package/dist/components/problems-overview/diagnostic-evaluation.js +118 -0
- package/dist/components/problems-overview/document-statistic.css.d.ts +2 -0
- package/dist/components/problems-overview/document-statistic.css.js +16 -0
- package/dist/components/problems-overview/document-statistic.d.ts +10 -0
- package/dist/components/problems-overview/document-statistic.js +49 -0
- package/dist/components/problems-overview/problem-overview-group.css.d.ts +2 -0
- package/dist/components/problems-overview/problem-overview-group.css.js +84 -0
- package/dist/components/problems-overview/problem-overview-group.d.ts +17 -0
- package/dist/components/problems-overview/problem-overview-group.js +121 -0
- package/dist/components/problems-overview/problem-statistic.css.d.ts +2 -0
- package/dist/components/problems-overview/problem-statistic.css.js +40 -0
- package/dist/components/problems-overview/problem-statistic.d.ts +11 -0
- package/dist/components/problems-overview/problem-statistic.js +57 -0
- package/dist/components/problems-overview/problem-statistics.css.d.ts +2 -0
- package/dist/components/problems-overview/problem-statistics.css.js +46 -0
- package/dist/components/problems-overview/problem-statistics.d.ts +14 -0
- package/dist/components/problems-overview/problem-statistics.js +132 -0
- package/dist/components/problems-overview/problems-overview.css.d.ts +2 -0
- package/dist/components/problems-overview/problems-overview.css.js +49 -0
- package/dist/components/problems-overview/problems-overview.d.ts +21 -0
- package/dist/components/problems-overview/problems-overview.js +108 -0
- package/dist/components/render-json-path/render-json-path.css.d.ts +2 -0
- package/dist/components/render-json-path/render-json-path.css.js +86 -0
- package/dist/components/render-json-path/render-json-path.d.ts +11 -0
- package/dist/components/render-json-path/render-json-path.js +105 -0
- package/dist/components/the-doctor/settings.d.ts +5 -0
- package/dist/components/the-doctor/settings.js +22 -0
- package/dist/components/the-doctor/status-bar.css.d.ts +2 -0
- package/dist/components/the-doctor/status-bar.css.js +47 -0
- package/dist/components/the-doctor/status-bar.d.ts +12 -0
- package/dist/components/the-doctor/status-bar.js +71 -0
- package/dist/components/the-doctor/the-doctor.css.d.ts +2 -0
- package/dist/components/the-doctor/the-doctor.css.js +156 -0
- package/dist/components/the-doctor/the-doctor.d.ts +57 -0
- package/dist/components/the-doctor/the-doctor.js +340 -0
- package/dist/cowboy-components-BOuaCruy.js +114388 -0
- package/dist/cowboy-components.d.ts +5 -2
- package/dist/cowboy-components.js +8 -2
- package/dist/cowboy-components.umd.cjs +3997 -103
- package/dist/cpp-Bq-GnYlH.js +407 -0
- package/dist/csharp-IDcibKAT.js +332 -0
- package/dist/csp-QdYr8JWa.js +59 -0
- package/dist/css/button.css.d.ts +2 -0
- package/dist/css/button.css.js +34 -0
- package/dist/css/chroma-synxtax.css.d.ts +2 -0
- package/dist/css/chroma-synxtax.css.js +130 -0
- package/dist/css/cowboy-components.css +3 -0
- package/dist/css/links.css.d.ts +2 -0
- package/dist/css/links.css.js +17 -0
- package/dist/css/lists.css.d.ts +2 -0
- package/dist/css/lists.css.js +43 -0
- package/dist/css/pb33f-theme.css +2 -2
- package/dist/css/syntax.css.js +1 -1
- package/dist/css-C-wMMefI.js +193 -0
- package/dist/cssMode-Cvbhe77l.js +1541 -0
- package/dist/cypher-BfBo9yir.js +269 -0
- package/dist/dart-Cv3rVfv_.js +287 -0
- package/dist/dockerfile-DyCXBGhV.js +136 -0
- package/dist/ecl-COP_iObm.js +462 -0
- package/dist/elixir-DoEhbk9F.js +575 -0
- package/dist/events/doctor.d.ts +51 -0
- package/dist/events/doctor.js +17 -0
- package/dist/flow9-DuHGSNW1.js +148 -0
- package/dist/freemarker2-DmhDQrVn.js +995 -0
- package/dist/fsharp-Dv9PDxVO.js +223 -0
- package/dist/go-CcdAeqiK.js +224 -0
- package/dist/graphql-CoRm4b1H.js +157 -0
- package/dist/handlebars-DWUSy2Nn.js +425 -0
- package/dist/hcl-BSgAhV5f.js +189 -0
- package/dist/html-BTxdvu8o.js +314 -0
- package/dist/htmlMode-DeG-6tqP.js +1551 -0
- package/dist/ini-ewx9HLIq.js +77 -0
- package/dist/java-B5lwcbTy.js +238 -0
- package/dist/javascript-CQTBmqTv.js +76 -0
- package/dist/jsonMode-DJhhXlcK.js +1958 -0
- package/dist/julia-NCcg_P_q.js +517 -0
- package/dist/kotlin-BYlnmGrb.js +259 -0
- package/dist/less-DG4tqgOo.js +168 -0
- package/dist/lexon-CTTPcJLv.js +163 -0
- package/dist/liquid-OuSl50Zm.js +246 -0
- package/dist/lua-CxQ1RWuo.js +168 -0
- package/dist/m3-mHFfpmgx.js +216 -0
- package/dist/markdown-Dh6sYULt.js +235 -0
- package/dist/mdx-Cs8POpae.js +171 -0
- package/dist/mips-CNUcjHD1.js +204 -0
- package/dist/model/document-statistics.d.ts +40 -0
- package/dist/model/document-statistics.js +4 -0
- package/dist/model/how_to_fix.d.ts +4 -0
- package/dist/model/how_to_fix.js +1 -0
- package/dist/model/problem.d.ts +19 -0
- package/dist/model/problem.js +106 -0
- package/dist/model/rule_documentation.d.ts +5 -0
- package/dist/model/rule_documentation.js +1 -0
- package/dist/model/session.d.ts +5 -0
- package/dist/model/session.js +1 -0
- package/dist/msdax-ZvxFeKvs.js +381 -0
- package/dist/mysql-COjg31sJ.js +884 -0
- package/dist/objective-c-BqrCFBhT.js +189 -0
- package/dist/pascal-CUpkilAS.js +257 -0
- package/dist/pascaligo-nJfvRJ7x.js +170 -0
- package/dist/perl-CWsX6Ysg.js +632 -0
- package/dist/pgsql-DwgpEXC8.js +857 -0
- package/dist/php-CrbKyd62.js +506 -0
- package/dist/pla-JxXT6Kb-.js +143 -0
- package/dist/postiats-BOdnTRGv.js +913 -0
- package/dist/powerquery-DTkwcXGH.js +896 -0
- package/dist/powershell-Cx53dGpt.js +245 -0
- package/dist/protobuf-Dp9vE-l-.js +426 -0
- package/dist/pug-BSjKVjwP.js +408 -0
- package/dist/python-BsXAz21q.js +282 -0
- package/dist/qsharp-C5P1RxY3.js +291 -0
- package/dist/r-sEMYnclc.js +249 -0
- package/dist/razor-CXJ9MZn4.js +556 -0
- package/dist/redis-DbzUc-fU.js +308 -0
- package/dist/redshift-nrLijj1O.js +815 -0
- package/dist/restructuredtext-CIbGUl6T.js +180 -0
- package/dist/ruby-JcYJisWg.js +517 -0
- package/dist/rust-BgbFBFXH.js +349 -0
- package/dist/sb-hRFFChi7.js +121 -0
- package/dist/scala-Cs0yVo3Q.js +376 -0
- package/dist/scheme-l_0jNtxy.js +114 -0
- package/dist/scss-C4l7ZIRR.js +268 -0
- package/dist/services/linting-service.d.ts +12 -0
- package/dist/services/linting-service.js +121 -0
- package/dist/shell-ikLk_l24.js +227 -0
- package/dist/solidity-4GxCaH9e.js +1373 -0
- package/dist/sophia-tX0WEZsZ.js +205 -0
- package/dist/sparql-D7ky-uMk.js +207 -0
- package/dist/sql-CqEfBVGS.js +859 -0
- package/dist/st-CNWQPqyI.js +422 -0
- package/dist/style.css +1 -1
- package/dist/swift-C_fDfC0d.js +318 -0
- package/dist/systemverilog-gAvsEtN_.js +582 -0
- package/dist/tcl-KbBChuA6.js +238 -0
- package/dist/tsMode-C-mwN8lz.js +886 -0
- package/dist/twig-Bb652BpM.js +398 -0
- package/dist/typescript-CamPbG-s.js +349 -0
- package/dist/vb-2e5hSeUh.js +378 -0
- package/dist/wgsl-CYSDq0zg.js +445 -0
- package/dist/workers/rule-documentation.worker.d.ts +1 -0
- package/dist/workers/rule-documentation.worker.js +85 -0
- package/dist/workers/search-problems.worker.d.ts +1 -0
- package/dist/workers/search-problems.worker.js +19 -0
- package/dist/xml-CrDvxVsf.js +101 -0
- package/dist/yaml-xGWjZwPI.js +212 -0
- package/package.json +6 -4
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import '@shoelace-style/shoelace/dist/components/split-panel/split-panel.js';
|
|
2
|
+
import '@shoelace-style/shoelace/dist/components/tab-group/tab-group.js';
|
|
3
|
+
import '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
|
4
|
+
import '@shoelace-style/shoelace/dist/components/tab/tab.js';
|
|
5
|
+
import '@shoelace-style/shoelace/dist/components/switch/switch.js';
|
|
6
|
+
import '@shoelace-style/shoelace/dist/components/dialog/dialog.js';
|
|
7
|
+
import { LitElement } from "lit";
|
|
8
|
+
import { EditorUpdatedEvent, ProblemRuleFilterChangedEvent } from "@/events/doctor";
|
|
9
|
+
import { ProblemDrawerEvent } from "@/components/problem-list/details-drawer.js";
|
|
10
|
+
import { SlSwitch, SlTab, SlTabGroup } from "@shoelace-style/shoelace";
|
|
11
|
+
export declare const DoctorDocumentBag = "pb33f-doctor-editor";
|
|
12
|
+
export declare const HowToFixBag = "pb33f-doctor-howtofix";
|
|
13
|
+
export declare const RuleDocumentationBag = "pb33f-doctor-ruledocs";
|
|
14
|
+
export declare const DiagnosticBag = "pb33f-doctor-diagnostic";
|
|
15
|
+
export declare const OWASPBag = "pb33f-doctor-owasp";
|
|
16
|
+
export declare const DefaultDocument = "document";
|
|
17
|
+
export declare const DocumentProblems = "problems";
|
|
18
|
+
export declare class TheDoctor extends LitElement {
|
|
19
|
+
static styles: import("lit").CSSResult[];
|
|
20
|
+
overviewPanel: SlTab;
|
|
21
|
+
problemsPanel: SlTab;
|
|
22
|
+
tabGroup: SlTabGroup;
|
|
23
|
+
owaspSwitch: SlSwitch;
|
|
24
|
+
private unavailable;
|
|
25
|
+
private errorBanner;
|
|
26
|
+
private bagManager;
|
|
27
|
+
private readonly editor;
|
|
28
|
+
private docBag;
|
|
29
|
+
private problemBag;
|
|
30
|
+
private diagnosticBag;
|
|
31
|
+
private OWASPBag;
|
|
32
|
+
private howToFixBag;
|
|
33
|
+
private ruleDocsBag;
|
|
34
|
+
private readonly problemsOverview;
|
|
35
|
+
private readonly problemList;
|
|
36
|
+
private readonly detailsDrawer;
|
|
37
|
+
private ruleDocsWorker;
|
|
38
|
+
private debounceTime;
|
|
39
|
+
private bounceId;
|
|
40
|
+
private problems;
|
|
41
|
+
private OWASPEnabled;
|
|
42
|
+
private readonly statusBar;
|
|
43
|
+
private session;
|
|
44
|
+
private doctorEndpoint;
|
|
45
|
+
constructor();
|
|
46
|
+
ruleGroupClicked(event: CustomEvent<ProblemRuleFilterChangedEvent>): void;
|
|
47
|
+
ruleDocsClicked(event: CustomEvent<ProblemDrawerEvent>): void;
|
|
48
|
+
private lintSpec;
|
|
49
|
+
private platformUnavailable;
|
|
50
|
+
private specClicked;
|
|
51
|
+
private problemClicked;
|
|
52
|
+
private loadState;
|
|
53
|
+
private fetchDocs;
|
|
54
|
+
specChanged(event: CustomEvent<EditorUpdatedEvent>): void;
|
|
55
|
+
toggleOWASP(): void;
|
|
56
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,340 @@
|
|
|
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/split-panel/split-panel.js';
|
|
8
|
+
import '@shoelace-style/shoelace/dist/components/tab-group/tab-group.js';
|
|
9
|
+
import '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
|
10
|
+
import '@shoelace-style/shoelace/dist/components/tab/tab.js';
|
|
11
|
+
import '@shoelace-style/shoelace/dist/components/switch/switch.js';
|
|
12
|
+
import '@shoelace-style/shoelace/dist/components/dialog/dialog.js';
|
|
13
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
14
|
+
import { html, LitElement } from "lit";
|
|
15
|
+
import { SpecEditor } from "@/components/editor/editor.js";
|
|
16
|
+
import { ActiveView, EditorClicked, EditorUpdated, OpenProblemDrawer, ProblemClicked, ProblemRuleFilterChangedManual, RuleClicked } from "@/events/doctor";
|
|
17
|
+
import { CreateBagManager } from "@pb33f/saddlebag";
|
|
18
|
+
import { LintingService } from "@/services/linting-service";
|
|
19
|
+
import { ProblemList } from "@/components/problem-list/problem-list.js";
|
|
20
|
+
import { Problem } from "@/model/problem.js";
|
|
21
|
+
import { ProblemDetailsDrawer, ProblemDrawerEventType } from "@/components/problem-list/details-drawer.js";
|
|
22
|
+
import RuleDocumentationWorker from "@/workers/rule-documentation.worker.js?worker";
|
|
23
|
+
import theDoctorCss from "./the-doctor.css.js";
|
|
24
|
+
import { ProblemsOverview } from "@/components/problems-overview/problems-overview.js";
|
|
25
|
+
import { ErrorBanner } from "@/components/error-banner/error-banner.js";
|
|
26
|
+
import { StatusBar } from "@/components/the-doctor/status-bar.js";
|
|
27
|
+
export const DoctorDocumentBag = "pb33f-doctor-editor";
|
|
28
|
+
export const HowToFixBag = "pb33f-doctor-howtofix";
|
|
29
|
+
export const RuleDocumentationBag = "pb33f-doctor-ruledocs";
|
|
30
|
+
export const DiagnosticBag = "pb33f-doctor-diagnostic";
|
|
31
|
+
export const OWASPBag = "pb33f-doctor-owasp";
|
|
32
|
+
export const DefaultDocument = "document";
|
|
33
|
+
export const DocumentProblems = "problems";
|
|
34
|
+
let TheDoctor = class TheDoctor extends LitElement {
|
|
35
|
+
//private doctorEndpoint: string = "http://localhost:9090";
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this.debounceTime = 300;
|
|
39
|
+
this.bounceId = 0;
|
|
40
|
+
this.doctorEndpoint = "https://doctor.pb33f.io";
|
|
41
|
+
// create a stateful bag manager
|
|
42
|
+
this.bagManager = CreateBagManager(true);
|
|
43
|
+
this.bagManager.loadStatefulBags().then(this.loadState.bind(this));
|
|
44
|
+
this.editor = new SpecEditor();
|
|
45
|
+
this.problemList = new ProblemList();
|
|
46
|
+
this.detailsDrawer = new ProblemDetailsDrawer();
|
|
47
|
+
this.problemsOverview = new ProblemsOverview();
|
|
48
|
+
this.errorBanner = new ErrorBanner();
|
|
49
|
+
this.statusBar = new StatusBar();
|
|
50
|
+
this.ruleDocsWorker = new RuleDocumentationWorker();
|
|
51
|
+
this.unavailable = false;
|
|
52
|
+
// TODO: make this configurable
|
|
53
|
+
this.editor.language = "yaml";
|
|
54
|
+
//@ts-ignore
|
|
55
|
+
this.addEventListener(EditorUpdated, this.specChanged);
|
|
56
|
+
//@ts-ignore
|
|
57
|
+
this.addEventListener(EditorClicked, this.specClicked);
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
this.addEventListener(ProblemClicked, this.problemClicked);
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
this.addEventListener(OpenProblemDrawer, this.ruleDocsClicked);
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
this.addEventListener(RuleClicked, this.ruleGroupClicked);
|
|
64
|
+
// hijack navigation buttons.
|
|
65
|
+
window.addEventListener('popstate', (e) => {
|
|
66
|
+
const state = e.state;
|
|
67
|
+
if (state) {
|
|
68
|
+
switch (state.view) {
|
|
69
|
+
case ActiveView.Problems:
|
|
70
|
+
this.tabGroup.show(ActiveView.Problems);
|
|
71
|
+
break;
|
|
72
|
+
case ActiveView.Overview:
|
|
73
|
+
this.tabGroup.show(ActiveView.Overview);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
history.pushState({ view: ActiveView.Overview }, "", ActiveView.Overview);
|
|
79
|
+
}
|
|
80
|
+
ruleGroupClicked(event) {
|
|
81
|
+
this.problemsPanel.focus();
|
|
82
|
+
const simEvent = new CustomEvent(ProblemRuleFilterChangedManual, {
|
|
83
|
+
bubbles: true,
|
|
84
|
+
composed: true,
|
|
85
|
+
detail: {
|
|
86
|
+
rule: event.detail.rule
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
this.problemsPanel.focus();
|
|
90
|
+
this.problemList.dispatchEvent(simEvent);
|
|
91
|
+
history.pushState({ rule: event.detail.rule }, "", `/${ActiveView.Problems}?rule=${event.detail.rule}`);
|
|
92
|
+
this.tabGroup.show(ActiveView.Problems);
|
|
93
|
+
}
|
|
94
|
+
ruleDocsClicked(event) {
|
|
95
|
+
const ruleId = event.detail.rule;
|
|
96
|
+
if (ruleId) {
|
|
97
|
+
switch (event.detail.type) {
|
|
98
|
+
case ProblemDrawerEventType.RULE_DOCS:
|
|
99
|
+
const ruleDoc = this.ruleDocsBag?.get(ruleId);
|
|
100
|
+
if (ruleDoc) {
|
|
101
|
+
event.detail.body = ruleDoc.body;
|
|
102
|
+
this.detailsDrawer.open(event.detail);
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case ProblemDrawerEventType.HOW_TO_FIX:
|
|
106
|
+
const howToFix = this.howToFixBag?.get(ruleId);
|
|
107
|
+
if (howToFix) {
|
|
108
|
+
event.detail.body = howToFix.howToFix;
|
|
109
|
+
this.detailsDrawer.open(event.detail);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
lintSpec(value) {
|
|
115
|
+
LintingService.lintFile(value, this.OWASPEnabled).then((result) => {
|
|
116
|
+
if (result && !Array.isArray(result)) {
|
|
117
|
+
this.editor.setMarkers([result]);
|
|
118
|
+
this.problemBag?.set(DocumentProblems, [result]);
|
|
119
|
+
this.problemList.problems = [result];
|
|
120
|
+
this.problems = [result];
|
|
121
|
+
this.problemsOverview.problems = this.problemList.problemItems;
|
|
122
|
+
}
|
|
123
|
+
if (result && Array.isArray(result)) {
|
|
124
|
+
this.editor.setMarkers(result);
|
|
125
|
+
this.problemBag?.set(DocumentProblems, result);
|
|
126
|
+
this.problemList.problems = result;
|
|
127
|
+
this.problems = result;
|
|
128
|
+
this.problemsOverview.problems = this.problemList.problemItems;
|
|
129
|
+
}
|
|
130
|
+
// update the overview statistics
|
|
131
|
+
LintingService.fetchStatistics().then((result) => {
|
|
132
|
+
this.problemsOverview.statistics = result;
|
|
133
|
+
this.diagnosticBag?.set(DiagnosticBag, result);
|
|
134
|
+
if (result?.remainingCredit <= 10) {
|
|
135
|
+
this.statusBar.callsRemaining = result.remainingCredit;
|
|
136
|
+
this.statusBar.visible = true;
|
|
137
|
+
console.warn("You are running low on credit, you will need to authenticate soon. " +
|
|
138
|
+
"" + result.remainingCredit + " credits remaining.");
|
|
139
|
+
}
|
|
140
|
+
}).catch((e) => {
|
|
141
|
+
console.error("statistics service is down");
|
|
142
|
+
this.platformUnavailable(e);
|
|
143
|
+
});
|
|
144
|
+
}).catch((e) => {
|
|
145
|
+
this.platformUnavailable(e);
|
|
146
|
+
console.error("so sorry, the doctor cannot see you right now, the clinic is closed.");
|
|
147
|
+
if (e) {
|
|
148
|
+
console.error(e.detail);
|
|
149
|
+
if (e.instance === 'https://pb33f.io/errors/no-credit-remaining') {
|
|
150
|
+
this.statusBar.callsRemaining = 0;
|
|
151
|
+
this.statusBar.visible = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
platformUnavailable(error) {
|
|
157
|
+
if (!this.unavailable) {
|
|
158
|
+
this.errorBanner.errorTitle = "The doctor is out.";
|
|
159
|
+
if (!error) {
|
|
160
|
+
this.errorBanner.errorMessage = "The clinic is <strong>closed!</strong> " +
|
|
161
|
+
"The doctor is currently unavailable" +
|
|
162
|
+
" because there is no response from the platform.";
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this.errorBanner.errorMessage = "The clinic is <strong>closed!</strong> " +
|
|
166
|
+
"The doctor is currently unavailable because " + error.detail;
|
|
167
|
+
}
|
|
168
|
+
this.errorBanner.visible = true;
|
|
169
|
+
this.unavailable = true;
|
|
170
|
+
this.problemsOverview.unavailable = true;
|
|
171
|
+
this.tabGroup.show(ActiveView.Overview);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
specClicked(event) {
|
|
175
|
+
this.detailsDrawer.close();
|
|
176
|
+
for (let i = 0; i < this.problems?.length; i++) {
|
|
177
|
+
if (this.problems[i].startLineNumber === event.detail.line) {
|
|
178
|
+
this.problemList.lineClicked(event.detail.line, true);
|
|
179
|
+
this.tabGroup.show(ActiveView.Problems);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
problemClicked(event) {
|
|
185
|
+
this.editor.editor?.revealLineInCenter(event.detail.problem.line);
|
|
186
|
+
this.editor.editor?.setPosition({
|
|
187
|
+
lineNumber: event.detail.problem.line,
|
|
188
|
+
column: event.detail.problem.column
|
|
189
|
+
});
|
|
190
|
+
this.detailsDrawer.close();
|
|
191
|
+
if (!event.detail.launchedFromProblems) {
|
|
192
|
+
this.problemList.lineClicked(event.detail.problem.problemObject.startLineNumber);
|
|
193
|
+
}
|
|
194
|
+
this.tabGroup.show(ActiveView.Problems);
|
|
195
|
+
}
|
|
196
|
+
loadState() {
|
|
197
|
+
LintingService.doctorEndpoint = this.doctorEndpoint;
|
|
198
|
+
this.docBag = this.bagManager.getBag(DoctorDocumentBag);
|
|
199
|
+
if (this.docBag) {
|
|
200
|
+
const doc = this.docBag.get(DefaultDocument);
|
|
201
|
+
if (doc) {
|
|
202
|
+
this.editor.setValue(doc, true);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
this.problemBag = this.bagManager.getBag(DocumentProblems);
|
|
206
|
+
if (this.problemBag) {
|
|
207
|
+
const markers = this.problemBag.get(DocumentProblems);
|
|
208
|
+
if (markers) {
|
|
209
|
+
this.problems = markers;
|
|
210
|
+
this.editor.setMarkers(markers);
|
|
211
|
+
for (let i = 0; i < markers.length; i++) {
|
|
212
|
+
markers[i] = Problem.reconstruct(markers[i]);
|
|
213
|
+
}
|
|
214
|
+
this.problemList.problems = markers;
|
|
215
|
+
this.problemsOverview.problems = this.problemList.problemItems;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
this.howToFixBag = this.bagManager.getBag(HowToFixBag);
|
|
219
|
+
this.diagnosticBag = this.bagManager.getBag(DiagnosticBag);
|
|
220
|
+
if (this.diagnosticBag) {
|
|
221
|
+
const stats = this.diagnosticBag.get(DiagnosticBag);
|
|
222
|
+
if (stats) {
|
|
223
|
+
this.problemsOverview.statistics = stats;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
this.OWASPBag = this.bagManager.getBag(OWASPBag);
|
|
227
|
+
if (this.OWASPBag) {
|
|
228
|
+
this.OWASPEnabled = this.OWASPBag.get(OWASPBag);
|
|
229
|
+
this.owaspSwitch.checked = this.OWASPEnabled;
|
|
230
|
+
}
|
|
231
|
+
// refresh state for how to fix.
|
|
232
|
+
this.fetchDocs();
|
|
233
|
+
}
|
|
234
|
+
fetchDocs() {
|
|
235
|
+
// the first this we need to do is start a session
|
|
236
|
+
LintingService.startSession().then((session) => {
|
|
237
|
+
this.session = session;
|
|
238
|
+
LintingService.fetchAllHowToFix().then((result) => {
|
|
239
|
+
if (result) {
|
|
240
|
+
result.forEach((howToFix) => {
|
|
241
|
+
this.howToFixBag?.set(howToFix.ruleId, howToFix);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}).catch((e) => {
|
|
245
|
+
this.platformUnavailable(e);
|
|
246
|
+
console.error("documentation service is down");
|
|
247
|
+
});
|
|
248
|
+
this.ruleDocsBag = this.bagManager.getBag(RuleDocumentationBag);
|
|
249
|
+
// populate docs via worker.
|
|
250
|
+
this.ruleDocsWorker.addEventListener("message", (event) => {
|
|
251
|
+
const data = event.data;
|
|
252
|
+
if (data) {
|
|
253
|
+
data.forEach((doc) => {
|
|
254
|
+
this.ruleDocsBag?.set(doc.ruleId, doc);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
this.ruleDocsWorker.postMessage({ start: true, endpoint: this.doctorEndpoint });
|
|
259
|
+
}).catch((e) => {
|
|
260
|
+
this.platformUnavailable(e);
|
|
261
|
+
console.error("cannot start session");
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
specChanged(event) {
|
|
265
|
+
if (this.docBag) {
|
|
266
|
+
this.docBag.set(DefaultDocument, event.detail.content);
|
|
267
|
+
}
|
|
268
|
+
clearTimeout(this.bounceId);
|
|
269
|
+
this.bounceId = window.setTimeout(() => {
|
|
270
|
+
this.lintSpec(event.detail.content);
|
|
271
|
+
}, this.debounceTime);
|
|
272
|
+
}
|
|
273
|
+
toggleOWASP() {
|
|
274
|
+
this.OWASPEnabled = this.owaspSwitch.checked;
|
|
275
|
+
this.OWASPBag?.set(OWASPBag, this.OWASPEnabled);
|
|
276
|
+
if (this.docBag) {
|
|
277
|
+
const doc = this.docBag.get(DefaultDocument);
|
|
278
|
+
this.lintSpec(doc);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
render() {
|
|
282
|
+
let overlay = html ``;
|
|
283
|
+
if (this.unavailable) {
|
|
284
|
+
overlay = html `
|
|
285
|
+
<div class="overlay" @click="return false"></div>`;
|
|
286
|
+
}
|
|
287
|
+
return html `
|
|
288
|
+
<div class="doctor">
|
|
289
|
+
${this.errorBanner}
|
|
290
|
+
${overlay}
|
|
291
|
+
<sl-split-panel class="split-panel ${this.unavailable ? 'unavailable' : ''}">
|
|
292
|
+
<sl-icon slot="divider" name="grip-vertical"></sl-icon>
|
|
293
|
+
<div class="editor" slot="start">
|
|
294
|
+
${this.detailsDrawer}
|
|
295
|
+
${this.editor}
|
|
296
|
+
</div>
|
|
297
|
+
<div class="problems" slot="end">
|
|
298
|
+
<sl-tab-group class="tab-group ">
|
|
299
|
+
<sl-tab slot="nav" panel="overview" class="tab" id="overviewPanel">Overview</sl-tab>
|
|
300
|
+
<sl-tab slot="nav" panel="problems" class="tab" id="problemsPanel">Problems</sl-tab>
|
|
301
|
+
<sl-tab slot="nav" panel="ruleset" class="tab" id="rulesetPanel">Rules</sl-tab>
|
|
302
|
+
<sl-tab-panel name="overview" class="tab-panel">${this.problemsOverview}</sl-tab-panel>
|
|
303
|
+
<sl-tab-panel name="problems" class="tab-panel">${this.problemList}</sl-tab-panel>
|
|
304
|
+
<sl-tab-panel name="ruleset" class="tab-panel">
|
|
305
|
+
<div class="ruleset">
|
|
306
|
+
<pb33f-attention-box type="info" headerText="Manage RuleSets">
|
|
307
|
+
Feature coming soon, you will be able to manage your ruleset(s) here.
|
|
308
|
+
</pb33f-attention-box>
|
|
309
|
+
<sl-switch size="small" @sl-change="${this.toggleOWASP}" id="owasp">Enable <a href="https://quobix.com/vacuum/rulesets/owasp/">OWASP</a>
|
|
310
|
+
Rules</a>?</sl-switch>
|
|
311
|
+
</div>
|
|
312
|
+
</sl-tab-panel>
|
|
313
|
+
</sl-tab-group>
|
|
314
|
+
</div>
|
|
315
|
+
</sl-split-panel>
|
|
316
|
+
${this.statusBar}
|
|
317
|
+
</div>
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
TheDoctor.styles = [theDoctorCss];
|
|
322
|
+
__decorate([
|
|
323
|
+
query('#overviewPanel')
|
|
324
|
+
], TheDoctor.prototype, "overviewPanel", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
query('#problemsPanel')
|
|
327
|
+
], TheDoctor.prototype, "problemsPanel", void 0);
|
|
328
|
+
__decorate([
|
|
329
|
+
query('sl-tab-group')
|
|
330
|
+
], TheDoctor.prototype, "tabGroup", void 0);
|
|
331
|
+
__decorate([
|
|
332
|
+
query('sl-switch#owasp')
|
|
333
|
+
], TheDoctor.prototype, "owaspSwitch", void 0);
|
|
334
|
+
__decorate([
|
|
335
|
+
property({ type: Boolean })
|
|
336
|
+
], TheDoctor.prototype, "unavailable", void 0);
|
|
337
|
+
TheDoctor = __decorate([
|
|
338
|
+
customElement("pb33f-doctor")
|
|
339
|
+
], TheDoctor);
|
|
340
|
+
export { TheDoctor };
|