@matdata/yasgui 5.8.1 → 5.9.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.
@@ -67,7 +67,7 @@ export default class TabSettingsModal {
67
67
  // Theme toggle button (if enabled)
68
68
  if (this.tab.yasgui.config.showThemeToggle) {
69
69
  this.themeToggleButton = document.createElement("button");
70
- addClass(this.themeToggleButton, "themeToggle");
70
+ addClass(this.themeToggleButton, "tabContextButton", "themeToggle");
71
71
  this.themeToggleButton.setAttribute("aria-label", "Toggle between light and dark theme");
72
72
  this.themeToggleButton.title = "Toggle theme";
73
73
  this.themeToggleButton.innerHTML = this.getThemeToggleIcon();
@@ -82,8 +82,10 @@ export default class TabSettingsModal {
82
82
  this.prefixButton = document.createElement("button");
83
83
  this.prefixButton.setAttribute("aria-label", "Insert Prefixes");
84
84
  this.prefixButton.title = "Insert saved prefixes into query";
85
- this.prefixButton.textContent = "PREFIX";
86
- addClass(this.prefixButton, "tabPrefixButton");
85
+ this.prefixButton.innerHTML = `<svg viewBox="0 0 24 24" fill="currentColor">
86
+ <path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"/>
87
+ </svg>`;
88
+ addClass(this.prefixButton, "tabContextButton", "prefixButton");
87
89
  controlBarEl.appendChild(this.prefixButton);
88
90
  this.prefixButton.onclick = () => this.insertPrefixesIntoQuery();
89
91
 
@@ -272,6 +274,13 @@ export default class TabSettingsModal {
272
274
  content.innerHTML = "";
273
275
  this.drawEditorSettings(content as HTMLElement);
274
276
  }
277
+ // Refresh endpoints list when switching to endpoints tab
278
+ if (tabName === "endpoints") {
279
+ const endpointsList = content.querySelector(".endpointsTable");
280
+ if (endpointsList) {
281
+ this.renderEndpointsList(endpointsList as HTMLElement);
282
+ }
283
+ }
275
284
  } else {
276
285
  removeClass(content as HTMLElement, "active");
277
286
  }
@@ -453,6 +462,12 @@ export default class TabSettingsModal {
453
462
  }
454
463
 
455
464
  private drawEndpointsSettings(container: HTMLElement) {
465
+ // Developer-configured endpoint buttons section (if any)
466
+ const devButtons = this.tab.yasgui.config.endpointButtons;
467
+ if (devButtons && devButtons.length > 0) {
468
+ this.drawDeveloperButtonsSettings(container);
469
+ }
470
+
456
471
  const section = document.createElement("div");
457
472
  addClass(section, "settingsSection");
458
473
 
@@ -477,6 +492,92 @@ export default class TabSettingsModal {
477
492
  container.appendChild(section);
478
493
  }
479
494
 
495
+ private drawDeveloperButtonsSettings(container: HTMLElement) {
496
+ const section = document.createElement("div");
497
+ addClass(section, "settingsSection");
498
+
499
+ const label = document.createElement("label");
500
+ label.textContent = "Developer-Configured Endpoint Buttons";
501
+ addClass(label, "settingsLabel");
502
+
503
+ const help = document.createElement("div");
504
+ help.textContent = "These endpoint buttons were configured by the developer. You can enable or disable them.";
505
+ addClass(help, "settingsHelp");
506
+
507
+ section.appendChild(label);
508
+ section.appendChild(help);
509
+
510
+ // List of dev buttons
511
+ const devButtonsList = document.createElement("div");
512
+ addClass(devButtonsList, "devButtonsTable");
513
+ this.renderDeveloperButtonsList(devButtonsList);
514
+ section.appendChild(devButtonsList);
515
+
516
+ container.appendChild(section);
517
+ }
518
+
519
+ private renderDeveloperButtonsList(container: HTMLElement) {
520
+ container.innerHTML = "";
521
+ const devButtons = this.tab.yasgui.config.endpointButtons || [];
522
+ const disabledButtons = this.tab.yasgui.persistentConfig.getDisabledDevButtons();
523
+
524
+ // Create table
525
+ const table = document.createElement("table");
526
+ addClass(table, "devButtonsTableElement");
527
+
528
+ // Header
529
+ const thead = document.createElement("thead");
530
+ const headerRow = document.createElement("tr");
531
+ const headers = ["Label", "Endpoint", "Enabled"];
532
+ headers.forEach((h) => {
533
+ const th = document.createElement("th");
534
+ th.textContent = h;
535
+ headerRow.appendChild(th);
536
+ });
537
+ thead.appendChild(headerRow);
538
+ table.appendChild(thead);
539
+
540
+ // Body
541
+ const tbody = document.createElement("tbody");
542
+
543
+ devButtons.forEach((button) => {
544
+ const row = document.createElement("tr");
545
+
546
+ // Label column
547
+ const labelCell = document.createElement("td");
548
+ labelCell.textContent = button.label;
549
+ addClass(labelCell, "devButtonLabelCell");
550
+ row.appendChild(labelCell);
551
+
552
+ // Endpoint column
553
+ const endpointCell = document.createElement("td");
554
+ endpointCell.textContent = button.endpoint;
555
+ endpointCell.title = button.endpoint;
556
+ addClass(endpointCell, "endpointCell");
557
+ row.appendChild(endpointCell);
558
+
559
+ // Enabled checkbox
560
+ const enabledCell = document.createElement("td");
561
+ const enabledCheckbox = document.createElement("input");
562
+ enabledCheckbox.type = "checkbox";
563
+ enabledCheckbox.checked = !disabledButtons.includes(button.endpoint);
564
+ enabledCheckbox.setAttribute("aria-label", `Toggle ${button.label} button`);
565
+ enabledCheckbox.title = "Show/hide this button";
566
+ enabledCheckbox.onchange = () => {
567
+ this.tab.yasgui.persistentConfig.toggleDevButton(button.endpoint, enabledCheckbox.checked);
568
+ this.tab.refreshEndpointButtons();
569
+ };
570
+ enabledCell.appendChild(enabledCheckbox);
571
+ addClass(enabledCell, "centerCell");
572
+ row.appendChild(enabledCell);
573
+
574
+ tbody.appendChild(row);
575
+ });
576
+
577
+ table.appendChild(tbody);
578
+ container.appendChild(table);
579
+ }
580
+
480
581
  private renderEndpointsList(container: HTMLElement) {
481
582
  container.innerHTML = "";
482
583
  const configs = this.tab.yasgui.persistentConfig.getEndpointConfigs();
@@ -1188,6 +1289,14 @@ export default class TabSettingsModal {
1188
1289
  if (editorContent && editorContent.innerHTML === "") {
1189
1290
  this.drawEditorSettings(editorContent as HTMLElement);
1190
1291
  }
1292
+ // Refresh endpoints list in case new endpoints were added while modal was closed
1293
+ const endpointsContent = this.modalContent.querySelector("#endpoints-content");
1294
+ if (endpointsContent) {
1295
+ const endpointsList = endpointsContent.querySelector(".endpointsTable");
1296
+ if (endpointsList) {
1297
+ this.renderEndpointsList(endpointsList as HTMLElement);
1298
+ }
1299
+ }
1191
1300
  addClass(this.modalOverlay, "open");
1192
1301
  }
1193
1302
 
@@ -126,11 +126,9 @@
126
126
  align-items: center;
127
127
  gap: 4px;
128
128
  margin-left: 4px;
129
-
130
- // Hide on small screens (mobile)
131
- @media (max-width: 768px) {
132
- display: none;
133
- }
129
+ position: relative;
130
+ flex-wrap: nowrap;
131
+ overflow: visible;
134
132
  }
135
133
 
136
134
  .endpointButton {
@@ -144,6 +142,7 @@
144
142
  font-weight: 500;
145
143
  white-space: nowrap;
146
144
  transition: all 0.2s ease;
145
+ flex-shrink: 0;
147
146
 
148
147
  &:hover {
149
148
  background-color: var(--yasgui-endpoint-button-hover-bg, #286090);
@@ -164,5 +163,99 @@
164
163
  padding: 4px 8px;
165
164
  font-size: 12px;
166
165
  }
166
+
167
+ // Hidden state for overflow
168
+ &.endpointButtonHidden {
169
+ display: none;
170
+ }
171
+ }
172
+
173
+ // Overflow button (ellipsis menu)
174
+ .endpointOverflowBtn {
175
+ display: flex;
176
+ align-items: center;
177
+ justify-content: center;
178
+ width: 28px;
179
+ height: 24px;
180
+ padding: 4px;
181
+ border: 1px solid var(--yasgui-endpoint-button-border, #337ab7);
182
+ background-color: var(--yasgui-endpoint-button-bg, #337ab7);
183
+ color: var(--yasgui-endpoint-button-text, #ffffff);
184
+ border-radius: 3px;
185
+ cursor: pointer;
186
+ flex-shrink: 0;
187
+ transition: all 0.2s ease;
188
+
189
+ svg {
190
+ width: 16px;
191
+ height: 16px;
192
+ }
193
+
194
+ &:hover {
195
+ background-color: var(--yasgui-endpoint-button-hover-bg, #286090);
196
+ border-color: var(--yasgui-endpoint-button-hover-border, #286090);
197
+ }
198
+
199
+ &:focus {
200
+ outline: 2px solid var(--yasgui-endpoint-button-focus, #5cb3fd);
201
+ outline-offset: 2px;
202
+ }
203
+
204
+ &[aria-expanded="true"] {
205
+ background-color: var(--yasgui-endpoint-button-hover-bg, #286090);
206
+ }
207
+ }
208
+
209
+ // Overflow dropdown menu
210
+ .endpointOverflowDropdown {
211
+ display: none;
212
+ position: absolute;
213
+ top: 100%;
214
+ right: 0;
215
+ margin-top: 4px;
216
+ min-width: 150px;
217
+ max-width: 300px;
218
+ background-color: var(--yasgui-bg-primary, #ffffff);
219
+ border: 1px solid var(--yasgui-border-color, #ddd);
220
+ border-radius: 4px;
221
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
222
+ z-index: 1000;
223
+ overflow: hidden;
224
+
225
+ // Dark mode shadow
226
+ [data-theme="dark"] & {
227
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
228
+ }
229
+ }
230
+
231
+ // Dropdown items
232
+ .endpointOverflowItem {
233
+ display: block;
234
+ width: 100%;
235
+ padding: 8px 12px;
236
+ text-align: left;
237
+ background: none;
238
+ border: none;
239
+ border-bottom: 1px solid var(--yasgui-border-color, #ddd);
240
+ color: var(--yasgui-text-primary, rgba(0, 0, 0, 0.87));
241
+ font-size: 13px;
242
+ cursor: pointer;
243
+ white-space: nowrap;
244
+ overflow: hidden;
245
+ text-overflow: ellipsis;
246
+ transition: background-color 0.15s ease;
247
+
248
+ &:last-child {
249
+ border-bottom: none;
250
+ }
251
+
252
+ &:hover {
253
+ background-color: var(--yasgui-bg-tertiary, #eee);
254
+ }
255
+
256
+ &:focus {
257
+ outline: none;
258
+ background-color: var(--yasgui-bg-tertiary, #eee);
259
+ }
167
260
  }
168
261
  }
package/src/tab.scss CHANGED
@@ -137,14 +137,14 @@
137
137
  border: none;
138
138
  background: none;
139
139
  align-self: center;
140
- padding-left: 10px;
141
- padding-right: 10px;
140
+ padding: 6px;
142
141
  cursor: pointer;
143
142
  color: var(--yasgui-button-text, #505050);
144
143
  fill: var(--yasgui-button-text, #505050);
145
144
  display: flex;
146
145
  align-items: center;
147
146
  justify-content: center;
147
+ flex-shrink: 0;
148
148
 
149
149
  .svgImg {
150
150
  width: 15px;
@@ -161,6 +161,16 @@
161
161
  color: var(--yasgui-button-hover, black);
162
162
  fill: var(--yasgui-button-hover, black);
163
163
  }
164
+
165
+ // Responsive spacing - reduce padding on smaller screens
166
+ @media (max-width: 768px) {
167
+ padding: 2px;
168
+
169
+ svg {
170
+ width: 18px;
171
+ height: 18px;
172
+ }
173
+ }
164
174
  }
165
175
 
166
176
  .controlbar {
@@ -168,5 +178,6 @@
168
178
  align-content: center;
169
179
  flex-shrink: 0;
170
180
  max-height: 35px;
181
+ gap: 2px;
171
182
  }
172
183
  }
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 = "5.8.1";
3
+ export const VERSION = "5.9.0";