@pb33f/cowboy-components 0.0.1 → 0.0.4

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 (82) hide show
  1. package/README.md +9 -0
  2. package/dist/components/attention-box/attention-box.css.js +73 -0
  3. package/dist/components/attention-box/attention-box.d.ts +16 -0
  4. package/dist/components/attention-box/attention-box.js +65 -0
  5. package/dist/components/changelog/changelog.css.js +95 -0
  6. package/dist/components/changelog/changelog.d.ts +12 -0
  7. package/dist/components/changelog/changelog.js +125 -0
  8. package/dist/components/changelog/model.d.ts +68 -0
  9. package/dist/components/changelog/model.js +1 -0
  10. package/dist/components/changelog/release.css.d.ts +2 -0
  11. package/dist/components/changelog/release.css.js +66 -0
  12. package/dist/components/changelog/release.d.ts +16 -0
  13. package/dist/components/changelog/release.js +96 -0
  14. package/dist/components/header/header.css.js +102 -0
  15. package/dist/components/header/header.d.ts +1 -0
  16. package/dist/components/header/header.js +39 -0
  17. package/dist/components/http-method/http-method.css.d.ts +2 -0
  18. package/dist/components/http-method/http-method.css.js +22 -0
  19. package/dist/components/http-method/http-method.d.ts +8 -0
  20. package/dist/components/http-method/http-method.js +34 -0
  21. package/dist/components/http-property-view/http-property-view.css.d.ts +2 -0
  22. package/dist/components/http-property-view/http-property-view.css.js +108 -0
  23. package/dist/components/http-property-view/http-property-view.d.ts +19 -0
  24. package/dist/components/http-property-view/http-property-view.js +102 -0
  25. package/dist/components/kv-view/kv-view.css.js +81 -0
  26. package/dist/components/kv-view/kv-view.js +98 -0
  27. package/dist/components/mailing-list/mailing-list.css.d.ts +2 -0
  28. package/dist/components/mailing-list/mailing-list.css.js +100 -0
  29. package/dist/components/mailing-list/mailing-list.d.ts +24 -0
  30. package/dist/components/mailing-list/mailing-list.js +138 -0
  31. package/dist/components/terminal/terminal-example.css.js +43 -0
  32. package/dist/components/terminal/terminal-example.js +34 -0
  33. package/dist/components/theme-switcher/theme-switcher.css.js +9 -0
  34. package/dist/components/theme-switcher/theme-switcher.js +76 -0
  35. package/dist/components/timeline/timeline-item.css.d.ts +2 -0
  36. package/dist/components/timeline/timeline-item.css.js +63 -0
  37. package/dist/components/timeline/timeline-item.d.ts +6 -0
  38. package/dist/components/timeline/timeline-item.js +32 -0
  39. package/dist/components/timeline/timeline.css.d.ts +2 -0
  40. package/dist/components/timeline/timeline.css.js +53 -0
  41. package/dist/components/timeline/timeline.d.ts +6 -0
  42. package/dist/components/timeline/timeline.js +30 -0
  43. package/dist/cowboy-components.d.ts +14 -0
  44. package/dist/cowboy-components.js +18 -4240
  45. package/dist/cowboy-components.umd.cjs +1146 -1213
  46. package/dist/css/alerts.css.d.ts +2 -0
  47. package/dist/css/alerts.css.js +89 -0
  48. package/dist/css/prism.css.d.ts +2 -0
  49. package/dist/css/prism.css.js +114 -0
  50. package/dist/css/shared.css.d.ts +2 -0
  51. package/dist/css/shared.css.js +116 -0
  52. package/dist/model/constants.d.ts +23 -0
  53. package/dist/model/constants.js +23 -0
  54. package/dist/model/controls.d.ts +30 -0
  55. package/dist/model/controls.js +25 -0
  56. package/dist/model/errors.d.ts +7 -0
  57. package/dist/model/errors.js +1 -0
  58. package/dist/model/exchange_method.d.ts +1 -0
  59. package/dist/model/exchange_method.js +16 -0
  60. package/dist/model/extract_content_type.d.ts +34 -0
  61. package/dist/model/extract_content_type.js +78 -0
  62. package/dist/model/extract_query.d.ts +1 -0
  63. package/dist/model/extract_query.js +11 -0
  64. package/dist/model/http_transaction.d.ts +78 -0
  65. package/dist/model/http_transaction.js +109 -0
  66. package/dist/style.css +1 -1
  67. package/package.json +18 -7
  68. package/demo/index.ts +0 -1
  69. package/demo/kv-view.ts +0 -18
  70. package/dist/fonts/BerkeleyMono-Bold.woff +0 -0
  71. package/dist/fonts/BerkeleyMono-Bold.woff2 +0 -0
  72. package/dist/fonts/BerkeleyMono-BoldItalic.woff +0 -0
  73. package/dist/fonts/BerkeleyMono-BoldItalic.woff2 +0 -0
  74. package/dist/fonts/BerkeleyMono-Italic.woff +0 -0
  75. package/dist/fonts/BerkeleyMono-Italic.woff2 +0 -0
  76. package/dist/fonts/BerkeleyMono-Regular.woff +0 -0
  77. package/dist/fonts/BerkeleyMono-Regular.woff2 +0 -0
  78. package/dist/index.d.ts +0 -9
  79. package/dist/vite.svg +0 -1
  80. package/index.html +0 -66
  81. /package/dist/components/{prism.css.d.ts → attention-box/attention-box.css.d.ts} +0 -0
  82. /package/dist/components/{shared.css.d.ts → changelog/changelog.css.d.ts} +0 -0
@@ -0,0 +1,102 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ a, a:visited, a:active {
4
+ text-decoration: none;
5
+ color: var(--primary-color);
6
+ }
7
+
8
+ a:hover {
9
+ color: var(--primary-color);
10
+ text-decoration: underline;
11
+ }
12
+
13
+ header.pb33f-header {
14
+ display: flex;
15
+ height: 57px;
16
+ flex-direction: row;
17
+ z-index: 1;
18
+ background-color: var(--background-color);
19
+ }
20
+
21
+ header.pb33f-header > .logo {
22
+ width: 170px;
23
+ min-width: 145px;
24
+ padding: 9px 0 10px 10px;
25
+ border-bottom: 1px dashed var(--secondary-color);
26
+ height: 36px;
27
+ }
28
+
29
+ header.pb33f-header > .logo .caret {
30
+ font-size: 1.6em;
31
+ color: var(--secondary-color)
32
+ }
33
+
34
+ header.pb33f-header > .logo .name {
35
+ font-size: 1.7em;
36
+ font-family: var(--font-stack-bold),sans-serif;
37
+ color: var(--primary-color);
38
+ text-shadow: 0 0 10px var(--primary-color-text-shadow), 0 0 10px var(--primary-color-text-shadow);
39
+ }
40
+
41
+ header.pb33f-header > .logo .name > a {
42
+ text-decoration: none;
43
+ }
44
+
45
+ header.pb33f-header > .logo .name > a:hover {
46
+ text-decoration: underline;
47
+
48
+ }
49
+
50
+ header.pb33f-header > .logo .name > a:active {
51
+ text-decoration: underline;
52
+ color: var(--secondary-color);
53
+ text-shadow: 0 0 5px var(--secondary-color-text-shadow), 0 0 10px var(--secondary-color-text-shadow-outer);
54
+ }
55
+
56
+ header.pb33f-header > .logo .name::after {
57
+ content: "";
58
+ -webkit-animation: cursor .8s infinite;
59
+ animation: cursor .8s infinite;
60
+ background: var(--primary-color);
61
+ border-radius: 0;
62
+ display: inline-block;
63
+ height: 0.9em;
64
+ margin-left: 0.2em;
65
+ width: 3px;
66
+ bottom: -2px;
67
+ position: relative;
68
+ }
69
+
70
+ header .header-space {
71
+ height: 55px;
72
+ flex-grow: 2;
73
+ border-bottom: 1px dashed var(--secondary-color);
74
+ }
75
+
76
+ @-webkit-keyframes cursor {
77
+ 0% {
78
+ opacity: 0;
79
+ }
80
+
81
+ 50% {
82
+ opacity: 1;
83
+ }
84
+
85
+ to {
86
+ opacity: 0;
87
+ }
88
+ }
89
+
90
+ @keyframes cursor {
91
+ 0% {
92
+ opacity: 0;
93
+ }
94
+
95
+ 50% {
96
+ opacity: 1;
97
+ }
98
+
99
+ to {
100
+ opacity: 0;
101
+ }
102
+ }`;
@@ -3,5 +3,6 @@ export declare class HeaderComponent extends LitElement {
3
3
  static styles: import("lit").CSSResult;
4
4
  name: string;
5
5
  url: string;
6
+ constructor();
6
7
  render(): import("lit-html").TemplateResult<1>;
7
8
  }
@@ -0,0 +1,39 @@
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 headerCss from "./header.css";
10
+ let HeaderComponent = class HeaderComponent extends LitElement {
11
+ constructor() {
12
+ super();
13
+ this.name = 'pb33f';
14
+ this.url = 'https://pb33f.io';
15
+ }
16
+ render() {
17
+ return html `
18
+ <header class="pb33f-header">
19
+ <div class="logo">
20
+ <span class="caret">$</span>
21
+ <span class="name"><a href="${this.url}">${this.name}</a></span>
22
+ </div>
23
+ <div class="header-space">
24
+ <slot></slot>
25
+ </div>
26
+ </header>`;
27
+ }
28
+ };
29
+ HeaderComponent.styles = headerCss;
30
+ __decorate([
31
+ property()
32
+ ], HeaderComponent.prototype, "name", void 0);
33
+ __decorate([
34
+ property()
35
+ ], HeaderComponent.prototype, "url", void 0);
36
+ HeaderComponent = __decorate([
37
+ customElement('pb33f-header')
38
+ ], HeaderComponent);
39
+ export { HeaderComponent };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ sl-tag.method {
4
+ width: 80px;
5
+ text-align: center;
6
+ }
7
+
8
+ .method::part(base) {
9
+ background: var(--background-color);
10
+ border-radius: 0;
11
+ text-align: center;
12
+ font-family: var(--font-stack-bold), monospace;
13
+ width: 100%;
14
+ }
15
+
16
+ .method::part(content) {
17
+ border-radius: 0;
18
+ text-align: center;
19
+ width: 100%;
20
+ display: inline-block;
21
+ }
22
+ `;
@@ -0,0 +1,8 @@
1
+ import { LitElement } from "lit";
2
+ export declare class HttpMethodComponent extends LitElement {
3
+ static styles: import("lit").CSSResult;
4
+ method: string;
5
+ lower: boolean;
6
+ constructor();
7
+ render(): import("lit-html").TemplateResult<1>;
8
+ }
@@ -0,0 +1,34 @@
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 { ExchangeMethod } from "../../model/exchange_method";
10
+ import httpMethodCss from "./http-method.css";
11
+ let HttpMethodComponent = class HttpMethodComponent extends LitElement {
12
+ constructor() {
13
+ super();
14
+ this.lower = false;
15
+ this.method = 'GET';
16
+ }
17
+ render() {
18
+ return html `
19
+ <sl-tag variant="${ExchangeMethod(this.method)}" class="method">
20
+ ${this.lower ? this.method.toLowerCase() : this.method.toUpperCase()}</sl-tag>
21
+ `;
22
+ }
23
+ };
24
+ HttpMethodComponent.styles = httpMethodCss;
25
+ __decorate([
26
+ property()
27
+ ], HttpMethodComponent.prototype, "method", void 0);
28
+ __decorate([
29
+ property({ type: Boolean })
30
+ ], HttpMethodComponent.prototype, "lower", void 0);
31
+ HttpMethodComponent = __decorate([
32
+ customElement('pb33f-http-method')
33
+ ], HttpMethodComponent);
34
+ export { HttpMethodComponent };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,108 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ .prop-type-table > table > thead > tr > th {
4
+ font-family: var(--font-stack-bold), sans-serif;
5
+ background-color: var(--table-header-background-solid);
6
+ text-align: left;
7
+ padding: 10px;
8
+ color: var(--font-color);
9
+ border-bottom: 1px dashed var(--kv-table-dividers);
10
+ border-top: 1px dashed var(--kv-table-header-border-top);
11
+ font-weight: normal;
12
+ }
13
+
14
+ .prop-type-table > table > thead > tr > th:first-child {
15
+ font-family: var(--font-stack-bold), sans-serif;
16
+ background: var(--kv-table-header-background-reversed);
17
+ text-align: right;
18
+ color: var(--primary-color);
19
+ padding-right: 10px;
20
+ }
21
+
22
+
23
+ .prop-type-table > table > thead > tr > th:nth-child(2) {
24
+ text-align: center;
25
+ color: var(--font-color);
26
+ background-color: var(--kv-table-header-background-solid);
27
+ font-weight: normal;
28
+ }
29
+
30
+ .prop-type-table > table > thead > tr > th:last-child {
31
+ background: var(--kv-table-header-background);
32
+ }
33
+
34
+ .prop-type-table > table > tbody > tr > td {
35
+ font-family: var(--font-stack-paragraph), monospace;
36
+ color: var(--font-color-sub1);
37
+ padding: 10px 0 10px 10px;
38
+ border-bottom: 1px dashed var(--secondary-color-dimmer);
39
+ }
40
+
41
+ .prop-type-table > table > tbody > tr > td:first-child > code {
42
+ color: var(--primary-color);
43
+ font-family: var(--font-stack-bold), monospace;
44
+ }
45
+
46
+ .prop-type-table > table > tbody > tr > td:nth-child(3) > code {
47
+ font-family: var(--font-stack), sans-serif;
48
+ border: 1px solid var(--secondary-color-lowalpha);
49
+ color: var(--secondary-color);
50
+ border-radius: 0;
51
+ padding: 0 5px 1px 5px;
52
+ background-color: var(--secondary-color-very-lowalpha);
53
+ }
54
+
55
+ .prop-type-table > table > tbody > tr > td:first-child {
56
+ width: 120px;
57
+ text-align: right;
58
+ padding-right: 10px;
59
+ border-right: 1px dashed var(--secondary-color-dimmer);
60
+ }
61
+
62
+ .prop-type-table > table > tbody > tr > td:nth-child(2) {
63
+ width: 10px;
64
+ color: var(--font-color);
65
+ font-family: var(--font-stack-italic), monospace;
66
+ text-align: center;
67
+ padding-right: 10px;
68
+ border-right: 1px dashed var(--secondary-color-dimmer);
69
+ }
70
+
71
+ table {
72
+ width: 100%;
73
+ border-spacing: 0;
74
+ }
75
+
76
+ table > tbody > tr > td > a {
77
+ text-decoration: underline;
78
+ }
79
+
80
+ table > tbody > tr > td > code {
81
+ color: var(--secondary-color);
82
+ font-size: 1em;
83
+ }
84
+
85
+ .file-item {
86
+ display: block;
87
+ }
88
+
89
+ .file-name {
90
+ font-family: var(--font-stack-bold), monospace;
91
+ display: block;
92
+ }
93
+
94
+ .file-header {
95
+ color: var(--font-color-sub1);
96
+ display: inline-block;
97
+ }
98
+
99
+ .file-header > strong {
100
+ color: var(--font-color-sub2);
101
+
102
+ }
103
+
104
+ hr {
105
+ margin-bottom: 10px;
106
+ }
107
+
108
+ `;
@@ -0,0 +1,19 @@
1
+ import { LitElement, TemplateResult } from "lit";
2
+ import { FormPart } from "../../model/extract_content_type";
3
+ export interface Property {
4
+ name: string;
5
+ value?: string[];
6
+ headers?: Map<string, string[]>;
7
+ files?: FormPart[];
8
+ type: string;
9
+ }
10
+ export declare class HttpPropertyViewComponent extends LitElement {
11
+ static styles: import("lit").CSSResult[];
12
+ propertyLabel: string;
13
+ typeLabel: string;
14
+ valueLabel: string;
15
+ private _data;
16
+ constructor();
17
+ set data(value: Property[]);
18
+ render(): TemplateResult<1>;
19
+ }
@@ -0,0 +1,102 @@
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, state, property } from "lit/decorators.js";
8
+ import { map } from "lit/directives/map.js";
9
+ import { LitElement, html } from "lit";
10
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
11
+ import propertyViewComponentCss from "./http-property-view.css";
12
+ import sharedCss from "../../css/shared.css";
13
+ let HttpPropertyViewComponent = class HttpPropertyViewComponent extends LitElement {
14
+ constructor() {
15
+ super();
16
+ this.propertyLabel = 'Property';
17
+ this.typeLabel = 'Type';
18
+ this.valueLabel = 'Value';
19
+ this._data = [];
20
+ }
21
+ set data(value) {
22
+ this._data = value;
23
+ }
24
+ render() {
25
+ let headerData = html ``;
26
+ if (this._data) {
27
+ headerData = html `
28
+ ${map(this._data, (i) => {
29
+ if (i.type !== 'field') {
30
+ return html `
31
+ <tr>
32
+ <td><code>${i.name}</code></td>
33
+ <td><code>${i.type}</code></td>
34
+ <td>${i.files?.map((f) => {
35
+ return html `
36
+ <span class="file-name">${f.name}</span>
37
+ <hr/>
38
+ ${f.headers?.forEach((value, key) => {
39
+ return html `
40
+ <span class="file-header">${key}
41
+ : <strong>${value}</strong></span>`;
42
+ })}</td>
43
+ </tr>`;
44
+ })}
45
+ </td>`;
46
+ }
47
+ let output = '';
48
+ i.value?.forEach((value) => {
49
+ output += value;
50
+ });
51
+ return html `
52
+ <tr>
53
+ <td><code>${i.name}</code></td>
54
+ <td>${i.type}</td>
55
+ <td>${unsafeHTML(output)}</td>
56
+ </tr>`;
57
+ })}
58
+ `;
59
+ }
60
+ const noData = html `
61
+ <div class="empty-data">
62
+ <sl-icon name="mic-mute" class="mute-icon"></sl-icon>
63
+ <br/>
64
+ No data extracted!
65
+ </div>`;
66
+ const table = html `
67
+ <div class="prop-type-table">
68
+ <table>
69
+ <thead>
70
+ <tr>
71
+ <th>${this.propertyLabel}</th>
72
+ <th>${this.typeLabel}</th>
73
+ <th>${this.valueLabel}</th>
74
+ </tr>
75
+ </thead>
76
+ <tbody>
77
+ ${headerData}
78
+ </tbody>
79
+ </table>
80
+ </div>
81
+ `;
82
+ const output = this._data?.length > 0 ? table : noData;
83
+ return html `${output}`;
84
+ }
85
+ };
86
+ HttpPropertyViewComponent.styles = [sharedCss, propertyViewComponentCss];
87
+ __decorate([
88
+ property()
89
+ ], HttpPropertyViewComponent.prototype, "propertyLabel", void 0);
90
+ __decorate([
91
+ property()
92
+ ], HttpPropertyViewComponent.prototype, "typeLabel", void 0);
93
+ __decorate([
94
+ property()
95
+ ], HttpPropertyViewComponent.prototype, "valueLabel", void 0);
96
+ __decorate([
97
+ state()
98
+ ], HttpPropertyViewComponent.prototype, "_data", void 0);
99
+ HttpPropertyViewComponent = __decorate([
100
+ customElement('pb33f-http-http-property-view')
101
+ ], HttpPropertyViewComponent);
102
+ export { HttpPropertyViewComponent };
@@ -0,0 +1,81 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ .kv-table > table {
4
+ width: 100%;
5
+ border-spacing: 0;
6
+ }
7
+
8
+ .kv-table > table > thead > tr > th {
9
+ font-family: var(--font-stack), sans-serif;
10
+ background: var(--kv-table-header-background);
11
+ text-align: left;
12
+ padding: 10px;
13
+ color: var(--font-color);
14
+ font-weight: normal;
15
+ border-bottom: 1px dashed var(--kv-table-dividers);
16
+ border-top: 1px dashed var(--kv-table-header-border-top);
17
+ }
18
+
19
+ .kv-table > table > thead > tr > th:first-child {
20
+ font-family: var(--font-stack-bold), sans-serif;
21
+ background: var(--kv-table-header-background-reversed);
22
+ text-align: right;
23
+ color: var(--primary-color);
24
+ padding-right: 10px;
25
+ }
26
+
27
+ .kv-table > table > thead > tr > th:nth-child(2) {
28
+ font-family: var(--font-stack-bold), sans-serif;
29
+ }
30
+
31
+ .kv-table > table > tbody > tr > td {
32
+ font-family: var(--font-stack), sans-serif;
33
+ padding: 10px 0 10px 10px;
34
+ border-bottom: 1px dashed var(--kv-table-dividers);
35
+ }
36
+
37
+ .kv-table > table > tbody > tr > td:first-child > code {
38
+ color: var(--primary-color);
39
+ font-family: var(--font-stack-bold), sans-serif;
40
+ }
41
+
42
+ .kv-table > table > tbody > tr > td:nth-child(2) {
43
+ color: var(--font-color-sub1)
44
+ }
45
+
46
+ .kv-table > table > tbody > tr > td:nth-child(2) > code {
47
+ font-family: var(--font-stack), sans-serif;
48
+ border: 1px solid var(--secondary-color-lowalpha);
49
+ color: var(--secondary-color);
50
+ border-radius: 0;
51
+ padding: 0 5px 1px 5px;
52
+ background-color: var(--secondary-color-very-lowalpha);
53
+ }
54
+
55
+ .kv-table > table > tbody > tr > td:first-child {
56
+ width: 180px;
57
+ text-align: right;
58
+ padding-right: 10px;
59
+ border-right: 1px dashed var(--kv-table-dividers);
60
+ }
61
+
62
+ .kv-table >table > tbody > tr > td > code {
63
+ color: var(--secondary-color);
64
+ font-weight: normal;
65
+ }
66
+
67
+
68
+ pre {
69
+ word-wrap: break-word;
70
+ white-space: pre-wrap;
71
+ max-width: 760px;
72
+ overflow-x: auto;
73
+ }
74
+
75
+ pre > code {
76
+ word-wrap: break-word;
77
+ white-space: pre-wrap;
78
+ }
79
+
80
+
81
+ `;
@@ -0,0 +1,98 @@
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, state, property } from "lit/decorators.js";
8
+ import { map } from "lit/directives/map.js";
9
+ import { LitElement } from "lit";
10
+ import { html } from "lit";
11
+ import kvViewComponentCss from "./kv-view.css";
12
+ import Prism from 'prismjs';
13
+ import 'prismjs/components/prism-json';
14
+ import 'prismjs/themes/prism-okaidia.css';
15
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
16
+ import prismCss from "../../css/prism.css";
17
+ import sharedCss from "../../css/shared.css";
18
+ let KVViewComponent = class KVViewComponent extends LitElement {
19
+ constructor() {
20
+ super();
21
+ this._data = new Map();
22
+ this.keyLabel = 'Key';
23
+ this.valueLabel = 'Value';
24
+ }
25
+ set data(value) {
26
+ if (value && value.size > 0) {
27
+ this._data = value;
28
+ }
29
+ }
30
+ render() {
31
+ let headerData = html ``;
32
+ if (this._data) {
33
+ headerData = html `
34
+ ${map(this._data, (i) => {
35
+ if (typeof i[1] === 'object') {
36
+ return html `
37
+ <tr>
38
+ <td><code>${i[0]}</code></td>
39
+ <td>
40
+ <pre style=""><code
41
+ style="white-space: pre-wrap; word-wrap: break-word;">${unsafeHTML(Prism.highlight(JSON.stringify(i[1], null, 2), Prism.languages['json'], 'json'))}</pre>
42
+ </code>
43
+ </td>
44
+ </tr>`;
45
+ }
46
+ return html `
47
+ <tr>
48
+ <td><code>${i[0]}</code></td>
49
+ <td>${unsafeHTML(i[1])}</td>
50
+ </tr>`;
51
+ })}
52
+ `;
53
+ }
54
+ const noData = html `
55
+ <div class="empty-data">
56
+ <sl-icon name="mic-mute" class="mute-icon"></sl-icon>
57
+ <br/>
58
+ No data extracted!
59
+ </div>`;
60
+ let header = html `
61
+ <thead>
62
+ <tr>
63
+ <th>${this.keyLabel}</th>
64
+ <th>${this.valueLabel}</th>
65
+ </tr>
66
+ </thead>`;
67
+ if (this.keyLabel == '' && this.valueLabel == '') {
68
+ header = html ``;
69
+ }
70
+ const table = html `
71
+
72
+ <div class="kv-table">
73
+ <table>
74
+ ${header}
75
+ <tbody>
76
+ ${headerData}
77
+ </tbody>
78
+ </table>
79
+ </div>
80
+ `;
81
+ const output = this._data?.size > 0 ? table : noData;
82
+ return html `${output}`;
83
+ }
84
+ };
85
+ KVViewComponent.styles = [prismCss, sharedCss, kvViewComponentCss];
86
+ __decorate([
87
+ property()
88
+ ], KVViewComponent.prototype, "keyLabel", void 0);
89
+ __decorate([
90
+ property()
91
+ ], KVViewComponent.prototype, "valueLabel", void 0);
92
+ __decorate([
93
+ state()
94
+ ], KVViewComponent.prototype, "_data", void 0);
95
+ KVViewComponent = __decorate([
96
+ customElement('pb33f-kv-view')
97
+ ], KVViewComponent);
98
+ export { KVViewComponent };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;