@hanzo/app 0.3.94 → 0.3.95
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/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +113 -47
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.js +210 -151
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.js +18 -13
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +6 -2
- package/dist/bots/kit.d.ts +1 -0
- package/dist/bots/kit.js +1 -1
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +6 -0
- package/dist/lib/todo.js +37 -25
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/Contacts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// The directory: who is in this org, and who you can put in a conversation.
|
|
4
4
|
//
|
|
5
5
|
// IT IS A LIST OF SUBJECTS AND NOTHING ELSE. People, the org's agents, and the
|
|
@@ -35,9 +35,10 @@ import { phrase } from '@hanzo/i18n';
|
|
|
35
35
|
import { useI18n } from '@hanzo/i18n/react';
|
|
36
36
|
import { useHost } from './host.js';
|
|
37
37
|
import { Check, Plus, Search, UserPlus } from 'lucide-react';
|
|
38
|
-
import { Box, Text, XStack, YStack } from '@hanzo/ui';
|
|
38
|
+
import { Box, Button, Text, XStack, YStack } from '@hanzo/ui';
|
|
39
39
|
import { useAi, useModels, usePeople, useThreads } from '@hanzo/ai/react';
|
|
40
40
|
import { useIam, useOrganizations } from '@hanzo/iam/react';
|
|
41
|
+
import { enter as enterSignIn, LOGIN } from './lib/destination.js';
|
|
41
42
|
import { hasSession } from './lib/session.js';
|
|
42
43
|
import { useHydrated } from './lib/hydrated.js';
|
|
43
44
|
import { ENSO, served } from './lib/ai.js';
|
|
@@ -50,11 +51,12 @@ import { called } from './team.js';
|
|
|
50
51
|
import { say } from './failure.js';
|
|
51
52
|
import { openThread } from './open.js';
|
|
52
53
|
import { spokenAt, start } from "./conversations.js";
|
|
54
|
+
import { useDevMode } from "./lib/dev-mode.js";
|
|
53
55
|
const TABS = [
|
|
54
56
|
{ id: 'all', label: phrase('All') },
|
|
55
57
|
{ id: 'person', label: phrase('People') },
|
|
56
58
|
{ id: 'agent', label: phrase('Agents') },
|
|
57
|
-
{ id: 'preset', label: phrase('
|
|
59
|
+
{ id: 'preset', label: phrase('Starter agents') },
|
|
58
60
|
];
|
|
59
61
|
export function Contacts() {
|
|
60
62
|
const { t } = useI18n();
|
|
@@ -67,20 +69,21 @@ export function Contacts() {
|
|
|
67
69
|
// they are signed out for a frame.
|
|
68
70
|
if (!hydrated)
|
|
69
71
|
return _jsx(Alone, { children: "\u00A0" });
|
|
70
|
-
if (!signedIn)
|
|
71
|
-
return _jsx(Alone, { children: t('Sign in to see who is in your organization.') });
|
|
72
|
+
if (!signedIn) {
|
|
73
|
+
return (_jsx(Alone, { action: _jsx(Button, { size: "sm", variant: "primary", rounded: "$3", minH: 36, "$max-sm": { minH: 44 }, mt: "$2", onClick: () => enterSignIn(LOGIN), children: t('Sign in') }), children: t('Sign in to see who is in your organization.') }));
|
|
74
|
+
}
|
|
72
75
|
if (!currentOrgId)
|
|
73
76
|
return _jsx(Alone, { children: t('This account is not in an organization yet.') });
|
|
74
77
|
return _jsx(Roster, { owner: currentOrgId });
|
|
75
78
|
}
|
|
76
79
|
/** The app's one heading, for every state that has nothing to list. */
|
|
77
|
-
function Alone({ children }) {
|
|
80
|
+
function Alone({ children, action }) {
|
|
78
81
|
const { t } = useI18n();
|
|
79
|
-
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center",
|
|
82
|
+
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", px: "$6", pt: "$6", pb: "$12", "$max-sm": { px: '$4', pb: '$8' }, gap: "$1.5", children: [_jsx(Text, { render: "h1", m: 0, fontSize: "$6", fontWeight: "600", letterSpacing: -0.34, color: "$ink", text: "center", children: t('Contacts') }), _jsx(Text, { fontSize: "$3", color: "$soft", maxW: 460, lineHeight: "$4", text: "center", children: children }), action] }));
|
|
80
83
|
}
|
|
81
84
|
/** A read that answered no, said once, above whatever else is on screen. */
|
|
82
|
-
function Note({ children }) {
|
|
83
|
-
return (_jsx(
|
|
85
|
+
function Note({ children, error }) {
|
|
86
|
+
return (_jsx(YStack, { width: "100%", maxW: 960, mx: "auto", px: "$4", "$max-sm": { px: '$3' }, py: "$2", children: _jsx(Text, { role: error ? 'alert' : undefined, fontSize: "$2", color: error ? 'var(--state-error)' : '$soft', children: children }) }));
|
|
84
87
|
}
|
|
85
88
|
/**
|
|
86
89
|
* The directory itself.
|
|
@@ -90,6 +93,7 @@ function Note({ children }) {
|
|
|
90
93
|
*/
|
|
91
94
|
function Roster({ owner }) {
|
|
92
95
|
const { t } = useI18n();
|
|
96
|
+
const [devMode] = useDevMode();
|
|
93
97
|
const ai = useAi();
|
|
94
98
|
const { router } = useHost();
|
|
95
99
|
const { people, loading: reading, error: unread } = usePeople({ owner, service: false });
|
|
@@ -149,14 +153,12 @@ function Roster({ owner }) {
|
|
|
149
153
|
kind: 'agent',
|
|
150
154
|
name: one.name,
|
|
151
155
|
label: called(one.name),
|
|
152
|
-
note: one.description || one.model || '',
|
|
156
|
+
note: one.description || (devMode ? one.model : '') || '',
|
|
153
157
|
avatar: one.avatar,
|
|
154
158
|
emoji: one.emoji,
|
|
155
159
|
at: spokenAt(threads, one.name),
|
|
156
160
|
});
|
|
157
161
|
}
|
|
158
|
-
// A preset the org has already installed IS the agent above it. Drawing
|
|
159
|
-
// both would offer to install what is already here.
|
|
160
162
|
for (const one of presets ?? []) {
|
|
161
163
|
if (agents.some((made) => made.name === one.id))
|
|
162
164
|
continue;
|
|
@@ -165,12 +167,12 @@ function Roster({ owner }) {
|
|
|
165
167
|
kind: 'preset',
|
|
166
168
|
name: one.id,
|
|
167
169
|
label: one.title || one.id,
|
|
168
|
-
note: t('
|
|
170
|
+
note: t('Starter agent'),
|
|
169
171
|
at: 0,
|
|
170
172
|
});
|
|
171
173
|
}
|
|
172
174
|
return rows;
|
|
173
|
-
}, [people, agents, presets, threads, t]);
|
|
175
|
+
}, [people, agents, presets, threads, devMode, t]);
|
|
174
176
|
const shown = useMemo(() => {
|
|
175
177
|
const q = look.trim().toLowerCase();
|
|
176
178
|
return entries
|
|
@@ -233,30 +235,32 @@ function Roster({ owner }) {
|
|
|
233
235
|
}
|
|
234
236
|
}, [ai, busy, entries, picked, router]);
|
|
235
237
|
const waiting = (reading && people.length === 0) || (gathering && agents.length === 0);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
?
|
|
246
|
-
:
|
|
238
|
+
const hasEmptyPrimary = !waiting && shown.length === 0 && !look.trim() && tab !== 'preset';
|
|
239
|
+
const headerPrimary = picked.length === 0 && !hasEmptyPrimary;
|
|
240
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, minW: 0, overflow: "hidden", children: [_jsx(YStack, { shrink: 0, borderBottomWidth: 1, borderColor: "$edge", children: _jsxs(XStack, { width: "100%", maxW: 960, mx: "auto", minH: 56, items: "center", flexWrap: "wrap", gap: "$3", px: "$4", py: "$2.5", "$max-sm": { px: '$3' }, children: [_jsx(Text, { render: "h1", m: 0, flex: 1, minW: 120, fontSize: "$6", fontWeight: "600", letterSpacing: -0.34, color: "$ink", numberOfLines: 1, children: t('Contacts') }), _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Control, { onPress: () => setInviting(true), icon: _jsx(UserPlus, { size: 13, "aria-hidden": true }), children: t('Invite') }), _jsx(Control, { onPress: () => setHiring(true), icon: _jsx(Plus, { size: 13, "aria-hidden": true }), strong: headerPrimary, children: t('New agent') })] })] }) }), _jsx(YStack, { shrink: 0, borderBottomWidth: 1, borderColor: "$edge", children: _jsxs(XStack, { width: "100%", maxW: 960, mx: "auto", items: "center", gap: "$3", px: "$4", py: "$2.5", "$max-sm": { px: '$3', gap: '$2' }, flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 180, minH: 36, px: "$2.5", bg: "$panel", borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$3", focusWithinStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minW: '100%', minH: 44 }, children: [_jsx(Search, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { render: _jsx("input", { value: look, onChange: (e) => setLook(e.target.value), placeholder: t('Search'), "aria-label": t('Search contacts') }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "$ink", fontSize: "$2", px: 0, py: 6 })] }), _jsxs(XStack, { items: "center", gap: "$3", flexWrap: "wrap", children: [_jsx(XStack, { items: "center", gap: "$1.5", flexWrap: "wrap", children: TABS.map((one) => (_jsx(Pill, { on: tab === one.id, onPress: () => setTab(one.id), children: t(one.label) }, one.id))) }), _jsx(Box, { display: "none", $sm: { display: 'flex' }, width: 1, height: 18, bg: "$edge" }), _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Pill, { on: order === 'name', onPress: () => setOrder('name'), children: t('A–Z') }), _jsx(Pill, { on: order === 'recent', onPress: () => setOrder('recent'), children: t('Recent') })] })] })] }) }), unread ? _jsx(Note, { error: true, children: say(unread, t('your organization'), 'read', t) }) : null, ungathered ? _jsx(Note, { error: true, children: say(ungathered, t("this org's agents"), 'read', t) }) : null, unlisted ? _jsx(Note, { error: true, children: say(unlisted, t('starter agents'), 'read', t) }) : null, wrong ? _jsx(Note, { error: true, children: wrong }) : null, _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: waiting && shown.length === 0 ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", pt: "$6", pb: "$12", px: "$4", children: _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Loading contacts…') }) })) : shown.length === 0 ? (_jsxs(YStack, { flex: 1, items: "center", justify: "center", pt: "$6", pb: "$12", "$max-sm": { pb: '$8' }, px: "$4", gap: "$4", children: [_jsx(Text, { fontSize: "$3", color: "$soft", text: "center", maxW: 420, lineHeight: "$4", children: look.trim()
|
|
241
|
+
? t('Nobody here matches “{query}”.', { query: look.trim() })
|
|
242
|
+
: tab === 'agent'
|
|
243
|
+
? t('No agents yet. Create one to start working together.')
|
|
244
|
+
: tab === 'preset'
|
|
245
|
+
? t('Every starter agent is already installed.')
|
|
246
|
+
: t('Just you so far. Invite a teammate or add an agent.') }), look.trim() ? (_jsx(Control, { onPress: () => setLook(''), children: t('Clear search') })) : tab === 'agent' ? (_jsx(Control, { onPress: () => setHiring(true), strong: true, children: t('New agent') })) : tab !== 'preset' ? (_jsx(Control, { onPress: () => setInviting(true), strong: true, children: t('Invite') })) : null] })) : (_jsx(YStack, { width: "100%", maxW: 960, mx: "auto", children: shown.map((one) => (_jsx(Row, { one: one, on: picked.includes(one.key), busy: busy === one.key, onPress: () => one.kind === 'preset'
|
|
247
|
+
? void install(one)
|
|
248
|
+
: setPicked((was) => was.includes(one.key)
|
|
249
|
+
? was.filter((k) => k !== one.key)
|
|
250
|
+
: [...was, one.key]) }, one.key))) })) }), picked.length > 0 ? (_jsx(YStack, { shrink: 0, bg: "$panel", borderTopWidth: 1, borderColor: "$edge", children: _jsxs(XStack, { width: "100%", maxW: 960, mx: "auto", items: "center", flexWrap: "wrap", gap: "$2", px: "$4", py: "$3", "$max-sm": { px: '$3' }, children: [_jsx(Text, { flex: 1, minW: 100, fontSize: "$2", color: "$soft", numberOfLines: 1, children: picked.length === 1 ? t('1 selected') : t('{n} selected', { n: picked.length }) }), _jsx(Control, { onPress: () => setPicked([]), children: t('Clear') }), _jsx(Control, { onPress: () => void enter(), strong: true, children: t(busy === 'conversation' ? 'Opening…' : 'Start conversation') })] }) })) : null, inviting ? _jsx(Invite, { owner: owner, onClose: () => setInviting(false) }) : null, hiring ? _jsx(Hire, { onClose: () => setHiring(false), onMade: () => setHiring(false) }) : null] }));
|
|
247
251
|
}
|
|
248
252
|
/** One row: a face, a name, a line about them, and what pressing it does. */
|
|
249
253
|
function Row({ one, on, busy, onPress, }) {
|
|
250
254
|
const { t } = useI18n();
|
|
251
|
-
return (_jsx(Box, { render: "button", onClick: onPress, "aria-label": one.label, "aria-pressed": one.kind === 'preset' ? undefined : on, width: "100%", display: "block", cursor: "pointer", borderWidth: 0, borderBottomWidth: 1, borderBottomColor: "
|
|
255
|
+
return (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: onPress, "aria-label": one.label, "aria-pressed": one.kind === 'preset' ? undefined : on, width: "100%", display: "block", cursor: "pointer", borderWidth: 0, borderBottomWidth: 1, borderBottomColor: "$edge", bg: on ? '$raised' : 'transparent', transition: "quickest", hoverStyle: { bg: on ? '$raised' : '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)', outlineOffset: -2 }, "$max-sm": { minH: 56 }, children: _jsxs(XStack, { gap: "$3", items: "center", px: "$4", py: "$3", "$max-sm": { px: '$3' }, children: [_jsx(Face, { src: one.avatar, emoji: one.emoji, name: one.name, size: 34 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, text: "start", children: one.label }), one.note ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, text: "start", children: one.note })) : null] }), one.kind === 'preset' ? (_jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$aside", shrink: 0, children: t(busy ? 'Installing…' : 'Install') })) : on ? (_jsx(Check, { size: 15, color: "var(--foreground)", "aria-hidden": true })) : null] }) }));
|
|
252
256
|
}
|
|
253
257
|
/** A named control. One shape for every button in this app. */
|
|
254
258
|
function Control({ children, onPress, icon, strong, }) {
|
|
255
|
-
return (_jsx(Box, { render: "button", onClick: onPress, px: "$3", py: "$
|
|
259
|
+
return (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: onPress, display: "inline-flex", items: "center", justify: "center", minH: 36, px: "$3.5", py: "$1.5", rounded: "$3", borderWidth: 1, borderColor: strong ? '$ink' : 'var(--border-strong)', bg: strong ? '$ink' : 'transparent', "$platform-web": { color: strong ? 'var(--background)' : 'var(--foreground)' }, transition: "quickest", hoverStyle: { bg: strong ? '$ink' : '$hover', opacity: strong ? 0.9 : 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minH: 44 }, cursor: "pointer", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [icon ? (_jsx(Text, { display: "inline-flex", items: "center", color: strong ? '$background' : '$ink', children: icon })) : null, _jsx(Text, { fontSize: "$2", color: strong ? '$background' : '$ink', fontWeight: strong ? '600' : '500', numberOfLines: 1, children: children })] }) }));
|
|
256
260
|
}
|
|
257
261
|
/** A switch that is on or off — a tab, an order. Same shape, so they read alike. */
|
|
258
262
|
function Pill({ children, on, onPress, }) {
|
|
259
|
-
return (_jsx(Box, { render: "button", onClick: onPress, "aria-pressed": on, px: "$2.5", py: "$1
|
|
263
|
+
return (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: onPress, "aria-pressed": on, display: "inline-flex", items: "center", justify: "center", minH: 32, px: "$2.5", py: "$1", rounded: "$3", borderWidth: 1, borderColor: on ? '$ink' : 'var(--border-strong)', bg: on ? '$raised' : 'transparent', transition: "quickest", hoverStyle: { bg: on ? '$raised' : '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minH: 44 }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: on ? '500' : '400', color: on ? '$ink' : '$soft', numberOfLines: 1, children: children }) }));
|
|
260
264
|
}
|
|
261
265
|
/**
|
|
262
266
|
* ADDING A PERSON IS AN INVITATION, and it is the only honest shape for it.
|
|
@@ -300,11 +304,11 @@ function Invite({ owner, onClose }) {
|
|
|
300
304
|
setBusy(false);
|
|
301
305
|
}
|
|
302
306
|
};
|
|
303
|
-
return (_jsx(Box, { position: "fixed", inset: 0, z: "var(--z-modal)", display: "flex", items: "center", justify: "center", p: "$
|
|
307
|
+
return (_jsx(Box, { position: "fixed", inset: 0, z: "var(--z-modal)", display: "flex", items: "center", justify: "center", p: "$3", bg: "var(--surface-scrim)", onClick: (e) => {
|
|
304
308
|
if (e.target === e.currentTarget)
|
|
305
309
|
onClose();
|
|
306
|
-
}, children: _jsxs(YStack, { role: "dialog", "aria-label": t('Invite'), width: "
|
|
310
|
+
}, children: _jsxs(YStack, { role: "dialog", "aria-modal": true, "aria-label": t('Invite'), width: "calc(100vw - 24px)", maxW: 440, gap: "$4", p: "$5", "$max-sm": { p: '$4' }, rounded: "$6", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$background", boxShadow: "var(--shadow-lg)", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", letterSpacing: -0.34, color: "$ink", children: t('Invite') }), link ? (_jsx(Text, { fontSize: "$2", color: "$soft", lineHeight: "$3", children: t('Share this one-time link to invite someone to {owner}.', { owner }) })) : (_jsx(Text, { fontSize: "$2", color: "$soft", lineHeight: "$3", children: t('Create a one-time invitation link for {owner}.', { owner }) }))] }), link ? (_jsxs(XStack, { items: "center", gap: "$2", minW: 0, p: "$2.5", rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: "$edge", children: [_jsx(Text, { "data-i18n-ltr": true, flex: 1, minW: 0, fontFamily: "$mono", fontSize: "$2", color: "$ink", numberOfLines: 1, children: link }), _jsx(Take, { text: link, says: t('the invitation link'), label: t('Copy') })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsx(Text, { render: _jsx("input", { value: email, onChange: (e) => setEmail(e.target.value), onKeyDown: (e) => {
|
|
307
311
|
if (e.key === 'Enter')
|
|
308
312
|
void make();
|
|
309
|
-
}, placeholder: t('Their email — or leave it open to anyone with the link'), "aria-label": t('Email'), autoFocus: true }), width: "100%", bg: "
|
|
313
|
+
}, placeholder: t('Their email — or leave it open to anyone with the link'), "aria-label": t('Email'), autoFocus: true }), width: "100%", minH: 38, bg: "$panel", borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$3", px: 12, py: 8, "$max-sm": { minH: 44 }, outlineStyle: "none", focusStyle: { borderColor: 'var(--ring)' }, color: "$ink", fontSize: "$2" }), wrong ? (_jsx(Text, { role: "alert", fontSize: "$2", color: "var(--state-error)", children: wrong })) : null] })), _jsxs(XStack, { justify: "flex-end", gap: "$2", pt: "$1", flexWrap: "wrap", children: [_jsx(Control, { onPress: onClose, children: t(link ? 'Done' : 'Cancel') }), link ? null : (_jsx(Control, { onPress: () => void make(), strong: true, children: t(busy ? 'Creating…' : 'Create invite link') }))] })] }) }));
|
|
310
314
|
}
|
package/dist/ContextMenu.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useI18n } from '@hanzo/i18n/react';
|
|
5
|
-
import { SizableText, Text, XStack, YStack } from '@hanzo/gui';
|
|
5
|
+
import { SizableText, Text, View, XStack, YStack } from '@hanzo/gui';
|
|
6
6
|
import { toast } from '@hanzo/ui';
|
|
7
|
-
import { Archive, CheckSquare, Clock, Code2, Copy, ExternalLink, FolderGit2, GitBranch, Globe, Link2, MessageSquare, Moon, PanelLeft, Pencil, Pin, Play, Plus, RotateCcw, Search, Settings, Share2, Sparkles, SquarePen, SquareTerminal, Sun, Trash2, Volume2, WandSparkles, } from 'lucide-react';
|
|
8
|
-
import { app, design, settings, studio, talk, TERMINALS } from './lib/host.js';
|
|
7
|
+
import { Archive, ArchiveRestore, CheckSquare, Clock, Code2, Copy, ExternalLink, FolderGit2, GitBranch, Globe, Link2, MessageSquare, Moon, PanelLeft, Pencil, Pin, PinOff, Play, Plus, RotateCcw, Search, Settings, Share2, Sparkles, SquarePen, SquareTerminal, Sun, Trash2, Volume2, WandSparkles, } from 'lucide-react';
|
|
8
|
+
import { app, design, flow, settings, studio, talk, TERMINALS } from './lib/host.js';
|
|
9
|
+
import { rememberSettingsReturn } from './lib/dev-mode.js';
|
|
10
|
+
import { useOpen } from './open.js';
|
|
11
|
+
import { usePinnedNav } from './Rail.js';
|
|
9
12
|
import { site } from './where.js';
|
|
13
|
+
const SAFE_BOTTOM = 'calc(12px + env(safe-area-inset-bottom, 0px))';
|
|
14
|
+
const FOCUS_RING = { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' };
|
|
10
15
|
const isMac = () => typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);
|
|
11
16
|
const fullUrl = (path) => {
|
|
12
17
|
if (/^https?:\/\//.test(path))
|
|
@@ -18,11 +23,11 @@ const placePath = (id, mode) => {
|
|
|
18
23
|
case 'new':
|
|
19
24
|
return mode === 'dev' ? app('') : mode === 'design' ? design('') : mode === 'studio' ? studio('') : talk();
|
|
20
25
|
case 'projects':
|
|
21
|
-
return app('projects');
|
|
26
|
+
return app('-/projects');
|
|
22
27
|
case 'issues':
|
|
23
|
-
return app('issues');
|
|
28
|
+
return app('-/issues');
|
|
24
29
|
case 'templates':
|
|
25
|
-
return app('templates');
|
|
30
|
+
return app('-/templates');
|
|
26
31
|
case 'agents':
|
|
27
32
|
return app('-/customize/agents');
|
|
28
33
|
case 'bots':
|
|
@@ -54,6 +59,9 @@ const railPath = (slot) => {
|
|
|
54
59
|
case 'rail-studio':
|
|
55
60
|
case 'place-studio':
|
|
56
61
|
return studio('');
|
|
62
|
+
case 'rail-flow':
|
|
63
|
+
case 'place-flow':
|
|
64
|
+
return flow('');
|
|
57
65
|
case 'rail-tabs':
|
|
58
66
|
case 'place-tabs':
|
|
59
67
|
return TERMINALS;
|
|
@@ -75,9 +83,28 @@ const railPath = (slot) => {
|
|
|
75
83
|
};
|
|
76
84
|
export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, onNewChat, go, }) {
|
|
77
85
|
const { t } = useI18n();
|
|
86
|
+
const { thread: activeThread } = useOpen();
|
|
78
87
|
const [state, setState] = useState(null);
|
|
88
|
+
const [compact, setCompact] = useState(() => typeof window !== 'undefined' ? window.innerWidth < 640 : false);
|
|
79
89
|
const panelRef = useRef(null);
|
|
90
|
+
const openerRef = useRef(null);
|
|
80
91
|
const apple = isMac();
|
|
92
|
+
const [pins, togglePin] = usePinnedNav();
|
|
93
|
+
const closeMenu = useCallback((restoreFocus = false) => {
|
|
94
|
+
setState(null);
|
|
95
|
+
if (restoreFocus) {
|
|
96
|
+
queueMicrotask(() => openerRef.current?.focus?.());
|
|
97
|
+
}
|
|
98
|
+
}, []);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
101
|
+
return;
|
|
102
|
+
const mq = window.matchMedia('(max-width: 639px)');
|
|
103
|
+
const sync = () => setCompact(mq.matches);
|
|
104
|
+
sync();
|
|
105
|
+
mq.addEventListener?.('change', sync);
|
|
106
|
+
return () => mq.removeEventListener?.('change', sync);
|
|
107
|
+
}, []);
|
|
81
108
|
const copyLink = async (path) => {
|
|
82
109
|
try {
|
|
83
110
|
await navigator.clipboard.writeText(fullUrl(path));
|
|
@@ -100,8 +127,10 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
100
127
|
const windowRoot = target.closest('[data-slot="window"]');
|
|
101
128
|
if (!windowRoot)
|
|
102
129
|
return;
|
|
103
|
-
// Let ConversationMenu handle [data-thread] rows, and never override native menu in inputs, SVGs, or active text selections
|
|
104
|
-
if (target.closest('[data-thread], [role="menu"], [role="dialog"]
|
|
130
|
+
// Let ConversationMenu handle [data-thread] rows, and never override native menu in inputs, standalone SVGs, or active text selections
|
|
131
|
+
if (target.closest('[data-thread], [role="menu"], [role="dialog"]'))
|
|
132
|
+
return;
|
|
133
|
+
if (target.closest('svg') && !target.closest('button, a, [role="button"], [data-slot^="rail-"], [data-place-id], [data-project]'))
|
|
105
134
|
return;
|
|
106
135
|
const htmlEl = target;
|
|
107
136
|
if (htmlEl.isContentEditable ||
|
|
@@ -158,6 +187,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
158
187
|
if (placeEl) {
|
|
159
188
|
const slot = placeEl.getAttribute('data-slot') ?? '';
|
|
160
189
|
const placeId = placeEl.getAttribute('data-place-id') ?? (slot === 'app-new' ? 'new' : '');
|
|
190
|
+
const pinTargetId = placeId && placeId !== 'new' ? placeId : slot.startsWith('place-') && slot !== 'place-more' && slot !== 'place-back' && slot !== 'place-name' ? slot.slice('place-'.length) : '';
|
|
161
191
|
const label = placeEl.textContent?.trim() || placeEl.getAttribute('aria-label') || t('Open');
|
|
162
192
|
const routeTo = placeId ? placePath(placeId, mode) : railPath(slot);
|
|
163
193
|
title = label;
|
|
@@ -167,6 +197,17 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
167
197
|
icon: _jsx(FolderGit2, { size: 15, "aria-hidden": true }),
|
|
168
198
|
run: () => placeEl.click(),
|
|
169
199
|
});
|
|
200
|
+
if (pinTargetId) {
|
|
201
|
+
const pinned = pins.includes(pinTargetId);
|
|
202
|
+
entries.push({
|
|
203
|
+
key: 'place-pin',
|
|
204
|
+
label: pinned ? t('Unpin') : t('Pin to top'),
|
|
205
|
+
icon: pinned ? _jsx(PinOff, { size: 15, "aria-hidden": true }) : _jsx(Pin, { size: 15, "aria-hidden": true }),
|
|
206
|
+
run: () => {
|
|
207
|
+
togglePin(pinTargetId);
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
}
|
|
170
211
|
if (routeTo) {
|
|
171
212
|
entries.push({
|
|
172
213
|
key: 'place-tab',
|
|
@@ -187,7 +228,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
187
228
|
run: () => window.dispatchEvent(new CustomEvent('hanzo:recents-select')),
|
|
188
229
|
}, {
|
|
189
230
|
key: 'place-search',
|
|
190
|
-
label: t('Search &
|
|
231
|
+
label: t('Search & commands…'),
|
|
191
232
|
icon: _jsx(Search, { size: 15, "aria-hidden": true }),
|
|
192
233
|
shortcut: apple ? '⌘K' : 'Ctrl+K',
|
|
193
234
|
run: onSeek,
|
|
@@ -203,7 +244,9 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
203
244
|
if (!entries.length) {
|
|
204
245
|
const railEl = target.closest('[data-slot^="rail-"]');
|
|
205
246
|
const slot = railEl?.getAttribute('data-slot') ?? '';
|
|
206
|
-
|
|
247
|
+
const ignoredSlots = new Set(['rail', 'rail-marks', 'rail-more', 'rail-pinned', 'rail-unpinned', 'rail-fold-toggle', 'rail-item-options', 'rail-expand', 'rail-new']);
|
|
248
|
+
if (railEl && slot && !ignoredSlots.has(slot)) {
|
|
249
|
+
const navId = railEl.getAttribute('data-nav-id') ?? slot.replace(/^rail-/, '');
|
|
207
250
|
const label = railEl.getAttribute('aria-label') || t('Open');
|
|
208
251
|
const routeTo = railPath(slot);
|
|
209
252
|
title = label;
|
|
@@ -213,6 +256,17 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
213
256
|
icon: _jsx(ExternalLink, { size: 15, "aria-hidden": true }),
|
|
214
257
|
run: () => railEl.click(),
|
|
215
258
|
});
|
|
259
|
+
if (navId && !navId.startsWith('anon-')) {
|
|
260
|
+
const pinned = pins.includes(navId);
|
|
261
|
+
entries.push({
|
|
262
|
+
key: 'rail-pin',
|
|
263
|
+
label: pinned ? t('Unpin') : t('Pin to top'),
|
|
264
|
+
icon: pinned ? _jsx(PinOff, { size: 15, "aria-hidden": true }) : _jsx(Pin, { size: 15, "aria-hidden": true }),
|
|
265
|
+
run: () => {
|
|
266
|
+
togglePin(navId);
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
}
|
|
216
270
|
if (routeTo) {
|
|
217
271
|
entries.push({
|
|
218
272
|
key: 'rail-tab',
|
|
@@ -236,7 +290,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
236
290
|
key: 'rail-dev-projects',
|
|
237
291
|
label: t('Projects'),
|
|
238
292
|
icon: _jsx(FolderGit2, { size: 15, "aria-hidden": true }),
|
|
239
|
-
run: () => go(app('projects')),
|
|
293
|
+
run: () => go(app('-/projects')),
|
|
240
294
|
});
|
|
241
295
|
}
|
|
242
296
|
else if (slot === 'rail-chat') {
|
|
@@ -275,13 +329,13 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
275
329
|
run: () => window.dispatchEvent(new CustomEvent('hanzo:recents-select')),
|
|
276
330
|
}, {
|
|
277
331
|
key: 'sidebar-select-all',
|
|
278
|
-
label: t('Select
|
|
332
|
+
label: t('Select all'),
|
|
279
333
|
icon: _jsx(CheckSquare, { size: 15, "aria-hidden": true }),
|
|
280
334
|
shortcut: apple ? '⌘A' : 'Ctrl+A',
|
|
281
335
|
run: () => window.dispatchEvent(new CustomEvent('hanzo:recents-select', { detail: { mode: 'all' } })),
|
|
282
336
|
}, {
|
|
283
337
|
key: 'sidebar-search',
|
|
284
|
-
label: t('Search &
|
|
338
|
+
label: t('Search & commands…'),
|
|
285
339
|
icon: _jsx(Search, { size: 15, "aria-hidden": true }),
|
|
286
340
|
shortcut: apple ? '⌘K' : 'Ctrl+K',
|
|
287
341
|
run: onSeek,
|
|
@@ -289,7 +343,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
289
343
|
key: 'sidebar-projects',
|
|
290
344
|
label: t('Projects'),
|
|
291
345
|
icon: _jsx(FolderGit2, { size: 15, "aria-hidden": true }),
|
|
292
|
-
run: () => go(app('projects')),
|
|
346
|
+
run: () => go(app('-/projects')),
|
|
293
347
|
}, {
|
|
294
348
|
key: 'sidebar-shut',
|
|
295
349
|
label: t('Close sidebar'),
|
|
@@ -376,6 +430,18 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
376
430
|
run: () => dispatchChat('copy'),
|
|
377
431
|
}, { key: 'sep-turn-q', line: true });
|
|
378
432
|
}
|
|
433
|
+
const activeId = activeThread ||
|
|
434
|
+
(window.location.pathname.startsWith('/chat/')
|
|
435
|
+
? decodeURIComponent(window.location.pathname.slice('/chat/'.length))
|
|
436
|
+
: '');
|
|
437
|
+
const activeRow = activeId && typeof CSS !== 'undefined' && typeof CSS.escape === 'function'
|
|
438
|
+
? document.querySelector(`[data-thread="${CSS.escape(activeId)}"]`)
|
|
439
|
+
: activeId
|
|
440
|
+
? Array.from(document.querySelectorAll('[data-thread]')).find((el) => el.getAttribute('data-thread') === activeId) ?? null
|
|
441
|
+
: null;
|
|
442
|
+
const isPinned = Boolean(activeRow?.hasAttribute('data-pinned'));
|
|
443
|
+
const isArchived = Boolean(activeRow?.hasAttribute('data-archived'));
|
|
444
|
+
const convPath = activeId ? talk(activeId) : window.location.pathname + window.location.search;
|
|
379
445
|
entries.push({
|
|
380
446
|
key: 'conv-rename',
|
|
381
447
|
label: t('Rename'),
|
|
@@ -383,8 +449,8 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
383
449
|
run: () => dispatchChat('rename'),
|
|
384
450
|
}, {
|
|
385
451
|
key: 'conv-pin',
|
|
386
|
-
label: t('Pin'),
|
|
387
|
-
icon: _jsx(Pin, { size: 15, "aria-hidden": true }),
|
|
452
|
+
label: isPinned ? t('Unpin') : t('Pin'),
|
|
453
|
+
icon: isPinned ? _jsx(PinOff, { size: 15, "aria-hidden": true }) : _jsx(Pin, { size: 15, "aria-hidden": true }),
|
|
388
454
|
run: () => dispatchChat('pin'),
|
|
389
455
|
}, {
|
|
390
456
|
key: 'conv-share',
|
|
@@ -400,21 +466,22 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
400
466
|
key: 'conv-copy-link',
|
|
401
467
|
label: t('Copy link'),
|
|
402
468
|
icon: _jsx(Link2, { size: 15, "aria-hidden": true }),
|
|
403
|
-
run: () => void copyLink(
|
|
469
|
+
run: () => void copyLink(convPath),
|
|
404
470
|
}, {
|
|
405
471
|
key: 'conv-open-tab',
|
|
406
472
|
label: t('Open in new tab'),
|
|
407
473
|
icon: _jsx(ExternalLink, { size: 15, "aria-hidden": true }),
|
|
408
|
-
run: () => openNewTab(
|
|
474
|
+
run: () => openNewTab(convPath),
|
|
409
475
|
}, {
|
|
410
476
|
key: 'conv-archive',
|
|
411
|
-
label: t('Archive'),
|
|
412
|
-
icon: _jsx(Archive, { size: 15, "aria-hidden": true }),
|
|
477
|
+
label: isArchived ? t('Unarchive') : t('Archive'),
|
|
478
|
+
icon: isArchived ? _jsx(ArchiveRestore, { size: 15, "aria-hidden": true }) : _jsx(Archive, { size: 15, "aria-hidden": true }),
|
|
413
479
|
run: () => dispatchChat('archive'),
|
|
414
480
|
}, { key: 'sep-conv-del', line: true }, {
|
|
415
481
|
key: 'conv-delete',
|
|
416
482
|
label: t('Delete'),
|
|
417
|
-
icon: _jsx(Trash2, { size: 15, "aria-hidden": true }),
|
|
483
|
+
icon: _jsx(Trash2, { size: 15, color: "var(--state-error)", "aria-hidden": true }),
|
|
484
|
+
destructive: true,
|
|
418
485
|
run: () => dispatchChat('delete'),
|
|
419
486
|
});
|
|
420
487
|
}
|
|
@@ -433,7 +500,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
433
500
|
run: () => go(app('')),
|
|
434
501
|
}, {
|
|
435
502
|
key: 'stage-search',
|
|
436
|
-
label: t('Search &
|
|
503
|
+
label: t('Search & commands…'),
|
|
437
504
|
icon: _jsx(Search, { size: 15, "aria-hidden": true }),
|
|
438
505
|
shortcut: apple ? '⌘K' : 'Ctrl+K',
|
|
439
506
|
run: onSeek,
|
|
@@ -441,7 +508,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
441
508
|
key: 'stage-projects',
|
|
442
509
|
label: t('Projects'),
|
|
443
510
|
icon: _jsx(FolderGit2, { size: 15, "aria-hidden": true }),
|
|
444
|
-
run: () => go(app('projects')),
|
|
511
|
+
run: () => go(app('-/projects')),
|
|
445
512
|
}, {
|
|
446
513
|
key: 'stage-design',
|
|
447
514
|
label: 'Design',
|
|
@@ -465,7 +532,7 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
465
532
|
: host.theme === 'light';
|
|
466
533
|
return {
|
|
467
534
|
key: 'stage-theme',
|
|
468
|
-
label:
|
|
535
|
+
label: isLight ? t('Switch to dark theme') : t('Switch to light theme'),
|
|
469
536
|
icon: isLight ? _jsx(Moon, { size: 15, "aria-hidden": true }) : _jsx(Sun, { size: 15, "aria-hidden": true }),
|
|
470
537
|
run: () => host.chooseTheme?.(isLight ? 'dark' : 'light'),
|
|
471
538
|
};
|
|
@@ -481,59 +548,76 @@ export function AppContextMenu({ host, mode, closed, onToggleSidebar, onSeek, on
|
|
|
481
548
|
window.dispatchEvent(new CustomEvent('hanzo:anon-settings'));
|
|
482
549
|
return;
|
|
483
550
|
}
|
|
484
|
-
|
|
551
|
+
rememberSettingsReturn();
|
|
552
|
+
go(settings('account'));
|
|
485
553
|
},
|
|
486
554
|
});
|
|
487
555
|
}
|
|
488
556
|
if (!entries.length)
|
|
489
557
|
return;
|
|
490
558
|
e.preventDefault();
|
|
559
|
+
openerRef.current =
|
|
560
|
+
document.activeElement instanceof HTMLElement && document.activeElement !== document.body
|
|
561
|
+
? document.activeElement
|
|
562
|
+
: target.closest('button, a, [role="button"], [tabindex]');
|
|
491
563
|
const vw = window.innerWidth;
|
|
492
564
|
const vh = window.innerHeight;
|
|
493
565
|
const menuW = 240;
|
|
494
566
|
const menuH = entries.length * 32 + 24;
|
|
495
567
|
const x = Math.max(8, Math.min(e.clientX, vw - menuW - 8));
|
|
496
568
|
const y = Math.max(8, Math.min(e.clientY, vh - menuH - 8));
|
|
569
|
+
setCompact(vw < 640);
|
|
497
570
|
setState({ x, y, title, entries });
|
|
498
571
|
};
|
|
499
572
|
window.addEventListener('contextmenu', onContextMenu);
|
|
500
573
|
return () => window.removeEventListener('contextmenu', onContextMenu);
|
|
501
|
-
}, [apple, closed, go, host, mode, onNewChat, onSeek, onToggleSidebar, t]);
|
|
574
|
+
}, [activeThread, apple, closed, go, host, mode, onNewChat, onSeek, onToggleSidebar, pins, togglePin, t]);
|
|
502
575
|
useEffect(() => {
|
|
503
576
|
if (!state)
|
|
504
577
|
return;
|
|
505
578
|
const onPointerDown = (e) => {
|
|
506
579
|
if (panelRef.current?.contains(e.target))
|
|
507
580
|
return;
|
|
508
|
-
|
|
581
|
+
closeMenu(false);
|
|
509
582
|
};
|
|
510
583
|
const onKeyDown = (e) => {
|
|
511
584
|
if (e.key === 'Escape') {
|
|
512
585
|
e.preventDefault();
|
|
513
|
-
|
|
586
|
+
closeMenu(true);
|
|
514
587
|
}
|
|
515
588
|
};
|
|
516
|
-
const onScroll = () =>
|
|
517
|
-
|
|
589
|
+
const onScroll = (e) => {
|
|
590
|
+
if (panelRef.current?.contains(e.target))
|
|
591
|
+
return;
|
|
592
|
+
closeMenu(false);
|
|
593
|
+
};
|
|
594
|
+
const onBlur = () => closeMenu(false);
|
|
595
|
+
window.addEventListener('pointerdown', onPointerDown, true);
|
|
518
596
|
window.addEventListener('keydown', onKeyDown, true);
|
|
519
597
|
window.addEventListener('scroll', onScroll, true);
|
|
520
|
-
window.addEventListener('blur',
|
|
598
|
+
window.addEventListener('blur', onBlur);
|
|
521
599
|
return () => {
|
|
522
|
-
window.removeEventListener('
|
|
600
|
+
window.removeEventListener('pointerdown', onPointerDown, true);
|
|
523
601
|
window.removeEventListener('keydown', onKeyDown, true);
|
|
524
602
|
window.removeEventListener('scroll', onScroll, true);
|
|
525
|
-
window.removeEventListener('blur',
|
|
603
|
+
window.removeEventListener('blur', onBlur);
|
|
526
604
|
};
|
|
527
|
-
}, [state]);
|
|
605
|
+
}, [state, closeMenu]);
|
|
528
606
|
if (!state)
|
|
529
607
|
return null;
|
|
608
|
+
const items = state.entries.map((entry) => 'line' in entry ? (_jsx(XStack, { height: 1, bg: "$borderColor", my: "$1", mx: "$1", role: "separator" }, entry.key)) : (_jsxs(XStack, { render: _jsx("button", { type: "button" }), role: "menuitem", width: "100%", px: "$2.5", py: compact ? '$2' : '$1.5', minH: compact ? 44 : 30, "$max-sm": { minH: 44 }, rounded: "$3", borderWidth: 0, items: "center", gap: "$2.5", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, onClick: () => {
|
|
609
|
+
closeMenu(false);
|
|
610
|
+
entry.run();
|
|
611
|
+
}, children: [_jsx(XStack, { width: 16, height: 16, items: "center", justify: "center", shrink: 0, opacity: entry.destructive ? 1 : 0.85, children: entry.icon }), _jsx(Text, { flex: 1, minW: 0, fontSize: compact ? '$3' : '$2', color: entry.destructive ? 'var(--state-error)' : '$ink', numberOfLines: 1, text: "start", children: entry.label }), entry.shortcut && !compact ? (_jsx(SizableText, { size: "$1", color: "$soft", "aria-hidden": true, "data-i18n-ltr": true, children: entry.shortcut })) : null] }, entry.key)));
|
|
612
|
+
if (compact) {
|
|
613
|
+
return (_jsxs(_Fragment, { children: [_jsx(View, { "data-slot": "app-context-menu-scrim", position: "fixed", inset: 0, bg: "var(--surface-scrim)", z: "var(--z-overlay)", onClick: () => closeMenu(true) }), _jsxs(YStack, { ref: (node) => {
|
|
614
|
+
panelRef.current = node ?? null;
|
|
615
|
+
}, role: "menu", "aria-label": state.title ?? t('Application menu'), "data-slot": "app-context-menu", "data-presentation": "sheet", position: "fixed", b: 0, l: 8, r: 8, width: "calc(100vw - 16px)", maxW: "100vw", maxH: "75dvh", overflowY: "auto", pt: "$2", px: "$2", pb: SAFE_BOTTOM, borderTopLeftRadius: "$5", borderTopRightRadius: "$5", borderBottomLeftRadius: 0, borderBottomRightRadius: 0, bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-floating)", z: "var(--z-modal)", children: [_jsx(XStack, { justify: "center", pt: "$1", pb: "$2", shrink: 0, "aria-hidden": true, "data-slot": "sheet-handle", children: _jsx(View, { width: 36, height: 4, rounded: "$10", bg: "$edge" }) }), state.title ? (_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$aside", px: "$2.5", pb: "$1.5", numberOfLines: 1, children: state.title })) : null, _jsx(YStack, { gap: "$0.5", minW: 0, children: items })] })] }));
|
|
616
|
+
}
|
|
530
617
|
return (_jsx(YStack, { ref: (node) => {
|
|
531
618
|
panelRef.current = node ?? null;
|
|
532
|
-
}, role: "menu", "aria-label": state.title ?? t('Application menu'), "data-slot": "app-context-menu", minW: 228, maxW: 280, p: "$1.5", rounded: "$4", bg: "
|
|
619
|
+
}, role: "menu", "aria-label": state.title ?? t('Application menu'), "data-slot": "app-context-menu", minW: 228, maxW: 280, maxH: "75dvh", overflowY: "auto", p: "$1.5", rounded: "$4", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-floating)", z: "var(--z-popover)", position: "fixed", l: state.x, t: state.y, "$platform-web": {
|
|
533
620
|
backdropFilter: 'blur(20px)',
|
|
534
|
-
boxShadow: 'var(--shadow-
|
|
535
|
-
}, children:
|
|
536
|
-
setState(null);
|
|
537
|
-
entry.run();
|
|
538
|
-
}, children: [_jsx(XStack, { width: 16, height: 16, items: "center", justify: "center", shrink: 0, opacity: 0.85, children: entry.icon }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", color: "$ink", numberOfLines: 1, text: "start", children: entry.label }), entry.shortcut ? (_jsx(SizableText, { size: "$1", color: "$soft", "aria-hidden": true, "data-i18n-ltr": true, children: entry.shortcut })) : null] }, entry.key))) }));
|
|
621
|
+
boxShadow: 'var(--shadow-floating)',
|
|
622
|
+
}, children: items }));
|
|
539
623
|
}
|
package/dist/Directory.js
CHANGED
|
@@ -217,7 +217,7 @@ export function Catalog({ tab }) {
|
|
|
217
217
|
return (rows ?? []).filter((r) => !q || r.name.toLowerCase().includes(q) || r.description.toLowerCase().includes(q));
|
|
218
218
|
}, [rows, query]);
|
|
219
219
|
const quiet = (text, action) => (_jsxs(YStack, { gap: "$3", py: "$4", items: "flex-start", children: [_jsx(Text, { fontSize: "$3", color: "$soft", children: text }), action] }));
|
|
220
|
-
return (_jsxs(YStack, { gap: "$4", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 180, children: [_jsx(Search, { size: 14, "aria-hidden": true }), _jsx(Input, { value: query, onChangeText: setQuery, placeholder: search, "aria-label": search, flex: 1 })] }), _jsx(Action, { render: "button",
|
|
220
|
+
return (_jsxs(YStack, { gap: "$4", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 180, children: [_jsx(Search, { size: 14, "aria-hidden": true }), _jsx(Input, { value: query, onChangeText: setQuery, placeholder: search, "aria-label": search, flex: 1 })] }), _jsx(Action, { render: _jsx("button", { type: "button" }), onClick: () => window.open('https://hanzo.market', '_blank', 'noopener,noreferrer'), $touchable: { minH: 36 }, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Compass, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "500", children: t('Explore on hanzo.market') }), _jsx(ArrowUpRight, { size: 13, "aria-hidden": true })] }) })] }), tab === 'channels' && !signed ? (quiet(t('Sign in to see the channels your organization can connect.'), _jsx(Action, { render: _jsx("button", { type: "button" }), onClick: () => enter(), $touchable: { minH: 44, minW: 44 }, children: t('Sign in') }))) : wrong ? (quiet(say(wrong, t('the channels'), 'read', t), _jsx(Action, { render: _jsx("button", { type: "button" }), onClick: () => setTurn((n) => n + 1), $touchable: { minH: 44, minW: 44 }, children: t('Try again') }))) : rows === null ? (quiet(t(tab === 'channels' ? 'Loading channels…' : 'Loading works with…'))) : shown.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { fontSize: "$3", color: "$soft", children: shown.length === 1 ? t('1 result') : t('{n} results', { n: shown.length }) }), _jsx(YStack, { maxH: 380, overflowY: "auto", overflowX: "hidden", paddingInlineEnd: "$1", width: "100%", children: _jsx(Grid, { columns: tab === 'channels' ? { min: 168, max: 4 } : { min: 240, max: 2 }, gap: 12, children: shown.map((r) => tab === 'channels' ? (_jsx(Channel, { row: r, onChange: () => setTurn((n) => n + 1) }, r.id)) : (_jsx(RowCard, { row: r, tab: tab }, r.id))) }) })] })) : (quiet(query ? t('Nothing matches “{query}”.', { query }) : t(tab === 'channels' ? 'No channel can be connected here yet.' : 'Nothing is listed yet.')))] }));
|
|
221
221
|
}
|
|
222
222
|
function RowCard({ row, tab }) {
|
|
223
223
|
const { t } = useI18n();
|
package/dist/Drawer.js
CHANGED
|
@@ -341,5 +341,5 @@ export function Lift() {
|
|
|
341
341
|
*/
|
|
342
342
|
export function Layer({ drawer, top = 0, children }) {
|
|
343
343
|
const { t } = useI18n();
|
|
344
|
-
return (_jsxs(YStack, { ref: drawer.layer, role: "dialog", "aria-modal": true, "aria-label": t('Menu'), tabIndex: -1, "data-slot": "drawer", "data-state": drawer.state, position: "absolute", t: top, b: 0, insetInlineStart: 0, insetInlineEnd: 0, outlineStyle: "none", $md: { display: 'none' }, children: [_jsx(YStack, { "data-slot": "menu", position: "absolute", t: 0, b: 0, insetInlineStart: 0, z: "var(--z-base)", width: OPEN, bg: "var(--pane-floor)", pt: "var(--safe-top)", pb: "max(var(--pane-gap), var(--safe-bottom))", ...{ paddingInlineStart: 'max(var(--safe-left), var(--safe-right))', touchAction: 'pan-y' }, children: children }), drawer.state === 'open' ? (_jsx(YStack, { render: "button", "data-slot": "drawer-close", "aria-label": t('Close sidebar'),
|
|
344
|
+
return (_jsxs(YStack, { ref: drawer.layer, role: "dialog", "aria-modal": true, "aria-label": t('Menu'), tabIndex: -1, "data-slot": "drawer", "data-state": drawer.state, position: "absolute", t: top, b: 0, insetInlineStart: 0, insetInlineEnd: 0, outlineStyle: "none", $md: { display: 'none' }, children: [_jsx(YStack, { "data-slot": "menu", position: "absolute", t: 0, b: 0, insetInlineStart: 0, z: "var(--z-base)", width: OPEN, bg: "var(--pane-floor)", pt: "var(--safe-top)", pb: "max(var(--pane-gap), var(--safe-bottom))", ...{ paddingInlineStart: 'max(var(--safe-left), var(--safe-right))', touchAction: 'pan-y' }, children: children }), drawer.state === 'open' ? (_jsx(YStack, { render: _jsx("button", { type: "button" }), "data-slot": "drawer-close", "aria-label": t('Close sidebar'), onClick: drawer.close, position: "absolute", t: 0, b: 0, insetInlineEnd: 0, z: "var(--z-drawer)", bg: "transparent", borderWidth: 0, cursor: "pointer", ...{ insetInlineStart: OPEN, touchAction: 'none' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' } })) : null] }));
|
|
345
345
|
}
|