@liberation-data/desk 0.1.0 → 0.3.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 +126 -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 +252 -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 +10 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +5 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/infoTip.d.ts +11 -0
- package/dist/react/infoTip.d.ts.map +1 -0
- package/dist/react/infoTip.js +8 -0
- package/dist/react/infoTip.js.map +1 -0
- package/dist/react/pane.d.ts +28 -0
- package/dist/react/pane.d.ts.map +1 -0
- package/dist/react/pane.js +9 -0
- package/dist/react/pane.js.map +1 -0
- package/llms.txt +34 -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 +252 -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 +10 -2
- package/src/react/infoTip.tsx +48 -0
- package/src/react/pane.tsx +65 -0
package/src/react/index.ts
CHANGED
|
@@ -36,6 +36,10 @@ export type {
|
|
|
36
36
|
TextFieldProps,
|
|
37
37
|
ToggleProps,
|
|
38
38
|
} from './controls.js'
|
|
39
|
+
export { Pane, Toolbar } from './pane.js'
|
|
40
|
+
export type { PaneProps, ToolbarProps } from './pane.js'
|
|
41
|
+
export { InfoTip } from './infoTip.js'
|
|
42
|
+
export type { InfoTipProps } from './infoTip.js'
|
|
39
43
|
export { Checklist, useTasks } from './tasks.js'
|
|
40
44
|
export { localSetupStore, useSetupProgress } from './setupProgress.js'
|
|
41
45
|
export type { SetupProgress, SetupProgressOptions, SetupRecord, SetupStore } from './setupProgress.js'
|
|
@@ -59,6 +63,10 @@ export type { ComposerProps, Message, ThreadProps } from './conversation.js'
|
|
|
59
63
|
export { Alert, Popover, Sheet, ToastProvider, useToast } from './overlays.js'
|
|
60
64
|
export type { AlertProps, PopoverProps, PopoverTriggerProps, SheetProps, Toast, ToastInput } from './overlays.js'
|
|
61
65
|
export { MenuBar, menuAction, menuCommand, menuHeader, menuSeparator, windowMenuItems } from './MenuBar.js'
|
|
66
|
+
export { useContextMenu } from './contextMenu.js'
|
|
67
|
+
export type { ContextMenuOptions, ContextMenuResult, ContextMenuTargetProps } from './contextMenu.js'
|
|
62
68
|
export type { Menu, MenuBarProps, MenuItem } from './MenuBar.js'
|
|
63
|
-
export {
|
|
64
|
-
export type {
|
|
69
|
+
export { IconView } from './iconView.js'
|
|
70
|
+
export type { IconViewItem, IconViewProps } from './iconView.js'
|
|
71
|
+
export { Dock, DOCK_ITEM, dockItem, dockSeparator, dockStack } from './Dock.js'
|
|
72
|
+
export type { DockEntry, DockItem, DockPins, DockProps, DockStack } from './Dock.js'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { Popover } from './overlays.js'
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* What a view would explain if asked. A window that opens with a paragraph makes everyone read it
|
|
7
|
+
* every time to reach the thing they came for; the same words behind an (i) are there for whoever
|
|
8
|
+
* has the question, once.
|
|
9
|
+
*
|
|
10
|
+
* Only for explanation. A warning, or anything that changes what someone is about to do, belongs
|
|
11
|
+
* in front of them — hiding that behind a disclosure is how it goes unread.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface InfoTipProps {
|
|
15
|
+
/** What it explains, e.g. "About these logs" — the button's name and the popover's. */
|
|
16
|
+
readonly label: string
|
|
17
|
+
readonly children: ReactNode
|
|
18
|
+
readonly placement?: 'below' | 'above'
|
|
19
|
+
readonly align?: 'start' | 'end'
|
|
20
|
+
readonly className?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function InfoTip({ label, children, placement = 'below', align = 'start', className }: InfoTipProps) {
|
|
24
|
+
const [open, setOpen] = useState(false)
|
|
25
|
+
return (
|
|
26
|
+
<Popover
|
|
27
|
+
open={open}
|
|
28
|
+
onOpenChange={setOpen}
|
|
29
|
+
label={label}
|
|
30
|
+
placement={placement}
|
|
31
|
+
align={align}
|
|
32
|
+
trigger={props => (
|
|
33
|
+
<button
|
|
34
|
+
{...props}
|
|
35
|
+
ref={props.ref}
|
|
36
|
+
type="button"
|
|
37
|
+
className={['desk-infotip', className].filter(Boolean).join(' ')}
|
|
38
|
+
aria-label={label}
|
|
39
|
+
data-open={open || undefined}
|
|
40
|
+
>
|
|
41
|
+
<span aria-hidden="true">i</span>
|
|
42
|
+
</button>
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<div className="desk-infotip-body">{children}</div>
|
|
46
|
+
</Popover>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Ref, UIEvent, ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* The inside of a window: a row of controls that stays put, and content that scrolls under it.
|
|
5
|
+
*
|
|
6
|
+
* A window is a fixed height, so something inside it has to give. When the content simply grows,
|
|
7
|
+
* the window grows with it and the whole thing scrolls — the toolbar leaves with it, and a log or a
|
|
8
|
+
* table has to be scrolled past to reach anything below. A pane fills the window instead and scrolls
|
|
9
|
+
* only its middle, so the controls stay where the pointer left them.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface ToolbarProps {
|
|
13
|
+
/** Controls, in reading order. Anything given `className="desk-grow"` takes the spare room. */
|
|
14
|
+
readonly children: ReactNode
|
|
15
|
+
/** Pushed to the trailing end: what acts on everything here, or the state of it. */
|
|
16
|
+
readonly trailing?: ReactNode
|
|
17
|
+
/** Names the row for assistive technology when it holds more than one thing: "Log controls". */
|
|
18
|
+
readonly label?: string
|
|
19
|
+
readonly className?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** One aligned row of controls. Every item sits on the same centre line, whatever its height. */
|
|
23
|
+
export function Toolbar({ children, trailing, label, className }: ToolbarProps) {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
{...(label ? { role: 'group', 'aria-label': label } : {})}
|
|
27
|
+
className={['desk-toolbar', className].filter(Boolean).join(' ')}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
{trailing != null && <div className="desk-toolbar-trailing">{trailing}</div>}
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PaneProps {
|
|
36
|
+
/** Stays put at the top: a Toolbar, usually. */
|
|
37
|
+
readonly header?: ReactNode
|
|
38
|
+
/** Stays put at the bottom: a count, a status line, the buttons of a form. */
|
|
39
|
+
readonly footer?: ReactNode
|
|
40
|
+
/** Fills what is left and scrolls, on its own. */
|
|
41
|
+
readonly children: ReactNode
|
|
42
|
+
/** The scrolling part is the thing being read, so it can be named and reached by the keyboard. */
|
|
43
|
+
readonly label?: string
|
|
44
|
+
/** The scrolling element itself: for reading where it sits, or sending it to the bottom. */
|
|
45
|
+
readonly bodyRef?: Ref<HTMLDivElement>
|
|
46
|
+
readonly onScroll?: (event: UIEvent<HTMLDivElement>) => void
|
|
47
|
+
readonly className?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function Pane({ header, footer, children, label, bodyRef, onScroll, className }: PaneProps) {
|
|
51
|
+
return (
|
|
52
|
+
<div className={['desk-pane', className].filter(Boolean).join(' ')}>
|
|
53
|
+
{header != null && <div className="desk-pane-header">{header}</div>}
|
|
54
|
+
<div
|
|
55
|
+
ref={bodyRef}
|
|
56
|
+
className="desk-pane-body"
|
|
57
|
+
onScroll={onScroll}
|
|
58
|
+
{...(label ? { role: 'region', 'aria-label': label, tabIndex: 0 } : {})}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</div>
|
|
62
|
+
{footer != null && <div className="desk-pane-footer">{footer}</div>}
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|