@hanzo/app 0.3.101 → 0.3.102
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/dist/App.js +1 -1
- package/dist/ContextMenu.d.ts +4 -1
- package/dist/ContextMenu.js +3 -2
- package/dist/Rail.d.ts +33 -7
- package/dist/Rail.js +71 -36
- package/dist/Sidebar.js +16 -12
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -394,7 +394,7 @@ function Window({ bar, betas }) {
|
|
|
394
394
|
if (typeof window !== 'undefined') {
|
|
395
395
|
window.dispatchEvent(new CustomEvent('hanzo:anon-settings', { detail: { open: false } }));
|
|
396
396
|
}
|
|
397
|
-
} }) })) : mode === 'chat' ? (_jsx(Split, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'design' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : mode === 'flow' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Workflow, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Flow" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'flow')?.line ?? 'Visual workflows and multi-agent pipelines.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'flow'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(FlowStudio, { host: maker }) }) })) })) : mode === 'studio' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Clapperboard, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Studio" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'studio')?.line ?? 'Director Studio for AI film, video, and creative production.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'studio'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(DirectorStudio, { host: maker }) }) })) })) : at.mode === 'hosted' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsxs(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), position: "relative", flex: 1, minW: 0, minH: 0, children: [!plans && !run && !inPlace && closed && free && host.person !== null ? (_jsx(XStack, { position: "absolute", t: 8, r: 12, z: "var(--z-raised)", items: "center", "$max-md": { display: 'none' }, children: _jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t('Upgrade plan'), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, onClick: () => window.location.assign(payUrl('/cart', { org: currentOrg(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$soft", numberOfLines: 1, children: t('Upgrade plan') })] }) })) : null, plans ? null : _jsx(Builder, { host: host, rail: false })] })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsx(XStack, { flex: 1, minH: 0, children: _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Sidebar, { pins: pins, host: host, mode: mode, thread: thread, inside: inside, go: move, onShut: shut, onSeek: seek, onBack: back, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, onOrg: org, drawer: true, places: sidebar, made: maker }) }) }) })), finding ? _jsx(Search, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null, _jsx(AppContextMenu, { host: host, mode: mode, closed: closed, onToggleSidebar: flip, onSeek: seek, onNewChat: () => {
|
|
397
|
+
} }) })) : mode === 'chat' ? (_jsx(Split, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'design' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : mode === 'flow' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Workflow, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Flow" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'flow')?.line ?? 'Visual workflows and multi-agent pipelines.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'flow'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(FlowStudio, { host: maker }) }) })) })) : mode === 'studio' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Clapperboard, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Studio" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'studio')?.line ?? 'Director Studio for AI film, video, and creative production.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'studio'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(DirectorStudio, { host: maker }) }) })) })) : at.mode === 'hosted' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsxs(YStack, { id: "main-content", tabIndex: -1, render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), position: "relative", flex: 1, minW: 0, minH: 0, children: [!plans && !run && !inPlace && closed && free && host.person !== null ? (_jsx(XStack, { position: "absolute", t: 8, r: 12, z: "var(--z-raised)", items: "center", "$max-md": { display: 'none' }, children: _jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t('Upgrade plan'), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, onClick: () => window.location.assign(payUrl('/cart', { org: currentOrg(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$soft", numberOfLines: 1, children: t('Upgrade plan') })] }) })) : null, plans ? null : _jsx(Builder, { host: host, rail: false })] })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsx(XStack, { flex: 1, minH: 0, children: _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Sidebar, { pins: pins, host: host, mode: mode, thread: thread, inside: inside, go: move, onShut: shut, onSeek: seek, onBack: back, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, onOrg: org, drawer: true, places: sidebar, made: maker }) }) }) })), finding ? _jsx(Search, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null, _jsx(AppContextMenu, { pins: pins, host: host, mode: mode, closed: closed, onToggleSidebar: flip, onSeek: seek, onNewChat: () => {
|
|
398
398
|
empty();
|
|
399
399
|
move(talk());
|
|
400
400
|
}, go: move })] }) }) }) }) }));
|
package/dist/ContextMenu.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Host } from '@hanzo/build';
|
|
2
2
|
import { type Place } from './lib/host.js';
|
|
3
|
-
|
|
3
|
+
import { type Pins } from './Rail.js';
|
|
4
|
+
export declare function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, onNewChat, go, pins: held, }: {
|
|
4
5
|
host: Host;
|
|
5
6
|
mode: Place['mode'];
|
|
6
7
|
closed: boolean;
|
|
@@ -8,4 +9,6 @@ export declare function AppContextMenu({ host, mode, closed, onToggleSidebar, on
|
|
|
8
9
|
onSeek: () => void;
|
|
9
10
|
onNewChat: () => void;
|
|
10
11
|
go: (address: string) => void;
|
|
12
|
+
/** The surface's pins (App.tsx), so a pin made here shows in the Sidebar and the Rail at once. */
|
|
13
|
+
pins?: Pins;
|
|
11
14
|
}): import("react").JSX.Element;
|
package/dist/ContextMenu.js
CHANGED
|
@@ -81,7 +81,7 @@ const railPath = (slot) => {
|
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, onNewChat, go, }) {
|
|
84
|
+
export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, onNewChat, go, pins: held, }) {
|
|
85
85
|
const { t } = useI18n();
|
|
86
86
|
const { thread: activeThread } = useOpen();
|
|
87
87
|
const [state, setState] = useState(null);
|
|
@@ -89,7 +89,8 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
89
89
|
const panelRef = useRef(null);
|
|
90
90
|
const openerRef = useRef(null);
|
|
91
91
|
const apple = isMac();
|
|
92
|
-
const
|
|
92
|
+
const own = usePinnedNav();
|
|
93
|
+
const [pins, togglePin] = held ?? own;
|
|
93
94
|
const closeMenu = useCallback((restoreFocus = false) => {
|
|
94
95
|
setState(null);
|
|
95
96
|
if (restoreFocus) {
|
package/dist/Rail.d.ts
CHANGED
|
@@ -4,20 +4,34 @@ import { MARK } from './ground.js';
|
|
|
4
4
|
import { type Place } from './lib/host.js';
|
|
5
5
|
export { MARK };
|
|
6
6
|
export declare const RAIL_FOLDED = 52;
|
|
7
|
-
/** Where
|
|
7
|
+
/** Where an earlier version kept the menu (the five apps, then the reader's pins), on the account. Read once, to carry those pins over. */
|
|
8
8
|
export declare const NAV_PINNED_KEY = "hanzo.nav.pinned";
|
|
9
|
+
/** Where the reader's pins are kept, on the account (`usePref`), so they follow them to every device: only what they pinned, in their order. */
|
|
10
|
+
export declare const NAV_PINS_KEY = "hanzo.nav.pins";
|
|
11
|
+
/** The menu as it stands when nothing is pinned, in its order: each app's default place. */
|
|
12
|
+
export declare const DEFAULT_NAV: readonly string[];
|
|
13
|
+
/** The old name of `DEFAULT_NAV`, for importers that still read it. */
|
|
9
14
|
export declare const DEFAULT_PINNED_NAV: readonly string[];
|
|
10
|
-
/** The reader's
|
|
11
|
-
export declare function
|
|
12
|
-
/**
|
|
15
|
+
/** The reader's pins, each once, in their order. */
|
|
16
|
+
export declare function cleanPinnedNav(list: readonly unknown[]): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The pins an earlier version kept (`NAV_PINNED_KEY`: the five apps, then what the reader pinned from More): the ones
|
|
19
|
+
* pinned from More stay pinned, and the five go back to their default places.
|
|
20
|
+
*/
|
|
21
|
+
export declare function carriedPinnedNav(list: unknown): string[];
|
|
22
|
+
/** `list` with `id` pinned (to the end of the pins, so at the top of the menu, under the ones pinned before it) or unpinned (back to its default place). */
|
|
13
23
|
export declare function toggledPinnedNav(list: readonly string[], id: string): string[];
|
|
14
|
-
/** `list` with `sourceId` moved to where `targetId` stands. */
|
|
24
|
+
/** `list` with `sourceId` moved to where `targetId` stands, pinning it on the way when it was not; `targetId` not pinned puts it last. */
|
|
15
25
|
export declare function reorderedPinnedNav(list: readonly string[], sourceId: string, targetId: string): string[];
|
|
16
|
-
/** What `usePinnedNav` answers, held once by the surface and handed to the Rail and the
|
|
26
|
+
/** What `usePinnedNav` answers, held once by the surface and handed to the Rail, the Sidebar and the context menu, so a pin made in one is in the others. */
|
|
17
27
|
export type Pins = ReturnType<typeof usePinnedNav>;
|
|
18
28
|
/** `list` with `id` swapped with its neighbour one place up (-1) or down (1) among `visible`, the pins the reader sees (one may be hidden): the keyboard's way to the order a drag makes. */
|
|
19
29
|
export declare function shiftedPinnedNav(list: readonly string[], id: string, delta: -1 | 1, visible?: readonly string[]): string[];
|
|
20
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The reader's pins, a toggle for one, a reorder and a move, kept on the account. Pins stand at the top of the menu in
|
|
32
|
+
* the reader's order; everything else keeps its default place (`DEFAULT_NAV`, then More). Until the reader pins under
|
|
33
|
+
* this version, the pins an earlier one kept carry over (`carriedPinnedNav`).
|
|
34
|
+
*/
|
|
21
35
|
export declare function usePinnedNav(): [string[], (id: string) => void, (sourceId: string, targetId: string) => void, (id: string, delta: -1 | 1, visible?: readonly string[]) => void];
|
|
22
36
|
/** The places the rail holds beside the products, by the builder address each opens. */
|
|
23
37
|
export declare const RAISED: {
|
|
@@ -65,6 +79,7 @@ export declare function useNavEntries({ host, mode, at, inside, onChat, onDev, o
|
|
|
65
79
|
allEntries: NavEntry[];
|
|
66
80
|
externalEntries: NavEntry[];
|
|
67
81
|
pinnedEntries: NavEntry[];
|
|
82
|
+
defaultEntries: NavEntry[];
|
|
68
83
|
moreEntries: NavEntry[];
|
|
69
84
|
shownInPrimary: Set<string>;
|
|
70
85
|
reach: (address: string) => void;
|
|
@@ -81,6 +96,17 @@ export declare function Mark({ label, on, tooltip, onPress, onClick, children, .
|
|
|
81
96
|
children: ReactNode;
|
|
82
97
|
[attribute: `data-${string}` | `aria-${string}`]: unknown;
|
|
83
98
|
}): import("react").JSX.Element;
|
|
99
|
+
/**
|
|
100
|
+
* A destination on the folded rail: its mark with its name under it, so the folded rail reads at a glance without a
|
|
101
|
+
* hover (hanzo-inc/app issue 315). The name is small and one line; a long one ends in an ellipsis, and the tooltip says it whole.
|
|
102
|
+
*/
|
|
103
|
+
export declare function RailMark({ label, on, onClick, children, ...rest }: {
|
|
104
|
+
label: string;
|
|
105
|
+
on?: boolean;
|
|
106
|
+
onClick?: () => void;
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
[attribute: `data-${string}` | `aria-${string}`]: unknown;
|
|
109
|
+
}): import("react").JSX.Element;
|
|
84
110
|
/** The sidebar's toggle: the same mark wherever a host draws it. */
|
|
85
111
|
export declare function Toggle({ open, onPress, label }: {
|
|
86
112
|
open: boolean;
|
package/dist/Rail.js
CHANGED
|
@@ -29,33 +29,46 @@ export { MARK };
|
|
|
29
29
|
export const RAIL_FOLDED = 52;
|
|
30
30
|
/** A mark on a touch screen, px: a thumb's 44. */
|
|
31
31
|
const TOUCH = 44;
|
|
32
|
-
/** Where
|
|
32
|
+
/** Where an earlier version kept the menu (the five apps, then the reader's pins), on the account. Read once, to carry those pins over. */
|
|
33
33
|
export const NAV_PINNED_KEY = 'hanzo.nav.pinned';
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
/** The
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/** Where the reader's pins are kept, on the account (`usePref`), so they follow them to every device: only what they pinned, in their order. */
|
|
35
|
+
export const NAV_PINS_KEY = 'hanzo.nav.pins';
|
|
36
|
+
/** The menu as it stands when nothing is pinned, in its order: each app's default place. */
|
|
37
|
+
export const DEFAULT_NAV = ['chat', 'dev', 'design', 'library', 'tabs'];
|
|
38
|
+
/** The old name of `DEFAULT_NAV`, for importers that still read it. */
|
|
39
|
+
export const DEFAULT_PINNED_NAV = DEFAULT_NAV;
|
|
40
|
+
const CORE_NAV_SET = new Set(DEFAULT_NAV);
|
|
41
|
+
/** The reader's pins, each once, in their order. */
|
|
42
|
+
export function cleanPinnedNav(list) {
|
|
43
|
+
return [...new Set(list.filter((id) => typeof id === 'string' && id.length > 0))];
|
|
40
44
|
}
|
|
41
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The pins an earlier version kept (`NAV_PINNED_KEY`: the five apps, then what the reader pinned from More): the ones
|
|
47
|
+
* pinned from More stay pinned, and the five go back to their default places.
|
|
48
|
+
*/
|
|
49
|
+
export function carriedPinnedNav(list) {
|
|
50
|
+
return Array.isArray(list) ? cleanPinnedNav(list).filter((id) => !CORE_NAV_SET.has(id)) : [];
|
|
51
|
+
}
|
|
52
|
+
/** `list` with `id` pinned (to the end of the pins, so at the top of the menu, under the ones pinned before it) or unpinned (back to its default place). */
|
|
42
53
|
export function toggledPinnedNav(list, id) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
const pins = cleanPinnedNav(list);
|
|
55
|
+
if (!id)
|
|
56
|
+
return pins;
|
|
57
|
+
return pins.includes(id) ? pins.filter((item) => item !== id) : [...pins, id];
|
|
46
58
|
}
|
|
47
|
-
/** `list` with `sourceId` moved to where `targetId` stands. */
|
|
59
|
+
/** `list` with `sourceId` moved to where `targetId` stands, pinning it on the way when it was not; `targetId` not pinned puts it last. */
|
|
48
60
|
export function reorderedPinnedNav(list, sourceId, targetId) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
const pins = cleanPinnedNav(list);
|
|
62
|
+
if (!sourceId || sourceId === targetId)
|
|
63
|
+
return pins;
|
|
64
|
+
const without = pins.filter((id) => id !== sourceId);
|
|
52
65
|
const at = without.indexOf(targetId);
|
|
53
66
|
without.splice(at < 0 ? without.length : at, 0, sourceId);
|
|
54
|
-
return
|
|
67
|
+
return without;
|
|
55
68
|
}
|
|
56
69
|
/** `list` with `id` swapped with its neighbour one place up (-1) or down (1) among `visible`, the pins the reader sees (one may be hidden): the keyboard's way to the order a drag makes. */
|
|
57
70
|
export function shiftedPinnedNav(list, id, delta, visible = list) {
|
|
58
|
-
const next =
|
|
71
|
+
const next = cleanPinnedNav(list);
|
|
59
72
|
const other = visible[visible.indexOf(id) + delta];
|
|
60
73
|
const from = next.indexOf(id);
|
|
61
74
|
const to = other === undefined ? -1 : next.indexOf(other);
|
|
@@ -64,10 +77,15 @@ export function shiftedPinnedNav(list, id, delta, visible = list) {
|
|
|
64
77
|
[next[from], next[to]] = [next[to], next[from]];
|
|
65
78
|
return next;
|
|
66
79
|
}
|
|
67
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* The reader's pins, a toggle for one, a reorder and a move, kept on the account. Pins stand at the top of the menu in
|
|
82
|
+
* the reader's order; everything else keeps its default place (`DEFAULT_NAV`, then More). Until the reader pins under
|
|
83
|
+
* this version, the pins an earlier one kept carry over (`carriedPinnedNav`).
|
|
84
|
+
*/
|
|
68
85
|
export function usePinnedNav() {
|
|
69
|
-
const [
|
|
70
|
-
const
|
|
86
|
+
const [earlier] = usePref(NAV_PINNED_KEY, null);
|
|
87
|
+
const [kept, keep] = usePref(NAV_PINS_KEY, null);
|
|
88
|
+
const pinned = Array.isArray(kept) ? cleanPinnedNav(kept) : carriedPinnedNav(earlier);
|
|
71
89
|
return [pinned, (id) => keep(toggledPinnedNav(pinned, id)), (src, target) => keep(reorderedPinnedNav(pinned, src, target)), (id, delta, visible) => keep(shiftedPinnedNav(pinned, id, delta, visible))];
|
|
72
90
|
}
|
|
73
91
|
/** The places the rail holds beside the products, by the builder address each opens. */
|
|
@@ -116,7 +134,6 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
116
134
|
slot: 'rail-chat',
|
|
117
135
|
label: t('Chat'),
|
|
118
136
|
href: talk(),
|
|
119
|
-
pinnable: false,
|
|
120
137
|
on: mode === 'chat',
|
|
121
138
|
icon: _jsx(MARKS.chat.icon, { size: 17, "aria-hidden": true }),
|
|
122
139
|
onPress: onChat,
|
|
@@ -126,7 +143,6 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
126
143
|
slot: 'rail-dev',
|
|
127
144
|
label: 'Dev',
|
|
128
145
|
href: app(''),
|
|
129
|
-
pinnable: false,
|
|
130
146
|
on: mode === 'dev' && !here,
|
|
131
147
|
icon: _jsx(MARKS.dev.icon, { size: 17, "aria-hidden": true }),
|
|
132
148
|
onPress: onDev,
|
|
@@ -139,7 +155,6 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
139
155
|
slot: 'rail-design',
|
|
140
156
|
label: 'Design',
|
|
141
157
|
href: design(''),
|
|
142
|
-
pinnable: false,
|
|
143
158
|
on: mode === 'design',
|
|
144
159
|
icon: _jsx(MARKS.design.icon, { size: 17, "aria-hidden": true }),
|
|
145
160
|
onPress: () => onDesign?.(),
|
|
@@ -150,7 +165,6 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
150
165
|
slot: 'rail-library',
|
|
151
166
|
label: t('Library'),
|
|
152
167
|
href: app(RAISED.library),
|
|
153
|
-
pinnable: false,
|
|
154
168
|
on: here === 'library',
|
|
155
169
|
icon: _jsx(MARKS.library.icon, { size: 17, "aria-hidden": true }),
|
|
156
170
|
onPress: to(RAISED.library),
|
|
@@ -207,7 +221,6 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
207
221
|
slot: 'rail-tabs',
|
|
208
222
|
label: 'Tabs',
|
|
209
223
|
href: TERMINALS,
|
|
210
|
-
pinnable: false,
|
|
211
224
|
on: mode === 'tabs',
|
|
212
225
|
icon: _jsx(MARKS.tabs.icon, { size: 17, "aria-hidden": true }),
|
|
213
226
|
onPress: onTabs,
|
|
@@ -277,11 +290,18 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
277
290
|
]
|
|
278
291
|
: [];
|
|
279
292
|
const combinedById = new Map([...allEntries, ...externalEntries].map((item) => [item.id, item]));
|
|
280
|
-
// Anonymous visitors see the public trio (Chat, Dev, Library).
|
|
293
|
+
// Anonymous visitors see the public trio (Chat, Dev, Library), and pin nothing.
|
|
294
|
+
// The reader's pins lead, in their order; the default apps follow in theirs; the rest is More.
|
|
281
295
|
const pinnedEntries = anon
|
|
282
|
-
?
|
|
296
|
+
? []
|
|
283
297
|
: pinnedIds.map((id) => combinedById.get(id)).filter((item) => Boolean(item));
|
|
284
|
-
const
|
|
298
|
+
const pinnedShown = new Set(pinnedEntries.map((item) => item.id));
|
|
299
|
+
const defaultEntries = anon
|
|
300
|
+
? allEntries
|
|
301
|
+
: DEFAULT_NAV.filter((id) => !pinnedShown.has(id))
|
|
302
|
+
.map((id) => combinedById.get(id))
|
|
303
|
+
.filter((item) => Boolean(item));
|
|
304
|
+
const shownInPrimary = new Set([...pinnedEntries, ...defaultEntries].map((item) => item.id));
|
|
285
305
|
const moreEntries = anon
|
|
286
306
|
? []
|
|
287
307
|
: [
|
|
@@ -301,6 +321,7 @@ export function useNavEntries({ host, mode, at, inside = null, onChat, onDev, on
|
|
|
301
321
|
allEntries,
|
|
302
322
|
externalEntries,
|
|
303
323
|
pinnedEntries,
|
|
324
|
+
defaultEntries,
|
|
304
325
|
moreEntries,
|
|
305
326
|
shownInPrimary,
|
|
306
327
|
reach,
|
|
@@ -314,6 +335,13 @@ export function Mark({ label, on = false, tooltip = false, onPress, onClick, chi
|
|
|
314
335
|
return button;
|
|
315
336
|
return (_jsxs(Tooltip, { placement: "right", offset: 8, children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { maxW: 240, px: "$2.5", py: "$1.5", rounded: "$3", bg: "var(--popover)", borderWidth: 1, borderColor: "$edge", z: "var(--z-tooltip)", children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "500", color: "$ink", children: label }) })] }));
|
|
316
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* A destination on the folded rail: its mark with its name under it, so the folded rail reads at a glance without a
|
|
340
|
+
* hover (hanzo-inc/app issue 315). The name is small and one line; a long one ends in an ellipsis, and the tooltip says it whole.
|
|
341
|
+
*/
|
|
342
|
+
export function RailMark({ label, on = false, onClick, children, ...rest }) {
|
|
343
|
+
return (_jsxs(Tooltip, { placement: "right", offset: 8, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(YStack, { render: "button", "aria-label": label, "aria-current": on ? 'page' : undefined, onClick: onClick, width: RAIL_FOLDED - 6, minH: MARK + 6, px: 2, py: 5, gap: 3, rounded: 12, items: "center", justify: "center", shrink: 0, cursor: "pointer", bg: on ? '$raised' : 'transparent', hoverStyle: { bg: on ? '$raised' : '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, $touchable: { minH: TOUCH + 8 }, ...rest, children: [_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", opacity: on ? 1 : 0.76, children: children }), _jsx(Text, { "data-slot": "rail-caption", "aria-hidden": true, maxW: "100%", fontSize: 10, lineHeight: 12, fontWeight: on ? '600' : '400', color: on ? '$ink' : '$aside', numberOfLines: 1, text: "center", children: label })] }) }), _jsx(TooltipContent, { maxW: 240, px: "$2.5", py: "$1.5", rounded: "$3", bg: "var(--popover)", borderWidth: 1, borderColor: "$edge", z: "var(--z-tooltip)", children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "500", color: "$ink", children: label }) })] }));
|
|
344
|
+
}
|
|
317
345
|
/** The sidebar's toggle: the same mark wherever a host draws it. */
|
|
318
346
|
export function Toggle({ open, onPress, label }) {
|
|
319
347
|
const { t } = useI18n();
|
|
@@ -337,10 +365,12 @@ export function Rail({ host, mode, at, open, toggle, onOpen, onNew, compact = fa
|
|
|
337
365
|
go,
|
|
338
366
|
pins,
|
|
339
367
|
});
|
|
340
|
-
const { anon,
|
|
368
|
+
const { anon, pinnedEntries, defaultEntries, allEntries, externalEntries, shownInPrimary, reach } = nav;
|
|
341
369
|
const betasDialog = _jsx(BetasDialog, { open: betas, onOpenChange: setBetas, go: reach });
|
|
342
370
|
const unpinnedActive = allEntries.filter((item) => !shownInPrimary.has(item.id) && item.on);
|
|
343
|
-
|
|
371
|
+
// The reader's pins first, then the default apps in their places, then an app from More while the reader is in it.
|
|
372
|
+
const visibleMarks = [...pinnedEntries, ...defaultEntries, ...unpinnedActive];
|
|
373
|
+
const pinnedSet = new Set(pinnedEntries.map((item) => item.id));
|
|
344
374
|
const overflowBuiltIn = allEntries.filter((item) => !shownInPrimary.has(item.id) && !item.on);
|
|
345
375
|
const overflowExternal = externalEntries.filter((item) => !shownInPrimary.has(item.id));
|
|
346
376
|
const foldedEntries = [...overflowBuiltIn, ...overflowExternal];
|
|
@@ -357,10 +387,13 @@ export function Rail({ host, mode, at, open, toggle, onOpen, onNew, compact = fa
|
|
|
357
387
|
else
|
|
358
388
|
go(talk());
|
|
359
389
|
});
|
|
360
|
-
return (_jsx(TooltipProvider, { delay: 90, children: _jsxs(YStack, { "data-slot": "rail", "data-expanded": "false", render: "nav", "aria-label": t('Products'), width: RAIL_FOLDED, flex: 1, minH: 0, pt: (HEAD - MARK) / 2 + 2, pb: 0, gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2, pb: 0 }, children: [!compact && expandHandler ? (_jsx(Mark, { label: t('Open sidebar'), "data-slot": "rail-expand", tooltip: true, onClick: expandHandler, children: _jsx(PanelLeftOpen, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) })) : null, !compact && mode !== 'beta' && mode !== 'hosted' ? (_jsx(Mark, { label: newLabel, "data-slot": "rail-new", tooltip: true, onClick: handleNew, children: _jsx(Plus, { size: 18, "aria-hidden": true }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [visibleMarks.map((item) => {
|
|
390
|
+
return (_jsx(TooltipProvider, { delay: 90, children: _jsxs(YStack, { "data-slot": "rail", "data-expanded": "false", render: "nav", "aria-label": t('Products'), width: RAIL_FOLDED, flex: 1, minH: 0, pt: (HEAD - MARK) / 2 + 2, pb: 0, gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2, pb: 0 }, children: [!compact && expandHandler ? (_jsx(Mark, { label: t('Open sidebar'), "data-slot": "rail-expand", tooltip: true, onClick: expandHandler, children: _jsx(PanelLeftOpen, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) })) : null, !compact && mode !== 'beta' && mode !== 'hosted' ? (_jsx(Mark, { label: newLabel, "data-slot": "rail-new", tooltip: true, onClick: handleNew, children: _jsx(Plus, { size: 18, "aria-hidden": true }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [visibleMarks.map((item, i) => {
|
|
361
391
|
const isDragging = dragId === item.id;
|
|
362
|
-
|
|
363
|
-
|
|
392
|
+
// A pin is where a drag lands: dropped on one, the dragged app is pinned there (or moved there among the pins).
|
|
393
|
+
const droppable = pinnedSet.has(item.id);
|
|
394
|
+
const isDropTarget = droppable && dropId === item.id && dragId !== null && dragId !== item.id;
|
|
395
|
+
const afterPins = i > 0 && i === pinnedEntries.length;
|
|
396
|
+
return (_jsxs(YStack, { width: "100%", items: "center", opacity: isDragging ? 0.4 : 1, borderTopWidth: isDropTarget ? 2 : 0, borderColor: "var(--foreground)", pt: isDropTarget ? 2 : 0, "$platform-web": { cursor: isDragging ? 'grabbing' : 'grab' }, ...{
|
|
364
397
|
draggable: !anon,
|
|
365
398
|
onDragStart: (e) => {
|
|
366
399
|
setDragId(item.id);
|
|
@@ -369,7 +402,7 @@ export function Rail({ host, mode, at, open, toggle, onOpen, onNew, compact = fa
|
|
|
369
402
|
e.dataTransfer.effectAllowed = 'move';
|
|
370
403
|
},
|
|
371
404
|
onDragOver: (e) => {
|
|
372
|
-
if (!dragId || dragId === item.id)
|
|
405
|
+
if (!droppable || !dragId || dragId === item.id)
|
|
373
406
|
return;
|
|
374
407
|
e.preventDefault();
|
|
375
408
|
if (e.dataTransfer)
|
|
@@ -382,6 +415,8 @@ export function Rail({ host, mode, at, open, toggle, onOpen, onNew, compact = fa
|
|
|
382
415
|
setDropId(null);
|
|
383
416
|
},
|
|
384
417
|
onDrop: (e) => {
|
|
418
|
+
if (!droppable)
|
|
419
|
+
return;
|
|
385
420
|
e.preventDefault();
|
|
386
421
|
const src = dragId || e.dataTransfer?.getData('text/plain');
|
|
387
422
|
if (src && src !== item.id)
|
|
@@ -393,8 +428,8 @@ export function Rail({ host, mode, at, open, toggle, onOpen, onNew, compact = fa
|
|
|
393
428
|
setDragId(null);
|
|
394
429
|
setDropId(null);
|
|
395
430
|
},
|
|
396
|
-
}, children: _jsx(
|
|
397
|
-
}), !anon && foldedEntries.length > 0 ? (_jsx(MoreMenu, { placement: dir === 'rtl' ? 'left-start' : 'right-start', minWidth: 220, maxHeight: 420, entries: foldedEntries, onPin: nav.togglePin, t: t, trigger:
|
|
431
|
+
}, children: [afterPins ? _jsx(YStack, { "data-slot": "rail-pins-end", width: 20, height: 1, bg: "$edge", mb: 4, "aria-hidden": true }) : null, _jsx(RailMark, { label: item.label, on: item.on, onClick: item.onPress, "data-slot": item.slot, "data-nav-id": item.id, "data-pinned": pinnedSet.has(item.id) ? '' : undefined, children: item.icon })] }, item.id));
|
|
432
|
+
}), !anon && foldedEntries.length > 0 ? (_jsx(MoreMenu, { placement: dir === 'rtl' ? 'left-start' : 'right-start', minWidth: 220, maxHeight: 420, entries: foldedEntries, onPin: nav.togglePin, t: t, trigger: _jsxs(YStack, { render: "button", "aria-label": t('More'), ...{ title: t('More') }, "data-slot": "rail-more", width: RAIL_FOLDED - 6, minH: MARK + 6, px: 2, py: 5, gap: 3, rounded: 12, items: "center", justify: "center", cursor: "pointer", hoverStyle: { bg: '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, $touchable: { minH: TOUCH + 8 }, children: [_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", opacity: 0.68, children: _jsx(Ellipsis, { size: 18, "aria-hidden": true }) }), _jsx(Text, { "data-slot": "rail-caption", "aria-hidden": true, maxW: "100%", fontSize: 10, lineHeight: 12, color: "$aside", numberOfLines: 1, text: "center", children: t('More') })] }) })) : null, betasDialog] }), anon ? (_jsxs(YStack, { gap: 4, items: "center", pb: "$1", children: [_jsx(Mark, { label: t('See plans and pricing'), "data-slot": "anon-pricing", tooltip: true, onClick: () => {
|
|
398
433
|
if (typeof window !== 'undefined')
|
|
399
434
|
window.location.assign('/pricing');
|
|
400
435
|
}, children: _jsx(Sparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Help'), "data-slot": "anon-help", tooltip: true, onClick: () => {
|
package/dist/Sidebar.js
CHANGED
|
@@ -26,10 +26,10 @@ import { useEffect, useId, useMemo, useState } from 'react';
|
|
|
26
26
|
import { Account, Made } from './Account.js';
|
|
27
27
|
import { useBetas } from './Betas.js';
|
|
28
28
|
import { Recents } from './Recents.js';
|
|
29
|
-
import { fullNavUrl, raised, useNavEntries } from './Rail.js';
|
|
29
|
+
import { DEFAULT_NAV, fullNavUrl, raised, useNavEntries } from './Rail.js';
|
|
30
30
|
import { MoreMenu } from './MoreMenu.js';
|
|
31
31
|
import { Setup } from './Setup.js';
|
|
32
|
-
import { ago, UNTITLED_RUN } from './recent.js';
|
|
32
|
+
import { ago, PINNED, UNTITLED_RUN } from './recent.js';
|
|
33
33
|
import { empty } from './open.js';
|
|
34
34
|
import { useSpan } from './span.js';
|
|
35
35
|
import { useDevMode } from './lib/dev-mode.js';
|
|
@@ -121,14 +121,17 @@ function fullPlaceUrl(path) {
|
|
|
121
121
|
return path;
|
|
122
122
|
return new URL(site(path), window.location.href).href;
|
|
123
123
|
}
|
|
124
|
-
function NavMenuRow({ item, pinned, onTogglePin, onMove, draggable = false, dragging = false, dropTarget = false, onDragStart, onDragOver, onDragLeave, onDrop, onDragEnd, t, }) {
|
|
124
|
+
function NavMenuRow({ item, pinned, pinnable = true, onTogglePin, onMove, draggable = false, dragging = false, dropTarget = false, onDragStart, onDragOver, onDragLeave, onDrop, onDragEnd, t, }) {
|
|
125
125
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
126
|
-
const canPin = item.pinnable !== false;
|
|
126
|
+
const canPin = pinnable && item.pinnable !== false;
|
|
127
127
|
const handleTogglePin = () => {
|
|
128
128
|
onTogglePin(item.id);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
// Unpinned, an app goes back to its default place: one of the menu's own apps to its row, any other to More.
|
|
130
|
+
toast.success(!pinned
|
|
131
|
+
? t('Pinned {name} to top', { name: item.label })
|
|
132
|
+
: DEFAULT_NAV.includes(item.id)
|
|
133
|
+
? t('Unpinned {name}', { name: item.label })
|
|
134
|
+
: t('Moved {name} back to More', { name: item.label }));
|
|
132
135
|
};
|
|
133
136
|
const menuItems = [
|
|
134
137
|
...(canPin
|
|
@@ -521,8 +524,9 @@ export function Sidebar({ pins, host, mode, thread, go, onShut, onSeek, onBack,
|
|
|
521
524
|
go,
|
|
522
525
|
pins,
|
|
523
526
|
});
|
|
524
|
-
//
|
|
525
|
-
|
|
527
|
+
// The reader's pins lead (under Pinned), the default apps follow in their places, and an app that lives in More draws
|
|
528
|
+
// its own row (and sub-links) after them while the reader is in it.
|
|
529
|
+
const rest = [...nav.defaultEntries, ...nav.moreEntries.filter((item) => item.on)];
|
|
526
530
|
const showMore = !at && !anon && nav.moreEntries.length > 0;
|
|
527
531
|
const subGroupsFor = (entryId) => {
|
|
528
532
|
if (at)
|
|
@@ -555,7 +559,7 @@ export function Sidebar({ pins, host, mode, thread, go, onShut, onSeek, onBack,
|
|
|
555
559
|
const renderNavEntryWithSublinks = (item, allowDrop) => {
|
|
556
560
|
const subGroups = item.on ? subGroupsFor(item.id) : [];
|
|
557
561
|
const canDrag = !anon;
|
|
558
|
-
return (_jsxs(YStack, { gap: 1, width: "100%", children: [_jsx(NavMenuRow, { item: item, pinned: pinnedSet.has(item.id), onTogglePin: togglePin, onMove: canDrag && allowDrop && pinnedSet.has(item.id)
|
|
562
|
+
return (_jsxs(YStack, { gap: 1, width: "100%", children: [_jsx(NavMenuRow, { item: item, pinned: pinnedSet.has(item.id), pinnable: !anon, onTogglePin: togglePin, onMove: canDrag && allowDrop && pinnedSet.has(item.id)
|
|
559
563
|
? {
|
|
560
564
|
up: seen.indexOf(item.id) > 0 ? () => movePin(item.id, -1, seen) : undefined,
|
|
561
565
|
down: seen.indexOf(item.id) < seen.length - 1 ? () => movePin(item.id, 1, seen) : undefined,
|
|
@@ -642,7 +646,7 @@ export function Sidebar({ pins, host, mode, thread, go, onShut, onSeek, onBack,
|
|
|
642
646
|
return (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$2", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: orderedLinks.map((link) => (_jsx(PlaceRow, { link: link, mode: mode, makeIcon: Make, t: t }, link.id))) })] }, g.id));
|
|
643
647
|
}) })) : null, !at ? (_jsx(YStack, { "data-slot": "sidebar-nav", render: "nav", "aria-label": t('Products'),
|
|
644
648
|
// The nav takes what it needs; Recents below scrolls in what is left, and More stays under it.
|
|
645
|
-
shrink: 1, minH: 0, overflowY: "auto", overflowX: "hidden", pt: "$1.5", gap: "$1", "$platform-web": { scrollbarWidth: 'none' }, children:
|
|
649
|
+
shrink: 1, minH: 0, overflowY: "auto", overflowX: "hidden", pt: "$1.5", gap: "$1", "$platform-web": { scrollbarWidth: 'none' }, children: _jsxs(YStack, { "data-slot": "rail-pinned", gap: 1, width: "100%", borderBottomWidth: dropId === '__pinned_end__' ? 2 : 0, borderBottomColor: dropId === '__pinned_end__' ? 'var(--foreground)' : 'transparent', ...(!anon
|
|
646
650
|
? {
|
|
647
651
|
onDragOver: (e) => {
|
|
648
652
|
if (!dragId)
|
|
@@ -661,7 +665,7 @@ export function Sidebar({ pins, host, mode, thread, go, onShut, onSeek, onBack,
|
|
|
661
665
|
setDropId(null);
|
|
662
666
|
},
|
|
663
667
|
}
|
|
664
|
-
: null), children:
|
|
668
|
+
: null), children: [nav.pinnedEntries.length > 0 ? (_jsxs(YStack, { "data-slot": "nav-pins", role: "group", "aria-labelledby": `${uid}-pins`, gap: 1, width: "100%", pb: "$1.5", children: [_jsx(Text, { id: `${uid}-pins`, "data-slot": "nav-pins-head", paddingInlineStart: "$2.5", pb: 2, fontSize: "$1", fontWeight: "500", color: "$hint", numberOfLines: 1, children: t(PINNED) }), nav.pinnedEntries.map((item) => renderNavEntryWithSublinks(item, true))] })) : null, rest.map((item) => renderNavEntryWithSublinks(item, false))] }) })) : null, rail, showRecents ? _jsx(XStack, { height: 1, bg: "$edge", mx: "$1.5", my: "$2", shrink: 0 }) : null, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: "$2", mt: "$1.5", borderTopWidth: 1, borderColor: "$edge" })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$2", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : !showRecents ? (_jsx(YStack, { flex: 1, minH: 0 })) : mode === 'design' ? (made ? _jsx(Recents, { host: made, mode: "design", thread: null, onOpen: open, onNew: create }) : _jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), showMore ? (_jsx(YStack, { "data-slot": "rail-unpinned", shrink: 0, pt: "$1", width: "100%", children: _jsx(MoreMenu, { placement: "top-start", minWidth: 220, maxHeight: 420, entries: nav.moreEntries, onPin: togglePin, t: t, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "place-more", "aria-label": t('More'), "aria-haspopup": "menu", width: "100%", minW: 0, minH: 34, px: "$2.5", py: 0, gap: "$2.5", $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$3", borderWidth: 0, items: "center", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: 0.78, children: _jsx(MoreHorizontal, { size: 15, "aria-hidden": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", fontWeight: "400", color: "$aside", numberOfLines: 1, text: "start", children: t('More') })] }) }) })) : null, anon ? (_jsxs(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: "var(--z-raised)", children: [_jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", minH: 32, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, borderWidth: 0, bg: "transparent", cursor: "pointer", onClick: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Text, { fontSize: "$2", fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, text: "start", children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
|
|
665
669
|
if (typeof window !== 'undefined')
|
|
666
670
|
window.location.assign('/login?next=%2Fchat');
|
|
667
671
|
}, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.102",
|
|
4
4
|
"description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|