@liberation-data/desk 0.14.0 → 0.16.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 (76) hide show
  1. package/README.md +70 -7
  2. package/dist/core/index.d.ts +2 -0
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/index.js +1 -0
  5. package/dist/core/index.js.map +1 -1
  6. package/dist/core/look.d.ts +12 -0
  7. package/dist/core/look.d.ts.map +1 -0
  8. package/dist/core/look.js +26 -0
  9. package/dist/core/look.js.map +1 -0
  10. package/dist/css/conversation.css +21 -0
  11. package/dist/css/dock.css +123 -3
  12. package/dist/css/looks.css +258 -0
  13. package/dist/css/tokens.css +5 -1
  14. package/dist/desk.css +408 -4
  15. package/dist/fx/fx.d.ts +29 -0
  16. package/dist/fx/fx.d.ts.map +1 -0
  17. package/dist/fx/fx.js +119 -0
  18. package/dist/fx/fx.js.map +1 -0
  19. package/dist/fx/index.d.ts +7 -0
  20. package/dist/fx/index.d.ts.map +1 -0
  21. package/dist/fx/index.js +4 -0
  22. package/dist/fx/index.js.map +1 -0
  23. package/dist/fx/measure.d.ts +18 -0
  24. package/dist/fx/measure.d.ts.map +1 -0
  25. package/dist/fx/measure.js +37 -0
  26. package/dist/fx/measure.js.map +1 -0
  27. package/dist/fx/sounds.d.ts +108 -0
  28. package/dist/fx/sounds.d.ts.map +1 -0
  29. package/dist/fx/sounds.js +148 -0
  30. package/dist/fx/sounds.js.map +1 -0
  31. package/dist/react/Desktop.d.ts.map +1 -1
  32. package/dist/react/Desktop.js +44 -9
  33. package/dist/react/Desktop.js.map +1 -1
  34. package/dist/react/Dock.d.ts +11 -1
  35. package/dist/react/Dock.d.ts.map +1 -1
  36. package/dist/react/Dock.js +4 -3
  37. package/dist/react/Dock.js.map +1 -1
  38. package/dist/react/context.d.ts +9 -1
  39. package/dist/react/context.d.ts.map +1 -1
  40. package/dist/react/context.js +15 -3
  41. package/dist/react/context.js.map +1 -1
  42. package/dist/react/conversation.d.ts +12 -0
  43. package/dist/react/conversation.d.ts.map +1 -1
  44. package/dist/react/conversation.js +1 -1
  45. package/dist/react/conversation.js.map +1 -1
  46. package/dist/react/index.d.ts +4 -2
  47. package/dist/react/index.d.ts.map +1 -1
  48. package/dist/react/index.js +2 -1
  49. package/dist/react/index.js.map +1 -1
  50. package/dist/react/shell.d.ts +4 -1
  51. package/dist/react/shell.d.ts.map +1 -1
  52. package/dist/react/shell.js +2 -2
  53. package/dist/react/shell.js.map +1 -1
  54. package/dist/react/soundsToggle.d.ts +14 -0
  55. package/dist/react/soundsToggle.d.ts.map +1 -0
  56. package/dist/react/soundsToggle.js +12 -0
  57. package/dist/react/soundsToggle.js.map +1 -0
  58. package/llms.txt +44 -14
  59. package/package.json +7 -2
  60. package/src/core/index.ts +2 -0
  61. package/src/core/look.ts +43 -0
  62. package/src/css/conversation.css +21 -0
  63. package/src/css/dock.css +123 -3
  64. package/src/css/looks.css +257 -0
  65. package/src/css/tokens.css +5 -1
  66. package/src/fx/fx.ts +145 -0
  67. package/src/fx/index.ts +6 -0
  68. package/src/fx/measure.ts +70 -0
  69. package/src/fx/sounds.ts +213 -0
  70. package/src/react/Desktop.tsx +97 -29
  71. package/src/react/Dock.tsx +16 -3
  72. package/src/react/context.tsx +25 -3
  73. package/src/react/conversation.tsx +18 -1
  74. package/src/react/index.ts +4 -2
  75. package/src/react/shell.tsx +5 -2
  76. package/src/react/soundsToggle.tsx +19 -0
package/README.md CHANGED
@@ -141,9 +141,9 @@ Links work the same everywhere: a link opens the same windows, shown one at a ti
141
141
 
142
142
  ## Dock
143
143
 
144
- ![The Window menu open over a filled window, with the dock below](https://raw.githubusercontent.com/liberation-data/desk/main/docs/screenshots/menus.png)
144
+ ![The Window menu open over a filled window, with the dock beside it](https://raw.githubusercontent.com/liberation-data/desk/main/docs/screenshots/menus.png)
145
145
 
146
- <sub>The dock along the bottom, with a badge and a stack; the Window menu listing what is open.</sub>
146
+ <sub>The dock on the left, with a badge and stacks; the Window menu listing what is open.</sub>
147
147
 
148
148
  ```tsx
149
149
  import { Dock, dockItem, dockSeparator, dockStack } from '@liberation-data/desk/react'
@@ -159,11 +159,17 @@ import { Dock, dockItem, dockSeparator, dockStack } from '@liberation-data/desk/
159
159
  ```
160
160
 
161
161
  An item opens the window with its id (or `window`), and shows a dot while that window is open. A stack fans
162
- its items out above the dock and previews the first four icons. `onSelect` replaces opening a window.
162
+ its items out toward the desk and previews the first four icons. `onSelect` replaces opening a window.
163
163
 
164
- The dock is one tab stop: arrow keys move along it, Enter opens, Escape folds a stack away and returns focus
165
- to it. With `placement="overlay"` (the default) it floats over the bottom of its positioned parent; set
166
- `--desk-inset-bottom` so windows stop above it.
164
+ `side` puts the dock on the `left` (the default), `right` or `bottom` of the desk. Left, because a bottom
165
+ dock takes height from every window — which is what a laptop has least of — and on a Mac it sits on top
166
+ of the real one.
167
+
168
+ The dock is one tab stop: arrow keys move along it (Up and Down when it stands at a side), Enter opens,
169
+ Escape folds a stack away and returns focus to it. With `placement="overlay"` (the default) it floats over
170
+ its positioned parent and makes its own room: a `<Desktop>` beside it starts where the dock ends, so no
171
+ window opens underneath it. That needs the dock and the desktop to be siblings; composed any other way,
172
+ set `--desk-inset-bottom` (or pad the stage) yourself.
167
173
 
168
174
  ### Keeping things in the dock
169
175
 
@@ -692,8 +698,65 @@ import '@liberation-data/desk/css/conversation.css'
692
698
  import '@liberation-data/desk/css/search.css'
693
699
  import '@liberation-data/desk/css/setup.css' // the wizard and tours
694
700
  import '@liberation-data/desk/css/apps.css' // app frames and dragging between windows
701
+ import '@liberation-data/desk/css/looks.css' // GNOME and Windows chrome: last, it restyles the rest
695
702
  ``` Light and dark follow `prefers-color-scheme`, and `data-theme="light|dark"` on the root wins.
696
703
 
704
+ ## Looks
705
+
706
+ ![Four arranged windows in the GNOME look](https://raw.githubusercontent.com/liberation-data/desk/main/docs/screenshots/look-gnome.png)
707
+
708
+ <sub>The GNOME look: title bars with the title centred and the controls at the end, a dark top bar and dash.</sub>
709
+
710
+ ![Four arranged windows in the Windows look](https://raw.githubusercontent.com/liberation-data/desk/main/docs/screenshots/look-windows.png)
711
+
712
+ <sub>The Windows look: full-height controls with a red close, and a pill under each open item in the dock.</sub>
713
+
714
+ The desk wears the chrome of the platform it is on — Mac, GNOME or Windows — and an app can choose one
715
+ instead. Where a window's controls sit and what they look like, how the title, the menu bar and the dock
716
+ are drawn: that is the look. It is separate from the theme, so every look comes light and dark.
717
+
718
+ ```tsx
719
+ <DeskShell look="auto"> {/* 'auto' (the default) | 'mac' | 'gnome' | 'windows' */}
720
+ ```
721
+
722
+ `auto` reads the device: Macs, iPhones and iPads get `mac`, Windows gets `windows`, Linux and ChromeOS get
723
+ `gnome`, and anything else gets `mac`. The look is set as `data-look` on the root, so menus and popovers
724
+ portalled out of the desk get it too. The desk does not remember a choice: keep it where the app keeps its
725
+ other preferences and pass it back in, as the garage sample's Settings does.
726
+
727
+ A look changes chrome, not brand: it never touches `--desk-accent` or `--desk-ground`. Nor the keyboard —
728
+ somebody on a Mac who picks the GNOME look still presses ⌘, and menus still say so. An app drawing chrome
729
+ of its own reads the look with `useLook()`, as the sample does to call its Window menu's Zoom *Maximize*
730
+ off a Mac.
731
+
732
+ ## Sounds
733
+
734
+ Three sounds, synthesised, in their own entry point so an app that makes none loads none:
735
+
736
+ ```tsx
737
+ import { createFx } from '@liberation-data/desk/fx'
738
+ import { SoundsToggle } from '@liberation-data/desk/react'
739
+
740
+ const fx = createFx({ storageKey: 'garage.sounds-muted' }) // one per app
741
+ fx.unlock() // audio opens on the first press
742
+
743
+ fx.play('attention') // something is waiting on this person
744
+ fx.play('ready') // something to look at when they are ready
745
+ fx.play('failed') // their work did not finish
746
+
747
+ <SoundsToggle fx={fx} description="When a part needs you, when a service is ready, and when one fails" />
748
+ ```
749
+
750
+ They are one family, told apart by shape: attention rises, ready is small and high, failed is a low
751
+ growl. Each is levelled to the same loudness on a laptop speaker, measured rather than judged by ear —
752
+ `measureLoudness` is exported, for checking a sound of your own. A second request for the same sound
753
+ within 1.5 seconds is the same event, and plays once. Nothing plays before the first press: browsers
754
+ refuse, so `unlock()` takes that press. The mute is this browser's, and `SoundsToggle` follows it across
755
+ tabs.
756
+
757
+ An app's own sound — a chime when it opens, say — goes in `createFx({ sounds: { chime } })`, and obeys the
758
+ same mute. When to make a sound is the hard part: see [HIG.md](HIG.md), Sound.
759
+
697
760
  ## Docs
698
761
 
699
762
  - [docs/guide.md](docs/guide.md) — building an app with it, and what catches people out
@@ -707,7 +770,7 @@ npm install
707
770
  npm test # vitest
708
771
  npm run typecheck
709
772
  npm run example # the Garage sample in examples/garage
710
- npm run size # the gzipped budget: core 11 KiB, react 46, css 10
773
+ npm run size # the gzipped budget: core 13 KiB, react 52, css 16, fx 5
711
774
  npm run check # everything CI runs
712
775
  npm run check:browser # the generated-app bridge in real Chrome, against a running sample
713
776
  npm run build # dist/
@@ -6,6 +6,8 @@ export { createBus, InputCommands, topicMatches } from './events.js';
6
6
  export type { Bus, DeskEvent, EventHandler, InputDescription, SubscribeOptions } from './events.js';
7
7
  export { bindShortcuts, formatShortcut, isApplePlatform, isInstalledApp, matchesShortcut, parseShortcut } from './shortcuts.js';
8
8
  export type { Keymap, Shortcut, ShortcutOptions } from './shortcuts.js';
9
+ export { deviceLook, lookFor, resolveLook } from './look.js';
10
+ export type { Look, LookChoice } from './look.js';
9
11
  export { parse, serialize, syncWithLocation } from './location.js';
10
12
  export { isTitleCase, titleCase } from './titles.js';
11
13
  export { fitFrame, localLayoutStore, stepFrom } from './layouts.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,UAAU,EACV,KAAK,GACN,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,IA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jE,YAAY,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAA"}
@@ -2,6 +2,7 @@ export { createDesk, cascadeFrame, cascadeSlot, focusedId, instancesOf, isMinimi
2
2
  export { addCommandHandler, addDeskCommands, canPerform, chainStart, DeskCommands, perform, STAGE_ATTRIBUTE, WINDOW_ATTRIBUTE, windowElement, } from './commands.js';
3
3
  export { createBus, InputCommands, topicMatches } from './events.js';
4
4
  export { bindShortcuts, formatShortcut, isApplePlatform, isInstalledApp, matchesShortcut, parseShortcut } from './shortcuts.js';
5
+ export { deviceLook, lookFor, resolveLook } from './look.js';
5
6
  export { parse, serialize, syncWithLocation } from './location.js';
6
7
  export { isTitleCase, titleCase } from './titles.js';
7
8
  export { fitFrame, localLayoutStore, stepFrom } from './layouts.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,UAAU,EACV,KAAK,GACN,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE/H,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,UAAU,EACV,KAAK,GACN,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE/H,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,12 @@
1
+ export type Look = 'mac' | 'gnome' | 'windows';
2
+ /** What an app asks for: a look, or `auto` for the one that matches the device. */
3
+ export type LookChoice = Look | 'auto';
4
+ /**
5
+ * The look for a device, from its platform string and user agent. A device it does not recognise
6
+ * gets `mac`, which is how desk looked before it had looks.
7
+ */
8
+ export declare function lookFor(platform: string, userAgent: string): Look;
9
+ /** The look for the device this is running on; `mac` where there is no navigator to ask. */
10
+ export declare function deviceLook(): Look;
11
+ export declare const resolveLook: (choice: LookChoice) => Look;
12
+ //# sourceMappingURL=look.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"look.d.ts","sourceRoot":"","sources":["../../src/core/look.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAA;AAE9C,mFAAmF;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,CAAA;AAEtC;;;GAGG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAQjE;AAQD,4FAA4F;AAC5F,wBAAgB,UAAU,IAAI,IAAI,CAIjC;AAED,eAAO,MAAM,WAAW,WAAY,UAAU,KAAG,IAAmD,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The look for a device, from its platform string and user agent. A device it does not recognise
3
+ * gets `mac`, which is how desk looked before it had looks.
4
+ */
5
+ export function lookFor(platform, userAgent) {
6
+ // Android reports a Linux platform, and is not a Linux desktop.
7
+ if (/android/i.test(userAgent))
8
+ return 'mac';
9
+ const device = `${platform} ${userAgent}`;
10
+ if (/mac|iphone|ipad|ipod|ios/i.test(device))
11
+ return 'mac';
12
+ if (/win/i.test(device))
13
+ return 'windows';
14
+ if (/linux|cros|chrome os|x11|bsd/i.test(device))
15
+ return 'gnome';
16
+ return 'mac';
17
+ }
18
+ /** The look for the device this is running on; `mac` where there is no navigator to ask. */
19
+ export function deviceLook() {
20
+ if (typeof navigator === 'undefined')
21
+ return 'mac';
22
+ const hints = navigator;
23
+ return lookFor(hints.userAgentData?.platform || hints.platform || '', hints.userAgent ?? '');
24
+ }
25
+ export const resolveLook = (choice) => (choice === 'auto' ? deviceLook() : choice);
26
+ //# sourceMappingURL=look.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"look.js","sourceRoot":"","sources":["../../src/core/look.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,QAAgB,EAAE,SAAiB;IACzD,gEAAgE;IAChE,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5C,MAAM,MAAM,GAAG,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAA;IACzC,IAAI,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1D,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IACzC,IAAI,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,OAAO,CAAA;IAChE,OAAO,KAAK,CAAA;AACd,CAAC;AAQD,4FAA4F;AAC5F,MAAM,UAAU,UAAU;IACxB,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;IAClD,MAAM,KAAK,GAAG,SAA+B,CAAA;IAC7C,OAAO,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,IAAI,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA;AAC9F,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAQ,EAAE,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA"}
@@ -47,8 +47,29 @@
47
47
  font-size: 11.5px;
48
48
  font-weight: 600;
49
49
  color: var(--desk-muted);
50
+ /* A row, so an avatar and the name share a baseline rather than the mark pushing the name
51
+ down by its own height. */
52
+ display: flex;
53
+ align-items: center;
54
+ gap: var(--desk-space-1);
55
+ }
56
+
57
+ /*
58
+ * Who is speaking, beside their name. Sized here rather than by the caller so every application
59
+ * that supplies one lands on the same line — a node is free to be anything, but it is not free to
60
+ * be any size.
61
+ */
62
+ .desk-message-avatar {
63
+ display: inline-flex;
64
+ flex: none;
65
+ align-items: center;
66
+ justify-content: center;
67
+ inline-size: 18px;
68
+ block-size: 18px;
50
69
  }
51
70
 
71
+ .desk-message-avatar > * { inline-size: 100%; block-size: 100%; }
72
+
52
73
  .desk-bubble {
53
74
  padding: var(--desk-space-2) var(--desk-space-3);
54
75
  border: 1px solid var(--desk-rule);
package/dist/css/dock.css CHANGED
@@ -20,12 +20,56 @@
20
20
 
21
21
  .desk-dock[data-placement="overlay"] {
22
22
  position: absolute;
23
- left: 50%;
24
- bottom: 12px;
25
23
  z-index: 1000;
24
+ }
25
+
26
+ .desk-dock[data-placement="overlay"][data-side="bottom"] {
27
+ left: 50%;
28
+ bottom: var(--desk-dock-offset);
26
29
  transform: translateX(-50%);
27
30
  }
28
31
 
32
+ .desk-dock[data-placement="overlay"]:not([data-side="bottom"]) {
33
+ top: 50%;
34
+ transform: translateY(-50%);
35
+ }
36
+
37
+ .desk-dock[data-placement="overlay"][data-side="left"] {
38
+ left: var(--desk-dock-offset);
39
+ }
40
+
41
+ .desk-dock[data-placement="overlay"][data-side="right"] {
42
+ right: var(--desk-dock-offset);
43
+ }
44
+
45
+ /* Standing in a column: items top to bottom, and never taller than the room it stands in. */
46
+ .desk-dock:not([data-side="bottom"]) {
47
+ flex-direction: column;
48
+ align-items: center;
49
+ max-width: none;
50
+ max-height: calc(100% - 2 * var(--desk-dock-offset));
51
+ /* The same thickness standing up as lying down, so --desk-dock-room holds on every side. */
52
+ padding: 9px 7px;
53
+ }
54
+
55
+ /*
56
+ * An overlay dock makes its own room. The stage beside it starts where the dock ends — a margin, not
57
+ * padding, because windows are placed from the stage's own corner: padding would keep filled windows
58
+ * clear and still open every free one underneath the dock.
59
+ */
60
+ :has(> .desk-dock[data-placement="overlay"][data-side="left"]) > .desk-stage {
61
+ margin-left: var(--desk-dock-room);
62
+ }
63
+
64
+ :has(> .desk-dock[data-placement="overlay"][data-side="right"]) > .desk-stage {
65
+ margin-right: var(--desk-dock-room);
66
+ }
67
+
68
+ :has(> .desk-dock[data-placement="overlay"][data-side="bottom"]) > .desk-stage {
69
+ /* The stage is `height: 100%`, so a margin would push it past its parent rather than shorten it. */
70
+ height: calc(100% - var(--desk-dock-room));
71
+ }
72
+
29
73
  .desk-dock-separator {
30
74
  flex: none;
31
75
  align-self: stretch;
@@ -34,6 +78,12 @@
34
78
  background: var(--desk-rule);
35
79
  }
36
80
 
81
+ .desk-dock:not([data-side="bottom"]) .desk-dock-separator {
82
+ width: auto;
83
+ height: 1px;
84
+ margin: 4px 6px;
85
+ }
86
+
37
87
  .desk-dock-slot {
38
88
  position: relative;
39
89
  display: flex;
@@ -67,11 +117,22 @@
67
117
  outline-offset: 2px;
68
118
  }
69
119
 
120
+ /* Magnified toward the desk, whichever side that is. */
70
121
  @media (hover: hover) and (pointer: fine) {
71
- .desk-dock-item:hover:not(:disabled) {
122
+ .desk-dock[data-side="bottom"] .desk-dock-item:hover:not(:disabled) {
72
123
  transform: translateY(-8px) scale(1.14);
73
124
  margin: 0 5px;
74
125
  }
126
+
127
+ .desk-dock[data-side="left"] .desk-dock-item:hover:not(:disabled) {
128
+ transform: translateX(8px) scale(1.14);
129
+ margin: 5px 0;
130
+ }
131
+
132
+ .desk-dock[data-side="right"] .desk-dock-item:hover:not(:disabled) {
133
+ transform: translateX(-8px) scale(1.14);
134
+ margin: 5px 0;
135
+ }
75
136
  }
76
137
 
77
138
  .desk-dock-icon {
@@ -127,6 +188,22 @@
127
188
  background: var(--desk-muted);
128
189
  }
129
190
 
191
+ /* On a dock at the side the dot sits between the item and the edge of the screen, as it does under a bottom one. */
192
+ .desk-dock:not([data-side="bottom"]) .desk-dock-item[data-running]::after {
193
+ top: 50%;
194
+ bottom: auto;
195
+ margin: -2px 0 0;
196
+ }
197
+
198
+ .desk-dock[data-side="left"] .desk-dock-item[data-running]::after {
199
+ left: -6px;
200
+ }
201
+
202
+ .desk-dock[data-side="right"] .desk-dock-item[data-running]::after {
203
+ left: auto;
204
+ right: -6px;
205
+ }
206
+
130
207
  .desk-dock-item[data-focused]::after {
131
208
  background: var(--desk-accent);
132
209
  }
@@ -174,6 +251,21 @@
174
251
  transition: opacity .12s;
175
252
  }
176
253
 
254
+ .desk-dock:not([data-side="bottom"]) .desk-dock-tip {
255
+ bottom: auto;
256
+ top: 50%;
257
+ transform: translateY(-50%);
258
+ }
259
+
260
+ .desk-dock[data-side="left"] .desk-dock-tip {
261
+ left: calc(100% + 14px);
262
+ }
263
+
264
+ .desk-dock[data-side="right"] .desk-dock-tip {
265
+ left: auto;
266
+ right: calc(100% + 14px);
267
+ }
268
+
177
269
  .desk-dock-item:hover .desk-dock-tip,
178
270
  .desk-dock-item:focus-visible .desk-dock-tip {
179
271
  opacity: 1;
@@ -211,6 +303,30 @@
211
303
  }
212
304
  }
213
305
 
306
+ /* Beside a dock at the side, level with the stack it came from, opening toward the desk. */
307
+ .desk-dock:not([data-side="bottom"]) .desk-stack {
308
+ bottom: auto;
309
+ top: 0;
310
+ transform: none;
311
+ animation-name: desk-pop-aside;
312
+ }
313
+
314
+ .desk-dock[data-side="left"] .desk-stack {
315
+ left: calc(100% + 18px);
316
+ }
317
+
318
+ .desk-dock[data-side="right"] .desk-stack {
319
+ left: auto;
320
+ right: calc(100% + 18px);
321
+ }
322
+
323
+ @keyframes desk-pop-aside {
324
+ from {
325
+ opacity: 0;
326
+ scale: .98;
327
+ }
328
+ }
329
+
214
330
  .desk-stack-title {
215
331
  margin: 0 0 8px 4px;
216
332
  font-size: 11px;
@@ -276,3 +392,7 @@
276
392
  .desk-dock-item[data-desk-drop][data-over] {
277
393
  box-shadow: -6px 0 0 -2px var(--desk-accent);
278
394
  }
395
+
396
+ .desk-dock:not([data-side="bottom"]) .desk-dock-item[data-desk-drop][data-over] {
397
+ box-shadow: 0 -6px 0 -2px var(--desk-accent);
398
+ }
@@ -0,0 +1,258 @@
1
+ /* @liberation-data/desk — looks.css */
2
+ /*
3
+ * Looks: the platform chrome, on `data-look` at the root. The rest of desk.css is the Mac look, so
4
+ * this part only says how GNOME and Windows differ from it.
5
+ *
6
+ * A look changes chrome, never brand: nothing here sets --desk-accent or --desk-ground. Selectors
7
+ * carry the look AND the base rule's own specificity, so they win by coming later, not by !important.
8
+ */
9
+
10
+ /* ── GNOME (Adwaita) ── */
11
+
12
+ [data-look="gnome"] {
13
+ --desk-font: Cantarell, "Adwaita Sans", system-ui, sans-serif;
14
+ }
15
+
16
+ /*
17
+ * Title and note stacked in the middle of the bar, centred on the bar and not on the space left over,
18
+ * as a GNOME header bar does. The end of the bar keeps room for the controls and a little more.
19
+ */
20
+ [data-look="gnome"] .desk-titlebar {
21
+ position: relative;
22
+ min-height: 46px;
23
+ padding: 0 11px;
24
+ justify-content: flex-end;
25
+ }
26
+
27
+ [data-look="gnome"] .desk-titlebar-heading {
28
+ position: absolute;
29
+ left: 50%;
30
+ transform: translateX(-50%);
31
+ max-width: calc(100% - 2 * 120px);
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ text-align: center;
36
+ pointer-events: none;
37
+ }
38
+
39
+ [data-look="gnome"] .desk-titlebar-heading > * {
40
+ max-width: 100%;
41
+ }
42
+
43
+ [data-look="gnome"] .desk-title {
44
+ font-size: 13.5px;
45
+ font-weight: 700;
46
+ }
47
+
48
+ [data-look="gnome"] .desk-window-note {
49
+ margin: 0;
50
+ font-size: 11.5px;
51
+ }
52
+
53
+ [data-look="gnome"] .desk-window .desk-controls {
54
+ gap: 12px;
55
+ }
56
+
57
+ [data-look="gnome"] .desk-window .desk-control[data-control] {
58
+ width: 24px;
59
+ height: 24px;
60
+ background: color-mix(in srgb, var(--desk-ink) 10%, transparent);
61
+ color: var(--desk-ink);
62
+ }
63
+
64
+ [data-look="gnome"] .desk-window .desk-controls .desk-control[data-control]:hover {
65
+ background: color-mix(in srgb, var(--desk-ink) 16%, transparent);
66
+ }
67
+
68
+ [data-look="gnome"] .desk-window .desk-controls .desk-control[data-control]:active {
69
+ background: color-mix(in srgb, var(--desk-ink) 26%, transparent);
70
+ }
71
+
72
+ /* GNOME's marks are always there: symbolic icons, not colours. */
73
+ [data-look="gnome"] .desk-window .desk-control-glyph {
74
+ opacity: 1;
75
+ color: currentColor;
76
+ stroke-width: 1.3;
77
+ }
78
+
79
+ /* The key window is told apart by its shadow and its title, not by an accent border. */
80
+ [data-look="gnome"] .desk-window[data-focused] {
81
+ border-color: var(--desk-rule);
82
+ }
83
+
84
+ /* ── Windows 11 ── */
85
+
86
+ [data-look="windows"] {
87
+ --desk-font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
88
+ --desk-radius: 8px;
89
+ }
90
+
91
+ /* The controls run the full height of the bar, flush to its end. */
92
+ [data-look="windows"] .desk-titlebar {
93
+ min-height: 32px;
94
+ padding: 0 0 0 12px;
95
+ align-items: stretch;
96
+ background: var(--desk-surface);
97
+ }
98
+
99
+ [data-look="windows"] .desk-titlebar > * {
100
+ align-self: center;
101
+ }
102
+
103
+ [data-look="windows"] .desk-title {
104
+ flex: 1 1 auto;
105
+ font-size: 12px;
106
+ font-weight: 400;
107
+ }
108
+
109
+ [data-look="windows"] .desk-titlebar > .desk-controls {
110
+ align-self: stretch;
111
+ margin-left: var(--desk-space-2);
112
+ gap: 0;
113
+ }
114
+
115
+ [data-look="windows"] .desk-window .desk-control[data-control] {
116
+ width: 46px;
117
+ height: auto;
118
+ border-radius: 0;
119
+ background: transparent;
120
+ color: var(--desk-ink);
121
+ }
122
+
123
+ [data-look="windows"] .desk-window .desk-controls .desk-control[data-control]:hover {
124
+ background: color-mix(in srgb, var(--desk-ink) 8%, transparent);
125
+ }
126
+
127
+ [data-look="windows"] .desk-window .desk-controls .desk-control[data-control="close"]:hover {
128
+ background: #c42b1c;
129
+ color: #ffffff;
130
+ }
131
+
132
+ [data-look="windows"] .desk-window .desk-control-glyph {
133
+ width: 10px;
134
+ height: 10px;
135
+ opacity: 1;
136
+ color: currentColor;
137
+ stroke-width: 1;
138
+ stroke-linecap: butt;
139
+ }
140
+
141
+ [data-look="windows"] .desk-window:not([data-focused]) .desk-control-glyph {
142
+ opacity: .45;
143
+ }
144
+
145
+ [data-look="windows"] .desk-control:focus-visible {
146
+ outline-offset: -2px;
147
+ }
148
+
149
+ /*
150
+ * ── GNOME shell: the top bar and the dash are dark in either theme, and so is what opens from them ──
151
+ * The tokens are redefined on the bar and the dock themselves, so their menus and stacks, which sit
152
+ * inside them, come out dark too — as the shell's own menus do.
153
+ */
154
+ [data-look="gnome"] .desk-menubar,
155
+ [data-look="gnome"] .desk-dock {
156
+ --desk-ink: #ffffff;
157
+ --desk-muted: rgb(255 255 255 / 68%);
158
+ --desk-surface: #2a2a2a;
159
+ --desk-rule: rgb(255 255 255 / 10%);
160
+ --desk-dock-icon: transparent;
161
+ }
162
+
163
+ [data-look="gnome"] .desk-menubar {
164
+ height: 32px;
165
+ --desk-dock-glass: rgb(0 0 0 / 94%);
166
+ border-bottom: 0;
167
+ font-weight: 600;
168
+ }
169
+
170
+ [data-look="gnome"] .desk-menubar-title {
171
+ border-radius: 999px;
172
+ }
173
+
174
+ [data-look="gnome"] .desk-menu {
175
+ border-radius: 12px;
176
+ padding: 6px;
177
+ }
178
+
179
+ [data-look="gnome"] .desk-menu-item {
180
+ border-radius: 6px;
181
+ font-weight: 400;
182
+ }
183
+
184
+ [data-look="gnome"] .desk-menu-item[data-active],
185
+ [data-look="windows"] .desk-menu-item[data-active] {
186
+ background: color-mix(in srgb, var(--desk-ink) 10%, transparent);
187
+ color: var(--desk-ink);
188
+ }
189
+
190
+ [data-look="gnome"] .desk-dock {
191
+ --desk-dock-glass: rgb(24 24 24 / 86%);
192
+ border-radius: 20px;
193
+ }
194
+
195
+ [data-look="gnome"] .desk-dock .desk-dock-item {
196
+ border: 0;
197
+ border-radius: 12px;
198
+ }
199
+
200
+ /* No magnification: GNOME's dash lights an item up rather than growing it. */
201
+ [data-look="gnome"] .desk-dock .desk-dock-item:hover:not(:disabled),
202
+ [data-look="windows"] .desk-dock .desk-dock-item:hover:not(:disabled) {
203
+ transform: none;
204
+ margin: 0;
205
+ background: color-mix(in srgb, var(--desk-ink) 12%, transparent);
206
+ }
207
+
208
+ /* ── Windows: a flat bar, taskbar tiles, and a pill that widens for the key window ── */
209
+
210
+ [data-look="windows"] .desk-menubar {
211
+ background: var(--desk-surface);
212
+ backdrop-filter: none;
213
+ -webkit-backdrop-filter: none;
214
+ }
215
+
216
+ [data-look="windows"] .desk-menubar-title,
217
+ [data-look="windows"] .desk-menu-item {
218
+ border-radius: 4px;
219
+ }
220
+
221
+ [data-look="windows"] .desk-menu {
222
+ border-radius: 8px;
223
+ padding: 4px;
224
+ }
225
+
226
+ [data-look="windows"] .desk-dock {
227
+ border-radius: 8px;
228
+ }
229
+
230
+ [data-look="windows"] .desk-dock .desk-dock-item {
231
+ border: 0;
232
+ border-radius: 4px;
233
+ background: transparent;
234
+ }
235
+
236
+ [data-look="windows"] .desk-dock .desk-dock-item[data-running]::after {
237
+ width: 6px;
238
+ height: 3px;
239
+ margin-left: -3px;
240
+ border-radius: 2px;
241
+ bottom: -4px;
242
+ }
243
+
244
+ [data-look="windows"] .desk-dock[data-side="bottom"] .desk-dock-item[data-focused]::after {
245
+ width: 16px;
246
+ margin-left: -8px;
247
+ }
248
+
249
+ [data-look="windows"] .desk-dock:not([data-side="bottom"]) .desk-dock-item[data-running]::after {
250
+ width: 3px;
251
+ height: 6px;
252
+ margin: -3px 0 0;
253
+ }
254
+
255
+ [data-look="windows"] .desk-dock:not([data-side="bottom"]) .desk-dock-item[data-focused]::after {
256
+ height: 16px;
257
+ margin-top: -8px;
258
+ }
@@ -47,11 +47,15 @@
47
47
  --desk-on-accent: #ffffff;
48
48
  --desk-ease: cubic-bezier(.32, .72, 0, 1);
49
49
  --desk-dock-size: 48px;
50
+ /* How far an overlay dock stands off the edge of the desk. */
51
+ --desk-dock-offset: 12px;
52
+ /* The room an overlay dock takes from the stage beside it: the offset, the dock, its border and padding. */
53
+ --desk-dock-room: calc(var(--desk-dock-offset) + var(--desk-dock-size) + 16px);
50
54
  --desk-dock-glass: rgb(255 255 255 / 72%);
51
55
  --desk-dock-icon: linear-gradient(160deg, #ffffff, #eceff5);
52
56
  --desk-badge: #ef4444;
53
57
  --desk-badge-ink: #ffffff;
54
- /* Room the stage leaves at the bottom for an overlay dock. */
58
+ /* Room the stage leaves at the bottom for something of the app's own. An overlay dock makes its own. */
55
59
  --desk-inset-bottom: 0px;
56
60
  }
57
61