@liberation-data/desk 0.1.0 → 0.2.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.
- package/README.md +92 -1
- package/dist/core/desk.d.ts.map +1 -1
- package/dist/core/desk.js +19 -2
- package/dist/core/desk.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/layouts.d.ts +26 -0
- package/dist/core/layouts.d.ts.map +1 -0
- package/dist/core/layouts.js +70 -0
- package/dist/core/layouts.js.map +1 -0
- package/dist/core/types.d.ts +3 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/desk.css +146 -1
- package/dist/react/Desktop.d.ts +7 -1
- package/dist/react/Desktop.d.ts.map +1 -1
- package/dist/react/Desktop.js +4 -4
- package/dist/react/Desktop.js.map +1 -1
- package/dist/react/Dock.d.ts +16 -1
- package/dist/react/Dock.d.ts.map +1 -1
- package/dist/react/Dock.js +44 -6
- package/dist/react/Dock.js.map +1 -1
- package/dist/react/MenuBar.d.ts +16 -0
- package/dist/react/MenuBar.d.ts.map +1 -1
- package/dist/react/MenuBar.js +36 -27
- package/dist/react/MenuBar.js.map +1 -1
- package/dist/react/context.d.ts +2 -0
- package/dist/react/context.d.ts.map +1 -1
- package/dist/react/context.js +2 -0
- package/dist/react/context.js.map +1 -1
- package/dist/react/contextMenu.d.ts +22 -0
- package/dist/react/contextMenu.d.ts.map +1 -0
- package/dist/react/contextMenu.js +146 -0
- package/dist/react/contextMenu.js.map +1 -0
- package/dist/react/iconView.d.ts +34 -0
- package/dist/react/iconView.d.ts.map +1 -0
- package/dist/react/iconView.js +112 -0
- package/dist/react/iconView.js.map +1 -0
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +1 -1
- package/llms.txt +22 -4
- package/package.json +1 -1
- package/src/core/desk.ts +17 -2
- package/src/core/index.ts +2 -0
- package/src/core/layouts.ts +88 -0
- package/src/core/types.ts +4 -0
- package/src/desk.css +146 -1
- package/src/react/Desktop.tsx +11 -2
- package/src/react/Dock.tsx +74 -5
- package/src/react/MenuBar.tsx +43 -30
- package/src/react/context.tsx +3 -0
- package/src/react/contextMenu.tsx +198 -0
- package/src/react/iconView.tsx +206 -0
- package/src/react/index.ts +6 -2
package/README.md
CHANGED
|
@@ -18,6 +18,19 @@ Drag a window by its title bar to free it where it sits. Drop it against the lef
|
|
|
18
18
|
that half. Resize from the sides, the bottom or the corner. Double-click the title bar, or press the green
|
|
19
19
|
control, to fill the desk and back.
|
|
20
20
|
|
|
21
|
+
Give the desk somewhere to keep layouts and windows come back the way they were left:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const desk = createDesk({ layouts: localLayoutStore('rides') })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
A window you made small and moved to a corner opens small and in the corner next time; one you zoomed opens
|
|
28
|
+
filling the desk. It is remembered per kind of window, so `query#2` opens where `query` was left. If the desk
|
|
29
|
+
has shrunk since, the window is moved back on and made smaller, and opens filled if it would be too small to
|
|
30
|
+
use. Another window of a kind already open steps down and to the right of it, wrapping to the top-left at the
|
|
31
|
+
edge. Arrange and a frame passed to `open` are not remembered. `LayoutStore` is two synchronous functions,
|
|
32
|
+
`load(type)` and `save(type, layout)`, for keeping layouts somewhere other than this browser.
|
|
33
|
+
|
|
21
34
|
## Use it
|
|
22
35
|
|
|
23
36
|
```tsx
|
|
@@ -57,6 +70,21 @@ what went wrong and offers Reload, which tries the import again rather than reme
|
|
|
57
70
|
`renderWindow` is called with a window's id. The desk never owns your content, and a window keeps its DOM
|
|
58
71
|
when focus moves, so scroll positions, carets and iframes survive.
|
|
59
72
|
|
|
73
|
+
### What a window is looking at
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<Desktop
|
|
77
|
+
title={id => TITLES[id]}
|
|
78
|
+
note={id => (id === 'logs' ? 'GET /api/v1/admin/logs' : null)}
|
|
79
|
+
renderWindow={render}
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`note` puts a quiet line on the trailing side of a window's title bar: the request behind it, the file being
|
|
84
|
+
edited, how many rows were found. It is text, not a control — the title names the window, the note says what
|
|
85
|
+
this one is looking at, and in a narrow window the note is cut before the title is. Return null for a window
|
|
86
|
+
with nothing to say. Controls belong in `actions`, which sits after it.
|
|
87
|
+
|
|
60
88
|
## Touch: one window at a time
|
|
61
89
|
|
|
62
90
|
`<Desktop layout="auto">` (the default) reads the device. A touch screen that cannot hover gets
|
|
@@ -89,6 +117,33 @@ The dock is one tab stop: arrow keys move along it, Enter opens, Escape folds a
|
|
|
89
117
|
to it. With `placement="overlay"` (the default) it floats over the bottom of its positioned parent; set
|
|
90
118
|
`--desk-inset-bottom` so windows stop above it.
|
|
91
119
|
|
|
120
|
+
### Keeping things in the dock
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<Dock
|
|
124
|
+
entries={[
|
|
125
|
+
...fixed,
|
|
126
|
+
dockSeparator('kept'),
|
|
127
|
+
...kept.map(app =>
|
|
128
|
+
dockItem({
|
|
129
|
+
id: `app#${app.id}`,
|
|
130
|
+
label: app.name,
|
|
131
|
+
icon: <AppIcon app={app} />,
|
|
132
|
+
movable: true,
|
|
133
|
+
contextMenu: () => [menuAction('Open', () => desk.open(`app#${app.id}`)), menuAction('Remove from Dock', () => unpin(app.id))],
|
|
134
|
+
}),
|
|
135
|
+
),
|
|
136
|
+
]}
|
|
137
|
+
pins={{ accepts: 'app', onPin: (drag, before) => pin(drag.payload, before), onMove: (id, before) => move(id, before) }}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The dock does not store what is kept; the app does, beside its other preferences, and passes it back as
|
|
142
|
+
entries. Drop something the dock `accepts` on it to keep it: on the dock it goes at the end, on a `movable`
|
|
143
|
+
item it goes in front of that one, and the fixed items are never split. A `movable` item can be carried along
|
|
144
|
+
the dock to a new place. `contextMenu` gives any item a right-click menu; an item that is `disabled` but has
|
|
145
|
+
a menu stays reachable, so something that can no longer open can still be removed.
|
|
146
|
+
|
|
92
147
|
## Controls
|
|
93
148
|
|
|
94
149
|
```tsx
|
|
@@ -355,6 +410,42 @@ own their shortcuts, as in AppKit — a command item's `shortcut` is shown and b
|
|
|
355
410
|
the bar, arrow keys move between menus and items (skipping separators and disabled items), a letter jumps
|
|
356
411
|
to an item, Enter chooses, Escape closes.
|
|
357
412
|
|
|
413
|
+
|
|
414
|
+
### Context menus
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
function RideRow({ ride }) {
|
|
418
|
+
const { target, menu } = useContextMenu({
|
|
419
|
+
label: `Actions for ${ride.name}`,
|
|
420
|
+
items: () => [menuAction('Open', () => open(ride)), menuSeparator(), menuCommand('Export', 'rides.export')],
|
|
421
|
+
})
|
|
422
|
+
return <><button {...target} onClick={() => open(ride)}>{ride.name}</button>{menu}</>
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
A right-click opens the menu where the pointer is; the Menu key or Shift+F10 opens it at the item, with the
|
|
427
|
+
first item ready. Items are the menu bar's, so a command asks the responder chain whether it is enabled and
|
|
428
|
+
runs from the item that was right-clicked. It closes on Escape, a click elsewhere, scrolling or resizing, and
|
|
429
|
+
gives focus back. The HIG's rule stands: nothing lives only in a context menu.
|
|
430
|
+
|
|
431
|
+
### Icon view
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
<IconView
|
|
435
|
+
label="Apps"
|
|
436
|
+
items={apps.map(app => ({ id: app.id, label: app.name, subtitle: app.scope, icon: <AppIcon app={app} /> }))}
|
|
437
|
+
onOpen={app => desk.open(`app#${app.id}`)}
|
|
438
|
+
contextMenu={app => [menuAction('Open', () => desk.open(`app#${app.id}`))]}
|
|
439
|
+
drag={{ type: 'app', payload: app => app }}
|
|
440
|
+
empty="No apps yet."
|
|
441
|
+
/>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
A Finder's icons, in rows that follow the window's width. A click selects and a double-click opens;
|
|
445
|
+
`openOn="single"` opens on one click, for a launcher. Arrows move through the grid (up and down by however
|
|
446
|
+
many fit in a row), Home and End go to the ends, typing a name jumps to it, Return opens, and the Menu key
|
|
447
|
+
opens the item's context menu. With `drag`, an icon can be carried to a drop target such as the dock.
|
|
448
|
+
|
|
358
449
|
## Commands and the responder chain
|
|
359
450
|
|
|
360
451
|
Some commands name no target — Copy, Close, Find. They go to whoever is responsible, the way AppKit's
|
|
@@ -425,7 +516,7 @@ npm install
|
|
|
425
516
|
npm test # vitest
|
|
426
517
|
npm run typecheck
|
|
427
518
|
npm run example # the Garage sample in examples/garage
|
|
428
|
-
npm run size # the gzipped budget: core
|
|
519
|
+
npm run size # the gzipped budget: core 11 KiB, react 46, css 10
|
|
429
520
|
npm run check # everything CI runs
|
|
430
521
|
npm run check:browser # the generated-app bridge in real Chrome, against a running sample
|
|
431
522
|
npm run build # dist/
|
package/dist/core/desk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desk.d.ts","sourceRoot":"","sources":["../../src/core/desk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACT,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"desk.d.ts","sourceRoot":"","sources":["../../src/core/desk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACT,MAAM,YAAY,CAAA;AAGnB,MAAM,WAAW,IAAI;IACnB,QAAQ,IAAI,SAAS,CAAA;IACrB,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAA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B,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAE,cAAgC,GAAG,KAAK,CAUjH;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAE,cAAgC,GAAG,MAAM,CAMxG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAE,cAAgC,GAAG,KAAK,CAM9H;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAMrD;AAED,wBAAgB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,IAAI,CA2I1D"}
|
package/dist/core/desk.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fitFrame, stepFrom } from './layouts.js';
|
|
1
2
|
export const EMPTY = { windows: [], stack: [] };
|
|
2
3
|
const DEFAULT_CASCADE = {
|
|
3
4
|
maxWidth: 720,
|
|
@@ -61,6 +62,7 @@ export function createDesk(options = {}) {
|
|
|
61
62
|
let stage = options.stage ?? (() => DEFAULT_STAGE);
|
|
62
63
|
let state = normalise(options.initial ?? EMPTY);
|
|
63
64
|
const listeners = new Set();
|
|
65
|
+
const layouts = options.layouts;
|
|
64
66
|
const commit = (next) => {
|
|
65
67
|
if (next === state)
|
|
66
68
|
return;
|
|
@@ -93,6 +95,7 @@ export function createDesk(options = {}) {
|
|
|
93
95
|
const next = frame ?? fits(remembered.get(id)) ?? nextFrame(state);
|
|
94
96
|
if (frame)
|
|
95
97
|
remembered.set(id, frame);
|
|
98
|
+
layouts?.save(windowType(id), { mode: 'floating', frame: next });
|
|
96
99
|
commit(toFront(replace(state, { id, mode: 'floating', frame: next }), id));
|
|
97
100
|
};
|
|
98
101
|
const fill = (id) => {
|
|
@@ -100,6 +103,7 @@ export function createDesk(options = {}) {
|
|
|
100
103
|
if (!window || window.mode === 'filled')
|
|
101
104
|
return;
|
|
102
105
|
remembered.set(id, window.frame);
|
|
106
|
+
layouts?.save(windowType(id), { mode: 'filled' });
|
|
103
107
|
commit(toFront(replace(state, { id, mode: 'filled' }), id));
|
|
104
108
|
};
|
|
105
109
|
return {
|
|
@@ -115,8 +119,21 @@ export function createDesk(options = {}) {
|
|
|
115
119
|
commit(toFront(state, id));
|
|
116
120
|
return;
|
|
117
121
|
}
|
|
118
|
-
const
|
|
119
|
-
const
|
|
122
|
+
const saved = opts.mode || opts.frame ? undefined : layouts?.load(windowType(id));
|
|
123
|
+
const kept = saved?.mode === 'floating' ? fitFrame(saved.frame, stage()) : null;
|
|
124
|
+
const mode = opts.mode ?? (opts.frame || kept ? 'floating' : 'filled');
|
|
125
|
+
const frame = () => {
|
|
126
|
+
if (opts.frame)
|
|
127
|
+
return opts.frame;
|
|
128
|
+
if (!kept)
|
|
129
|
+
return nextFrame(state);
|
|
130
|
+
const siblings = state.stack.flatMap(other => {
|
|
131
|
+
const w = find(other);
|
|
132
|
+
return w?.mode === 'floating' && windowType(w.id) === windowType(id) ? [w.frame] : [];
|
|
133
|
+
});
|
|
134
|
+
return stepFrom(kept, siblings, stage(), cascade.step, cascade.margin);
|
|
135
|
+
};
|
|
136
|
+
const window = mode === 'filled' ? { id, mode } : { id, mode, frame: frame() };
|
|
120
137
|
commit({ windows: [...state.windows, window], stack: [...state.stack, id] });
|
|
121
138
|
},
|
|
122
139
|
openInstance(type, opts = {}) {
|
package/dist/core/desk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desk.js","sourceRoot":"","sources":["../../src/core/desk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"desk.js","sourceRoot":"","sources":["../../src/core/desk.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAyBjD,MAAM,CAAC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,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;oBAC1B,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,UAAmB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;gBACnE,CAAC,CAAC;aACH,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,CAAC,IAAI;YACV,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;QAED,QAAQ,CAAC,IAAI;YACX,KAAK,GAAG,IAAI,CAAA;QACd,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { bindShortcuts, formatShortcut, isApplePlatform, isInstalledApp, matches
|
|
|
8
8
|
export type { Keymap, Shortcut, ShortcutOptions } from './shortcuts.js';
|
|
9
9
|
export { parse, serialize, syncWithLocation } from './location.js';
|
|
10
10
|
export { isTitleCase, titleCase } from './titles.js';
|
|
11
|
+
export { fitFrame, localLayoutStore, stepFrom } from './layouts.js';
|
|
12
|
+
export type { LayoutStore, SavedLayout } from './layouts.js';
|
|
11
13
|
export type { LocationEnv, LocationOptions } from './location.js';
|
|
12
14
|
export type { CascadeOptions, DeskOptions, DeskState, DeskWindow, Frame, OpenOptions, Size, WindowId, WindowMode, } from './types.js';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -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,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,KAAK,GACN,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,E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AAU,EACV,YAAY,EACZ,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5F,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACpE,YAAY,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC/H,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACvE,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;AACnE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACjE,YAAY,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAA"}
|
package/dist/core/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { createBus, InputCommands, topicMatches } from './events.js';
|
|
|
4
4
|
export { bindShortcuts, formatShortcut, isApplePlatform, isInstalledApp, matchesShortcut, parseShortcut } from './shortcuts.js';
|
|
5
5
|
export { parse, serialize, syncWithLocation } from './location.js';
|
|
6
6
|
export { isTitleCase, titleCase } from './titles.js';
|
|
7
|
+
export { fitFrame, localLayoutStore, stepFrom } from './layouts.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -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,MAAM,EACN,gBAAgB,EAChB,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"}
|
|
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,MAAM,EACN,gBAAgB,EAChB,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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Frame, Size } from './types.js';
|
|
2
|
+
export type SavedLayout = {
|
|
3
|
+
readonly mode: 'filled';
|
|
4
|
+
} | {
|
|
5
|
+
readonly mode: 'floating';
|
|
6
|
+
readonly frame: Frame;
|
|
7
|
+
};
|
|
8
|
+
/** Where layouts are kept. Synchronous: a window opens now, not after a round trip. */
|
|
9
|
+
export interface LayoutStore {
|
|
10
|
+
load(type: string): SavedLayout | undefined;
|
|
11
|
+
save(type: string, layout: SavedLayout): void;
|
|
12
|
+
}
|
|
13
|
+
/** Keeps layouts in this browser, under `desk.layouts.<key>`. */
|
|
14
|
+
export declare function localLayoutStore(key: string): LayoutStore;
|
|
15
|
+
/** A remembered frame on today's desk: on screen, no bigger than the desk, or null if too small to use. */
|
|
16
|
+
export declare function fitFrame(frame: Frame, stage: Size, min?: Size): Frame | null;
|
|
17
|
+
/**
|
|
18
|
+
* Where another window of a kind goes when some are already free on the desk: a step down and right
|
|
19
|
+
* of the one in front, back to the top-left when that would run off the desk, and never exactly on
|
|
20
|
+
* top of one already there.
|
|
21
|
+
*/
|
|
22
|
+
export declare function stepFrom(frame: Frame, open: readonly Frame[], stage: Size, step: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}, margin: number): Frame;
|
|
26
|
+
//# sourceMappingURL=layouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/core/layouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAc7C,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAA;AAE5G,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;IAC3C,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;CAC9C;AAID,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAqBzD;AAYD,2GAA2G;AAC3G,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAE,IAAU,GAAG,KAAK,GAAG,IAAI,CAUjF;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAWjI"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const MIN = { width: 240, height: 160 };
|
|
2
|
+
/** Keeps layouts in this browser, under `desk.layouts.<key>`. */
|
|
3
|
+
export function localLayoutStore(key) {
|
|
4
|
+
const name = `desk.layouts.${key}`;
|
|
5
|
+
const read = () => {
|
|
6
|
+
try {
|
|
7
|
+
const raw = globalThis.localStorage?.getItem(name);
|
|
8
|
+
const parsed = raw ? JSON.parse(raw) : {};
|
|
9
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
load: type => valid(read()[type]),
|
|
17
|
+
save(type, layout) {
|
|
18
|
+
try {
|
|
19
|
+
globalThis.localStorage?.setItem(name, JSON.stringify({ ...read(), [type]: layout }));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Private windows and full storage: windows still open, just not where they were.
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const finite = (...values) => values.every(v => typeof v === 'number' && Number.isFinite(v));
|
|
28
|
+
/** Storage is outside the program: anything that is not a layout is treated as none. */
|
|
29
|
+
function valid(layout) {
|
|
30
|
+
const l = layout;
|
|
31
|
+
if (l?.mode === 'filled')
|
|
32
|
+
return l;
|
|
33
|
+
if (l?.mode === 'floating' && l.frame && finite(l.frame.x, l.frame.y, l.frame.width, l.frame.height))
|
|
34
|
+
return l;
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
/** A remembered frame on today's desk: on screen, no bigger than the desk, or null if too small to use. */
|
|
38
|
+
export function fitFrame(frame, stage, min = MIN) {
|
|
39
|
+
const width = Math.min(frame.width, stage.width);
|
|
40
|
+
const height = Math.min(frame.height, stage.height);
|
|
41
|
+
if (width < min.width || height < min.height)
|
|
42
|
+
return null;
|
|
43
|
+
return {
|
|
44
|
+
x: Math.max(0, Math.min(frame.x, stage.width - width)),
|
|
45
|
+
y: Math.max(0, Math.min(frame.y, stage.height - height)),
|
|
46
|
+
width,
|
|
47
|
+
height,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Where another window of a kind goes when some are already free on the desk: a step down and right
|
|
52
|
+
* of the one in front, back to the top-left when that would run off the desk, and never exactly on
|
|
53
|
+
* top of one already there.
|
|
54
|
+
*/
|
|
55
|
+
export function stepFrom(frame, open, stage, step, margin) {
|
|
56
|
+
const front = open.at(-1);
|
|
57
|
+
if (!front)
|
|
58
|
+
return frame;
|
|
59
|
+
const taken = (f) => open.some(o => o.x === f.x && o.y === f.y);
|
|
60
|
+
let next = { ...frame, x: front.x + step.x, y: front.y + step.y };
|
|
61
|
+
for (let tries = 0; tries <= open.length; tries++) {
|
|
62
|
+
if (next.x + next.width > stage.width || next.y + next.height > stage.height)
|
|
63
|
+
next = { ...next, x: margin, y: margin };
|
|
64
|
+
if (!taken(next))
|
|
65
|
+
return next;
|
|
66
|
+
next = { ...next, x: next.x + step.x, y: next.y + step.y };
|
|
67
|
+
}
|
|
68
|
+
return next;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=layouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layouts.js","sourceRoot":"","sources":["../../src/core/layouts.ts"],"names":[],"mappings":"AAsBA,MAAM,GAAG,GAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AAE7C,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,IAAI,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,GAAgC,EAAE;QAC7C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;YAClD,MAAM,MAAM,GAAY,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YAClD,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAsC,CAAC,CAAC,CAAC,EAAE,CAAA;QAC5F,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAA;QACX,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,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;YAAE,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAA;QACtH,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAC7B,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAA;IAC5D,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LayoutStore } from './layouts.js';
|
|
1
2
|
export type WindowId = string;
|
|
2
3
|
export interface Frame {
|
|
3
4
|
readonly x: number;
|
|
@@ -42,6 +43,8 @@ export interface DeskOptions {
|
|
|
42
43
|
/** Reports the stage's size, so floating windows open inside it. */
|
|
43
44
|
readonly stage?: () => Size;
|
|
44
45
|
readonly initial?: DeskState;
|
|
46
|
+
/** Remembers how each kind of window was left, and opens it that way again. */
|
|
47
|
+
readonly layouts?: LayoutStore;
|
|
45
48
|
}
|
|
46
49
|
export interface OpenOptions {
|
|
47
50
|
/** Open as a free window rather than filling the desk. Given a frame, it floats there. */
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAE7B,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,CA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,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACzD,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAA;IAC5B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAA;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CACvB"}
|
package/dist/desk.css
CHANGED
|
@@ -216,6 +216,23 @@
|
|
|
216
216
|
color: var(--desk-muted);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
.desk-window-note {
|
|
220
|
+
margin: 0 0 0 auto;
|
|
221
|
+
min-width: 0;
|
|
222
|
+
/* The title is what the window IS; the note is what it is looking at. In a narrow window the note
|
|
223
|
+
gives up its room first, and is cut before the title is. */
|
|
224
|
+
flex: 0 999 auto;
|
|
225
|
+
overflow: hidden;
|
|
226
|
+
text-overflow: ellipsis;
|
|
227
|
+
white-space: nowrap;
|
|
228
|
+
font-size: 11.5px;
|
|
229
|
+
color: var(--desk-muted);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.desk-window-note + .desk-window-actions {
|
|
233
|
+
margin-left: var(--desk-space-1);
|
|
234
|
+
}
|
|
235
|
+
|
|
219
236
|
.desk-window-actions {
|
|
220
237
|
margin-left: auto;
|
|
221
238
|
display: flex;
|
|
@@ -372,7 +389,8 @@
|
|
|
372
389
|
transition: transform .18s var(--desk-ease), margin .18s var(--desk-ease);
|
|
373
390
|
}
|
|
374
391
|
|
|
375
|
-
.desk-dock-item:disabled
|
|
392
|
+
.desk-dock-item:disabled,
|
|
393
|
+
.desk-dock-item[aria-disabled="true"] {
|
|
376
394
|
opacity: .45;
|
|
377
395
|
cursor: not-allowed;
|
|
378
396
|
}
|
|
@@ -658,6 +676,13 @@
|
|
|
658
676
|
height: 15px;
|
|
659
677
|
}
|
|
660
678
|
|
|
679
|
+
/* A context menu is the same menu, opened where the pointer is rather than under a title. */
|
|
680
|
+
.desk-context-menu {
|
|
681
|
+
position: fixed;
|
|
682
|
+
z-index: 1300;
|
|
683
|
+
outline: none;
|
|
684
|
+
}
|
|
685
|
+
|
|
661
686
|
.desk-menubar-slot[data-align="end"] .desk-menu {
|
|
662
687
|
left: auto;
|
|
663
688
|
right: 0;
|
|
@@ -2548,3 +2573,123 @@
|
|
|
2548
2573
|
border: 0;
|
|
2549
2574
|
background: var(--desk-surface);
|
|
2550
2575
|
}
|
|
2576
|
+
|
|
2577
|
+
/* Icon view: a Finder's icons, in rows that follow the window's width. */
|
|
2578
|
+
.desk-icon-view {
|
|
2579
|
+
list-style: none;
|
|
2580
|
+
margin: 0;
|
|
2581
|
+
padding: 12px;
|
|
2582
|
+
display: grid;
|
|
2583
|
+
grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
|
|
2584
|
+
align-content: start;
|
|
2585
|
+
gap: 8px;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
.desk-icon-cell {
|
|
2589
|
+
display: grid;
|
|
2590
|
+
justify-items: center;
|
|
2591
|
+
align-content: start;
|
|
2592
|
+
gap: 4px;
|
|
2593
|
+
padding: 10px 6px;
|
|
2594
|
+
border-radius: 10px;
|
|
2595
|
+
text-align: center;
|
|
2596
|
+
cursor: default;
|
|
2597
|
+
user-select: none;
|
|
2598
|
+
outline: none;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
.desk-icon-cell[aria-disabled="true"] {
|
|
2602
|
+
opacity: .45;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
.desk-icon-cell:focus-visible {
|
|
2606
|
+
box-shadow: 0 0 0 2px var(--desk-accent);
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
.desk-icon-glyph {
|
|
2610
|
+
position: relative;
|
|
2611
|
+
display: grid;
|
|
2612
|
+
place-items: center;
|
|
2613
|
+
width: 56px;
|
|
2614
|
+
height: 56px;
|
|
2615
|
+
border-radius: 14px;
|
|
2616
|
+
border: 1px solid var(--desk-rule);
|
|
2617
|
+
background: var(--desk-dock-icon);
|
|
2618
|
+
color: var(--desk-ink);
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
.desk-icon-glyph > svg,
|
|
2622
|
+
.desk-icon-glyph > img {
|
|
2623
|
+
width: 55%;
|
|
2624
|
+
height: 55%;
|
|
2625
|
+
object-fit: contain;
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
.desk-icon-badge {
|
|
2629
|
+
position: absolute;
|
|
2630
|
+
top: -5px;
|
|
2631
|
+
right: -5px;
|
|
2632
|
+
min-width: 18px;
|
|
2633
|
+
padding: 0 5px;
|
|
2634
|
+
border-radius: 9px;
|
|
2635
|
+
background: var(--desk-accent);
|
|
2636
|
+
color: #fff;
|
|
2637
|
+
font-size: 11px;
|
|
2638
|
+
line-height: 18px;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
.desk-icon-label {
|
|
2642
|
+
max-width: 100%;
|
|
2643
|
+
padding: 1px 6px;
|
|
2644
|
+
border-radius: 5px;
|
|
2645
|
+
font-size: 12.5px;
|
|
2646
|
+
line-height: 1.3;
|
|
2647
|
+
overflow-wrap: anywhere;
|
|
2648
|
+
display: -webkit-box;
|
|
2649
|
+
-webkit-line-clamp: 2;
|
|
2650
|
+
-webkit-box-orient: vertical;
|
|
2651
|
+
overflow: hidden;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
.desk-icon-subtitle {
|
|
2655
|
+
max-width: 100%;
|
|
2656
|
+
font-size: 11px;
|
|
2657
|
+
color: var(--desk-muted);
|
|
2658
|
+
overflow: hidden;
|
|
2659
|
+
text-overflow: ellipsis;
|
|
2660
|
+
white-space: nowrap;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
.desk-icon-cell[aria-selected="true"] .desk-icon-glyph {
|
|
2664
|
+
background: color-mix(in srgb, var(--desk-accent) 16%, transparent);
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
.desk-icon-cell[aria-selected="true"] .desk-icon-label {
|
|
2668
|
+
background: var(--desk-accent);
|
|
2669
|
+
color: #fff;
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
.desk-icon-view-empty {
|
|
2673
|
+
display: grid;
|
|
2674
|
+
place-items: center;
|
|
2675
|
+
padding: 32px 16px;
|
|
2676
|
+
color: var(--desk-muted);
|
|
2677
|
+
text-align: center;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
.desk-icon-drag {
|
|
2681
|
+
display: grid;
|
|
2682
|
+
place-items: center;
|
|
2683
|
+
width: 40px;
|
|
2684
|
+
height: 40px;
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
/* Something carried to the dock: the dock lights up, and a kept item shows where it would go in front. */
|
|
2688
|
+
.desk-dock-item[data-desk-drop][data-ready] {
|
|
2689
|
+
outline: none;
|
|
2690
|
+
background: var(--desk-dock-icon);
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
.desk-dock-item[data-desk-drop][data-over] {
|
|
2694
|
+
box-shadow: -6px 0 0 -2px var(--desk-accent);
|
|
2695
|
+
}
|
package/dist/react/Desktop.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export type DeskLayout = 'desktop' | 'fullscreen';
|
|
|
5
5
|
export interface DesktopProps {
|
|
6
6
|
readonly renderWindow: (id: WindowId) => ReactNode;
|
|
7
7
|
readonly title: (id: WindowId) => ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* A quiet line on the trailing side of the title bar, saying what this window is looking at: the
|
|
10
|
+
* request behind it, the file it is editing, how many rows it found. Text, not a control — it
|
|
11
|
+
* gives way to the actions and disappears before the title does when the window is narrow.
|
|
12
|
+
*/
|
|
13
|
+
readonly note?: (id: WindowId) => ReactNode;
|
|
8
14
|
/** Window-wide controls on the trailing side of the title bar. One or two; more belongs in a toolbar. */
|
|
9
15
|
readonly actions?: (id: WindowId) => ReactNode;
|
|
10
16
|
/** Shown when no window is open. */
|
|
@@ -20,5 +26,5 @@ export interface DesktopProps {
|
|
|
20
26
|
readonly layout?: DeskLayout | 'auto';
|
|
21
27
|
readonly className?: string;
|
|
22
28
|
}
|
|
23
|
-
export declare function Desktop({ renderWindow, title, actions, empty, loading, failed, layout, className }: DesktopProps): import("react").JSX.Element;
|
|
29
|
+
export declare function Desktop({ renderWindow, title, note, actions, empty, loading, failed, layout, className }: DesktopProps): import("react").JSX.Element;
|
|
24
30
|
//# 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;AAGxF,OAAO,KAAK,EAAqB,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAInE,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,C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,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,SAAS,CAAA;IAC9C,oCAAoC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAA;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAA;IAC9B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AA2CD,wBAAgB,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAe,EAAE,SAAS,EAAE,EAAE,YAAY,+BA0F/H"}
|
package/dist/react/Desktop.js
CHANGED
|
@@ -34,7 +34,7 @@ const halfFrame = (stage, side) => {
|
|
|
34
34
|
const width = (area.width - area.gap) / 2;
|
|
35
35
|
return { x: side === 'start' ? area.x : area.x + width + area.gap, y: area.y, width, height: area.height };
|
|
36
36
|
};
|
|
37
|
-
export function Desktop({ renderWindow, title, actions, empty, loading, failed, layout = 'auto', className }) {
|
|
37
|
+
export function Desktop({ renderWindow, title, note, actions, empty, loading, failed, layout = 'auto', className }) {
|
|
38
38
|
const desk = useDesk();
|
|
39
39
|
const state = useDeskState();
|
|
40
40
|
const stage = useRef(null);
|
|
@@ -87,7 +87,7 @@ export function Desktop({ renderWindow, title, actions, empty, loading, failed,
|
|
|
87
87
|
}, [focused]);
|
|
88
88
|
return (_jsxs("div", { ref: stage, className: ['desk-stage', className].filter(Boolean).join(' '), "data-layout": mode, [STAGE_ATTRIBUTE]: '', children: [state.windows.length === 0 && empty, state.windows.map(window => (_jsx(WindowView, { window: window, layout: mode, depth: state.stack.indexOf(window.id), focused: window.id === focused,
|
|
89
89
|
// One window at a time: the rest stay mounted, keeping their state, and simply wait offstage.
|
|
90
|
-
hidden: mode === 'fullscreen' && window.id !== focused, title: title(window.id), actions: actions?.(window.id), children: _jsx(WindowContent, { id: window.id, render: renderWindow, loading: loading, failed: failed }) }, window.id)))] }));
|
|
90
|
+
hidden: mode === 'fullscreen' && window.id !== focused, title: title(window.id), note: note?.(window.id), actions: actions?.(window.id), children: _jsx(WindowContent, { id: window.id, render: renderWindow, loading: loading, failed: failed }) }, window.id)))] }));
|
|
91
91
|
}
|
|
92
92
|
// Each window loads and fails on its own: one fetching its code, or throwing, never blanks another.
|
|
93
93
|
const WindowContent = memo(function WindowContent({ id, render, loading, failed }) {
|
|
@@ -111,7 +111,7 @@ function reshape(gesture, origin, dx, dy) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function WindowView({ window, layout, hidden, depth, focused, title, actions, children }) {
|
|
114
|
+
function WindowView({ window, layout, hidden, depth, focused, title, note, actions, children }) {
|
|
115
115
|
const desk = useDesk();
|
|
116
116
|
// While dragging, the frame lives here and commits once on release, so a drag
|
|
117
117
|
// re-renders one window rather than notifying every subscriber per pixel.
|
|
@@ -207,6 +207,6 @@ function WindowView({ window, layout, hidden, depth, focused, title, actions, ch
|
|
|
207
207
|
}, children: [_jsxs("header", { className: "desk-titlebar", onPointerDown: startGesture('move'), onDoubleClick: event => {
|
|
208
208
|
if (!event.target.closest('button'))
|
|
209
209
|
zoom();
|
|
210
|
-
}, "data-draggable": layout === 'desktop' || undefined, children: [_jsxs("div", { className: "desk-controls", children: [_jsx("button", { type: "button", className: "desk-control", "data-control": "close", "aria-label": "Close", onClick: () => desk.close(window.id) }), layout === 'desktop' && (_jsx("button", { type: "button", className: "desk-control", "data-control": "mode", "aria-label": "Zoom", onClick: zoom }))] }), _jsx("h2", { id: titleId, className: "desk-title", children: title }), actions && _jsx("div", { className: "desk-window-actions", children: actions })] }), _jsx("div", { className: "desk-body", children: children }), layout === 'desktop' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "desk-edge", "data-edge": "left", "aria-hidden": "true", onPointerDown: startGesture('left') }), _jsx("div", { className: "desk-edge", "data-edge": "right", "aria-hidden": "true", onPointerDown: startGesture('right') }), _jsx("div", { className: "desk-edge", "data-edge": "bottom", "aria-hidden": "true", onPointerDown: startGesture('bottom') }), _jsx("div", { className: "desk-grip", "aria-hidden": "true", onPointerDown: startGesture('resize') })] }))] }) }));
|
|
210
|
+
}, "data-draggable": layout === 'desktop' || undefined, children: [_jsxs("div", { className: "desk-controls", children: [_jsx("button", { type: "button", className: "desk-control", "data-control": "close", "aria-label": "Close", onClick: () => desk.close(window.id) }), layout === 'desktop' && (_jsx("button", { type: "button", className: "desk-control", "data-control": "mode", "aria-label": "Zoom", onClick: zoom }))] }), _jsx("h2", { id: titleId, className: "desk-title", children: title }), note != null && note !== false && _jsx("p", { className: "desk-window-note", children: note }), actions && _jsx("div", { className: "desk-window-actions", children: actions })] }), _jsx("div", { className: "desk-body", children: children }), layout === 'desktop' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "desk-edge", "data-edge": "left", "aria-hidden": "true", onPointerDown: startGesture('left') }), _jsx("div", { className: "desk-edge", "data-edge": "right", "aria-hidden": "true", onPointerDown: startGesture('right') }), _jsx("div", { className: "desk-edge", "data-edge": "bottom", "aria-hidden": "true", onPointerDown: startGesture('bottom') }), _jsx("div", { className: "desk-grip", "aria-hidden": "true", onPointerDown: startGesture('resize') })] }))] }) }));
|
|
211
211
|
}
|
|
212
212
|
//# sourceMappingURL=Desktop.js.map
|