@hanzo/dev 4.1.0 → 4.2.1
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/{BinaryViewer-CmFUK4zZ.js → BinaryViewer-BCDMNW2g.js} +19 -19
- package/dist/{ChatMarkdown-nvEI7iCv.js → ChatMarkdown-BUidXqSs.js} +2460 -2460
- package/dist/{DevicePanel-v5e3sEIf.js → DevicePanel-D-pksK3r.js} +532 -532
- package/dist/{DeviceStreamView-CCIfmbxH.js → DeviceStreamView-DsCoOzDV.js} +377 -377
- package/dist/{DiffCommentAnnotation-BPTN_2a6.js → DiffCommentAnnotation-2HD5qiyt.js} +227 -227
- package/dist/{DiffFileTree-B_br90vY.js → DiffFileTree-CuWvI5hS.js} +13 -13
- package/dist/{DiffPanel-V5R5TPuK.js → DiffPanel-Z2QVmBzu.js} +328 -328
- package/dist/{DiffWorkerPoolProvider-BwFR-Fc9.js → DiffWorkerPoolProvider-CEfiCIGR.js} +3 -3
- package/dist/{DocumentPages-VSn83vty.js → DocumentPages-glImt2JO.js} +3 -3
- package/dist/{ExpandedImageDialog-CAorLacL.js → ExpandedImageDialog-iqO3LiIj.js} +404 -404
- package/dist/{FileExplorerPane-CeHulcPz.js → FileExplorerPane-GwnRmXEh.js} +4 -4
- package/dist/{FilePreviewPanel-BVNLvWOc.js → FilePreviewPanel-CXWpTlfI.js} +1089 -1089
- package/dist/{FontFilePreview-Dj8Blcay.js → FontFilePreview-CDydHOXg.js} +2 -2
- package/dist/{FontViewer-CLDdwhSr.js → FontViewer-DDt9C5Cb.js} +5 -5
- package/dist/{HanzoConnectAccountPages-BEzYfu2l.js → HanzoConnectAccountPages-_sfrtw9j.js} +357 -357
- package/dist/{HanzoConnectSidebarSignIn-BhD6-Up5.js → HanzoConnectSidebarSignIn-coFQvyRw.js} +3 -3
- package/dist/{Icons-CvSmt8vD.js → Icons-CdegMw5l.js} +1 -1
- package/dist/{LargeTextViewer-DfFnYGCw.js → LargeTextViewer-D3RklYQB.js} +8 -8
- package/dist/{MermaidDiagram-CTolIzQD.js → MermaidDiagram-sVLnox7j.js} +8 -8
- package/dist/{MermaidFilePreview-CP2zP4FU.js → MermaidFilePreview-BmPdNxW5.js} +2 -2
- package/dist/{MermaidViewer-BDfYkS9E.js → MermaidViewer-BlKTevTF.js} +3 -3
- package/dist/{NotebookPreview-Cybs5uM0.js → NotebookPreview-C0gSEyeO.js} +10 -10
- package/dist/{OfficeFilePreview-7JsmSoKU.js → OfficeFilePreview-Ago_DWEt.js} +2 -2
- package/dist/{OfficeViewer-CJoojlJK.js → OfficeViewer-DBRqtLet.js} +10 -10
- package/dist/{OpenInPicker-BIMWUxBP.js → OpenInPicker-DD_h7VLv.js} +287 -287
- package/dist/{OpenXmlOfficeViewer-C24Kj8DM.js → OpenXmlOfficeViewer-B4dxjpba.js} +4 -4
- package/dist/{PdfViewer-Cf1iD759.js → PdfViewer-BanXvPmz.js} +16 -16
- package/dist/{PreviewFaviconIcon-zFOuzIxe.js → PreviewFaviconIcon-BwYKB-3e.js} +892 -892
- package/dist/{PreviewImage-oY5YnuTr.js → PreviewImage-6UU-M6_B.js} +3 -3
- package/dist/{PreviewImageContent-n6eLzY99.js → PreviewImageContent-D-00K-A9.js} +3 -3
- package/dist/{PreviewPanel-Bo4Lt02m.js → PreviewPanel-CiuHdDv8.js} +489 -489
- package/dist/{PreviewPanelShell-DhXLeN5j.js → PreviewPanelShell-Dezxjg0T.js} +71 -71
- package/dist/{ProjectIconPickerDialog-D0kFzt8f.js → ProjectIconPickerDialog-LomrzROv.js} +29 -29
- package/dist/{ProjectMonogram-D35xrrXQ.js → ProjectMonogram-D21--FQY.js} +1 -1
- package/dist/{ProviderAuthTerminal-DfsXnu7A.js → ProviderAuthTerminal-pQXIfodT.js} +3 -3
- package/dist/{PullRequestCodeTab-Dv_0kVad.js → PullRequestCodeTab-Cqfh5eN2.js} +476 -476
- package/dist/{PullRequestReviewAnnotation-LeuwO-iH.js → PullRequestReviewAnnotation-B4Lp8Ktf.js} +334 -334
- package/dist/{ReadOnlySourcePreview-D__IA5g1.js → ReadOnlySourcePreview-7xXUUySV.js} +5 -5
- package/dist/{RelativeTime-BMRprQS8.js → RelativeTime-B_yprjav.js} +2 -2
- package/dist/{RightPanelResizeHandle-BLbSz-gk.js → RightPanelResizeHandle-PumvYb9P.js} +2 -2
- package/dist/{ThemeEditorPanel-CUDdsRsE.js → ThemeEditorPanel-BmXXpaCI.js} +196 -196
- package/dist/{ThreadTerminalDrawer-BF3Ix0q_.js → ThreadTerminalDrawer-DCgE3ojz.js} +461 -461
- package/dist/{VirtualTablePreview-dajviAfu.js → VirtualTablePreview-mA6DOFwb.js} +1 -1
- package/dist/{anchoredCopyToast-DnUtg1n_.js → anchoredCopyToast-BVa_dlBU.js} +2 -2
- package/dist/{assetUrls-DkY7vXfM.js → assetUrls-D8lRk7Xd.js} +45 -45
- package/dist/{browserLinkTarget-CA46wnQC.js → browserLinkTarget-BbVlDQYx.js} +18 -18
- package/dist/builder/api/git.d.ts +32 -4
- package/dist/builder/api/git.js +74 -4
- package/dist/builder/api/github.d.ts +54 -0
- package/dist/builder/api/github.js +103 -1
- package/dist/builder/api/models.d.ts +2 -0
- package/dist/builder/api/models.js +6 -1
- package/dist/builder/api/sandbox.d.ts +2 -0
- package/dist/builder/api/sandbox.js +3 -1
- package/dist/builder/desk.d.ts +6 -0
- package/dist/builder/desk.js +79 -14
- package/dist/builder/forge.js +79 -10
- package/dist/builder/github-sync.d.ts +70 -0
- package/dist/builder/github-sync.js +435 -0
- package/dist/builder/mind.d.ts +5 -5
- package/dist/builder/mind.js +35 -14
- package/dist/builder/pane.d.ts +1 -1
- package/dist/builder/pane.js +1 -1
- package/dist/builder/panel.js +5 -5
- package/dist/builder/preview-fallback.d.ts +47 -0
- package/dist/builder/preview-fallback.js +341 -0
- package/dist/builder/project.js +17 -4
- package/dist/builder/sync.js +27 -4
- package/dist/{changedFileKind-D6QYvIez.js → changedFileKind-DrjqPCpz.js} +5 -5
- package/dist/{collapsible-DFT41MdC.js → collapsible-CDT6JKbk.js} +1 -1
- package/dist/{color-picker-CshqBbpY.js → color-picker-kSVcH92L.js} +16 -16
- package/dist/core.js +1 -1
- package/dist/{decodeImagePreview-DnfFEjhw.js → decodeImagePreview-ZtWU3urU.js} +2 -2
- package/dist/{delimitedPreview-BiEpdYOj.js → delimitedPreview-DbbXcqOT.js} +1 -1
- package/dist/{dialog-DhQtWGRa.js → dialog-EmpqFZiK.js} +40 -40
- package/dist/{embed-c030vUqM.js → embed-CPWZKyIW.js} +36098 -35677
- package/dist/{empty-Bm5EzcG8.js → empty-ChM6gdzn.js} +1 -1
- package/dist/{errors-DrFQSJW3.js → errors-D8_Zn8KN.js} +2 -2
- package/dist/{fileContextMenu-BBo91omq.js → fileContextMenu-DW94DZj4.js} +54 -54
- package/dist/{fileExplorerLabel-AikEChiS.js → fileExplorerLabel-Cfz-3q1U.js} +507 -507
- package/dist/{fileSurfaceChrome-Cqkvn8RQ.js → fileSurfaceChrome-BDyKklTq.js} +26 -26
- package/dist/{hanzoWebAnalytics-CCxpTzcI.js → hanzoWebAnalytics-B1eETW-7.js} +1 -1
- package/dist/index.css +1 -1
- package/dist/{input-group-DEJEuwc9.js → input-group-BZ_QN-y7.js} +1 -1
- package/dist/{keybindings-C5tK_GAk.js → keybindings-D0pBlT1k.js} +7812 -7806
- package/dist/keymap.js +1 -1
- package/dist/{lucideIconByName-DUaXKH0V.js → lucideIconByName-CXY44V8P.js} +6835 -6848
- package/dist/{mediaReference-Bt_mh-ag.js → mediaReference-3wc4ZfY8.js} +95 -95
- package/dist/mediaSource-jW5c7b4r.js +70 -0
- package/dist/{modelPickerVisibility-Jue3CLfc.js → modelPickerVisibility-DBTc5r1G.js} +1 -1
- package/dist/{network-BbwqRm8c.js → network-wuXD7-is.js} +1 -1
- package/dist/{popover-anNQdce7.js → popover-BAyP2Tdr.js} +1 -1
- package/dist/{presentation-D9mVPBHm.js → presentation-68y8EAuH.js} +299 -299
- package/dist/{previewFailureMessages-BKpsSGX5.js → previewFailureMessages-CFguipaK.js} +3 -3
- package/dist/query-BPk2W3QN.js +63 -0
- package/dist/{readBinaryPreview-BAQ4fFjm.js → readBinaryPreview-CjZdBNVR.js} +2 -2
- package/dist/{refresh-icon-BYx64to1.js → refresh-icon-Vo5ImiQL.js} +1 -1
- package/dist/{scroll-area-ChvX8uOh.js → scroll-area-CEoyjC7h.js} +1 -1
- package/dist/{select-DumYjny_.js → select-DLFnkZsI.js} +2 -2
- package/dist/{session-_kmiSv2A.js → session-Decc4Fo5.js} +1063 -1063
- package/dist/{skeleton-CJqwfMSF.js → skeleton-BOKpAZv6.js} +1 -1
- package/dist/{switch-COwevwaq.js → switch-DjpPjtQN.js} +2 -2
- package/dist/{themePalette-Dl_7omVL.js → themePalette-C-GtwwqV.js} +977 -977
- package/dist/{threadSearch-BHyWwcV3.js → threadSearch-CrtCof6n.js} +162 -162
- package/dist/{toggle-CEO6qTxB.js → toggle-B4F0EEtI.js} +1 -1
- package/dist/{toggle-group-BHovdMDl.js → toggle-group-l8hRPswr.js} +2 -2
- package/dist/{use-atom-command-ByoYq_K6.js → use-atom-command-XemtT1Gv.js} +1 -1
- package/dist/{useAriaLabelledBy-DPSISlnL.js → useAriaLabelledBy-CibvSz-b.js} +1 -1
- package/dist/{useFileMetadata-e7zsixVX.js → useFileMetadata-PesehDX0.js} +33 -33
- package/dist/{useFloatingRootContext-CJ9stHca.js → useFloatingRootContext-ppoGvqar.js} +1 -1
- package/dist/{useLiveRefresh-BkKJKXhH.js → useLiveRefresh-aHkPuz6N.js} +172 -172
- package/dist/{useNextRenderData-CyUmSAgz.js → useNextRenderData-CNhjWfP0.js} +1 -1
- package/dist/{useSettings-DYG9Dmro.js → useSettings-B_MtcTyD.js} +139 -139
- package/dist/{useTextFieldSpeech-COa9XcRx.js → useTextFieldSpeech-B1wCgLPO.js} +1404 -1404
- package/dist/{useTheme-D2ZM1gvV.js → useTheme-WlXpQRKG.js} +4 -4
- package/dist/{utils-515nQ17G.js → utils-DtKQl-D3.js} +6184 -6172
- package/dist/{wizard-i86ViMRc.js → wizard-DjD4UNew.js} +3 -3
- package/dist/{workspaceFocus-BV1_9KiH.js → workspaceFocus-MR1plm6A.js} +144 -144
- package/dist/{zap-e0OsRjBR.js → zap-iwsUKtvA.js} +30 -17
- package/package.json +1 -1
- package/dist/mediaSource-zI7JWid4.js +0 -70
- package/dist/query-BxrrBAp6.js +0 -63
package/dist/builder/desk.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DropdownMenuProps } from '@hanzo/ui';
|
|
2
|
+
import { type FallbackPreview } from './preview-fallback.ts';
|
|
2
3
|
import type { Event } from './api/sessions.ts';
|
|
3
4
|
import type { Deck, Tabs } from './tabs.ts';
|
|
4
5
|
/** A run's panel before anyone has arranged it: Preview chosen first so live output opens immediately. */
|
|
@@ -46,3 +47,8 @@ export declare function Desk({ id, repo, branch, base, environment, mode, pr, ti
|
|
|
46
47
|
/** Reserve space for the host shell's top-right corner buttons. */
|
|
47
48
|
topRightInset?: boolean;
|
|
48
49
|
}): import("react").JSX.Element;
|
|
50
|
+
/** Inline renderer for session-edited files and project README.md when no dev server is listening. */
|
|
51
|
+
export declare function FallbackPreviewBody({ preview, device }: {
|
|
52
|
+
preview: FallbackPreview;
|
|
53
|
+
device: 'desktop' | 'mobile';
|
|
54
|
+
}): import("react").JSX.Element;
|
package/dist/builder/desk.js
CHANGED
|
@@ -14,12 +14,14 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
14
14
|
*/
|
|
15
15
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
16
16
|
import { useI18n } from '@hanzo/i18n/react';
|
|
17
|
-
import { Check, Circle, ExternalLink, Folder, GitBranch, GitPullRequest, Globe, Info, Laptop, Maximize2, MoreHorizontal, Play, RefreshCcw, Square, SquareTerminal, Upload, X } from '@hanzogui/lucide-icons-2';
|
|
17
|
+
import { Check, Circle, ExternalLink, FileText, Folder, GitBranch, GitPullRequest, Globe, Info, Laptop, Maximize2, MoreHorizontal, Play, RefreshCcw, Square, SquareTerminal, Upload, X } from '@hanzogui/lucide-icons-2';
|
|
18
18
|
import { Button, DropdownMenu, Switch } from '@hanzo/ui';
|
|
19
19
|
import { Console, DEVICES, PreviewFrame, Views } from '@hanzo/ui/agents';
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
21
|
import { RING } from './pane.js';
|
|
22
|
+
import { resolveFallbackPreview, svgPreviewDocument } from './preview-fallback.js';
|
|
22
23
|
import { cacheBustUrl, hasUnpublishedEdits, previewRevision, resolvePreviewSource } from './preview-url.js';
|
|
24
|
+
import { Prose } from './prose.js';
|
|
23
25
|
import { read as readChanges } from './api/changes.js';
|
|
24
26
|
import { read as readEnvironment } from './api/environment.js';
|
|
25
27
|
import { park, ports as listening, preview, sandbox as look, serve, served, stay, wake } from './api/sandbox.js';
|
|
@@ -64,7 +66,7 @@ export function Desk({ id, repo, branch, base, environment, mode, pr, title, pro
|
|
|
64
66
|
id: 'preview',
|
|
65
67
|
label: say('Preview'),
|
|
66
68
|
bleed: true,
|
|
67
|
-
render: () => (_jsx(Browser, { sandbox: sandbox, held: held, site: site, live: live, repo: repo, events: events, published: published, sessionStatus: sessionStatus, hasChanges: unpublished, onPublish: onPublish, onEnvironment: environ })),
|
|
69
|
+
render: () => (_jsx(Browser, { session: id, sandbox: sandbox, held: held, site: site, live: live, repo: repo, branch: branch, base: base, events: events, published: published, sessionStatus: sessionStatus, hasChanges: unpublished, onPublish: onPublish, onEnvironment: environ })),
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
id: 'artifacts',
|
|
@@ -101,10 +103,10 @@ export function Desk({ id, repo, branch, base, environment, mode, pr, title, pro
|
|
|
101
103
|
: pid === 'preview'
|
|
102
104
|
? say('Preview')
|
|
103
105
|
: k.label;
|
|
104
|
-
return (_jsxs(YStack, { minW: 0, minH: 0, borderLeftWidth: idx % 2 === 1 ? 1 : 0, borderTopWidth: idx >= 2 ? 1 : 0, "$max-lg": { borderLeftWidth: 0, borderTopWidth: idx > 0 ? 1 : 0 }, borderColor: "$borderColor", display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", children: [_jsxs(XStack, { px: "$2.5", py: "$1
|
|
106
|
+
return (_jsxs(YStack, { minW: 0, minH: 0, borderLeftWidth: idx % 2 === 1 ? 1 : 0, borderTopWidth: idx >= 2 ? 1 : 0, "$max-lg": { borderLeftWidth: 0, borderTopWidth: idx > 0 ? 1 : 0 }, borderColor: "$borderColor", display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", children: [_jsxs(XStack, { px: "$2.5", py: "$1", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", height: 40, minH: 40, style: idx === 1 && (topRightInset ?? !sheet) ? { paddingInlineEnd: 'calc(10px + var(--hanzo-shell-top-right-inset, 0px))' } : undefined, children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: headerTitle }), onExpandSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Expand {pane}', { pane: k.label }), ...{ title: say('Expand {pane}', { pane: k.label }) }, onClick: () => onExpandSplitPane(pid), minW: 30, minH: 30, items: "center", justify: "center", rounded: "$2", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(Maximize2, { size: 13, opacity: 0.7 }) })) : null, onCloseSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Close {pane}', { pane: k.label }), ...{ title: say('Close {pane}', { pane: k.label }) }, onClick: () => onCloseSplitPane(pid), minW: 30, minH: 30, items: "center", justify: "center", rounded: "$2", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(X, { size: 14, opacity: 0.7 }) })) : null] }), _jsx(YStack, { flex: 1, minH: 0, overflow: k.bleed ? 'hidden' : 'scroll', ...(k.bleed ? null : { p: '$3' }), children: k.render() })] }, pid));
|
|
105
107
|
}) })) : (_jsx(Panel, { side: side, kinds: kinds, sheet: sheet, topRightInset: topRightInset, onHide: onHide, label: say('Session details'),
|
|
106
108
|
// An empty tab offers what this session made: its site and its pull request.
|
|
107
|
-
suggested: [...(site ? [{ title: name || site, url: site }] : []), ...(pr.href ? [{ title: say('Pull request {pr}', { pr: pr.label }), url: pr.href }] : [])], bar: sandbox ? _jsx(Held, { box: box, live: live, devMode: devMode }) : null, menu: _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": say('Session actions'),
|
|
109
|
+
suggested: [...(site ? [{ title: name || site, url: site }] : []), ...(pr.href ? [{ title: say('Pull request {pr}', { pr: pr.label }), url: pr.href }] : [])], bar: sandbox ? _jsx(Held, { box: box, live: live, devMode: devMode }) : null, menu: _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": say('Session actions'), width: 28, height: 28, items: "center", justify: "center", rounded: 8, hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 15 }) }), items: [...menu, { key: 'details', label: say('Details'), icon: _jsx(Info, { size: 16 }), onSelect: environ }] }) }));
|
|
108
110
|
if (envColumn && !sheet) {
|
|
109
111
|
return (_jsxs(XStack, { flex: 1, minW: 0, minH: 0, width: "100%", height: "100%", children: [_jsx(EnvironmentInspection, { id: id, repo: repo, name: name, branch: branch, environment: environment, pr: pr, title: title, events: events, live: live, devMode: devMode, onOpenEnvironment: environ, onOpenDiff: () => side.open({ kind: 'diff', title: devMode ? say('Diff') : say('Changes') }) }), _jsx(YStack, { flex: 1, minW: 0, minH: 0, borderLeftWidth: 1, borderColor: "$borderColor", children: panelNode })] }));
|
|
110
112
|
}
|
|
@@ -211,7 +213,7 @@ const SAYS = {
|
|
|
211
213
|
* looking. A preview that lost its sandbox (409) is opened again, at most twice
|
|
212
214
|
* in a while; any other status is said, and Retry is the person's.
|
|
213
215
|
*/
|
|
214
|
-
function Browser({ sandbox, held, site, live, repo, events, published, sessionStatus, hasChanges, onPublish, onEnvironment, }) {
|
|
216
|
+
function Browser({ session, sandbox, held, site, live, repo, branch, base, events, published, sessionStatus, hasChanges, onPublish, onEnvironment, }) {
|
|
215
217
|
const { t: say } = useI18n();
|
|
216
218
|
const t = useTarget();
|
|
217
219
|
const [open, setOpen] = useState([]);
|
|
@@ -356,7 +358,7 @@ function Browser({ sandbox, held, site, live, repo, events, published, sessionSt
|
|
|
356
358
|
});
|
|
357
359
|
const showingSandbox = hasSandboxPreview && resolved.kind === 'sandbox';
|
|
358
360
|
if (!showingSandbox) {
|
|
359
|
-
return (_jsxs(_Fragment, { children: [dialog, _jsx(Site, { site: site, rev: rev, onReload: () => setRev((n) => n + 1), live: live, held: held, serving: serving, events: events, hasChanges: hasChanges, hasSandboxPreview: hasSandboxPreview, onUseSandbox: hasSandboxPreview ? () => setPreferLive(false) : undefined, onStart: startable ? () => void start() : undefined, onPublish: onPublish, onEnvironment: repo ? onEnvironment : undefined })] }));
|
|
361
|
+
return (_jsxs(_Fragment, { children: [dialog, _jsx(Site, { session: session, sandbox: sandbox, repo: repo, branch: branch, base: base, site: site, rev: rev, onReload: () => setRev((n) => n + 1), live: live, held: held, serving: serving, events: events, hasChanges: hasChanges, hasSandboxPreview: hasSandboxPreview, onUseSandbox: hasSandboxPreview ? () => setPreferLive(false) : undefined, onStart: startable ? () => void start() : undefined, onPublish: onPublish, onEnvironment: repo ? onEnvironment : undefined })] }));
|
|
360
362
|
}
|
|
361
363
|
const host = open.find((p) => p.port === port)?.host ?? '';
|
|
362
364
|
const framedSrc = src ? cacheBustUrl(src, rev) : '';
|
|
@@ -378,29 +380,92 @@ const WATCH = 120_000;
|
|
|
378
380
|
const WATCHING = 3_000;
|
|
379
381
|
/**
|
|
380
382
|
* Where the run published its work, framed, with its address, a reload and the
|
|
381
|
-
* page in a tab of its own; or
|
|
382
|
-
*
|
|
383
|
+
* page in a tab of its own; or, when nothing is serving yet, an automatic
|
|
384
|
+
* inline preview of the session's most recently edited file or the project's
|
|
385
|
+
* README.md (falling back to a quiet "No files yet" state only when there are
|
|
386
|
+
* genuinely zero files).
|
|
383
387
|
*/
|
|
384
|
-
function Site({ site, rev, onReload, live, held, serving, events, hasChanges, hasSandboxPreview, onUseSandbox, onStart, onPublish, onEnvironment, }) {
|
|
388
|
+
function Site({ session, sandbox, repo, branch, base, site, rev, onReload, live, held, serving, events, hasChanges, hasSandboxPreview, onUseSandbox, onStart, onPublish, onEnvironment, }) {
|
|
385
389
|
const { t } = useI18n();
|
|
390
|
+
const host = useHost();
|
|
391
|
+
const target = useTarget();
|
|
392
|
+
const signed = Boolean(host.person);
|
|
393
|
+
const running = Boolean(sandbox) && held === 'running';
|
|
386
394
|
const progress = live ? steps(events) : [];
|
|
387
395
|
const frame = useRef(null);
|
|
388
396
|
const [device, setDevice] = useState('desktop');
|
|
389
397
|
const [dock, setDock] = useKept('hanzo.build.dock', 36);
|
|
390
398
|
const [lines, setLines] = useState([]);
|
|
399
|
+
const [fallback, setFallback] = useState(null);
|
|
400
|
+
const [fallbackLoading, setFallbackLoading] = useState(false);
|
|
391
401
|
const onBridge = (e) => {
|
|
392
402
|
if (e.type === 'preview:console')
|
|
393
403
|
setLines((was) => [...was.slice(-400), { id: `p${was.length}-${Date.now()}`, level: e.level, text: e.text, source: 'page' }]);
|
|
394
404
|
};
|
|
405
|
+
// When no live server or published site is serving, load the session's latest edited file or project README.
|
|
406
|
+
useEffect(() => {
|
|
407
|
+
if (site) {
|
|
408
|
+
setFallback(null);
|
|
409
|
+
setFallbackLoading(false);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const ctrl = new AbortController();
|
|
413
|
+
setFallbackLoading(true);
|
|
414
|
+
void resolveFallbackPreview({
|
|
415
|
+
target,
|
|
416
|
+
session,
|
|
417
|
+
sandbox,
|
|
418
|
+
running,
|
|
419
|
+
signed,
|
|
420
|
+
repo,
|
|
421
|
+
branch,
|
|
422
|
+
base,
|
|
423
|
+
events,
|
|
424
|
+
signal: ctrl.signal,
|
|
425
|
+
})
|
|
426
|
+
.then((found) => {
|
|
427
|
+
if (!ctrl.signal.aborted)
|
|
428
|
+
setFallback(found);
|
|
429
|
+
})
|
|
430
|
+
.catch(() => {
|
|
431
|
+
if (!ctrl.signal.aborted)
|
|
432
|
+
setFallback(null);
|
|
433
|
+
})
|
|
434
|
+
.finally(() => {
|
|
435
|
+
if (!ctrl.signal.aborted)
|
|
436
|
+
setFallbackLoading(false);
|
|
437
|
+
});
|
|
438
|
+
return () => ctrl.abort();
|
|
439
|
+
}, [site, target, session, sandbox, running, signed, repo, branch, base, rev, events.length]);
|
|
395
440
|
const framedSite = site ? cacheBustUrl(site, rev) : '';
|
|
441
|
+
const showDeviceToggle = Boolean(site) || fallback?.format === 'html';
|
|
442
|
+
const fallbackPillLabel = fallback ? fallback.path : '';
|
|
396
443
|
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", minW: 0, children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the page'), ...{ title: t('Reload the page') }, onPress: () => {
|
|
397
444
|
onReload();
|
|
398
445
|
frame.current?.reload();
|
|
399
|
-
}, p: "$1.5", rounded: "$2", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 14 }) }), site ? (_jsxs(XStack, { "data-slot": "preview-mode", "data-kind": "live", items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 999, bg: "$edge", borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Globe, { size: 11, opacity: 0.75 }), _jsx(SizableText, { size: "$1", color: "$ink", numberOfLines: 1, children: t('Live site') })] })) : null, _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, style: mono, children: site
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
446
|
+
}, p: "$1.5", rounded: "$2", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 14 }) }), site ? (_jsxs(XStack, { "data-slot": "preview-mode", "data-kind": "live", items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 999, bg: "$edge", borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Globe, { size: 11, opacity: 0.75 }), _jsx(SizableText, { size: "$1", color: "$ink", numberOfLines: 1, children: t('Live site') })] })) : fallback ? (_jsxs(XStack, { "data-slot": "preview-mode", "data-kind": fallback.source === 'readme' ? 'readme' : 'file', items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 999, bg: "$edge", borderWidth: 1, borderColor: "$borderColor", shrink: 1, minW: 0, maxW: 260, children: [_jsx(FileText, { size: 11, opacity: 0.75 }), _jsx(SizableText, { size: "$1", color: "$ink", numberOfLines: 1, style: mono, children: fallbackPillLabel })] })) : null, _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, style: mono, children: site ? site : fallback ? '' : fallbackLoading ? t('Loading preview…') : t('No files yet') }), onUseSandbox ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onUseSandbox, shrink: 0, children: t('Sandbox preview') })) : onStart ? (_jsxs(XStack, { render: "button", "aria-label": site ? t('Start sandbox preview') : t('Start dev server'), onPress: onStart, items: "center", gap: "$1", px: "$2", height: 28, rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", shrink: 0, hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(Play, { size: 12 }), _jsx(SizableText, { size: "$1", color: "$ink", numberOfLines: 1, children: serving?.up ? t('Starting…') : site ? t('Sandbox preview') : t('Start dev server') })] })) : null, onPublish ? (_jsxs(Button, { size: "sm", variant: "primary", onPress: onPublish, shrink: 0, children: [_jsx(Upload, { size: 13 }), _jsx(SizableText, { size: "$1", color: "inherit", children: t('Publish') })] })) : null, showDeviceToggle ? (_jsx(Views, { views: DEVICES, value: device, onChange: (d) => setDevice(d), label: t('Device'), labels: "none" })) : null, site ? (_jsx(Out, { href: site, label: t('Open in browser'), children: _jsx(OpenOut, { label: t('Open in browser') }) })) : null] }), site && hasChanges && !live && !hasSandboxPreview ? (_jsxs(XStack, { "data-slot": "preview-stale-banner", px: "$2.5", py: "$1.5", gap: "$2", items: "center", bg: "$sunken", borderBottomWidth: 1, borderColor: "$borderColor", flexWrap: "wrap", children: [_jsx(SizableText, { size: "$1", color: "$soft", flex: 1, minW: 140, children: t('Showing the deployed live site — edits in this session are not published yet.') }), onStart ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onStart, children: t('Start preview') })) : null, onPublish ? (_jsx(Button, { size: "sm", variant: "primary", onPress: onPublish, children: t('Publish changes') })) : null] })) : null, !site && serving ? (_jsxs(YStack, { "data-slot": "preview-serving-banner", px: "$3", py: "$2", gap: "$1.5", bg: "$sunken", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(SizableText, { size: "$1", color: "$ink", role: "status", flex: 1, minW: 140, children: serving.why || (serving.command ? t('Starting {command}…', { command: serving.command }) : t('Starting the dev server…')) }), serving.why && onStart ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onStart, children: t('Try again') })) : null, serving.why && onEnvironment ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onEnvironment, children: t('Set a start command') })) : null] }), serving.log ? _jsx(Tail, { log: serving.log }) : null] })) : null, site ? (_jsxs(_Fragment, { children: [_jsx(PreviewFrame, { ref: frame, src: framedSite, title: t('Where this session is published'), device: device, onBridge: onBridge }), _jsx(Console, { lines: lines, height: dock, onHeight: setDock, onClear: () => setLines([]), label: t('Console') })] })) : fallback ? (_jsx(FallbackPreviewBody, { preview: fallback, device: device })) : (_jsxs(YStack, { "data-slot": "preview-empty", flex: 1, items: "center", justify: "center", gap: "$2.5", p: "$6", children: [_jsx(FileText, { size: 24, opacity: 0.35 }), _jsx(SizableText, { size: "$3", color: "$ink", children: fallbackLoading ? t('Loading preview…') : t('No files yet') }), progress.length ? (_jsx(YStack, { render: "ol", "aria-label": t('Live session steps'), gap: "$2", m: 0, p: 0, width: "100%", maxW: 340, children: progress.map((step) => (_jsxs(XStack, { render: "li", borderWidth: 1, borderColor: "$borderColor", bg: "$sunken", rounded: "$3", p: "$2.5", gap: "$2", items: "center", children: [step.done ? _jsx(Check, { size: 15, "aria-hidden": true }) : _jsx(Circle, { size: 15, "aria-hidden": true }), _jsx(SizableText, { size: "$2", flex: 1, children: step.name }), _jsx(SizableText, { size: "$1", color: "$soft", children: step.done ? t('Finished') : t('Running') })] }, step.name))) })) : null, !serving && onStart ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onStart, children: t('Start dev server') })) : null] }))] }));
|
|
447
|
+
}
|
|
448
|
+
/** Inline renderer for session-edited files and project README.md when no dev server is listening. */
|
|
449
|
+
export function FallbackPreviewBody({ preview, device }) {
|
|
450
|
+
if (preview.format === 'markdown') {
|
|
451
|
+
return (_jsx(YStack, { "data-slot": "preview-fallback", "data-format": "markdown", flex: 1, minH: 0, overflow: "scroll", px: "$5", py: "$4", children: _jsx(YStack, { maxW: 760, width: "100%", mx: "auto", children: _jsx(Prose, { text: preview.text }) }) }));
|
|
452
|
+
}
|
|
453
|
+
if (preview.format === 'html' || preview.format === 'svg') {
|
|
454
|
+
const srcDoc = preview.format === 'svg' ? svgPreviewDocument(preview.text) : preview.text;
|
|
455
|
+
return (_jsx(YStack, { "data-slot": "preview-fallback", "data-format": preview.format, flex: 1, minH: 0, items: "center", justify: "center", bg: "$sunken", children: _jsx("iframe", { srcDoc: srcDoc, title: preview.path, sandbox: "allow-scripts", style: {
|
|
456
|
+
border: 0,
|
|
457
|
+
width: preview.format === 'html' && device === 'mobile' ? 390 : '100%',
|
|
458
|
+
maxWidth: '100%',
|
|
459
|
+
height: '100%',
|
|
460
|
+
display: 'block',
|
|
461
|
+
background: preview.format === 'html' ? '#fff' : 'transparent',
|
|
462
|
+
} }) }));
|
|
463
|
+
}
|
|
464
|
+
if (preview.format === 'image' && preview.imageUrl) {
|
|
465
|
+
return (_jsx(YStack, { "data-slot": "preview-fallback", "data-format": "image", flex: 1, minH: 0, items: "center", justify: "center", p: "$4", overflow: "scroll", children: _jsx("img", { src: preview.imageUrl, alt: preview.path, style: { maxWidth: '100%', maxHeight: '100%', objectFit: 'contain', borderRadius: 6 } }) }));
|
|
466
|
+
}
|
|
467
|
+
const codeLines = preview.text.replace(/\r\n?/g, '\n').split('\n');
|
|
468
|
+
return (_jsx(YStack, { "data-slot": "preview-fallback", "data-format": "code", flex: 1, minH: 0, overflow: "scroll", px: "$3", py: "$3", bg: "$background", children: codeLines.map((line, idx) => (_jsxs(XStack, { gap: "$3", items: "flex-start", children: [_jsx(SizableText, { size: "$1", color: "$soft", width: 36, shrink: 0, text: "end", fontFamily: "$mono", opacity: 0.55, fontVariant: ['tabular-nums'], style: { userSelect: 'none' }, children: String(idx + 1) }), _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$ink", fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }, children: line || ' ' })] }, idx))) }));
|
|
404
469
|
}
|
|
405
470
|
/** The last lines a server wrote, as it wrote them. */
|
|
406
471
|
function Tail({ log }) {
|
package/dist/builder/forge.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
|
|
18
18
|
import { phrase } from '@hanzo/i18n';
|
|
19
19
|
import { useI18n } from '@hanzo/i18n/react';
|
|
20
|
-
import { ArrowRight, Check, ChevronDown, CircleCheck, CircleDot, CircleSlash, Copy, ExternalLink, FolderGit2, GitBranch, Github, GitPullRequest, LayoutTemplate, MoreHorizontal, RefreshCw, Search, SlidersHorizontal, Trash2, X, } from '@hanzogui/lucide-icons-2';
|
|
20
|
+
import { ArrowRight, Check, ChevronDown, CircleCheck, CircleDot, CircleSlash, Copy, ExternalLink, FolderGit2, GitBranch, GitFork, Github, GitPullRequest, LayoutTemplate, MoreHorizontal, Plus, RefreshCw, Search, SlidersHorizontal, Trash2, X, } from '@hanzogui/lucide-icons-2';
|
|
21
21
|
import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, Input, Skeleton, toast } from '@hanzo/ui';
|
|
22
22
|
import { useEffect, useMemo, useState } from 'react';
|
|
23
23
|
import { copy as toClipboard } from './clipboard.js';
|
|
@@ -25,7 +25,7 @@ import { RING, RING_INSET } from './pane.js';
|
|
|
25
25
|
import { ago } from './ago.js';
|
|
26
26
|
import { codebases, remove as removeRepo } from './api/codebases.js';
|
|
27
27
|
import { unlink as removeLink } from './api/links.js';
|
|
28
|
-
import { remove as removeProject } from './api/projects.js';
|
|
28
|
+
import { remove as removeProject, name as repoName } from './api/projects.js';
|
|
29
29
|
import { Scheduled } from './scheduled.js';
|
|
30
30
|
import { boards, everything, sources, UNREAD } from './api/work.js';
|
|
31
31
|
import { boardKey, pinRepo, readPending, writePending } from './choice.js';
|
|
@@ -35,9 +35,10 @@ import { useHost, useTarget } from './host.js';
|
|
|
35
35
|
import { path } from './route.js';
|
|
36
36
|
import { Customize } from './customize/index.js';
|
|
37
37
|
import { Sync } from './sync.js';
|
|
38
|
-
import { changed, connect, connection, disconnect as unlink, grants, heard, installations, linked, syncIssues } from './api/github.js';
|
|
38
|
+
import { changed, connect, connection, disconnect as unlink, githubRepoFrom, grants, heard, installations, linked, listGitTargets, syncIssues, } from './api/github.js';
|
|
39
39
|
import { disconnect } from './api/provider.js';
|
|
40
40
|
import { here, useBack } from './back.js';
|
|
41
|
+
import { GitHubBadge, GitHubReposModal, SyncToGitHubDialog } from './github-sync.js';
|
|
41
42
|
import { Out } from './out.js';
|
|
42
43
|
import { ask, assemble, attach, closes, facets, handle, home, keyOf, matches, pickProjects, place } from './merge.js';
|
|
43
44
|
import { removal, stopped } from './removal.js';
|
|
@@ -146,11 +147,52 @@ function Projects() {
|
|
|
146
147
|
const to = safePage * PAGE + slice.length;
|
|
147
148
|
const none = !list.loading && !list.error && list.value.length === 0 && pending.length === 0;
|
|
148
149
|
const open = (c) => host.go(path({ kind: 'repo', org: c.org || host.org || '', name: c.name }));
|
|
149
|
-
const
|
|
150
|
+
const [githubModal, setGitHubModal] = useState({ open: false, tab: 'browse' });
|
|
151
|
+
const openGitHubModal = (tab = 'browse') => setGitHubModal({ open: true, tab });
|
|
152
|
+
const link = () => openGitHubModal('browse');
|
|
150
153
|
const template = () => host.go(path({ kind: 'screen', screen: 'templates' }));
|
|
154
|
+
// Outbound GitHub mirror targets for visible repositories, plus optimistic sync state.
|
|
155
|
+
const [syncTarget, setSyncTarget] = useState(null);
|
|
156
|
+
const [syncedMap, setSyncedMap] = useState({});
|
|
157
|
+
const [rowTargets, setRowTargets] = useState({});
|
|
158
|
+
const visibleNames = slice.filter((c) => !syncing.has(c.name)).map((c) => c.name);
|
|
159
|
+
const visibleKey = visibleNames.join('\n');
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (!signed || !visibleKey)
|
|
162
|
+
return;
|
|
163
|
+
let stop = false;
|
|
164
|
+
const names = visibleKey.split('\n');
|
|
165
|
+
void Promise.all(names.map(async (n) => [n, await listGitTargets(target, n).catch(() => [])])).then((entries) => {
|
|
166
|
+
if (stop)
|
|
167
|
+
return;
|
|
168
|
+
setRowTargets((prev) => ({ ...prev, ...Object.fromEntries(entries) }));
|
|
169
|
+
});
|
|
170
|
+
return () => {
|
|
171
|
+
stop = true;
|
|
172
|
+
};
|
|
173
|
+
}, [signed, target, visibleKey, landed]);
|
|
151
174
|
// What each repository is tied to on Hanzo — the links into it, GitHub's names
|
|
152
175
|
// for the copies it made, the projects built from it — read for Remove alone.
|
|
153
176
|
const made = useRead(signed ? () => sources(target) : null, NONE, [target, signed, landed]);
|
|
177
|
+
const githubFor = (c) => {
|
|
178
|
+
if (syncedMap[c.name])
|
|
179
|
+
return syncedMap[c.name];
|
|
180
|
+
const directOrTarget = githubRepoFrom(c.clone, rowTargets[c.name]);
|
|
181
|
+
if (directOrTarget)
|
|
182
|
+
return directOrTarget;
|
|
183
|
+
const inbound = made.value.linked.find((l) => l.forge.toLowerCase() === c.name.toLowerCase());
|
|
184
|
+
if (inbound && inbound.owner && inbound.name) {
|
|
185
|
+
return {
|
|
186
|
+
owner: inbound.owner,
|
|
187
|
+
name: inbound.name,
|
|
188
|
+
fullName: `${inbound.owner}/${inbound.name}`,
|
|
189
|
+
htmlUrl: `https://github.com/${inbound.owner}/${inbound.name}`,
|
|
190
|
+
source: 'link',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const site = made.value.sites.find((s) => s.slug.toLowerCase() === c.name.toLowerCase() || (s.repo && repoName(s.repo).toLowerCase() === c.name.toLowerCase()));
|
|
194
|
+
return site?.repo ? githubRepoFrom(site.repo) : null;
|
|
195
|
+
};
|
|
154
196
|
const [confirming, setConfirming] = useState(null);
|
|
155
197
|
const [removing, setRemoving] = useState(false);
|
|
156
198
|
const [said, setSaid] = useState('');
|
|
@@ -195,15 +237,35 @@ function Projects() {
|
|
|
195
237
|
};
|
|
196
238
|
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 1040, mx: "auto", gap: "$4", children: [_jsxs(XStack, { justify: "space-between", items: "flex-start", gap: "$4", flexWrap: "wrap", children: [_jsxs(YStack, { gap: "$1", flex: 1, minW: 240, children: [_jsx(SizableText, { render: "h1", size: "$6", fontWeight: "500", color: "$ink", children: t('Projects') }), _jsx(SizableText, { size: "$2", color: "$soft", children: host.org
|
|
197
239
|
? t('{org}’s projects and linked GitHub repositories. Open one to work on it.', { org: host.org })
|
|
198
|
-
: t('Projects and linked GitHub repositories. Open one to work on it.') })] }), signed ? (_jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [_jsxs(Button, { size: "sm", variant: "outline", onPress: template, children: [_jsx(LayoutTemplate, { size: 14 }), t('Create from template')] }), _jsxs(Button, { size: "sm", variant: none ? 'outline' : 'primary', borderColor: none ? 'var(--border-strong)' : undefined, onPress: link, children: [_jsx(Github, { size: 14 }), t('Link a GitHub repo')] })] })) : null] }), signed ? _jsx(GitHubLink, { onSync:
|
|
240
|
+
: t('Projects and linked GitHub repositories. Open one to work on it.') })] }), signed ? (_jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [_jsxs(Button, { size: "sm", variant: "outline", onPress: template, children: [_jsx(LayoutTemplate, { size: 14 }), t('Create from template')] }), _jsxs(Button, { size: "sm", variant: none ? 'outline' : 'primary', borderColor: none ? 'var(--border-strong)' : undefined, onPress: link, children: [_jsx(Github, { size: 14 }), t('Link a GitHub repo')] })] })) : null] }), signed ? (_jsx(GitHubLink, { onSync: () => openGitHubModal('browse'), onCreate: () => openGitHubModal('create'), onFork: () => openGitHubModal('fork') })) : null, said ? (_jsx(SizableText, { size: "$2", color: saidError ? 'var(--state-error)' : '$soft', role: "status", children: said })) : null, list.error ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "var(--state-error)", text: "center", children: list.error.message }), _jsx(Button, { size: "sm", variant: "outline", onPress: list.reload, children: t('Try again') })] })) : !signed ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: t("Sign in to see this organization's projects.") }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.signIn?.(), children: t('Sign in') })] })) : list.loading && list.value.length === 0 && pending.length === 0 ? (_jsxs(YStack, { gap: "$3", "aria-busy": true, children: [_jsx(Note, { children: t('Loading projects…') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", bg: "$panel", overflow: "hidden", children: [0, 1, 2, 3].map((i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$3", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Skeleton, { layout: "block", width: 18, height: 18, rounded: "$2", shrink: 0 }), _jsxs(YStack, { flex: 1, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "38%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "56%", height: 12, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 64, height: 12, rounded: "$2", shrink: 0 })] }, i))) })] })) : none ? (_jsxs(YStack, { gap: "$4", children: [_jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$6", gap: "$1.5", items: "center", children: _jsx(SizableText, { size: "$2", color: "$soft", text: "center", maxW: 460, children: t('No projects yet. A project is a repository: link one from GitHub, or start one from a template.') }) }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", children: [_jsx(Choice, { label: t('Link a GitHub repo'), icon: _jsx(Github, { size: 20 }), says: t('Mirror repositories you already have. They stay in step with GitHub, and their issues can come too.'), onPress: link }), _jsx(Choice, { label: t('Create from template'), icon: _jsx(LayoutTemplate, { size: 20 }), says: t('Start from a finished product — a site, an app, a store — and make it yours.'), onPress: template })] })] })) : (_jsxs(_Fragment, { children: [_jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(YStack, { flex: 1, "$max-md": { display: 'none' } }), _jsx(YStack, { width: 320, minW: 0, shrink: 1, "$max-md": { width: 'auto', flex: 1 }, children: _jsx(Input, { value: q, onChangeText: setQ, placeholder: t('Find a project…'), "aria-label": t('Find a project'), startAdornment: _jsx(Search, { size: 14, color: "$soft", "aria-hidden": true }), endAdornment: q ? (_jsx(XStack, { render: "button", "aria-label": t('Clear search'), onPress: () => setQ(''), minW: 24, minH: 24, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(X, { size: 13, color: "$soft" }) })) : undefined, onKeyDown: (e) => {
|
|
199
241
|
if (e.key === 'Escape' && q)
|
|
200
242
|
setQ('');
|
|
201
|
-
} }) })] }), shown.length === 0 ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$7", gap: "$3", items: "center", children: [_jsx(Note, { children: t('Nothing matches.') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setQ(''), children: t('Clear search') })] })) : (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: [_jsxs(XStack, { px: "$3", py: "$2", gap: "$3", items: "center", bg: "$panel", children: [_jsxs(XStack, { flex: 1, minW: 0, render: "button", "aria-label": t('Sort by name'), items: "center", gap: "$1", onPress: () => setSort('name'), children: [_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: t('Name') }), sort === 'name' ? _jsx(ChevronDown, { size: 12 }) : null] }), _jsx(SizableText, { size: "$1", color: "$soft", width: 120, "$max-md": { display: 'none' }, children: t('Branch') }), _jsxs(XStack, { render: "button", "aria-label": t('Sort by last updated'), items: "center", justify: "flex-end", gap: "$1", width: 120, shrink: 0, "$max-md": { width: 84 }, onPress: () => setSort('updated'), children: [_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: t('Updated') }), sort === 'updated' ? _jsx(ChevronDown, { size: 12 }) : null] }), _jsx(YStack, { width: 32, shrink: 0 })] }), slice.map((c) => {
|
|
243
|
+
} }) })] }), shown.length === 0 ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$7", gap: "$3", items: "center", children: [_jsx(Note, { children: t('Nothing matches.') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setQ(''), children: t('Clear search') })] })) : (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: [_jsxs(XStack, { px: "$3", py: "$2", gap: "$3", items: "center", bg: "$panel", children: [_jsxs(XStack, { flex: 1, minW: 0, render: "button", "aria-label": t('Sort by name'), items: "center", gap: "$1", onPress: () => setSort('name'), children: [_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: t('Name') }), sort === 'name' ? _jsx(ChevronDown, { size: 12 }) : null] }), _jsx(SizableText, { size: "$1", color: "$soft", width: 120, "$max-md": { display: 'none' }, children: t('Branch') }), _jsxs(XStack, { render: "button", "aria-label": t('Sort by last updated'), items: "center", justify: "flex-end", gap: "$1", width: 120, shrink: 0, "$max-md": { width: 84 }, onPress: () => setSort('updated'), children: [_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: t('Updated') }), sort === 'updated' ? _jsx(ChevronDown, { size: 12 }) : null] }), _jsx(SizableText, { size: "$1", color: "$soft", width: 180, shrink: 0, text: "end", "$max-md": { display: 'none' }, children: "GitHub" }), _jsx(YStack, { width: 32, shrink: 0 })] }), slice.map((c) => {
|
|
202
244
|
const key = `${c.org}/${c.name}`;
|
|
203
245
|
const named = `${c.org ? `${c.org}/` : ''}${c.name}`;
|
|
204
246
|
const r = plan(c);
|
|
205
|
-
|
|
247
|
+
const gh = githubFor(c);
|
|
248
|
+
return (_jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", children: _jsxs(XStack, { items: "center", gap: "$3", paddingInlineEnd: "$3", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { render: "button", "aria-label": t('Open {repo}', { repo: named }), onPress: () => open(c), "$platform-web": { textAlign: 'start' }, flex: 1, minW: 0, items: "center", gap: "$3", paddingInlineStart: "$3", py: "$2.5", minH: 44, focusVisibleStyle: RING_INSET, children: [_jsx(XStack, { shrink: 0, children: _jsx(FolderGit2, { size: 15, color: "$soft", "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsxs(XStack, { minW: 0, maxW: "100%", overflow: "hidden", items: "baseline", self: "flex-start", 'data-i18n-ltr': '', children: [c.org ? (_jsx(SizableText, { size: "$2", color: "$soft", numberOfLines: 1, shrink: 100, minW: 0, children: `${c.org}/` })) : null, _jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", numberOfLines: 1, shrink: 1, minW: 0, children: c.name })] }), c.description ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: c.description })) : null, gh ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, display: "none", "$max-md": { display: 'flex' }, children: `GitHub · ${gh.fullName}` })) : null] }), _jsxs(XStack, { width: 120, items: "center", gap: "$1.5", minW: 0, "$max-md": { display: 'none' }, children: [_jsx(GitBranch, { size: 12, color: "$soft" }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: c.branch })] }), _jsx(SizableText, { size: "$1", color: "$soft", width: 120, shrink: 0, "$max-md": { width: 84 }, text: "end", numberOfLines: 1, children: syncing.has(c.name) ? t('Syncing…') : ago(c.updated) })] }), _jsx(XStack, { width: 180, justify: "flex-end", items: "center", gap: "$2", shrink: 0, "$max-md": { display: 'none' }, children: gh ? (_jsx(GitHubBadge, { fullName: gh.fullName, htmlUrl: gh.htmlUrl, compact: true })) : !syncing.has(c.name) ? (_jsxs(Button, { size: "sm", variant: "outline", "data-slot": "row-sync-github", "aria-label": t('Sync {repo} to GitHub', { repo: c.name }), onPress: () => setSyncTarget(c), children: [_jsx(Github, { size: 13 }), t('Sync to GitHub')] })) : null }), _jsx(XStack, { width: 32, shrink: 0, justify: "center", children: _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": t('Actions for {repo}', { repo: named }), disabled: removing, width: 32, height: 32, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(MoreHorizontal, { size: 16, color: "$soft" }) }), items: [
|
|
206
249
|
{ key: 'open', label: t('Open workspace'), icon: _jsx(ArrowRight, { size: 14 }), onSelect: () => open(c) },
|
|
250
|
+
...(gh
|
|
251
|
+
? [
|
|
252
|
+
{
|
|
253
|
+
key: 'open-github',
|
|
254
|
+
label: t('Open {repo} on GitHub', { repo: gh.fullName }),
|
|
255
|
+
icon: _jsx(ExternalLink, { size: 14 }),
|
|
256
|
+
onSelect: () => host.open(gh.htmlUrl),
|
|
257
|
+
},
|
|
258
|
+
]
|
|
259
|
+
: !syncing.has(c.name)
|
|
260
|
+
? [
|
|
261
|
+
{
|
|
262
|
+
key: 'sync-github',
|
|
263
|
+
label: t('Sync to GitHub'),
|
|
264
|
+
icon: _jsx(Github, { size: 14 }),
|
|
265
|
+
onSelect: () => setSyncTarget(c),
|
|
266
|
+
},
|
|
267
|
+
]
|
|
268
|
+
: []),
|
|
207
269
|
{ key: 'copy', label: t('Copy repository'), icon: _jsx(Copy, { size: 14 }), onSelect: () => copyRepo(named) },
|
|
208
270
|
...(r
|
|
209
271
|
? [
|
|
@@ -215,7 +277,14 @@ function Projects() {
|
|
|
215
277
|
}), _jsxs(XStack, { px: "$3", py: "$2", justify: "space-between", items: "center", gap: "$2", flexWrap: "wrap", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: t('Showing {from}–{to} of {total}', { from, to, total: shown.length }) }), _jsxs(XStack, { gap: "$3", items: "center", children: [_jsx(XStack, { render: "button", "aria-label": t('Previous page'), disabled: safePage === 0, onPress: () => setPage(safePage - 1), children: _jsx(SizableText, { size: "$1", color: safePage === 0 ? '$soft' : '$ink', children: t('Prev') }) }), _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: `${safePage + 1} / ${pages}` }), _jsx(XStack, { render: "button", "aria-label": t('Next page'), disabled: safePage >= pages - 1, onPress: () => setPage(safePage + 1), children: _jsx(SizableText, { size: "$1", color: safePage >= pages - 1 ? '$soft' : '$ink', children: t('Next') }) })] })] })] }))] }))] }), _jsx(Confirm, { open: confirming !== null, onOpenChange: (o) => !o && !removing && setConfirming(null), title: confirming ? t('Remove {repo}?', { repo: confirming.repo }) : t('Remove project?'), says: confirming?.says ?? '', act: t('Remove'), run: async () => {
|
|
216
278
|
if (confirming)
|
|
217
279
|
await remove(confirming);
|
|
218
|
-
} })
|
|
280
|
+
} }), _jsx(GitHubReposModal, { open: githubModal.open, initialTab: githubModal.tab, onOpenChange: (o) => setGitHubModal((prev) => ({ ...prev, open: o })), onChanged: () => {
|
|
281
|
+
list.reload();
|
|
282
|
+
made.reload();
|
|
283
|
+
setLanded((n) => n + 1);
|
|
284
|
+
} }), syncTarget ? (_jsx(SyncToGitHubDialog, { open: true, onOpenChange: (o) => !o && setSyncTarget(null), repoName: syncTarget.name, defaultName: syncTarget.name, defaultDescription: syncTarget.description, onSynced: (info) => {
|
|
285
|
+
setSyncedMap((prev) => ({ ...prev, [syncTarget.name]: info }));
|
|
286
|
+
setLanded((n) => n + 1);
|
|
287
|
+
} })) : null] }));
|
|
219
288
|
}
|
|
220
289
|
/** One of the two ways in, as a card you press. */
|
|
221
290
|
function Choice({ label, icon, says, onPress }) {
|
|
@@ -235,7 +304,7 @@ function Choice({ label, icon, says, onPress }) {
|
|
|
235
304
|
* A change made here, in Settings or in the Hanzo app's Quick setup is said on
|
|
236
305
|
* the window (api/github.ts `changed`), and this line reads it again.
|
|
237
306
|
*/
|
|
238
|
-
function GitHubLink({ onSync }) {
|
|
307
|
+
function GitHubLink({ onSync, onCreate, onFork, }) {
|
|
239
308
|
const host = useHost();
|
|
240
309
|
const target = useTarget();
|
|
241
310
|
const { t } = useI18n();
|
|
@@ -290,7 +359,7 @@ function GitHubLink({ onSync }) {
|
|
|
290
359
|
? own
|
|
291
360
|
? t('Disconnect your GitHub from Hanzo?')
|
|
292
361
|
: t('Disconnect @{login}? Hanzo’s GitHub App is removed from it too, unless another organization uses it.', { login: c.login })
|
|
293
|
-
: note || (c.connected ? t('Choose repositories to mirror; each stays in step with GitHub.') : t('One step on GitHub, then pick the repositories to sync.')) })] }), c.connected && asking ? (_jsxs(XStack, { gap: "$2", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: () => setAsking(false), children: t('Cancel') }), _jsx(Button, { size: "sm", variant: "primary", disabled: busy, onPress: () => void drop(), children: busy ? t('Disconnecting…') : t('Confirm disconnect') })] })) : c.connected ? (_jsxs(XStack, { gap: "$2", children: [_jsxs(Button, { size: "sm", variant: "outline", onPress: onSync, children: [_jsx(RefreshCw, { size: 14 }), t('Sync repositories')] }), leave ? (_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: () => setAsking(true), children: t('Disconnect') })) : null] })) : (_jsxs(Button, { size: "sm", variant: "primary", disabled: busy, onPress: () => void link(), children: [_jsx(Github, { size: 14 }), busy ? t('Opening GitHub…') : t('Connect GitHub')] }))] }));
|
|
362
|
+
: note || (c.connected ? t('Choose repositories to mirror; each stays in step with GitHub.') : t('One step on GitHub, then pick the repositories to sync.')) })] }), c.connected && asking ? (_jsxs(XStack, { gap: "$2", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: () => setAsking(false), children: t('Cancel') }), _jsx(Button, { size: "sm", variant: "primary", disabled: busy, onPress: () => void drop(), children: busy ? t('Disconnecting…') : t('Confirm disconnect') })] })) : c.connected ? (_jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsxs(Button, { size: "sm", variant: "outline", onPress: onSync, children: [_jsx(RefreshCw, { size: 14 }), t('Sync repositories')] }), onCreate ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: onCreate, children: [_jsx(Plus, { size: 14 }), t('Create new repo')] })) : null, onFork ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: onFork, children: [_jsx(GitFork, { size: 14 }), t('Fork repo')] })) : null, leave ? (_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onPress: () => setAsking(true), children: t('Disconnect') })) : null] })) : (_jsxs(Button, { size: "sm", variant: "primary", disabled: busy, onPress: () => void link(), children: [_jsx(Github, { size: 14 }), busy ? t('Opening GitHub…') : t('Connect GitHub')] }))] }));
|
|
294
363
|
}
|
|
295
364
|
/** The menus' words, marked (`phrase`) and drawn through `t`; GitHub and Hanzo are names, drawn as given. */
|
|
296
365
|
const KINDS = { all: phrase('Issues and pull requests'), issue: phrase('Issues'), pr: phrase('Pull requests') };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type CreatedRepo, type GitHubRepoBadgeInfo } from './api/github.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Crisp monochrome GitHub badge/link (`owner/repo ↗`) with optional sync status.
|
|
4
|
+
*/
|
|
5
|
+
export declare function GitHubBadge({ fullName, htmlUrl, syncedLabel, compact, }: {
|
|
6
|
+
fullName: string;
|
|
7
|
+
htmlUrl: string;
|
|
8
|
+
syncedLabel?: string;
|
|
9
|
+
compact?: boolean;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* 1-click user OAuth fallback callout shown when creating/forking under a
|
|
13
|
+
* personal GitHub account returns HTTP 412 or 409.
|
|
14
|
+
*/
|
|
15
|
+
export declare function GitHubOAuthCallout({ message, label, }: {
|
|
16
|
+
message?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Form to create a new GitHub repository (`POST /v1/provider/github/repos`).
|
|
21
|
+
* Handles 412/409 personal account OAuth requirement with a 1-click CTA.
|
|
22
|
+
*/
|
|
23
|
+
export declare function CreateGitHubRepoForm({ defaultName, defaultDescription, linkRepo, orgs, submitLabel, oauthLabel, onCreated, onCancel, }: {
|
|
24
|
+
defaultName?: string;
|
|
25
|
+
defaultDescription?: string;
|
|
26
|
+
/** Hanzo Git repo slug to link and push immediately after creation. */
|
|
27
|
+
linkRepo?: string;
|
|
28
|
+
orgs?: string[];
|
|
29
|
+
submitLabel?: string;
|
|
30
|
+
oauthLabel?: string;
|
|
31
|
+
onCreated: (repo: CreatedRepo) => void | Promise<void>;
|
|
32
|
+
onCancel?: () => void;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Form to fork a GitHub repository (`POST /v1/provider/github/fork`).
|
|
36
|
+
* Supports `owner/repo`, GitHub URLs, and bare repository names.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ForkGitHubRepoForm({ orgs, submitLabel, onForked, onCancel, }: {
|
|
39
|
+
orgs?: string[];
|
|
40
|
+
submitLabel?: string;
|
|
41
|
+
onForked: (repo: CreatedRepo) => void | Promise<void>;
|
|
42
|
+
onCancel?: () => void;
|
|
43
|
+
}): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Dialog to sync a Hanzo Git project to GitHub:
|
|
46
|
+
* - Create & sync a new GitHub repository (`POST /v1/provider/github/repos` with `linkRepo`), OR
|
|
47
|
+
* - Link an existing GitHub repository URL (`POST /v1/git/repos/:name/targets`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function SyncToGitHubDialog({ open, onOpenChange, repoName, defaultName, defaultDescription, onSynced, }: {
|
|
50
|
+
open: boolean;
|
|
51
|
+
onOpenChange: (open: boolean) => void;
|
|
52
|
+
repoName: string;
|
|
53
|
+
defaultName?: string;
|
|
54
|
+
defaultDescription?: string;
|
|
55
|
+
onSynced: (info: GitHubRepoBadgeInfo) => void;
|
|
56
|
+
}): import("react").JSX.Element;
|
|
57
|
+
/**
|
|
58
|
+
* Modal/drawer experience for "Link a GitHub repo" / "Sync repositories" on `/dev/projects`:
|
|
59
|
+
* - When connected with 0 repositories, presents first-class "Create a new GitHub repository"
|
|
60
|
+
* and "Fork a GitHub repository" actions instead of a dead-end empty state.
|
|
61
|
+
* - When repositories are listed, provides instant search, 1-click "Import & edit in /dev",
|
|
62
|
+
* and clean access to "Create new repo" and "Fork repo".
|
|
63
|
+
* - Responsive from 390px mobile to 1440px desktop with zero overlap.
|
|
64
|
+
*/
|
|
65
|
+
export declare function GitHubReposModal({ open, onOpenChange, initialTab, onChanged, }: {
|
|
66
|
+
open: boolean;
|
|
67
|
+
onOpenChange: (open: boolean) => void;
|
|
68
|
+
initialTab?: 'browse' | 'create' | 'fork';
|
|
69
|
+
onChanged?: () => void;
|
|
70
|
+
}): import("react").JSX.Element;
|