clay-server 5.0.0-beta.2 → 5.0.0-beta.3

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 (50) hide show
  1. package/lib/daemon.js +9 -0
  2. package/lib/new-session-default.js +45 -0
  3. package/lib/project-connection.js +4 -2
  4. package/lib/project-session-creation.js +107 -0
  5. package/lib/project-session-delete.js +21 -3
  6. package/lib/project-session-folder-delete.js +169 -0
  7. package/lib/project-session-folders.js +272 -0
  8. package/lib/project-sessions.js +46 -26
  9. package/lib/project.js +2 -0
  10. package/lib/public/app.js +10 -0
  11. package/lib/public/css/filebrowser.css +3 -3
  12. package/lib/public/css/mates.css +1 -1
  13. package/lib/public/css/mobile-nav.css +0 -128
  14. package/lib/public/css/session-folders.css +383 -0
  15. package/lib/public/css/sidebar.css +28 -545
  16. package/lib/public/index.html +3 -21
  17. package/lib/public/modules/app-favicon.js +5 -4
  18. package/lib/public/modules/app-messages.js +13 -0
  19. package/lib/public/modules/input.js +3 -0
  20. package/lib/public/modules/project-switcher.js +4 -4
  21. package/lib/public/modules/session-create-form.js +428 -0
  22. package/lib/public/modules/session-create.js +338 -0
  23. package/lib/public/modules/session-folder-collapse.js +192 -0
  24. package/lib/public/modules/session-folder-context.js +215 -0
  25. package/lib/public/modules/session-folder-delete.js +313 -0
  26. package/lib/public/modules/session-folder-dialogs.js +173 -0
  27. package/lib/public/modules/session-folder-dnd.js +214 -0
  28. package/lib/public/modules/session-folder-draft.js +184 -0
  29. package/lib/public/modules/session-folder-layout.js +133 -0
  30. package/lib/public/modules/session-folder-toolbar.js +185 -0
  31. package/lib/public/modules/session-folder-view-menu.js +187 -0
  32. package/lib/public/modules/session-folders.js +95 -0
  33. package/lib/public/modules/session-list-search.js +108 -0
  34. package/lib/public/modules/session-presence-ui.js +44 -0
  35. package/lib/public/modules/sidebar-mobile.js +38 -182
  36. package/lib/public/modules/sidebar-session-folders-ui.js +382 -0
  37. package/lib/public/modules/sidebar-sessions.js +141 -718
  38. package/lib/public/modules/sidebar.js +10 -2
  39. package/lib/public/modules/terminal.js +2 -2
  40. package/lib/public/modules/tool-palette.js +37 -219
  41. package/lib/public/style.css +1 -0
  42. package/lib/server.js +4 -0
  43. package/lib/session-folders.js +414 -0
  44. package/lib/sessions.js +7 -5
  45. package/lib/users-session-folder-preferences.js +69 -0
  46. package/lib/users.js +6 -0
  47. package/lib/ws-schema.js +11 -0
  48. package/package.json +1 -1
  49. package/lib/public/modules/session-creation-cta.js +0 -46
  50. package/lib/public/modules/tool-palette-overlays.js +0 -159
@@ -1,159 +0,0 @@
1
- // tool-palette-overlays.js — transient overlays that sit on top of the palette.
2
- //
3
- // Two independent, self-contained pieces extracted from tool-palette.js so
4
- // that module stays under the size limit: the right-click context menu, and
5
- // the Cmd/Ctrl+O hotkey pick mode. Neither owns palette state; the menu takes
6
- // its items (and their actions) from the caller, and pick mode works purely
7
- // off the rendered tiles. Behavior is unchanged by the move.
8
-
9
- import { PALETTES } from './tool-palette-order.js';
10
-
11
- // --- Right-click context menu ---
12
-
13
- var _openMenu = null;
14
-
15
- export function openPaletteContextMenu(x, y, items) {
16
- closePaletteContextMenu();
17
- var menu = document.createElement('div');
18
- menu.className = 'tool-palette-ctx-menu';
19
- for (var i = 0; i < items.length; i++) {
20
- (function (item) {
21
- var btn = document.createElement('button');
22
- btn.type = 'button';
23
- btn.className = 'tool-palette-ctx-item';
24
- btn.textContent = item.label;
25
- btn.addEventListener('click', function (e) {
26
- e.stopPropagation();
27
- closePaletteContextMenu();
28
- item.action();
29
- });
30
- menu.appendChild(btn);
31
- })(items[i]);
32
- }
33
- document.body.appendChild(menu);
34
- // Clamp to viewport.
35
- var rect = menu.getBoundingClientRect();
36
- var px = x, py = y;
37
- if (px + rect.width > window.innerWidth - 4) px = window.innerWidth - rect.width - 4;
38
- if (py + rect.height > window.innerHeight - 4) py = window.innerHeight - rect.height - 4;
39
- menu.style.left = px + 'px';
40
- menu.style.top = py + 'px';
41
- _openMenu = menu;
42
- }
43
-
44
- export function closePaletteContextMenu() {
45
- if (_openMenu && _openMenu.parentNode) _openMenu.parentNode.removeChild(_openMenu);
46
- _openMenu = null;
47
- }
48
-
49
- document.addEventListener('click', function () { closePaletteContextMenu(); });
50
- document.addEventListener('keydown', function (e) {
51
- if (e.key === 'Escape') closePaletteContextMenu();
52
- });
53
- window.addEventListener('blur', function () { closePaletteContextMenu(); });
54
- window.addEventListener('resize', function () { closePaletteContextMenu(); });
55
-
56
- // --- Hotkey overlay (Cmd/Ctrl + O) ---
57
- //
58
- // Press Cmd/Ctrl + O to reveal a hotkey badge on each visible palette
59
- // tile. Then press the shown digit (1..9, 0) or letter (a..z) to
60
- // activate that tool. Escape or clicking away dismisses. Inspired by
61
- // Vimium / Superhuman-style "pick a tile with one keystroke" flows.
62
-
63
- var _pickActive = false;
64
- var HOTKEYS = (function () {
65
- var k = [];
66
- for (var i = 1; i <= 9; i++) k.push(String(i));
67
- k.push('0');
68
- for (var c = 97; c <= 122; c++) k.push(String.fromCharCode(c));
69
- return k;
70
- })();
71
-
72
- function getVisiblePaletteName() {
73
- // offsetParent is null when the element (or an ancestor) is hidden.
74
- var mateActive = document.getElementById('mate-sidebar-tools');
75
- if (mateActive && mateActive.offsetParent !== null) return 'mate';
76
- var sessionActive = document.getElementById('session-actions');
77
- if (sessionActive && sessionActive.offsetParent !== null) return 'session';
78
- return null;
79
- }
80
-
81
- export function enterToolPickMode() {
82
- if (_pickActive) return;
83
- var name = getVisiblePaletteName();
84
- if (!name) return;
85
- var active = document.getElementById(PALETTES[name].activeContainerId);
86
- if (!active) return;
87
- var tiles = active.querySelectorAll('[data-tool-id]');
88
- if (tiles.length === 0) return;
89
- for (var i = 0; i < tiles.length && i < HOTKEYS.length; i++) {
90
- var key = HOTKEYS[i];
91
- tiles[i].dataset.hotkey = key;
92
- var badge = document.createElement('span');
93
- badge.className = 'tool-palette-hotkey-badge';
94
- badge.textContent = key.toUpperCase();
95
- tiles[i].appendChild(badge);
96
- }
97
- _pickActive = true;
98
- }
99
-
100
- export function exitToolPickMode() {
101
- if (!_pickActive) return;
102
- _pickActive = false;
103
- var badges = document.querySelectorAll('.tool-palette-hotkey-badge');
104
- for (var i = 0; i < badges.length; i++) {
105
- if (badges[i].parentNode) badges[i].parentNode.removeChild(badges[i]);
106
- }
107
- var marked = document.querySelectorAll('[data-hotkey]');
108
- for (var j = 0; j < marked.length; j++) {
109
- delete marked[j].dataset.hotkey;
110
- }
111
- }
112
-
113
- // Capture phase so we reliably preempt typing and browser shortcuts
114
- // when focus is in an input.
115
- document.addEventListener('keydown', function (e) {
116
- // Pick mode: consume the next printable key.
117
- if (_pickActive) {
118
- if (e.key === 'Escape') {
119
- e.preventDefault();
120
- exitToolPickMode();
121
- return;
122
- }
123
- // Ignore modifier-only keys; react to single-character keys.
124
- if (e.key.length !== 1) return;
125
- if (e.ctrlKey || e.metaKey || e.altKey) return;
126
- var key = e.key.toLowerCase();
127
- var tile = document.querySelector('[data-hotkey="' + key + '"]');
128
- if (tile) {
129
- e.preventDefault();
130
- exitToolPickMode();
131
- tile.click();
132
- } else {
133
- // Unknown key exits pick mode without triggering a tile.
134
- exitToolPickMode();
135
- }
136
- return;
137
- }
138
-
139
- // Enter pick mode on Cmd/Ctrl + O (letter O). Intercepted globally
140
- // including inside text inputs — the browser's native Cmd+O is a
141
- // file-picker dialog Clay never wants, so taking it over costs the
142
- // user nothing and is especially useful when jumping to a tool from
143
- // the session search box.
144
- if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key && e.key.toLowerCase() === 'o') {
145
- if (!getVisiblePaletteName()) return;
146
- e.preventDefault();
147
- enterToolPickMode();
148
- }
149
- }, true);
150
-
151
- // Dismiss the overlay on click-away, blur, or viewport changes so it
152
- // never lingers invisibly.
153
- document.addEventListener('click', function () { if (_pickActive) exitToolPickMode(); });
154
- window.addEventListener('blur', function () { if (_pickActive) exitToolPickMode(); });
155
- window.addEventListener('resize', function () { if (_pickActive) exitToolPickMode(); });
156
-
157
- export function isToolPickActive() {
158
- return _pickActive;
159
- }