@matdata/yasgui 5.4.0 → 5.6.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/src/defaults.ts CHANGED
@@ -22,7 +22,6 @@ export default function initialize(): Config<CatalogueItem> {
22
22
  return "yagui_" + id;
23
23
  },
24
24
  tabName: "Query",
25
- corsProxy: undefined,
26
25
  persistencyExpire: 60 * 60 * 24 * 30,
27
26
  persistenceLabelResponse: "response",
28
27
  persistenceLabelConfig: "config",
@@ -31,6 +30,7 @@ export default function initialize(): Config<CatalogueItem> {
31
30
  theme: undefined,
32
31
  showThemeToggle: true,
33
32
  orientation: "vertical",
33
+ showSnippetsBar: true,
34
34
  endpointButtons: undefined,
35
35
  endpointCatalogueOptions: {
36
36
  getData: () => {
@@ -4,6 +4,7 @@
4
4
  margin: 4px 0px;
5
5
  border: 2px solid #ccc;
6
6
  width: 100%;
7
+ min-width: 200px;
7
8
  &:hover {
8
9
  border-color: #bbb;
9
10
  }
@@ -125,6 +126,11 @@
125
126
  align-items: center;
126
127
  gap: 4px;
127
128
  margin-left: 4px;
129
+
130
+ // Hide on small screens (mobile)
131
+ @media (max-width: 768px) {
132
+ display: none;
133
+ }
128
134
  }
129
135
 
130
136
  .endpointButton {
@@ -152,5 +158,11 @@
152
158
  outline: 2px solid var(--yasgui-endpoint-button-focus, #5cb3fd);
153
159
  outline-offset: 2px;
154
160
  }
161
+
162
+ // Reduce padding on medium screens
163
+ @media (max-width: 1024px) {
164
+ padding: 4px 8px;
165
+ font-size: 12px;
166
+ }
155
167
  }
156
168
  }
package/src/index.ts CHANGED
@@ -35,6 +35,27 @@ export interface EndpointButton {
35
35
  endpoint: string;
36
36
  label: string;
37
37
  }
38
+
39
+ export interface EndpointConfig {
40
+ endpoint: string;
41
+ label?: string; // Optional label for the endpoint
42
+ showAsButton?: boolean; // Whether to show as a quick-switch button (requires label)
43
+ authentication?:
44
+ | {
45
+ type: "basic";
46
+ username: string;
47
+ password: string;
48
+ }
49
+ | {
50
+ type: "bearer";
51
+ token: string;
52
+ }
53
+ | {
54
+ type: "apiKey";
55
+ headerName: string;
56
+ apiKey: string;
57
+ };
58
+ }
38
59
  export interface Config<EndpointObject extends CatalogueItem = CatalogueItem> {
39
60
  /**
40
61
  * Autofocus yasqe on load or tab switch
@@ -43,7 +64,6 @@ export interface Config<EndpointObject extends CatalogueItem = CatalogueItem> {
43
64
  endpointInfo: ((tab?: Tab) => Element) | undefined;
44
65
  copyEndpointOnNewTab: boolean;
45
66
  tabName: string;
46
- corsProxy: string | undefined;
47
67
  endpointCatalogueOptions: EndpointSelectConfig<EndpointObject>;
48
68
  endpointButtons?: EndpointButton[];
49
69
  //The function allows us to modify the config before we pass it on to a tab
@@ -57,7 +77,6 @@ export interface Config<EndpointObject extends CatalogueItem = CatalogueItem> {
57
77
  yasr: YasrConfig;
58
78
  requestConfig: YasguiRequestConfig;
59
79
  contextMenuContainer: HTMLElement | undefined;
60
- nonSslDomain?: string;
61
80
  theme?: Theme;
62
81
  showThemeToggle?: boolean;
63
82
  /**
@@ -66,6 +85,10 @@ export interface Config<EndpointObject extends CatalogueItem = CatalogueItem> {
66
85
  * 'horizontal': YASQE on left, YASR on right
67
86
  */
68
87
  orientation?: "vertical" | "horizontal";
88
+ /**
89
+ * Show code snippets bar in all tabs (global setting)
90
+ */
91
+ showSnippetsBar?: boolean;
69
92
  }
70
93
  export type PartialConfig = {
71
94
  [P in keyof Config]?: Config[P] extends object ? Partial<Config[P]> : Config[P];
@@ -130,6 +153,12 @@ export class Yasgui extends EventEmitter {
130
153
  this.themeManager.listenToSystemTheme();
131
154
  this.persistentConfig = new PersistentConfig(this);
132
155
 
156
+ // Load persisted showSnippetsBar if available
157
+ const persistedShowSnippetsBar = this.persistentConfig.getShowSnippetsBar();
158
+ if (persistedShowSnippetsBar !== undefined) {
159
+ this.config.showSnippetsBar = persistedShowSnippetsBar;
160
+ }
161
+
133
162
  this.tabElements = new TabElements(this);
134
163
  this.tabPanelsEl = document.createElement("div");
135
164
 
@@ -405,7 +434,6 @@ export class Yasgui extends EventEmitter {
405
434
  public static Yasr = Yasr;
406
435
  public static Yasqe = Yasqe;
407
436
  public static defaults = initializeDefaults();
408
- public static corsEnabled: { [endpoint: string]: boolean } = {};
409
437
  }
410
438
 
411
439
  export function getRandomId() {
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // Version information for YASGUI
2
2
  // This file is auto-generated during build - do not edit manually
3
- export const VERSION = "4.6.1";
3
+ export const VERSION = "5.6.0";