@softure-ai/theme-notion 0.16.2 → 0.18.0
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/CHANGELOG.md +21 -0
- package/README.md +37 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/messages/en.d.ts +14 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +14 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/index.d.ts +14 -0
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/notion/AsidePanel.d.ts +7 -2
- package/dist/notion/AsidePanel.d.ts.map +1 -1
- package/dist/notion/AsidePanel.js +9 -5
- package/dist/notion/AsidePanel.js.map +1 -1
- package/dist/notion/Document.d.ts +71 -0
- package/dist/notion/Document.d.ts.map +1 -0
- package/dist/notion/Document.js +147 -0
- package/dist/notion/Document.js.map +1 -0
- package/dist/notion/document-kind.d.ts +7 -0
- package/dist/notion/document-kind.d.ts.map +1 -0
- package/dist/notion/document-kind.js +13 -0
- package/dist/notion/document-kind.js.map +1 -0
- package/dist/notion/pdf-engine.d.ts +18 -0
- package/dist/notion/pdf-engine.d.ts.map +1 -0
- package/dist/notion/pdf-engine.js +44 -0
- package/dist/notion/pdf-engine.js.map +1 -0
- package/package.json +2 -1
- package/src/index.ts +13 -0
- package/src/lib/pdfjs-worker.d.ts +4 -0
- package/src/messages/en.ts +14 -0
- package/src/notion/AsidePanel.tsx +12 -4
- package/src/notion/Document.tsx +347 -0
- package/src/notion/document-kind.ts +15 -0
- package/src/notion/pdf-engine.ts +64 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,27 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done").
|
|
6
6
|
|
|
7
|
+
## 0.18.0
|
|
8
|
+
|
|
9
|
+
- `DocumentViewer`, `DocumentList`, `DocumentRow` (#1256): documents shown inside the page, never in a new browser
|
|
10
|
+
window. `DocumentViewer` is a full-screen `Dialog` (title, page count, zoom 50 % to 300 % of the fitted width, a
|
|
11
|
+
44 px close button below the safe area) that draws a PDF's pages into canvases with pdf.js or shows an image, from a
|
|
12
|
+
`Blob` (offline) or a URL; a broken file, a failed fetch or another type shows a message. `DocumentRow` draws one
|
|
13
|
+
document of a `DocumentList`: an icon by type, the title as a touch-sized open button, the size, an "available
|
|
14
|
+
offline" mark and optional actions. `getDocumentKind`, `DOCUMENT_ZOOM_STEPS`, `loadPdfjsEngine` (pdf.js, loaded
|
|
15
|
+
once on first use, its worker code run on the main thread: no worker URL to configure) and the `PdfEngine`
|
|
16
|
+
interface for another engine. Copy in `notionMessages.en.document`.
|
|
17
|
+
- New dependency: `pdfjs-dist` (Apache-2.0), imported only when a PDF opens.
|
|
18
|
+
- Migration: none.
|
|
19
|
+
|
|
20
|
+
## 0.17.0
|
|
21
|
+
|
|
22
|
+
- `AsidePanelProvider keepsSidebarOpen`: the left `Sidebar` and the right `AsidePanel` stay open together on a wide
|
|
23
|
+
screen, each with its own state: opening the panel (or a panel kept open on load) never folds the sidebar, and
|
|
24
|
+
opening the sidebar (its trigger, Ctrl+B, `AsidePanelSidebarOpener`) never closes the panel; `useAsidePanel()
|
|
25
|
+
.isSidebarFolded` follows the sidebar alone. New optional prop only; without it, one side panel at a time as before
|
|
26
|
+
(#1254).
|
|
27
|
+
|
|
7
28
|
## 0.16.2
|
|
8
29
|
|
|
9
30
|
- `SelectTrigger` shrinks to its cell: `min-w-0 max-w-full` on the trigger and `min-w-0` on its value, so a long
|
package/README.md
CHANGED
|
@@ -148,6 +148,8 @@ stages with a state, below), `Timeline` (dated entries on a vertical rail, below
|
|
|
148
148
|
`UploadField`, `UploadList` and `UploadItem` (pick or drop files, one row per file with progress, retry and remove,
|
|
149
149
|
below),
|
|
150
150
|
`FileInput` (a compact file picker for a form row: a button and the chosen file's name, below),
|
|
151
|
+
`DocumentViewer`, `DocumentList` and `DocumentRow` (a PDF's pages or an image shown inside the page, with page count
|
|
152
|
+
and zoom; one row per document with its type, size and an "available offline" mark, below),
|
|
151
153
|
`FormGrid` (fields side by side whose label, control and hint line up across columns, below).
|
|
152
154
|
|
|
153
155
|
**Touch sizes.** The controls a phone view taps most reach the `touch-target` token (44 px, Apple's HIG and WCAG
|
|
@@ -240,6 +242,8 @@ narrows next to it and stays usable (`SidePanel` is a panel over a canvas instea
|
|
|
240
242
|
`SidebarProvider` (every other prop passes through) and keeps one side panel open at a time: while the panel is open
|
|
241
243
|
on a wide screen the left `Sidebar` (offcanvas) is folded, and opening the sidebar any way (its trigger, Ctrl+B,
|
|
242
244
|
`AsidePanelSidebarOpener`) closes the panel; closing the panel brings the sidebar back unless the user folded it.
|
|
245
|
+
`keepsSidebarOpen` lets both stay open instead: the sidebar keeps its own state, opening the panel never folds it and
|
|
246
|
+
opening the sidebar never closes the panel (the content narrows between the two).
|
|
243
247
|
|
|
244
248
|
- `AsidePanelToggle`: one icon button fixed at the top-right edge, in the same place open or closed, with
|
|
245
249
|
`aria-expanded`, `aria-controls` and a label that switches between show and hide; `outline` while closed,
|
|
@@ -256,7 +260,8 @@ on a wide screen the left `Sidebar` (offcanvas) is folded, and opening the sideb
|
|
|
256
260
|
Its children render only while it is open, so pass a lazily loaded body (`next/dynamic` with `ssr: false`) and
|
|
257
261
|
screens that never open it never load its code.
|
|
258
262
|
- `AsidePanelSidebarOpener`: an icon button fixed at the top-left edge, shown only while the sidebar is folded on a
|
|
259
|
-
wide screen; it brings the sidebar back and closes the panel
|
|
263
|
+
wide screen; it brings the sidebar back and closes the panel (under `keepsSidebarOpen` it only brings the sidebar
|
|
264
|
+
back, so give it a `label` that does not mention the panel).
|
|
260
265
|
- Kept state: `initialState` (`{ isOpen, width }`) and `save(state)`, called after each change on a wide screen; keep
|
|
261
266
|
it per signed-in user (the app's database), so the panel opens the same way across screens, reloads and devices. A
|
|
262
267
|
failed save keeps the choice on the page and reaches `onSaveError`. `isHidden` marks a screen that offers no panel:
|
|
@@ -553,6 +558,37 @@ name); `messages` replaces any of it.
|
|
|
553
558
|
</UploadList>
|
|
554
559
|
```
|
|
555
560
|
|
|
561
|
+
**`DocumentViewer`, `DocumentList`, `DocumentRow`.** Documents shown inside the page, never in a new browser window
|
|
562
|
+
(which an installed iOS app cannot come back from offline). `DocumentViewer` is a full-screen `Dialog` with the
|
|
563
|
+
title, the page count, zoom out and in (50 % to 300 % of the fitted width, `DOCUMENT_ZOOM_STEPS`) and a 44 px close
|
|
564
|
+
button. Its `source` is `{ blob }` (a copy kept on the device, e.g. `createKeptFiles(...).find(url)` of
|
|
565
|
+
`@softure-ai/pwa`, shown with no network) or `{ url }` (fetched with the page's cookies, or by `fetchFile`). By
|
|
566
|
+
`contentType`, a PDF's pages are drawn one under the other into canvases by pdf.js (`pdfjs-dist`, Apache-2.0),
|
|
567
|
+
loaded only when the first PDF opens and run on the main thread, so there is no worker URL to configure; an image
|
|
568
|
+
shows from an object URL; another type, a broken file or a failed fetch shows a message instead of a blank screen.
|
|
569
|
+
`loadPdfEngine` takes another `PdfEngine` (`open(bytes)` → `{ pageCount, renderPage(page, canvas, width), destroy }`).
|
|
570
|
+
Call `loadPdfjsEngine()` once while online (e.g. when a page with documents opens): its chunks are ordinary build
|
|
571
|
+
files, so a service worker that keeps `/_next/static/` has them for an offline open later. `DocumentRow` is one
|
|
572
|
+
`li` of a `DocumentList`: an icon by type (`getDocumentKind`), the title as a touch-sized button that calls `onOpen`,
|
|
573
|
+
the size, an "available offline" mark with `isOffline`, and `actions` (e.g. a menu) after it. Every text has a
|
|
574
|
+
`messages` override (`notionMessages.en.document`).
|
|
575
|
+
|
|
576
|
+
```tsx
|
|
577
|
+
const [opened, setOpened] = useState<Doc | null>(null);
|
|
578
|
+
<DocumentList label="Documents">
|
|
579
|
+
{docs.map((doc) => (
|
|
580
|
+
<DocumentRow key={doc.id} title={doc.name} contentType={doc.type} size={doc.size} isOffline={doc.isKept} onOpen={() => setOpened(doc)} />
|
|
581
|
+
))}
|
|
582
|
+
</DocumentList>
|
|
583
|
+
<DocumentViewer
|
|
584
|
+
open={opened !== null}
|
|
585
|
+
onOpenChange={(open) => !open && setOpened(null)}
|
|
586
|
+
title={opened?.name ?? ""}
|
|
587
|
+
contentType={opened?.type ?? ""}
|
|
588
|
+
source={opened === null ? null : opened.blob !== null ? { blob: opened.blob } : { url: opened.url }}
|
|
589
|
+
/>
|
|
590
|
+
```
|
|
591
|
+
|
|
556
592
|
**`FileInput`.** The file picker of a form row, where `UploadField`'s dropping area is too large (one font, one
|
|
557
593
|
logo). A button at the height of `Input` and the default `SelectTrigger` (28 px) and, beside it, the chosen file's name
|
|
558
594
|
or "No file chosen", all in the app's words: `notionMessages.en.fileInput` (`choose`, `chooseMany` with `multiple`,
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,9 @@ export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps
|
|
|
67
67
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.js";
|
|
68
68
|
export { Timeline, type TimelineItem, type TimelineItemFold, type TimelineItemSize, type TimelineLine, type TimelineProps } from "./notion/Timeline.js";
|
|
69
69
|
export { TopLoadingBar, type TopLoadingBarProps } from "./notion/TopLoadingBar.js";
|
|
70
|
+
export { DOCUMENT_ZOOM_STEPS, getDocumentKind, type DocumentKind } from "./notion/document-kind.js";
|
|
71
|
+
export { DocumentList, DocumentRow, DocumentViewer, type DocumentListProps, type DocumentMessages, type DocumentMessagesOverride, type DocumentRowProps, type DocumentSource, type DocumentViewerProps, } from "./notion/Document.js";
|
|
72
|
+
export { loadPdfjsEngine, type PdfDocumentHandle, type PdfEngine } from "./notion/pdf-engine.js";
|
|
70
73
|
export { UploadField, UploadItem, UploadList, type UploadFieldProps, type UploadFileItem, type UploadItemProps, type UploadListProps, type UploadMessages, type UploadMessagesOverride, type UploadState, } from "./notion/Upload.js";
|
|
71
74
|
export { formatFileSize } from "./notion/format-file-size.js";
|
|
72
75
|
export { UpdatePrompt, type UpdatePromptProps } from "./notion/UpdatePrompt.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CA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E,mBAAmB,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,9 @@ export { Steps } from "./notion/Steps.js";
|
|
|
69
69
|
export { TabBar } from "./notion/TabBar.js";
|
|
70
70
|
export { Timeline } from "./notion/Timeline.js";
|
|
71
71
|
export { TopLoadingBar } from "./notion/TopLoadingBar.js";
|
|
72
|
+
export { DOCUMENT_ZOOM_STEPS, getDocumentKind } from "./notion/document-kind.js";
|
|
73
|
+
export { DocumentList, DocumentRow, DocumentViewer, } from "./notion/Document.js";
|
|
74
|
+
export { loadPdfjsEngine } from "./notion/pdf-engine.js";
|
|
72
75
|
export { UploadField, UploadItem, UploadList, } from "./notion/Upload.js";
|
|
73
76
|
export { formatFileSize } from "./notion/format-file-size.js";
|
|
74
77
|
export { UpdatePrompt } from "./notion/UpdatePrompt.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/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AAE,aAAa,EAA2B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAqB,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GAOf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAA0C,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,GAQX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC"}
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -65,6 +65,20 @@ export declare const en: {
|
|
|
65
65
|
readonly done: "Done";
|
|
66
66
|
readonly failed: "Failed";
|
|
67
67
|
};
|
|
68
|
+
readonly document: {
|
|
69
|
+
readonly close: "Close";
|
|
70
|
+
readonly zoomIn: "Zoom in";
|
|
71
|
+
readonly zoomOut: "Zoom out";
|
|
72
|
+
readonly zoom: "{percent}%";
|
|
73
|
+
readonly pageCount: "{count} pages";
|
|
74
|
+
readonly pageCountOne: "1 page";
|
|
75
|
+
readonly page: "Page {number} of {count}";
|
|
76
|
+
readonly loading: "Opening the document";
|
|
77
|
+
readonly failed: "This document cannot be shown.";
|
|
78
|
+
readonly unsupported: "This type of document cannot be shown here.";
|
|
79
|
+
readonly offline: "Available offline";
|
|
80
|
+
readonly open: "Open";
|
|
81
|
+
};
|
|
68
82
|
readonly steps: {
|
|
69
83
|
readonly done: "Done";
|
|
70
84
|
readonly current: "Current";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MA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BAAiB;iBAC1B,QAAQ,EAAE,aAAa;iBACvB,KAAK,EAAE,OAAO;iBACd,KAAK,EAAE,cAAc;iBACrB,MAAM,EAAE,eAAe;iBACvB,MAAM,EAAE,eAAe;iBACvB,QAAQ,EAAE,kBAAkB;iBAC5B,MAAM,EAAE,QAAQ;iBAChB,SAAS,EAAE,WAAW;iBACtB,MAAM,EAAE,QAAQ;iBAChB,IAAI,EAAE,MAAM;iBACZ,MAAM,EAAE,QAAQ;;aAElB,QAAQ;iBACN,KAAK,EAAE,OAAO;iBACd,MAAM,EAAE,SAAS;iBACjB,OAAO,EAAE,UAAU;iBACnB,IAAI,EAAE,YAAY;iBAClB,SAAS,EAAE,eAAe;iBAC1B,YAAY,EAAE,QAAQ;iBACtB,IAAI,EAAE,0BAA0B;iBAChC,OAAO,EAAE,sBAAsB;iBAC/B,MAAM,EAAE,gCAAgC;iBACxC,WAAW,EAAE,6CAA6C;iBAC1D,OAAO,EAAE,mBAAmB;iBAC5B,IAAI,EAAE,MAAM;;aAEd,KAAK;iBAAI,IAAI,EAAE,MAAM;iBAAE,OAAO,EAAE,SAAS;iBAAE,IAAI,EAAE,OAAO;iBAAE,MAAM,EAAE,QAAQ;;aAC1E,OAAO;iBAAI,KAAK,EAAE,iBAAiB;iBAAE,WAAW,EAAE,gCAAgC;;CAC1E,CAAC"}
|
package/dist/messages/en.js
CHANGED
|
@@ -43,6 +43,20 @@ export const en = {
|
|
|
43
43
|
done: "Done",
|
|
44
44
|
failed: "Failed",
|
|
45
45
|
},
|
|
46
|
+
document: {
|
|
47
|
+
close: "Close",
|
|
48
|
+
zoomIn: "Zoom in",
|
|
49
|
+
zoomOut: "Zoom out",
|
|
50
|
+
zoom: "{percent}%",
|
|
51
|
+
pageCount: "{count} pages",
|
|
52
|
+
pageCountOne: "1 page",
|
|
53
|
+
page: "Page {number} of {count}",
|
|
54
|
+
loading: "Opening the document",
|
|
55
|
+
failed: "This document cannot be shown.",
|
|
56
|
+
unsupported: "This type of document cannot be shown here.",
|
|
57
|
+
offline: "Available offline",
|
|
58
|
+
open: "Open",
|
|
59
|
+
},
|
|
46
60
|
steps: { done: "Done", current: "Current", todo: "To do", failed: "Failed" },
|
|
47
61
|
command: { title: "Command Palette", description: "Search for a command to run..." },
|
|
48
62
|
};
|
package/dist/messages/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,UAAU,EAAE;QACV,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kCAAkC;KAChD;IACD,UAAU,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE;IACjD,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;IAC1B,SAAS,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE;IAClH,UAAU,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE;IACjC,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;IACzB,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;IAC7B,OAAO,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAChH,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;IAC7B,QAAQ,EAAE;QACR,YAAY,EACV,mIAAmI;QACrI,QAAQ,EAAE,mDAAmD;QAC7D,KAAK,EAAE,iDAAiD;QACxD,OAAO,EAAE,mDAAmD;QAC5D,SAAS,EAAE,qCAAqC;QAChD,MAAM,EAAE,iBAAiB;KAC1B;IAC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AC5E,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gCAAgC,EAAE;CAC5E,CAAC"}
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -64,6 +64,20 @@ export declare const notionMessages: {
|
|
|
64
64
|
readonly done: "Done";
|
|
65
65
|
readonly failed: "Failed";
|
|
66
66
|
};
|
|
67
|
+
readonly document: {
|
|
68
|
+
readonly close: "Close";
|
|
69
|
+
readonly zoomIn: "Zoom in";
|
|
70
|
+
readonly zoomOut: "Zoom out";
|
|
71
|
+
readonly zoom: "{percent}%";
|
|
72
|
+
readonly pageCount: "{count} pages";
|
|
73
|
+
readonly pageCountOne: "1 page";
|
|
74
|
+
readonly page: "Page {number} of {count}";
|
|
75
|
+
readonly loading: "Opening the document";
|
|
76
|
+
readonly failed: "This document cannot be shown.";
|
|
77
|
+
readonly unsupported: "This type of document cannot be shown here.";
|
|
78
|
+
readonly offline: "Available offline";
|
|
79
|
+
readonly open: "Open";
|
|
80
|
+
};
|
|
67
81
|
readonly steps: {
|
|
68
82
|
readonly done: "Done";
|
|
69
83
|
readonly current: "Current";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC"}
|
|
@@ -12,6 +12,7 @@ export type AsidePanelProviderProps = Omit<ComponentProps<typeof SidebarProvider
|
|
|
12
12
|
readonly onSaveError?: (error: unknown) => void;
|
|
13
13
|
readonly isHidden?: boolean;
|
|
14
14
|
readonly panelId?: string;
|
|
15
|
+
readonly keepsSidebarOpen?: boolean;
|
|
15
16
|
};
|
|
16
17
|
interface AsidePanelContextValue {
|
|
17
18
|
readonly panelId: string;
|
|
@@ -32,9 +33,10 @@ export declare function useAsidePanel(): Pick<AsidePanelContextValue, "panelId"
|
|
|
32
33
|
/**
|
|
33
34
|
* The app shell's provider: renders `SidebarProvider` and keeps one side panel open at a time. While the right panel
|
|
34
35
|
* is open on a wide screen, the left sidebar is folded (offcanvas); opening the sidebar any way closes the panel.
|
|
36
|
+
* `keepsSidebarOpen` lets both stay open instead, each with its own state.
|
|
35
37
|
* Use it in place of `SidebarProvider`; every other `SidebarProvider` prop passes through.
|
|
36
38
|
*/
|
|
37
|
-
export declare function AsidePanelProvider({ initialState, save, onSaveError, isHidden, panelId, defaultOpen, children, ...props }: AsidePanelProviderProps): import("react").JSX.Element;
|
|
39
|
+
export declare function AsidePanelProvider({ initialState, save, onSaveError, isHidden, panelId, keepsSidebarOpen, defaultOpen, children, ...props }: AsidePanelProviderProps): import("react").JSX.Element;
|
|
38
40
|
export interface AsidePanelToggleProps {
|
|
39
41
|
readonly showLabel?: string;
|
|
40
42
|
readonly hideLabel?: string;
|
|
@@ -47,7 +49,10 @@ export interface AsidePanelSidebarOpenerProps {
|
|
|
47
49
|
readonly label?: string;
|
|
48
50
|
readonly className?: string;
|
|
49
51
|
}
|
|
50
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* The icon button at the top-left edge, shown only while the sidebar is folded: brings it back and closes the panel
|
|
54
|
+
* (only brings it back under `keepsSidebarOpen`, so the app passes a label without "hide the panel" there).
|
|
55
|
+
*/
|
|
51
56
|
export declare function AsidePanelSidebarOpener({ label, className }: AsidePanelSidebarOpenerProps): import("react").JSX.Element | null;
|
|
52
57
|
export interface AsidePanelProps {
|
|
53
58
|
readonly title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsidePanel.d.ts","sourceRoot":"","sources":["../../src/notion/AsidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMnD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,CAAC;AAGlD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CACjC;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,QAAQ,CAAC,GAAG;IAEvH,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IAEvC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEhD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"AsidePanel.d.ts","sourceRoot":"","sources":["../../src/notion/AsidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAA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Q,EAAE,SAAS,CAAC;IAE7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,UAAsC,EACtC,WAAwC,EACxC,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,eAAe,sCA2FjB"}
|
|
@@ -27,9 +27,10 @@ function useAsidePanelContext(component) {
|
|
|
27
27
|
/**
|
|
28
28
|
* The app shell's provider: renders `SidebarProvider` and keeps one side panel open at a time. While the right panel
|
|
29
29
|
* is open on a wide screen, the left sidebar is folded (offcanvas); opening the sidebar any way closes the panel.
|
|
30
|
+
* `keepsSidebarOpen` lets both stay open instead, each with its own state.
|
|
30
31
|
* Use it in place of `SidebarProvider`; every other `SidebarProvider` prop passes through.
|
|
31
32
|
*/
|
|
32
|
-
export function AsidePanelProvider({ initialState, save, onSaveError, isHidden = false, panelId = "aside-panel", defaultOpen = true, children, ...props }) {
|
|
33
|
+
export function AsidePanelProvider({ initialState, save, onSaveError, isHidden = false, panelId = "aside-panel", keepsSidebarOpen = false, defaultOpen = true, children, ...props }) {
|
|
33
34
|
const isMobile = useIsMobile();
|
|
34
35
|
const [kept, setKept] = useState(initialState);
|
|
35
36
|
const [isMobileOpen, setMobileOpen] = useState(false);
|
|
@@ -37,7 +38,7 @@ export function AsidePanelProvider({ initialState, save, onSaveError, isHidden =
|
|
|
37
38
|
const toggleRef = useRef(null);
|
|
38
39
|
const isHeadingFocusRequested = useRef(false);
|
|
39
40
|
const isOpen = isHidden ? false : isMobile ? isMobileOpen : kept.isOpen;
|
|
40
|
-
const isSidebarShown = isSidebarOpen && !(kept.isOpen && !isMobile && !isHidden);
|
|
41
|
+
const isSidebarShown = isSidebarOpen && (keepsSidebarOpen || !(kept.isOpen && !isMobile && !isHidden));
|
|
41
42
|
const keep = useCallback((next) => {
|
|
42
43
|
setKept(next);
|
|
43
44
|
if (save === undefined)
|
|
@@ -65,9 +66,9 @@ export function AsidePanelProvider({ initialState, save, onSaveError, isHidden =
|
|
|
65
66
|
}, [kept, keep]);
|
|
66
67
|
const openSidebar = useCallback(() => {
|
|
67
68
|
setSidebarOpen(true);
|
|
68
|
-
if (kept.isOpen && !isMobile)
|
|
69
|
+
if (!keepsSidebarOpen && kept.isOpen && !isMobile)
|
|
69
70
|
keep({ ...kept, isOpen: false });
|
|
70
|
-
}, [isMobile, kept, keep]);
|
|
71
|
+
}, [keepsSidebarOpen, isMobile, kept, keep]);
|
|
71
72
|
const changeSidebar = useCallback((next) => {
|
|
72
73
|
if (next)
|
|
73
74
|
openSidebar();
|
|
@@ -99,7 +100,10 @@ export function AsidePanelToggle({ showLabel = messages.asidePanel.show, hideLab
|
|
|
99
100
|
const label = isOpen ? hideLabel : showLabel;
|
|
100
101
|
return (_jsx(Button, { ref: toggleRef, type: "button", "data-slot": "aside-panel-toggle", variant: isOpen ? "secondary" : "outline", size: "icon", "aria-expanded": isOpen, "aria-controls": panelId, "aria-label": label, title: label, className: cn("fixed top-[calc(--spacing(2)+env(safe-area-inset-top))] right-[calc(--spacing(2)+env(safe-area-inset-right))] z-20", className), onClick: toggle, children: _jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }));
|
|
101
102
|
}
|
|
102
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* The icon button at the top-left edge, shown only while the sidebar is folded: brings it back and closes the panel
|
|
105
|
+
* (only brings it back under `keepsSidebarOpen`, so the app passes a label without "hide the panel" there).
|
|
106
|
+
*/
|
|
103
107
|
export function AsidePanelSidebarOpener({ label = messages.asidePanel.showSidebar, className }) {
|
|
104
108
|
const { isMobile, isSidebarFolded, openSidebar } = useAsidePanelContext("AsidePanelSidebarOpener");
|
|
105
109
|
if (isMobile || !isSidebarFolded)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsidePanel.js","sourceRoot":"","sources":["../../src/notion/AsidePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AACxH,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"AsidePanel.js","sourceRoot":"","sources":["../../src/notion/AsidePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AACxH,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM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AAC,UAAU,CAAC;IAErD,iHAAiH;IACjH,oGAAoG;IACpG,OAAO,CACL,iBACE,EAAE,EAAE,OAAO,eACD,aAAa,gBACX,KAAK,qBACA,SAAS,EAC1B,SAAS,EAAE,EAAE,CACX,4IAA4I,EAC5I,SAAS,CACV,aAED,4BAAe,oBAAoB,EAAC,SAAS,EAAC,yEAAyE,aACrH,aAAI,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,SAAS,EAAC,qDAAqD,YAC9G,KAAK,GACH,EACL,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAa,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,YAChJ,KAAC,SAAS,mBAAa,MAAM,EAAC,WAAW,EAAE,iBAAiB,GAAI,GACzD,IACL,EACN,2BAAe,qBAAqB,EAAC,SAAS,EAAC,gCAAgC,YAC5E,QAAQ,GACL,IACA,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type PdfEngine } from "./pdf-engine.js";
|
|
3
|
+
/** What the viewer shows: the bytes at hand (a kept copy, offline) or a URL it fetches. */
|
|
4
|
+
export type DocumentSource = {
|
|
5
|
+
readonly blob: Blob;
|
|
6
|
+
} | {
|
|
7
|
+
readonly url: string;
|
|
8
|
+
};
|
|
9
|
+
/** The texts of the document parts; `{count}`, `{number}` and `{percent}` are filled in. Built-in English: `notionMessages.en.document`. */
|
|
10
|
+
export interface DocumentMessages {
|
|
11
|
+
readonly close: string;
|
|
12
|
+
readonly zoomIn: string;
|
|
13
|
+
readonly zoomOut: string;
|
|
14
|
+
readonly zoom: string;
|
|
15
|
+
readonly pageCount: string;
|
|
16
|
+
readonly pageCountOne: string;
|
|
17
|
+
readonly page: string;
|
|
18
|
+
readonly loading: string;
|
|
19
|
+
readonly failed: string;
|
|
20
|
+
readonly unsupported: string;
|
|
21
|
+
readonly offline: string;
|
|
22
|
+
/** Read by a screen reader before a row's title. */
|
|
23
|
+
readonly open: string;
|
|
24
|
+
}
|
|
25
|
+
/** The app's wording for the document parts; each text left out keeps the built-in English one. */
|
|
26
|
+
export type DocumentMessagesOverride = Partial<DocumentMessages>;
|
|
27
|
+
export interface DocumentViewerProps {
|
|
28
|
+
readonly open: boolean;
|
|
29
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
30
|
+
/** The document's title, shown on top and as the dialog's name. */
|
|
31
|
+
readonly title: string;
|
|
32
|
+
/** The media type; it decides between PDF pages and an image. */
|
|
33
|
+
readonly contentType: string;
|
|
34
|
+
/** The bytes or the URL; nothing loads while it is `null`. */
|
|
35
|
+
readonly source: DocumentSource | null;
|
|
36
|
+
/** The PDF engine; pdf.js loaded on first use by default. */
|
|
37
|
+
readonly loadPdfEngine?: () => Promise<PdfEngine>;
|
|
38
|
+
/** Reads a URL source; `fetch` with the page's cookies by default. */
|
|
39
|
+
readonly fetchFile?: (url: string) => Promise<Blob>;
|
|
40
|
+
/** Something beside the zoom, e.g. a download link. */
|
|
41
|
+
readonly actions?: ReactNode;
|
|
42
|
+
readonly messages?: DocumentMessagesOverride;
|
|
43
|
+
readonly className?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function DocumentViewer({ open, onOpenChange, title, contentType, source, loadPdfEngine, fetchFile, actions, messages, className }: DocumentViewerProps): import("react").JSX.Element;
|
|
46
|
+
export interface DocumentListProps {
|
|
47
|
+
/** The list's accessible name, e.g. "Documents". */
|
|
48
|
+
readonly label: string;
|
|
49
|
+
/** `DocumentRow` rows. */
|
|
50
|
+
readonly children: ReactNode;
|
|
51
|
+
readonly className?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function DocumentList({ label, children, className }: DocumentListProps): import("react").JSX.Element;
|
|
54
|
+
export interface DocumentRowProps {
|
|
55
|
+
readonly title: string;
|
|
56
|
+
readonly contentType: string;
|
|
57
|
+
/** In bytes. */
|
|
58
|
+
readonly size: number;
|
|
59
|
+
/** Whether a copy is kept on the device; draws the "available offline" mark. */
|
|
60
|
+
readonly isOffline?: boolean;
|
|
61
|
+
/** Opens the document, e.g. in `DocumentViewer`. */
|
|
62
|
+
readonly onOpen: () => void;
|
|
63
|
+
/** Buttons after the row, e.g. a menu to rename or remove. */
|
|
64
|
+
readonly actions?: ReactNode;
|
|
65
|
+
/** Formats the size, e.g. "de" writes "1,5 kB". */
|
|
66
|
+
readonly locale?: string;
|
|
67
|
+
readonly messages?: DocumentMessagesOverride;
|
|
68
|
+
readonly className?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare function DocumentRow({ title, contentType, size, isOffline, onOpen, actions, locale, messages, className }: DocumentRowProps): import("react").JSX.Element;
|
|
71
|
+
//# sourceMappingURL=Document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../src/notion/Document.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUpE,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG1F,2FAA2F;AAC3F,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,4IAA4I;AAC5I,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,Q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as FileIcon, FileImage, FileText, LoaderCircle, Minus, Plus, X } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { en } from "../messages/en.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { Button } from "../ui/button.js";
|
|
8
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog.js";
|
|
9
|
+
import { DOCUMENT_ZOOM_STEPS, getDocumentKind } from "./document-kind.js";
|
|
10
|
+
import { formatFileSize } from "./format-file-size.js";
|
|
11
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
12
|
+
import { loadPdfjsEngine } from "./pdf-engine.js";
|
|
13
|
+
import { Status } from "./Status.js";
|
|
14
|
+
function mergeMessages(override) {
|
|
15
|
+
return { ...en.document, ...override };
|
|
16
|
+
}
|
|
17
|
+
function fill(template, values) {
|
|
18
|
+
return template.replaceAll(/\{(\w+)\}/g, (match, key) => (key in values ? String(values[key]) : match));
|
|
19
|
+
}
|
|
20
|
+
const FIT_INDEX = 2;
|
|
21
|
+
/** The width a PDF page fits when the viewer cannot measure its area (a page rendered on the server, a test). */
|
|
22
|
+
const FALLBACK_WIDTH = 800;
|
|
23
|
+
/** The widest a page is drawn at 100 %: a printed page's width on a wide screen, so its lines stay readable. */
|
|
24
|
+
const MAX_FIT_WIDTH = 880;
|
|
25
|
+
/** Reads a URL's bytes as the signed-in user, the way the app's own page would. */
|
|
26
|
+
async function fetchDocument(url) {
|
|
27
|
+
const response = await fetch(url, { credentials: "same-origin" });
|
|
28
|
+
if (!response.ok)
|
|
29
|
+
throw new Error(`DocumentViewer: fetching ${url} answered ${String(response.status)}`);
|
|
30
|
+
return response.blob();
|
|
31
|
+
}
|
|
32
|
+
// A document inside the page, on the whole screen: a PDF's pages drawn one under the other, or an image, with the
|
|
33
|
+
// title, the page count, zoom and a close button. It never opens a new browser window, which an installed phone app
|
|
34
|
+
// cannot come back from offline; with a `Blob` source it needs no network at all.
|
|
35
|
+
export function DocumentViewer({ open, onOpenChange, title, contentType, source, loadPdfEngine = loadPdfjsEngine, fetchFile = fetchDocument, actions, messages, className }) {
|
|
36
|
+
const words = mergeMessages(messages);
|
|
37
|
+
const [loaded, setLoaded] = useState({ state: "loading" });
|
|
38
|
+
const [zoomIndex, setZoomIndex] = useState(FIT_INDEX);
|
|
39
|
+
const kind = getDocumentKind(contentType);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!open || source === null)
|
|
42
|
+
return undefined;
|
|
43
|
+
if (kind === "other") {
|
|
44
|
+
setLoaded({ state: "unsupported" });
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
let isCurrent = true;
|
|
48
|
+
let release = () => undefined;
|
|
49
|
+
setLoaded({ state: "loading" });
|
|
50
|
+
setZoomIndex(FIT_INDEX);
|
|
51
|
+
void (async () => {
|
|
52
|
+
try {
|
|
53
|
+
const blob = "blob" in source ? source.blob : await fetchFile(source.url);
|
|
54
|
+
if (kind === "image") {
|
|
55
|
+
const url = URL.createObjectURL(blob);
|
|
56
|
+
release = () => URL.revokeObjectURL(url);
|
|
57
|
+
if (isCurrent)
|
|
58
|
+
setLoaded({ state: "image", url });
|
|
59
|
+
else
|
|
60
|
+
release();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const engine = await loadPdfEngine();
|
|
64
|
+
const document = await engine.open(await blob.arrayBuffer());
|
|
65
|
+
release = () => document.destroy();
|
|
66
|
+
if (isCurrent)
|
|
67
|
+
setLoaded({ state: "pdf", document });
|
|
68
|
+
else
|
|
69
|
+
release();
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
if (isCurrent)
|
|
73
|
+
setLoaded({ state: "failed" });
|
|
74
|
+
}
|
|
75
|
+
})();
|
|
76
|
+
return () => {
|
|
77
|
+
isCurrent = false;
|
|
78
|
+
release();
|
|
79
|
+
};
|
|
80
|
+
}, [open, source, kind, loadPdfEngine, fetchFile]);
|
|
81
|
+
const zoom = DOCUMENT_ZOOM_STEPS[zoomIndex] ?? 1;
|
|
82
|
+
const pageCount = loaded.state === "pdf" ? loaded.document.pageCount : null;
|
|
83
|
+
const canZoom = loaded.state === "pdf" || loaded.state === "image";
|
|
84
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "document-viewer", showCloseButton: false, className: cn("top-0 left-0 flex h-dvh max-w-none translate-x-0 translate-y-0 flex-col gap-0 rounded-none p-0 sm:max-w-none", "pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]", className), children: [_jsxs("div", { "data-slot": "document-viewer-header", className: "flex min-w-0 items-center gap-2 border-b border-border py-1 pr-2 pl-4", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(DialogTitle, { className: "truncate text-base", title: title, children: title }), _jsx(DialogDescription, { "data-slot": "document-viewer-pages", className: "text-small", children: pageCount === null ? "" : pageCount === 1 ? words.pageCountOne : fill(words.pageCount, { count: pageCount }) })] }), actions, canZoom ? (_jsxs("div", { "data-slot": "document-viewer-zoom", className: "flex shrink-0 items-center gap-1", children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon-touch", className: "md:size-7", "aria-label": words.zoomOut, title: words.zoomOut, disabled: zoomIndex === 0, onClick: () => setZoomIndex((index) => Math.max(0, index - 1)), children: _jsx(Minus, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }), _jsx("span", { "data-slot": "document-viewer-zoom-level", "aria-live": "polite", className: "w-12 text-center text-small text-muted-foreground tabular-nums", children: fill(words.zoom, { percent: Math.round(zoom * 100) }) }), _jsx(Button, { type: "button", variant: "ghost", size: "icon-touch", className: "md:size-7", "aria-label": words.zoomIn, title: words.zoomIn, disabled: zoomIndex === DOCUMENT_ZOOM_STEPS.length - 1, onClick: () => setZoomIndex((index) => Math.min(DOCUMENT_ZOOM_STEPS.length - 1, index + 1)), children: _jsx(Plus, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) })] })) : null, _jsx(DialogClose, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-touch", "data-slot": "document-viewer-close", "aria-label": words.close, title: words.close, className: "shrink-0", children: _jsx(X, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }) })] }), _jsx("div", { "data-slot": "document-viewer-body", role: "region", "aria-label": title, tabIndex: 0, className: "min-h-0 flex-1 overflow-auto bg-muted outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset", children: _jsx(DocumentBody, { loaded: loaded, zoom: zoom, title: title, words: words }) })] }) }));
|
|
85
|
+
}
|
|
86
|
+
function DocumentBody({ loaded, zoom, title, words }) {
|
|
87
|
+
if (loaded.state === "loading") {
|
|
88
|
+
return (_jsxs("p", { role: "status", "data-slot": "document-viewer-loading", className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [_jsx(LoaderCircle, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "size-4 animate-spin" }), words.loading] }));
|
|
89
|
+
}
|
|
90
|
+
if (loaded.state === "failed" || loaded.state === "unsupported") {
|
|
91
|
+
return (_jsx("p", { role: "alert", "data-slot": "document-viewer-error", className: "flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground", children: loaded.state === "failed" ? words.failed : words.unsupported }));
|
|
92
|
+
}
|
|
93
|
+
if (loaded.state === "image") {
|
|
94
|
+
return (_jsx("div", { className: "flex min-h-full items-start justify-center p-4", children: _jsx("img", { "data-slot": "document-viewer-image", src: loaded.url, alt: title, className: "h-auto max-w-none", style: { width: `${String(zoom * 100)}%` } }) }));
|
|
95
|
+
}
|
|
96
|
+
return _jsx(PdfPages, { document: loaded.document, zoom: zoom, words: words });
|
|
97
|
+
}
|
|
98
|
+
function PdfPages({ document, zoom, words }) {
|
|
99
|
+
const areaRef = useRef(null);
|
|
100
|
+
const [areaWidth, setAreaWidth] = useState(null);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
const area = areaRef.current;
|
|
103
|
+
if (area === null)
|
|
104
|
+
return undefined;
|
|
105
|
+
// The width inside the area's padding: at 100 % a page fits the screen with its margin on both sides.
|
|
106
|
+
const measure = () => {
|
|
107
|
+
const style = globalThis.getComputedStyle(area);
|
|
108
|
+
const inner = area.clientWidth - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0);
|
|
109
|
+
setAreaWidth(inner > 0 ? Math.min(inner, MAX_FIT_WIDTH) : FALLBACK_WIDTH);
|
|
110
|
+
};
|
|
111
|
+
measure();
|
|
112
|
+
if (typeof ResizeObserver === "undefined")
|
|
113
|
+
return undefined;
|
|
114
|
+
const observer = new ResizeObserver(measure);
|
|
115
|
+
observer.observe(area);
|
|
116
|
+
return () => observer.disconnect();
|
|
117
|
+
}, []);
|
|
118
|
+
const pages = Array.from({ length: document.pageCount }, (_, index) => index + 1);
|
|
119
|
+
return (_jsx("div", { ref: areaRef, "data-slot": "document-viewer-pages-area", className: "flex flex-col items-center gap-3 p-4", children: areaWidth === null
|
|
120
|
+
? null
|
|
121
|
+
: pages.map((pageNumber) => (_jsx(PdfPage, { document: document, pageNumber: pageNumber, width: Math.round(areaWidth * zoom), label: fill(words.page, { number: pageNumber, count: document.pageCount }) }, pageNumber))) }));
|
|
122
|
+
}
|
|
123
|
+
function PdfPage({ document, pageNumber, width, label }) {
|
|
124
|
+
const canvasRef = useRef(null);
|
|
125
|
+
const [hasFailed, setHasFailed] = useState(false);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const canvas = canvasRef.current;
|
|
128
|
+
if (canvas === null)
|
|
129
|
+
return;
|
|
130
|
+
document.renderPage(pageNumber, canvas, width).then(() => setHasFailed(false), () => setHasFailed(true));
|
|
131
|
+
}, [document, pageNumber, width]);
|
|
132
|
+
return (_jsx("canvas", { ref: canvasRef, role: "img", "aria-label": label, "data-slot": "document-viewer-page", "data-page": pageNumber, "data-failed": hasFailed || undefined, className: "max-w-none bg-background shadow-dialog" }));
|
|
133
|
+
}
|
|
134
|
+
const KIND_ICONS = { pdf: FileText, image: FileImage, other: FileIcon };
|
|
135
|
+
// The documents of an entry, one `DocumentRow` per row.
|
|
136
|
+
export function DocumentList({ label, children, className }) {
|
|
137
|
+
return (_jsx("ul", { "aria-label": label, "data-slot": "document-list", className: cn("flex flex-col gap-1", className), children: children }));
|
|
138
|
+
}
|
|
139
|
+
// One document: an icon by its type, the title as a touch-sized button that opens it, its size, and a mark when a copy
|
|
140
|
+
// is kept on the device.
|
|
141
|
+
export function DocumentRow({ title, contentType, size, isOffline = false, onOpen, actions, locale = "en", messages, className }) {
|
|
142
|
+
const words = mergeMessages(messages);
|
|
143
|
+
const kind = getDocumentKind(contentType);
|
|
144
|
+
const Icon = KIND_ICONS[kind];
|
|
145
|
+
return (_jsxs("li", { "data-slot": "document-row", "data-kind": kind, "data-offline": isOffline || undefined, className: cn("flex min-w-0 items-center gap-2 rounded-md px-2 py-1", className), children: [_jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "size-4 shrink-0 text-muted-foreground" }), _jsxs("button", { type: "button", "data-slot": "document-row-open", onClick: onOpen, className: "flex min-h-touch-target min-w-0 flex-1 flex-wrap items-center gap-x-2 rounded-sm text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 md:min-h-7", children: [_jsxs("span", { className: "sr-only", children: [words.open, " "] }), _jsx("span", { "data-slot": "document-row-title", title: title, className: "min-w-0 truncate text-sm font-medium", children: title }), _jsx("span", { "data-slot": "document-row-size", className: "shrink-0 text-small text-muted-foreground tabular-nums", children: formatFileSize(size, locale) }), isOffline ? (_jsx(Status, { color: "green", icon: CircleCheck, className: "shrink-0 text-small", children: words.offline })) : null] }), actions === undefined ? null : _jsx("div", { "data-slot": "document-row-actions", className: "flex shrink-0 items-center gap-1", children: actions })] }));
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=Document.js.map
|