tabby-quick-buttons 0.1.0 → 1.0.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 CHANGED
@@ -1,10 +1,12 @@
1
1
  # Tabby Quick Buttons
2
2
 
3
- Hover over the floating button in the lower-right corner of a Tabby terminal to open the command panel. Click an alias to send its saved command to the focused terminal pane.
3
+ Source code and issue tracker are available on [GitHub](https://github.com/vzpd/tabby-quick-buttons).
4
+
5
+ Hover over the floating button in a Tabby terminal to open the command panel. The button starts in the lower-right corner. Drag it anywhere in the window to save a new position. Click the **Quick Buttons** icon in the Tabby toolbar to keep the panel open.
4
6
 
5
7
  - **Shared** groups are available in every terminal. Add commands directly or organize them in nested groups.
6
8
  - **Current profile** groups are available only in the matching Tabby profile. Renaming the profile keeps the association. Temporary connections without a profile ID can use shared groups.
7
- - Select **Manage** to add, edit, or delete commands and groups in the panel. Select **Done** to return to hover mode.
9
+ - Select **Manage** to add, edit, or delete commands and groups. Drag a command onto a group heading to move it. Dropping onto **Shared** or **Current profile** moves it to the root of that scope and changes where it is available. Select **Done** to return to hover mode.
8
10
  - Each command has a display alias and a single line of terminal text. **Press Enter after inserting** is enabled by default. Turn it off to insert the command for review or editing.
9
11
 
10
12
  Use shortcuts at an empty shell prompt. The plugin stores commands in Tabby's configuration. Keep passwords and tokens out of command text.
@@ -21,7 +23,7 @@ npm pack
21
23
  In Tabby, go to **Settings → Plugins** and open the plugin directory. Install the package from that directory using the path to the generated archive:
22
24
 
23
25
  ```sh
24
- npm install /absolute/path/to/tabby-quick-buttons-0.1.0.tgz
26
+ npm install /absolute/path/to/tabby-quick-buttons-1.0.0.tgz
25
27
  ```
26
28
 
27
29
  Quit and reopen Tabby, then open a terminal. The plugin uses the Angular and terminal APIs bundled with Tabby.
package/dist/index.js CHANGED
@@ -9,13 +9,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const common_1 = require("@angular/common");
10
10
  const core_1 = require("@angular/core");
11
11
  const tabby_core_1 = require("tabby-core");
12
+ const rxjs_1 = require("rxjs");
12
13
  const quickButtons_component_1 = require("./quickButtons.component");
13
14
  class QuickButtonsConfigProvider extends tabby_core_1.ConfigProvider {
14
15
  defaults = {
15
16
  quickButtons: { scopes: [] },
16
17
  };
17
18
  }
18
- function mountQuickButtons(app, injector, document) {
19
+ let QuickButtonsToolbar = class QuickButtonsToolbar extends tabby_core_1.ToolbarButtonProvider {
20
+ opened = new rxjs_1.Subject();
21
+ provide() {
22
+ return [{
23
+ title: 'Quick Buttons',
24
+ icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m4 7 5 5-5 5m8 0h7"/></svg>',
25
+ click: () => this.opened.next(),
26
+ }];
27
+ }
28
+ };
29
+ QuickButtonsToolbar = __decorate([
30
+ (0, core_1.Injectable)()
31
+ ], QuickButtonsToolbar);
32
+ function mountQuickButtons(app, injector, document, toolbar) {
19
33
  let component;
20
34
  return () => {
21
35
  if (component) {
@@ -25,7 +39,12 @@ function mountQuickButtons(app, injector, document) {
25
39
  document.body.append(host);
26
40
  component = (0, core_1.createComponent)(quickButtons_component_1.QuickButtonsComponent, { environmentInjector: injector, hostElement: host });
27
41
  app.attachView(component.hostView);
28
- component.onDestroy(() => host.remove());
42
+ const instance = component.instance;
43
+ const launch = toolbar.opened.subscribe(() => instance.togglePinned());
44
+ component.onDestroy(() => {
45
+ launch.unsubscribe();
46
+ host.remove();
47
+ });
29
48
  };
30
49
  }
31
50
  let QuickButtonsPlugin = class QuickButtonsPlugin {
@@ -36,10 +55,12 @@ QuickButtonsPlugin = __decorate([
36
55
  declarations: [quickButtons_component_1.QuickButtonsComponent],
37
56
  providers: [
38
57
  { provide: tabby_core_1.ConfigProvider, useClass: QuickButtonsConfigProvider, multi: true },
58
+ QuickButtonsToolbar,
59
+ { provide: tabby_core_1.ToolbarButtonProvider, useExisting: QuickButtonsToolbar, multi: true },
39
60
  {
40
61
  provide: core_1.APP_BOOTSTRAP_LISTENER,
41
62
  useFactory: mountQuickButtons,
42
- deps: [core_1.ApplicationRef, core_1.EnvironmentInjector, common_1.DOCUMENT],
63
+ deps: [core_1.ApplicationRef, core_1.EnvironmentInjector, common_1.DOCUMENT, QuickButtonsToolbar],
43
64
  multi: true,
44
65
  },
45
66
  ],
@@ -15,19 +15,33 @@ const tabby_core_1 = require("tabby-core");
15
15
  const tabby_terminal_1 = require("tabby-terminal");
16
16
  const quickButtons_view_1 = require("./quickButtons.view");
17
17
  const invalidCommandCharacters = /[\x00-\x1f\x7f-\x9f]/;
18
+ const ballSize = 52;
19
+ const edge = 8;
20
+ const positionKey = 'tabby-quick-buttons.floating-position';
21
+ const commandDragType = 'application/x-tabby-quick-button';
18
22
  let QuickButtonsComponent = class QuickButtonsComponent {
19
23
  app;
20
24
  config;
25
+ notifications;
21
26
  target = null;
22
27
  scopes = [];
23
28
  managing = false;
24
29
  editor = null;
25
30
  busy = false;
26
31
  error = '';
32
+ dragged = null;
33
+ dropTarget = null;
34
+ movingBall = false;
35
+ pinned = false;
36
+ ballPosition = this.loadBallPosition();
37
+ ballDrag = null;
38
+ suppressBallClick = false;
39
+ viewport = { width: window.innerWidth, height: window.innerHeight };
27
40
  panelContext;
28
- constructor(app, config) {
41
+ constructor(app, config, notifications) {
29
42
  this.app = app;
30
43
  this.config = config;
44
+ this.notifications = notifications;
31
45
  }
32
46
  get activeTerminal() {
33
47
  const tab = this.app.activeTab;
@@ -40,9 +54,113 @@ let QuickButtonsComponent = class QuickButtonsComponent {
40
54
  get settings() {
41
55
  return this.config.store.quickButtons;
42
56
  }
57
+ get layout() {
58
+ const { width, height } = this.viewport;
59
+ const x = this.clamp(this.ballPosition?.x ?? width - ballSize - 24, width - ballSize - edge);
60
+ const y = this.clamp(this.ballPosition?.y ?? height - ballSize - 16, height - ballSize - edge);
61
+ const below = y + ballSize / 2 < height / 2;
62
+ const anchorRight = x + ballSize / 2 >= width / 2;
63
+ const panelWidth = Math.min(380, anchorRight ? x + ballSize - edge : width - x - edge);
64
+ const panelHeight = Math.min(570, (below ? height - y : y + ballSize) - edge);
65
+ return { x, y, panelWidth, panelHeight, panelOffset: anchorRight ? ballSize - panelWidth : 0, below, anchorRight };
66
+ }
67
+ updateViewport() {
68
+ this.viewport = { width: window.innerWidth, height: window.innerHeight };
69
+ }
70
+ clamp(value, limit) {
71
+ return Math.max(edge, Math.min(value, limit));
72
+ }
73
+ loadBallPosition() {
74
+ try {
75
+ const position = JSON.parse(window.localStorage.getItem(positionKey) ?? 'null');
76
+ return Number.isFinite(position?.x) && Number.isFinite(position?.y) ? position : null;
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ }
82
+ startBallDrag(event) {
83
+ if (event.button !== 0 || !event.isPrimary) {
84
+ return;
85
+ }
86
+ this.suppressBallClick = false;
87
+ const { x, y } = this.layout;
88
+ const listeners = new AbortController();
89
+ this.ballDrag = {
90
+ pointerId: event.pointerId,
91
+ pointer: { x: event.clientX, y: event.clientY },
92
+ origin: { x, y },
93
+ listeners,
94
+ };
95
+ const { signal } = listeners;
96
+ window.addEventListener('pointermove', move => this.moveBall(move), { signal });
97
+ window.addEventListener('pointerup', up => this.finishBallDrag(up), { signal });
98
+ window.addEventListener('pointercancel', cancel => this.finishBallDrag(cancel), { signal });
99
+ const button = event.currentTarget;
100
+ button.setPointerCapture(event.pointerId);
101
+ }
102
+ moveBall(event) {
103
+ const drag = this.ballDrag;
104
+ if (!drag || drag.pointerId !== event.pointerId) {
105
+ return;
106
+ }
107
+ const dx = event.clientX - drag.pointer.x;
108
+ const dy = event.clientY - drag.pointer.y;
109
+ if (!this.movingBall && Math.hypot(dx, dy) < 5) {
110
+ return;
111
+ }
112
+ this.movingBall = true;
113
+ this.ballPosition = {
114
+ x: this.clamp(drag.origin.x + dx, this.viewport.width - ballSize - edge),
115
+ y: this.clamp(drag.origin.y + dy, this.viewport.height - ballSize - edge),
116
+ };
117
+ }
118
+ finishBallDrag(event) {
119
+ if (this.ballDrag?.pointerId !== event.pointerId) {
120
+ return;
121
+ }
122
+ this.ballDrag.listeners.abort();
123
+ this.ballDrag = null;
124
+ if (!this.movingBall) {
125
+ return;
126
+ }
127
+ this.movingBall = false;
128
+ this.suppressBallClick = true;
129
+ if (!this.pinned && !this.managing) {
130
+ this.close();
131
+ }
132
+ try {
133
+ window.localStorage.setItem(positionKey, JSON.stringify(this.ballPosition));
134
+ }
135
+ catch {
136
+ this.notifications.info('Quick Buttons moved. This window could not save its position.');
137
+ }
138
+ }
139
+ clickBall(event) {
140
+ if (event.detail && this.suppressBallClick) {
141
+ this.suppressBallClick = false;
142
+ return;
143
+ }
144
+ this.togglePinned();
145
+ }
146
+ togglePinned() {
147
+ if (!this.activeTerminal) {
148
+ this.notifications.info('Open a terminal to use Quick Buttons.');
149
+ return;
150
+ }
151
+ if (this.busy) {
152
+ return;
153
+ }
154
+ if (this.pinned || this.managing) {
155
+ this.close();
156
+ return;
157
+ }
158
+ this.open();
159
+ this.pinned = true;
160
+ }
43
161
  open() {
44
162
  const terminal = this.activeTerminal;
45
- if (!terminal || this.expanded || this.busy) {
163
+ if (!terminal || this.expanded || this.busy || this.movingBall) {
46
164
  return;
47
165
  }
48
166
  this.target = terminal;
@@ -65,14 +183,19 @@ let QuickButtonsComponent = class QuickButtonsComponent {
65
183
  this.panelContext?.unsubscribe();
66
184
  this.target = null;
67
185
  this.managing = false;
186
+ this.pinned = false;
68
187
  this.editor = null;
69
188
  this.error = '';
189
+ this.endCommandDrag();
190
+ this.ballDrag?.listeners.abort();
191
+ this.ballDrag = null;
192
+ this.movingBall = false;
70
193
  }
71
194
  ngOnDestroy() {
72
- this.panelContext?.unsubscribe();
195
+ this.close();
73
196
  }
74
197
  leave() {
75
- if (!this.managing) {
198
+ if (!this.managing && !this.pinned && !this.ballDrag) {
76
199
  this.close();
77
200
  }
78
201
  }
@@ -109,6 +232,60 @@ let QuickButtonsComponent = class QuickButtonsComponent {
109
232
  this.editor = null;
110
233
  this.error = '';
111
234
  }
235
+ startCommandDrag(event, scope, parentPath, entries, index) {
236
+ if (!this.managing || this.editor || this.busy || !event.dataTransfer) {
237
+ event.preventDefault();
238
+ return;
239
+ }
240
+ this.error = '';
241
+ this.dragged = { scope, parentPath, entries, index };
242
+ event.dataTransfer.effectAllowed = 'move';
243
+ event.dataTransfer.setData(commandDragType, 'command');
244
+ }
245
+ overGroup(event, entries) {
246
+ if (!this.dragged || this.dragged.entries === entries || !event.dataTransfer) {
247
+ return;
248
+ }
249
+ event.preventDefault();
250
+ event.dataTransfer.dropEffect = 'move';
251
+ this.dropTarget = entries;
252
+ }
253
+ leaveGroup(event, entries) {
254
+ const target = event.currentTarget;
255
+ if (this.dropTarget === entries && !target.contains(event.relatedTarget)) {
256
+ this.dropTarget = null;
257
+ }
258
+ }
259
+ endCommandDrag() {
260
+ this.dragged = null;
261
+ this.dropTarget = null;
262
+ }
263
+ async dropCommand(event, scope, path, entries) {
264
+ const drag = this.dragged;
265
+ if (!drag || drag.entries === entries || event.dataTransfer?.getData(commandDragType) !== 'command') {
266
+ return;
267
+ }
268
+ event.preventDefault();
269
+ this.endCommandDrag();
270
+ if (!this.managing || !this.expanded || this.editor || this.busy) {
271
+ return;
272
+ }
273
+ const source = this.copyScope(drag.scope);
274
+ const destination = drag.scope === scope ? source : this.copyScope(scope);
275
+ const from = this.entriesAt(source.entries, drag.parentPath);
276
+ const to = this.entriesAt(destination.entries, path);
277
+ const command = from?.[drag.index];
278
+ if (!from || !to || command?.kind !== 'command') {
279
+ this.error = 'The command or group is missing. Start the move again.';
280
+ return;
281
+ }
282
+ from.splice(drag.index, 1);
283
+ to.push(command);
284
+ const changes = destination === source
285
+ ? new Map([[scope, source]])
286
+ : new Map([[drag.scope, source], [scope, destination]]);
287
+ await this.persist(changes);
288
+ }
112
289
  async save() {
113
290
  const editor = this.editor;
114
291
  if (!editor || this.busy) {
@@ -120,25 +297,12 @@ let QuickButtonsComponent = class QuickButtonsComponent {
120
297
  this.error = entry.kind === 'group' ? 'Enter a group name.' : 'Enter an alias and a single line of terminal text.';
121
298
  return;
122
299
  }
123
- const settings = this.settings;
124
- const previous = settings.scopes;
125
- const existing = previous.find(item => item.profileId === scope.profileId);
126
- if (existing !== scope.saved) {
127
- this.refreshScopes();
128
- this.editor = null;
129
- this.error = 'Shortcuts changed elsewhere. Start the edit again.';
300
+ const updated = this.copyScope(scope);
301
+ const entries = this.entriesAt(updated.entries, parentPath);
302
+ if (!entries) {
303
+ this.error = 'The original group is missing. Start the edit again.';
130
304
  return;
131
305
  }
132
- const updated = { profileId: scope.profileId, entries: structuredClone(scope.entries) };
133
- let entries = updated.entries;
134
- for (const groupIndex of parentPath) {
135
- const group = entries[groupIndex];
136
- if (group?.kind !== 'group') {
137
- this.error = 'The original group is missing. Start the edit again.';
138
- return;
139
- }
140
- entries = group.entries;
141
- }
142
306
  if (deleting && index !== undefined) {
143
307
  entries.splice(index, 1);
144
308
  }
@@ -151,10 +315,37 @@ let QuickButtonsComponent = class QuickButtonsComponent {
151
315
  entries[index] = savedEntry;
152
316
  }
153
317
  }
154
- const next = previous.filter(item => item.profileId !== scope.profileId);
155
- if (updated.entries.length) {
156
- next.push(updated);
318
+ await this.persist(new Map([[scope, updated]]));
319
+ }
320
+ copyScope(scope) {
321
+ return { profileId: scope.profileId, entries: structuredClone(scope.entries) };
322
+ }
323
+ entriesAt(entries, path) {
324
+ for (const index of path) {
325
+ const group = entries[index];
326
+ if (group?.kind !== 'group') {
327
+ return undefined;
328
+ }
329
+ entries = group.entries;
330
+ }
331
+ return entries;
332
+ }
333
+ async persist(changes) {
334
+ const settings = this.settings;
335
+ const previous = settings.scopes;
336
+ for (const scope of changes.keys()) {
337
+ if (previous.find(item => item.profileId === scope.profileId) !== scope.saved) {
338
+ this.refreshScopes();
339
+ this.editor = null;
340
+ this.error = 'Shortcuts changed elsewhere. Try again.';
341
+ return;
342
+ }
157
343
  }
344
+ const updated = [...changes.values()];
345
+ const next = [
346
+ ...previous.filter(item => !updated.some(scope => scope.profileId === item.profileId)),
347
+ ...updated.filter(scope => scope.entries.length),
348
+ ];
158
349
  this.busy = true;
159
350
  this.error = '';
160
351
  settings.scopes = next;
@@ -185,6 +376,9 @@ let QuickButtonsComponent = class QuickButtonsComponent {
185
376
  });
186
377
  }
187
378
  };
379
+ __decorate([
380
+ (0, core_1.HostListener)('window:resize')
381
+ ], QuickButtonsComponent.prototype, "updateViewport", null);
188
382
  QuickButtonsComponent = __decorate([
189
383
  (0, core_1.Component)({
190
384
  selector: 'tabby-quick-buttons',
@@ -192,6 +386,7 @@ QuickButtonsComponent = __decorate([
192
386
  styles: [quickButtons_view_1.styles],
193
387
  }),
194
388
  __param(0, (0, core_1.Inject)(tabby_core_1.AppService)),
195
- __param(1, (0, core_1.Inject)(tabby_core_1.ConfigService))
389
+ __param(1, (0, core_1.Inject)(tabby_core_1.ConfigService)),
390
+ __param(2, (0, core_1.Inject)(tabby_core_1.NotificationsService))
196
391
  ], QuickButtonsComponent);
197
392
  exports.QuickButtonsComponent = QuickButtonsComponent;
@@ -2,23 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.styles = exports.template = void 0;
4
4
  exports.template = `
5
- <div class="dock" *ngIf="activeTerminal"
5
+ <div class="dock" *ngIf="activeTerminal && layout as position"
6
+ [style.left.px]="position.x" [style.top.px]="position.y"
6
7
  (pointerenter)="open()" (pointerleave)="leave()"
7
8
  (keydown.escape)="$event.stopPropagation(); close()">
8
- <button type="button" class="ball btn btn-secondary" aria-label="Quick commands"
9
- title="Quick commands" [attr.aria-expanded]="expanded" (click)="open()">
10
- <span aria-hidden="true">›_</span>
9
+ <button type="button" class="ball btn btn-primary" [class.moving]="movingBall"
10
+ [class.integrated]="expanded && !movingBall" aria-label="Quick Buttons"
11
+ title="Quick Buttons · Drag to move" [attr.aria-expanded]="expanded && !movingBall"
12
+ (pointerdown)="startBallDrag($event)"
13
+ (lostpointercapture)="finishBallDrag($event)" (click)="clickBall($event)">
14
+ <svg viewBox="0 0 24 24" width="25" height="25" fill="none" stroke="currentColor" stroke-width="2"
15
+ stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4 7 5 5-5 5m8 0h7"/></svg>
11
16
  </button>
12
17
 
13
- <div class="panel-position" *ngIf="expanded">
14
- <section class="panel" aria-label="Quick commands panel">
18
+ <div class="panel-position" *ngIf="expanded && !movingBall" [class.below]="position.below"
19
+ [class.anchor-right]="position.anchorRight"
20
+ [style.left.px]="position.panelOffset" [style.width.px]="position.panelWidth">
21
+ <section class="panel" aria-label="Quick commands panel" [style.max-height.px]="position.panelHeight">
15
22
  <header class="panel-header">
16
- <strong>Quick commands</strong>
17
- <button *ngIf="!managing" type="button" class="btn btn-sm btn-outline-secondary"
18
- (click)="managing = true">Manage</button>
23
+ <strong>Quick Buttons</strong>
24
+ <div *ngIf="!managing" class="actions">
25
+ <button type="button" class="btn btn-sm btn-outline-secondary"
26
+ (click)="managing = true">Manage</button>
27
+ <button type="button" class="btn btn-sm btn-outline-secondary" aria-label="Close Quick Buttons"
28
+ (click)="close()">×</button>
29
+ </div>
19
30
  <button *ngIf="managing" type="button" class="btn btn-sm btn-outline-secondary"
20
31
  [disabled]="busy" (click)="close()">Done</button>
21
32
  </header>
33
+ <p *ngIf="managing && !editor" class="move-hint">Drag a command onto a group heading to move it.</p>
22
34
 
23
35
  <form *ngIf="editor as draft" class="editor" (submit)="$event.preventDefault(); save()">
24
36
  <ng-container *ngIf="!draft.deleting; else deletePrompt">
@@ -58,7 +70,12 @@ exports.template = `
58
70
 
59
71
  <div class="scope-list">
60
72
  <section class="scope" *ngFor="let scope of scopes">
61
- <div class="row-heading">
73
+ <div class="row-heading"
74
+ [class.drop-ready]="dragged && dragged.entries !== scope.entries"
75
+ [class.drop-active]="dropTarget === scope.entries"
76
+ (dragover)="overGroup($event, scope.entries)"
77
+ (dragleave)="leaveGroup($event, scope.entries)"
78
+ (drop)="dropCommand($event, scope, [], scope.entries)">
62
79
  <strong class="scope-title">{{ scope.title }}</strong>
63
80
  <span class="scope-tag" *ngIf="scope.profileId !== null">Current profile</span>
64
81
  </div>
@@ -82,73 +99,93 @@ exports.template = `
82
99
  [disabled]="editor || busy" (click)="add(scope, path, 'group')">Add group</button>
83
100
  </div>
84
101
  <p *ngIf="!entries.length && !managing" class="empty">No commands yet</p>
85
- <div *ngFor="let entry of entries; let index = index" class="entry">
86
- <ng-container *ngIf="entry.kind === 'group'; else command">
87
- <details open>
88
- <summary>{{ entry.title }}</summary>
89
- <div class="nested">
90
- <div class="actions group-actions" *ngIf="managing">
102
+ <div class="entries" [class.managing]="managing">
103
+ <div *ngFor="let entry of entries; let index = index" class="entry" [class.is-group]="entry.kind === 'group'">
104
+ <ng-container *ngIf="entry.kind === 'group'; else command">
105
+ <details open>
106
+ <summary [class.drop-ready]="dragged && dragged.entries !== entry.entries"
107
+ [class.drop-active]="dropTarget === entry.entries"
108
+ (dragover)="overGroup($event, entry.entries)"
109
+ (dragleave)="leaveGroup($event, entry.entries)"
110
+ (drop)="dropCommand($event, scope, path.concat(index), entry.entries)">{{ entry.title }}</summary>
111
+ <div class="nested">
112
+ <div class="actions group-actions" *ngIf="managing">
113
+ <ng-container *ngTemplateOutlet="editActions"></ng-container>
114
+ </div>
115
+ <ng-container *ngTemplateOutlet="entryList; context: {
116
+ $implicit: entry.entries, scope: scope, path: path.concat(index)
117
+ }"></ng-container>
118
+ </div>
119
+ </details>
120
+ </ng-container>
121
+ <ng-template #command>
122
+ <div class="command-row">
123
+ <span class="command-drag" *ngIf="managing" [attr.draggable]="!editor && !busy"
124
+ (dragstart)="startCommandDrag($event, scope, path, entries, index)"
125
+ (dragend)="endCommandDrag()" title="Drag to another group">
126
+ <span aria-hidden="true" class="grip">⠿</span>
127
+ <span class="command-alias">{{ entry.title }}</span>
128
+ </span>
129
+ <button *ngIf="!managing" type="button" class="command-run"
130
+ [disabled]="!target?.session?.open" (click)="execute(entry, scope)">
131
+ <span class="command-alias">{{ entry.title }}</span>
132
+ </button>
133
+ <div class="actions" *ngIf="managing">
91
134
  <ng-container *ngTemplateOutlet="editActions"></ng-container>
92
135
  </div>
93
- <ng-container *ngTemplateOutlet="entryList; context: {
94
- $implicit: entry.entries, scope: scope, path: path.concat(index)
95
- }"></ng-container>
96
- </div>
97
- </details>
98
- </ng-container>
99
- <ng-template #command>
100
- <div class="command-row">
101
- <span class="command-alias" *ngIf="managing">{{ entry.title }}</span>
102
- <button *ngIf="!managing" type="button" class="command-run"
103
- [disabled]="!target?.session?.open" (click)="execute(entry, scope)">
104
- <span aria-hidden="true" class="prompt">›</span>
105
- <span class="command-alias">{{ entry.title }}</span>
106
- </button>
107
- <div class="actions" *ngIf="managing">
108
- <ng-container *ngTemplateOutlet="editActions"></ng-container>
109
136
  </div>
110
- </div>
111
- </ng-template>
112
- <ng-template #editActions>
113
- <button type="button" class="btn btn-sm btn-outline-secondary"
114
- [disabled]="editor || busy" [attr.aria-label]="'Edit ' + entry.title"
115
- (click)="edit(scope, path, index, entry)">Edit</button>
116
- <button type="button" class="btn btn-sm btn-outline-danger"
117
- [disabled]="editor || busy" [attr.aria-label]="'Delete ' + entry.title"
118
- (click)="edit(scope, path, index, entry, true)">Delete</button>
119
- </ng-template>
137
+ </ng-template>
138
+ <ng-template #editActions>
139
+ <button type="button" class="btn btn-sm btn-outline-secondary"
140
+ [disabled]="editor || busy" [attr.aria-label]="'Edit ' + entry.title"
141
+ (click)="edit(scope, path, index, entry)">Edit</button>
142
+ <button type="button" class="btn btn-sm btn-outline-danger"
143
+ [disabled]="editor || busy" [attr.aria-label]="'Delete ' + entry.title"
144
+ (click)="edit(scope, path, index, entry, true)">Delete</button>
145
+ </ng-template>
146
+ </div>
120
147
  </div>
121
148
  </ng-template>
122
149
  `;
123
150
  exports.styles = `
124
151
  .dock {
125
152
  position: fixed;
126
- right: 24px;
127
- bottom: 16px;
128
153
  z-index: 1020;
129
154
  }
130
155
  .ball {
131
156
  display: grid;
132
157
  place-items: center;
133
- width: 36px;
134
- height: 36px;
158
+ place-content: center;
135
159
  border-radius: 50%;
136
160
  padding: 0;
137
- font: 600 16px ui-monospace, monospace;
138
- opacity: .75;
161
+ width: 52px;
162
+ height: 52px;
163
+ box-shadow: 0 0 0 2px var(--bs-body-bg, #252525), 0 4px 14px #0006;
164
+ cursor: grab;
165
+ touch-action: none;
166
+ user-select: none;
167
+ }
168
+ .ball.moving { cursor: grabbing; }
169
+ .ball svg { pointer-events: none; }
170
+ .ball.integrated {
171
+ position: relative;
172
+ z-index: 1;
173
+ border-color: transparent;
174
+ border-radius: 8px;
175
+ color: var(--bs-body-color);
176
+ background: transparent;
177
+ box-shadow: none;
139
178
  }
140
- .ball:hover, .ball:focus-visible, .ball[aria-expanded="true"] { opacity: 1; }
179
+ .ball.integrated:hover { background: #80808026; }
180
+ .ball.integrated:focus-visible { outline: 2px solid var(--bs-primary, #9689eb); outline-offset: -3px; }
141
181
  .panel-position {
142
182
  position: absolute;
143
- right: 0;
144
- bottom: 100%;
145
- padding-bottom: 8px;
146
- width: min(360px, calc(100vw - 40px));
183
+ bottom: 0;
147
184
  }
185
+ .panel-position.below { top: 0; bottom: auto; }
148
186
  .panel {
149
187
  display: flex;
150
188
  flex-direction: column;
151
- max-height: min(570px, calc(100vh - 78px));
152
189
  border: 1px solid var(--bs-border-color, #555);
153
190
  border-radius: 8px;
154
191
  color: var(--bs-body-color);
@@ -161,8 +198,22 @@ exports.styles = `
161
198
  align-items: center;
162
199
  gap: 8px;
163
200
  }
164
- .panel-header { justify-content: space-between; padding: 10px 12px; }
165
- .panel-header, .editor { border-bottom: 1px solid var(--bs-border-color, #555); }
201
+ .panel-header {
202
+ order: 1;
203
+ flex: none;
204
+ justify-content: space-between;
205
+ min-height: 52px;
206
+ padding: 6px 12px 6px 58px;
207
+ border-top: 1px solid var(--bs-border-color, #555);
208
+ }
209
+ .panel-position.below .panel-header {
210
+ order: 0;
211
+ border-top: none;
212
+ border-bottom: 1px solid var(--bs-border-color, #555);
213
+ }
214
+ .panel-position.anchor-right .panel-header { padding: 6px 58px 6px 12px; }
215
+ .editor { border-bottom: 1px solid var(--bs-border-color, #555); }
216
+ .move-hint { margin: 7px 12px 0; font-size: .85em; opacity: .8; }
166
217
  .scope-list { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 12px 10px; }
167
218
  .scope { padding: 8px 0; }
168
219
  .scope + .scope { border-top: 1px solid var(--bs-border-color, #555); }
@@ -171,29 +222,34 @@ exports.styles = `
171
222
  .scope-tag { flex: none; opacity: .72; font-size: .8em; }
172
223
  .empty { margin: 3px 0; opacity: .75; font-size: .9em; }
173
224
  .profile-hint { padding-bottom: 4px; }
174
- .entry { margin-top: 3px; }
175
- summary { cursor: pointer; padding: 4px 0; }
225
+ .entries { display: flex; flex-wrap: wrap; gap: 5px; }
226
+ .entry { min-width: 0; max-width: 100%; }
227
+ .entry.is-group, .entries.managing > .entry { flex: 0 0 100%; }
228
+ summary { cursor: pointer; padding: 4px; }
229
+ .row-heading { padding: 3px 4px; }
230
+ .drop-ready { outline: 1px dashed var(--bs-primary, #9689eb); border-radius: 4px; }
231
+ .drop-active { background: var(--bs-primary-bg-subtle, #80808040); outline-style: solid; }
176
232
  .nested {
177
233
  border-left: 1px solid var(--bs-border-color, #555);
178
234
  margin-left: 5px;
179
235
  padding-left: 9px;
180
236
  }
181
237
  .command-row { justify-content: space-between; min-height: 30px; }
238
+ .command-drag { display: flex; align-items: center; gap: 6px; min-width: 0; }
239
+ .command-drag[draggable="true"] { cursor: grab; user-select: none; }
240
+ .grip { opacity: .68; }
182
241
  .command-run {
183
- display: flex;
184
- align-items: flex-start;
185
- gap: 8px;
186
- width: 100%;
187
- padding: 4px 6px;
242
+ display: block;
243
+ max-width: 100%;
244
+ padding: 3px 8px;
188
245
  text-align: left;
189
246
  color: inherit;
190
- background: transparent;
191
- border: 0;
247
+ background: #80808017;
248
+ border: 1px solid #80808052;
192
249
  border-radius: 4px;
193
250
  }
194
251
  .command-run:hover:not(:disabled) { background: #80808030; }
195
252
  .command-run:disabled { opacity: .5; }
196
- .prompt { font-family: ui-monospace, monospace; opacity: .7; }
197
253
  .actions { flex-wrap: wrap; }
198
254
  .command-row > .actions { flex: none; }
199
255
  .group-actions { margin: 4px 0; }
@@ -204,7 +260,6 @@ summary { cursor: pointer; padding: 4px 0; }
204
260
  .command-input { font-family: ui-monospace, monospace; }
205
261
  .error { margin: 6px 12px; }
206
262
  @media (max-height: 420px) {
207
- .panel { display: block; overflow: auto; overscroll-behavior: contain; }
208
- .scope-list { overflow: visible; }
263
+ .editor { overflow: auto; max-height: 52vh; }
209
264
  }
210
265
  `;
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "tabby-quick-buttons",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "Floating command shortcuts with shared and per-profile groups for Tabby.",
5
5
  "author": "zp",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/vzpd/tabby-quick-buttons.git"
10
+ },
11
+ "homepage": "https://github.com/vzpd/tabby-quick-buttons#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/vzpd/tabby-quick-buttons/issues"
14
+ },
7
15
  "keywords": [
8
16
  "tabby-plugin"
9
17
  ],