@liberation-data/desk 0.41.0 → 0.43.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 (112) hide show
  1. package/README.md +152 -9
  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/scheme.d.ts +12 -0
  7. package/dist/core/scheme.d.ts.map +1 -0
  8. package/dist/core/scheme.js +15 -0
  9. package/dist/core/scheme.js.map +1 -0
  10. package/dist/core/types.d.ts +6 -0
  11. package/dist/core/types.d.ts.map +1 -1
  12. package/dist/css/apps.css +149 -0
  13. package/dist/css/controls.css +21 -2
  14. package/dist/css/dock.css +1 -1
  15. package/dist/css/looks.css +50 -4
  16. package/dist/css/overlays.css +6 -0
  17. package/dist/css/tokens.css +1 -0
  18. package/dist/css/windows.css +173 -5
  19. package/dist/desk.css +401 -12
  20. package/dist/react/Desktop.d.ts +12 -3
  21. package/dist/react/Desktop.d.ts.map +1 -1
  22. package/dist/react/Desktop.js +29 -9
  23. package/dist/react/Desktop.js.map +1 -1
  24. package/dist/react/Dock.d.ts +6 -1
  25. package/dist/react/Dock.d.ts.map +1 -1
  26. package/dist/react/Dock.js +9 -1
  27. package/dist/react/Dock.js.map +1 -1
  28. package/dist/react/MenuBar.d.ts +8 -1
  29. package/dist/react/MenuBar.d.ts.map +1 -1
  30. package/dist/react/MenuBar.js +34 -5
  31. package/dist/react/MenuBar.js.map +1 -1
  32. package/dist/react/app.d.ts +174 -0
  33. package/dist/react/app.d.ts.map +1 -0
  34. package/dist/react/app.js +146 -0
  35. package/dist/react/app.js.map +1 -0
  36. package/dist/react/appPanels.d.ts +22 -0
  37. package/dist/react/appPanels.d.ts.map +1 -0
  38. package/dist/react/appPanels.js +114 -0
  39. package/dist/react/appPanels.js.map +1 -0
  40. package/dist/react/appearance.d.ts +55 -0
  41. package/dist/react/appearance.d.ts.map +1 -0
  42. package/dist/react/appearance.js +140 -0
  43. package/dist/react/appearance.js.map +1 -0
  44. package/dist/react/arrange.d.ts +6 -0
  45. package/dist/react/arrange.d.ts.map +1 -1
  46. package/dist/react/arrange.js +21 -0
  47. package/dist/react/arrange.js.map +1 -1
  48. package/dist/react/codeBlock.d.ts.map +1 -1
  49. package/dist/react/codeBlock.js +6 -60
  50. package/dist/react/codeBlock.js.map +1 -1
  51. package/dist/react/context.d.ts +9 -1
  52. package/dist/react/context.d.ts.map +1 -1
  53. package/dist/react/context.js +47 -3
  54. package/dist/react/context.js.map +1 -1
  55. package/dist/react/copy.d.ts +22 -0
  56. package/dist/react/copy.d.ts.map +1 -0
  57. package/dist/react/copy.js +68 -0
  58. package/dist/react/copy.js.map +1 -0
  59. package/dist/react/documentTitle.d.ts.map +1 -1
  60. package/dist/react/documentTitle.js +4 -1
  61. package/dist/react/documentTitle.js.map +1 -1
  62. package/dist/react/index.d.ts +10 -1
  63. package/dist/react/index.d.ts.map +1 -1
  64. package/dist/react/index.js +7 -1
  65. package/dist/react/index.js.map +1 -1
  66. package/dist/react/layers.d.ts.map +1 -1
  67. package/dist/react/layers.js +7 -2
  68. package/dist/react/layers.js.map +1 -1
  69. package/dist/react/overlays.d.ts.map +1 -1
  70. package/dist/react/overlays.js +29 -12
  71. package/dist/react/overlays.js.map +1 -1
  72. package/dist/react/shell.d.ts +4 -1
  73. package/dist/react/shell.d.ts.map +1 -1
  74. package/dist/react/shell.js +2 -2
  75. package/dist/react/shell.js.map +1 -1
  76. package/dist/react/tabs.d.ts +7 -1
  77. package/dist/react/tabs.d.ts.map +1 -1
  78. package/dist/react/tabs.js +13 -8
  79. package/dist/react/tabs.js.map +1 -1
  80. package/dist/react/widgets.d.ts +33 -0
  81. package/dist/react/widgets.d.ts.map +1 -0
  82. package/dist/react/widgets.js +213 -0
  83. package/dist/react/widgets.js.map +1 -0
  84. package/llms.txt +75 -8
  85. package/package.json +1 -1
  86. package/src/core/index.ts +2 -0
  87. package/src/core/scheme.ts +21 -0
  88. package/src/core/types.ts +6 -0
  89. package/src/css/apps.css +149 -0
  90. package/src/css/controls.css +21 -2
  91. package/src/css/dock.css +1 -1
  92. package/src/css/looks.css +50 -4
  93. package/src/css/overlays.css +6 -0
  94. package/src/css/tokens.css +1 -0
  95. package/src/css/windows.css +173 -5
  96. package/src/react/Desktop.tsx +50 -12
  97. package/src/react/Dock.tsx +11 -1
  98. package/src/react/MenuBar.tsx +38 -5
  99. package/src/react/app.tsx +284 -0
  100. package/src/react/appPanels.tsx +197 -0
  101. package/src/react/appearance.tsx +204 -0
  102. package/src/react/arrange.ts +23 -0
  103. package/src/react/codeBlock.tsx +7 -65
  104. package/src/react/context.tsx +55 -3
  105. package/src/react/copy.ts +81 -0
  106. package/src/react/documentTitle.ts +4 -1
  107. package/src/react/index.ts +30 -1
  108. package/src/react/layers.ts +7 -2
  109. package/src/react/overlays.tsx +30 -12
  110. package/src/react/shell.tsx +5 -2
  111. package/src/react/tabs.tsx +23 -10
  112. package/src/react/widgets.tsx +265 -0
package/dist/desk.css CHANGED
@@ -85,6 +85,7 @@
85
85
  --desk-dock-icon: linear-gradient(160deg, #ffffff, #eceff5);
86
86
  --desk-badge: #ef4444;
87
87
  --desk-badge-ink: #ffffff;
88
+ --desk-widget-width: 200px;
88
89
  /* Room the stage leaves at the bottom for something of the app's own. An overlay dock makes its own. */
89
90
  --desk-inset-bottom: 0px;
90
91
  }
@@ -339,16 +340,18 @@
339
340
  color: var(--desk-muted);
340
341
  }
341
342
 
342
- /* The note gives up the spare room; the (i) keeps its place at the end of the bar. */
343
343
  /*
344
- * The (i) is the bar's last word, at its trailing end, with or without a note before it. It sits in its popover's
345
- * anchor, so the anchor is what the bar lays out: a margin on the button inside it would move nothing.
344
+ * The (i) is on the bar's far edge, opposite the controls: here, on a Mac, it is the bar's last word, after
345
+ * the note and the actions. Whatever comes before it takes the spare room, and it follows. It sits in its
346
+ * popover's anchor, so the anchor is what the bar lays out: a margin on the button inside it would move
347
+ * nothing. The other looks put it first, and say so in looks.css.
346
348
  */
347
349
  .desk-titlebar > .desk-popover-anchor:has(> .desk-window-info) {
348
350
  margin-left: auto;
349
351
  }
350
352
 
351
- .desk-window-note ~ .desk-popover-anchor:has(> .desk-window-info) {
353
+ .desk-window-note ~ .desk-popover-anchor:has(> .desk-window-info),
354
+ .desk-window-actions ~ .desk-popover-anchor:has(> .desk-window-info) {
352
355
  margin-left: var(--desk-space-2);
353
356
  }
354
357
 
@@ -397,6 +400,12 @@
397
400
  margin-left: var(--desk-space-3);
398
401
  }
399
402
 
403
+ /* The count has taken the spare room, so what follows it keeps to it rather than splitting the room. */
404
+ .desk-window-progress ~ .desk-window-actions,
405
+ .desk-window-progress ~ .desk-popover-anchor:has(> .desk-window-info) {
406
+ margin-left: var(--desk-space-2);
407
+ }
408
+
400
409
  .desk-titlebar[data-progress] .desk-title,
401
410
  .desk-titlebar[data-progress] .desk-window-note {
402
411
  max-width: none;
@@ -424,7 +433,13 @@
424
433
  .desk-window-progress-fill { transition: none; }
425
434
  }
426
435
 
427
- .desk-popover-anchor:has(> .desk-window-info) + .desk-window-actions,
436
+ /* Narrower still, the count keeps its words and lets the track go, so the bar's far edge stays on the bar. */
437
+ @container (max-width: 400px) {
438
+ .desk-window-progress-track {
439
+ display: none;
440
+ }
441
+ }
442
+
428
443
  .desk-window-note + .desk-window-actions {
429
444
  margin-left: var(--desk-space-1);
430
445
  }
@@ -565,6 +580,139 @@
565
580
  right: var(--desk-padding);
566
581
  }
567
582
 
583
+ /* ── Widgets: glances in a corner of the stage, behind the windows unless the person keeps one in front ── */
584
+
585
+ /* As big as the stage, to ask its size. No z-index, so each widget stands behind or in front on its own. */
586
+ .desk-widgets {
587
+ container: desk-widgets / size;
588
+ position: absolute;
589
+ inset: 0;
590
+ pointer-events: none;
591
+ }
592
+
593
+ /*
594
+ * A margin of padding for the focus ring, which a list that scrolls would clip. Too many for the desk, and it
595
+ * scrolls: it takes the pointer, as a scroller without it is passed over by the wheel, a finger and its scrollbar.
596
+ */
597
+ .desk-widget-list {
598
+ position: absolute;
599
+ pointer-events: auto;
600
+ box-sizing: border-box;
601
+ width: calc(var(--desk-widget-width) + 2 * var(--desk-space-1));
602
+ max-height: calc(100% - 2 * (var(--desk-padding) - var(--desk-space-1)) - var(--desk-inset-bottom));
603
+ padding: var(--desk-space-1);
604
+ display: flex;
605
+ flex-direction: column;
606
+ gap: var(--desk-space-2);
607
+ overflow: hidden auto;
608
+ scrollbar-width: thin;
609
+ }
610
+
611
+ .desk-widgets[data-corner^="top"] > .desk-widget-list {
612
+ top: calc(var(--desk-padding) - var(--desk-space-1));
613
+ }
614
+
615
+ .desk-widgets[data-corner^="bottom"] > .desk-widget-list {
616
+ bottom: calc(var(--desk-padding) - var(--desk-space-1) + var(--desk-inset-bottom));
617
+ }
618
+
619
+ .desk-widgets[data-corner$="left"] > .desk-widget-list {
620
+ left: calc(var(--desk-padding) - var(--desk-space-1));
621
+ }
622
+
623
+ .desk-widgets[data-corner$="right"] > .desk-widget-list {
624
+ right: calc(var(--desk-padding) - var(--desk-space-1));
625
+ }
626
+
627
+ /* Behind: on the desk surface, over what the app draws on an empty desk; windows start at 10. */
628
+ .desk-widget {
629
+ flex: none;
630
+ box-sizing: border-box;
631
+ position: relative;
632
+ z-index: 1;
633
+ min-height: 44px;
634
+ padding: 0;
635
+ border: 1px solid var(--desk-rule);
636
+ border-radius: var(--desk-radius);
637
+ background: var(--desk-surface);
638
+ color: var(--desk-ink);
639
+ font-family: var(--desk-font);
640
+ font-size: var(--desk-text-body);
641
+ text-align: start;
642
+ overflow: clip;
643
+ overflow-wrap: anywhere;
644
+ user-select: none;
645
+ }
646
+
647
+ /* Its words, on an opaque surface. */
648
+ .desk-widget-surface {
649
+ display: block;
650
+ box-sizing: border-box;
651
+ min-height: 42px;
652
+ padding: var(--desk-space-2) var(--desk-space-3);
653
+ }
654
+
655
+ /* In front, by choice: a frame of the dock's glass round that surface, as a stack's panel. No shadow: the list clips it. */
656
+ .desk-widget[data-front] {
657
+ z-index: 800;
658
+ padding: var(--desk-space-1);
659
+ background: var(--desk-dock-glass);
660
+ backdrop-filter: blur(28px) saturate(170%);
661
+ -webkit-backdrop-filter: blur(28px) saturate(170%);
662
+ }
663
+
664
+ .desk-widget[data-front] > .desk-widget-surface {
665
+ /* The frame comes out of the padding: ticking one keeps its size. */
666
+ min-height: calc(42px - 2 * var(--desk-space-1));
667
+ padding: calc(var(--desk-space-2) - var(--desk-space-1)) calc(var(--desk-space-3) - var(--desk-space-1));
668
+ border-radius: max(0px, calc(var(--desk-radius) - var(--desk-space-1)));
669
+ background: var(--desk-surface);
670
+ }
671
+
672
+ button.desk-widget {
673
+ cursor: pointer;
674
+ transition: border-color .12s var(--desk-ease);
675
+ }
676
+
677
+ button.desk-widget:hover {
678
+ border-color: color-mix(in srgb, var(--desk-accent) 45%, var(--desk-rule));
679
+ }
680
+
681
+ .desk-widget:focus-visible {
682
+ outline: 2px solid var(--desk-accent);
683
+ outline-offset: 2px;
684
+ }
685
+
686
+ /* A tour pointing at them moves nothing, and its ring fits in that margin too. */
687
+ .desk-widget-list[data-desk-tour-pointed] {
688
+ position: absolute;
689
+ }
690
+
691
+ .desk-widget[data-desk-tour-pointed] {
692
+ outline-offset: 2px;
693
+ }
694
+
695
+ .desk-widget-unseen {
696
+ position: absolute;
697
+ width: 1px;
698
+ height: 1px;
699
+ overflow: hidden;
700
+ clip-path: inset(50%);
701
+ white-space: nowrap;
702
+ }
703
+
704
+ /* A desk this small belongs to the windows. */
705
+ @container desk-widgets (max-width: 640px) or (max-height: 400px) {
706
+ .desk-widget-list,
707
+ .desk-widgets > .desk-widget-unseen {
708
+ display: none;
709
+ }
710
+ }
711
+
712
+ @media (forced-colors: active) {
713
+ button.desk-widget:hover { border-color: Highlight; }
714
+ }
715
+
568
716
  /* ── The inside of a window: controls that stay, content that scrolls ── */
569
717
 
570
718
  /* Two panels in one window, and the edge between them that moves. */
@@ -753,6 +901,27 @@
753
901
  overflow: hidden;
754
902
  }
755
903
 
904
+ /*
905
+ * A centred window that fits its content (`fitContent`) is as tall as what is in it, up to its max-height.
906
+ * Its height comes from its content rather than the content from its height, so a pane in it is not 100% of
907
+ * anything: it takes its own height and gives way, with the middle scrolling, once the window is at its cap.
908
+ */
909
+ .desk-window[data-fit] {
910
+ height: fit-content;
911
+ }
912
+
913
+ .desk-window[data-fit] > .desk-body {
914
+ flex: 0 1 auto;
915
+ display: flex;
916
+ flex-direction: column;
917
+ }
918
+
919
+ .desk-window[data-fit] > .desk-body > * {
920
+ flex: 0 1 auto;
921
+ height: auto;
922
+ min-height: 0;
923
+ }
924
+
756
925
  .desk-toolbar {
757
926
  display: flex;
758
927
  align-items: center;
@@ -1006,7 +1175,7 @@
1006
1175
  height: 100%;
1007
1176
  }
1008
1177
 
1009
- /* A dot for "a window is open", brighter when it has focus. */
1178
+ /* A dot for "a window is open", brighter when it has focus: a 4px dot 2px off its tile. */
1010
1179
  .desk-dock-item[data-running]::after {
1011
1180
  content: "";
1012
1181
  position: absolute;
@@ -2265,7 +2434,7 @@
2265
2434
  transition: background .12s var(--desk-ease), color .12s var(--desk-ease);
2266
2435
  }
2267
2436
 
2268
- .desk-tab:hover:not(:disabled):not([aria-selected="true"]) {
2437
+ .desk-tab:hover:not(:disabled):not([aria-disabled="true"]):not([aria-selected="true"]) {
2269
2438
  background: color-mix(in srgb, var(--desk-ink) 6%, transparent);
2270
2439
  color: var(--desk-ink);
2271
2440
  }
@@ -2281,11 +2450,30 @@
2281
2450
  outline-offset: -2px;
2282
2451
  }
2283
2452
 
2284
- .desk-tab:disabled {
2453
+ .desk-tab:disabled,
2454
+ .desk-tab[aria-disabled="true"] {
2285
2455
  opacity: .45;
2286
2456
  cursor: default;
2287
2457
  }
2288
2458
 
2459
+ /* An unavailable tab the arrows stop on: the ring is drawn in full, the label stays dimmed. */
2460
+ .desk-tab[aria-disabled="true"]:focus-visible {
2461
+ opacity: 1;
2462
+ color: color-mix(in srgb, var(--desk-muted) 45%, transparent);
2463
+ }
2464
+
2465
+ /* Why a tab is unavailable: read by a screen reader, shown to a pointer as the tab's title. */
2466
+ .desk-tab-why {
2467
+ position: absolute;
2468
+ width: 1px;
2469
+ height: 1px;
2470
+ margin: -1px;
2471
+ padding: 0;
2472
+ overflow: hidden;
2473
+ clip-path: inset(50%);
2474
+ white-space: nowrap;
2475
+ }
2476
+
2289
2477
  .desk-tab-badge {
2290
2478
  min-width: 18px;
2291
2479
  padding: 0 5px;
@@ -3056,6 +3244,12 @@
3056
3244
  background: var(--desk-surface);
3057
3245
  box-shadow: var(--desk-shadow-floating);
3058
3246
  animation: desk-menu-in .14s var(--desk-ease);
3247
+ overscroll-behavior: contain;
3248
+ }
3249
+
3250
+ /* Focused only so its keys scroll it (see Popover); the open dialog is its own sign of where focus is. */
3251
+ .desk-popover:focus {
3252
+ outline: none;
3059
3253
  }
3060
3254
 
3061
3255
  /* A sheet belongs to its window: the scrim covers that window and nothing else. */
@@ -4038,6 +4232,155 @@
4038
4232
  background: var(--desk-surface);
4039
4233
  }
4040
4234
 
4235
+ /* ── About and Settings, from what the app declares ── */
4236
+
4237
+ .desk-about-body {
4238
+ display: flex;
4239
+ flex-direction: column;
4240
+ gap: var(--desk-space-4);
4241
+ }
4242
+
4243
+ .desk-about-brand {
4244
+ display: flex;
4245
+ flex-direction: column;
4246
+ align-items: center;
4247
+ gap: var(--desk-space-1);
4248
+ text-align: center;
4249
+ }
4250
+
4251
+ .desk-about-icon {
4252
+ display: grid;
4253
+ place-items: center;
4254
+ width: 96px;
4255
+ height: 96px;
4256
+ margin-bottom: var(--desk-space-2);
4257
+ }
4258
+
4259
+ .desk-about-icon > svg,
4260
+ .desk-about-icon > img {
4261
+ width: 100%;
4262
+ height: 100%;
4263
+ }
4264
+
4265
+ .desk-about-name {
4266
+ margin: 0;
4267
+ font-size: var(--desk-text-display);
4268
+ font-weight: 600;
4269
+ }
4270
+
4271
+ .desk-about-version,
4272
+ .desk-about-description {
4273
+ margin: 0;
4274
+ }
4275
+
4276
+ .desk-about-links {
4277
+ display: flex;
4278
+ flex-wrap: wrap;
4279
+ justify-content: center;
4280
+ gap: var(--desk-space-2) var(--desk-space-4);
4281
+ }
4282
+
4283
+ .desk-about-links a {
4284
+ color: var(--desk-accent);
4285
+ }
4286
+
4287
+ /*
4288
+ * Name and value in two columns; a note sits under its value. Every section shares one grid, through
4289
+ * subgrid, so the names are one column down the whole panel, as wide as the longest of them.
4290
+ */
4291
+ .desk-about-sections {
4292
+ display: grid;
4293
+ grid-template-columns: max-content minmax(0, 1fr);
4294
+ column-gap: var(--desk-space-3);
4295
+ row-gap: var(--desk-space-4);
4296
+ }
4297
+
4298
+ .desk-about-sections > section {
4299
+ grid-column: 1 / -1;
4300
+ display: grid;
4301
+ grid-template-columns: subgrid;
4302
+ /* normal: the panel's column gap, so a section's own gap does not shift its values off the column. */
4303
+ column-gap: normal;
4304
+ row-gap: var(--desk-space-2);
4305
+ }
4306
+
4307
+ .desk-about-sections > section > * {
4308
+ grid-column: 1 / -1;
4309
+ }
4310
+
4311
+ .desk-about-facts {
4312
+ display: grid;
4313
+ grid-template-columns: subgrid;
4314
+ column-gap: normal;
4315
+ row-gap: var(--desk-space-1);
4316
+ margin: 0;
4317
+ }
4318
+
4319
+ /* A browser without subgrid: each section is its own grid, and a floor under the names keeps them close. */
4320
+ @supports not (grid-template-columns: subgrid) {
4321
+ .desk-about-facts {
4322
+ grid-template-columns: max-content minmax(0, 1fr);
4323
+ column-gap: var(--desk-space-3);
4324
+ }
4325
+
4326
+ .desk-about-facts dt {
4327
+ min-width: 9rem;
4328
+ }
4329
+ }
4330
+
4331
+ .desk-about-facts > div {
4332
+ display: contents;
4333
+ }
4334
+
4335
+ .desk-about-facts dt {
4336
+ color: var(--desk-muted);
4337
+ }
4338
+
4339
+ .desk-about-facts dd {
4340
+ margin: 0;
4341
+ overflow-wrap: anywhere;
4342
+ user-select: text;
4343
+ }
4344
+
4345
+ .desk-about-fact-note {
4346
+ display: block;
4347
+ }
4348
+
4349
+ .desk-about-note {
4350
+ margin: 0;
4351
+ text-align: center;
4352
+ }
4353
+
4354
+ .desk-about-legal {
4355
+ margin: 0;
4356
+ text-align: center;
4357
+ }
4358
+
4359
+ .desk-about-foot {
4360
+ display: flex;
4361
+ align-items: center;
4362
+ gap: var(--desk-space-3);
4363
+ padding: var(--desk-space-3) var(--desk-space-4);
4364
+ border-top: 1px solid var(--desk-rule);
4365
+ }
4366
+
4367
+ /* What Copy copies, out of sight: selected in place of the panel where there is no clipboard. */
4368
+ .desk-about-copied {
4369
+ position: absolute;
4370
+ width: 1px;
4371
+ height: 1px;
4372
+ margin: -1px;
4373
+ overflow: hidden;
4374
+ clip-path: inset(50%);
4375
+ white-space: pre;
4376
+ }
4377
+
4378
+ .desk-settings-page {
4379
+ display: flex;
4380
+ flex-direction: column;
4381
+ gap: var(--desk-space-5);
4382
+ }
4383
+
4041
4384
  /* @liberation-data/desk — looks.css */
4042
4385
  /*
4043
4386
  * Looks: the platform chrome, on `data-look` at the root. The rest of desk.css is the Mac look, so
@@ -4090,11 +4433,20 @@
4090
4433
  font-size: var(--desk-text-small);
4091
4434
  }
4092
4435
 
4093
- /* The end of the bar is the controls', so the (i) leads it. */
4094
- [data-look="gnome"] .desk-titlebar > .desk-popover-anchor:first-child {
4436
+ /*
4437
+ * The end of the bar is the controls', so the (i) is at its start, on the far edge (it is first in the
4438
+ * document). It takes the spare room after it, and nothing else in the bar reaches for any: an auto
4439
+ * margin on both sides of it would centre it in the room, under the heading.
4440
+ */
4441
+ [data-look="gnome"] .desk-titlebar > .desk-popover-anchor:has(> .desk-window-info) {
4442
+ margin-left: 0;
4095
4443
  margin-right: auto;
4096
4444
  }
4097
4445
 
4446
+ [data-look="gnome"] .desk-window-actions {
4447
+ margin-left: 0;
4448
+ }
4449
+
4098
4450
  /*
4099
4451
  * The middle is the heading's, so the count waits at the end of the bar, before the controls, and
4100
4452
  * the heading keeps clear of both. A narrow bar keeps the count and lets the track go.
@@ -4102,6 +4454,7 @@
4102
4454
  [data-look="gnome"] .desk-window-progress {
4103
4455
  position: static;
4104
4456
  transform: none;
4457
+ margin-left: 0;
4105
4458
  }
4106
4459
 
4107
4460
  [data-look="gnome"] .desk-titlebar[data-progress] .desk-titlebar-heading {
@@ -4179,6 +4532,11 @@
4179
4532
  height: 5px;
4180
4533
  }
4181
4534
 
4535
+ /* The (i) is first in the document, at the start of the bar: the end is the controls'. */
4536
+ [data-look="windows"] .desk-titlebar > .desk-popover-anchor:has(> .desk-window-info) {
4537
+ margin-left: 0;
4538
+ }
4539
+
4182
4540
  [data-look="windows"] .desk-title {
4183
4541
  flex: 1 1 auto;
4184
4542
  font-size: var(--desk-text-small);
@@ -4231,7 +4589,8 @@
4231
4589
  * inside them, come out dark too — as the shell's own menus do.
4232
4590
  */
4233
4591
  [data-look="gnome"] .desk-menubar,
4234
- [data-look="gnome"] .desk-dock {
4592
+ [data-look="gnome"] .desk-dock,
4593
+ [data-look="gnome"] .desk-widget[data-front] {
4235
4594
  --desk-ink: #ffffff;
4236
4595
  --desk-muted: rgb(255 255 255 / 68%);
4237
4596
  --desk-surface: #2a2a2a;
@@ -4266,8 +4625,13 @@
4266
4625
  color: var(--desk-ink);
4267
4626
  }
4268
4627
 
4269
- [data-look="gnome"] .desk-dock {
4628
+ /* A widget kept in front is the dash's material too. */
4629
+ [data-look="gnome"] .desk-dock,
4630
+ [data-look="gnome"] .desk-widget[data-front] {
4270
4631
  --desk-dock-glass: rgb(24 24 24 / 86%);
4632
+ }
4633
+
4634
+ [data-look="gnome"] .desk-dock {
4271
4635
  border-radius: 20px;
4272
4636
  }
4273
4637
 
@@ -4276,6 +4640,31 @@
4276
4640
  border-radius: 12px;
4277
4641
  }
4278
4642
 
4643
+ /*
4644
+ * The running dot by the glyph, as GNOME's dash has it: its tiles are transparent, so 3px off a tile no one sees is out
4645
+ * by the dock's edge. The glyph is 46% of its item, centred (a stack's 72%), so its edge is 27% (14%) in; the 4px dot
4646
+ * stands 4px off that, on whichever side the dock is.
4647
+ */
4648
+ [data-look="gnome"] .desk-dock {
4649
+ --desk-dock-dot-glyph: calc(27% - 8px);
4650
+ }
4651
+
4652
+ [data-look="gnome"] .desk-dock .desk-dock-item[data-stack] {
4653
+ --desk-dock-dot-glyph: calc(14% - 8px);
4654
+ }
4655
+
4656
+ [data-look="gnome"] .desk-dock[data-side="bottom"] .desk-dock-item[data-running]::after {
4657
+ bottom: var(--desk-dock-dot-glyph);
4658
+ }
4659
+
4660
+ [data-look="gnome"] .desk-dock[data-side="left"] .desk-dock-item[data-running]::after {
4661
+ left: var(--desk-dock-dot-glyph);
4662
+ }
4663
+
4664
+ [data-look="gnome"] .desk-dock[data-side="right"] .desk-dock-item[data-running]::after {
4665
+ right: var(--desk-dock-dot-glyph);
4666
+ }
4667
+
4279
4668
  /* No magnification: GNOME's dash lights an item up rather than growing it. */
4280
4669
  [data-look="gnome"] .desk-dock .desk-dock-item:hover:not(:disabled),
4281
4670
  [data-look="windows"] .desk-dock .desk-dock-item:hover:not(:disabled) {
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { WindowId, WindowLimits } from '../core/types.js';
3
+ import type { Widget, WidgetCorner } from './widgets.js';
3
4
  import type { WindowFailed, WindowLoading } from './windowBoundary.js';
4
5
  export type DeskLayout = 'desktop' | 'fullscreen';
5
6
  export interface DesktopProps {
@@ -19,8 +20,8 @@ export interface DesktopProps {
19
20
  */
20
21
  readonly limits?: (id: WindowId) => WindowLimits | null;
21
22
  /**
22
- * What this window is, behind an (i) at the end of its title bar — the same place in every window,
23
- * so a person who wonders what they are looking at always knows where to ask. Explanation only: a
23
+ * What this window is, behind an (i) on the far edge of its title bar, opposite the controls — the
24
+ * same place in every window, so a person who wonders what they are looking at always knows where to ask. Explanation only: a
24
25
  * warning, or anything that changes what someone is about to do, belongs in the window itself.
25
26
  */
26
27
  readonly info?: (id: WindowId) => ReactNode;
@@ -37,7 +38,15 @@ export interface DesktopProps {
37
38
  * window at a time; anything with a pointer gets the layered `desktop`.
38
39
  */
39
40
  readonly layout?: DeskLayout | 'auto';
41
+ /**
42
+ * Glances stacked in a corner of the desk, clear of the dock: behind the windows, unless the person keeps
43
+ * one in front from the Window menu (`widgetMenuItems`). Not shown in the fullscreen layout, or on a desk
44
+ * too small to spare the room.
45
+ */
46
+ readonly widgets?: readonly Widget[];
47
+ /** The corner they stand in: `top-right` unless said. Keep it clear in the app's default layout. */
48
+ readonly widgetCorner?: WidgetCorner;
40
49
  readonly className?: string;
41
50
  }
42
- export declare function Desktop({ renderWindow, title, note, info, actions, limits, empty, loading, failed, layout, className }: DesktopProps): import("react").JSX.Element;
51
+ export declare function Desktop({ renderWindow, title, note, info, actions, limits, empty, loading, failed, layout, widgets, widgetCorner, className }: DesktopProps): import("react").JSX.Element;
43
52
  //# sourceMappingURL=Desktop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Desktop.d.ts","sourceRoot":"","sources":["../../src/react/Desktop.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoD,SAAS,EAAE,MAAM,OAAO,CAAA;AAKxF,OAAO,KAAK,EAAqB,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAOjF,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEtE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,YAAY,CAAA;AAEjD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,SAAS,CAAA;IAClD,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,SAAS,CAAA;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,SAAS,CAAA;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,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import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
3
3
  import { addCommandHandler, addDeskCommands, DeskCommands, STAGE_ATTRIBUTE, WINDOW_ATTRIBUTE, windowElement } from '../core/commands.js';
4
4
  import { focusedId, isMinimized, onDesk } from '../core/desk.js';
5
- import { arrangement } from './arrange.js';
5
+ import { Widgets, widgetsKeptClear } from './widgets.js';
6
+ import { arrangement, areaAround } from './arrange.js';
6
7
  import { InfoTip } from './infoTip.js';
7
8
  import { useDesk, useDeskState, useLook, WindowContext } from './context.js';
9
+ import { ABOUT_WINDOW, appWindowLimits, appWindowTitle, desksWindow, SETTINGS_WINDOW, useDeskApp } from './app.js';
10
+ import { AboutContent, SettingsContent } from './appPanels.js';
8
11
  import { WindowBoundary } from './windowBoundary.js';
9
12
  import { TitleProgress } from './windowProgress.js';
13
+ const NO_WIDGETS = [];
10
14
  /** Touch-first: a coarse pointer that cannot hover. A tablet with a trackpad reports otherwise. */
11
15
  const TOUCH = '(pointer: coarse) and (hover: none)';
12
16
  function useMediaQuery(query) {
@@ -31,17 +35,26 @@ function arrangementArea(stage) {
31
35
  const gap = parseFloat(style.columnGap) || 0;
32
36
  return { x: left, y: top, width: stage.clientWidth - left - right, height: stage.clientHeight - top - bottom, gap };
33
37
  }
38
+ const systemLimits = (app, id) => {
39
+ const which = desksWindow(app, id);
40
+ return which ? appWindowLimits(app, which) : null;
41
+ };
34
42
  const halfFrame = (stage, side) => {
35
43
  const area = arrangementArea(stage);
36
44
  const width = (area.width - area.gap) / 2;
37
45
  return { x: side === 'start' ? area.x : area.x + width + area.gap, y: area.y, width, height: area.height };
38
46
  };
39
- export function Desktop({ renderWindow, title, note, info, actions, limits, empty, loading, failed, layout = 'auto', className }) {
47
+ export function Desktop({ renderWindow, title, note, info, actions, limits, empty, loading, failed, layout = 'auto', widgets = NO_WIDGETS, widgetCorner = 'top-right', className }) {
40
48
  const desk = useDesk();
41
49
  const state = useDeskState();
42
50
  const stage = useRef(null);
43
51
  const touch = useMediaQuery(TOUCH);
44
52
  const mode = layout === 'auto' ? (touch ? 'fullscreen' : 'desktop') : layout;
53
+ // About and Settings, when the app has declared itself: Desk draws them, unless the app's Settings is its own.
54
+ const app = useDeskApp();
55
+ const ownsAbout = app !== null;
56
+ const ownsSettings = desksWindow(app, SETTINGS_WINDOW) !== null;
57
+ const render = useCallback((id) => ownsAbout && id === ABOUT_WINDOW ? _jsx(AboutContent, {}) : ownsSettings && id === SETTINGS_WINDOW ? _jsx(SettingsContent, {}) : renderWindow(id), [renderWindow, ownsAbout, ownsSettings]);
45
58
  useLayoutEffect(() => {
46
59
  desk.setStage(() => ({ width: stage.current?.clientWidth ?? 1024, height: stage.current?.clientHeight ?? 768 }));
47
60
  }, [desk]);
@@ -117,10 +130,10 @@ export function Desktop({ renderWindow, title, note, info, actions, limits, empt
117
130
  if (element instanceof HTMLElement && !element.contains(document.activeElement))
118
131
  element.focus({ preventScroll: true });
119
132
  }, [focused]);
120
- return (_jsxs("div", { ref: stage, className: ['desk-stage', className].filter(Boolean).join(' '), "data-layout": mode, [STAGE_ATTRIBUTE]: '', children: [onDesk(state).length === 0 && empty, state.windows.map(window => (_jsx(WindowView, { window: window, layout: mode, depth: state.stack.indexOf(window.id), focused: window.id === focused,
133
+ return (_jsxs("div", { ref: stage, className: ['desk-stage', className].filter(Boolean).join(' '), "data-layout": mode, [STAGE_ATTRIBUTE]: '', children: [_jsx(Widgets, { widgets: mode === 'desktop' ? widgets : NO_WIDGETS, corner: widgetCorner }), onDesk(state).length === 0 && empty, state.windows.map(window => (_jsx(WindowView, { window: window, layout: mode, depth: state.stack.indexOf(window.id), focused: window.id === focused,
121
134
  // Offstage, not gone: it keeps its DOM, so nothing in it is lost. One window at a time on
122
135
  // touch, and minimizing, are the same thing to everything below this line.
123
- hidden: (mode === 'fullscreen' && window.id !== focused) || isMinimized(state, window.id), minimized: isMinimized(state, window.id), title: title(window.id), note: note?.(window.id), info: info?.(window.id), limits: limits?.(window.id) ?? null, actions: actions?.(window.id), children: _jsx(WindowContent, { id: window.id, render: renderWindow, loading: loading, failed: failed }) }, window.id)))] }));
136
+ hidden: (mode === 'fullscreen' && window.id !== focused) || isMinimized(state, window.id), minimized: isMinimized(state, window.id), title: appWindowTitle(app, window.id) ?? title(window.id), note: note?.(window.id), info: info?.(window.id), limits: limits?.(window.id) ?? systemLimits(app, window.id), actions: actions?.(window.id), children: _jsx(WindowContent, { id: window.id, render: render, loading: loading, failed: failed }) }, window.id)))] }));
124
137
  }
125
138
  // Each window loads and fails on its own: one fetching its code, or throwing, never blanks another.
126
139
  const WindowContent = memo(function WindowContent({ id, render, loading, failed }) {
@@ -176,12 +189,15 @@ function arrangeNow(desk, element) {
176
189
  const windows = onDesk(state);
177
190
  const stack = state.stack.filter(id => !isMinimized(state, id));
178
191
  const [focused, previous] = [stack.at(-1), stack.at(-2)];
179
- if (windows.length === 1) {
192
+ // Widgets kept in front have their corner; the windows are laid out in the rest.
193
+ const area = arrangementArea(element);
194
+ const clear = widgetsKeptClear(element, area.gap);
195
+ if (windows.length === 1 && !clear) {
180
196
  if (focused)
181
197
  desk.fill(focused);
182
198
  return;
183
199
  }
184
- const frames = arrangement(windows.map(w => w.id), focused ?? null, previous ?? null, arrangementArea(element), { minWidth: MIN_WIDTH, minHeight: MIN_HEIGHT });
200
+ const frames = arrangement(windows.map(w => w.id), focused ?? null, previous ?? null, clear ? areaAround(area, clear) : area, { minWidth: MIN_WIDTH, minHeight: MIN_HEIGHT });
185
201
  desk.placeAll(frames);
186
202
  // Windows that cascade come in front of the half they cascade over; the focused window stays in front of all.
187
203
  if (previous)
@@ -320,14 +336,18 @@ function WindowView({ window, layout, hidden, minimized, depth, focused, title,
320
336
  const controls = (_jsx(WindowControls, { look: look, layout: layout, filled: window.mode === 'filled' && !live, onClose: () => desk.close(window.id), onMinimize: () => desk.minimize(window.id), onZoom: zoom }));
321
337
  const heading = (_jsx("h2", { id: titleId, className: "desk-title", children: title }));
322
338
  const windowNote = note != null && note !== false && _jsx("p", { className: "desk-window-note", children: note });
323
- // At the end of a Mac bar, beside the note; at the start of the others, whose end is the controls'.
339
+ /*
340
+ * The (i) is on the bar's far edge, opposite the controls: last on a Mac bar, whose start is the
341
+ * controls', and first on the others, whose end is. It is put there in the document, not moved there
342
+ * by CSS, so Tab reaches it where it is seen, and it is in the same corner of every window of a look.
343
+ */
324
344
  const windowInfo = info != null && info !== false && (_jsx(InfoTip, { className: "desk-window-info", label: typeof title === 'string' ? `About ${title}` : 'About this window', align: look === 'mac' ? 'end' : 'start', children: info }));
325
- return (_jsx(WindowContext.Provider, { value: context, children: _jsxs("section", { ref: element, tabIndex: -1, [WINDOW_ATTRIBUTE]: window.id, className: "desk-window", "data-mode": layout === 'fullscreen' ? 'fullscreen' : live ? 'floating' : window.mode, "data-centred": centred || undefined, "data-hidden": hidden || undefined, "data-minimized": minimized || undefined, inert: hidden || undefined, "data-focused": focused || undefined, "data-dragging": live ? true : undefined, "aria-labelledby": titleId, style: style, onPointerDownCapture: () => {
345
+ return (_jsx(WindowContext.Provider, { value: context, children: _jsxs("section", { ref: element, tabIndex: -1, [WINDOW_ATTRIBUTE]: window.id, className: "desk-window", "data-mode": layout === 'fullscreen' ? 'fullscreen' : live ? 'floating' : window.mode, "data-centred": centred || undefined, "data-fit": (centred && limits?.fitContent) || undefined, "data-hidden": hidden || undefined, "data-minimized": minimized || undefined, inert: hidden || undefined, "data-focused": focused || undefined, "data-dragging": live ? true : undefined, "aria-labelledby": titleId, style: style, onPointerDownCapture: () => {
326
346
  if (!focused)
327
347
  desk.focus(window.id);
328
348
  }, children: [_jsxs("header", { className: "desk-titlebar", onPointerDown: startGesture('move'), onDoubleClick: event => {
329
349
  if (!event.target.closest('button'))
330
350
  zoom();
331
- }, "data-draggable": layout === 'desktop' || undefined, "data-progress": progress ? true : undefined, children: [look === 'mac' ? controls : windowInfo, look === 'gnome' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "desk-titlebar-heading", children: [heading, windowNote] }), progress && _jsx(TitleProgress, { progress: progress })] })) : (_jsxs(_Fragment, { children: [heading, progress && _jsx(TitleProgress, { progress: progress }), windowNote] })), look === 'mac' && windowInfo, actions && _jsx("div", { className: "desk-window-actions", children: actions }), look !== 'mac' && controls] }), _jsx("div", { className: "desk-body", children: children }), layout === 'desktop' && (_jsxs(_Fragment, { children: [['top', 'left', 'right', 'bottom'].map(side => (_jsx("div", { className: "desk-edge", "data-edge": side, "aria-hidden": "true", onPointerDown: startGesture(side) }, side))), ['top-left', 'top-right', 'bottom-left', 'bottom-right'].map(corner => (_jsx("div", { className: "desk-grip", "data-corner": corner, "aria-hidden": "true", onPointerDown: startGesture(corner) }, corner)))] }))] }) }));
351
+ }, "data-draggable": layout === 'desktop' || undefined, "data-progress": progress ? true : undefined, children: [look === 'mac' ? controls : windowInfo, look === 'gnome' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "desk-titlebar-heading", children: [heading, windowNote] }), progress && _jsx(TitleProgress, { progress: progress })] })) : (_jsxs(_Fragment, { children: [heading, progress && _jsx(TitleProgress, { progress: progress }), windowNote] })), actions && _jsx("div", { className: "desk-window-actions", children: actions }), look === 'mac' ? windowInfo : controls] }), _jsx("div", { className: "desk-body", children: children }), layout === 'desktop' && (_jsxs(_Fragment, { children: [['top', 'left', 'right', 'bottom'].map(side => (_jsx("div", { className: "desk-edge", "data-edge": side, "aria-hidden": "true", onPointerDown: startGesture(side) }, side))), ['top-left', 'top-right', 'bottom-left', 'bottom-right'].map(corner => (_jsx("div", { className: "desk-grip", "data-corner": corner, "aria-hidden": "true", onPointerDown: startGesture(corner) }, corner)))] }))] }) }));
332
352
  }
333
353
  //# sourceMappingURL=Desktop.js.map