@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
@@ -9,25 +9,40 @@ import '@shoelace-style/shoelace/dist/components/tree-item/tree-item.js';
9
9
  import { customElement, property, state } from "lit/decorators.js";
10
10
  import { html, LitElement } from "lit";
11
11
  import treeCss from "./tree.css.js";
12
- import { ModelTreeNodeClicked } from "../../events/doctor.js";
12
+ import { ModelTreeNodeClicked, RolodexTreeNodeClicked } from "../../events/doctor.js";
13
13
  import { IconColor, IconSize } from "../model-icon/model-icon.js";
14
14
  import { ExtractStatusStyleFromCodeByCode } from "../../model/extract_status.js";
15
15
  import modelSharedCss from "../model-renderer/model-shared.css.js";
16
16
  import tooltipCss from "../../css/tooltip.css.js";
17
+ import { NodeType } from "../../model/node_type";
17
18
  let ModelTree = class ModelTree extends LitElement {
18
19
  constructor(nodeMap, nodeIdMap, nodeIdHashMap) {
19
20
  super();
21
+ this.selectedNodes = [];
20
22
  this.nodeMap = nodeMap;
21
23
  this.nodeIdMap = nodeIdMap;
22
24
  this.nodeIdHashMap = nodeIdHashMap;
25
+ this.isRolodex = false;
23
26
  this.filteredNodes = new Map();
27
+ this.pendingNavigationHash = "";
28
+ this.pendingNavigationPath = "";
24
29
  }
25
30
  nodeClicked(nodeHashId) {
26
31
  this.dispatchEvent(new CustomEvent(ModelTreeNodeClicked, {
27
32
  bubbles: true,
28
33
  composed: true,
29
34
  detail: {
30
- nodeHashId: nodeHashId
35
+ nodeHashId: nodeHashId,
36
+ }
37
+ }));
38
+ }
39
+ rolodexClicked(nodeHashId, path = '') {
40
+ this.dispatchEvent(new CustomEvent(RolodexTreeNodeClicked, {
41
+ bubbles: true,
42
+ composed: true,
43
+ detail: {
44
+ nodeHashId: nodeHashId,
45
+ path: path
31
46
  }
32
47
  }));
33
48
  }
@@ -38,18 +53,76 @@ let ModelTree = class ModelTree extends LitElement {
38
53
  this.openNode(parent.parentId);
39
54
  }
40
55
  this.renderRoot.querySelectorAll(`sl-tree-item#model-${parent?.idHash}`)[0]?.setAttribute('expanded', 'true');
56
+ this.requestUpdate();
57
+ return;
58
+ }
59
+ else {
60
+ const model = this.renderRoot.querySelectorAll(`sl-tree-item#model-${parentId}`)[0];
61
+ if (model) {
62
+ model.setAttribute('expanded', 'true');
63
+ // check if the model has a parent
64
+ const nodeParent = model.getAttribute('data-parentid');
65
+ if (nodeParent) {
66
+ this.openNode(nodeParent);
67
+ }
68
+ this.requestUpdate();
69
+ return;
70
+ }
71
+ }
72
+ }
73
+ updated() {
74
+ if (this.pendingNavigationHash != "") {
75
+ this.explorerClicked(this.pendingNavigationHash);
76
+ }
77
+ if (this.pendingNavigationPath && this.pendingNavigationPath != "") {
78
+ const pnp = this.pendingNavigationPath;
79
+ this.openNodeByPath(pnp);
80
+ }
81
+ }
82
+ openNodeByPath(path) {
83
+ const treeItems = this.renderRoot?.querySelectorAll(`sl-tree-item`);
84
+ if (treeItems) {
85
+ let selected = null;
86
+ for (let i = 0; i < treeItems?.length; i++) {
87
+ const item = treeItems[i];
88
+ const itemPath = item.getAttribute('data-path');
89
+ item.selected = itemPath === path;
90
+ if (item.selected) {
91
+ selected = item;
92
+ item.expanded = true;
93
+ const parentId = item.getAttribute('data-parentid');
94
+ if (parentId) {
95
+ this.pendingNavigationPath = "";
96
+ this.openNode(parentId);
97
+ }
98
+ }
99
+ }
100
+ if (selected) {
101
+ requestAnimationFrame(() => {
102
+ selected?.scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
103
+ });
104
+ }
41
105
  }
42
106
  }
43
107
  explorerClicked(nodeHashId) {
44
- const treeItems = this.renderRoot.querySelectorAll(`sl-tree-item`);
108
+ const treeItems = this.renderRoot?.querySelectorAll(`sl-tree-item`);
109
+ if (!treeItems) {
110
+ this.pendingNavigationHash = nodeHashId;
111
+ }
112
+ else {
113
+ if (this.pendingNavigationHash != "") {
114
+ nodeHashId = this.pendingNavigationHash;
115
+ this.pendingNavigationHash = "";
116
+ }
117
+ }
45
118
  let selected = null;
46
- for (let i = 0; i < treeItems.length; i++) {
119
+ for (let i = 0; i < treeItems?.length; i++) {
47
120
  const item = treeItems[i];
48
121
  item.selected = item.id === `model-${nodeHashId}`;
49
122
  if (item.selected) {
50
123
  selected = item;
51
124
  item.expanded = true;
52
- const parentId = item.getAttribute('data-parentId');
125
+ const parentId = item.getAttribute('data-parentid');
53
126
  if (parentId) {
54
127
  this.openNode(parentId);
55
128
  }
@@ -74,13 +147,17 @@ let ModelTree = class ModelTree extends LitElement {
74
147
  return html `<span style="color: var(--font-color-sub1)">${node.label}</span>`;
75
148
  }
76
149
  switch (node.type) {
77
- case 'response':
150
+ case NodeType.ROLODEX_FILE:
151
+ return html `<span style="color: var(--font-color)"><strong>${node.label}</strong></span>`;
152
+ case NodeType.RESPONSE:
78
153
  const label = parseInt(node.label);
79
154
  return html `<span class="${ExtractStatusStyleFromCodeByCode(label)}">${node.label}</span>`;
80
- case 'operation':
81
- return html `<pb33f-http-method tiny method="${node.label}"></pb33f-http-method>`;
82
- case 'pathItem':
83
- return html `<pb33f-render-operation-path nowrap path="${node.label}"></pb33f-render-operation-path>`;
155
+ case NodeType.OPERATION:
156
+ return html `
157
+ <pb33f-http-method tiny method="${node.label}"></pb33f-http-method>`;
158
+ case NodeType.PATH_ITEM:
159
+ return html `
160
+ <pb33f-render-operation-path nowrap path="${node.label}"></pb33f-render-operation-path>`;
84
161
  default:
85
162
  if (node.instance) {
86
163
  return html `<strong>${node.label}</strong>`;
@@ -91,7 +168,16 @@ let ModelTree = class ModelTree extends LitElement {
91
168
  buildTree(node, depth) {
92
169
  let results = [];
93
170
  if (node.nodes && node.nodes.length > 0) {
94
- node.nodes.sort((a, b) => a.label.localeCompare(b.label));
171
+ // check if this is a path item, if so make sure the parameters are first.
172
+ if (node.type === NodeType.PATH_ITEM) {
173
+ const operations = node.nodes.filter(n => n.type === NodeType.OPERATION);
174
+ const parameters = node.nodes.filter(n => (n.type === NodeType.PARAMETER || n.type === NodeType.PARAMETERS));
175
+ const other = node.nodes.filter(n => n.type !== NodeType.OPERATION && (n.type !== NodeType.PARAMETER && n.type !== NodeType.PARAMETERS));
176
+ node.nodes = parameters.concat(operations).concat(other);
177
+ }
178
+ else {
179
+ node.nodes.sort((a, b) => a.label.localeCompare(b.label));
180
+ }
95
181
  for (let i = 0; i < node.nodes.length; i++) {
96
182
  depth++;
97
183
  results.push(this.buildTree(node.nodes[i], depth));
@@ -103,7 +189,7 @@ let ModelTree = class ModelTree extends LitElement {
103
189
  }
104
190
  let styleIco = IconColor.primary;
105
191
  const filtered = (this.filteredNodes.size > 0 && !this.filteredNodes.get(node.idHash));
106
- if (node.type === 'response') {
192
+ if (node.type === NodeType.RESPONSE) {
107
193
  const label = parseInt(node.label);
108
194
  const style = ExtractStatusStyleFromCodeByCode(label);
109
195
  switch (style) {
@@ -118,6 +204,9 @@ let ModelTree = class ModelTree extends LitElement {
118
204
  break;
119
205
  }
120
206
  }
207
+ if (node.type === NodeType.ROLODEX_FILE) {
208
+ styleIco = IconColor.secondary;
209
+ }
121
210
  if (filtered) {
122
211
  styleIco = IconColor.filtered;
123
212
  }
@@ -138,14 +227,106 @@ let ModelTree = class ModelTree extends LitElement {
138
227
  }
139
228
  }
140
229
  if (warnings > 0) {
141
- warnBadge = html `<sl-badge class="warn">${warnings}</sl-badge>`;
230
+ warnBadge = html `
231
+ <sl-badge class="warn">${warnings}</sl-badge>`;
142
232
  }
143
233
  if (errors > 0) {
144
- errorBadge = html `<sl-badge class="err">${errors}</sl-badge>`;
234
+ errorBadge = html `
235
+ <sl-badge class="err">${errors}</sl-badge>`;
236
+ }
237
+ }
238
+ }
239
+ let icon = html `
240
+ <pb33f-model-icon size="${IconSize.small}" icon="${node.type}" color=${styleIco}></pb33f-model-icon>`;
241
+ if (node.openapi) {
242
+ icon = html `
243
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.OPENAPI}"
244
+ color=${styleIco}></pb33f-model-icon>`;
245
+ }
246
+ else {
247
+ // determine if this is something other than a JSON or YAML file by looking at the extension.
248
+ if (!node.label.endsWith('.json') || !node.label.endsWith('.yaml') || !node.label.endsWith('.yml')) {
249
+ if (node.label.includes('.')) {
250
+ const ext = node.label.split('.').pop();
251
+ if (ext) {
252
+ switch (ext) {
253
+ case NodeType.JS:
254
+ icon = html `
255
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.JS}"
256
+ color=${styleIco}></pb33f-model-icon>`;
257
+ break;
258
+ case NodeType.GO:
259
+ icon = html `
260
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.GO}"
261
+ color=${styleIco}></pb33f-model-icon>`;
262
+ break;
263
+ case NodeType.TS:
264
+ icon = html `
265
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.TS}"
266
+ color=${styleIco}></pb33f-model-icon>`;
267
+ break;
268
+ case NodeType.CS:
269
+ icon = html `
270
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.CS}"
271
+ color=${styleIco}></pb33f-model-icon>`;
272
+ break;
273
+ case NodeType.C:
274
+ icon = html `
275
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.C}"
276
+ color=${styleIco}></pb33f-model-icon>`;
277
+ break;
278
+ case NodeType.CPP:
279
+ icon = html `
280
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.CPP}"
281
+ color=${styleIco}></pb33f-model-icon>`;
282
+ break;
283
+ case NodeType.PHP:
284
+ icon = html `
285
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.PHP}"
286
+ color=${styleIco}></pb33f-model-icon>`;
287
+ break;
288
+ case NodeType.PY:
289
+ icon = html `
290
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.PY}"
291
+ color=${styleIco}></pb33f-model-icon>`;
292
+ break;
293
+ case NodeType.HTML:
294
+ icon = html `
295
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.HTML}"
296
+ color=${styleIco}></pb33f-model-icon>`;
297
+ break;
298
+ case NodeType.MD:
299
+ icon = html `
300
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.MD}"
301
+ color=${styleIco}></pb33f-model-icon>`;
302
+ break;
303
+ case NodeType.JAVA:
304
+ icon = html `
305
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.JAVA}"
306
+ color=${styleIco}></pb33f-model-icon>`;
307
+ break;
308
+ case NodeType.RS:
309
+ icon = html `
310
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.RS}"
311
+ color=${styleIco}></pb33f-model-icon>`;
312
+ break;
313
+ case NodeType.ZIG:
314
+ icon = html `
315
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.ZIG}"
316
+ color=${styleIco}></pb33f-model-icon>`;
317
+ break;
318
+ case NodeType.RB:
319
+ icon = html `
320
+ <pb33f-model-icon size="${IconSize.small}" icon="${NodeType.RB}"
321
+ color=${styleIco}></pb33f-model-icon>`;
322
+ break;
323
+ }
324
+ }
145
325
  }
146
326
  }
147
327
  }
148
328
  return html `
329
+
149
330
  <sl-tree-item id="model-${node.idHash}" ?expanded="${expanded}"
150
331
  @sl-expand="${(evt) => {
151
332
  this.expanded(evt, node);
@@ -153,12 +334,14 @@ let ModelTree = class ModelTree extends LitElement {
153
334
  @sl-collapse="${(evt) => {
154
335
  this.collapse(evt, node);
155
336
  }}"
156
- data-parentId="${node.parentId}"
157
- data-hashId="${node.idHash}">
337
+ data-parentid="${node.parentId}"
338
+ data-hashid="${node.idHash}"
339
+ data-path="${node.path ? node.path : node.nodePath}">
158
340
  <div style="display: flex">
159
- <pb33f-model-icon size="${IconSize.small}" icon="${node.type}" color=${styleIco}></pb33f-model-icon>
341
+ ${icon}
160
342
  <div style="padding-left:8px; flex-grow: 4; white-space: nowrap">
161
- ${filtered ? html `<span style="color: var(--font-color-sub1)">${this.renderLabel(node, filtered)}
343
+ ${filtered ? html `<span
344
+ style="color: var(--font-color-sub1)">${this.renderLabel(node, filtered)}
162
345
  <sl-tooltip content="filtered item">
163
346
  <sl-icon name="eye-slash" style="vertical-align: middle; font-size: 0.8rem"></sl-icon>
164
347
  </sl-tooltip>
@@ -171,10 +354,30 @@ let ModelTree = class ModelTree extends LitElement {
171
354
  `;
172
355
  }
173
356
  nodesSelected(treeItems) {
357
+ this.selectedNodes = treeItems;
174
358
  for (let i = 0; i < treeItems.length; i++) {
175
359
  const hash = treeItems[i].getAttribute('data-hashId');
176
- if (hash)
177
- this.nodeClicked(hash);
360
+ const path = treeItems[i].getAttribute('data-path');
361
+ if (hash) {
362
+ if (!this.isRolodex) {
363
+ this.nodeClicked(hash);
364
+ }
365
+ else {
366
+ if (path && path != '') {
367
+ this.rolodexClicked(hash, path);
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ treeClicked(event) {
374
+ // which tree item was actually clicked?
375
+ const clickedItem = event.target?.closest('sl-tree-item');
376
+ if (!clickedItem)
377
+ return;
378
+ // if the clicked item is already in selectedNodes, re-fire
379
+ if (this.selectedNodes.some(item => item === clickedItem)) {
380
+ this.nodesSelected(this.selectedNodes);
178
381
  }
179
382
  }
180
383
  render() {
@@ -184,13 +387,15 @@ let ModelTree = class ModelTree extends LitElement {
184
387
  const tree = this.buildTree(this.node, 0);
185
388
  let nodeLimitExceeded = html ``;
186
389
  if (this.nodeLimitExceeded) {
187
- nodeLimitExceeded = html `<div class="node-limit-exceeded">
188
- <sl-icon name="exclamation-triangle" style="vertical-align: middle"></sl-icon> Objects exceed limit of ${this.nodeLimit}.
189
- </div>`;
390
+ nodeLimitExceeded = html `
391
+ <div class="node-limit-exceeded">
392
+ <sl-icon name="exclamation-triangle" style="vertical-align: middle"></sl-icon>
393
+ Objects exceed limit of ${this.nodeLimit}.
394
+ </div>`;
190
395
  }
191
396
  return html `
192
397
  ${nodeLimitExceeded}
193
- <sl-tree @sl-selection-change="${(evt) => {
398
+ <sl-tree @click=${this.treeClicked} @sl-selection-change="${(evt) => {
194
399
  {
195
400
  const selected = evt.detail.selection;
196
401
  this.nodesSelected(selected);
@@ -217,6 +422,9 @@ __decorate([
217
422
  __decorate([
218
423
  property()
219
424
  ], ModelTree.prototype, "filteredNodes", void 0);
425
+ __decorate([
426
+ property()
427
+ ], ModelTree.prototype, "isRolodex", void 0);
220
428
  ModelTree = __decorate([
221
429
  customElement("pb33f-model-tree")
222
430
  ], ModelTree);
@@ -21,15 +21,19 @@ export default css `
21
21
  }
22
22
 
23
23
  .no-values {
24
+ min-height: 550px;
24
25
  width: 500px;
25
26
  margin: 0 auto;
26
27
  padding-top: 50px;
27
28
  text-align: center;
28
29
  font-size: 1.9em;
29
- color: var(--font-color-sub3);
30
+ color: var(--font-color-sub4);
30
31
  font-family: var(--font-stack-bold), monospace;
31
32
  overflow-y: hidden;
32
-
33
+ }
34
+
35
+ .error {
36
+ color: var(--error-color);
33
37
  }
34
38
 
35
39
  .no-values sl-icon {
@@ -8,6 +8,7 @@ export declare class Paginator extends LitElement {
8
8
  itemsPerPage: number;
9
9
  label: string;
10
10
  activeIndex: number;
11
+ invalid: boolean;
11
12
  private renderValues;
12
13
  private sparks;
13
14
  private paginatorNavigator;
@@ -19,6 +19,7 @@ let Paginator = class Paginator extends LitElement {
19
19
  this.totalItems = 0;
20
20
  this.itemsPerPage = 20;
21
21
  this.activeIndex = 0;
22
+ this.invalid = false;
22
23
  this.paginatorNavigator = new PaginatorNavigation();
23
24
  this.paginatorNavigator.currentPage = this.currentPage;
24
25
  this.paginatorNavigator.totalPages = this.totalPages;
@@ -82,13 +83,13 @@ let Paginator = class Paginator extends LitElement {
82
83
  this.renderValues = this.values?.slice(this.paginatorNavigator.getRangeStart(), this.paginatorNavigator.getRangeEnd());
83
84
  }
84
85
  render() {
85
- let sparks = new PixelSparks();
86
+ this.sparks.isError = this.invalid;
86
87
  if (this.renderValues?.length === 0 || !this.renderValues) {
87
88
  return html `
88
- <div class="no-values" style="position: relative">
89
+ <div class="no-values ${this.invalid ? 'error' : ''}" style="position: relative">
89
90
  <div style="position: absolute; width: 100%; top: -50px; left: 0;">${this.sparks}</div>
90
- <sl-icon name="x-square"></sl-icon><br/>
91
- no results
91
+ <sl-icon name="prescription2"></sl-icon><br/>
92
+ ${this.invalid ? 'invalid / error' : 'healthy!'}
92
93
  </div>
93
94
  `;
94
95
  }
@@ -122,6 +123,9 @@ __decorate([
122
123
  __decorate([
123
124
  property()
124
125
  ], Paginator.prototype, "activeIndex", void 0);
126
+ __decorate([
127
+ property({ type: Boolean })
128
+ ], Paginator.prototype, "invalid", void 0);
125
129
  Paginator = __decorate([
126
130
  customElement("pb33f-paginator-navigation")
127
131
  ], Paginator);
@@ -7,7 +7,7 @@ export default css `
7
7
 
8
8
  sl-drawer::part(panel) {
9
9
  border: 1px dashed var(--secondary-color);
10
- z-index: 3
10
+ z-index: 10
11
11
  }
12
12
 
13
13
  sl-drawer::part(header) {
@@ -30,13 +30,16 @@ let ProblemItem = class ProblemItem extends LitElement {
30
30
  class="${this.selectedSibling ? 'selectedPath' : ''}"></pb33f-render-json-path>`;
31
31
  break;
32
32
  case ProblemLabelView.RuleViolation:
33
- render = html `${this.problemObject.source}</>`;
33
+ render = html `${this.problemObject.source}`;
34
34
  break;
35
35
  case ProblemLabelView.Message:
36
- render = html `${unsafeHTML(marked.parse(this.problemObject.message).toString())}</>`;
36
+ render = html `${unsafeHTML(marked.parse(this.problemObject.message).toString())}`;
37
37
  break;
38
38
  case ProblemLabelView.Category:
39
- render = html `${this.problemObject.category}</>`;
39
+ render = html `${this.problemObject.category}`;
40
+ break;
41
+ case ProblemLabelView.Source:
42
+ render = html `${this.problemObject.sourceLocation}`;
40
43
  break;
41
44
  }
42
45
  return render;
@@ -6,7 +6,8 @@ export declare enum ProblemLabelView {
6
6
  JSONPath = "Path",
7
7
  RuleViolation = "Rule Violation",
8
8
  Message = "Message",
9
- Category = "Category"
9
+ Category = "Category",
10
+ Source = "Source Location"
10
11
  }
11
12
  export declare class ProblemLabelViewFilter extends LitElement {
12
13
  static styles: import("lit").CSSResult[];
@@ -18,6 +18,7 @@ export var ProblemLabelView;
18
18
  ProblemLabelView["RuleViolation"] = "Rule Violation";
19
19
  ProblemLabelView["Message"] = "Message";
20
20
  ProblemLabelView["Category"] = "Category";
21
+ ProblemLabelView["Source"] = "Source Location";
21
22
  })(ProblemLabelView || (ProblemLabelView = {}));
22
23
  let ProblemLabelViewFilter = class ProblemLabelViewFilter extends LitElement {
23
24
  constructor() {
@@ -13,6 +13,7 @@ export declare class ProblemList extends LitElement {
13
13
  private readonly paginator;
14
14
  private unfilteredProblems;
15
15
  private activeSearch;
16
+ isInvalid: boolean;
16
17
  constructor();
17
18
  private reset;
18
19
  private addSearchWorkerListener;
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement } from "lit/decorators.js";
7
+ import { customElement, property } from "lit/decorators.js";
8
8
  import { html, LitElement } from "lit";
9
9
  import { ProblemItem } from "./problem-item.js";
10
10
  import { ProblemMainView } from "./problem-mainview.js";
@@ -29,6 +29,7 @@ let ProblemList = class ProblemList extends LitElement {
29
29
  this.unfilteredProblems = [];
30
30
  this.searchWorker = new SearchWorker();
31
31
  this.activeSearch = false;
32
+ this.isInvalid = false;
32
33
  this.addSearchWorkerListener();
33
34
  // @ts-ignore
34
35
  this.addEventListener(ProblemClicked, this.problemClicked);
@@ -139,6 +140,10 @@ let ProblemList = class ProblemList extends LitElement {
139
140
  this.problemList[i].problemLabelView = ProblemLabelView.Category;
140
141
  this.problemLabelView = ProblemLabelView.Category;
141
142
  break;
143
+ case ProblemLabelView.Source:
144
+ this.problemList[i].problemLabelView = ProblemLabelView.Source;
145
+ this.problemLabelView = ProblemLabelView.Source;
146
+ break;
142
147
  }
143
148
  }
144
149
  }
@@ -189,6 +194,15 @@ let ProblemList = class ProblemList extends LitElement {
189
194
  return 0;
190
195
  });
191
196
  break;
197
+ case ProblemSortView.SourceLocation:
198
+ this.problemList = this.problemList.sort((a, b) => {
199
+ if (a.problemObject.sourceLocation < b.problemObject.sourceLocation)
200
+ return 1;
201
+ if (a.problemObject.sourceLocation > b.problemObject.sourceLocation)
202
+ return -1;
203
+ return 0;
204
+ });
205
+ break;
192
206
  }
193
207
  this.problemList = this.problemList.slice(0, this.problemList.length);
194
208
  this.requestUpdate();
@@ -311,6 +325,7 @@ let ProblemList = class ProblemList extends LitElement {
311
325
  }
312
326
  render() {
313
327
  this.paginator.values = this.problemList;
328
+ this.paginator.invalid = this.isInvalid;
314
329
  return html `
315
330
  <div class="problem-list-container">
316
331
  <div class="main-view">
@@ -327,6 +342,9 @@ let ProblemList = class ProblemList extends LitElement {
327
342
  }
328
343
  };
329
344
  ProblemList.styles = [problemListCss, sharedCss];
345
+ __decorate([
346
+ property({ type: Boolean })
347
+ ], ProblemList.prototype, "isInvalid", void 0);
330
348
  ProblemList = __decorate([
331
349
  customElement("pb33f-problem-list")
332
350
  ], ProblemList);
@@ -69,7 +69,7 @@ export default css `
69
69
  }
70
70
 
71
71
 
72
- .location {
72
+ .location, .source-location {
73
73
  font-size: 0.7rem;
74
74
  margin-top: 15px;
75
75
  display: block;
@@ -96,6 +96,11 @@ let ProblemMainView = class ProblemMainView extends LitElement {
96
96
  <div class="main-view empty">Pick a problem...<br/><sl-icon name="pin-angle"></sl-icon><br/></div>`;
97
97
  }
98
98
  renderProblem(problem) {
99
+ let sourceLocation = html ``;
100
+ if (problem.sourceLocation && problem.sourceLocation.length > 0 &&
101
+ (problem.sourceLocation != 'root.yaml' && problem.sourceLocation != 'root')) {
102
+ sourceLocation = html `<div class="source-location">Problem file:<br/> <strong>${problem.sourceLocation}</strong></div>`;
103
+ }
99
104
  return html `
100
105
  <div class="problem">
101
106
  <div class="icon ${getProblemClass(problem)}">
@@ -106,6 +111,7 @@ let ProblemMainView = class ProblemMainView extends LitElement {
106
111
  <div class="location">
107
112
  Location: <pb33f-render-json-path path="${problem.jsonPath}"></pb33f-render-json-path>
108
113
  </div>
114
+ ${sourceLocation}
109
115
  </div>
110
116
  </div>
111
117
  <div class="source">
@@ -7,7 +7,8 @@ export declare enum ProblemSortView {
7
7
  Rule = "Rule Violation",
8
8
  JSONPath = "Path",
9
9
  Category = "Category",
10
- Severity = "Severity"
10
+ Severity = "Severity",
11
+ SourceLocation = "Source Location"
11
12
  }
12
13
  export declare class ProblemSortFilter extends LitElement {
13
14
  static styles: import("lit").CSSResult[];
@@ -19,6 +19,7 @@ export var ProblemSortView;
19
19
  ProblemSortView["JSONPath"] = "Path";
20
20
  ProblemSortView["Category"] = "Category";
21
21
  ProblemSortView["Severity"] = "Severity";
22
+ ProblemSortView["SourceLocation"] = "Source Location";
22
23
  })(ProblemSortView || (ProblemSortView = {}));
23
24
  let ProblemSortFilter = class ProblemSortFilter extends LitElement {
24
25
  constructor() {
@@ -24,20 +24,30 @@ export default css `
24
24
  .score {
25
25
  width: 100px;
26
26
  height: 100px;
27
- line-height: 100px;
27
+ //line-height: 100px;
28
28
  border: 1px solid var(--primary-color);
29
29
  text-align: center;
30
30
  margin-top: 10px;
31
31
  margin-bottom: 10px;
32
32
  }
33
- .score span {
33
+
34
+ .score .score-percent {
35
+ display: inline-block;
36
+ vertical-align: middle;
37
+ line-height: normal;
38
+ font-size: 1rem;
39
+ color: var(--primary-color);
40
+ padding-top: 8px;
41
+ font-family: var(--font-stack-bold), monospace;
42
+ }
43
+
44
+ .score .score-grade {
34
45
  display: inline-block;
35
46
  vertical-align: middle;
36
47
  line-height: normal;
37
- font-size: 2rem;
48
+ font-size: 3.2rem;
38
49
  color: var(--primary-color);
39
50
  font-family: var(--font-stack-bold), monospace;
40
-
41
51
  }
42
52
 
43
53
  .evaluation {