@liberation-data/desk 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +69 -2
  2. package/dist/core/commands.d.ts +2 -0
  3. package/dist/core/commands.d.ts.map +1 -1
  4. package/dist/core/commands.js +11 -4
  5. package/dist/core/commands.js.map +1 -1
  6. package/dist/core/desk.d.ts +14 -0
  7. package/dist/core/desk.d.ts.map +1 -1
  8. package/dist/core/desk.js +56 -7
  9. package/dist/core/desk.js.map +1 -1
  10. package/dist/core/index.d.ts +1 -1
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/core/index.js +1 -1
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/core/location.d.ts.map +1 -1
  15. package/dist/core/location.js +15 -7
  16. package/dist/core/location.js.map +1 -1
  17. package/dist/core/types.d.ts +7 -1
  18. package/dist/core/types.d.ts.map +1 -1
  19. package/dist/css/dock.css +6 -0
  20. package/dist/css/tokens.css +1 -0
  21. package/dist/css/windows.css +5 -0
  22. package/dist/desk.css +12 -0
  23. package/dist/react/Desktop.d.ts +1 -1
  24. package/dist/react/Desktop.d.ts.map +1 -1
  25. package/dist/react/Desktop.js +13 -9
  26. package/dist/react/Desktop.js.map +1 -1
  27. package/dist/react/Dock.d.ts.map +1 -1
  28. package/dist/react/Dock.js +10 -7
  29. package/dist/react/Dock.js.map +1 -1
  30. package/dist/react/MenuBar.d.ts +5 -1
  31. package/dist/react/MenuBar.d.ts.map +1 -1
  32. package/dist/react/MenuBar.js +10 -3
  33. package/dist/react/MenuBar.js.map +1 -1
  34. package/dist/react/appFrame.d.ts +1 -1
  35. package/dist/react/appFrame.d.ts.map +1 -1
  36. package/dist/react/appFrame.js +1 -1
  37. package/dist/react/appFrame.js.map +1 -1
  38. package/dist/react/documentTitle.d.ts +10 -0
  39. package/dist/react/documentTitle.d.ts.map +1 -0
  40. package/dist/react/documentTitle.js +25 -0
  41. package/dist/react/documentTitle.js.map +1 -0
  42. package/dist/react/index.d.ts +2 -0
  43. package/dist/react/index.d.ts.map +1 -1
  44. package/dist/react/index.js +1 -0
  45. package/dist/react/index.js.map +1 -1
  46. package/llms.txt +33 -5
  47. package/package.json +16 -1
  48. package/src/core/commands.ts +9 -4
  49. package/src/core/desk.ts +61 -7
  50. package/src/core/index.ts +2 -0
  51. package/src/core/location.ts +15 -7
  52. package/src/core/types.ts +7 -1
  53. package/src/css/dock.css +6 -0
  54. package/src/css/tokens.css +1 -0
  55. package/src/css/windows.css +5 -0
  56. package/src/react/Desktop.tsx +21 -9
  57. package/src/react/Dock.tsx +10 -4
  58. package/src/react/MenuBar.tsx +12 -3
  59. package/src/react/appFrame.tsx +5 -1
  60. package/src/react/documentTitle.ts +52 -0
  61. package/src/react/index.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC1E,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAChG,YAAY,EACV,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,E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,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACjH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACrG,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC/E,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
@@ -4,6 +4,7 @@ export { DeskShell } from './shell.js';
4
4
  export { DeskProvider, useDesk, useDeskState, useWindowId } from './context.js';
5
5
  export { useCanPerform, useCommand, usePerform, useShortcuts } from './commands.js';
6
6
  export { Desktop } from './Desktop.js';
7
+ export { useDocumentTitle } from './documentTitle.js';
7
8
  export { lazyWindow } from './windowBoundary.js';
8
9
  export { Button, Checkbox, ChoiceGroup, RadioGroup, SegmentedControl, Slider, TextField, Toggle } from './controls.js';
9
10
  export { Pane, Toolbar } from './pane.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,a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AE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGtE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAErG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
package/llms.txt CHANGED
@@ -62,7 +62,8 @@ interface Desk {
62
62
  openInstance(type: string, options?): string // 'query', then 'query#2' — returns the id it opened
63
63
  close(id: string): void
64
64
  closeAll(): void
65
- focus(id: string): void
65
+ minimize(id: string): void // off the desk, still open and loaded; see Minimizing
66
+ focus(id: string): void // forward, and back onto the desk when minimized
66
67
  float(id: string, frame?: Frame): void // no frame: last place it sat, else the next cascade step
67
68
  fill(id: string): void // fill the desk; remembers the frame for float()
68
69
  toggleMode(id: string): void // zoom: fill ⇄ free
@@ -77,7 +78,8 @@ interface Desk {
77
78
 
78
79
  interface DeskState {
79
80
  windows: readonly DeskWindow[] // the order they were opened = the order Arrange lays out
80
- stack: readonly string[] // back to front; the last one is key
81
+ stack: readonly string[] // back to front; the last one NOT minimized is key
82
+ minimized?: readonly string[] // open and off the desk; absent while nothing is
81
83
  }
82
84
  type DeskWindow = { id: string; mode: 'filled' } | { id: string; mode: 'floating'; frame: Frame }
83
85
  interface Frame { x: number; y: number; width: number; height: number }
@@ -98,11 +100,26 @@ lays windows out once as free windows (`placeAll`); moving or resizing one chang
98
100
  filled window frees it where it sits. Edge drops take a half; double-click or the green control zooms. State is immutable; every mutator returns void and notifies
99
101
  subscribers only when something actually changed.
100
102
 
103
+ ### Minimizing
104
+
105
+ ```ts
106
+ desk.minimize(id) // off the desk, still open and still mounted
107
+ desk.focus(id) / desk.open(id) // and back, to the mode and frame it had — there is no un-minimize
108
+ isMinimized(state, id) / onDesk(state)
109
+ state.minimized?: readonly WindowId[] // absent while nothing is minimized
110
+ ```
111
+
112
+ Deliberately NOT a `WindowMode`: the window keeps its mode and frame, which is how it comes back to them.
113
+ `focusedId` skips minimized windows, so a desk with everything minimized has no key window and shows
114
+ `<Desktop empty>`; Arrange, window cycling and `fitToStage` skip them too. The title bar's amber control and
115
+ `DeskCommands.minimizeWindow` (⌘M) do it. The dock keeps `data-running` and adds `data-minimized`;
116
+ `windowMenuItems` gives the item `detail: 'Minimized'`.
117
+
101
118
  ### URL and history
102
119
 
103
120
  ```ts
104
121
  syncWithLocation(desk, stage: () => Size, options?: LocationOptions, env?: LocationEnv): () => void
105
- serialize(state, options?): URLSearchParams // #w=rides,map~&f=map (`~` = free; the rest fill)
122
+ serialize(state, options?): URLSearchParams // #w=rides,map~_&f=rides (`~` = free, `_` = minimized)
106
123
  parse(params, stage, options?): DeskState
107
124
  interface LocationOptions { key?: 'w'; focusKey?: 'f'; isKnown?: (id: string) => boolean }
108
125
  ```
@@ -110,6 +127,17 @@ interface LocationOptions { key?: 'w'; focusKey?: 'f'; isKnown?: (id: string) =>
110
127
  Opening or closing pushes history (Back closes); focus and mode changes replace it. Frames are never in the
111
128
  URL. Other hash parameters are left alone. A URL naming no windows adopts whatever the app opened.
112
129
 
130
+ ### The browser tab
131
+
132
+ ```tsx
133
+ useDocumentTitle(title: (id: WindowId) => string, options?: DocumentTitleOptions): void
134
+ interface DocumentTitleOptions { app?: string; separator?: string } // default separator ' — '
135
+ ```
136
+
137
+ `document.title` follows the frontmost window — `Rides — Garage` — and is the app's name alone with nothing
138
+ open. `app` defaults to the document's own title (the page's `<title>`), and is restored on unmount. The
139
+ window's name is a string here, not the `ReactNode` `<Desktop title>` renders.
140
+
113
141
  ### Commands (the responder chain)
114
142
 
115
143
  ```ts
@@ -119,7 +147,7 @@ addCommandHandler(element: EventTarget, command, handler, { enabled? }): () => v
119
147
  addDeskCommands(stage: EventTarget, desk): () => void
120
148
  chainStart(desk, options?): EventTarget
121
149
  windowElement(doc, id): Element | null
122
- DeskCommands = { closeWindow, zoomWindow, arrange, nextWindow, previousWindow }
150
+ DeskCommands = { closeWindow, minimizeWindow, zoomWindow, arrange, nextWindow, previousWindow }
123
151
  // arrange is answered by a mounted Desktop: 1 fills, 2 split, 3 one tall + two stacked, 4+ a grid of usable cells;
124
152
  // the focused window takes the first place. Put it in the Window menu as "Arrange", shortcut 'mod+alt+a'.
125
153
  WINDOW_ATTRIBUTE = 'data-desk-window'; STAGE_ATTRIBUTE = 'data-desk-stage'
@@ -311,7 +339,7 @@ useDeskEvent<T>(topic, handler, { replay? }) // replay: deliver the las
311
339
  theme?={{ mode: 'light'|'dark', tokens: Record<string,string> }}
312
340
  sandbox?="allow-scripts allow-forms" />
313
341
  // theme: sent with hello and again on change; the bridge sets the tokens as custom properties on the
314
- // app's root, with data-desk-theme and color-scheme. The app may read desk.theme / desk.onTheme(fn).
342
+ // app's root, with data-theme and color-scheme (the attribute desk's own CSS and the HIG use). The app may read desk.theme / desk.onTheme(fn).
315
343
  withAppBridge(html): string // puts the app-side script in the page's <head>
316
344
  APP_BRIDGE_SCRIPT // the same script, to include some other way
317
345
  ```
package/package.json CHANGED
@@ -1,7 +1,22 @@
1
1
  {
2
2
  "name": "@liberation-data/desk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "A desktop for the web, for React: windows, a dock, menus and commands, controls, tours and setup assistants.",
5
+ "keywords": [
6
+ "react",
7
+ "desktop",
8
+ "window-manager",
9
+ "windows",
10
+ "dock",
11
+ "menu-bar",
12
+ "commands",
13
+ "ui",
14
+ "ui-components",
15
+ "typescript",
16
+ "web-desktop",
17
+ "tours",
18
+ "onboarding"
19
+ ],
5
20
  "license": "Apache-2.0",
6
21
  "author": "Jasper Blues",
7
22
  "repository": {
@@ -1,4 +1,4 @@
1
- import { focusedId } from './desk.js'
1
+ import { focusedId, onDesk } from './desk.js'
2
2
  import type { Desk } from './desk.js'
3
3
 
4
4
  /*
@@ -118,6 +118,8 @@ export const DeskCommands = {
118
118
  closeWindow: 'desk.window.close',
119
119
  /** Fills the key window, or frees it: the green control. */
120
120
  zoomWindow: 'desk.window.zoom',
121
+ /** Takes the key window off the desk, still open and still loaded: the amber control. */
122
+ minimizeWindow: 'desk.window.minimize',
121
123
  /** Answered by a mounted Desktop, which knows the space windows are laid out in. */
122
124
  arrange: 'desk.window.arrange',
123
125
  nextWindow: 'desk.window.next',
@@ -126,8 +128,10 @@ export const DeskCommands = {
126
128
 
127
129
  export function addDeskCommands(stage: EventTarget, desk: Desk): () => void {
128
130
  const key = () => focusedId(desk.getState())
131
+ // Only the windows on the desk: cycling through a minimized one would drag it back out by the way.
129
132
  const cycle = (step: 1 | -1) => {
130
- const { windows } = desk.getState()
133
+ const windows = onDesk(desk.getState())
134
+ if (!windows.length) return
131
135
  const current = windows.findIndex(w => w.id === key())
132
136
  const next = windows[(current + step + windows.length) % windows.length]
133
137
  if (next) desk.focus(next.id)
@@ -135,8 +139,9 @@ export function addDeskCommands(stage: EventTarget, desk: Desk): () => void {
135
139
  const removers = [
136
140
  addCommandHandler(stage, DeskCommands.closeWindow, () => { const id = key(); if (id) desk.close(id) }, { enabled: () => key() !== null }),
137
141
  addCommandHandler(stage, DeskCommands.zoomWindow, () => { const id = key(); if (id) desk.toggleMode(id) }, { enabled: () => key() !== null }),
138
- addCommandHandler(stage, DeskCommands.nextWindow, () => cycle(1), { enabled: () => desk.getState().windows.length > 1 }),
139
- addCommandHandler(stage, DeskCommands.previousWindow, () => cycle(-1), { enabled: () => desk.getState().windows.length > 1 }),
142
+ addCommandHandler(stage, DeskCommands.minimizeWindow, () => { const id = key(); if (id) desk.minimize(id) }, { enabled: () => key() !== null }),
143
+ addCommandHandler(stage, DeskCommands.nextWindow, () => cycle(1), { enabled: () => onDesk(desk.getState()).length > 1 }),
144
+ addCommandHandler(stage, DeskCommands.previousWindow, () => cycle(-1), { enabled: () => onDesk(desk.getState()).length > 1 }),
140
145
  ]
141
146
  return () => removers.forEach(remove => remove())
142
147
  }
package/src/core/desk.ts CHANGED
@@ -19,6 +19,12 @@ export interface Desk {
19
19
  openInstance(type: string, options?: OpenOptions): WindowId
20
20
  close(id: WindowId): void
21
21
  closeAll(): void
22
+ /**
23
+ * Off the desk without being closed: still open, still mounted, and keeping the mode and frame it
24
+ * had. Focusing or opening it again brings it back.
25
+ */
26
+ minimize(id: WindowId): void
27
+ /** Brings a window forward, and back onto the desk when it was minimized. */
22
28
  focus(id: WindowId): void
23
29
  /** Frees a window: where it last was, or at the next step of the cascade. Given a frame, puts it there. */
24
30
  float(id: WindowId, frame?: Frame): void
@@ -59,7 +65,24 @@ const DEFAULT_CASCADE: CascadeOptions = {
59
65
 
60
66
  const DEFAULT_STAGE: Size = { width: 1024, height: 768 }
61
67
 
62
- export const focusedId = (state: DeskState): WindowId | null => state.stack.at(-1) ?? null
68
+ /** Open, and off the desk: still mounted, and not somewhere anyone can point at. */
69
+ export const isMinimized = (state: DeskState, id: WindowId): boolean => state.minimized?.includes(id) ?? false
70
+
71
+ /** The windows on the desk, in the order they were opened: what Arrange lays out. */
72
+ export const onDesk = (state: DeskState): readonly DeskWindow[] =>
73
+ state.minimized?.length ? state.windows.filter(w => !isMinimized(state, w.id)) : state.windows
74
+
75
+ /**
76
+ * The key window: the frontmost one on the desk. A minimized window keeps its place in the stack,
77
+ * so it comes back where it was, but is never key — there is nothing on screen to type into.
78
+ */
79
+ export const focusedId = (state: DeskState): WindowId | null => {
80
+ for (let i = state.stack.length - 1; i >= 0; i--) {
81
+ const id = state.stack[i] as WindowId
82
+ if (!isMinimized(state, id)) return id
83
+ }
84
+ return null
85
+ }
63
86
 
64
87
  /**
65
88
  * Two windows onto the same thing — a second query beside the first — are the
@@ -117,7 +140,18 @@ export function normalise(state: DeskState): DeskState {
117
140
  const ids = new Set(windows.map(w => w.id))
118
141
  const stacked = state.stack.filter((id, i, all) => ids.has(id) && all.indexOf(id) === i)
119
142
  const unstacked = windows.map(w => w.id).filter(id => !stacked.includes(id))
120
- return { windows, stack: [...unstacked, ...stacked] }
143
+ const minimized = state.minimized?.filter((id, i, all) => ids.has(id) && all.indexOf(id) === i) ?? []
144
+ const stack = [...unstacked, ...stacked]
145
+ // Left out while nothing is minimized: the everyday state is the two lists it always was.
146
+ return minimized.length ? { windows, stack, minimized } : { windows, stack }
147
+ }
148
+
149
+ /** Keeps the field out of the state while nothing is minimized, so the everyday state is two lists. */
150
+ function withMinimized(state: DeskState, ids: readonly WindowId[]): DeskState {
151
+ if (ids.length) return { ...state, minimized: ids }
152
+ if (!state.minimized) return state
153
+ const { minimized: _none, ...rest } = state
154
+ return rest
121
155
  }
122
156
 
123
157
  export function createDesk(options: DeskOptions = {}): Desk {
@@ -133,8 +167,14 @@ export function createDesk(options: DeskOptions = {}): Desk {
133
167
  listeners.forEach(listener => listener(state))
134
168
  }
135
169
 
136
- const toFront = (s: DeskState, id: WindowId): DeskState =>
137
- s.stack.at(-1) === id ? s : { ...s, stack: [...s.stack.filter(x => x !== id), id] }
170
+ /*
171
+ * Forward, and back onto the desk: there is no focused-but-minimized window, so every way of
172
+ * choosing one comes back through here.
173
+ */
174
+ const toFront = (s: DeskState, id: WindowId): DeskState => {
175
+ const shown = withMinimized(s, s.minimized?.filter(x => x !== id) ?? [])
176
+ return shown.stack.at(-1) === id ? shown : { ...shown, stack: [...shown.stack.filter(x => x !== id), id] }
177
+ }
138
178
 
139
179
  const nextFrame = (s: DeskState) => nextCascadeFrame(s.windows, stage(), cascade)
140
180
 
@@ -165,11 +205,16 @@ export function createDesk(options: DeskOptions = {}): Desk {
165
205
  return frame.x + 40 <= width && frame.y + 20 <= height && frame.x >= 0 && frame.y >= 0 ? frame : undefined
166
206
  }
167
207
 
208
+ /* Already in the mode being asked for, so nothing to change — except that it may be off the desk. */
209
+ const restoreIfMinimized = (id: WindowId) => {
210
+ if (isMinimized(state, id)) commit(toFront(state, id))
211
+ }
212
+
168
213
  // Plain functions rather than methods, so `const { open } = desk` works.
169
214
  const float = (id: WindowId, frame?: Frame) => {
170
215
  const window = find(id)
171
216
  if (!window) return
172
- if (window.mode === 'floating' && !frame) return
217
+ if (window.mode === 'floating' && !frame) return restoreIfMinimized(id)
173
218
  const next = frame ?? fits(remembered.get(id)) ?? nextFrame(state)
174
219
  if (frame) {
175
220
  remembered.set(id, frame)
@@ -182,7 +227,8 @@ export function createDesk(options: DeskOptions = {}): Desk {
182
227
 
183
228
  const fill = (id: WindowId) => {
184
229
  const window = find(id)
185
- if (!window || window.mode === 'filled') return
230
+ if (!window) return
231
+ if (window.mode === 'filled') return restoreIfMinimized(id)
186
232
  remembered.set(id, window.frame)
187
233
  layouts?.save(windowType(id), { mode: 'filled' })
188
234
  commit(toFront(replace(state, { id, mode: 'filled' }), id))
@@ -228,7 +274,15 @@ export function createDesk(options: DeskOptions = {}): Desk {
228
274
  },
229
275
 
230
276
  close(id) {
231
- if (find(id)) commit({ windows: state.windows.filter(w => w.id !== id), stack: state.stack.filter(x => x !== id) })
277
+ if (!find(id)) return
278
+ const closed: DeskState = { windows: state.windows.filter(w => w.id !== id), stack: state.stack.filter(x => x !== id) }
279
+ commit(withMinimized(closed, state.minimized?.filter(x => x !== id) ?? []))
280
+ },
281
+
282
+ minimize(id) {
283
+ if (!find(id) || isMinimized(state, id)) return
284
+ // The stack is left alone: a window comes back to where it was, not to the front of everything.
285
+ commit(withMinimized(state, [...(state.minimized ?? []), id]))
232
286
  },
233
287
 
234
288
  closeAll() {
package/src/core/index.ts CHANGED
@@ -4,8 +4,10 @@ export {
4
4
  cascadeSlot,
5
5
  focusedId,
6
6
  instancesOf,
7
+ isMinimized,
7
8
  isOpen,
8
9
  nextCascadeFrame,
10
+ onDesk,
9
11
  normalise,
10
12
  windowType,
11
13
  EMPTY,
@@ -1,4 +1,4 @@
1
- import { cascadeFrame, focusedId, normalise } from './desk.js'
1
+ import { cascadeFrame, focusedId, isMinimized, normalise } from './desk.js'
2
2
  import type { Desk } from './desk.js'
3
3
  import type { DeskState, DeskWindow, Size, WindowId } from './types.js'
4
4
 
@@ -7,12 +7,15 @@ import type { DeskState, DeskWindow, Size, WindowId } from './types.js'
7
7
  * never frames. A shared link should open the same things, not reproduce
8
8
  * someone else's window positions on a different screen.
9
9
  *
10
- * #w=notes,clock~,inspector&f=clock
10
+ * #w=notes,clock~,inspector_&f=clock
11
11
  *
12
- * `~` marks a free window; the others fill the desk. `f` names the focused window.
12
+ * `~` marks a free window; the others fill the desk. `_` marks one that is minimized — open and
13
+ * off the desk — which is not a position but which windows are open and how, so it travels.
14
+ * `f` names the focused window.
13
15
  */
14
16
 
15
17
  const FLOAT = '~'
18
+ const MINIMIZED = '_'
16
19
 
17
20
  const warned = new Set<string>()
18
21
  /** Said once per message: a warning on every parse would be noise, not help. */
@@ -36,7 +39,9 @@ export function serialize(state: DeskState, options: LocationOptions = {}): URLS
36
39
  if (!state.windows.length) return params
37
40
  params.set(
38
41
  options.key ?? 'w',
39
- state.windows.map(w => `${encodeURIComponent(w.id)}${w.mode === 'floating' ? FLOAT : ''}`).join(','),
42
+ state.windows
43
+ .map(w => `${encodeURIComponent(w.id)}${w.mode === 'floating' ? FLOAT : ''}${isMinimized(state, w.id) ? MINIMIZED : ''}`)
44
+ .join(','),
40
45
  )
41
46
  const focused = focusedId(state)
42
47
  if (focused) params.set(options.focusKey ?? 'f', focused)
@@ -58,8 +63,10 @@ export function parse(params: URLSearchParams, stage: Size, options: LocationOpt
58
63
  .split(',')
59
64
  .filter(Boolean)
60
65
  .map(token => {
61
- const floating = token.endsWith(FLOAT)
62
- return { id: decodeURIComponent(floating ? token.slice(0, -1) : token), floating }
66
+ const minimized = token.endsWith(MINIMIZED)
67
+ const rest = minimized ? token.slice(0, -1) : token
68
+ const floating = rest.endsWith(FLOAT)
69
+ return { id: decodeURIComponent(floating ? rest.slice(0, -1) : rest), floating, minimized }
63
70
  })
64
71
  .filter(e => e.id && known(e.id))
65
72
 
@@ -72,7 +79,8 @@ export function parse(params: URLSearchParams, stage: Size, options: LocationOpt
72
79
  const focus = params.get(options.focusKey ?? 'f')
73
80
  const ids = windows.map(w => w.id)
74
81
  const stack = focus && ids.includes(focus) ? [...ids.filter(id => id !== focus), focus] : ids
75
- return normalise({ windows, stack })
82
+ const minimized = entries.filter(e => e.minimized).map(e => e.id)
83
+ return normalise(minimized.length ? { windows, stack, minimized } : { windows, stack })
76
84
  }
77
85
 
78
86
  export interface LocationEnv {
package/src/core/types.ts CHANGED
@@ -24,8 +24,14 @@ export type WindowMode = DeskWindow['mode']
24
24
  export interface DeskState {
25
25
  /** Open windows in the order they were opened. Arrange lays them out in this order, so focusing never reshuffles them. */
26
26
  readonly windows: readonly DeskWindow[]
27
- /** Window ids back to front. The last one has focus. */
27
+ /** Window ids back to front. The last one that is not minimized has focus. */
28
28
  readonly stack: readonly WindowId[]
29
+ /**
30
+ * Open, still mounted, and off the desk. Minimizing is not a way for a window to sit on the desk,
31
+ * so it is not a mode: the window keeps the mode and the frame it had, and comes back to them.
32
+ * Absent while nothing is minimized, which is most of the time.
33
+ */
34
+ readonly minimized?: readonly WindowId[]
29
35
  }
30
36
 
31
37
  export interface CascadeOptions {
package/src/css/dock.css CHANGED
@@ -130,6 +130,12 @@
130
130
  background: var(--desk-accent);
131
131
  }
132
132
 
133
+ /* Open, and all of it off the desk: the dot is hollow, so "open" still reads at a glance. */
134
+ .desk-dock-item[data-minimized]::after {
135
+ background: transparent;
136
+ box-shadow: inset 0 0 0 1px var(--desk-muted);
137
+ }
138
+
133
139
  .desk-dock-badge {
134
140
  position: absolute;
135
141
  top: -5px;
@@ -11,6 +11,7 @@
11
11
  --desk-rule: #dde1e8;
12
12
  --desk-accent: #5b57f5;
13
13
  --desk-close: #ef6b63;
14
+ --desk-minimize: #f0b429;
14
15
  --desk-mode: #34c47a;
15
16
  --desk-info: #34c47a;
16
17
  --desk-radius: 12px;
@@ -105,6 +105,11 @@
105
105
  background: var(--desk-close);
106
106
  }
107
107
 
108
+ .desk-window[data-focused] .desk-control[data-control="minimize"],
109
+ .desk-control[data-control="minimize"]:hover {
110
+ background: var(--desk-minimize);
111
+ }
112
+
108
113
  .desk-window[data-focused] .desk-control[data-control="mode"],
109
114
  .desk-control[data-control="mode"]:hover {
110
115
  background: var(--desk-mode);
@@ -1,7 +1,7 @@
1
1
  import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
2
2
  import type { CSSProperties, PointerEvent as ReactPointerEvent, ReactNode } from 'react'
3
3
  import { addCommandHandler, addDeskCommands, DeskCommands, STAGE_ATTRIBUTE, WINDOW_ATTRIBUTE, windowElement } from '../core/commands.js'
4
- import { focusedId } from '../core/desk.js'
4
+ import { focusedId, isMinimized, onDesk } from '../core/desk.js'
5
5
  import type { Desk } from '../core/desk.js'
6
6
  import type { DeskWindow, Frame, WindowId, WindowLimits } from '../core/types.js'
7
7
  import { arrangement } from './arrange.js'
@@ -36,7 +36,7 @@ export interface DesktopProps {
36
36
  readonly info?: (id: WindowId) => ReactNode
37
37
  /** Window-wide controls on the trailing side of the title bar. One or two; more belongs in a toolbar. */
38
38
  readonly actions?: (id: WindowId) => ReactNode
39
- /** Shown when no window is open. */
39
+ /** Shown when no window is on the desk — none open, or every one of them minimized. */
40
40
  readonly empty?: ReactNode
41
41
  /** Shown inside a window while its code loads. Default: a quiet "Loading…". */
42
42
  readonly loading?: WindowLoading
@@ -159,7 +159,7 @@ export function Desktop({ renderWindow, title, note, info, actions, limits, empt
159
159
  () => arrangeNow(desk, element),
160
160
  {
161
161
  enabled: () => {
162
- const { windows } = desk.getState()
162
+ const windows = onDesk(desk.getState())
163
163
  return windows.length > 1 || windows.some(w => w.mode === 'floating')
164
164
  },
165
165
  },
@@ -186,7 +186,7 @@ export function Desktop({ renderWindow, title, note, info, actions, limits, empt
186
186
  data-layout={mode}
187
187
  {...{ [STAGE_ATTRIBUTE]: '' }}
188
188
  >
189
- {state.windows.length === 0 && empty}
189
+ {onDesk(state).length === 0 && empty}
190
190
  {state.windows.map(window => (
191
191
  <WindowView
192
192
  key={window.id}
@@ -194,8 +194,10 @@ export function Desktop({ renderWindow, title, note, info, actions, limits, empt
194
194
  layout={mode}
195
195
  depth={state.stack.indexOf(window.id)}
196
196
  focused={window.id === focused}
197
- // One window at a time: the rest stay mounted, keeping their state, and simply wait offstage.
198
- hidden={mode === 'fullscreen' && window.id !== focused}
197
+ // Offstage, not gone: it keeps its DOM, so nothing in it is lost. One window at a time on
198
+ // touch, and minimizing, are the same thing to everything below this line.
199
+ hidden={(mode === 'fullscreen' && window.id !== focused) || isMinimized(state, window.id)}
200
+ minimized={isMinimized(state, window.id)}
199
201
  title={title(window.id)}
200
202
  note={note?.(window.id)}
201
203
  info={info?.(window.id)}
@@ -231,6 +233,8 @@ interface WindowViewProps {
231
233
  readonly window: DeskWindow
232
234
  readonly layout: DeskLayout
233
235
  readonly hidden?: boolean
236
+ /** Hidden because it was minimized, rather than because another window has the screen. */
237
+ readonly minimized?: boolean
234
238
  readonly depth: number
235
239
  readonly focused: boolean
236
240
  readonly title: ReactNode
@@ -244,7 +248,10 @@ interface WindowViewProps {
244
248
  /** Moving by the title bar, or resizing from the corner or from the left, right or bottom edge. */
245
249
  /** Lays every open window out at once: what Window → Arrange does, and what a shrunken desk needs. */
246
250
  function arrangeNow(desk: Desk, element: HTMLElement) {
247
- const { windows, stack } = desk.getState()
251
+ const state = desk.getState()
252
+ // Minimized windows are off the desk: laying one out would put it back without being asked.
253
+ const windows = onDesk(state)
254
+ const stack = state.stack.filter(id => !isMinimized(state, id))
248
255
  const [focused, previous] = [stack.at(-1), stack.at(-2)]
249
256
  if (windows.length === 1) {
250
257
  if (focused) desk.fill(focused)
@@ -285,7 +292,7 @@ function reshape(gesture: Gesture, origin: Frame, dx: number, dy: number): Frame
285
292
  }
286
293
  }
287
294
 
288
- function WindowView({ window, layout, hidden, depth, focused, title, note, info, actions, limits, children }: WindowViewProps) {
295
+ function WindowView({ window, layout, hidden, minimized, depth, focused, title, note, info, actions, limits, children }: WindowViewProps) {
289
296
  const desk = useDesk()
290
297
  // While dragging, the frame lives here and commits once on release, so a drag
291
298
  // re-renders one window rather than notifying every subscriber per pixel.
@@ -393,6 +400,7 @@ function WindowView({ window, layout, hidden, depth, focused, title, note, info,
393
400
  className="desk-window"
394
401
  data-mode={layout === 'fullscreen' ? 'fullscreen' : live ? 'floating' : window.mode}
395
402
  data-hidden={hidden || undefined}
403
+ data-minimized={minimized || undefined}
396
404
  inert={hidden || undefined}
397
405
  data-focused={focused || undefined}
398
406
  data-dragging={live ? true : undefined}
@@ -413,7 +421,11 @@ function WindowView({ window, layout, hidden, depth, focused, title, note, info,
413
421
  <div className="desk-controls">
414
422
  <button type="button" className="desk-control" data-control="close" aria-label="Close" onClick={() => desk.close(window.id)} />
415
423
  {layout === 'desktop' && (
416
- <button type="button" className="desk-control" data-control="mode" aria-label="Zoom" onClick={zoom} />
424
+ <>
425
+ {/* Off the desk, still open: nothing is unmounted, so nothing inside it is lost. */}
426
+ <button type="button" className="desk-control" data-control="minimize" aria-label="Minimize" onClick={() => desk.minimize(window.id)} />
427
+ <button type="button" className="desk-control" data-control="mode" aria-label="Zoom" onClick={zoom} />
428
+ </>
417
429
  )}
418
430
  </div>
419
431
  <h2 id={titleId} className="desk-title">
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useId, useRef, useState } from 'react'
2
2
  import type { KeyboardEvent, ReactNode } from 'react'
3
- import { focusedId, instancesOf, windowType } from '../core/desk.js'
3
+ import { focusedId, instancesOf, isMinimized, windowType } from '../core/desk.js'
4
4
  import type { DeskState, WindowId } from '../core/types.js'
5
5
  import { useDesk, useDeskState } from './context.js'
6
6
  import { useContextMenu } from './contextMenu.js'
@@ -73,10 +73,13 @@ const windowOf = (item: DockItem) => item.window ?? item.id
73
73
 
74
74
  const statusOf = (state: DeskState, items: readonly DockItem[]) => {
75
75
  const key = focusedId(state)
76
+ const windows = items.flatMap(i => instancesOf(state, windowOf(i)))
76
77
  return {
77
78
  // Any window of this kind counts: a second query window is still Query, running.
78
- running: items.some(i => instancesOf(state, windowOf(i)).length > 0),
79
+ running: windows.length > 0,
79
80
  focused: items.some(i => key !== null && windowType(key) === windowOf(i)),
81
+ // Open, and none of it on the desk. One window of a kind still showing means the item is not.
82
+ minimized: windows.length > 0 && windows.every(w => isMinimized(state, w.id)),
80
83
  }
81
84
  }
82
85
 
@@ -165,7 +168,7 @@ interface DockButtonProps {
165
168
 
166
169
  function DockButton({ item, tabIndex, pins }: DockButtonProps) {
167
170
  const desk = useDesk()
168
- const { running, focused } = statusOf(useDeskState(), [item])
171
+ const { running, focused, minimized } = statusOf(useDeskState(), [item])
169
172
  const context = useContextMenu({ label: item.label, items: item.contextMenu ?? (() => []), disabled: !item.contextMenu })
170
173
  // Only kept items take drops, so something carried lands among them and never splits the fixed ones.
171
174
  const droppable = Boolean(pins && item.movable)
@@ -182,6 +185,7 @@ function DockButton({ item, tabIndex, pins }: DockButtonProps) {
182
185
  aria-label={item.label}
183
186
  data-running={running || undefined}
184
187
  data-focused={focused || undefined}
188
+ data-minimized={minimized || undefined}
185
189
  // An item with a menu stays reachable while it cannot open, so it can still be removed.
186
190
  disabled={item.disabled && !item.contextMenu}
187
191
  aria-disabled={(item.disabled && item.contextMenu && true) || undefined}
@@ -219,7 +223,7 @@ interface StackButtonProps {
219
223
  function StackButton({ stack, tabIndex, open, setOpenStack }: StackButtonProps) {
220
224
  const desk = useDesk()
221
225
  const state = useDeskState()
222
- const { running, focused } = statusOf(state, stack.items)
226
+ const { running, focused, minimized } = statusOf(state, stack.items)
223
227
  const onOpenChange = (next: boolean) => setOpenStack(next ? stack.id : null)
224
228
  const button = useRef<HTMLButtonElement>(null)
225
229
  const panel = useRef<HTMLDivElement>(null)
@@ -264,6 +268,7 @@ function StackButton({ stack, tabIndex, open, setOpenStack }: StackButtonProps)
264
268
  aria-controls={open ? panelId : undefined}
265
269
  data-running={running || undefined}
266
270
  data-focused={focused || undefined}
271
+ data-minimized={minimized || undefined}
267
272
  onClick={() => onOpenChange(!open)}
268
273
  >
269
274
  <span className="desk-dock-icon" aria-hidden="true">
@@ -307,6 +312,7 @@ function StackButton({ stack, tabIndex, open, setOpenStack }: StackButtonProps)
307
312
  data-rove
308
313
  className="desk-stack-item"
309
314
  data-running={status.running || undefined}
315
+ data-minimized={status.minimized || undefined}
310
316
  disabled={item.disabled}
311
317
  onClick={() => select(item)}
312
318
  >
@@ -2,7 +2,7 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react'
2
2
  import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react'
3
3
  import { canPerform, perform } from '../core/commands.js'
4
4
  import type { CommandId } from '../core/commands.js'
5
- import { focusedId } from '../core/desk.js'
5
+ import { focusedId, isMinimized } from '../core/desk.js'
6
6
  import { bindShortcuts, formatShortcut, isApplePlatform } from '../core/shortcuts.js'
7
7
  import type { Desk } from '../core/desk.js'
8
8
  import type { DeskState, WindowId } from '../core/types.js'
@@ -59,10 +59,19 @@ export const menuAction = (label: string, onSelect: () => void, options: Omit<Op
59
59
  export const menuSeparator = (): MenuItem => ({ type: 'separator' })
60
60
  export const menuHeader = (label: string): MenuItem => ({ type: 'header', label })
61
61
 
62
- /** One item per open window, the key window checked — what a Window menu lists at its foot. */
62
+ /**
63
+ * One item per open window, the key window checked — what a Window menu lists at its foot. A
64
+ * minimized window says so and is still listed: the menu is where someone looks for a window
65
+ * they cannot see, and choosing it brings it back.
66
+ */
63
67
  export function windowMenuItems(state: DeskState, focus: (id: WindowId) => void, title: (id: WindowId) => string): MenuItem[] {
64
68
  const key = focusedId(state)
65
- return state.windows.map(w => menuAction(title(w.id), () => focus(w.id), { checked: w.id === key }))
69
+ return state.windows.map(w =>
70
+ menuAction(title(w.id), () => focus(w.id), {
71
+ checked: w.id === key,
72
+ ...(isMinimized(state, w.id) ? { detail: 'Minimized' } : {}),
73
+ }),
74
+ )
66
75
  }
67
76
 
68
77
  export interface MenuBarProps {
@@ -31,6 +31,10 @@ const PROTOCOL = 1
31
31
  * the page is, for an app that decides its own colours but wants to know; `tokens` are custom
32
32
  * properties the bridge sets on the app's own root, so an app that reads them gets the desk's
33
33
  * colours with nothing to write.
34
+ *
35
+ * The mode is stamped as `data-theme`, which is the attribute desk's own stylesheet reads and the
36
+ * one the HIG tells app authors to honour — so a page already written that way follows the desk
37
+ * with nothing added to it.
34
38
  */
35
39
  export interface AppTheme {
36
40
  readonly mode: 'light' | 'dark'
@@ -188,7 +192,7 @@ export const APP_BRIDGE_SCRIPT = `(() => {
188
192
  if (!theme) return;
189
193
  desk.theme = theme;
190
194
  const root = document.documentElement;
191
- root.dataset.deskTheme = theme.mode;
195
+ root.dataset.theme = theme.mode;
192
196
  root.style.colorScheme = theme.mode;
193
197
  for (const [name, value] of Object.entries(theme.tokens || {})) root.style.setProperty(name, value);
194
198
  themed.forEach(h => h(theme));