V0.7.0 shell contract (#54)
All checks were successful
All checks were successful
This commit was merged in pull request #54.
This commit is contained in:
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user