clay-server 5.5.2 → 5.6.0-beta.2
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/lib/project-connection.js +24 -2
- package/lib/project-entry-policy.js +55 -0
- package/lib/project-session-actions.js +4 -0
- package/lib/project.js +3 -0
- package/lib/public/app.js +2 -0
- package/lib/public/appearance-bootstrap.js +2 -1
- package/lib/public/css/chrome-material.css +22 -5
- package/lib/public/css/navigation-island.css +72 -8
- package/lib/public/css/project-empty-canvas.css +43 -0
- package/lib/public/css/split-view-layout.css +3 -3
- package/lib/public/css/title-bar.css +1 -1
- package/lib/public/css/tool-pane.css +5 -5
- package/lib/public/css/workspace-background-gallery.css +3 -3
- package/lib/public/index.html +1 -0
- package/lib/public/modules/app-connection.js +1 -1
- package/lib/public/modules/app-messages.js +8 -1
- package/lib/public/modules/appearance-preferences.js +3 -2
- package/lib/public/modules/command-palette.js +1 -1
- package/lib/public/modules/pane-appearance-bridge.js +1 -1
- package/lib/public/modules/project-empty-canvas.js +159 -0
- package/lib/public/modules/projects-hub-view.js +1 -1
- package/lib/public/modules/split-pane-header-state.js +4 -5
- package/lib/public/modules/split-pane-renderer.js +3 -9
- package/lib/public/modules/split-session-boundary.js +1 -0
- package/lib/public/modules/split-view-close-actions.js +40 -0
- package/lib/public/modules/split-view-picker-render.js +13 -13
- package/lib/public/modules/split-view-presentation-close.js +9 -5
- package/lib/public/modules/split-view-presentation-renderer.js +5 -0
- package/lib/public/modules/split-view-presentations.js +19 -33
- package/lib/public/modules/split-view.js +7 -1
- package/lib/public/modules/theme.js +1 -1
- package/lib/public/modules/view-workspace-controller.js +6 -2
- package/lib/public/modules/workspace-background-gallery.js +16 -11
- package/lib/public/pane-assets/{app-H6UV34XQ.js → app-Y3UNQJAF.js} +1 -1
- package/lib/public/pane-assets/{chunk-67B5MWKR.js → chunk-3HH6CEO5.js} +1 -1
- package/lib/public/pane-assets/chunk-5JCXUWGC.js +1 -0
- package/lib/public/pane-assets/{chunk-633SGCT2.js → chunk-5Z22SHOM.js} +1 -1
- package/lib/public/pane-assets/{chunk-VAS6LSXR.js → chunk-76XI36Y7.js} +1 -1
- package/lib/public/pane-assets/chunk-BCUZ5CU4.js +1 -0
- package/lib/public/pane-assets/{chunk-IHK2VFL6.js → chunk-BHQLADRL.js} +1 -1
- package/lib/public/pane-assets/{chunk-TJYXZQL7.js → chunk-DCIX62EV.js} +1 -1
- package/lib/public/pane-assets/{chunk-T6XZ4HSS.js → chunk-DK5TJRPY.js} +1 -1
- package/lib/public/pane-assets/{chunk-XUTPUOOM.js → chunk-DNZONOJO.js} +1 -1
- package/lib/public/pane-assets/{chunk-MY6UBTTY.js → chunk-FFGCYBLP.js} +1 -1
- package/lib/public/pane-assets/{chunk-RTJ34GHZ.js → chunk-HA7YSD4A.js} +1 -1
- package/lib/public/pane-assets/chunk-IX4TRTWV.js +1 -0
- package/lib/public/pane-assets/{chunk-T5JS6E2K.js → chunk-JD65ITOS.js} +1 -1
- package/lib/public/pane-assets/chunk-JYKTJDXQ.js +1 -0
- package/lib/public/pane-assets/{chunk-KMFUU6Q2.js → chunk-M6IVTHY2.js} +1 -1
- package/lib/public/pane-assets/chunk-MHIJP27M.js +1 -0
- package/lib/public/pane-assets/{chunk-Z77CGAMT.js → chunk-S7RDX7Z7.js} +97 -97
- package/lib/public/pane-assets/{chunk-NEM3WBSD.js → chunk-SBLWP3OO.js} +1 -1
- package/lib/public/pane-assets/{chunk-YGHAWNJX.js → chunk-XUDCXLKZ.js} +1 -1
- package/lib/public/pane-assets/{chunk-2EMRY2BT.js → chunk-YIMKBG4B.js} +1 -1
- package/lib/public/pane-assets/{chunk-ZPRL32HE.js → chunk-YSP3IUTM.js} +1 -1
- package/lib/public/pane-assets/chunk-Z2APTNHP.js +1 -0
- package/lib/public/pane-assets/chunk-ZH3SEVMH.js +1 -0
- package/lib/public/pane-assets/manifest.json +392 -390
- package/lib/public/pane-assets/style-KPZA4PQD.css +1 -0
- package/lib/public/workspace-art/classic-mac-dither.svg +1 -0
- package/lib/public/workspace-art/clay-aqua.webp +0 -0
- package/lib/public/workspace-art/clay-clouds.webp +0 -0
- package/lib/public/workspace-art/clay-cove.webp +0 -0
- package/lib/public/workspace-art/clay-embossed.webp +0 -0
- package/lib/public/workspace-art/clay-galaxy.webp +0 -0
- package/lib/public/workspace-art/clay-light.webp +0 -0
- package/lib/public/workspace-art/clay-mates.webp +0 -0
- package/lib/public/workspace-art/clay-meadow.webp +0 -0
- package/lib/public/workspace-art/clay-memphis.webp +0 -0
- package/lib/public/workspace-art/clay-silicon.webp +0 -0
- package/lib/public/workspace-background-catalog.js +45 -4
- package/lib/server-appearance-settings.js +2 -2
- package/lib/server.js +1 -1
- package/lib/sessions.js +15 -1
- package/lib/user-presence.js +26 -0
- package/lib/ws-schema.js +1 -0
- package/package.json +1 -1
- package/lib/public/pane-assets/chunk-54AIJGMD.js +0 -1
- package/lib/public/pane-assets/chunk-A33CACT7.js +0 -1
- package/lib/public/pane-assets/chunk-CZBPKNRD.js +0 -1
- package/lib/public/pane-assets/chunk-EZHZ5MFM.js +0 -1
- package/lib/public/pane-assets/chunk-P36WWGYN.js +0 -1
- package/lib/public/pane-assets/chunk-XLUV3TB5.js +0 -1
- package/lib/public/pane-assets/chunk-XXMTHJBP.js +0 -1
- package/lib/public/pane-assets/style-F4MQRRX2.css +0 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// The empty workspace reuses the split picker without an enclosing pane.
|
|
2
|
+
import { store } from './store.js';
|
|
3
|
+
import { startNewSession } from './sidebar-sessions.js';
|
|
4
|
+
import { retryOptions, createOptions } from './session-create.js';
|
|
5
|
+
import { switchToStandalone } from './split-view-presentations.js';
|
|
6
|
+
import { renderPicker, renderPickerResults, pickerCandidates } from './split-view-picker-render.js';
|
|
7
|
+
import { activeSavedView } from './view-workspace-state.js';
|
|
8
|
+
import { layoutScope, currentLayoutScope } from './split-view-layout-scope.js';
|
|
9
|
+
|
|
10
|
+
var CANVAS_ID = 'project-empty-canvas';
|
|
11
|
+
function canvasElement() { return document.getElementById(CANVAS_ID); }
|
|
12
|
+
export function viewHasOpenPanes(view) {
|
|
13
|
+
return !!(view && view.workspace && Array.isArray(view.workspace.panes) && view.workspace.panes.some(function (pane) { return pane.open; }));
|
|
14
|
+
}
|
|
15
|
+
export function presentableWithoutSessions(view, sessions) {
|
|
16
|
+
return viewHasOpenPanes(view) || !(sessions || []).length;
|
|
17
|
+
}
|
|
18
|
+
function standaloneScope() {
|
|
19
|
+
var state = store.snap();
|
|
20
|
+
return { standalone: true, context: state.projectSplitViewContextKey || null, slug: state.currentSlug || null,
|
|
21
|
+
owner: state.currentProjectOwnerId || null, viewer: state.myUserId || null, generation: state.projectSplitViewSocketGeneration || 0 };
|
|
22
|
+
}
|
|
23
|
+
function currentPickerScope(scope) {
|
|
24
|
+
if (scope && scope.standalone) {
|
|
25
|
+
var state = store.snap();
|
|
26
|
+
return !state.projectSplitViewActiveId && !state.projectSplitViewSingletonOrigin && !state.splitPanes &&
|
|
27
|
+
scope.context === (state.projectSplitViewContextKey || null) && scope.slug === (state.currentSlug || null) &&
|
|
28
|
+
scope.owner === (state.currentProjectOwnerId || null) && scope.viewer === (state.myUserId || null) &&
|
|
29
|
+
scope.generation === (state.projectSplitViewSocketGeneration || 0);
|
|
30
|
+
}
|
|
31
|
+
return currentLayoutScope(scope);
|
|
32
|
+
}
|
|
33
|
+
function updatePicker(change) {
|
|
34
|
+
var state = store.get('projectStartPicker');
|
|
35
|
+
if (state) store.set({ projectStartPicker: Object.assign({}, state, change) });
|
|
36
|
+
}
|
|
37
|
+
function createSession(vendor) {
|
|
38
|
+
var state = store.get('projectStartPicker');
|
|
39
|
+
if (!state || state.pending || !currentPickerScope(state.scope) ||
|
|
40
|
+
!createOptions().vendors.some(function (item) { return item.id === vendor && item.installed; })) return;
|
|
41
|
+
var requestId = 'project-start-' + (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function' ? crypto.randomUUID() : Date.now().toString(36) + '-' + Math.random().toString(36).slice(2));
|
|
42
|
+
updatePicker({ pending: requestId, error: '' });
|
|
43
|
+
if (!startNewSession(vendor, { forceNew: true, activate: false, slug: store.get('currentSlug'), requestId: requestId })) {
|
|
44
|
+
updatePicker({ pending: null, error: 'Not connected. Reconnect and try again.' });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
setTimeout(function () {
|
|
48
|
+
var current = store.get('projectStartPicker');
|
|
49
|
+
if (current && current.pending === requestId) updatePicker({ pending: null, error: 'Creation was not confirmed. Check the sidebar before trying again.' });
|
|
50
|
+
}, 30000);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// A stale acknowledgement must never select a session in another workspace.
|
|
54
|
+
export function handleEmptyCanvasNewSessionResult(msg) {
|
|
55
|
+
var state = store.get('projectStartPicker');
|
|
56
|
+
if (!state || !state.pending || msg.requestId !== state.pending) return false;
|
|
57
|
+
var current = currentPickerScope(state.scope) && !state.dismissed;
|
|
58
|
+
updatePicker({ pending: null, error: msg.ok ? '' : msg.error || 'The session could not be created.' });
|
|
59
|
+
if (current && msg.ok && typeof msg.sessionId === 'number') switchToStandalone(msg.sessionId);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function onClick(event) {
|
|
64
|
+
var button = event.target.closest('button'), state = store.get('projectStartPicker');
|
|
65
|
+
if (!button || button.disabled || !state || state.pending || !currentPickerScope(state.scope)) return;
|
|
66
|
+
if (button.dataset.splitRetry) { retryOptions(); return; }
|
|
67
|
+
if (button.dataset.splitVendor) { createSession(button.dataset.splitVendor); return; }
|
|
68
|
+
var id = Number(button.dataset.splitSession);
|
|
69
|
+
if (pickerCandidates(state.query, true).some(function (session) { return session.id === id; })) switchToStandalone(id);
|
|
70
|
+
}
|
|
71
|
+
function onKey(event) {
|
|
72
|
+
var menu = canvasElement();
|
|
73
|
+
if (event.key === 'Escape') {
|
|
74
|
+
event.preventDefault(); event.stopPropagation();
|
|
75
|
+
if (menu.contains(document.activeElement)) document.activeElement.blur();
|
|
76
|
+
updatePicker({ dismissed: true });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (['ArrowDown', 'ArrowUp', 'Home', 'End', 'Enter'].indexOf(event.key) < 0) return;
|
|
80
|
+
if (event.target.tagName === 'INPUT' && ['Home', 'End'].indexOf(event.key) >= 0) return;
|
|
81
|
+
var items = Array.from(menu.querySelectorAll('[data-split-session], [data-split-vendor]')).filter(function (item) { return !item.disabled; });
|
|
82
|
+
if (!items.length) return;
|
|
83
|
+
if (event.key === 'Enter') {
|
|
84
|
+
if (event.target.tagName === 'INPUT') { event.preventDefault(); items[0].click(); }
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
var index = items.indexOf(document.activeElement);
|
|
89
|
+
var next = event.key === 'Home' ? 0 : event.key === 'End' ? items.length - 1 : index < 0 ? event.key === 'ArrowUp' ? items.length - 1 : 0 : (index + (event.key === 'ArrowUp' ? -1 : 1) + items.length) % items.length;
|
|
90
|
+
items[next].focus();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function renderProjectEmptyCanvas(host, nativeApp) {
|
|
94
|
+
if (!host) return;
|
|
95
|
+
var root = canvasElement();
|
|
96
|
+
if (!root || root.parentNode !== host || !currentPickerScope((store.get('projectStartPicker') || {}).scope)) {
|
|
97
|
+
clearProjectEmptyCanvas();
|
|
98
|
+
root = document.createElement('section');
|
|
99
|
+
root.id = CANVAS_ID;
|
|
100
|
+
root.className = 'split-view-arrange split-session-picker';
|
|
101
|
+
root.setAttribute('role', 'dialog');
|
|
102
|
+
root.setAttribute('aria-label', 'Open a session');
|
|
103
|
+
host.appendChild(root);
|
|
104
|
+
var scope = activeSavedView() ? layoutScope(activeSavedView()) : standaloneScope();
|
|
105
|
+
store.set({ projectStartPicker: { projectStart: true, side: 'right', query: '', error: '', pending: null, dismissed: false, scope: scope } });
|
|
106
|
+
renderPicker(root, store.get('projectStartPicker'));
|
|
107
|
+
root.addEventListener('click', onClick);
|
|
108
|
+
root.addEventListener('keydown', onKey);
|
|
109
|
+
root.addEventListener('input', function (event) {
|
|
110
|
+
updatePicker({ query: event.target.value });
|
|
111
|
+
root.querySelector('.split-session-section').textContent = event.target.value ? 'Search results' : 'Recent sessions';
|
|
112
|
+
});
|
|
113
|
+
if (!createOptions().loaded) retryOptions();
|
|
114
|
+
}
|
|
115
|
+
host.classList.add('visible', 'project-start-visible');
|
|
116
|
+
// A closed pane may leave the split canvas geometry on the shared host.
|
|
117
|
+
// The empty workspace uses normal flex centering and preserves its children.
|
|
118
|
+
host.classList.remove('split-view-canvas', 'split-view-preview-only');
|
|
119
|
+
delete host.dataset.positioned;
|
|
120
|
+
delete host.dataset.singlePane;
|
|
121
|
+
delete host.dataset.previewOnly;
|
|
122
|
+
if (nativeApp) nativeApp.classList.add('split-native-hidden');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function showStandaloneEmptyCanvas(host, nativeApp) {
|
|
126
|
+
store.set({ projectSplitViewSingletonOrigin: null, projectStartPicker: {
|
|
127
|
+
projectStart: true, side: 'right', query: '', error: '', pending: null, dismissed: false, scope: standaloneScope()
|
|
128
|
+
} });
|
|
129
|
+
renderProjectEmptyCanvas(host, nativeApp);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function clearProjectEmptyCanvas() {
|
|
133
|
+
var root = canvasElement();
|
|
134
|
+
var host = document.getElementById('split-host');
|
|
135
|
+
if (host) host.classList.remove('project-start-visible');
|
|
136
|
+
if (root) root.remove();
|
|
137
|
+
if (store.get('projectStartPicker')) store.set({ projectStartPicker: null });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
store.subscribe(function (state, previous) {
|
|
141
|
+
var root = canvasElement();
|
|
142
|
+
if (!root || !state.projectStartPicker) return;
|
|
143
|
+
root.hidden = !!state.projectStartPicker.dismissed;
|
|
144
|
+
if (state.projectStartPicker !== previous.projectStartPicker || state.paneBindingSessions !== previous.paneBindingSessions ||
|
|
145
|
+
state.sessionCreateOptions !== previous.sessionCreateOptions || state.connected !== previous.connected) {
|
|
146
|
+
renderPickerResults(root, state.projectStartPicker);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// This decision arrives only on project entry; elapsed time never navigates a live tab.
|
|
151
|
+
export function handleProjectEntry(msg) {
|
|
152
|
+
if (store.get('paneMode') || store.get('dmMode') || msg.projectSlug !== store.get('currentSlug')) return false;
|
|
153
|
+
store.set({ projectEntryEmpty: msg.empty === true });
|
|
154
|
+
if (msg.empty === true) {
|
|
155
|
+
store.set({ activeSessionId: null, sessionOriginId: null, projectSplitViewActiveId: null, projectSplitViewSingletonOrigin: null, splitPanes: null });
|
|
156
|
+
showStandaloneEmptyCanvas(document.getElementById('split-host'), document.getElementById('app'));
|
|
157
|
+
}
|
|
158
|
+
return msg.empty === true;
|
|
159
|
+
}
|
|
@@ -39,7 +39,7 @@ export function projectsHubContent(state) {
|
|
|
39
39
|
var mateReady = !!state.connected && clayMateReady(state);
|
|
40
40
|
return '<main class="projects-main" aria-labelledby="projects-title"><section class="projects-welcome"><div class="projects-eyebrow">WELCOME TO</div>' +
|
|
41
41
|
'<h1 id="projects-title" tabindex="-1"><span class="projects-wordmark" role="img" aria-label="Clay Studio"></span></h1>' +
|
|
42
|
-
'<p class="projects-lead">Where
|
|
42
|
+
'<p class="projects-lead">Where minds work together</p>' +
|
|
43
43
|
'<div class="projects-intro-grid">' +
|
|
44
44
|
welcomeCard('01 / PROJECTS', 'Work together on a project.', 'Bring a codebase or a folder of files, and work through it together with Clay Studio.',
|
|
45
45
|
button('create-project', 'Start a project ' + iconHtml('arrow-right'), 'projects-button-primary', !available), 'project-clay') +
|
|
@@ -43,11 +43,10 @@ export function syncPaneHeaderState(paneEl) {
|
|
|
43
43
|
}
|
|
44
44
|
var close = paneEl.querySelector('.split-pane-close');
|
|
45
45
|
if (close) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
close.
|
|
50
|
-
close.disabled = !ready || singletonOnly;
|
|
46
|
+
close.hidden = false;
|
|
47
|
+
close.disabled = !ready;
|
|
48
|
+
close.title = 'Close pane';
|
|
49
|
+
close.setAttribute('aria-label', 'Close pane');
|
|
51
50
|
}
|
|
52
51
|
var title = paneEl.querySelector('.split-pane-title');
|
|
53
52
|
if (title) title.setAttribute('aria-disabled', ready ? 'false' : 'true');
|
|
@@ -318,9 +318,6 @@ export function createSplitPane(pane, closePane) {
|
|
|
318
318
|
var fullAccess = createPermissionControl("split-pane-full-access hidden", "Driver session permission mode");
|
|
319
319
|
updatePaneFullAccessButton(fullAccess, session); bindPermissionControl(fullAccess, function () { return permissionState(sessionById(Number(paneEl.dataset.sessionId))); }); header.appendChild(fullAccess); header.insertBefore(fullAccess, ctxChip);
|
|
320
320
|
var close = document.createElement("button"); close.type = "button"; close.className = "split-pane-close"; close.title = "Close pane"; close.setAttribute("aria-label", "Close pane"); close.innerHTML = iconHtml("x");
|
|
321
|
-
if (store.get('projectSplitViewSingletonOrigin') === (session && session.sessionOriginId)) {
|
|
322
|
-
close.hidden = true; close.title = "The only pane cannot be closed"; close.setAttribute("aria-label", "The only pane cannot be closed");
|
|
323
|
-
}
|
|
324
321
|
close.dataset.sessionId = String(pane.sessionId); close.addEventListener("click", function () { if (syncPaneHeaderState(paneEl)) closePane(Number(this.dataset.sessionId)); }); header.appendChild(close);
|
|
325
322
|
var info = document.createElement("button"); info.type = "button"; info.className = "split-pane-info"; info.setAttribute("aria-label", "Session information"); info.title = "Session information"; info.innerHTML = iconHtml("info");
|
|
326
323
|
info.addEventListener("click", function (event) { event.stopPropagation(); if (syncPaneHeaderState(paneEl)) togglePaneInfo(info, frame); }); identity.insertBefore(info, title.nextSibling);
|
|
@@ -472,13 +469,10 @@ export function updateSplitPaneMetadata(paneEl, pane) {
|
|
|
472
469
|
export function updateSplitPaneCloseVisibility(paneEl, sessionId) {
|
|
473
470
|
var close = paneEl && paneEl.querySelector('.split-pane-close');
|
|
474
471
|
if (!close) return;
|
|
475
|
-
var paneHost = paneEl.parentNode;
|
|
476
|
-
var singletonOnly = !!paneHost && paneHost.id === 'split-host' && paneHost.dataset && paneHost.dataset.singlePane === 'true' &&
|
|
477
|
-
paneHost.querySelectorAll(':scope > .split-pane').length === 1;
|
|
478
472
|
if (sessionId != null) close.dataset.sessionId = String(sessionId);
|
|
479
|
-
close.hidden =
|
|
480
|
-
close.disabled =
|
|
481
|
-
close.title =
|
|
473
|
+
close.hidden = false;
|
|
474
|
+
close.disabled = false;
|
|
475
|
+
close.title = "Close pane";
|
|
482
476
|
close.setAttribute("aria-label", close.title);
|
|
483
477
|
}
|
|
484
478
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { store } from './store.js';
|
|
2
|
+
import { getCachedSessions } from './sidebar-sessions.js';
|
|
3
|
+
import { validPresentationClose } from './split-view-presentation-close.js';
|
|
4
|
+
import { removeViewSession } from './split-view-member-actions.js';
|
|
5
|
+
import { showStandaloneEmptyCanvas } from './project-empty-canvas.js';
|
|
6
|
+
|
|
7
|
+
function viewExists(views, id) {
|
|
8
|
+
return (views || []).find(function (item) { return item.id === id; }) || null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function handlePresentationClose(detail, host, nativeApp) {
|
|
12
|
+
var view = viewExists(store.get('projectSplitViews'), store.get('projectSplitViewActiveId'));
|
|
13
|
+
if (!detail || !validPresentationClose(detail)) return;
|
|
14
|
+
if (!view && detail.kind === 'singleton') {
|
|
15
|
+
var standaloneSession = (getCachedSessions() || []).find(function (item) { return item.id === Number(detail.sessionId); });
|
|
16
|
+
if (!standaloneSession || standaloneSession.sessionOriginId !== detail.sessionOriginId ||
|
|
17
|
+
store.get('projectSplitViewSingletonOrigin') !== standaloneSession.sessionOriginId) return;
|
|
18
|
+
showStandaloneEmptyCanvas(host, nativeApp);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!view || detail.kind !== 'saved-view') return;
|
|
22
|
+
var session = (getCachedSessions() || []).find(function (item) { return item.id === Number(detail.sessionId); });
|
|
23
|
+
if (!session || !view.sessions.some(function (item) { return item.sessionOriginId === session.sessionOriginId; })) return;
|
|
24
|
+
removeViewSession(view, session.sessionOriginId);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function reopenEmptyCanvasSession(row, switchToStandalone) {
|
|
28
|
+
var picker = store.get('projectStartPicker');
|
|
29
|
+
var session = row && picker && picker.projectStart && (getCachedSessions() || []).find(function (item) { return item.id === Number(row.dataset.sessionId); });
|
|
30
|
+
if (!session) return false;
|
|
31
|
+
return switchToStandalone(session.id) !== false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function handleEmptyCanvasSidebarClick(target, event, switchToStandalone) {
|
|
35
|
+
var row = target.closest(".session-item[data-session-id], .session-loop-child[data-session-id]"), picker = store.get('projectStartPicker');
|
|
36
|
+
if (!row || !picker || !picker.projectStart || target.closest(".session-row-actions button, .session-linear-link, input, textarea, select, [contenteditable='true']")) return false;
|
|
37
|
+
reopenEmptyCanvasSession(row, switchToStandalone);
|
|
38
|
+
event.preventDefault(); event.stopImmediatePropagation();
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
@@ -19,23 +19,23 @@ function age(time) {
|
|
|
19
19
|
var minutes = Math.max(0, Math.floor((Date.now() - (time || 0)) / 60000));
|
|
20
20
|
return minutes < 1 ? 'Now' : minutes < 60 ? minutes + 'm' : minutes < 1440 ? Math.floor(minutes / 60) + 'h' : Math.floor(minutes / 1440) + 'd';
|
|
21
21
|
}
|
|
22
|
-
export function pickerCandidates(query) {
|
|
22
|
+
export function pickerCandidates(query, projectStart) {
|
|
23
23
|
var view = activeSavedView(), text = (query || '').trim().toLocaleLowerCase();
|
|
24
24
|
return (getCachedSessions() || []).filter(function (session) {
|
|
25
|
-
return view && session.sessionOriginId && !session.hidden && session.sessionRole !== 'worker' && !session.isMate && !session.isTui &&
|
|
26
|
-
(session.ownerId || null) === (store.get('myUserId') || null) && !view.sessions.some(function (ref) { return ref.sessionOriginId === session.sessionOriginId; }) &&
|
|
25
|
+
return (projectStart || view) && session.sessionOriginId && !session.hidden && session.sessionRole !== 'worker' && !session.isMate && !session.isTui &&
|
|
26
|
+
(session.ownerId || null) === (store.get('myUserId') || null) && (projectStart || !view.sessions.some(function (ref) { return ref.sessionOriginId === session.sessionOriginId; })) &&
|
|
27
27
|
(!text || (session.title || 'New session').toLocaleLowerCase().indexOf(text) >= 0);
|
|
28
28
|
}).sort(function (a, b) { return (b.lastActivity || b.createdAt || 0) - (a.lastActivity || a.createdAt || 0); }).slice(0, text ? 40 : 6);
|
|
29
29
|
}
|
|
30
|
-
export function renderPickerResults(menu) {
|
|
31
|
-
var state = store.get('splitSessionPicker'); if (!state) return;
|
|
30
|
+
export function renderPickerResults(menu, model) {
|
|
31
|
+
var state = model || store.get('splitSessionPicker'); if (!state) return;
|
|
32
32
|
var list = menu.querySelector('.split-session-results'); if (!list) return;
|
|
33
33
|
var focused = menu.contains(document.activeElement) && document.activeElement.dataset, focusKey = focused && (focused.splitSession ? ['splitSession', focused.splitSession] : focused.splitVendor ? ['splitVendor', focused.splitVendor] : null);
|
|
34
34
|
list.replaceChildren();
|
|
35
|
-
var candidates = pickerCandidates(state.query), blocked = !pickerCapacity() || !!store.get('projectSplitViewPending') || !!store.get('splitSessionCreation');
|
|
35
|
+
var candidates = pickerCandidates(state.query, state.projectStart), blocked = state.projectStart ? !!state.pending || !store.get('connected') : !pickerCapacity() || !!store.get('projectSplitViewPending') || !!store.get('splitSessionCreation');
|
|
36
36
|
candidates.forEach(function (session) {
|
|
37
|
-
var title = session.title || 'New session', owner = viewForOrigin(session.sessionOriginId);
|
|
38
|
-
var choice = button('Add ' + title, 'splitSession', String(session.id)); choice.className = 'split-session-result'; choice.disabled = blocked;
|
|
37
|
+
var title = session.title || 'New session', owner = !state.projectStart && viewForOrigin(session.sessionOriginId);
|
|
38
|
+
var choice = button((state.projectStart ? 'Open ' : 'Add ') + title, 'splitSession', String(session.id)); choice.className = 'split-session-result'; choice.disabled = blocked;
|
|
39
39
|
choice.appendChild(vendorIcon(session.vendor));
|
|
40
40
|
var content = document.createElement('span'); content.className = 'split-session-result-title'; content.textContent = title; choice.appendChild(content);
|
|
41
41
|
var time = document.createElement('small'); time.textContent = age(session.lastActivity || session.createdAt); choice.appendChild(time);
|
|
@@ -56,10 +56,10 @@ export function renderPickerResults(menu) {
|
|
|
56
56
|
}
|
|
57
57
|
var status = menu.querySelector('[role="status"]');
|
|
58
58
|
if (focusKey) { var restored = Array.from(menu.querySelectorAll('button')).find(function (item) { return item.dataset[focusKey[0]] === focusKey[1] && !item.disabled; }); if (restored) restored.focus({ preventScroll: true }); }
|
|
59
|
-
status.textContent = !pickerCapacity() ? 'This View already has eight session panes.' : store.get('projectSplitViewPending') ? 'Saving the View…' : store.get('splitSessionCreation') ? 'Creating session…' : state.error || '';
|
|
59
|
+
status.textContent = state.projectStart ? (state.pending ? 'Creating session…' : state.error || '') : !pickerCapacity() ? 'This View already has eight session panes.' : store.get('projectSplitViewPending') ? 'Saving the View…' : store.get('splitSessionCreation') ? 'Creating session…' : state.error || '';
|
|
60
60
|
}
|
|
61
|
-
export function renderPicker(menu) {
|
|
62
|
-
var state = store.get('splitSessionPicker'); if (!state) return;
|
|
61
|
+
export function renderPicker(menu, model) {
|
|
62
|
+
var state = model || store.get('splitSessionPicker'); if (!state) return;
|
|
63
63
|
menu.replaceChildren(); menu.dataset.stage = state.side ? 'sessions' : 'direction';
|
|
64
64
|
if (!state.side) {
|
|
65
65
|
var header = document.createElement('div'); header.className = 'split-view-arrange-header';
|
|
@@ -76,6 +76,6 @@ export function renderPicker(menu) {
|
|
|
76
76
|
var heading = document.createElement('div'); heading.className = 'split-session-section split-session-new'; heading.textContent = 'New session'; menu.appendChild(heading);
|
|
77
77
|
var vendors = document.createElement('div'); vendors.className = 'split-session-vendors'; vendors.setAttribute('aria-label', 'Installed vendors'); menu.appendChild(vendors);
|
|
78
78
|
var status = document.createElement('p'); status.className = 'split-session-status'; status.setAttribute('role', 'status'); menu.appendChild(status);
|
|
79
|
-
var footer = document.createElement('small'); footer.className = 'split-session-hint'; footer.textContent = '↑↓ Choose · Enter Open · Esc Cancel'; menu.appendChild(footer);
|
|
80
|
-
renderPickerResults(menu); refreshIcons();
|
|
79
|
+
var footer = document.createElement('small'); footer.className = 'split-session-hint'; footer.textContent = state.projectStart ? '↑↓ Choose · Enter Open · Esc Close' : '↑↓ Choose · Enter Open · Esc Cancel'; menu.appendChild(footer);
|
|
80
|
+
renderPickerResults(menu, state); refreshIcons();
|
|
81
81
|
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { store } from './store.js';
|
|
2
2
|
import { livePaneBinding, samePaneBinding } from './pane-binding.js';
|
|
3
|
+
import { currentSingletonPresentation } from './split-view-singleton.js';
|
|
4
|
+
import { getCachedSessions } from './sidebar-sessions.js';
|
|
3
5
|
|
|
4
6
|
export function presentationCloseTarget(pane) {
|
|
5
7
|
var state = store.snap(), frame = pane && pane.querySelector('.split-pane-frame');
|
|
6
8
|
var live = frame && frame.clayPane && frame.clayPane.identity();
|
|
7
9
|
var view = (state.projectSplitViews || []).find(function (item) { return item.id === state.projectSplitViewActiveId; });
|
|
8
|
-
|
|
10
|
+
var singleton = !view && currentSingletonPresentation(state, getCachedSessions());
|
|
11
|
+
if (!pane || !pane.isConnected || pane.hidden || !live || !live.ready || !livePaneBinding(frame) ||
|
|
9
12
|
frame.dataset.requestedSessionId || live.projectSlug !== state.currentSlug || live.ownerId !== (state.myUserId || null) ||
|
|
10
|
-
frame.dataset.sessionId !== String(live.sessionId) || frame.dataset.sessionOriginId !== live.binding.sessionOriginId
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
frame.dataset.sessionId !== String(live.sessionId) || frame.dataset.sessionOriginId !== live.binding.sessionOriginId) return null;
|
|
14
|
+
if (view && !view.sessions.some(function (item) { return item.id === live.sessionId && item.sessionOriginId === live.binding.sessionOriginId; })) return null;
|
|
15
|
+
if (!view && (!singleton || singleton.origin !== state.projectSplitViewSingletonOrigin || singleton.session.id !== live.sessionId || singleton.origin !== live.binding.sessionOriginId)) return null;
|
|
16
|
+
return { kind: view ? 'saved-view' : 'singleton', viewId: view && view.id, revision: state.projectSplitViewRevision, sessionId: live.sessionId,
|
|
13
17
|
sessionOriginId: live.binding.sessionOriginId, frame: frame, binding: live.binding };
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export function validPresentationClose(detail) {
|
|
17
21
|
var pane = detail && detail.frame && detail.frame.closest('.split-pane');
|
|
18
22
|
var current = presentationCloseTarget(pane);
|
|
19
|
-
return !!(current && current.frame === detail.frame && current.viewId === detail.viewId && current.revision === detail.revision &&
|
|
23
|
+
return !!(current && current.kind === detail.kind && current.frame === detail.frame && current.viewId === detail.viewId && current.revision === detail.revision &&
|
|
20
24
|
current.sessionId === detail.sessionId && current.sessionOriginId === detail.sessionOriginId && samePaneBinding(current.binding, detail.binding));
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -19,6 +19,7 @@ import { iconHtml, refreshIcons } from './icons.js';
|
|
|
19
19
|
import { ensureArrangeMenu as buildArrangeMenu } from './split-view-arrange-menu.js';
|
|
20
20
|
import { pickerCapacity } from './split-view-picker-actions.js';
|
|
21
21
|
import { reserveEmptySplit, clearEmptySplit } from './split-session-empty-pane.js';
|
|
22
|
+
import { clearProjectEmptyCanvas } from './project-empty-canvas.js';
|
|
22
23
|
|
|
23
24
|
var host = null;
|
|
24
25
|
var app = null;
|
|
@@ -71,6 +72,7 @@ export function initPresentationRenderer(hostElement) {
|
|
|
71
72
|
|
|
72
73
|
export function hidePresentationView() {
|
|
73
74
|
if (!host) return;
|
|
75
|
+
clearProjectEmptyCanvas();
|
|
74
76
|
clearEmptySplit(host);
|
|
75
77
|
var legacySplit = store.get('splitPanes');
|
|
76
78
|
if (legacySplit) releaseRetainedPanes(host);
|
|
@@ -117,11 +119,14 @@ export function hidePresentationView() {
|
|
|
117
119
|
|
|
118
120
|
export function renderPresentationView(view, tree, sessions) {
|
|
119
121
|
if (!host || !view || !Array.isArray(sessions)) return;
|
|
122
|
+
clearProjectEmptyCanvas();
|
|
120
123
|
var drag = store.get('projectSplitViewDividerDrag');
|
|
121
124
|
if (drag && !currentLayoutScope(drag.scope)) onWindowBlur();
|
|
122
125
|
var ids = listIds(tree);
|
|
123
126
|
var singleton = ids.length === 1 && sessions.length === 1 && ids[0] === sessions[0].sessionOriginId;
|
|
124
127
|
if ((!singleton && !validateTree(tree, ids).ok) || ids.length !== sessions.length) return;
|
|
128
|
+
if (singleton) store.set({ projectSplitViewSingletonOrigin: ids[0] });
|
|
129
|
+
else if (store.get('projectSplitViewSingletonOrigin')) store.set({ projectSplitViewSingletonOrigin: null });
|
|
125
130
|
var byOrigin = new Map();
|
|
126
131
|
sessions.forEach(function (session) { byOrigin.set(session.sessionOriginId, session); });
|
|
127
132
|
var panes = [];
|
|
@@ -6,7 +6,6 @@ import { mutation } from './view-mutations.js';
|
|
|
6
6
|
import { initSavedWorkspace } from './view-workspace-controller.js';
|
|
7
7
|
import { preserveReconnectingPresentation } from './split-pane-retention.js';
|
|
8
8
|
import { layoutScope, currentLayoutScope, presentationTree } from './split-view-layout-scope.js';
|
|
9
|
-
import { validPresentationClose } from './split-view-presentation-close.js';
|
|
10
9
|
import { applyPresentationDrop } from './split-view-presentation-drop.js';
|
|
11
10
|
import { closeSessionContextMenu } from './session-context-menu.js';
|
|
12
11
|
import { openSplitViewMenu, closeSplitViewMenu as closeGroupMenus } from './split-view-sidebar-menu.js';
|
|
@@ -23,17 +22,15 @@ import { preset, listIds, validateTree, arrangeRegion } from './split-view-layou
|
|
|
23
22
|
import { viewIdForOrigin, updateActiveSession, exactDriverForOrigin, restorablePresentation } from './split-view-presentation-lookup.js';
|
|
24
23
|
import { groupedSessionIds } from './split-group-helpers.js';
|
|
25
24
|
import { handleSplitViewCreateEvent } from './split-view-create-action.js';
|
|
26
|
-
import { removeViewSession } from './split-view-member-actions.js';
|
|
27
25
|
import { initSplitViewCreateMenu } from './split-view-create-menu.js';
|
|
28
26
|
import { currentSingletonPresentation } from './split-view-singleton.js';
|
|
27
|
+
import { renderProjectEmptyCanvas, viewHasOpenPanes, presentableWithoutSessions } from './project-empty-canvas.js';
|
|
28
|
+
import { handleEmptyCanvasSidebarClick, handlePresentationClose } from './split-view-close-actions.js';
|
|
29
29
|
var host = null;
|
|
30
30
|
var nativeApp = null;
|
|
31
31
|
var mainPanels = null;
|
|
32
|
-
var stickyContainer = null;
|
|
33
|
-
|
|
34
|
-
var stickyAnchor = null;function contextKey(state) {
|
|
35
|
-
return [state.currentSlug || "", state.currentProjectOwnerId || "", state.myUserId || "", state.projectSplitViewSocketGeneration || 0].join("|");
|
|
36
|
-
}
|
|
32
|
+
var stickyContainer = null, stickyHome = null, stickyAnchor = null;
|
|
33
|
+
function contextKey(state) { return [state.currentSlug || "", state.currentProjectOwnerId || "", state.myUserId || "", state.projectSplitViewSocketGeneration || 0].join("|"); }
|
|
37
34
|
function projectReady(state) {
|
|
38
35
|
return getWs() !== state.splitIdentityBlockedSocket && !state.paneMode && !state.dmMode && state.currentSlug && state.activeProjectSlug === state.currentSlug &&
|
|
39
36
|
state.sessionListProjectSlug === state.currentSlug && state.authIdentityLoaded && state.connected;
|
|
@@ -47,6 +44,7 @@ function resetForContext() {
|
|
|
47
44
|
store.set({ projectSplitViews: [], projectSplitViewRevision: 0, projectSplitViewContextKey: key,
|
|
48
45
|
projectSplitViewHydrated: false, projectSplitViewPending: null, projectSplitViewError: uncertain,
|
|
49
46
|
projectSplitViewActiveId: null, projectSplitViewFocusedOrigin: null, projectSplitViewPreviewTree: null, projectSplitViewStandaloneTarget: null,
|
|
47
|
+
projectStartPicker: null,
|
|
50
48
|
projectSplitViewDrag: null, projectSplitViewDividerDrag: null, projectSplitViewRequestSocket: null,
|
|
51
49
|
projectSplitViewRequestGeneration: null, projectSplitViewRequestOwnerId: null, projectSplitViewRequestSlug: null });
|
|
52
50
|
return true;
|
|
@@ -83,8 +81,7 @@ function exactProjectMessage(msg) {
|
|
|
83
81
|
state.projectSplitViewRequestOwnerId === (state.myUserId || null) && state.projectSplitViewRequestSocket === getWs();
|
|
84
82
|
}
|
|
85
83
|
function viewExists(views, id) {
|
|
86
|
-
|
|
87
|
-
return null;
|
|
84
|
+
return (views || []).find(function (view) { return view.id === id; }) || null;
|
|
88
85
|
}
|
|
89
86
|
function viewSessions(view) {
|
|
90
87
|
if (!view || !Array.isArray(view.sessions)) return [];
|
|
@@ -115,18 +112,14 @@ export function handleProjectSplitViews(msg) {
|
|
|
115
112
|
renderActive();
|
|
116
113
|
return true;
|
|
117
114
|
}
|
|
118
|
-
// A repeated read must not cancel a captured gesture in an unchanged view.
|
|
119
115
|
if (state.projectSplitViewHydrated && !state.projectSplitViewPending && !msg.error && !state.projectSplitViewError &&
|
|
120
116
|
msg.revision === state.projectSplitViewRevision && JSON.stringify(nextViews) === JSON.stringify(state.projectSplitViews)) return true;
|
|
121
117
|
var pending = state.projectSplitViewPending;
|
|
122
118
|
if (state.projectSplitViewDrag || state.projectSplitViewDividerDrag) cleanupTransientInteractions(state);
|
|
123
119
|
var activeId = state.projectSplitViewActiveId;
|
|
124
|
-
if (!viewExists(nextViews, activeId)) {
|
|
125
|
-
// A saved active view without sessions is only a usable blank canvas when
|
|
126
|
-
// it still presents open panes or the project has no sessions at all.
|
|
127
|
-
// Restoring a husk over real sessions leaves the owner on a blank screen.
|
|
120
|
+
if (!state.projectEntryEmpty && !viewExists(nextViews, activeId)) {
|
|
128
121
|
var emptyRestorable = nextViews.find(function (view) { return view.id === msg.activeViewId && !view.sessions.length; });
|
|
129
|
-
if (emptyRestorable && presentableWithoutSessions(emptyRestorable)) activeId = emptyRestorable.id;
|
|
122
|
+
if (emptyRestorable && presentableWithoutSessions(emptyRestorable, getCachedSessions())) activeId = emptyRestorable.id;
|
|
130
123
|
else {
|
|
131
124
|
var restored = restorablePresentation(state, nextViews, getCachedSessions());
|
|
132
125
|
if (restored) activeId = restored.id;
|
|
@@ -210,7 +203,7 @@ export function setActiveView(id, preferredOrigin) {
|
|
|
210
203
|
store.set({ projectSplitViewSwitching: true });
|
|
211
204
|
if (!sendMessage({ type: "switch_session", id: activeSession.id })) { store.set({ projectSplitViewSwitching: false }); return false; }
|
|
212
205
|
}
|
|
213
|
-
store.set({ projectSplitViewActiveId: id, projectSplitViewFocusedOrigin: null, projectSplitViewPreviewTree: null, splitPanes: null });
|
|
206
|
+
store.set({ projectEntryEmpty: false, projectStartPicker: null, projectSplitViewActiveId: id, projectSplitViewFocusedOrigin: null, projectSplitViewPreviewTree: null, splitPanes: null });
|
|
214
207
|
renderActive();
|
|
215
208
|
return true;
|
|
216
209
|
}
|
|
@@ -228,20 +221,21 @@ export function switchToStandalone(sessionId) {
|
|
|
228
221
|
showToast("Session switch could not be sent. The current Split view is still open.", "error");
|
|
229
222
|
return false;
|
|
230
223
|
}
|
|
231
|
-
store.set({ projectSplitViewActiveId: null, projectSplitViewFocusedOrigin: null, projectSplitViewPreviewTree: null, projectSplitViewSwitching: false, splitPanes: null });
|
|
224
|
+
store.set({ projectSplitViewActiveId: null, projectSplitViewFocusedOrigin: null, projectSplitViewPreviewTree: null, projectSplitViewSwitching: false, splitPanes: null, projectStartPicker: null });
|
|
232
225
|
renderActive();
|
|
233
226
|
return true;
|
|
234
227
|
}
|
|
235
|
-
function presentableWithoutSessions(view) {
|
|
236
|
-
if (view.workspace && Array.isArray(view.workspace.panes) && view.workspace.panes.some(function (pane) { return pane.open; })) return true;
|
|
237
|
-
return !(getCachedSessions() || []).length;
|
|
238
|
-
}
|
|
239
228
|
function renderActive() {
|
|
240
229
|
if (store.get('splitPanes')) { repaintLegacySplit(); return; }
|
|
241
230
|
if (!host || !nativeApp || preserveReconnectingPresentation(host)) return;
|
|
242
231
|
var state = store.snap(), view = viewExists(state.projectSplitViews, state.projectSplitViewActiveId);
|
|
243
232
|
if (state.splitIdentityBlockedSocket === getWs()) { hidePresentationView(); return; }
|
|
233
|
+
if (state.projectEntryEmpty) { renderProjectEmptyCanvas(host, nativeApp); return; }
|
|
244
234
|
if (!view) {
|
|
235
|
+
if (state.projectStartPicker && state.projectStartPicker.projectStart) {
|
|
236
|
+
renderProjectEmptyCanvas(host, nativeApp);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
245
239
|
var restored = state.projectSplitViewHydrated && restorablePresentation(state, state.projectSplitViews, getCachedSessions());
|
|
246
240
|
if (restored) {
|
|
247
241
|
store.set({ projectSplitViewActiveId: restored.id, projectSplitViewSingletonOrigin: null, projectSplitViewFocusedOrigin: null });
|
|
@@ -263,12 +257,8 @@ function renderActive() {
|
|
|
263
257
|
}
|
|
264
258
|
if (state.projectSplitViewSingletonOrigin) store.set({ projectSplitViewSingletonOrigin: null });
|
|
265
259
|
if (restoreViewPair(view)) return;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// sidebar click is pulled back into it. Release it and show the app again.
|
|
269
|
-
if (!view.sessions.length && !presentableWithoutSessions(view)) {
|
|
270
|
-
store.set({ projectSplitViewActiveId: null, projectSplitViewFocusedOrigin: null, projectSplitViewPreviewTree: null });
|
|
271
|
-
hidePresentationView();
|
|
260
|
+
if (!view.sessions.length && !viewHasOpenPanes(view)) {
|
|
261
|
+
renderProjectEmptyCanvas(host, nativeApp);
|
|
272
262
|
return;
|
|
273
263
|
}
|
|
274
264
|
var sessions = viewSessions(view);
|
|
@@ -289,6 +279,7 @@ function onClick(event) {
|
|
|
289
279
|
clickedPane && clickedPane.querySelector('.split-pane-frame') && clickedPane.querySelector('.split-pane-frame').dataset.sessionOriginId === suppressed.targetOrigin;
|
|
290
280
|
if (matchesSource) { event.preventDefault(); event.stopImmediatePropagation(); store.set({ projectSplitViewSuppressClick: null }); return; }
|
|
291
281
|
}
|
|
282
|
+
if (handleEmptyCanvasSidebarClick(target, event, switchToStandalone)) return;
|
|
292
283
|
var menu = target.closest(".split-view-arrange"); if (menu) return;
|
|
293
284
|
var splitGroup = target.closest(".split-view-group[data-split-view-id]");
|
|
294
285
|
if (splitGroup) {
|
|
@@ -440,11 +431,7 @@ function onResize(event) {
|
|
|
440
431
|
layout: view.layout, activeSessionOriginId: view.activeSessionOriginId })) { store.set({ projectSplitViewPreviewTree: null }); renderActive(); }
|
|
441
432
|
}
|
|
442
433
|
function onClosePane(event) {
|
|
443
|
-
|
|
444
|
-
if (!view || !event.detail || !validPresentationClose(event.detail)) return;
|
|
445
|
-
var session = (getCachedSessions() || []).find(function (item) { return item.id === Number(event.detail.sessionId); });
|
|
446
|
-
if (!session || !view.sessions.some(function (item) { return item.sessionOriginId === session.sessionOriginId; })) return;
|
|
447
|
-
removeViewSession(view, session.sessionOriginId);
|
|
434
|
+
handlePresentationClose(event.detail, host, nativeApp);
|
|
448
435
|
}
|
|
449
436
|
function onFocus(event) {
|
|
450
437
|
var view = viewExists(store.get('projectSplitViews'), store.get('projectSplitViewActiveId'));
|
|
@@ -501,7 +488,6 @@ export function initSplitViewPresentations(hostElement) { init(hostElement); }
|
|
|
501
488
|
export function renderPresentationSplitView() { renderActive(); }
|
|
502
489
|
export function presentationViewForSidebar(viewId) { return viewExists(store.get('projectSplitViews'), viewId); }
|
|
503
490
|
|
|
504
|
-
// Canonical navigation uses the same draft guard and view renderer as human entry.
|
|
505
491
|
export function applyReviewedSplitView(target) {
|
|
506
492
|
var view = viewExists(store.get('projectSplitViews'), target.view.id);
|
|
507
493
|
if (!projectReady(store.snap()) || store.get('projectSplitViewPending') || !view || JSON.stringify(view) !== JSON.stringify(target.view)) return false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { clearProjectEmptyCanvas } from './project-empty-canvas.js';
|
|
1
2
|
import { syncPairView, pairPresentationPanes, pairViewCapacity } from './view-pair-presentation.js';
|
|
2
3
|
import { paintLegacyToolPanes } from './tool-pane-legacy.js';
|
|
3
4
|
import { adoptDocumentSource } from './clay-studio-document.js';
|
|
@@ -196,6 +197,7 @@ function renderSplit(split) {
|
|
|
196
197
|
renderPresentationSplitView();
|
|
197
198
|
return;
|
|
198
199
|
}
|
|
200
|
+
clearProjectEmptyCanvas();
|
|
199
201
|
if (split && split.panes) releaseRetainedPanes(host);
|
|
200
202
|
else clearRetainedPanes(host);
|
|
201
203
|
var panes = split && split.panes;
|
|
@@ -386,7 +388,11 @@ function keepCurrentDriverGroup(driver) {
|
|
|
386
388
|
}
|
|
387
389
|
|
|
388
390
|
function handleSidebarSessionClick(event) {
|
|
389
|
-
var state = store.snap();
|
|
391
|
+
var state = store.snap();
|
|
392
|
+
// The empty workspace owns session selection while its picker is visible.
|
|
393
|
+
// Let the presentation handler switch the retained session and close it.
|
|
394
|
+
if (state.projectStartPicker && state.projectStartPicker.projectStart) return;
|
|
395
|
+
if ((!state.splitPanes && !currentSingletonPresentation(state, getCachedSessions())) || event.button !== 0) return;
|
|
390
396
|
// This document capture listener runs before a row's bubble handlers. Leave
|
|
391
397
|
// real controls alone so GitHub anchors retain native click, modified-click,
|
|
392
398
|
// and keyboard navigation rather than selecting their owning session.
|
|
@@ -124,7 +124,7 @@ export function getAppearanceSnapshot() {
|
|
|
124
124
|
var pref = effectiveAppearance();
|
|
125
125
|
return { themeId: currentThemeId, userId: store.get('myUserId') || null,
|
|
126
126
|
preference: { configured: !!pref.configured || !!pref.mode || !!pref.theme || !!pref.background, theme: pref.theme || null, mode: pref.mode || null,
|
|
127
|
-
lightTheme: pref.lightTheme || null, darkTheme: pref.darkTheme || null, background: pref.background
|
|
127
|
+
lightTheme: pref.lightTheme || null, darkTheme: pref.darkTheme || null, background: workspaceBackgrounds.normalizeBackground(pref.background), backgroundColor: workspaceBackgrounds.getColor(pref.backgroundColor, pref.customBackgroundColors).id, customBackgroundColors: pref.customBackgroundColors || [] } };
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// A pane iframe mirrors the parent's live appearance. The server remains the
|
|
@@ -170,7 +170,7 @@ function tick() {
|
|
|
170
170
|
else if (run.desired || run.inflight) {
|
|
171
171
|
store.set({ projectSplitViewError: 'The saved workspace changed while a local edit was pending. Reload before trying again.' }); return;
|
|
172
172
|
} else {
|
|
173
|
-
run = { key: key, appliedWorkspace: savedWorkspace, restoring: true, restored: {}, cancelled: {}, unavailable: {}, desired: null, migrated: true, legacyEligible: false };
|
|
173
|
+
run = { key: key, appliedWorkspace: savedWorkspace, restoring: true, restored: {}, cancelled: {}, unavailable: {}, desired: null, migrated: true, legacyEligible: false, activationHandled: run.activationHandled };
|
|
174
174
|
store.set({ savedWorkspaceRuntime: run, savedWorkspaceLegacyLayout: null }); restore(view, run); return;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -183,7 +183,11 @@ function tick() {
|
|
|
183
183
|
}
|
|
184
184
|
retryPending(view, run, 'terminal'); retryPending(view, run, 'browser'); migrateCoordinates(view, run);
|
|
185
185
|
if (!store.get('projectSplitViewPending')) run.inflight = null;
|
|
186
|
-
|
|
186
|
+
// Persist local View entry once; another tab's selection is not a new local action.
|
|
187
|
+
if (!run.activationHandled) {
|
|
188
|
+
run.activationHandled = true;
|
|
189
|
+
if (!run.desired && store.get('projectSplitViewSavedActiveId') !== view.id) { run.desired = copy(view.workspace); run.desiredBase = JSON.stringify(view.workspace); }
|
|
190
|
+
}
|
|
187
191
|
flush();
|
|
188
192
|
}
|
|
189
193
|
}
|