@pb33f/cowboy-components 0.3.5 → 0.5.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.
- package/README.md +1 -1
- package/dist/assets/css.worker-CTSQecos.js +84 -0
- package/dist/assets/editor.worker-CYC0jP-p.js +12 -0
- package/dist/assets/equalizer.worker-CdIiiqfH.js +1 -0
- package/dist/assets/html.worker-C1BIaUKh.js +461 -0
- package/dist/assets/json.worker-BCyBlh8h.js +49 -0
- package/dist/assets/rule-documentation.worker-B7xOWY5M.js +1 -0
- package/dist/components/credit-ticker/credit-ticker.css.d.ts +2 -0
- package/dist/components/credit-ticker/credit-ticker.css.js +36 -0
- package/dist/components/credit-ticker/credit-ticker.d.ts +14 -0
- package/dist/components/credit-ticker/credit-ticker.js +88 -0
- package/dist/components/editor/editor-breadcrumb.css.d.ts +2 -0
- package/dist/components/editor/editor-breadcrumb.css.js +49 -0
- package/dist/components/editor/editor-breadcrumb.d.ts +9 -0
- package/dist/components/editor/editor-breadcrumb.js +60 -0
- package/dist/components/editor/editor.css.d.ts +2 -0
- package/dist/components/editor/editor.css.js +62 -0
- package/dist/components/editor/editor.d.ts +25 -4
- package/dist/components/editor/editor.js +412 -76
- package/dist/components/manage-ruleset/manage-ruleset.css.js +5 -0
- package/dist/components/manage-ruleset/manage-ruleset.js +8 -6
- package/dist/components/model-icon/model-icon.d.ts +7 -0
- package/dist/components/model-icon/model-icon.js +56 -7
- package/dist/components/model-renderer/clickable-ref.d.ts +2 -2
- package/dist/components/model-renderer/clickable-ref.js +5 -4
- package/dist/components/model-renderer/header.js +10 -10
- package/dist/components/model-renderer/operation.js +2 -2
- package/dist/components/model-renderer/rendered-node.css.js +1 -1
- package/dist/components/model-renderer/schema.js +1 -1
- package/dist/components/model-tree/tree.css.js +1 -0
- package/dist/components/model-tree/tree.d.ts +8 -0
- package/dist/components/model-tree/tree.js +232 -24
- package/dist/components/paginator/paginator.css.js +6 -2
- package/dist/components/paginator/paginator.d.ts +1 -0
- package/dist/components/paginator/paginator.js +8 -4
- package/dist/components/problem-list/details-drawer.css.js +1 -1
- package/dist/components/problem-list/problem-item.js +6 -3
- package/dist/components/problem-list/problem-label-view-filter.d.ts +2 -1
- package/dist/components/problem-list/problem-label-view-filter.js +1 -0
- package/dist/components/problem-list/problem-list.d.ts +1 -0
- package/dist/components/problem-list/problem-list.js +19 -1
- package/dist/components/problem-list/problem-mainview.css.js +1 -1
- package/dist/components/problem-list/problem-mainview.js +6 -0
- package/dist/components/problem-list/problem-sort-filter.d.ts +2 -1
- package/dist/components/problem-list/problem-sort-filter.js +1 -0
- package/dist/components/problems-overview/diagnostic-evaluation.css.js +14 -4
- package/dist/components/problems-overview/diagnostic-evaluation.js +42 -1
- package/dist/components/problems-overview/problems-overview.css.js +1 -0
- package/dist/components/the-doctor/nuke-workspace.d.ts +13 -0
- package/dist/components/the-doctor/nuke-workspace.js +70 -0
- package/dist/components/the-doctor/sparks.d.ts +1 -0
- package/dist/components/the-doctor/sparks.js +11 -2
- package/dist/components/the-doctor/status-bar.css.js +6 -5
- package/dist/components/the-doctor/the-doctor.css.js +117 -16
- package/dist/components/the-doctor/the-doctor.d.ts +70 -21
- package/dist/components/the-doctor/the-doctor.js +1023 -166
- package/dist/components/the-doctor/upload-archive.css.d.ts +2 -0
- package/dist/components/the-doctor/upload-archive.css.js +98 -0
- package/dist/components/the-doctor/upload-archive.d.ts +33 -0
- package/dist/components/the-doctor/upload-archive.js +281 -0
- package/dist/components/visualizer/equalizer.d.ts +3 -1
- package/dist/components/visualizer/equalizer.js +55 -31
- package/dist/components/visualizer/explorer.js +9 -5
- package/dist/cowboy-components.umd.cjs +1846 -1273
- package/dist/css/hr.css.d.ts +2 -0
- package/dist/css/hr.css.js +12 -0
- package/dist/css/pb33f-theme.css +1 -0
- package/dist/events/doctor.d.ts +19 -1
- package/dist/events/doctor.js +5 -0
- package/dist/model/channels.d.ts +1 -0
- package/dist/model/channels.js +1 -0
- package/dist/model/graph.d.ts +17 -0
- package/dist/model/graph.js +17 -1
- package/dist/model/link.d.ts +8 -0
- package/dist/model/node_type.d.ts +22 -1
- package/dist/model/node_type.js +22 -0
- package/dist/model/panel-state.d.ts +5 -0
- package/dist/model/panel-state.js +1 -0
- package/dist/model/problem.d.ts +3 -1
- package/dist/model/problem.js +4 -2
- package/dist/model/rolodex.d.ts +34 -0
- package/dist/model/rolodex.js +1 -0
- package/dist/services/linting-service.d.ts +1 -1
- package/dist/services/linting-service.js +23 -11
- package/dist/services/model-service.d.ts +8 -1
- package/dist/services/model-service.js +127 -0
- package/dist/style.css +1 -1
- package/dist/workers/equalizer.worker.js +4 -3
- package/dist/workers/rule-documentation.worker.d.ts +2 -2
- package/dist/workers/rule-documentation.worker.js +26 -15
- package/package.json +3 -3
- package/dist/assets/css.worker-B_qZXUzt.js +0 -84
- package/dist/assets/editor.worker-HEmB0D7P.js +0 -11
- package/dist/assets/equalizer.worker-icLzyXQ7.js +0 -1
- package/dist/assets/html.worker-D3WUrk8Q.js +0 -458
- package/dist/assets/json.worker-CAhUaBo4.js +0 -42
- package/dist/assets/rule-documentation.worker-D39NS8Lx.js +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `
|
|
3
|
+
|
|
4
|
+
sl-dialog::part(body) {
|
|
5
|
+
margin-top:0;
|
|
6
|
+
padding-top: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
sl-dialog::part(title) {
|
|
10
|
+
margin-bottom:5px;
|
|
11
|
+
padding-bottom: 5px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
.invalid-file {
|
|
16
|
+
border: 1px solid var(--error-color);
|
|
17
|
+
}
|
|
18
|
+
.invalid {
|
|
19
|
+
color: var(--error-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
h4 {
|
|
23
|
+
margin-top: 0;
|
|
24
|
+
padding-top: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.files {
|
|
28
|
+
border: 1px dashed var(--secondary-color);
|
|
29
|
+
padding: 20px;
|
|
30
|
+
margin-top: 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.file-list {
|
|
34
|
+
max-height: 400px;
|
|
35
|
+
overflow-x: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.path{
|
|
39
|
+
color: var(--font-color-sub1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.name {
|
|
43
|
+
color: var(--primary-color);
|
|
44
|
+
font-family: var(--font-stack-bold),serif;
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
input[type="file"] {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.archive-select {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
padding-top: 20px;
|
|
56
|
+
border-top: 1px dashed var(--secondary-color);
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.url-input {
|
|
61
|
+
width: 100%
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.use-url {
|
|
65
|
+
width: 50%;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
border-right: 1px dashed var(--secondary-color);
|
|
69
|
+
padding-right: 20px;
|
|
70
|
+
margin-right: 20px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.upload-archive {
|
|
74
|
+
width: 50%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
sl-button.close-button::part(base) {
|
|
78
|
+
margin-top: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.upload-archive-button {
|
|
82
|
+
border: 1px solid var(--primary-color);
|
|
83
|
+
display: inline-block;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
color: var(--primary-color);
|
|
86
|
+
padding: 10px;
|
|
87
|
+
font-size: 0.8rem;
|
|
88
|
+
height: 18px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
.not-spec {
|
|
94
|
+
color: var(--secondary-color);
|
|
95
|
+
font-family: var(--font-stack), serif;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '@shoelace-style/shoelace/dist/components/format-bytes/format-bytes.js';
|
|
2
|
+
import { LitElement, TemplateResult } from "lit";
|
|
3
|
+
import SlDialog from "@shoelace-style/shoelace/dist/components/dialog/dialog.js";
|
|
4
|
+
import { SlButton, SlInput } from "@shoelace-style/shoelace";
|
|
5
|
+
import { FileMeta } from "../../model/rolodex";
|
|
6
|
+
export declare class UploadArchiveComponent extends LitElement {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
dialog: SlDialog | undefined;
|
|
9
|
+
visible: boolean;
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
files: FileMeta[];
|
|
13
|
+
urlInputButton: SlButton;
|
|
14
|
+
urlInput: SlInput;
|
|
15
|
+
urlOverlay: HTMLElement;
|
|
16
|
+
urlProblem: HTMLElement;
|
|
17
|
+
urlSpinner: HTMLDivElement;
|
|
18
|
+
file: any;
|
|
19
|
+
fileName: string;
|
|
20
|
+
fileType: string;
|
|
21
|
+
fileSize: number;
|
|
22
|
+
fileTooBig: boolean;
|
|
23
|
+
noSpecFilesFound: boolean;
|
|
24
|
+
constructor();
|
|
25
|
+
show(): void;
|
|
26
|
+
hide(): void;
|
|
27
|
+
handleFileChange(event: any): void;
|
|
28
|
+
selectFile(path: string): void;
|
|
29
|
+
fetchUrl(): void;
|
|
30
|
+
validateUrl(evt: KeyboardEvent): void;
|
|
31
|
+
renderFilePath(file: string, isOpenAPI?: boolean): TemplateResult;
|
|
32
|
+
render(): TemplateResult<1>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
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/format-bytes/format-bytes.js';
|
|
8
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
9
|
+
import { html, LitElement } from "lit";
|
|
10
|
+
import dialogCss from "../../css/dialog.css";
|
|
11
|
+
import buttonCss from "../../css/button.css";
|
|
12
|
+
import uploadArchiveCss from "./upload-archive.css";
|
|
13
|
+
import listsCss from "../../css/lists.css";
|
|
14
|
+
import { ModelService } from "../../services/model-service";
|
|
15
|
+
import linksCss from "../../css/links.css";
|
|
16
|
+
import { RolodexRootFileSelected, ArchiveURLRequested } from "../../events/doctor";
|
|
17
|
+
import formsCss from "../../css/forms.css";
|
|
18
|
+
import hrCss from "../../css/hr.css";
|
|
19
|
+
import { NodeType } from "../../model/node_type";
|
|
20
|
+
import { IconSize } from "../model-icon/model-icon";
|
|
21
|
+
const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
|
|
22
|
+
let UploadArchiveComponent = class UploadArchiveComponent extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.visible = false;
|
|
26
|
+
this.invalid = false;
|
|
27
|
+
this.file = null;
|
|
28
|
+
this.files = [];
|
|
29
|
+
}
|
|
30
|
+
show() {
|
|
31
|
+
this.visible = true;
|
|
32
|
+
this.dialog?.show();
|
|
33
|
+
}
|
|
34
|
+
hide() {
|
|
35
|
+
this.visible = false;
|
|
36
|
+
this.dialog?.hide();
|
|
37
|
+
}
|
|
38
|
+
handleFileChange(event) {
|
|
39
|
+
const file = event.target.files[0];
|
|
40
|
+
if (file) {
|
|
41
|
+
this.noSpecFilesFound = false;
|
|
42
|
+
// check if the file is over 5mb (which is too big for free tier)
|
|
43
|
+
if (file.size > 5242880) {
|
|
44
|
+
this.invalid = true;
|
|
45
|
+
this.fileName = file.name;
|
|
46
|
+
this.fileType = file.type;
|
|
47
|
+
this.fileSize = file.size;
|
|
48
|
+
this.fileTooBig = true;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.fileName = file.name;
|
|
52
|
+
this.fileType = file.type;
|
|
53
|
+
this.fileSize = file.size;
|
|
54
|
+
if (file.type === 'application/zip' || file.type === 'application/gzip' || file.type === 'application/x-gzip') {
|
|
55
|
+
this.file = file;
|
|
56
|
+
this.invalid = false;
|
|
57
|
+
const formData = new FormData();
|
|
58
|
+
formData.append('spec-archive', file);
|
|
59
|
+
ModelService.uploadArchive(formData).then((response) => {
|
|
60
|
+
// count the number of openapi files, if there is only one - automatically select it to avoid
|
|
61
|
+
// a step. Thanks to @francois for the suggestion.
|
|
62
|
+
this.files = response.files;
|
|
63
|
+
let count = 0;
|
|
64
|
+
let found = [];
|
|
65
|
+
this.files.forEach((file) => {
|
|
66
|
+
if (file.isOpenAPI) {
|
|
67
|
+
count++;
|
|
68
|
+
found.push(file);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (count === 0) {
|
|
72
|
+
console.error('No OpenAPI files found in the archive');
|
|
73
|
+
this.noSpecFilesFound = true;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (count === 1) {
|
|
77
|
+
this.selectFile(found[0].name);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}).catch((error) => {
|
|
81
|
+
console.error(error);
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.invalid = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
selectFile(path) {
|
|
89
|
+
this.noSpecFilesFound = false;
|
|
90
|
+
ModelService.selectRootPath(path).then((response) => {
|
|
91
|
+
this.dispatchEvent(new CustomEvent(RolodexRootFileSelected, {
|
|
92
|
+
composed: true,
|
|
93
|
+
bubbles: true,
|
|
94
|
+
detail: {
|
|
95
|
+
content: response.instance,
|
|
96
|
+
path: path,
|
|
97
|
+
nodeHashId: response.idHash,
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
this.files = [];
|
|
101
|
+
this.hide();
|
|
102
|
+
}).catch((error) => {
|
|
103
|
+
console.error(error);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
fetchUrl() {
|
|
107
|
+
this.noSpecFilesFound = false;
|
|
108
|
+
this.dispatchEvent(new CustomEvent(ArchiveURLRequested, {
|
|
109
|
+
composed: true,
|
|
110
|
+
bubbles: true,
|
|
111
|
+
detail: {
|
|
112
|
+
url: this.urlInput.value
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
this.hide();
|
|
116
|
+
}
|
|
117
|
+
validateUrl(evt) {
|
|
118
|
+
if (evt.key === "Enter") {
|
|
119
|
+
this.fetchUrl();
|
|
120
|
+
}
|
|
121
|
+
const urlValue = this.urlInput.value;
|
|
122
|
+
if (urlValue.match(urlRegex)) {
|
|
123
|
+
this.urlInputButton.disabled = false;
|
|
124
|
+
this.urlInputButton.classList.remove('close-button');
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.urlInputButton.disabled = true;
|
|
128
|
+
this.urlInputButton.classList.add('close-button');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
renderFilePath(file, isOpenAPI = false) {
|
|
132
|
+
// get the index of the last slash
|
|
133
|
+
const lastSlash = file.lastIndexOf('/');
|
|
134
|
+
if (lastSlash === -1) {
|
|
135
|
+
let link = html ` <a href="#" @click="${() => {
|
|
136
|
+
this.selectFile(file);
|
|
137
|
+
}}">${file}</a>`;
|
|
138
|
+
if (!isOpenAPI) {
|
|
139
|
+
link = html `<span class="not-spec">${file}</span>`;
|
|
140
|
+
}
|
|
141
|
+
return html `<span class="name">${link}</span>`;
|
|
142
|
+
}
|
|
143
|
+
const fileName = file.substring(lastSlash + 1);
|
|
144
|
+
const path = file.substring(0, lastSlash);
|
|
145
|
+
let link = html ` <a href="#" @click="${() => {
|
|
146
|
+
this.selectFile(path + '/' + fileName);
|
|
147
|
+
}}">${fileName}</a>`;
|
|
148
|
+
if (!isOpenAPI) {
|
|
149
|
+
link = html `<span class="not-spec">${fileName}</span>`;
|
|
150
|
+
}
|
|
151
|
+
return html `
|
|
152
|
+
<span class="path">${path}/</span><span class="name">
|
|
153
|
+
${link}
|
|
154
|
+
</span>
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
render() {
|
|
158
|
+
let files = html ``;
|
|
159
|
+
if (this.files.length > 0) {
|
|
160
|
+
files = html `
|
|
161
|
+
<div class="files">
|
|
162
|
+
<h4>Select the Entry Document</h4>
|
|
163
|
+
<p>
|
|
164
|
+
The Entry Document is the 'top' or the <strong><em>starting point</em></strong>.
|
|
165
|
+
Tell the doctor which is your <strong><em>main</em></strong>
|
|
166
|
+
specification that <strong>starts</strong> the OpenAPI document.
|
|
167
|
+
</p>
|
|
168
|
+
<div class="file-list"><ul>
|
|
169
|
+
${this.files.map((file) => {
|
|
170
|
+
let icon = html ``;
|
|
171
|
+
if (file.isOpenAPI) {
|
|
172
|
+
icon = html `<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.OPENAPI}" ></pb33f-model-icon>`;
|
|
173
|
+
return html `
|
|
174
|
+
<li>${this.renderFilePath(file.name, file.isOpenAPI)} ${icon}</li>`;
|
|
175
|
+
}
|
|
176
|
+
})}
|
|
177
|
+
</div>
|
|
178
|
+
</ul>
|
|
179
|
+
</div>`;
|
|
180
|
+
}
|
|
181
|
+
if (this.noSpecFilesFound) {
|
|
182
|
+
files = html ` <p class="invalid"><strong>No OpenAPI files found in archive!</strong></p>
|
|
183
|
+
<p class="invalid">The doctor was unable to detect any OpenAPI YAML or JSON files in the archive you selected.</p>
|
|
184
|
+
<p>Try another file, or check your archive.</p>`;
|
|
185
|
+
}
|
|
186
|
+
return html `
|
|
187
|
+
<sl-dialog style="--width: 60vw; --height: 50vh">
|
|
188
|
+
<span slot="label"><sl-icon name="upload"></sl-icon> Import OpenAPI spec via URL or upload an archive</span>
|
|
189
|
+
<div class="archive-select">
|
|
190
|
+
<div class="use-url">
|
|
191
|
+
|
|
192
|
+
<div style="margin-top: 8px; margin-right: 5px;">URL:</div>
|
|
193
|
+
<div style="width: 100%">
|
|
194
|
+
<sl-input id="url-input" class="url-input"
|
|
195
|
+
placeholder="https://api.pb33f.io/train-travel.yaml"
|
|
196
|
+
@keydown="${this.validateUrl}"
|
|
197
|
+
@keyup="${this.validateUrl}"></sl-input>
|
|
198
|
+
<div style="width: 100%; padding-top: 20px;">
|
|
199
|
+
<sl-button id="url-input-button" class="url-input-button close-button"
|
|
200
|
+
variant="neutral" disabled
|
|
201
|
+
@click="${this.fetchUrl}">Fetch URL
|
|
202
|
+
</sl-button>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div class="upload-archive">
|
|
208
|
+
Spec exploded into multiple files? Upload a <strong>zip</strong> archive or a <strong>tarball</strong> containing everything.
|
|
209
|
+
<p>
|
|
210
|
+
The OpenAPI doctor supports <strong>zip files</strong> (.zip) and gzip compressed
|
|
211
|
+
<strong>tarballs</strong> (.tar.gz).
|
|
212
|
+
</p>
|
|
213
|
+
|
|
214
|
+
<label for="fileInput" class="upload-archive-button">
|
|
215
|
+
Upload .zip or .tar.gz
|
|
216
|
+
</label>
|
|
217
|
+
<input ${this.invalid ? 'invalid-file invalid' : ''}" type="file" id="fileInput"
|
|
218
|
+
@change="${this.handleFileChange}"/>
|
|
219
|
+
|
|
220
|
+
${this.invalid && !this.fileTooBig ? html `
|
|
221
|
+
<p class="invalid">'<strong>${this.fileName}</strong>' has a type of
|
|
222
|
+
'<strong>${this.fileType}</strong>'
|
|
223
|
+
which is an invalid file type.</p>
|
|
224
|
+
<p class="invalid">Please upload a <strong>valid</strong> zip archive or a tarball.</p>
|
|
225
|
+
` : ''}
|
|
226
|
+
|
|
227
|
+
${this.invalid && this.fileTooBig ? html `
|
|
228
|
+
<p class="invalid">'<strong>${this.fileName}</strong>' is too big!
|
|
229
|
+
'<strong>
|
|
230
|
+
<sl-format-bytes value="${this.fileSize}"></sl-format-bytes>
|
|
231
|
+
</strong>'
|
|
232
|
+
exceeds the <strong>5mb</strong> limit for free use
|
|
233
|
+
</p>
|
|
234
|
+
<p class="invalid">Please upload a <strong>smaller</strong> zip archive or a tarball, or
|
|
235
|
+
authenticate.</p>
|
|
236
|
+
` : ''}
|
|
237
|
+
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
${files}
|
|
242
|
+
<sl-button slot="footer" variant="primary" @click="${this.hide}">Close</sl-button>
|
|
243
|
+
</sl-dialog>
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
UploadArchiveComponent.styles = [dialogCss, buttonCss, uploadArchiveCss, listsCss, linksCss, formsCss, hrCss];
|
|
248
|
+
__decorate([
|
|
249
|
+
query('sl-dialog')
|
|
250
|
+
], UploadArchiveComponent.prototype, "dialog", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
property({ type: Boolean })
|
|
253
|
+
], UploadArchiveComponent.prototype, "visible", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
property({ type: Boolean })
|
|
256
|
+
], UploadArchiveComponent.prototype, "invalid", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ type: Boolean })
|
|
259
|
+
], UploadArchiveComponent.prototype, "loading", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
property({ type: Array })
|
|
262
|
+
], UploadArchiveComponent.prototype, "files", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
query('#url-input-button')
|
|
265
|
+
], UploadArchiveComponent.prototype, "urlInputButton", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
query('#url-input')
|
|
268
|
+
], UploadArchiveComponent.prototype, "urlInput", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
query('#editor-url-overlay')
|
|
271
|
+
], UploadArchiveComponent.prototype, "urlOverlay", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
query('#url-problem')
|
|
274
|
+
], UploadArchiveComponent.prototype, "urlProblem", void 0);
|
|
275
|
+
__decorate([
|
|
276
|
+
query('#url-spinner')
|
|
277
|
+
], UploadArchiveComponent.prototype, "urlSpinner", void 0);
|
|
278
|
+
UploadArchiveComponent = __decorate([
|
|
279
|
+
customElement("pb33f-upload-archive")
|
|
280
|
+
], UploadArchiveComponent);
|
|
281
|
+
export { UploadArchiveComponent };
|
|
@@ -71,6 +71,7 @@ export declare class EqualizerComponent extends HasEyes {
|
|
|
71
71
|
closeEqualizer(): void;
|
|
72
72
|
closeKey(): void;
|
|
73
73
|
openKey(): void;
|
|
74
|
+
isInitialized(): boolean;
|
|
74
75
|
nodeSpacingRangeChanged(id: string): void;
|
|
75
76
|
processRenderedObjects(): void;
|
|
76
77
|
bendChanged(): void;
|
|
@@ -78,8 +79,9 @@ export declare class EqualizerComponent extends HasEyes {
|
|
|
78
79
|
refsChanged(): void;
|
|
79
80
|
polyChanged(): void;
|
|
80
81
|
dimmingChanged(): void;
|
|
82
|
+
private initialized;
|
|
81
83
|
initializeEqualizer(): void;
|
|
82
|
-
runEQ(): void;
|
|
84
|
+
runEQ(rebuild?: boolean): void;
|
|
83
85
|
componentVisible(): void;
|
|
84
86
|
componentHidden(): void;
|
|
85
87
|
sendConfig(): void;
|
|
@@ -55,6 +55,7 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
55
55
|
constructor() {
|
|
56
56
|
super();
|
|
57
57
|
this.configuredObjects = new Set();
|
|
58
|
+
this.initialized = false;
|
|
58
59
|
this._allChecked = false;
|
|
59
60
|
this.controls = new OrientationControlsComponent();
|
|
60
61
|
this.keyComponent = new ExplorerKeyComponent();
|
|
@@ -65,7 +66,7 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
65
66
|
this.equalizerWorker.addEventListener("message", (event) => {
|
|
66
67
|
this.controls.searchComponent.graphResponse = event.data;
|
|
67
68
|
this.controls.searchComponent.currentObjects = this.currentObjects;
|
|
68
|
-
if (this.firstBoot) {
|
|
69
|
+
if (!this.firstBoot) {
|
|
69
70
|
this.dispatchEvent(new CustomEvent(ExplorerEqualizerFiltered, {
|
|
70
71
|
bubbles: true,
|
|
71
72
|
composed: true,
|
|
@@ -89,34 +90,46 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
89
90
|
}
|
|
90
91
|
}));
|
|
91
92
|
// select the root after the equalizer has run with defaults
|
|
92
|
-
setTimeout(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
93
|
+
// setTimeout(() => {
|
|
94
|
+
// if (!this.activeNode)
|
|
95
|
+
// this.navigateToRoot();
|
|
96
|
+
// this.firstBoot = false;
|
|
97
|
+
// }, 350); // delay a few MS to allow event bubbling to complete
|
|
97
98
|
}
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
if (!this.initialized)
|
|
100
|
+
this.initialized = true;
|
|
101
|
+
if (this.firstBoot || event.data.rebuild) {
|
|
102
|
+
this.dispatchEvent(new CustomEvent(ExplorerEqualizerChanged, {
|
|
103
|
+
bubbles: true,
|
|
104
|
+
composed: true,
|
|
105
|
+
detail: {
|
|
106
|
+
graph: event.data,
|
|
107
|
+
spacing: {
|
|
108
|
+
nodeNodeBetweenLayers: this.nodeNodeBetweenLayers,
|
|
109
|
+
nodeNode: this.nodeNode,
|
|
110
|
+
edgeNodeBetweenLayers: this.edgeNodeBetweenLayers,
|
|
111
|
+
edgeNode: this.edgeNode,
|
|
112
|
+
bendEdges: this.bendEdges,
|
|
113
|
+
bendPoints: this.bendPoints
|
|
114
|
+
},
|
|
115
|
+
references: {
|
|
116
|
+
renderRefs: this.renderRefs,
|
|
117
|
+
renderPoly: this.renderPoly
|
|
118
|
+
},
|
|
119
|
+
options: {
|
|
120
|
+
dimDependents: this.dimDependencies
|
|
121
|
+
}
|
|
117
122
|
}
|
|
123
|
+
}));
|
|
124
|
+
if (this.firstBoot) {
|
|
125
|
+
// select the root after the equalizer has run with defaults
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
if (!this.activeNode)
|
|
128
|
+
this.navigateToRoot();
|
|
129
|
+
this.firstBoot = false;
|
|
130
|
+
}, 2000); // wait
|
|
118
131
|
}
|
|
119
|
-
}
|
|
132
|
+
}
|
|
120
133
|
});
|
|
121
134
|
this.controls.addEventListener(ExplorerEqualizerOpen, this.openEqualizer.bind(this));
|
|
122
135
|
this.controls.addEventListener(ExplorerEqualizerClose, this.closeEqualizer.bind(this));
|
|
@@ -195,6 +208,9 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
195
208
|
this.controls.keyClosed = false;
|
|
196
209
|
this.requestUpdate();
|
|
197
210
|
}
|
|
211
|
+
isInitialized() {
|
|
212
|
+
return this.initialized;
|
|
213
|
+
}
|
|
198
214
|
nodeSpacingRangeChanged(id) {
|
|
199
215
|
const range = this.shadowRoot?.querySelector(`#${id}`);
|
|
200
216
|
const rangeValue = parseInt(range.value);
|
|
@@ -250,8 +266,15 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
250
266
|
}
|
|
251
267
|
// run the initial graph through the defaults to turn down the noise on the initial render
|
|
252
268
|
initializeEqualizer() {
|
|
269
|
+
if (this.initialized) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
253
272
|
const bootObject = {};
|
|
254
|
-
|
|
273
|
+
if (!this.renderObjects) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
for (let i = 0; i < this.renderObjects.length; i++) {
|
|
277
|
+
const object = this.renderObjects[i];
|
|
255
278
|
if (object.enabled) {
|
|
256
279
|
bootObject[object.type] = true;
|
|
257
280
|
if (object.filters) {
|
|
@@ -274,7 +297,7 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
274
297
|
this.currentObjects = workerObject.objects;
|
|
275
298
|
this.equalizerWorker.postMessage(workerObject);
|
|
276
299
|
}
|
|
277
|
-
runEQ() {
|
|
300
|
+
runEQ(rebuild = false) {
|
|
278
301
|
if (this.configuredObjects && this.configuredObjects.size > 0) {
|
|
279
302
|
const workerObject = {};
|
|
280
303
|
const configuredObjects = {};
|
|
@@ -283,12 +306,13 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
283
306
|
});
|
|
284
307
|
workerObject.objects = configuredObjects;
|
|
285
308
|
workerObject.graphResponse = this.graphResponse;
|
|
309
|
+
workerObject.rebuild = rebuild;
|
|
286
310
|
workerObject.references = {
|
|
287
311
|
renderRefs: this.renderRefs,
|
|
288
312
|
renderPoly: this.renderPoly
|
|
289
313
|
};
|
|
290
314
|
this.extractSpacing(workerObject);
|
|
291
|
-
if (this._visible) {
|
|
315
|
+
if (this._visible || rebuild) {
|
|
292
316
|
this.equalizerWorker.postMessage(workerObject);
|
|
293
317
|
}
|
|
294
318
|
else {
|
|
@@ -300,8 +324,8 @@ let EqualizerComponent = EqualizerComponent_1 = class EqualizerComponent extends
|
|
|
300
324
|
componentVisible() {
|
|
301
325
|
super.componentVisible();
|
|
302
326
|
if (this._cachedEQ) {
|
|
303
|
-
this.equalizerWorker.postMessage(this._cachedEQ);
|
|
304
|
-
this._cachedEQ = null
|
|
327
|
+
// this.equalizerWorker.postMessage(this._cachedEQ);
|
|
328
|
+
//this._cachedEQ = null
|
|
305
329
|
}
|
|
306
330
|
}
|
|
307
331
|
componentHidden() {
|
|
@@ -247,12 +247,16 @@ let ExplorerComponent = class ExplorerComponent extends HasEyes {
|
|
|
247
247
|
if (width2 >= this.zoomMax || width2 <= this.zoomMin) {
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
+
if (Number.isNaN(x2) || Number.isNaN(y2) || Number.isNaN(width2) || Number.isNaN(height2)) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
250
253
|
requestAnimationFrame(() => {
|
|
251
254
|
this.svgItem.setAttribute('viewBox', `${x2} ${y2} ${width2} ${height2}`);
|
|
252
255
|
});
|
|
253
256
|
}
|
|
254
257
|
equalizerFiltered(evt) {
|
|
255
|
-
this.
|
|
258
|
+
this.graphResponse = evt.detail.graph;
|
|
259
|
+
this.buildGraph();
|
|
256
260
|
}
|
|
257
261
|
equalizerChanged(evt) {
|
|
258
262
|
if (evt.detail.graph.nodes.length > 0) {
|
|
@@ -281,7 +285,7 @@ let ExplorerComponent = class ExplorerComponent extends HasEyes {
|
|
|
281
285
|
}
|
|
282
286
|
this.buildGraph();
|
|
283
287
|
setTimeout(() => {
|
|
284
|
-
if (this.activeNode) {
|
|
288
|
+
if (this.activeNode && this._visible) {
|
|
285
289
|
this.dispatchEvent(new CustomEvent(ModelTreeNodeClicked, {
|
|
286
290
|
bubbles: true,
|
|
287
291
|
composed: true,
|
|
@@ -292,7 +296,7 @@ let ExplorerComponent = class ExplorerComponent extends HasEyes {
|
|
|
292
296
|
}));
|
|
293
297
|
return;
|
|
294
298
|
}
|
|
295
|
-
this.navigateToRoot();
|
|
299
|
+
//this.navigateToRoot();
|
|
296
300
|
}, 150);
|
|
297
301
|
}
|
|
298
302
|
buildLayout() {
|
|
@@ -398,7 +402,7 @@ let ExplorerComponent = class ExplorerComponent extends HasEyes {
|
|
|
398
402
|
this.nodeComponents = [];
|
|
399
403
|
this.renderGraphMap.clear();
|
|
400
404
|
this.renderedNodeMap.clear();
|
|
401
|
-
this.graphResponse.nodesRendered
|
|
405
|
+
this.graphResponse.nodesRendered?.forEach((node) => {
|
|
402
406
|
this.renderedNodeMap.set(node.id, node);
|
|
403
407
|
});
|
|
404
408
|
this.graph.children?.forEach((c) => {
|
|
@@ -609,7 +613,7 @@ let ExplorerComponent = class ExplorerComponent extends HasEyes {
|
|
|
609
613
|
return svg `
|
|
610
614
|
${this.equalizer}
|
|
611
615
|
${nodeLimitExceeded}
|
|
612
|
-
<svg preserveAspectRatio="xMidYMid meet" style="width: 100%; height:
|
|
616
|
+
<svg preserveAspectRatio="xMidYMid meet" style="width: 100%; height: calc(100vh - 170px);" viewBox="0 0 ${base} ${base}"
|
|
613
617
|
@wheel="${this.onWheel}"
|
|
614
618
|
@mousedown="${this.mouseDown}"
|
|
615
619
|
@mouseup="${this.mouseUp}"
|