@open-document/core 0.17.0 → 0.17.2

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.
Files changed (43) hide show
  1. package/dist/{build-BzNZnIhF.js → build-CryLx-8O.js} +1 -1
  2. package/dist/{check-C7kxlAFW.js → check-BU86QFnH.js} +3 -3
  3. package/dist/cli/bin.js +12 -12
  4. package/dist/{context-CFPnmNCR.js → context-DHCqEAue.js} +2 -2
  5. package/dist/{deploy-gcp-BUiSuqz7.js → deploy-gcp-bbxQT0gf.js} +1 -1
  6. package/dist/{dev-BUo7OESU.js → dev-Dmi2PnqI.js} +1 -1
  7. package/dist/{diff-B950T0O6.js → diff-HVSJapV4.js} +2 -2
  8. package/dist/{export-CHN1CiGv.js → export-CDobz0UO.js} +3 -3
  9. package/dist/{import-CLSnIxvN.js → import-BUHNpf-a.js} +3 -3
  10. package/dist/{open-doc-plugin-DnX5usgI.js → open-doc-plugin-DE1sJXK_.js} +3 -2
  11. package/dist/ops/index.js +2 -2
  12. package/dist/{ops-BgbM5Irm.js → ops-DKEhE_su.js} +1 -1
  13. package/dist/{preview-BVwVqS-I.js → preview-Do-31RB6.js} +1 -1
  14. package/dist/{proofread-BpR_3GZz.js → proofread-C0crhm3C.js} +3 -3
  15. package/dist/{session-DmbXf3u7.js → session-CcIBEiIB.js} +181 -112
  16. package/dist/{templates-BsWxs7oo.js → templates-hcl2pb6n.js} +3 -3
  17. package/dist/{translations-CW5OVM0L.js → translations-x2NwYrcj.js} +2 -2
  18. package/dist/vite/index.d.ts +2 -0
  19. package/dist/vite/index.js +2 -2
  20. package/package.json +1 -1
  21. package/skills/doc-authoring/SKILL.md +10 -12
  22. package/src/app/components/agent/agent-dock.tsx +1 -1
  23. package/src/app/components/agent/transcript.tsx +2 -4
  24. package/src/app/components/browser/browser-ui.tsx +8 -2
  25. package/src/app/components/comments/comments-panel.tsx +9 -5
  26. package/src/app/components/doc-assets.tsx +9 -5
  27. package/src/app/components/panel/panel-shell.tsx +3 -1
  28. package/src/app/components/sidebar/sidebar.tsx +2 -1
  29. package/src/app/lib/ask.ts +113 -0
  30. package/src/app/lib/clipboard.ts +26 -0
  31. package/src/app/lib/export-pdf.ts +18 -0
  32. package/src/app/lib/i18n-ja/browser.ts +1 -0
  33. package/src/app/lib/i18n-ja/doc.ts +9 -0
  34. package/src/app/lib/i18n-ko/browser.ts +1 -0
  35. package/src/app/lib/i18n-ko/doc.ts +7 -0
  36. package/src/app/lib/i18n-zh-cn/browser.ts +1 -0
  37. package/src/app/lib/i18n-zh-cn/doc.ts +7 -0
  38. package/src/app/lib/i18n-zh-tw/browser.ts +1 -0
  39. package/src/app/lib/i18n-zh-tw/doc.ts +7 -0
  40. package/src/app/routes/assets.tsx +19 -12
  41. package/src/app/routes/doc.tsx +218 -64
  42. package/src/app/routes/home.tsx +27 -19
  43. package/src/app/virtual.d.ts +1 -1
@@ -6,6 +6,7 @@ import {
6
6
  Check,
7
7
  ChevronDown,
8
8
  Download,
9
+ Ellipsis,
9
10
  Eye,
10
11
  FileCode2,
11
12
  FileImage,
@@ -65,10 +66,12 @@ import {
65
66
  useAgentStatus,
66
67
  } from '../lib/agent/use-agent';
67
68
  import { useAgentBridge } from '../lib/agent-bridge';
69
+ import { copyText } from '../lib/clipboard';
68
70
  import { exportDocAsDocx } from '../lib/export-docx';
71
+ import { downloadBlob, downloadName } from '../lib/export-dom';
69
72
  import { exportDocAsHtml } from '../lib/export-html';
70
73
  import { exportDocAsImages } from '../lib/export-image';
71
- import { exportDocAsPdf } from '../lib/export-pdf';
74
+ import { exportDocAsPdf, PrintBlockedError } from '../lib/export-pdf';
72
75
  import { useLocale, useT } from '../lib/i18n';
73
76
  import { type OutlineEntry, useDocOutline } from '../lib/outline';
74
77
  import {
@@ -82,6 +85,7 @@ import { markDocOpened } from '../lib/recent-docs';
82
85
  import { getRecordState, setRecords, useRecordIndex } from '../lib/records';
83
86
  import { scanDocument } from '../lib/scan';
84
87
  import { pageLang, resolvePageGeometry } from '../lib/sdk';
88
+ import { toast } from '../lib/toast';
85
89
  import { useDocModule } from '../lib/use-doc-module';
86
90
  import { useDocPages } from '../lib/use-doc-pages';
87
91
  import { cn } from '../lib/utils';
@@ -554,6 +558,33 @@ export function Doc() {
554
558
  return onPage[0]?.id ?? null;
555
559
  }, [outline, currentPage]);
556
560
 
561
+ /*
562
+ * A frame that may not print (VS Code's webviews) gets the PDF the CLI makes, from the
563
+ * dev server. It renders the whole document: the server has no page range to obey.
564
+ */
565
+ const pdfFromServer = async (partial: boolean): Promise<boolean> => {
566
+ if (!doc || !docId) return false;
567
+ if (!import.meta.env.DEV) {
568
+ toast.error(t('This window cannot print'), {
569
+ description: t('Open the document in a browser to save a PDF.'),
570
+ });
571
+ return false;
572
+ }
573
+ const res = await fetch(`/__docs/${encodeURIComponent(docId)}/pdf`, { method: 'POST' });
574
+ if (!res.ok) {
575
+ const body = (await res.json().catch(() => ({}))) as { error?: string };
576
+ toast.error(t('Could not make the PDF'), { description: body.error ?? res.statusText });
577
+ return false;
578
+ }
579
+ downloadBlob(await res.blob(), `${downloadName(doc, docId)}.pdf`);
580
+ if (partial) {
581
+ toast.success(t('Saved the whole document'), {
582
+ description: t('This window cannot print a page range.'),
583
+ });
584
+ }
585
+ return true;
586
+ };
587
+
557
588
  const runDownload = async (format: DownloadFormat) => {
558
589
  if (!doc || !docId || download) return;
559
590
 
@@ -574,9 +605,14 @@ export function Doc() {
574
605
  setDownload({ format, percent: 0 });
575
606
  try {
576
607
  if (format === 'pdf') {
577
- await exportDocAsPdf(doc, docId, chosen, (progress) =>
578
- setDownload({ format, percent: progress.percent }),
579
- );
608
+ try {
609
+ await exportDocAsPdf(doc, docId, chosen, (progress) =>
610
+ setDownload({ format, percent: progress.percent }),
611
+ );
612
+ } catch (err) {
613
+ if (!(err instanceof PrintBlockedError)) throw err;
614
+ if (!(await pdfFromServer(chosen.length < pages.length))) return;
615
+ }
580
616
  } else if (format === 'html') {
581
617
  await exportDocAsHtml(doc, docId, chosen);
582
618
  } else if (format === 'docx') {
@@ -846,9 +882,13 @@ export function Doc() {
846
882
  (page, zoom, layout, fullscreen), and what you do to the document
847
883
  (search, edit, design, download). The middle rail is `auto` between
848
884
  two equal `1fr` rails, so it sits at the true centre of the bar while
849
- the title truncates before anything is overlapped. */}
850
- <header className="grid h-12 flex-none grid-cols-[1fr_auto_1fr] items-center gap-3 border-b border-border px-3">
851
- <div className="flex min-w-0 items-center gap-1">
885
+ the title truncates before anything is overlapped. Below xl the bar is
886
+ a plain row: the title takes what is left, the view controls drop out
887
+ by width (zoom and layout below lg, the page counter below sm), labels
888
+ fold to icons, and below sm Changes, Comments and Copy link move into
889
+ a More menu, so nothing is pushed off the edge. */}
890
+ <header className="flex h-12 flex-none items-center gap-2 border-b border-border px-3 xl:grid xl:grid-cols-[1fr_auto_1fr] xl:gap-3">
891
+ <div className="flex min-w-0 flex-1 items-center gap-1">
852
892
  <HeaderBackLink />
853
893
  <h1 className="truncate font-medium text-sm">{doc.meta?.title ?? docId}</h1>
854
894
  {doc.records && doc.records.length > 0 && (
@@ -856,50 +896,58 @@ export function Doc() {
856
896
  )}
857
897
  </div>
858
898
 
859
- <div className="hidden items-center gap-2 sm:flex">
899
+ <div className="hidden flex-none items-center gap-2 sm:flex">
860
900
  <PageJump page={currentPage} total={pages.length} onJump={scrollToPage} />
861
- <Divider />
862
- <ZoomControl
863
- scale={scale}
864
- fit={manualScale === null ? zoomMode : null}
865
- onStep={zoom}
866
- onSet={setZoom}
867
- onFit={fitTo}
868
- />
869
- <Divider />
870
- <fieldset className="flex items-center gap-0.5">
871
- <legend className="sr-only">{t('Page layout')}</legend>
872
- <IconButton
873
- label={t('Continuous')}
874
- active={viewMode === 'continuous'}
875
- onClick={() => setViewMode('continuous')}
876
- >
877
- <Rows3 className="size-3.5" />
878
- </IconButton>
879
- <IconButton
880
- label={t('Two-up')}
881
- active={viewMode === 'spread'}
882
- onClick={() => setViewMode('spread')}
883
- >
884
- <BookOpen className="size-3.5" />
885
- </IconButton>
886
- <IconButton
887
- label={t('Grid')}
888
- active={viewMode === 'grid'}
889
- onClick={() => setViewMode('grid')}
890
- >
891
- <LayoutGrid className="size-3.5" />
892
- </IconButton>
893
- </fieldset>
894
- <IconButton
895
- label={isFullscreen ? t('Exit fullscreen (F)') : t('Fullscreen (F)')}
896
- onClick={toggleFullscreen}
897
- >
898
- {isFullscreen ? <Minimize className="size-3.5" /> : <Maximize className="size-3.5" />}
899
- </IconButton>
901
+ <div className="hidden items-center gap-2 lg:flex">
902
+ <Divider />
903
+ <ZoomControl
904
+ scale={scale}
905
+ fit={manualScale === null ? zoomMode : null}
906
+ onStep={zoom}
907
+ onSet={setZoom}
908
+ onFit={fitTo}
909
+ />
910
+ <Divider />
911
+ <fieldset className="flex items-center gap-0.5">
912
+ <legend className="sr-only">{t('Page layout')}</legend>
913
+ <IconButton
914
+ label={t('Continuous')}
915
+ active={viewMode === 'continuous'}
916
+ onClick={() => setViewMode('continuous')}
917
+ >
918
+ <Rows3 className="size-3.5" />
919
+ </IconButton>
920
+ <IconButton
921
+ label={t('Two-up')}
922
+ active={viewMode === 'spread'}
923
+ onClick={() => setViewMode('spread')}
924
+ >
925
+ <BookOpen className="size-3.5" />
926
+ </IconButton>
927
+ <IconButton
928
+ label={t('Grid')}
929
+ active={viewMode === 'grid'}
930
+ onClick={() => setViewMode('grid')}
931
+ >
932
+ <LayoutGrid className="size-3.5" />
933
+ </IconButton>
934
+ </fieldset>
935
+ {document.fullscreenEnabled && (
936
+ <IconButton
937
+ label={isFullscreen ? t('Exit fullscreen (F)') : t('Fullscreen (F)')}
938
+ onClick={toggleFullscreen}
939
+ >
940
+ {isFullscreen ? (
941
+ <Minimize className="size-3.5" />
942
+ ) : (
943
+ <Maximize className="size-3.5" />
944
+ )}
945
+ </IconButton>
946
+ )}
947
+ </div>
900
948
  </div>
901
949
 
902
- <div className="flex items-center justify-end gap-2">
950
+ <div className="flex flex-none items-center justify-end gap-1.5 sm:gap-2">
903
951
  <DocSearch scrollRef={scrollRef} pagesRef={pagesRef} onFoundPage={setCurrentPage} />
904
952
 
905
953
  {import.meta.env.DEV && (
@@ -935,10 +983,10 @@ export function Doc() {
935
983
  )}
936
984
  >
937
985
  <Palette className="size-3.5" />
938
- {t('Design')}
986
+ <span className="hidden lg:inline">{t('Design')}</span>
939
987
  <kbd
940
988
  aria-hidden
941
- className="hidden rounded-sm bg-foreground/10 px-1 font-mono text-[9.5px] text-muted-foreground md:inline"
989
+ className="hidden rounded-sm bg-foreground/10 px-1 font-mono text-[9.5px] text-muted-foreground lg:inline"
942
990
  >
943
991
  D
944
992
  </kbd>
@@ -957,12 +1005,12 @@ export function Doc() {
957
1005
  title={`${t('Changes since the last commit')} (C)`}
958
1006
  onClick={() => toggleDock('changes')}
959
1007
  className={cn(
960
- 'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
1008
+ 'hidden flex-none sm:flex items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
961
1009
  changesOpen && 'bg-accent',
962
1010
  )}
963
1011
  >
964
1012
  <GitCompare className="size-3.5" />
965
- <span className="hidden lg:inline">{t('Changes')}</span>
1013
+ <span className="hidden xl:inline">{t('Changes')}</span>
966
1014
  {changeItems.length > 0 && (
967
1015
  <span
968
1016
  aria-hidden
@@ -987,12 +1035,12 @@ export function Doc() {
987
1035
  title={`${t('Comments')} (M)`}
988
1036
  onClick={() => toggleDock('comments')}
989
1037
  className={cn(
990
- 'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
1038
+ 'hidden flex-none sm:flex items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
991
1039
  commentsOpen && 'bg-accent',
992
1040
  )}
993
1041
  >
994
1042
  <MessageSquare className="size-3.5" />
995
- <span className="hidden lg:inline">{t('Comments')}</span>
1043
+ <span className="hidden xl:inline">{t('Comments')}</span>
996
1044
  {commentList.length > 0 && (
997
1045
  <span
998
1046
  aria-hidden
@@ -1023,7 +1071,29 @@ export function Doc() {
1023
1071
  </button>
1024
1072
  )}
1025
1073
 
1026
- <CopyLink />
1074
+ <div className="hidden sm:contents">
1075
+ <CopyLink />
1076
+ </div>
1077
+ <MoreMenu
1078
+ changes={
1079
+ import.meta.env.DEV
1080
+ ? {
1081
+ open: changesOpen,
1082
+ count: changeItems.length,
1083
+ toggle: () => toggleDock('changes'),
1084
+ }
1085
+ : null
1086
+ }
1087
+ comments={
1088
+ import.meta.env.DEV
1089
+ ? {
1090
+ open: commentsOpen,
1091
+ count: commentList.length,
1092
+ toggle: () => toggleDock('comments'),
1093
+ }
1094
+ : null
1095
+ }
1096
+ />
1027
1097
 
1028
1098
  {/* The document browser normally carries this. A viewer mounted with
1029
1099
  `showDocBrowser: false` never shows that shell, and without it a
@@ -1036,6 +1106,8 @@ export function Doc() {
1036
1106
  <button
1037
1107
  type="button"
1038
1108
  disabled={download !== null}
1109
+ aria-label={download ? undefined : t('Download')}
1110
+ title={t('Download')}
1039
1111
  className="flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md bg-primary px-2.5 py-1.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 disabled:opacity-70 aria-expanded:opacity-90"
1040
1112
  {...props}
1041
1113
  >
@@ -1046,9 +1118,11 @@ export function Doc() {
1046
1118
  ) : (
1047
1119
  <Download className="size-3.5" />
1048
1120
  )}
1049
- {download
1050
- ? `${t(DOWNLOAD_LABEL[download.format])} ${Math.round(download.percent)}%`
1051
- : t('Download')}
1121
+ {download ? (
1122
+ `${t(DOWNLOAD_LABEL[download.format])} ${Math.round(download.percent)}%`
1123
+ ) : (
1124
+ <span className="hidden md:inline">{t('Download')}</span>
1125
+ )}
1052
1126
  </button>
1053
1127
  )}
1054
1128
  >
@@ -1097,7 +1171,8 @@ export function Doc() {
1097
1171
  </div>
1098
1172
  </header>
1099
1173
 
1100
- <div className="flex min-h-0 flex-1">
1174
+ {/* Positioned: below md the right dock floats over the pages from here. */}
1175
+ <div className="relative flex min-h-0 flex-1">
1101
1176
  <DocSidebar
1102
1177
  docId={docId ?? ''}
1103
1178
  pages={pages}
@@ -1585,6 +1660,83 @@ function ZoomControl({
1585
1660
  }
1586
1661
 
1587
1662
  /** The page as it is — document, and the reader's place in it — on the clipboard. */
1663
+ type DockToggle = { open: boolean; count: number; toggle: () => void } | null;
1664
+
1665
+ /** Below sm the header has no room for Changes, Comments and Copy link; they live here. */
1666
+ function MoreMenu({ changes, comments }: { changes: DockToggle; comments: DockToggle }) {
1667
+ const t = useT();
1668
+ const item = 'size-4 flex-none text-muted-foreground';
1669
+ return (
1670
+ <div className="sm:hidden">
1671
+ <Menu
1672
+ className="w-48 p-1.5"
1673
+ trigger={(props) => (
1674
+ <button
1675
+ type="button"
1676
+ aria-label={t('More')}
1677
+ title={t('More')}
1678
+ className="flex size-8 flex-none items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground"
1679
+ {...props}
1680
+ >
1681
+ <Ellipsis className="size-4" />
1682
+ </button>
1683
+ )}
1684
+ >
1685
+ {(close) => (
1686
+ <>
1687
+ {changes && (
1688
+ <MenuItem
1689
+ active={changes.open}
1690
+ onClick={() => {
1691
+ close();
1692
+ changes.toggle();
1693
+ }}
1694
+ >
1695
+ <GitCompare className={item} />
1696
+ <span className="flex-1">{t('Changes')}</span>
1697
+ {changes.count > 0 && (
1698
+ <span className="font-mono text-[10px] text-muted-foreground tabular-nums">
1699
+ {changes.count}
1700
+ </span>
1701
+ )}
1702
+ </MenuItem>
1703
+ )}
1704
+ {comments && (
1705
+ <MenuItem
1706
+ active={comments.open}
1707
+ onClick={() => {
1708
+ close();
1709
+ comments.toggle();
1710
+ }}
1711
+ >
1712
+ <MessageSquare className={item} />
1713
+ <span className="flex-1">{t('Comments')}</span>
1714
+ {comments.count > 0 && (
1715
+ <span className="font-mono text-[10px] text-muted-foreground tabular-nums">
1716
+ {comments.count}
1717
+ </span>
1718
+ )}
1719
+ </MenuItem>
1720
+ )}
1721
+ <MenuItem
1722
+ onClick={() => {
1723
+ close();
1724
+ const href = window.location.href;
1725
+ void copyText(href).then(
1726
+ (ok) => ok || toast.error(t('Copying is blocked here'), { description: href }),
1727
+ );
1728
+ }}
1729
+ >
1730
+ <Link2 className={item} />
1731
+ <span className="flex-1">{t('Copy link')}</span>
1732
+ </MenuItem>
1733
+ </>
1734
+ )}
1735
+ </Menu>
1736
+ </div>
1737
+ );
1738
+ }
1739
+
1588
1740
  function CopyLink() {
1589
1741
  const t = useT();
1590
1742
  const [copied, setCopied] = useState(false);
@@ -1594,11 +1746,13 @@ function CopyLink() {
1594
1746
  aria-label={copied ? t('Link copied') : t('Copy link')}
1595
1747
  title={t('Copy link')}
1596
1748
  onClick={async () => {
1597
- try {
1598
- await navigator.clipboard.writeText(window.location.href);
1599
- setCopied(true);
1600
- setTimeout(() => setCopied(false), 1500);
1601
- } catch {}
1749
+ const href = window.location.href;
1750
+ if (!(await copyText(href))) {
1751
+ toast.error(t('Copying is blocked here'), { description: href });
1752
+ return;
1753
+ }
1754
+ setCopied(true);
1755
+ setTimeout(() => setCopied(false), 1500);
1602
1756
  }}
1603
1757
  className="flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
1604
1758
  >
@@ -34,6 +34,7 @@ import { DOC_DND_MIME } from '../components/sidebar/folder-item';
34
34
  import { ALL_DOCS_ID, DRAFT_ID } from '../components/sidebar/sidebar';
35
35
  import { Menu, MenuItem, MenuSeparator } from '../components/ui/menu';
36
36
  import { useAgentStatus, useCreateDoc } from '../lib/agent/use-agent';
37
+ import { askConfirm, askText } from '../lib/ask';
37
38
  import { coverContent } from '../lib/doc-preview';
38
39
  import { docCreatedAt, docIds, docThemes, docTitles } from '../lib/docs';
39
40
  import { type Translate, useLocale, useT } from '../lib/i18n';
@@ -112,10 +113,12 @@ export function Home() {
112
113
  <button
113
114
  type="button"
114
115
  onClick={() => setCreating(true)}
115
- className="flex h-8 items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
116
+ aria-label={t('New document')}
117
+ title={t('New document')}
118
+ className="flex h-8 flex-none items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
116
119
  >
117
120
  <Plus className="size-3.5" />
118
- {t('New document')}
121
+ <span className="hidden @md:inline">{t('New document')}</span>
119
122
  </button>
120
123
  </>
121
124
  );
@@ -178,11 +181,12 @@ export function Home() {
178
181
  <button
179
182
  type="button"
180
183
  aria-label={t('Sort: {label}', { label: t(currentSort.label) })}
181
- className="flex h-8 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs transition-colors hover:bg-accent aria-expanded:bg-accent"
184
+ title={t(currentSort.label)}
185
+ className="flex h-8 flex-none items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs transition-colors hover:bg-accent aria-expanded:bg-accent"
182
186
  {...props}
183
187
  >
184
188
  <currentSort.icon className="size-3.5 text-muted-foreground" />
185
- {t(currentSort.label)}
189
+ <span className="hidden @lg:inline">{t(currentSort.label)}</span>
186
190
  <ChevronDown className="size-3 text-muted-foreground" />
187
191
  </button>
188
192
  )}
@@ -204,7 +208,7 @@ export function Home() {
204
208
  ))
205
209
  }
206
210
  </Menu>
207
- <label className="flex h-8 w-56 items-center gap-2 rounded-md border border-border bg-background px-2.5 text-xs focus-within:border-foreground focus-within:ring-2 focus-within:ring-primary/30">
211
+ <label className="flex h-8 min-w-0 flex-1 items-center gap-2 @2xl:w-56 @2xl:flex-none rounded-md border border-border bg-background px-2.5 text-xs focus-within:border-foreground focus-within:ring-2 focus-within:ring-primary/30">
208
212
  <Search className="size-3.5 flex-none text-muted-foreground" />
209
213
  <input
210
214
  type="search"
@@ -390,8 +394,12 @@ function DocCard({
390
394
  <MenuItem
391
395
  onClick={() => {
392
396
  close();
393
- const next = window.prompt(t('Document title'), title);
394
- if (next && next !== title) void run(() => ctx.renameDoc(docId, next));
397
+ void askText(t('Document title'), title, {
398
+ ok: t('Rename'),
399
+ cancel: t('Cancel'),
400
+ }).then((next) => {
401
+ if (next && next !== title) void run(() => ctx.renameDoc(docId, next));
402
+ });
395
403
  }}
396
404
  >
397
405
  <PencilLine className="size-3.5" />
@@ -443,16 +451,15 @@ function DocCard({
443
451
  destructive
444
452
  onClick={() => {
445
453
  close();
446
- if (
447
- !window.confirm(
448
- t('Delete "{title}"? This removes docs/{id}/ from disk.', {
449
- title,
450
- id: docId,
451
- }),
452
- )
453
- )
454
- return;
455
- void run(() => ctx.deleteDoc(docId));
454
+ void askConfirm(
455
+ t('Delete "{title}"? This removes docs/{id}/ from disk.', {
456
+ title,
457
+ id: docId,
458
+ }),
459
+ { ok: t('Delete'), cancel: t('Cancel'), destructive: true },
460
+ ).then((yes) => {
461
+ if (yes) void run(() => ctx.deleteDoc(docId));
462
+ });
456
463
  }}
457
464
  >
458
465
  <Trash2 className="size-3.5" />
@@ -478,19 +485,20 @@ function DraftWithAgentButton() {
478
485
  <button
479
486
  type="button"
480
487
  onClick={() => void start()}
488
+ aria-label={t.agent.createDoc}
481
489
  title={
482
490
  provider
483
491
  ? format(t.agent.createDocWith, { provider: provider.name })
484
492
  : t.agent.quickCreateHint
485
493
  }
486
- className="flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
494
+ className="flex h-8 flex-none items-center gap-1.5 rounded-md border border-border px-2.5 text-xs transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
487
495
  >
488
496
  {provider ? (
489
497
  <ProviderLogo provider={provider.id} className="size-3.5" />
490
498
  ) : (
491
499
  <Sparkles className="size-3.5" />
492
500
  )}
493
- {t.agent.createDoc}
501
+ <span className="hidden @lg:inline">{t.agent.createDoc}</span>
494
502
  </button>
495
503
  );
496
504
  }
@@ -26,6 +26,6 @@ declare module 'virtual:open-doc/config' {
26
26
  import type { OpenDocConfig } from '../config';
27
27
 
28
28
  type ResolvedBuild = { showDocBrowser: boolean; allowHtmlExport: boolean };
29
- const config: OpenDocConfig & { build: ResolvedBuild; version: string };
29
+ const config: OpenDocConfig & { build: ResolvedBuild; version: string; fromSource: boolean };
30
30
  export default config;
31
31
  }