@hanzo/app 0.3.81 → 0.3.82
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 +2 -2
- package/dist/Recents.d.ts +1 -0
- package/dist/Recents.js +34 -9
- package/dist/Sidebar.d.ts +3 -1
- package/dist/Sidebar.js +7 -3
- package/dist/recent.d.ts +12 -1
- package/dist/recent.js +31 -0
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -348,7 +348,7 @@ function Window({ bar, betas }) {
|
|
|
348
348
|
};
|
|
349
349
|
window.addEventListener('mousemove', onMove);
|
|
350
350
|
window.addEventListener('mouseup', onUp);
|
|
351
|
-
} })) : null] }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage",
|
|
351
|
+
} })) : null] }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar, made: maker }) })), _jsxs(YStack, { "data-slot": "stage",
|
|
352
352
|
// A column: the phone's bar, then the panes taking the rest. Not a grid of `auto` and
|
|
353
353
|
// `1fr` rows: from md the bar is display none, which leaves the grid, so the panes were
|
|
354
354
|
// placed in the `auto` row and stood their content's height, and Dev's pane, which
|
|
@@ -360,7 +360,7 @@ function Window({ bar, betas }) {
|
|
|
360
360
|
if (typeof window !== 'undefined') {
|
|
361
361
|
window.dispatchEvent(new CustomEvent('hanzo:anon-settings', { detail: { open: false } }));
|
|
362
362
|
}
|
|
363
|
-
} }) })) : mode === 'chat' ? (_jsx(Split, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { 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, { 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, { 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, { 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, { 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, { 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, { 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: 5, 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' }, onPress: () => 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: 15, lineHeight: 20, 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: _jsxs(XStack, { flex: 1, minH: 0, children: [_jsx(YStack, { "data-slot": "drawer-rail", shrink: 0, pt: "calc(var(--pane-gap) + 8px)", $touchable: { pt: 'calc(var(--pane-gap) + 4px)' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar }) })] }) })), 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: () => {
|
|
363
|
+
} }) })) : mode === 'chat' ? (_jsx(Split, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { 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, { 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, { 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, { 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, { 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, { 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, { 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: 5, 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' }, onPress: () => 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: 15, lineHeight: 20, 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: _jsxs(XStack, { flex: 1, minH: 0, children: [_jsx(YStack, { "data-slot": "drawer-rail", shrink: 0, pt: "calc(var(--pane-gap) + 8px)", $touchable: { pt: 'calc(var(--pane-gap) + 4px)' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, 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: () => {
|
|
364
364
|
empty();
|
|
365
365
|
move(talk());
|
|
366
366
|
}, go: move })] }) }) }) }) }));
|
package/dist/Recents.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Host } from '@hanzo/build';
|
|
2
2
|
import { type Mode, type Recent } from './recent.js';
|
|
3
3
|
export declare function Recents({ host, mode, thread, onOpen, onNew, }: {
|
|
4
|
+
/** The mode's host: Design's is the one Studio is mounted with (App.tsx `maker`), whose path is Studio's. */
|
|
4
5
|
host: Host;
|
|
5
6
|
mode: Mode;
|
|
6
7
|
/** The Chat conversation the pane holds, or null. */
|
package/dist/Recents.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// The reader's Recents in the column's mode, and only that mode's: Chat lists its
|
|
4
4
|
// conversations (`/v1/agents/chat/conversations`, `useThreadList`), Dev its
|
|
5
|
-
// coding runs (`/v1/agent/sessions?kind=coding`, @hanzo/build `useSessions`)
|
|
5
|
+
// coding runs (`/v1/agent/sessions?kind=coding`, @hanzo/build `useSessions`),
|
|
6
|
+
// Design what Studio keeps of its conversations (@hanzo/studio `useRecent`). Each
|
|
6
7
|
// mode reads its own store. The menu beside the heading narrows, groups and sorts
|
|
7
8
|
// the list; the choice is kept per mode in this browser. Chat's rows share one
|
|
8
9
|
// menu (thread.tsx `ConversationMenu`): pinned ones list first, under Pinned,
|
|
@@ -12,15 +13,22 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
|
12
13
|
import { ScrollView, SizableText, XStack, YStack } from '@hanzo/gui';
|
|
13
14
|
import { CheckSquare, ChevronDown, ChevronRight, GitPullRequest, ListFilter } from 'lucide-react';
|
|
14
15
|
import { DOTS, route, useSessions } from '@hanzo/build';
|
|
16
|
+
import * as studio from '@hanzo/studio';
|
|
15
17
|
import { DropdownMenu } from '@hanzo/ui';
|
|
16
18
|
import { SidebarItem, StatusDot } from '@hanzo/ui/chat';
|
|
17
19
|
import { useKept } from './kept.js';
|
|
18
20
|
import { app } from './lib/host.js';
|
|
19
21
|
import { site } from './where.js';
|
|
20
|
-
import { ago, arrange, chats, hasUnreadUpdate, MENUS, PINNED, PLAIN, runs, SINCE, UNFILED, UNTITLED, UNTITLED_RUN, viewOf } from './recent.js';
|
|
22
|
+
import { ago, arrange, chats, designs, hasUnreadUpdate, MENUS, PINNED, PLAIN, runs, SINCE, UNFILED, UNTITLED, UNTITLED_RUN, viewOf } from './recent.js';
|
|
21
23
|
import { ConversationMenu, ThreadRow, useThreadList } from './thread.js';
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Studio's own read of Design's conversations (@hanzo/studio `useRecent`, from
|
|
26
|
+
* 0.1.11): this browser's store, shared with Studio's panes. An older Studio has
|
|
27
|
+
* none, and Design then lists nothing here, never Chat's.
|
|
28
|
+
*/
|
|
29
|
+
const useMade = studio.useRecent;
|
|
30
|
+
/** The menu's items: each section a heading and its options (recent.ts's phrases, drawn through `t`), the one in force checked; Select multiple where the rows carry a menu. */
|
|
31
|
+
function items(mode, view, set, t, select) {
|
|
24
32
|
const m = MENUS[mode];
|
|
25
33
|
const section = (key, label, options) => options.length
|
|
26
34
|
? [
|
|
@@ -36,6 +44,8 @@ function items(mode, view, set, t) {
|
|
|
36
44
|
: [];
|
|
37
45
|
const parts = [section('status', t('Status'), m.status), section('since', t('Last activity'), SINCE), section('group', t('Group by'), m.group), section('sort', t('Sort by'), m.sort)].filter((p) => p.length);
|
|
38
46
|
const base = parts.flatMap((p, i) => (i ? [{ type: 'separator', key: `sep-${i}` }, ...p] : p));
|
|
47
|
+
if (!select)
|
|
48
|
+
return base;
|
|
39
49
|
return [
|
|
40
50
|
...base,
|
|
41
51
|
{ type: 'separator', key: 'sep-select' },
|
|
@@ -53,7 +63,20 @@ const Note = ({ children }) => (_jsx(SizableText, { size: "$1", color: "$soft",
|
|
|
53
63
|
export function Recents({ host, mode, thread, onOpen, onNew, }) {
|
|
54
64
|
const [kept, keep] = useKept(`hanzo.recents.${mode}`, PLAIN);
|
|
55
65
|
const view = viewOf(mode, kept);
|
|
56
|
-
|
|
66
|
+
if (mode === 'chat')
|
|
67
|
+
return _jsx(Chats, { thread: thread, view: view, keep: keep, onOpen: onOpen, onNew: onNew });
|
|
68
|
+
if (mode === 'design')
|
|
69
|
+
return useMade ? _jsx(Designs, { host: host, view: view, keep: keep }) : _jsx(YStack, { flex: 1, minH: 0 });
|
|
70
|
+
return _jsx(Runs, { host: host, view: view, keep: keep, onOpen: onOpen });
|
|
71
|
+
}
|
|
72
|
+
/** Design's Recents: Studio's conversations, each opened in Design at its own address (@hanzo/studio `path`). */
|
|
73
|
+
function Designs({ host, view, keep }) {
|
|
74
|
+
const { rows: made, error } = useMade(host);
|
|
75
|
+
const rows = useMemo(() => designs(made), [made]);
|
|
76
|
+
const failed = useMemo(() => (error ? new Error(error) : null), [error]);
|
|
77
|
+
const at = studio.route(host.path);
|
|
78
|
+
const held = at.kind === 'chat' ? at.id : null;
|
|
79
|
+
return (_jsx(List, { mode: "design", rows: rows, view: view, keep: keep, open: (r) => r.id === held, reading: false, error: failed, onOpen: (r) => host.go(studio.path({ kind: 'chat', id: r.id })) }));
|
|
57
80
|
}
|
|
58
81
|
/** Chat's Recents: the conversation store alone, the archived ones when the view asks for them. */
|
|
59
82
|
function Chats({ thread, view, keep, onOpen, onNew, }) {
|
|
@@ -201,7 +224,9 @@ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, h
|
|
|
201
224
|
const isUnread = Boolean(r.kind === 'chat' && !open(r) && unreadIds?.has(r.id));
|
|
202
225
|
const age = ago(r.at, new Date(), t);
|
|
203
226
|
const when = age ? (_jsx(SizableText, { "data-slot": "row-age", fontSize: 12, lineHeight: 16, color: "var(--muted-foreground)", children: age })) : null;
|
|
204
|
-
|
|
227
|
+
// A Design conversation's dot is there while it works or when it failed; at rest it wears its age alone.
|
|
228
|
+
const settled = r.kind === 'design' && r.status === 'done';
|
|
229
|
+
const rowAside = r.kind === 'design' ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, settled ? null : _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : r.kind === 'dev' ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, r.pr ? _jsx(GitPullRequest, { size: 13, color: "var(--state-success)", "aria-hidden": true }) : null, _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : isUnread || when ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, isUnread ? (_jsx(XStack, { "data-slot": "thread-unread-dot", width: 6, height: 6, rounded: 999, bg: "var(--foreground)", "aria-hidden": true })) : null] })) : undefined;
|
|
205
230
|
const item = (_jsx(SidebarItem, { "data-kind": r.kind, active: open(r), rounded: 8, minH: 29, paddingInlineStart: "$2", paddingInlineEnd: one || rowAside ? 52 : '$2',
|
|
206
231
|
// A thumb's 44 on a touch screen; a conversation's ⋯ is a thumb wide there and always there: the title stops short of it.
|
|
207
232
|
$touchable: one ? { minH: 44, paddingInlineEnd: 52 } : { minH: 44 }, onKeyDown: (e) => {
|
|
@@ -215,15 +240,15 @@ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, h
|
|
|
215
240
|
return (_jsxs(YStack, { role: "listitem", position: "relative", children: [item, rowAside ? (_jsx(XStack, { position: "absolute", insetInlineEnd: "$2.5", t: 0, b: 0, items: "center", pointerEvents: "none", children: rowAside })) : null] }, r.id));
|
|
216
241
|
};
|
|
217
242
|
// The view menu stands at the end of the Recents heading: the target's own, quiet until the pointer is near.
|
|
218
|
-
const menu = (_jsx(DropdownMenu, { minWidth: 200, trigger: _jsx(XStack, { render: "button", "aria-label": t('Recents view'), width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: narrowed ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, bg: narrowed ? '$hover' : 'transparent', children: _jsx(ListFilter, { size: 14, "aria-hidden": true }) }), items: items(mode, view, keep, t) }));
|
|
243
|
+
const menu = (_jsx(DropdownMenu, { minWidth: 200, trigger: _jsx(XStack, { render: "button", "aria-label": t('Recents view'), width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: narrowed ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, bg: narrowed ? '$hover' : 'transparent', children: _jsx(ListFilter, { size: 14, "aria-hidden": true }) }), items: items(mode, view, keep, t, Boolean(threads)) }));
|
|
219
244
|
/** A section's heading: quiet 11.5px label, the Recents one carrying the count and the menu. */
|
|
220
|
-
const heading = (title, id, lead = false) => (_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 26, paddingInlineStart: "$2", paddingInlineEnd: "$1", mt: "$2.5", shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { id: id, fontSize: 11.5, lineHeight: 16, fontWeight: "500", color: "var(--muted-foreground)", children: title }), lead && running ? (_jsx(XStack, { "aria-label": t('{n} running', { n: running }), minW: 18, height: 18, px: "$1.5", rounded: 999, items: "center", justify: "center", bg: "$edge", borderWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", "aria-hidden": true, "data-i18n-ltr": true, children: String(running) }) })) : null] }), _jsxs(XStack, { items: "center", gap: 2, children: [lead && rows.length > 0 ? (_jsx(XStack, { render: "button", "aria-label": t('Select multiple'), ...{ title: t('Select multiple') }, width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, onPress: () => {
|
|
245
|
+
const heading = (title, id, lead = false) => (_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 26, paddingInlineStart: "$2", paddingInlineEnd: "$1", mt: "$2.5", shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { id: id, fontSize: 11.5, lineHeight: 16, fontWeight: "500", color: "var(--muted-foreground)", children: title }), lead && running ? (_jsx(XStack, { "aria-label": t('{n} running', { n: running }), minW: 18, height: 18, px: "$1.5", rounded: 999, items: "center", justify: "center", bg: "$edge", borderWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", "aria-hidden": true, "data-i18n-ltr": true, children: String(running) }) })) : null] }), _jsxs(XStack, { items: "center", gap: 2, children: [lead && threads && rows.length > 0 ? (_jsx(XStack, { render: "button", "aria-label": t('Select multiple'), ...{ title: t('Select multiple') }, width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, onPress: () => {
|
|
221
246
|
if (typeof window !== 'undefined')
|
|
222
247
|
window.dispatchEvent(new CustomEvent('hanzo:recents-select'));
|
|
223
248
|
}, children: _jsx(CheckSquare, { size: 13, "aria-hidden": true }) })) : null, lead ? menu : null] })] }));
|
|
224
249
|
const loose = groups.filter((g) => g.title !== PINNED);
|
|
225
250
|
const pinned = groups.find((g) => g.title === PINNED);
|
|
226
|
-
const note = reading ? (_jsx(Note, { children: t(mode === 'chat' ? 'Reading your chats…' : 'Reading your runs…') })) : error ? null : view.status === 'archived' ? (_jsx(Note, { children: t('No archived chats.') })) : narrowed ? (_jsx(Note, { children: t('Nothing in this view.') })) : (_jsx(Note, { children: t(mode === 'chat' ? 'No chats yet.' : 'No runs yet.') }));
|
|
251
|
+
const note = reading ? (_jsx(Note, { children: t(mode === 'chat' ? 'Reading your chats…' : 'Reading your runs…') })) : error ? null : view.status === 'archived' ? (_jsx(Note, { children: t('No archived chats.') })) : narrowed ? (_jsx(Note, { children: t('Nothing in this view.') })) : (_jsx(Note, { children: t(mode === 'chat' ? 'No chats yet.' : mode === 'design' ? 'Nothing made yet.' : 'No runs yet.') }));
|
|
227
252
|
// Each list of conversations holds its own menu (thread.tsx): the view menu
|
|
228
253
|
// in the Recents heading between them is a menu of its own, never inside one.
|
|
229
254
|
const menus = (rows, primary = true) => threads ? (_jsx(ConversationMenu, { threads: threads, active: held, onGone: onNew, customActions: customActions, hrefOf: hrefOf, primary: primary, children: _jsx(YStack, { children: rows }) })) : (rows);
|
package/dist/Sidebar.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function dispatchTabsAction(detail: {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
machine?: string;
|
|
9
9
|
}): void;
|
|
10
|
-
export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer, rail, foot, places, }: {
|
|
10
|
+
export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer, rail, foot, places, made, }: {
|
|
11
11
|
host: Host;
|
|
12
12
|
mode: Place['mode'];
|
|
13
13
|
/** The Chat conversation the pane holds, or null. */
|
|
@@ -32,6 +32,8 @@ export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack
|
|
|
32
32
|
label: string;
|
|
33
33
|
links: RailLink[];
|
|
34
34
|
}[];
|
|
35
|
+
/** The host Design is mounted with (App.tsx `maker`): where its conversations are read and opened. */
|
|
36
|
+
made?: Host;
|
|
35
37
|
}): import("react").JSX.Element;
|
|
36
38
|
export declare function AnonSettingsPane({ host, onClose, }: {
|
|
37
39
|
host: Host;
|
package/dist/Sidebar.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// The app's sidebar, beside the rail on the window's floor (App.tsx): the
|
|
4
4
|
// mode's name with the bell and the search at its end, New, Dev's places in
|
|
5
|
-
// Dev, the reader's Recents (Pinned first), and
|
|
5
|
+
// Dev, the reader's Recents (Pinned first) for Chat, Dev and Design (Design's
|
|
6
|
+
// own, through the host Studio is mounted with; Studio and Flow keep none to
|
|
7
|
+
// list), and the first-run cards. Which
|
|
6
8
|
// product it lists is the rail's to say; the account is at the rail's foot, or
|
|
7
9
|
// on a phone at the foot of its menu (Drawer.tsx), where this column is the menu.
|
|
8
10
|
//
|
|
@@ -253,7 +255,7 @@ function Activity({ host }) {
|
|
|
253
255
|
];
|
|
254
256
|
return (_jsx(DropdownMenu, { minWidth: 280, trigger: _jsx(XStack, { render: "button", "aria-label": t('Activity'), ...{ title: t('Activity') }, ...HEAD, items: "center", justify: "center", cursor: "pointer", opacity: 0.7, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(Bell, { size: 15, "aria-hidden": true }) }), items: items }));
|
|
255
257
|
}
|
|
256
|
-
export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer = false, rail, foot, places, }) {
|
|
258
|
+
export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer = false, rail, foot, places, made, }) {
|
|
257
259
|
const { t, dir } = useI18n();
|
|
258
260
|
const anon = host.person === null;
|
|
259
261
|
const free = useFree(Boolean(host.token?.())) || anon;
|
|
@@ -385,7 +387,9 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
385
387
|
if (typeof window !== 'undefined') {
|
|
386
388
|
window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
|
|
387
389
|
}
|
|
388
|
-
}), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", 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: g.links.map((link) => (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", 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: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' ||
|
|
390
|
+
}), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", 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: g.links.map((link) => (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", 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: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' || mode === 'studio' || mode === 'flow' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : mode === 'design' ? (
|
|
391
|
+
// Design's own conversations, read and opened through the host Studio is mounted with.
|
|
392
|
+
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 })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, 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: 12, lineHeight: 17, 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: () => {
|
|
389
393
|
if (typeof window !== 'undefined')
|
|
390
394
|
window.location.assign('/login?next=%2Fchat');
|
|
391
395
|
}, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
|
package/dist/recent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Say } from '@hanzo/i18n';
|
|
2
|
-
export type Mode = 'chat' | 'dev';
|
|
2
|
+
export type Mode = 'chat' | 'dev' | 'design';
|
|
3
3
|
export interface Recent {
|
|
4
4
|
kind: Mode;
|
|
5
5
|
id: string;
|
|
@@ -54,6 +54,17 @@ export declare function chats(threads: {
|
|
|
54
54
|
* seen yet.
|
|
55
55
|
*/
|
|
56
56
|
export declare function hasUnreadUpdate(rowId: string, updatedAt: string | number | undefined, activeId: string | null, seenAt: Record<string, number>): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Design's conversations as rows, as @hanzo/studio's `useRecent` lists them:
|
|
59
|
+
* one at work reads Running and one whose last turn failed Failed, as a run's
|
|
60
|
+
* would; `updated` is Unix milliseconds.
|
|
61
|
+
*/
|
|
62
|
+
export declare function designs(rows: {
|
|
63
|
+
id: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
updated?: number;
|
|
66
|
+
state?: string;
|
|
67
|
+
}[]): Recent[];
|
|
57
68
|
/** Dev's runs as rows. */
|
|
58
69
|
export declare function runs(sessions: {
|
|
59
70
|
id: string;
|
package/dist/recent.js
CHANGED
|
@@ -49,6 +49,18 @@ export const MENUS = {
|
|
|
49
49
|
{ id: 'title', label: phrase('Title') },
|
|
50
50
|
],
|
|
51
51
|
},
|
|
52
|
+
// Design's conversations (@hanzo/studio): no archive, and a state that is the last turn's, so no Status to narrow by.
|
|
53
|
+
design: {
|
|
54
|
+
status: [],
|
|
55
|
+
group: [
|
|
56
|
+
{ id: 'date', label: phrase('Date') },
|
|
57
|
+
{ id: 'none', label: phrase('None') },
|
|
58
|
+
],
|
|
59
|
+
sort: [
|
|
60
|
+
{ id: 'activity', label: phrase('Activity') },
|
|
61
|
+
{ id: 'title', label: phrase('Title') },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
52
64
|
};
|
|
53
65
|
/** A kept view as this mode may hold it: anything a menu does not offer reads as the plain view's. */
|
|
54
66
|
export function viewOf(mode, kept) {
|
|
@@ -88,6 +100,25 @@ export function hasUnreadUpdate(rowId, updatedAt, activeId, seenAt) {
|
|
|
88
100
|
const seen = seenAt[rowId];
|
|
89
101
|
return typeof seen === 'number' && stamp > seen;
|
|
90
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Design's conversations as rows, as @hanzo/studio's `useRecent` lists them:
|
|
105
|
+
* one at work reads Running and one whose last turn failed Failed, as a run's
|
|
106
|
+
* would; `updated` is Unix milliseconds.
|
|
107
|
+
*/
|
|
108
|
+
export function designs(rows) {
|
|
109
|
+
return rows.map((r) => {
|
|
110
|
+
const when = new Date(typeof r.updated === 'number' ? r.updated : Number.NaN);
|
|
111
|
+
const at = Number.isNaN(when.getTime()) ? '' : when.toISOString();
|
|
112
|
+
return {
|
|
113
|
+
kind: 'design',
|
|
114
|
+
id: r.id,
|
|
115
|
+
title: r.title || UNTITLED,
|
|
116
|
+
at,
|
|
117
|
+
began: at,
|
|
118
|
+
status: r.state === 'making' ? 'running' : r.state === 'failed' ? 'error' : 'done',
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}
|
|
91
122
|
/** Dev's runs as rows. */
|
|
92
123
|
export function runs(sessions) {
|
|
93
124
|
return sessions.map((r) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.82",
|
|
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",
|