V0.7.0 shell contract (#54)
All checks were successful
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-sqlite (push) Successful in 2m54s
CI/CD / test-go-pg (push) Successful in 2m55s
CI/CD / build-and-deploy (push) Successful in 1m5s

This commit was merged in pull request #54.
This commit is contained in:
2026-04-01 20:19:45 +00:00
parent 1236220302
commit e916ed41ea
151 changed files with 3250 additions and 684 deletions

View File

@@ -154,7 +154,7 @@ export async function boot() {
sw.ui = Object.freeze({});
}
// Topbar — standard navigation bar for surfaces
// Topbar — standard navigation bar for surfaces (legacy API)
try {
const topbarMod = await import('../shell/topbar.js');
_shell.Topbar = topbarMod.Topbar;
@@ -162,7 +162,16 @@ export async function boot() {
console.warn('[sw] Topbar import failed:', e.message);
}
// Freeze shell now that Topbar is loaded
// Shell Topbar — kernel-injected two-slot topbar
try {
const shellTopbarMod = await import('../shell/shell-topbar.js');
_shell.topbar = shellTopbarMod.shellTopbarAPI;
_shell._ShellTopbar = shellTopbarMod.ShellTopbar;
} catch (e) {
console.warn('[sw] ShellTopbar import failed:', e.message);
}
// Freeze shell now that all shell modules are loaded
sw.shell = Object.freeze(_shell);
// UserMenu render helper — surfaces call sw.userMenu(container, opts)
@@ -174,7 +183,7 @@ export async function boot() {
};
// Marker for idempotency
sw._sdk = '0.6.5';
sw._sdk = '0.7.0';
// 8. Expose globally
window.sw = sw;
@@ -210,7 +219,18 @@ export async function boot() {
console.warn('[sw] Imperative host mount failed:', e.message);
}
// 11. Signal ready
// 11. Auto-mount shell topbar if #shell-topbar exists
try {
const shellMount = document.getElementById('shell-topbar');
if (shellMount && sw.shell._ShellTopbar && auth.isAuthenticated) {
const { render } = preact;
render(html`<${sw.shell._ShellTopbar} />`, shellMount);
}
} catch (e) {
console.warn('[sw] Shell topbar mount failed:', e.message);
}
// 12. Signal ready
events.emit('sdk.ready', {}, { localOnly: true });
document.dispatchEvent(new CustomEvent('sw:ready', { detail: { sw } }));
console.log(`[sw] SDK v${sw._sdk} ready`);