Changeset 0.37.14 (#226)
Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content">
|
||||
<title>{{block "title" .}}Chat Switchboard{{end}}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="{{.BasePath}}/favicon.svg?v={{.Version}}">
|
||||
<link rel="icon" type="image/x-icon" href="{{.BasePath}}/favicon.ico?v={{.Version}}">
|
||||
@@ -24,6 +24,7 @@
|
||||
<link rel="stylesheet" href="{{.BasePath}}/css/workflow.css?v={{.Version}}">
|
||||
<link rel="stylesheet" href="{{.BasePath}}/css/admin-surfaces.css?v={{.Version}}">
|
||||
<link rel="stylesheet" href="{{.BasePath}}/css/extension-surface.css?v={{.Version}}">
|
||||
<link rel="stylesheet" href="{{.BasePath}}/css/sw-shell.css?v={{.Version}}">
|
||||
{{if eq .Surface "chat"}}{{template "css-chat" .}}{{end}}
|
||||
{{if eq .Surface "notes"}}{{template "css-notes" .}}{{end}}
|
||||
{{/* v0.27.0: Extension surface CSS — loaded from /surfaces/{id}/css/main.css */}}
|
||||
@@ -51,6 +52,23 @@
|
||||
document.documentElement.setAttribute('data-theme', resolved);
|
||||
var meta = document.getElementById('metaThemeColor');
|
||||
if (meta) meta.content = resolved === 'light' ? '#f7f7fa' : '#0e0e10';
|
||||
var fav = document.querySelector('link[rel="icon"][type="image/svg+xml"]');
|
||||
if (fav) fav.href = fav.href.replace(/favicon(-light)?\.svg/, resolved === 'light' ? 'favicon-light.svg' : 'favicon.svg');
|
||||
} catch(e) {}
|
||||
})();
|
||||
// Early appearance — apply scale + msg font from localStorage on all surfaces.
|
||||
// Scale uses transform on .surface-inner so shell stays fixed, content fills viewport.
|
||||
(function() {
|
||||
try {
|
||||
var p = JSON.parse(localStorage.getItem('cs-appearance') || '{}');
|
||||
if (p.scale && p.scale !== 100) {
|
||||
var s = p.scale / 100;
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var el = document.getElementById('surfaceInner');
|
||||
if (el) { el.style.transform = 'scale('+s+')'; el.style.transformOrigin = 'top left'; el.style.width = (100/s)+'%'; el.style.height = (100/s)+'%'; }
|
||||
});
|
||||
}
|
||||
if (p.msgFont && p.msgFont !== 14) document.documentElement.style.setProperty('--msg-font', p.msgFont + 'px');
|
||||
} catch(e) {}
|
||||
})();
|
||||
</script>
|
||||
@@ -62,6 +80,15 @@
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .Message.Visible}}
|
||||
<div class="sw-shell__announcement" id="shellMessage">
|
||||
<div class="sw-shell__announcement-inner sw-shell__announcement--{{.Message.Variant}}">
|
||||
<span class="sw-shell__announcement-text">{{.Message.Text}}</span>
|
||||
<button class="sw-shell__banner-close" onclick="this.closest('.sw-shell__announcement').remove()" aria-label="Dismiss">×</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="surface" id="surface">
|
||||
<div class="surface-inner" id="surfaceInner">
|
||||
{{if eq .Surface "chat"}}{{template "surface-chat" .}}
|
||||
@@ -75,6 +102,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .Footer.Visible}}
|
||||
<div class="sw-shell__footer">{{.Footer.Text}}</div>
|
||||
{{end}}
|
||||
|
||||
{{if .Banner.Visible}}
|
||||
<div class="banner banner-bottom active" style="background:{{.Banner.Background}};color:{{.Banner.Color}};height:var(--banner-h);line-height:var(--banner-h);text-align:center;font-size:12px;font-weight:600;overflow:hidden;">
|
||||
{{.Banner.Text}}
|
||||
@@ -92,32 +123,9 @@
|
||||
{{if .Manifest}}window.__MANIFEST__ = {{.Manifest | toJSON}};{{end}}
|
||||
</script>
|
||||
|
||||
<script type="module" nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/sb.js?v={{.Version}}"></script>
|
||||
{{/* v0.37.13 Scorched Earth III: app-state.js, ui-primitives.js,
|
||||
user-menu.js, file-tree.js, code-editor.js removed.
|
||||
Earlier: api.js, ui-core.js, pages.js (v0.37.10),
|
||||
ui-format.js, virtual-scroll.js, model-selector.js, drag-resize.js (v0.37.12),
|
||||
chat-pane.js, pane-container.js (v0.37.10). */}}
|
||||
<script type="module" nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/events.js?v={{.Version}}"></script>
|
||||
{{/* v0.28.5: SDK — composition layer over globals. */}}
|
||||
<script type="module" nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/switchboard-sdk.js?v={{.Version}}"></script>
|
||||
|
||||
{{/* ── Universal init: SDK boot for ALL surfaces ── */}}
|
||||
<script type="module" nonce="{{.CSPNonce}}">
|
||||
// v0.28.5: SDK handles theme + appearance. Idempotent.
|
||||
Switchboard.init();
|
||||
|
||||
// Universal logout — available on every surface.
|
||||
// Preact surfaces override with richer versions.
|
||||
function handleLogout() {
|
||||
if (!confirm('Sign out?')) return;
|
||||
if (typeof Events !== 'undefined') { Events.disconnect(); Events.clear(); }
|
||||
if (typeof API !== 'undefined' && API.logout) API.logout();
|
||||
location.reload();
|
||||
}
|
||||
// Register fallback — app.js re-registers with a richer version.
|
||||
sb.register('handleLogout', handleLogout);
|
||||
</script>
|
||||
{{/* v0.37.14 Scorched Earth IV: sb.js, events.js, switchboard-sdk.js,
|
||||
workflow-surfaces.js removed. All surfaces use Preact SDK boot().
|
||||
Survivors: debug.js, repl.js (standalone, no old-layer deps). */}}
|
||||
|
||||
{{if eq .Surface "chat"}}{{template "scripts-chat" .}}{{end}}
|
||||
{{if eq .Surface "admin"}}{{template "scripts-admin" .}}{{end}}
|
||||
@@ -136,13 +144,13 @@
|
||||
<div class="modal modal-wide">
|
||||
<div class="modal-header">
|
||||
<h2>Debug Log</h2>
|
||||
<button class="modal-close" onclick="sb.call('closeModal','debugModal')">✕</button>
|
||||
<button class="modal-close" onclick="closeModal('debugModal')">✕</button>
|
||||
</div>
|
||||
<div class="modal-tabs">
|
||||
<button class="debug-tab active" data-tab="console" onclick="sb.call('switchDebugTab','console')">Console <span id="debugConsoleCount" class="badge">0</span></button>
|
||||
<button class="debug-tab" data-tab="network" onclick="sb.call('switchDebugTab','network')">Network <span id="debugNetworkCount" class="badge">0</span></button>
|
||||
<button class="debug-tab" data-tab="state" onclick="sb.call('switchDebugTab','state')">State</button>
|
||||
<button class="debug-tab" data-tab="repl" onclick="sb.call('switchDebugTab','repl')">REPL</button>
|
||||
<button class="debug-tab active" data-tab="console" onclick="switchDebugTab('console')">Console <span id="debugConsoleCount" class="badge">0</span></button>
|
||||
<button class="debug-tab" data-tab="network" onclick="switchDebugTab('network')">Network <span id="debugNetworkCount" class="badge">0</span></button>
|
||||
<button class="debug-tab" data-tab="state" onclick="switchDebugTab('state')">State</button>
|
||||
<button class="debug-tab" data-tab="repl" onclick="switchDebugTab('repl')">REPL</button>
|
||||
</div>
|
||||
<div class="modal-body" style="padding:0;overflow:hidden;display:flex;flex-direction:column;min-height:0;">
|
||||
<div id="debugConsoleTab" class="debug-tab-content" style="display:flex;flex-direction:column;flex:1;min-height:0;">
|
||||
@@ -167,20 +175,19 @@
|
||||
</div>
|
||||
<div class="modal-footer" style="display:flex;justify-content:space-between;align-items:center;">
|
||||
<div style="display:flex;gap:8px;">
|
||||
<button class="btn-danger btn-small" onclick="sb.call('runDebugDiagnostics')">Diagnostics</button>
|
||||
<button class="btn-danger btn-small" onclick="sb.call('purgeCache')">Purge Cache</button>
|
||||
<button class="btn-danger btn-small" onclick="runDebugDiagnostics()">Diagnostics</button>
|
||||
<button class="btn-danger btn-small" onclick="purgeCache()">Purge Cache</button>
|
||||
</div>
|
||||
<div style="display:flex;gap:8px;">
|
||||
<button class="btn-secondary btn-small" onclick="sb.call('clearDebugLog')">Clear</button>
|
||||
<button class="btn-secondary btn-small" onclick="sb.call('copyDebugLog')">Copy</button>
|
||||
<button class="btn-secondary btn-small" onclick="sb.call('exportDebugLog')">Export</button>
|
||||
<button class="btn-secondary btn-small" onclick="clearDebugLog()">Clear</button>
|
||||
<button class="btn-secondary btn-small" onclick="copyDebugLog()">Copy</button>
|
||||
<button class="btn-secondary btn-small" onclick="exportDebugLog()">Export</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/debug.js?v={{.Version}}"></script>
|
||||
<script type="module" nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/repl.js?v={{.Version}}"></script>
|
||||
<div id="toastContainer" class="toast-container"></div>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user