@pb33f/cowboy-components 0.7.8 → 0.7.10

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 (39) hide show
  1. package/dist/components/the-doctor/the-doctor.css.js +16 -0
  2. package/dist/components/the-doctor/the-doctor.d.ts +3 -0
  3. package/dist/components/the-doctor/the-doctor.js +49 -3
  4. package/dist/components/time-vortex/tardis-control.css.js +0 -16
  5. package/dist/components/workspaces/workspace-destroy-dialog.d.ts +17 -0
  6. package/dist/components/workspaces/workspace-destroy-dialog.js +85 -0
  7. package/dist/components/workspaces/workspace-form.d.ts +22 -0
  8. package/dist/components/workspaces/workspace-form.js +194 -0
  9. package/dist/components/workspaces/workspace-view.css.d.ts +2 -0
  10. package/dist/components/workspaces/workspace-view.css.js +40 -0
  11. package/dist/components/workspaces/workspace-view.d.ts +30 -0
  12. package/dist/components/workspaces/workspace-view.js +196 -0
  13. package/dist/controllers/diagnostic-controller.d.ts +1 -0
  14. package/dist/controllers/diagnostic-controller.js +9 -8
  15. package/dist/controllers/rolodex-controller.d.ts +1 -1
  16. package/dist/controllers/rolodex-controller.js +1 -1
  17. package/dist/controllers/workspace-controller.d.ts +15 -0
  18. package/dist/controllers/workspace-controller.js +156 -0
  19. package/dist/cowboy-components.umd.cjs +1558 -1094
  20. package/dist/css/badges.css.d.ts +2 -0
  21. package/dist/css/badges.css.js +12 -0
  22. package/dist/css/button.css.js +1 -1
  23. package/dist/css/forms.css.js +127 -1
  24. package/dist/css/lists.css.js +8 -0
  25. package/dist/css/pb33f-theme.css +1 -0
  26. package/dist/css/spinner.css.js +29 -0
  27. package/dist/events/doctor.d.ts +15 -0
  28. package/dist/events/doctor.js +10 -0
  29. package/dist/model/form-types.d.ts +32 -0
  30. package/dist/model/form-types.js +19 -0
  31. package/dist/model/formable.d.ts +51 -0
  32. package/dist/model/formable.js +542 -0
  33. package/dist/model/workspace.d.ts +6 -0
  34. package/dist/model/workspace.js +1 -0
  35. package/dist/monacoeditorwork/yaml.worker..bundle.js +14801 -14800
  36. package/dist/services/workspace-service.d.ts +10 -0
  37. package/dist/services/workspace-service.js +132 -0
  38. package/dist/style.css +1 -1
  39. package/package.json +7 -2
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ sl-badge::part(base) {
4
+ border-radius: 0;
5
+ }
6
+
7
+ sl-badge {
8
+ vertical-align: text-top;
9
+ }
10
+
11
+
12
+ `;
@@ -10,7 +10,7 @@ export default css `
10
10
  margin-top: 5px;
11
11
  }
12
12
 
13
- sl-button.close-button::part(base){
13
+ sl-button.close-button::part(base),sl-button.cancel-button::part(base){
14
14
  border: 1px solid var(--font-color-sub2);
15
15
  background-color: var(--background-color);
16
16
  color: var(--font-color-sub2);
@@ -58,7 +58,12 @@ export default css `
58
58
  font-family: var(--font-stack), monospace;
59
59
  font-size: 0.8rem;
60
60
  }
61
-
61
+
62
+ sl-input::part(form-control-help-text) {
63
+ font-size: 0.8rem;
64
+ font-family: var(--font-stack-italic), sans-serif;
65
+ }
66
+
62
67
  sl-textarea::part(base) {
63
68
  border-radius: 0;
64
69
  font-family: var(--font-stack), monospace;
@@ -118,6 +123,127 @@ export default css `
118
123
  font-family: var(--font-stack), monospace;
119
124
  font-size: 0.8rem;
120
125
  }
126
+
127
+ .form-controls {
128
+ padding-top: 10px;
129
+ padding-bottom: 10px;
130
+ }
131
+
132
+ /* Error state styling */
133
+ .label-on-left.error::part(form-control-label) {
134
+ color: var(--error-color);
135
+ }
136
+
137
+ .label-on-left.error::part(form-control-help-text) {
138
+ color: var(--error-color);
139
+ }
140
+
141
+ sl-input.error::part(base) {
142
+ border-color: var(--error-color);
143
+ }
144
+
145
+ sl-input.error::part(form-control-label) {
146
+ color: var(--error-color);
147
+ }
148
+
149
+ sl-input.error::part(form-control-help-text) {
150
+ color: var(--error-color);
151
+ }
152
+
153
+ sl-textarea.error::part(base) {
154
+ border-color: var(--error-color);
155
+ }
156
+
157
+ sl-textarea.error::part(form-control-label) {
158
+ color: var(--error-color);
159
+ }
160
+
161
+ sl-textarea.error::part(form-control-help-text) {
162
+ color: var(--error-color);
163
+ }
164
+
165
+ sl-select.error::part(combobox) {
166
+ border-color: var(--error-color);
167
+ }
168
+
169
+ sl-select.error::part(form-control-label) {
170
+ color: var(--error-color);
171
+ }
172
+
173
+ sl-select.error::part(form-control-help-text) {
174
+ color: var(--error-color);
175
+ }
176
+
177
+ sl-range.error::part(form-control-label) {
178
+ color: var(--error-color);
179
+ }
180
+
181
+ sl-range.error::part(form-control-help-text) {
182
+ color: var(--error-color);
183
+ }
184
+
185
+ sl-radio-group.error::part(form-control-label) {
186
+ color: var(--error-color);
187
+ }
188
+
189
+ sl-radio-group.error::part(form-control-help-text) {
190
+ color: var(--error-color);
191
+ }
192
+
193
+ sl-checkbox.error::part(label) {
194
+ color: var(--error-color);
195
+ }
196
+
197
+ sl-switch.error {
198
+ color: var(--error-color);
199
+ }
200
+
201
+ /* Top error styling */
202
+ .form-top-error {
203
+ margin-bottom: 20px;
204
+ }
205
+
206
+ /* Loading state styling */
207
+ .form-loading-message {
208
+ margin-bottom: 20px;
209
+ }
210
+
211
+ .dynamic-form.loading {
212
+ position: relative;
213
+ }
214
+
215
+ .dynamic-form.loading .form-fields::after {
216
+ content: '';
217
+ position: absolute;
218
+ top: 0;
219
+ left: 0;
220
+ right: 0;
221
+ bottom: 0;
222
+ background-color: var(--background-color-withlowopacity);
223
+ backdrop-filter: blur(1px);
224
+ z-index: 10;
225
+ pointer-events: all;
226
+ }
121
227
 
228
+ .form-fields {
229
+ position: relative;
230
+ }
231
+
232
+ /* Button loading state */
233
+ .button-primary.loading {
234
+ opacity: 0.6;
235
+ cursor: not-allowed;
236
+ }
237
+
238
+ .dynamic-form.loading sl-input,
239
+ .dynamic-form.loading sl-textarea,
240
+ .dynamic-form.loading sl-select,
241
+ .dynamic-form.loading sl-checkbox,
242
+ .dynamic-form.loading sl-radio-group,
243
+ .dynamic-form.loading sl-range,
244
+ .dynamic-form.loading sl-switch {
245
+ pointer-events: none;
246
+ opacity: 0.6;
247
+ }
122
248
 
123
249
  `;
@@ -4,6 +4,14 @@ export default css `
4
4
  padding-left: 20px;
5
5
  }
6
6
 
7
+ ul > li.secondary:before {
8
+ color: var(--secondary-color);
9
+ font-family: var(--font-stack-bold), monospace;
10
+ margin-right: 10px;
11
+ content: ">";
12
+ }
13
+
14
+
7
15
  ul > li {
8
16
  font-family: var(--font-stack-paragraph), monospace;
9
17
  font-weight: normal;
@@ -67,6 +67,7 @@ html {
67
67
 
68
68
  --background-color: #0d1117;
69
69
  --background-color-withopacity: rgba(13, 17, 23, 0.8);
70
+ --background-color-withlowopacity: rgba(13, 17, 23, 0.1);
70
71
 
71
72
  --font-color: #e8e9ed;
72
73
  --font-color-sub1: #a7a7a7;
@@ -26,6 +26,35 @@ export default css `
26
26
  margin-top: 20px;
27
27
  }
28
28
 
29
+
30
+ .spinner-icon {
31
+ display: block;
32
+ margin: 20px auto 0 auto;
33
+ width: 200px;
34
+ color: var(--primary-color);
35
+ font-size: 6rem;
36
+ animation: spin 2s linear infinite;
37
+ }
38
+
39
+ .spinner-icon-small {
40
+ display: inline-block;
41
+ color: var(--primary-color);
42
+ font-size: 1rem;
43
+ animation: spin 0.3s linear infinite;
44
+ vertical-align: top;
45
+ }
46
+
47
+
48
+ @keyframes spin {
49
+ 0% {
50
+ transform: rotate(0deg);
51
+ }
52
+ 100% {
53
+ transform: rotate(360deg);
54
+ }
55
+ }
56
+
57
+
29
58
  @keyframes spinner {
30
59
  0% {
31
60
  transform: rotate(0);
@@ -62,6 +62,16 @@ export declare const OpenSettings = "openSettings";
62
62
  export declare const OpenAuthentication = "openAuthentication";
63
63
  export declare const StartSessionFailed = "startSessionFailed";
64
64
  export declare const CreditEmpty = "creditEmpty";
65
+ export declare const FormDirtyEvent = "formDirty";
66
+ export declare const FormValidEvent = "formValid";
67
+ export declare const FormInvalidEvent = "formInvalid";
68
+ export declare const FormSubmitComplete = "formSubmitComplete";
69
+ export declare const RefreshWorkspaces = "refreshWorkspaces";
70
+ export declare const SwitchWorkspace = "switchWorkspace";
71
+ export declare const DeleteWorkspace = "deleteWorkspace";
72
+ export declare const CreateWorkspace = "createWorkspace";
73
+ export declare const UpdateWorkspace = "updateWorkspace";
74
+ export declare const Reboot = "reboot";
65
75
  export interface RevisionClickedEvent {
66
76
  specSummary: SpecSummary;
67
77
  }
@@ -191,3 +201,8 @@ export interface HistoryState {
191
201
  activeNode: string;
192
202
  ref: string;
193
203
  }
204
+ export interface FormFieldChangeEvent {
205
+ key: string;
206
+ value: any;
207
+ originalValue: any;
208
+ }
@@ -54,6 +54,16 @@ export const OpenSettings = "openSettings";
54
54
  export const OpenAuthentication = "openAuthentication";
55
55
  export const StartSessionFailed = "startSessionFailed";
56
56
  export const CreditEmpty = "creditEmpty";
57
+ export const FormDirtyEvent = 'formDirty';
58
+ export const FormValidEvent = 'formValid';
59
+ export const FormInvalidEvent = 'formInvalid';
60
+ export const FormSubmitComplete = 'formSubmitComplete';
61
+ export const RefreshWorkspaces = 'refreshWorkspaces';
62
+ export const SwitchWorkspace = 'switchWorkspace';
63
+ export const DeleteWorkspace = 'deleteWorkspace';
64
+ export const CreateWorkspace = 'createWorkspace';
65
+ export const UpdateWorkspace = 'updateWorkspace';
66
+ export const Reboot = 'reboot';
57
67
  export var ActiveView;
58
68
  (function (ActiveView) {
59
69
  ActiveView["Problems"] = "problems";
@@ -0,0 +1,32 @@
1
+ export declare enum FieldType {
2
+ Text = "text",
3
+ Number = "number",
4
+ Boolean = "boolean",
5
+ Array = "array"
6
+ }
7
+ export declare enum RenderType {
8
+ Text = "text",
9
+ Textarea = "textarea",
10
+ Select = "select",
11
+ Radio = "radio",
12
+ Checkbox = "checkbox",
13
+ Slider = "slider",
14
+ Switch = "switch",
15
+ Hidden = "hidden",
16
+ Ignored = "ignored"
17
+ }
18
+ export interface FormError {
19
+ key: string;
20
+ message: string;
21
+ }
22
+ export interface FormHint {
23
+ key: string;
24
+ renderType: RenderType;
25
+ options?: string[] | number[];
26
+ placeholder?: string;
27
+ helpText?: string;
28
+ required?: boolean;
29
+ min?: number;
30
+ max?: number;
31
+ step?: number;
32
+ }
@@ -0,0 +1,19 @@
1
+ export var FieldType;
2
+ (function (FieldType) {
3
+ FieldType["Text"] = "text";
4
+ FieldType["Number"] = "number";
5
+ FieldType["Boolean"] = "boolean";
6
+ FieldType["Array"] = "array";
7
+ })(FieldType || (FieldType = {}));
8
+ export var RenderType;
9
+ (function (RenderType) {
10
+ RenderType["Text"] = "text";
11
+ RenderType["Textarea"] = "textarea";
12
+ RenderType["Select"] = "select";
13
+ RenderType["Radio"] = "radio";
14
+ RenderType["Checkbox"] = "checkbox";
15
+ RenderType["Slider"] = "slider";
16
+ RenderType["Switch"] = "switch";
17
+ RenderType["Hidden"] = "hidden";
18
+ RenderType["Ignored"] = "ignored";
19
+ })(RenderType || (RenderType = {}));
@@ -0,0 +1,51 @@
1
+ import { LitElement, TemplateResult } from "lit";
2
+ import { TheDoctor } from "../components/the-doctor/the-doctor.js";
3
+ import { FormError, FormHint } from "./form-types.js";
4
+ export declare class Formable extends LitElement {
5
+ doc: TheDoctor;
6
+ static styles: import("lit").CSSResult[];
7
+ model: any;
8
+ private formData;
9
+ private originalData;
10
+ private isDirty;
11
+ errors: FormError[];
12
+ hints: FormHint[];
13
+ validationErrors: Map<string, string>;
14
+ topError: FormError | null;
15
+ loadingMessage: string | null;
16
+ isLoading: boolean;
17
+ onFormSubmit: (() => void) | null;
18
+ autoFocus: boolean;
19
+ constructor(doc?: TheDoctor);
20
+ setHints(hints: FormHint[]): void;
21
+ renderErrors(errors: FormError[]): void;
22
+ clearErrors(): void;
23
+ setTopError(error: FormError): void;
24
+ clearTopError(): void;
25
+ setLoading(message: string): void;
26
+ notLoading(): void;
27
+ renderForm(): any;
28
+ wipeModel(customDefaults?: {
29
+ [key: string]: any;
30
+ }): void;
31
+ renderCancelButton(onClick?: () => void): TemplateResult;
32
+ renderActionButton(label: string, onClick?: () => void): TemplateResult;
33
+ setFormSubmitHandler(handler: () => void): void;
34
+ private initializeFormData;
35
+ private getFieldType;
36
+ private getHintForKey;
37
+ private handleFieldChange;
38
+ private renderHiddenField;
39
+ private renderTextField;
40
+ private renderNumberField;
41
+ private renderBooleanField;
42
+ private renderArrayField;
43
+ private formatLabel;
44
+ private handleKeyDown;
45
+ private handleFieldNavigation;
46
+ private captureCurrentFieldValue;
47
+ private triggerFormSubmission;
48
+ private getFormInputElements;
49
+ private isFirstVisibleField;
50
+ renderModel(): TemplateResult;
51
+ }