Changeset 0.27.0 (#166)

This commit is contained in:
2026-03-10 16:38:06 +00:00
parent 400f7dd176
commit 7e4f1581f2
15 changed files with 1721 additions and 520 deletions

View File

@@ -22,8 +22,13 @@
<link rel="stylesheet" href="{{.BasePath}}/css/tool-grants.css?v={{.Version}}">
<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}}">
{{if eq .Surface "chat"}}{{template "css-chat" .}}{{end}}
{{if eq .Surface "editor"}}{{template "css-editor" .}}{{end}}
{{/* v0.27.0: Extension surface CSS — loaded from /surfaces/{id}/css/main.css */}}
{{if and .Manifest (eq .Manifest.Source "extension")}}
<link rel="stylesheet" href="{{.BasePath}}/surfaces/{{.Surface}}/css/main.css?v={{.Version}}">
{{end}}
<style>
:root {
--banner-h: 28px;
@@ -63,6 +68,7 @@
{{else if eq .Surface "editor"}}{{template "surface-editor" .}}
{{else if eq .Surface "notes"}}{{template "surface-notes" .}}
{{else if eq .Surface "settings"}}{{template "surface-settings" .}}
{{else if and .Manifest (eq .Manifest.Source "extension")}}{{template "surface-extension" .}}
{{else}}<div style="padding:20px">Unknown surface: {{.Surface}}</div>
{{end}}
</div>
@@ -120,6 +126,10 @@
{{if eq .Surface "editor"}}{{template "scripts-editor" .}}{{end}}
{{if eq .Surface "notes"}}{{template "scripts-notes" .}}{{end}}
{{if eq .Surface "settings"}}{{template "scripts-settings" .}}{{end}}
{{/* v0.27.0: Extension surface JS — loaded from /surfaces/{id}/js/main.js */}}
{{if and .Manifest (eq .Manifest.Source "extension")}}
<script nonce="{{.CSPNonce}}" src="{{.BasePath}}/surfaces/{{.Surface}}/js/main.js?v={{.Version}}"></script>
{{end}}
{{/* ── Debug Log Modal (all surfaces) ───── */}}
<div id="debugModal" class="modal-overlay">

View File

@@ -189,6 +189,13 @@ window.addEventListener('unhandledrejection', function(e) {
<span class="sb-label">Editor</span>
</a>
{{end}}
{{/* v0.27.0: Extension surface nav items */}}
{{range .ExtensionSurfaces}}
<a href="{{$.BasePath}}{{.Route}}" class="sb-btn sidebar-extension-btn" title="{{.Title}}" data-surface-id="{{.ID}}">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
<span class="sb-label">{{.Title}}</span>
</a>
{{end}}
<div class="sidebar-bottom-divider"></div>
{{template "user-menu" dict "ID" ""}}
</div>

View File

@@ -0,0 +1,21 @@
{{/* v0.27.0: Generic container for extension surfaces.
Extension JS mounts into #extension-mount. The manifest is available
as window.__MANIFEST__ (injected in base.html). Platform primitives
(Theme, UI, API, ChatPane, etc.) are loaded by base.html before this
script runs.
Extensions can use any component available on the page:
- ChatPane.create(container, opts)
- UI.* primitives (toast, confirm, etc.)
- API.* (authenticated fetch)
- Theme.* (dark/light queries)
*/}}
{{define "surface-extension"}}
<div id="extension-surface" class="extension-surface"
data-surface-id="{{.Surface}}">
{{/* User menu — must pass dict with ID field, not raw PageData */}}
{{template "user-menu" dict "ID" "ext"}}
<div id="extension-mount" class="extension-mount"></div>
</div>
{{end}}