Feat v0.2.3 sdk tasks (#7)
Some checks failed
CI/CD / detect-changes (push) Successful in 23s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Failing after 2m27s
CI/CD / test-sqlite (push) Successful in 2m34s
CI/CD / build-and-deploy (push) Has been skipped

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #7.
This commit is contained in:
2026-03-27 11:06:40 +00:00
committed by xcaliber
parent 57ccf19efb
commit 239a5fb732
26 changed files with 2230 additions and 38 deletions

View File

@@ -18,6 +18,9 @@ import { createDomains } from './api-domains.js';
import { createEvents } from './events.js';
import { createPipe } from './pipe.js';
import { createTheme } from './theme.js';
import { createStorage } from './storage.js';
import { createSlots } from './slots.js';
import { createActions } from './actions.js';
import { confirm } from '../primitives/confirm.js';
import { prompt } from '../primitives/prompt.js';
@@ -61,9 +64,12 @@ export async function boot() {
// 6. Remaining modules
const { can, isAdmin, isTeamAdmin } = createCan(auth);
const api = createDomains(restClient);
const pipe = createPipe();
const theme = createTheme(events.emit.bind(events));
const api = createDomains(restClient);
const pipe = createPipe();
const theme = createTheme(events.emit.bind(events));
const storage = createStorage();
const slots = createSlots(events.emit.bind(events));
const actions = createActions(events.emit.bind(events));
// 7. Assemble sw object
const sw = Object.create(null);
@@ -89,16 +95,19 @@ export async function boot() {
sw.emit = events.emit.bind(events);
sw.events = events;
// Pipe & Theme
sw.pipe = pipe;
sw.theme = theme;
// Pipe, Theme, Storage, Slots, Actions
sw.pipe = pipe;
sw.theme = theme;
sw.storage = storage;
sw.slots = slots;
sw.actions = actions;
// Shell helpers — imperative confirm/prompt backed by primitives
sw.confirm = confirm;
sw.prompt = prompt;
// Shell — layout utilities (decouples surface code from shell DOM)
sw.shell = Object.freeze({
const _shell = {
/** CSS transform scale on #surfaceInner (appearance zoom). */
getScale() {
const el = document.getElementById('surfaceInner');
@@ -108,7 +117,10 @@ export async function boot() {
const m = t.match(/matrix\(([^,]+)/);
return m ? parseFloat(m[1]) || 1 : 1;
},
});
/** Topbar — set after dynamic import below */
Topbar: null,
};
sw.shell = _shell;
// Toast — dynamic import to avoid module resolution issues
try {
@@ -121,6 +133,26 @@ export async function boot() {
console.warn('[sw] Toast import failed:', e.message);
}
// UI primitives — extensions use sw.ui.Button, sw.ui.Dialog, etc.
try {
const primitives = await import('../primitives/index.js');
sw.ui = Object.freeze({ ...primitives });
} catch (e) {
console.warn('[sw] Primitives import failed:', e.message);
sw.ui = Object.freeze({});
}
// Topbar — standard navigation bar for surfaces
try {
const topbarMod = await import('../shell/topbar.js');
_shell.Topbar = topbarMod.Topbar;
} catch (e) {
console.warn('[sw] Topbar import failed:', e.message);
}
// Freeze shell now that Topbar is loaded
sw.shell = Object.freeze(_shell);
// UserMenu render helper — surfaces call sw.userMenu(container, opts)
sw.userMenu = function (container, opts = {}) {
import('../shell/user-menu.js').then(({ UserMenu }) => {
@@ -130,7 +162,7 @@ export async function boot() {
};
// Marker for idempotency
sw._sdk = '0.38.1';
sw._sdk = '0.2.3';
// 8. Expose globally
window.sw = sw;