f0d2926872
Add comprehensive READMEs for Bigscreen and Desktop modes, and relocate the Tauri frontend prototype into a new Bigscreen/ subdirectory. This moves package.json/package-lock, src, src-tauri, assets, views, styles and related files into Bigscreen/ to separate the controller-first shell from top-level docs. Update the root README.md to reframe the project as "NebulaOS", describe Bigscreen/Desktop modes, the vision, tech stack and development notes. This reorganizes the repo layout for clearer mode separation and documentation.
35 lines
691 B
JavaScript
35 lines
691 B
JavaScript
export const createRouter = (outlet) => {
|
|
const views = new Map();
|
|
let current = null;
|
|
|
|
const register = (view) => {
|
|
views.set(view.id, view);
|
|
};
|
|
|
|
const navigate = (id) => {
|
|
const view = views.get(id);
|
|
if (!view) {
|
|
throw new Error(`Unknown view: ${id}`);
|
|
}
|
|
|
|
current = id;
|
|
outlet.innerHTML = view.render();
|
|
const nextView = outlet.querySelector(".view");
|
|
if (nextView) {
|
|
requestAnimationFrame(() => {
|
|
nextView.classList.add("view-entered");
|
|
});
|
|
}
|
|
view.mount?.(outlet);
|
|
return view.getNavigationContract();
|
|
};
|
|
|
|
const getCurrent = () => current;
|
|
|
|
return {
|
|
register,
|
|
navigate,
|
|
getCurrent,
|
|
};
|
|
};
|