Context
First leaf of #21198, and the one that creates src/desktop/. The demo's apps/webdesktop/view/ViewportController.mjs holds a window manager next to its sign-in and permission code: windows and createdWindows, createWindow(), openApp(), onTaskItemClick(), onWindowHeaderAction(), onWindowHide(), onAppsFilter(), hideAllWindows(), releaseWindows(), and the signOuts counter that cancels a window load a sign-out overtook (#21100). The order of the windows lives elsewhere, as module state in view/AppWindow.mjs.
The Problem
That logic is what every web desktop needs. Today a consumer can only copy it, and a copy never receives a fix like #21100's. The order cannot be copied safely at all: as module state it is one stack for every desktop on an App worker.
The Architectural Reality
- Design authority: n/a — moves and generalizes existing behavior; calls none of it wrong.
TreeStore#isKept(nodeOrKey) (src/data/TreeStore.mjs:792) says whether the apps store's filter keeps an app.
- A window is a
dialog.Base (src/dialog/Base.mjs: hide(), show(), hidden, animateTargetId, boundaryContainerId). It floats outside the component tree, so whoever creates it destroys it. It has one fixed z-index: 1000 (resources/scss/src/dialog/Base.scss:8) and no order among dialogs; toFront exists nowhere in src/.
- The demo's order is module state in
view/AppWindow.mjs (lines 9-30 and 116-128): a stack, baseZIndex = 10, restack(), and toFront() on mousedown.
- The demo loads
AppWindow through import() on first open and parents the window's state provider to the desktop's.
- Today's coverage:
test/playwright/unit/apps/webdesktop/view/ViewportController.spec.mjs.
The Fix
src/desktop/WindowManager.mjs, Neo.desktop.WindowManager (core.Base):
- configs
appStore, taskStore, windowClass (a class or an async module loader) and windowConfig (record => config, merged into each window);
openApp(record): create on first open and keep, or show; add or un-minimize its task; bring it to the front;
restore(appId): show a minimized window, or bring a visible one to the front;
minimize(appId) and close(appId);
bringToFront(appId): the manager's own stack sets the z-index of the windows it created; a mousedown on one of them brings it to the front;
reset(): cancel opens in flight, clear the tasks, hide every window without animation;
destroy(): destroy what it created, including loads in flight;
- it listens to the app store's
filter event and closes the windows of apps the filter no longer keeps.
- Its
@summary says that a window here is an app window addressed by appId, that windowId keeps its engine meaning (a browser window), and points at Neo.manager.Window.
src/desktop/model/Task.mjs and src/desktop/store/Tasks.mjs, moved from the demo.
- The demo's controller creates the manager and delegates to it until the desktop container owns it (a later leaf of #21198); its sign-out calls
reset(). Its window code and AppWindow.mjs's module-level stack go.
- The window tests move from the controller's spec to a spec beside the manager.
- The Architecture Overview's Structural Inventory gains a
src/desktop/ row.
Contract Ledger
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
Neo.desktop.WindowManager configs appStore, taskStore, windowClass, windowConfig |
#21198 |
One window per app id, created on first open and kept |
A failed or cancelled load caches nothing; the next open loads again |
JSDoc |
unit |
| What the manager uses of a window |
src/dialog/Base.mjs |
show(), hide(), hidden, its hide and headerAction events, and the z-index the manager sets; any dialog.Base qualifies |
— |
JSDoc |
unit |
openApp, restore, minimize, close, bringToFront, reset, destroy |
the demo's controller and AppWindow.mjs on dev |
The demo's behavior, with the order per manager instead of per module |
An unknown app id is a no-op |
JSDoc |
unit |
App-store filter → close |
the demo's onAppsFilter() |
Closes the windows, minimized ones too, of apps the filter drops |
— |
JSDoc |
unit |
Neo.desktop.model.Task, Neo.desktop.store.Tasks |
the demo's files |
Fields id, text, iconCls, color, minimized |
— |
JSDoc |
unit |
Acceptance Criteria
Out of Scope
The launcher, the taskbar, the app window and the desktop container (later leaves of #21198); order among floating dialogs the manager did not create; the tear-out of D#21204; everything #21198 excludes.
Related
Parent #21198 · blocked by #21033, so it lands after the Engine 14 cut · #21100 (the sign-out race this carries into src/) · #21064 (the demo's windows) · D#21204 (where a popup embodiment would plug into the window-class seam).
Sweeps: as #21198 at 2026-11-16T23:59Z (latest 20 open, open and closed window manager, A2A, MC, own assignments); no equivalent. Revised 2026-11-17 after Mnemosyne's epic review on #21198.
Origin Session ID: 99757ce4-c1d9-4801-83f2-e2f545246917
Retrieval Hint: "desktop WindowManager src one window per app id minimize restore close reset filter drop z-index stack per manager"
Context
First leaf of #21198, and the one that creates
src/desktop/. The demo'sapps/webdesktop/view/ViewportController.mjsholds a window manager next to its sign-in and permission code:windowsandcreatedWindows,createWindow(),openApp(),onTaskItemClick(),onWindowHeaderAction(),onWindowHide(),onAppsFilter(),hideAllWindows(),releaseWindows(), and thesignOutscounter that cancels a window load a sign-out overtook (#21100). The order of the windows lives elsewhere, as module state inview/AppWindow.mjs.The Problem
That logic is what every web desktop needs. Today a consumer can only copy it, and a copy never receives a fix like #21100's. The order cannot be copied safely at all: as module state it is one stack for every desktop on an App worker.
The Architectural Reality
TreeStore#isKept(nodeOrKey)(src/data/TreeStore.mjs:792) says whether the apps store's filter keeps an app.dialog.Base(src/dialog/Base.mjs:hide(),show(),hidden,animateTargetId,boundaryContainerId). It floats outside the component tree, so whoever creates it destroys it. It has one fixedz-index: 1000(resources/scss/src/dialog/Base.scss:8) and no order among dialogs;toFrontexists nowhere insrc/.view/AppWindow.mjs(lines 9-30 and 116-128): astack,baseZIndex = 10,restack(), andtoFront()onmousedown.AppWindowthroughimport()on first open and parents the window's state provider to the desktop's.test/playwright/unit/apps/webdesktop/view/ViewportController.spec.mjs.The Fix
src/desktop/WindowManager.mjs,Neo.desktop.WindowManager(core.Base):appStore,taskStore,windowClass(a class or an async module loader) andwindowConfig(record => config, merged into each window);openApp(record): create on first open and keep, or show; add or un-minimize its task; bring it to the front;restore(appId): show a minimized window, or bring a visible one to the front;minimize(appId)andclose(appId);bringToFront(appId): the manager's own stack sets thez-indexof the windows it created; amousedownon one of them brings it to the front;reset(): cancel opens in flight, clear the tasks, hide every window without animation;destroy(): destroy what it created, including loads in flight;filterevent and closes the windows of apps the filter no longer keeps.@summarysays that a window here is an app window addressed byappId, thatwindowIdkeeps its engine meaning (a browser window), and points atNeo.manager.Window.src/desktop/model/Task.mjsandsrc/desktop/store/Tasks.mjs, moved from the demo.reset(). Its window code andAppWindow.mjs's module-level stack go.src/desktop/row.Contract Ledger
Neo.desktop.WindowManagerconfigsappStore,taskStore,windowClass,windowConfigsrc/dialog/Base.mjsshow(),hide(),hidden, itshideandheaderActionevents, and thez-indexthe manager sets; anydialog.BasequalifiesopenApp,restore,minimize,close,bringToFront,reset,destroyAppWindow.mjsondevfilter→ closeonAppsFilter()Neo.desktop.model.Task,Neo.desktop.store.Tasksid,text,iconCls,color,minimizedAcceptance Criteria
WindowManager.mjs,model/Task.mjsandstore/Tasks.mjsexist undersrc/desktop/with@summaryJSDoc, the manager's carrying the naming rule. The demo uses them; its controller holds no window state (windows,createdWindows,signOuts), andAppWindow.mjsno module-level stack.reset()during a load creates no window and clears the tasks;destroy()destroys created windows and loads in flight; a window brought to the front is above the others of its manager, and two managers keep separate stacks.test/playwright/e2e/webdesktop/PhoneAndTouch.spec.mjsand the remaining demo unit specs pass.src/desktop/row.Out of Scope
The launcher, the taskbar, the app window and the desktop container (later leaves of #21198); order among floating dialogs the manager did not create; the tear-out of D#21204; everything #21198 excludes.
Related
Parent #21198 · blocked by #21033, so it lands after the Engine 14 cut · #21100 (the sign-out race this carries into
src/) · #21064 (the demo's windows) · D#21204 (where a popup embodiment would plug into the window-class seam).Sweeps: as #21198 at 2026-11-16T23:59Z (latest 20 open, open and closed
window manager, A2A, MC, own assignments); no equivalent. Revised 2026-11-17 after Mnemosyne's epic review on #21198.Origin Session ID: 99757ce4-c1d9-4801-83f2-e2f545246917 Retrieval Hint: "desktop WindowManager src one window per app id minimize restore close reset filter drop z-index stack per manager"