@pb33f/cowboy-components 0.3.4 → 0.4.0

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 (96) hide show
  1. package/dist/assets/css.worker-CTSQecos.js +84 -0
  2. package/dist/assets/editor.worker-CYC0jP-p.js +12 -0
  3. package/dist/assets/equalizer.worker-CdIiiqfH.js +1 -0
  4. package/dist/assets/html.worker-C1BIaUKh.js +461 -0
  5. package/dist/assets/json.worker-BCyBlh8h.js +49 -0
  6. package/dist/assets/rule-documentation.worker-B7xOWY5M.js +1 -0
  7. package/dist/components/credit-ticker/credit-ticker.css.d.ts +2 -0
  8. package/dist/components/credit-ticker/credit-ticker.css.js +36 -0
  9. package/dist/components/credit-ticker/credit-ticker.d.ts +14 -0
  10. package/dist/components/credit-ticker/credit-ticker.js +88 -0
  11. package/dist/components/editor/editor-breadcrumb.css.d.ts +2 -0
  12. package/dist/components/editor/editor-breadcrumb.css.js +49 -0
  13. package/dist/components/editor/editor-breadcrumb.d.ts +9 -0
  14. package/dist/components/editor/editor-breadcrumb.js +60 -0
  15. package/dist/components/editor/editor.css.d.ts +2 -0
  16. package/dist/components/editor/editor.css.js +62 -0
  17. package/dist/components/editor/editor.d.ts +25 -4
  18. package/dist/components/editor/editor.js +412 -76
  19. package/dist/components/manage-ruleset/manage-ruleset.css.js +5 -0
  20. package/dist/components/manage-ruleset/manage-ruleset.js +8 -6
  21. package/dist/components/model-icon/model-icon.d.ts +7 -0
  22. package/dist/components/model-icon/model-icon.js +56 -7
  23. package/dist/components/model-renderer/clickable-ref.d.ts +2 -2
  24. package/dist/components/model-renderer/clickable-ref.js +5 -4
  25. package/dist/components/model-renderer/header.js +10 -10
  26. package/dist/components/model-renderer/operation.js +2 -2
  27. package/dist/components/model-renderer/rendered-node.css.js +1 -1
  28. package/dist/components/model-renderer/schema.js +1 -1
  29. package/dist/components/model-tree/tree.css.js +1 -0
  30. package/dist/components/model-tree/tree.d.ts +8 -0
  31. package/dist/components/model-tree/tree.js +232 -24
  32. package/dist/components/paginator/paginator.css.js +6 -2
  33. package/dist/components/paginator/paginator.d.ts +1 -0
  34. package/dist/components/paginator/paginator.js +8 -4
  35. package/dist/components/problem-list/details-drawer.css.js +1 -1
  36. package/dist/components/problem-list/problem-item.js +6 -3
  37. package/dist/components/problem-list/problem-label-view-filter.d.ts +2 -1
  38. package/dist/components/problem-list/problem-label-view-filter.js +1 -0
  39. package/dist/components/problem-list/problem-list.d.ts +1 -0
  40. package/dist/components/problem-list/problem-list.js +19 -1
  41. package/dist/components/problem-list/problem-mainview.css.js +1 -1
  42. package/dist/components/problem-list/problem-mainview.js +6 -0
  43. package/dist/components/problem-list/problem-sort-filter.d.ts +2 -1
  44. package/dist/components/problem-list/problem-sort-filter.js +1 -0
  45. package/dist/components/problems-overview/diagnostic-evaluation.css.js +14 -4
  46. package/dist/components/problems-overview/diagnostic-evaluation.js +42 -1
  47. package/dist/components/problems-overview/problems-overview.css.js +1 -0
  48. package/dist/components/the-doctor/nuke-workspace.d.ts +13 -0
  49. package/dist/components/the-doctor/nuke-workspace.js +70 -0
  50. package/dist/components/the-doctor/sparks.d.ts +1 -0
  51. package/dist/components/the-doctor/sparks.js +11 -2
  52. package/dist/components/the-doctor/status-bar.css.js +6 -5
  53. package/dist/components/the-doctor/the-doctor.css.js +117 -16
  54. package/dist/components/the-doctor/the-doctor.d.ts +70 -21
  55. package/dist/components/the-doctor/the-doctor.js +1026 -169
  56. package/dist/components/the-doctor/upload-archive.css.d.ts +2 -0
  57. package/dist/components/the-doctor/upload-archive.css.js +98 -0
  58. package/dist/components/the-doctor/upload-archive.d.ts +33 -0
  59. package/dist/components/the-doctor/upload-archive.js +281 -0
  60. package/dist/components/visualizer/equalizer.d.ts +3 -1
  61. package/dist/components/visualizer/equalizer.js +55 -31
  62. package/dist/components/visualizer/explorer.js +6 -5
  63. package/dist/cowboy-components.umd.cjs +1846 -1273
  64. package/dist/css/hr.css.d.ts +2 -0
  65. package/dist/css/hr.css.js +12 -0
  66. package/dist/css/pb33f-theme.css +1 -0
  67. package/dist/events/doctor.d.ts +19 -1
  68. package/dist/events/doctor.js +5 -0
  69. package/dist/model/channels.d.ts +1 -0
  70. package/dist/model/channels.js +1 -0
  71. package/dist/model/graph.d.ts +17 -0
  72. package/dist/model/graph.js +17 -1
  73. package/dist/model/link.d.ts +8 -0
  74. package/dist/model/node_type.d.ts +22 -1
  75. package/dist/model/node_type.js +22 -0
  76. package/dist/model/panel-state.d.ts +5 -0
  77. package/dist/model/panel-state.js +1 -0
  78. package/dist/model/problem.d.ts +3 -1
  79. package/dist/model/problem.js +4 -2
  80. package/dist/model/rolodex.d.ts +34 -0
  81. package/dist/model/rolodex.js +1 -0
  82. package/dist/services/linting-service.d.ts +1 -1
  83. package/dist/services/linting-service.js +23 -11
  84. package/dist/services/model-service.d.ts +8 -1
  85. package/dist/services/model-service.js +127 -0
  86. package/dist/style.css +1 -1
  87. package/dist/workers/equalizer.worker.js +4 -3
  88. package/dist/workers/rule-documentation.worker.d.ts +2 -2
  89. package/dist/workers/rule-documentation.worker.js +26 -15
  90. package/package.json +3 -3
  91. package/dist/assets/css.worker-B_qZXUzt.js +0 -84
  92. package/dist/assets/editor.worker-HEmB0D7P.js +0 -11
  93. package/dist/assets/equalizer.worker-icLzyXQ7.js +0 -1
  94. package/dist/assets/html.worker-D3WUrk8Q.js +0 -458
  95. package/dist/assets/json.worker-CAhUaBo4.js +0 -42
  96. package/dist/assets/rule-documentation.worker-D39NS8Lx.js +0 -1
@@ -0,0 +1 @@
1
+ (function(){"use strict";var a=(t=>(t.RULE="rule",t.FUNCTION="function",t))(a||{});onmessage=function(t){if(t.data.start){const o=[d(t.data.endpoint,t.data.existingRules),l(t.data.endpoint,t.data.existingFunctions)];Promise.all(o).then(e=>{postMessage(e.flat())}).catch(()=>{console.error("documentation cannot be fetched")})}};async function d(t,o){return new Promise(async(e,n)=>{try{const c=(await m(t)).map(s=>s.ruleId&&!o.includes(s.ruleId)?y(s.ruleId,t).then(i=>(i.body&&(s.body=i.body),s.type=a.RULE,s)):Promise.resolve(s)),u=await Promise.all(c);e(u)}catch(r){console.error("documentation service is down"),n(r)}})}async function l(t,o){return new Promise(async(e,n)=>{try{const c=(await f(t)).map(s=>s.functionId&&!o.includes(s.functionId)?h(s.functionId,t).then(i=>(i.body&&(s.body=i.body),s.type=a.FUNCTION,s)):Promise.resolve(s)),u=await Promise.all(c);e(u)}catch(r){console.error("documentation service is down"),n(r)}})}async function m(t){try{const e=await(await fetch(t+"/rules/documentation",{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e?e!=null&&e.error?new Promise(async(n,r)=>{r(e.error)}):e:new Promise(async(n,r)=>{r("nothing returned")})}catch(o){return new Promise(async(e,n)=>{n(o)})}}async function f(t){try{const e=await(await fetch(t+"/functions/documentation",{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e?e!=null&&e.error?new Promise(async(n,r)=>{r(e.error)}):e:new Promise(async(n,r)=>{r("nothing returned")})}catch(o){return new Promise(async(e,n)=>{n(o)})}}async function y(t,o){try{const n=await(await fetch(o+`/rules/documentation/${t}`,{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return n?n!=null&&n.error?new Promise(async(r,c)=>{c(n.error)}):n:new Promise(async(r,c)=>{c("nothing returned")})}catch(e){return new Promise(async(n,r)=>{r(e)})}}async function h(t,o){try{const n=await(await fetch(o+`/functions/documentation/${t}`,{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return n?n!=null&&n.error?new Promise(async(r,c)=>{c(n.error)}):n:new Promise(async(r,c)=>{c("nothing returned")})}catch(e){return new Promise(async(n,r)=>{r(e)})}}})();
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,36 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ sl-icon {
4
+ vertical-align: middle;
5
+ }
6
+
7
+ .credit-ticker {
8
+ overflow: hidden;
9
+
10
+ }
11
+
12
+ .credits {
13
+ font-family: var(--font-stack-bold), monospace;
14
+ }
15
+
16
+ #downArrow {
17
+ vertical-align: text-top;
18
+ }
19
+
20
+ .arrow {
21
+ display: inline-block;
22
+ margin-left: 10px;
23
+ }
24
+
25
+ .ok {
26
+ color: var(--terminal-text);
27
+ }
28
+
29
+ .warning {
30
+ color: var(--warn-color);
31
+ }
32
+
33
+ .danger {
34
+ color: var(--error-color);
35
+ }
36
+ `;
@@ -0,0 +1,14 @@
1
+ import '@shoelace-style/shoelace/dist/components/animation/animation.js';
2
+ import { LitElement } from "lit";
3
+ import { SlAnimation } from "@shoelace-style/shoelace";
4
+ export declare class CreditTicker extends LitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ credits: number;
7
+ visible: boolean;
8
+ downArrow: HTMLElement;
9
+ arrowAnimation: SlAnimation;
10
+ private showArrow;
11
+ constructor();
12
+ protected updated(): void;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ }
@@ -0,0 +1,88 @@
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/animation/animation.js';
8
+ import { customElement, property, query } from "lit/decorators.js";
9
+ import { html, LitElement } from "lit";
10
+ import creditTickerCss from "./credit-ticker.css";
11
+ let CreditTicker = class CreditTicker extends LitElement {
12
+ constructor() {
13
+ super();
14
+ this.credits = -1;
15
+ this.visible = false;
16
+ }
17
+ // Trigger animations when component updates
18
+ updated() {
19
+ // If there's a new credit update, animate the arrow
20
+ if (this.visible && this.credits > 0) {
21
+ this.downArrow.style.display = 'inline-block';
22
+ // Make sure we start with fadeInDown
23
+ this.arrowAnimation.name = 'fadeInDown';
24
+ this.arrowAnimation.play = true;
25
+ // After 1 second, fade out
26
+ setTimeout(() => {
27
+ this.arrowAnimation.name = 'fadeOut';
28
+ this.arrowAnimation.duration = 500;
29
+ this.arrowAnimation.play = true;
30
+ }, 1000);
31
+ setTimeout(() => {
32
+ this.downArrow.style.display = 'none';
33
+ }, 1500);
34
+ }
35
+ }
36
+ render() {
37
+ if (!this.visible) {
38
+ return html ``;
39
+ }
40
+ let credits = this.credits;
41
+ if (credits < 0) {
42
+ credits = '--';
43
+ }
44
+ let arrowClass = 'ok';
45
+ if (this.credits <= 10 && this.credits > 0) {
46
+ arrowClass = 'warning';
47
+ }
48
+ if (this.credits < 1) {
49
+ arrowClass = 'danger';
50
+ }
51
+ return html `
52
+ <div class="credit-ticker ${arrowClass}">
53
+ <sl-icon name="cash-coin"></sl-icon>
54
+ <span class="credits">
55
+ <sl-format-number value="${credits}"></sl-format-number>
56
+ </span>
57
+ <div class="arrow">
58
+ <sl-animation
59
+ id="arrowAnimation"
60
+ name="fadeInDown"
61
+ easing="ease-in-out"
62
+ duration="500"
63
+ iterations="1"
64
+ >
65
+ <sl-icon name="arrow-down" id="downArrow"></sl-icon>
66
+ </sl-animation>
67
+ </div>
68
+ </div>
69
+ `;
70
+ }
71
+ };
72
+ CreditTicker.styles = [creditTickerCss];
73
+ __decorate([
74
+ property()
75
+ ], CreditTicker.prototype, "credits", void 0);
76
+ __decorate([
77
+ property()
78
+ ], CreditTicker.prototype, "visible", void 0);
79
+ __decorate([
80
+ query('.arrow')
81
+ ], CreditTicker.prototype, "downArrow", void 0);
82
+ __decorate([
83
+ query('#arrowAnimation')
84
+ ], CreditTicker.prototype, "arrowAnimation", void 0);
85
+ CreditTicker = __decorate([
86
+ customElement('pb33f-credit-ticker')
87
+ ], CreditTicker);
88
+ export { CreditTicker };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,49 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ :host{
4
+ height: 25px;
5
+ position: absolute;
6
+ background-color: var(--background-color-withopacity);
7
+ width: 100%;
8
+ bottom: 10px;
9
+ font-size: 0.8rem;
10
+ z-index: 102;
11
+ }
12
+
13
+ .sep {
14
+ vertical-align: text-bottom;
15
+ margin-left: 5px;
16
+ margin-right: 5px;
17
+ color: var(--secondary-color);
18
+ }
19
+
20
+ sl-breadcrumb {
21
+
22
+ }
23
+
24
+ sl-breadcrumb > sl-breadcrumb-item:last-child > sl-icon {
25
+ display: none;
26
+ }
27
+
28
+ .crumb-head {
29
+ font-family: var(--font-stack-bold), sans-serif;
30
+ color: var(--primary-color);
31
+ }
32
+ .crumb-invalid {
33
+ font-family: var(--font-stack-bold), sans-serif;
34
+ color: var(--background-color);
35
+ vertical-align: middle;
36
+ }
37
+
38
+ .valid-path {
39
+ border-top: 1px solid var(--secondary-color);
40
+ padding: 5px 0 5px 5px;
41
+ }
42
+
43
+ .invalid-path {
44
+ border-top: 1px solid var(--error-color);
45
+ padding: 5px 0 5px 5px;
46
+ background-color: var(--error-color);
47
+ }
48
+
49
+ `;
@@ -0,0 +1,9 @@
1
+ import '@shoelace-style/shoelace/dist/components/breadcrumb/breadcrumb.js';
2
+ import { LitElement, TemplateResult } from "lit";
3
+ export declare class SpecEditorBreadcrumb extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ currentPath: string;
6
+ isInvalid: boolean;
7
+ constructor();
8
+ render(): TemplateResult<1>;
9
+ }
@@ -0,0 +1,60 @@
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/breadcrumb/breadcrumb.js';
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { html, LitElement } from "lit";
10
+ import editorBreadcrumbCss from "./editor-breadcrumb.css";
11
+ let SpecEditorBreadcrumb = class SpecEditorBreadcrumb extends LitElement {
12
+ constructor() {
13
+ super();
14
+ }
15
+ render() {
16
+ let crumbs = [];
17
+ const paths = this.currentPath?.split("/");
18
+ for (let i = 0; i < paths?.length; i++) {
19
+ if (paths[i] === "") {
20
+ continue;
21
+ }
22
+ if (i < paths.length - 1) {
23
+ crumbs.push(html `
24
+ <sl-breadcrumb-item>${paths[i]}</sl-breadcrumb-item>`);
25
+ }
26
+ else {
27
+ crumbs.push(html `<sl-breadcrumb-item><span class="crumb-head">${paths[i]}</span></sl-breadcrumb-item>`);
28
+ }
29
+ }
30
+ if (this.isInvalid) {
31
+ return html `
32
+ <div class="invalid-path">
33
+ <sl-icon slot="prefix" name="exclamation-octagon" class="crumb-invalid"></sl-icon>
34
+ <span class="crumb-invalid">File is not valid, it cannot be parsed by the doctor</span>
35
+ </div>`;
36
+ }
37
+ return html `
38
+ <div class="valid-path">
39
+ <sl-breadcrumb>
40
+ <sl-icon name="chevron-right" slot="separator" class="sep"></sl-icon>
41
+ <sl-breadcrumb-item>
42
+ <sl-icon slot="prefix" name="house" class="sep"></sl-icon>
43
+ Entry
44
+ </sl-breadcrumb-item>
45
+ ${crumbs}
46
+ </sl-breadcrumb>
47
+ </div>`;
48
+ }
49
+ };
50
+ SpecEditorBreadcrumb.styles = [editorBreadcrumbCss];
51
+ __decorate([
52
+ property()
53
+ ], SpecEditorBreadcrumb.prototype, "currentPath", void 0);
54
+ __decorate([
55
+ property({ type: Boolean })
56
+ ], SpecEditorBreadcrumb.prototype, "isInvalid", void 0);
57
+ SpecEditorBreadcrumb = __decorate([
58
+ customElement("pb33f-editor-breadcrumb")
59
+ ], SpecEditorBreadcrumb);
60
+ export { SpecEditorBreadcrumb };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,62 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ main {
4
+ width: 100%;
5
+ height: 100%;
6
+ }
7
+
8
+ .ref {
9
+ text-decoration-color: var(--terminal-text) !important;
10
+ text-decoration: underline;
11
+ color: var(--terminal-text);
12
+ cursor: pointer;
13
+ }
14
+
15
+ .ref-poly {
16
+ text-decoration-color: var(--warn-color) !important;
17
+ text-decoration: underline;
18
+ color: var(--warn-color);
19
+ cursor: pointer;
20
+ }
21
+
22
+ .ref:hover {
23
+ color: var(--terminal-text);
24
+ font-family: var(--font-stack-bold), sans-serif;
25
+ text-shadow: 0 0 20px var(--terminal-text);
26
+ }
27
+
28
+ .ref-poly:hover {
29
+ color: var(--warn-color);
30
+ font-family: var(--font-stack-bold), sans-serif;
31
+ text-shadow: 0 0 20px var(--warn-color);
32
+ }
33
+
34
+ .ref:active, .ref-poly:active {
35
+ color: var(--error-color);
36
+ text-decoration-color: var(--error-color) !important;
37
+ }
38
+
39
+ .ref-margin, .ref-poly-margin {
40
+ position: relative;
41
+ width: 16px;
42
+ height: 16px;
43
+ }
44
+
45
+ .ref-margin::before {
46
+ content: '\\2192';
47
+ font-size: 16px;
48
+ color: var(--terminal-text);
49
+ position: absolute;
50
+ top: 0;
51
+ left: 0;
52
+ }
53
+
54
+ .ref-poly-margin::before {
55
+ content: '\\2192';
56
+ font-size: 16px;
57
+ color: var(--warn-color);
58
+ position: absolute;
59
+ top: 0;
60
+ left: 0;
61
+ }
62
+ `;
@@ -1,5 +1,7 @@
1
1
  import { LitElement } from "lit";
2
2
  import * as monaco from "monaco-editor";
3
+ import { Reference } from "../../model/graph.js";
4
+ import { SpecEditorBreadcrumb } from "./editor-breadcrumb.js";
3
5
  export declare class SpecEditor extends LitElement {
4
6
  private container;
5
7
  editor?: monaco.editor.IStandaloneCodeEditor;
@@ -8,17 +10,36 @@ export declare class SpecEditor extends LitElement {
8
10
  theme?: string;
9
11
  language?: string;
10
12
  code?: string;
13
+ links: Reference[];
14
+ minimapVisible: boolean;
15
+ currentPath: string;
11
16
  id: string;
12
- static styles: import("lit").CSSResult;
13
- constructor(id?: string);
17
+ showBreadcrumb: boolean;
18
+ private isActive;
19
+ private linkDecorations;
20
+ private decorationIdToLinkTarget;
21
+ breadcumb: SpecEditorBreadcrumb;
14
22
  private firstboot;
23
+ static styles: import("lit").CSSResult[];
24
+ constructor(id?: string);
25
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
26
+ revive(): void;
27
+ dead(): void;
28
+ setCurrentPath(path: string): void;
15
29
  render(): import("lit-html").TemplateResult<1>;
16
30
  private getFile;
17
31
  private getCode;
18
32
  private getTheme;
33
+ switchLanguage(language: string): void;
19
34
  private isDark;
20
- setValue(value: string, firstboot?: boolean): void;
21
- getValue(): string;
35
+ setValue(value: string, firstBoot?: boolean): void;
36
+ getValue(): string | undefined;
37
+ clearDecorations(): void;
38
+ clearAllMarkers(): void;
22
39
  setMarkers(markers: monaco.editor.IMarkerData[]): void;
40
+ toggleMinimap(): void;
23
41
  firstUpdated(): void;
42
+ open(uri: monaco.Uri): Promise<boolean>;
43
+ applyLinkDecorations(): void;
44
+ provideLinks(_model: monaco.editor.ITextModel, _token: monaco.CancellationToken): monaco.languages.ProviderResult<monaco.languages.ILinksList>;
24
45
  }