[verified] refactor: establish service and frontend boundaries

This commit is contained in:
chick
2026-07-15 02:43:41 +08:00
parent 0ac6faa6a3
commit e04a16e817
29 changed files with 917 additions and 598 deletions
+11
View File
@@ -0,0 +1,11 @@
export const VIEW_IDS = Object.freeze(['home', 'detail', 'rawpage', 'api'])
export function resolveView(view, hasActiveInstance = false) {
return VIEW_IDS.includes(view) ? view : hasActiveInstance ? 'detail' : 'home'
}
export function createViewRouter({ panels, controls, storage = globalThis.localStorage } = {}) {
return view => {
for (const control of controls()) control.classList.toggle('active', control.dataset.view === view)
for (const panel of panels()) panel.classList.toggle('active', panel.id === `${view}View`)
storage?.setItem('multi-simadmin-view', view)
}
}