@rightkit/document-core 0.1.2 → 0.2.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 +23 -0
- package/README.md +31 -7
- package/dist/app/chrome.js +1 -1
- package/dist/app/documentPrinting.d.ts +0 -6
- package/dist/app/documentPrinting.js +0 -18
- package/dist/app/shell/nativeMenu.d.ts +3 -2
- package/dist/app/shell/nativeMenu.js +8 -5
- package/dist/documents/perfEventCounters.d.ts +0 -8
- package/dist/documents/perfEventCounters.js +2 -1
- package/dist/documents/preview/previewFrame.d.ts +2 -1
- package/dist/documents/preview/previewFrame.js +9 -7
- package/dist/documents/searchUtils.js +1 -1
- package/dist/host.d.ts +36 -0
- package/dist/host.js +54 -0
- package/dist/index.d.ts +1 -46
- package/dist/index.js +1 -46
- package/dist/settings/themes.js +1 -1
- package/dist/state/bridgeEvents.d.ts +1 -1
- package/dist/state/bridgeEvents.js +7 -4
- package/dist/state/recentUrls.js +4 -3
- package/dist/state/tauriBridge.d.ts +3 -47
- package/dist/state/tauriBridge.js +6 -162
- package/dist/styles.css +2 -2
- package/package.json +16 -87
- package/dist/app/shortcutChords.d.ts +0 -6
- package/dist/app/shortcutChords.js +0 -14
- package/dist/app/useCloseFindOnSurfaceChange.d.ts +0 -14
- package/dist/app/useCloseFindOnSurfaceChange.js +0 -23
- package/dist/app/useEditText.d.ts +0 -6
- package/dist/app/useEditText.js +0 -10
- package/dist/appName.d.ts +0 -2
- package/dist/appName.js +0 -8
- package/dist/documents/FullscreenIcon.d.ts +0 -4
- package/dist/documents/FullscreenIcon.js +0 -7
- package/dist/documents/mdx/mdxRuntimeScript.d.ts +0 -2
- package/dist/documents/mdx/mdxRuntimeScript.js +0 -3
- package/dist/documents/mdx/mdxRuntimeScript.txt +0 -584
- package/dist/documents/pdf/MacPdfReadPane.d.ts +0 -23
- package/dist/documents/pdf/MacPdfReadPane.js +0 -708
- package/dist/documents/pdf/NativePdfDocument.d.ts +0 -9
- package/dist/documents/pdf/NativePdfDocument.js +0 -41
- package/dist/documents/pdf/PdfInlineTextEditor.d.ts +0 -53
- package/dist/documents/pdf/PdfInlineTextEditor.js +0 -225
- package/dist/documents/pdf/PdfOcrLayer.d.ts +0 -4
- package/dist/documents/pdf/PdfOcrLayer.js +0 -30
- package/dist/documents/pdf/PdfOutline.d.ts +0 -6
- package/dist/documents/pdf/PdfOutline.js +0 -12
- package/dist/documents/pdf/PdfPasswordPrompt.d.ts +0 -5
- package/dist/documents/pdf/PdfPasswordPrompt.js +0 -24
- package/dist/documents/pdf/PdfThumbnails.d.ts +0 -8
- package/dist/documents/pdf/PdfThumbnails.js +0 -201
- package/dist/documents/pdf/PdfToolbar.d.ts +0 -47
- package/dist/documents/pdf/PdfToolbar.js +0 -76
- package/dist/documents/pdf/PdfViewer.d.ts +0 -36
- package/dist/documents/pdf/PdfViewer.js +0 -1522
- package/dist/documents/pdf/PdfViewerBody.d.ts +0 -22
- package/dist/documents/pdf/PdfViewerBody.js +0 -42
- package/dist/documents/pdf/macPdfNativeBridge.d.ts +0 -118
- package/dist/documents/pdf/macPdfNativeBridge.js +0 -134
- package/dist/documents/pdf/nearestVisiblePdfPage.d.ts +0 -2
- package/dist/documents/pdf/nearestVisiblePdfPage.js +0 -22
- package/dist/documents/pdf/pdfBench.d.ts +0 -88
- package/dist/documents/pdf/pdfBench.js +0 -535
- package/dist/documents/pdf/pdfBenchAutopilot.d.ts +0 -48
- package/dist/documents/pdf/pdfBenchAutopilot.js +0 -154
- package/dist/documents/pdf/pdfBenchTransport.d.ts +0 -21
- package/dist/documents/pdf/pdfBenchTransport.js +0 -233
- package/dist/documents/pdf/pdfEditModel.d.ts +0 -294
- package/dist/documents/pdf/pdfEditModel.js +0 -105
- package/dist/documents/pdf/pdfEditor.d.ts +0 -100
- package/dist/documents/pdf/pdfEditor.js +0 -68
- package/dist/documents/pdf/pdfOcr.d.ts +0 -36
- package/dist/documents/pdf/pdfOcr.js +0 -88
- package/dist/documents/pdf/pdfOcrEdit.d.ts +0 -32
- package/dist/documents/pdf/pdfOcrEdit.js +0 -138
- package/dist/documents/pdf/pdfPrinting.d.ts +0 -28
- package/dist/documents/pdf/pdfPrinting.js +0 -110
- package/dist/documents/pdf/pdfSave.d.ts +0 -87
- package/dist/documents/pdf/pdfSave.js +0 -250
- package/dist/documents/pdf/pdfShared.d.ts +0 -16
- package/dist/documents/pdf/pdfShared.js +0 -20
- package/dist/documents/pdf/pdfToMarkdown.d.ts +0 -11
- package/dist/documents/pdf/pdfToMarkdown.js +0 -67
- package/dist/documents/pdf/pdfjsLibGlobal.d.ts +0 -1
- package/dist/documents/pdf/pdfjsLibGlobal.js +0 -12
- package/dist/documents/pdf/toolbarIcons.d.ts +0 -18
- package/dist/documents/pdf/toolbarIcons.js +0 -31
- package/dist/documents/pdf/usePdfDocumentLoader.d.ts +0 -40
- package/dist/documents/pdf/usePdfDocumentLoader.js +0 -243
- package/dist/documents/pdf/usePdfEditSession.d.ts +0 -88
- package/dist/documents/pdf/usePdfEditSession.js +0 -341
- package/dist/documents/pdf/usePdfEditor.d.ts +0 -59
- package/dist/documents/pdf/usePdfEditor.js +0 -317
- package/dist/documents/pdf/usePdfFit.d.ts +0 -19
- package/dist/documents/pdf/usePdfFit.js +0 -55
- package/dist/documents/pdf/usePdfOcr.d.ts +0 -38
- package/dist/documents/pdf/usePdfOcr.js +0 -337
- package/dist/documents/pdf/usePdfPreviewRecompose.d.ts +0 -28
- package/dist/documents/pdf/usePdfPreviewRecompose.js +0 -256
- package/dist/documents/pdf/usePdfSavePlan.d.ts +0 -61
- package/dist/documents/pdf/usePdfSavePlan.js +0 -287
- package/dist/documents/pdf/usePdfSearch.d.ts +0 -31
- package/dist/documents/pdf/usePdfSearch.js +0 -367
- package/dist/documents/pdf/usePdfViewControls.d.ts +0 -72
- package/dist/documents/pdf/usePdfViewControls.js +0 -152
- package/dist/documents/scopedSelectAll.d.ts +0 -5
- package/dist/documents/scopedSelectAll.js +0 -77
- package/dist/documents/txt/cmScroll.d.ts +0 -11
- package/dist/documents/txt/cmScroll.js +0 -52
- package/dist/documents/useMirroredEditText.d.ts +0 -15
- package/dist/documents/useMirroredEditText.js +0 -29
- package/dist/documents/useSplitResize.d.ts +0 -7
- package/dist/documents/useSplitResize.js +0 -37
- package/dist/settings/rk-settings.css +0 -38
- package/dist/settings/sections/EditorSection.d.ts +0 -1
- package/dist/settings/sections/EditorSection.js +0 -18
- package/dist/settings/sections/FileAssociationsSection.d.ts +0 -1
- package/dist/settings/sections/FileAssociationsSection.js +0 -5
- package/dist/settings/sections/MacFileAssociationsBlock.d.ts +0 -33
- package/dist/settings/sections/MacFileAssociationsBlock.js +0 -151
- package/dist/settings/sections/ThemeSection.d.ts +0 -1
- package/dist/settings/sections/ThemeSection.js +0 -31
- package/dist/settings/sections/TypographySection.d.ts +0 -1
- package/dist/settings/sections/TypographySection.js +0 -19
- package/dist/settings/sections/onOff.d.ts +0 -11
- package/dist/settings/sections/onOff.js +0 -8
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import { type DocumentSearchMode } from "../DocumentToolbarFind.js";
|
|
3
|
-
import { type PdfEditorMode } from "./pdfEditor.js";
|
|
4
|
-
import type { PdfOcrDocumentState, PdfOcrStatus } from "./usePdfOcr.js";
|
|
5
|
-
export declare function PdfToolbar({ panel, hasOutline, current, numPages, pageDraft, pageShake, scaleDraft, fitMode, onTogglePanel, onPageDraftChange, onCommitPageDraft, onZoom, onScaleDraftChange, onCommitScaleDraft, onSetFit, onRotate, ocrAvailable, currentPageScanned, ocrState, ocrErrorMessage, onRecognize, documentOcrState, onRecognizeDocument, findBar, findMode, onRequestFind, onRequestReplace, editorMode, editorReady, editorDirty, onSetEditorMode, freeTextSize, onFreeTextSizeChange, onAddImageStamp, textEditActive, onToggleTextEdit, readOnly, }: {
|
|
6
|
-
panel: null | "outline" | "thumbs";
|
|
7
|
-
hasOutline: boolean;
|
|
8
|
-
current: number;
|
|
9
|
-
numPages: number;
|
|
10
|
-
pageDraft: string | null;
|
|
11
|
-
pageShake: boolean;
|
|
12
|
-
scaleDraft: string;
|
|
13
|
-
fitMode: "width" | "page" | null;
|
|
14
|
-
onTogglePanel: (p: "outline" | "thumbs") => void;
|
|
15
|
-
onPageDraftChange: (v: string) => void;
|
|
16
|
-
onCommitPageDraft: () => void;
|
|
17
|
-
onZoom: (delta: number) => void;
|
|
18
|
-
onScaleDraftChange: (v: string) => void;
|
|
19
|
-
onCommitScaleDraft: () => void;
|
|
20
|
-
onSetFit: (mode: "width" | "page") => void;
|
|
21
|
-
onRotate: (delta: number) => void;
|
|
22
|
-
ocrAvailable?: boolean;
|
|
23
|
-
currentPageScanned?: boolean;
|
|
24
|
-
ocrState?: PdfOcrStatus;
|
|
25
|
-
ocrErrorMessage?: string;
|
|
26
|
-
onRecognize?: () => void;
|
|
27
|
-
documentOcrState?: PdfOcrDocumentState;
|
|
28
|
-
onRecognizeDocument?: () => void;
|
|
29
|
-
findBar?: ReactNode;
|
|
30
|
-
findMode?: DocumentSearchMode;
|
|
31
|
-
onRequestFind?: () => void;
|
|
32
|
-
onRequestReplace?: () => void;
|
|
33
|
-
/** Stage 1 editor tool state — "none" is the pure-viewer default (view-first invariant). */
|
|
34
|
-
editorMode?: PdfEditorMode;
|
|
35
|
-
editorReady?: boolean;
|
|
36
|
-
editorDirty?: boolean;
|
|
37
|
-
onSetEditorMode?: (mode: PdfEditorMode) => void;
|
|
38
|
-
freeTextSize?: number;
|
|
39
|
-
onFreeTextSizeChange?: (size: number) => void;
|
|
40
|
-
onAddImageStamp?: (file: File) => undefined | Promise<boolean>;
|
|
41
|
-
/** Existing-text edit mode — separate from the annotation-editor tools above (it edits source
|
|
42
|
-
* text runs via the backend, not overlaid annotations). Off by default (view-first). */
|
|
43
|
-
textEditActive?: boolean;
|
|
44
|
-
onToggleTextEdit?: () => void;
|
|
45
|
-
/** Wave 2 Read mode — every markup/edit affordance hides; only the viewing pills remain. */
|
|
46
|
-
readOnly?: boolean;
|
|
47
|
-
}): import("react").JSX.Element;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Minus } from "@phosphor-icons/react/dist/icons/Minus";
|
|
3
|
-
import { Plus } from "@phosphor-icons/react/dist/icons/Plus";
|
|
4
|
-
import { ArrowCounterClockwise } from "@phosphor-icons/react/dist/icons/ArrowCounterClockwise";
|
|
5
|
-
import { ArrowClockwise } from "@phosphor-icons/react/dist/icons/ArrowClockwise";
|
|
6
|
-
import { Scan } from "@phosphor-icons/react/dist/icons/Scan";
|
|
7
|
-
import { useRef, useState } from "react";
|
|
8
|
-
import { DocumentToolbarSearch } from "../DocumentToolbarFind.js";
|
|
9
|
-
import { DocumentToolbarShell } from "../DocumentToolbarShell.js";
|
|
10
|
-
import { PDF_EDITOR_TOOLS } from "./pdfEditor.js";
|
|
11
|
-
import { IconThumbnails, IconOutline, IconFitWidth, IconFitPage, IconEditText, IconAnnotateText, IconDraw, IconHighlight, IconImage, } from "./toolbarIcons.js";
|
|
12
|
-
import { DocBar } from "../../app/shell/docBar.js";
|
|
13
|
-
// Maps each Stage 1 annotation-editor tool (defined in pdfEditor.ts, kept dependency-free of
|
|
14
|
-
// React) to its toolbar icon. "none" never appears in PDF_EDITOR_TOOLS so it has no icon.
|
|
15
|
-
const EDITOR_TOOL_ICON = {
|
|
16
|
-
freeText: _jsx(IconAnnotateText, {}),
|
|
17
|
-
ink: _jsx(IconDraw, {}),
|
|
18
|
-
highlight: _jsx(IconHighlight, {}),
|
|
19
|
-
stamp: _jsx(IconImage, {}),
|
|
20
|
-
};
|
|
21
|
-
// Presentational PDF toolbar: panel toggles (thumbnails/outline), page box, zoom, fit, rotate, and
|
|
22
|
-
// (Stage 1) the annotation-editor tool switcher. All state lives in PdfViewer; this is
|
|
23
|
-
// props-in / callbacks-out.
|
|
24
|
-
export function PdfToolbar({ panel, hasOutline, current, numPages, pageDraft, pageShake, scaleDraft, fitMode, onTogglePanel, onPageDraftChange, onCommitPageDraft, onZoom, onScaleDraftChange, onCommitScaleDraft, onSetFit, onRotate, ocrAvailable, currentPageScanned, ocrState = "idle", ocrErrorMessage, onRecognize, documentOcrState, onRecognizeDocument, findBar, findMode, onRequestFind, onRequestReplace, editorMode, editorReady, editorDirty, onSetEditorMode, freeTextSize, onFreeTextSizeChange, onAddImageStamp, textEditActive, onToggleTextEdit, readOnly = false, }) {
|
|
25
|
-
const stampInputRef = useRef(null);
|
|
26
|
-
// Floating-bar icon button (34px round) — matches TBtn round chrome without a wrapper component.
|
|
27
|
-
const capsuleBtn = (active) => `vr-press vr-focus grid h-[34px] w-[34px] flex-shrink-0 place-items-center rounded-full border transition-colors disabled:opacity-30 ${active
|
|
28
|
-
? "border-copper bg-copper/15 text-copper-hi"
|
|
29
|
-
: "border-transparent text-muted hover:border-line hover:text-paper"}`;
|
|
30
|
-
// Single capsule docked in its own row above the pages (data-vr-floating-bar: reader-surface
|
|
31
|
-
// strip + hairline), so scrolled pages end at the row instead of sliding under it; the find
|
|
32
|
-
// capsule hangs 8px under the row.
|
|
33
|
-
return (_jsx("div", { className: "no-print vr-chrome vr-document-toolbar relative z-30 shrink-0 text-xs text-muted", children: _jsxs(DocBar, { children: [_jsx("div", { className: "vr-capsule h-[42px] px-1", children: _jsxs(DocumentToolbarShell, { ariaLabel: "PDF tools", variant: "scroll", className: "vr-capsule-scroll", children: [_jsx("button", { type: "button", onClick: () => onTogglePanel("thumbs"), "aria-pressed": panel === "thumbs", "aria-label": "Page thumbnails", className: capsuleBtn(panel === "thumbs"), title: "Page thumbnails", children: _jsx(IconThumbnails, {}) }), _jsx("button", { type: "button", onClick: () => onTogglePanel("outline"), disabled: !hasOutline, "aria-pressed": panel === "outline", "aria-label": hasOutline ? "Outline bookmarks" : "No outline in this PDF", className: capsuleBtn(panel === "outline"), title: hasOutline ? "Outline (bookmarks)" : "No outline in this PDF", children: _jsx(IconOutline, {}) }), _jsx("span", { className: "mx-1 h-5 w-px flex-shrink-0 bg-line" }), _jsx("input", { type: "number", value: pageDraft ?? current, "aria-label": "Page number", onChange: (e) => onPageDraftChange(e.target.value), onKeyDown: (e) => {
|
|
34
|
-
if (e.key === "Enter") {
|
|
35
|
-
onCommitPageDraft();
|
|
36
|
-
e.target.blur();
|
|
37
|
-
}
|
|
38
|
-
}, onBlur: onCommitPageDraft, className: `w-12 flex-shrink-0 rounded-md border bg-ink px-1 py-1 text-center font-mono text-paper outline-none focus:border-copper ${pageShake ? "vr-shake border-danger" : "border-line"}` }), _jsxs("span", { className: "flex-shrink-0 whitespace-nowrap font-mono text-muted-2", children: ["/ ", numPages || "…"] }), !readOnly && (_jsxs(_Fragment, { children: [(onToggleTextEdit || onSetEditorMode) && (_jsx("span", { className: "mx-1 h-5 w-px flex-shrink-0 bg-line" })), onToggleTextEdit && (_jsx("button", { type: "button", onClick: onToggleTextEdit, "aria-pressed": !!textEditActive, "aria-label": "Edit PDF text", title: "Edit existing PDF text", className: capsuleBtn(!!textEditActive), children: _jsx(IconEditText, {}) })), onSetEditorMode && (_jsxs(_Fragment, { children: [PDF_EDITOR_TOOLS.map((tool) => (_jsx("button", { type: "button", disabled: !editorReady, onClick: () => {
|
|
39
|
-
if (tool.mode === "stamp") {
|
|
40
|
-
onSetEditorMode("stamp");
|
|
41
|
-
stampInputRef.current?.click();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
onSetEditorMode(editorMode === tool.mode ? "none" : tool.mode);
|
|
45
|
-
}, "aria-pressed": editorMode === tool.mode, "aria-label": tool.title, title: tool.title, className: capsuleBtn(editorMode === tool.mode), children: EDITOR_TOOL_ICON[tool.mode] }, tool.mode))), editorMode === "freeText" && onFreeTextSizeChange && (_jsx(AddedTextSizeInput, { value: freeTextSize ?? 10, onChange: onFreeTextSizeChange }))] })), editorDirty && (_jsx("span", { role: "img", className: "ml-1 flex-shrink-0 text-copper-hi", title: "Unsaved annotation edits", "aria-label": "Unsaved annotation edits", children: "\u25CF" })), _jsx("input", { ref: stampInputRef, type: "file", accept: "image/*", className: "hidden", onChange: (e) => {
|
|
46
|
-
const file = e.target.files?.[0];
|
|
47
|
-
e.target.value = "";
|
|
48
|
-
if (file)
|
|
49
|
-
void onAddImageStamp?.(file);
|
|
50
|
-
} })] })), ((ocrAvailable && currentPageScanned && onRecognize) ||
|
|
51
|
-
(ocrAvailable && onRecognizeDocument)) && (_jsx("span", { className: "mx-1 h-5 w-px flex-shrink-0 bg-line" })), ocrAvailable && currentPageScanned && onRecognize && (_jsx("button", { type: "button", onClick: onRecognize, disabled: ocrState === "running" ||
|
|
52
|
-
ocrState === "done" ||
|
|
53
|
-
documentOcrState?.status === "running", "aria-label": ocrState === "running" ? "Recognizing text" : "Recognize text on this page", title: ocrState === "done" ? "Text recognized" : "Recognize text on this scanned page", className: capsuleBtn(false), children: _jsx(Scan, { size: 15, weight: "regular", "aria-hidden": true }) })), ocrAvailable && onRecognizeDocument && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: onRecognizeDocument, disabled: documentOcrState?.status === "running" ||
|
|
54
|
-
documentOcrState?.status === "done" ||
|
|
55
|
-
ocrState === "running", "aria-label": documentOcrState?.status === "running"
|
|
56
|
-
? "Live Text — recognizing scanned pages"
|
|
57
|
-
: "Live Text", title: documentOcrState?.status === "done"
|
|
58
|
-
? "Live Text — all scanned pages recognized"
|
|
59
|
-
: documentOcrState?.status === "error"
|
|
60
|
-
? "Live Text — retry recognising scanned pages"
|
|
61
|
-
: "Live Text — recognise text on all scanned pages", className: capsuleBtn(false), children: _jsx(Scan, { size: 15, weight: "regular", "aria-hidden": true }) }), documentOcrState && documentOcrState.status === "running" && (_jsxs("span", { role: "status", "aria-live": "polite", className: "flex-shrink-0 whitespace-nowrap font-mono text-muted-2", children: [documentOcrState.completed, "/", documentOcrState.total] })), documentOcrState && documentOcrState.status === "error" && (_jsx("span", { className: "flex-shrink-0 whitespace-nowrap font-mono text-danger", children: "OCR failed" }))] })), _jsx("span", { className: "mx-1 h-5 w-px flex-shrink-0 bg-line" }), _jsx("button", { type: "button", onClick: () => onZoom(-0.15), "aria-label": "Zoom out", title: "Zoom out", className: capsuleBtn(false), children: _jsx(Minus, { size: 14, weight: "regular", "aria-hidden": true }) }), _jsx("input", { type: "number", value: scaleDraft, "aria-label": "Zoom percentage", onChange: (e) => onScaleDraftChange(e.target.value), onKeyDown: (e) => {
|
|
62
|
-
if (e.key === "Enter") {
|
|
63
|
-
onCommitScaleDraft();
|
|
64
|
-
e.target.blur();
|
|
65
|
-
}
|
|
66
|
-
}, onBlur: onCommitScaleDraft, className: "w-14 flex-shrink-0 rounded-md border border-line bg-ink px-1 py-1 text-center font-mono text-paper outline-none focus:border-copper" }), _jsx("span", { className: "flex-shrink-0 font-mono text-muted-2", children: "%" }), _jsx("button", { type: "button", onClick: () => onZoom(0.15), "aria-label": "Zoom in", title: "Zoom in", className: capsuleBtn(false), children: _jsx(Plus, { size: 14, weight: "regular", "aria-hidden": true }) }), _jsx("span", { className: "mx-1 h-5 w-px flex-shrink-0 bg-line" }), _jsx("button", { type: "button", onClick: () => onSetFit("width"), "aria-pressed": fitMode === "width", "aria-label": "Fit to width", title: "Fit to width", className: capsuleBtn(fitMode === "width"), children: _jsx(IconFitWidth, {}) }), _jsx("button", { type: "button", onClick: () => onSetFit("page"), "aria-pressed": fitMode === "page", "aria-label": "Fit full page", title: "Fit full page", className: capsuleBtn(fitMode === "page"), children: _jsx(IconFitPage, {}) }), _jsx("span", { className: "mx-1 h-5 w-px flex-shrink-0 bg-line" }), _jsx("button", { type: "button", onClick: () => onRotate(-90), "aria-label": "Rotate left", className: capsuleBtn(false), title: "Rotate left", children: _jsx(ArrowCounterClockwise, { size: 14, weight: "regular", "aria-hidden": true }) }), _jsx("button", { type: "button", onClick: () => onRotate(90), "aria-label": "Rotate right", className: capsuleBtn(false), title: "Rotate right", children: _jsx(ArrowClockwise, { size: 14, weight: "regular", "aria-hidden": true }) })] }) }), ocrErrorMessage && (_jsx("div", { role: "alert", className: "vr-capsule px-3 py-1.5 text-xs text-danger", children: ocrErrorMessage })), _jsx(DocumentToolbarSearch, { findBar: findBar, activeMode: findMode, onRequestFind: onRequestFind, onRequestReplace: onRequestReplace })] }) }));
|
|
67
|
-
}
|
|
68
|
-
function AddedTextSizeInput({ value, onChange, }) {
|
|
69
|
-
const [draft, setDraft] = useState(null);
|
|
70
|
-
return (_jsxs("label", { className: "ml-1 flex flex-shrink-0 items-center gap-1 whitespace-nowrap text-muted-2", children: [_jsx("span", { children: "Size" }), _jsx("input", { type: "number", min: 6, max: 144, step: 1, value: draft ?? value, "aria-label": "Added text size", onChange: (event) => {
|
|
71
|
-
const next = event.target.value;
|
|
72
|
-
setDraft(next);
|
|
73
|
-
if (next !== "")
|
|
74
|
-
onChange(Number(next));
|
|
75
|
-
}, onBlur: () => setDraft(null), className: "w-12 rounded-md border border-line bg-ink px-1 py-1 text-center font-mono text-paper outline-none focus:border-copper" })] }));
|
|
76
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import type { SearchProvider, ViewMeta } from "../types.js";
|
|
3
|
-
import type { NativePdfEditingAction } from "./macPdfNativeBridge.js";
|
|
4
|
-
import type { PdfSavePlan } from "./pdfEditModel.js";
|
|
5
|
-
import "./pdfPrinting.js";
|
|
6
|
-
export declare function PdfViewer({ documentPath, url, active, initialView, initialEditingAction, onViewState, registerPrint, registerSearchProvider, findBar, findMode, onRequestFind, onRequestReplace, registerPdfSave, registerPdfSavePlan, onDirtyChange, readOnly, }: {
|
|
7
|
-
documentPath: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
active?: boolean;
|
|
10
|
-
initialView?: ViewMeta;
|
|
11
|
-
/** Explicit action carried across the native-reader → editor transition. */
|
|
12
|
-
initialEditingAction?: NativePdfEditingAction;
|
|
13
|
-
onViewState?: (m: ViewMeta) => void;
|
|
14
|
-
/** Register a print function that uses THIS pane's already-loaded PDFDocumentProxy — see
|
|
15
|
-
* documentPrinting.ts printPdfDocument. */
|
|
16
|
-
registerPrint?: (fn: (() => Promise<boolean>) | null) => void;
|
|
17
|
-
registerSearchProvider?: (provider: SearchProvider | null) => void;
|
|
18
|
-
/** Shared FindBar element, floated over content below toolbar triggers. */
|
|
19
|
-
findBar?: ReactNode;
|
|
20
|
-
findMode?: "find" | "replace";
|
|
21
|
-
onRequestFind?: () => void;
|
|
22
|
-
onRequestReplace?: () => void;
|
|
23
|
-
/** Register this pane's ANNOTATION-ONLY save function (pdf.js `saveDocument()` → PDF bytes),
|
|
24
|
-
* unchanged from Stage 1. `src/app/useDocumentSaver.ts` (a sibling lane, Dispatch B8) still calls
|
|
25
|
-
* this exact shape today, so it stays wired to `pdfEditor.saveBytes()` verbatim — changing its
|
|
26
|
-
* contract here would silently break the current Save/Save As/Ctrl+S path for annotation edits. */
|
|
27
|
-
registerPdfSave?: (fn: (() => Promise<Uint8Array | null>) | null) => void;
|
|
28
|
-
/** Register this pane's full two-phase source/OCR edit save plan (§10.1-§10.3). */
|
|
29
|
-
registerPdfSavePlan?: (fn: (() => Promise<PdfSavePlan>) | null) => void;
|
|
30
|
-
/** Reflects whether unsaved annotation-editor edits exist (pdf.js annotation storage is dirty).
|
|
31
|
-
* The app can use this the same way it uses `docxDirty` for the tab's dirty indicator. */
|
|
32
|
-
onDirtyChange?: (dirty: boolean) => void;
|
|
33
|
-
/** Wave 2 Read mode: annotation tools, source-text edit, and OCR stay off — the viewer is a
|
|
34
|
-
* pure reader. Entering Read commits any in-flight draft and drops active edit modes. */
|
|
35
|
-
readOnly?: boolean;
|
|
36
|
-
}): import("react").JSX.Element;
|