@salmonui/pdf-viewer 0.0.0-stage → 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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -2
  3. package/dist/PdfViewer.d.ts +6 -0
  4. package/dist/PdfViewer.d.ts.map +1 -0
  5. package/dist/PdfViewer.js +151 -0
  6. package/dist/PdfViewer.js.map +1 -0
  7. package/dist/core.d.ts +163 -0
  8. package/dist/core.d.ts.map +1 -0
  9. package/dist/core.js +939 -0
  10. package/dist/core.js.map +1 -0
  11. package/dist/engine/controller.d.ts +57 -0
  12. package/dist/engine/controller.d.ts.map +1 -0
  13. package/dist/engine/controller.js +418 -0
  14. package/dist/engine/controller.js.map +1 -0
  15. package/dist/engine/pdf-worker.d.ts +2 -0
  16. package/dist/engine/pdf-worker.d.ts.map +1 -0
  17. package/dist/engine/pdf-worker.js +23 -0
  18. package/dist/engine/pdf-worker.js.map +1 -0
  19. package/dist/icons.d.ts +5 -0
  20. package/dist/icons.d.ts.map +1 -0
  21. package/dist/icons.js +17 -0
  22. package/dist/icons.js.map +1 -0
  23. package/dist/index.d.ts +8 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +12 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/layout.d.ts +49 -0
  28. package/dist/layout.d.ts.map +1 -0
  29. package/dist/layout.js +115 -0
  30. package/dist/layout.js.map +1 -0
  31. package/dist/locale.d.ts +49 -0
  32. package/dist/locale.d.ts.map +1 -0
  33. package/dist/locale.js +50 -0
  34. package/dist/locale.js.map +1 -0
  35. package/dist/markup.d.ts +54 -0
  36. package/dist/markup.d.ts.map +1 -0
  37. package/dist/markup.js +175 -0
  38. package/dist/markup.js.map +1 -0
  39. package/dist/pdf-viewer.css +1523 -0
  40. package/dist/search.d.ts +36 -0
  41. package/dist/search.d.ts.map +1 -0
  42. package/dist/search.js +89 -0
  43. package/dist/search.js.map +1 -0
  44. package/dist/toolbar.d.ts +19 -0
  45. package/dist/toolbar.d.ts.map +1 -0
  46. package/dist/toolbar.js +128 -0
  47. package/dist/toolbar.js.map +1 -0
  48. package/dist/types.d.ts +227 -0
  49. package/dist/types.d.ts.map +1 -0
  50. package/dist/types.js +2 -0
  51. package/dist/types.js.map +1 -0
  52. package/dist/zoom.d.ts +35 -0
  53. package/dist/zoom.d.ts.map +1 -0
  54. package/dist/zoom.js +58 -0
  55. package/dist/zoom.js.map +1 -0
  56. package/package.json +44 -4
@@ -0,0 +1,36 @@
1
+ export interface PageText {
2
+ readonly text: string;
3
+ /** Start offset of each item in `text`. */
4
+ readonly starts: readonly number[];
5
+ /** Item strings (the text layer spans). */
6
+ readonly items: readonly string[];
7
+ }
8
+ export interface TextItemLike {
9
+ readonly str: string;
10
+ readonly hasEOL?: boolean | undefined;
11
+ }
12
+ export declare function buildPageText(items: readonly TextItemLike[]): PageText;
13
+ export interface SearchMatch {
14
+ /** 0-based page. */
15
+ readonly page: number;
16
+ readonly start: number;
17
+ readonly end: number;
18
+ }
19
+ export interface MatchOptions {
20
+ readonly matchCase?: boolean | undefined;
21
+ readonly wholeWord?: boolean | undefined;
22
+ }
23
+ /** Matches of `query` in one page text. Whitespace runs in the query match one space. */
24
+ export declare function findInText(text: string, query: string, options?: MatchOptions): Array<[number, number]>;
25
+ /** Matches over every page, in document order. */
26
+ export declare function findMatches(pages: readonly PageText[], query: string, options?: MatchOptions): SearchMatch[];
27
+ /** Item index and offset within the item of a text offset (clamped to the item bounds). */
28
+ export declare function locate(pageText: PageText, offset: number): {
29
+ readonly item: number;
30
+ readonly offset: number;
31
+ };
32
+ /** Per-item `[item, from, to]` pieces of a match (a match may span several spans). */
33
+ export declare function matchPieces(pageText: PageText, start: number, end: number): Array<[number, number, number]>;
34
+ /** Match counts per 1-based page. */
35
+ export declare function countByPage(matches: readonly SearchMatch[]): Record<number, number>;
36
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+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AQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAW7G;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAW3G;AAED,qCAAqC;AACrC,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAInF"}
package/dist/search.js ADDED
@@ -0,0 +1,89 @@
1
+ // Text search for PdfViewer. Pure: the page text is the
2
+ // concatenation of the engine's text items (one text-layer span each), with
3
+ // a space where a line ends; matches are offsets into that text and map back
4
+ // to (item, offset) pairs for highlighting.
5
+ export function buildPageText(items) {
6
+ let text = '';
7
+ const starts = [];
8
+ const strs = [];
9
+ for (const item of items) {
10
+ starts.push(text.length);
11
+ strs.push(item.str);
12
+ text += item.str;
13
+ if (item.hasEOL && !/\s$/.test(item.str))
14
+ text += ' ';
15
+ }
16
+ return { text, starts, items: strs };
17
+ }
18
+ const WORD = /[\p{L}\p{N}_]/u;
19
+ const isWord = (ch) => ch !== undefined && WORD.test(ch);
20
+ /** Lowercases per UTF-16 unit so offsets stay aligned with the source text. */
21
+ const fold = (s) => (s.length === s.toLowerCase().length ? s.toLowerCase() : Array.from(s, (c) => (c.toLowerCase().length === c.length ? c.toLowerCase() : c)).join(''));
22
+ const collapse = (s) => s.replace(/\s+/g, ' ').trim();
23
+ /** Matches of `query` in one page text. Whitespace runs in the query match one space. */
24
+ export function findInText(text, query, options = {}) {
25
+ const q = collapse(query);
26
+ if (!q)
27
+ return [];
28
+ const hay = (options.matchCase ? text : fold(text)).replace(/\s/g, ' ');
29
+ const needle = options.matchCase ? q : fold(q);
30
+ const out = [];
31
+ let from = 0;
32
+ for (;;) {
33
+ const at = hay.indexOf(needle, from);
34
+ if (at < 0)
35
+ break;
36
+ const end = at + needle.length;
37
+ if (!options.wholeWord || (!isWord(hay[at - 1]) && !isWord(hay[end])))
38
+ out.push([at, end]);
39
+ from = at + Math.max(1, needle.length);
40
+ }
41
+ return out;
42
+ }
43
+ /** Matches over every page, in document order. */
44
+ export function findMatches(pages, query, options = {}) {
45
+ const out = [];
46
+ pages.forEach((p, page) => {
47
+ for (const [start, end] of findInText(p.text, query, options))
48
+ out.push({ page, start, end });
49
+ });
50
+ return out;
51
+ }
52
+ /** Item index and offset within the item of a text offset (clamped to the item bounds). */
53
+ export function locate(pageText, offset) {
54
+ const { starts, items } = pageText;
55
+ let lo = 0;
56
+ let hi = starts.length - 1;
57
+ if (hi < 0)
58
+ return { item: 0, offset: 0 };
59
+ while (lo < hi) {
60
+ const mid = (lo + hi + 1) >> 1;
61
+ if (starts[mid] <= offset)
62
+ lo = mid;
63
+ else
64
+ hi = mid - 1;
65
+ }
66
+ return { item: lo, offset: Math.min(Math.max(0, offset - starts[lo]), items[lo].length) };
67
+ }
68
+ /** Per-item `[item, from, to]` pieces of a match (a match may span several spans). */
69
+ export function matchPieces(pageText, start, end) {
70
+ const a = locate(pageText, start);
71
+ const b = locate(pageText, end);
72
+ const out = [];
73
+ for (let i = a.item; i <= b.item; i++) {
74
+ const len = pageText.items[i].length;
75
+ const from = i === a.item ? a.offset : 0;
76
+ const to = i === b.item ? b.offset : len;
77
+ if (to > from)
78
+ out.push([i, from, to]);
79
+ }
80
+ return out;
81
+ }
82
+ /** Match counts per 1-based page. */
83
+ export function countByPage(matches) {
84
+ const out = {};
85
+ for (const m of matches)
86
+ out[m.page + 1] = (out[m.page + 1] ?? 0) + 1;
87
+ return out;
88
+ }
89
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,4EAA4E;AAC5E,6EAA6E;AAC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reSnapshot, ViewerCore } from './core.js';
3
+ import { type PdfViewerLocaleText } from './locale.js';
4
+ import type { PdfViewerProps, PdfViewerToolbarItem } from './types.js';
5
+ export declare const DEFAULT_TOOLBAR: readonly PdfViewerToolbarItem[];
6
+ interface Ctx {
7
+ readonly core: ViewerCore;
8
+ readonly snap: CoreSnapshot;
9
+ readonly t: PdfViewerLocaleText;
10
+ }
11
+ export declare function ViewerToolbar({ core, snap, t, props }: Ctx & {
12
+ readonly props: PdfViewerProps;
13
+ }): import("react").JSX.Element;
14
+ export declare function FindBar({ core, snap, t, className, style }: Ctx & {
15
+ readonly className?: string | undefined;
16
+ readonly style?: CSSProperties | undefined;
17
+ }): import("react").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../src/toolbar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,aAAa,EAAkB,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EAAQ,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAiB,MAAM,YAAY,CAAC;AAGtF,eAAO,MAAM,eAAe,EAAE,SAAS,oBAAoB,EAkBhD,CAAC;AAEZ,UAAU,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,CAAC,EAAE,mBAAmB,CAAC;CACjC;AAqGD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,+BAwB/F;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,GAAG;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;CAAE,+BA8CzJ"}
@@ -0,0 +1,128 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // PdfViewer toolbar on the shared Toolbar: one tab stop,
3
+ // roving arrow keys, overflow into a menu below the container width; and
4
+ // the find bar.
5
+ import { useState } from 'react';
6
+ import { Button } from '@salmonui/buttons/button';
7
+ import { MenuButton } from '@salmonui/buttons/menu';
8
+ import { Toolbar, ToolbarItem, ToolbarSeparator, ToolbarSpacer } from '@salmonui/navigation/toolbar';
9
+ import { ICONS } from './icons.js';
10
+ import { fill } from './locale.js';
11
+ import { formatScale, ZOOM_STEPS } from './zoom.js';
12
+ export const DEFAULT_TOOLBAR = Object.freeze([
13
+ 'sidebar',
14
+ '|',
15
+ 'previous',
16
+ 'next',
17
+ 'pageNumber',
18
+ '|',
19
+ 'zoomOut',
20
+ 'zoom',
21
+ 'zoomIn',
22
+ '-',
23
+ 'search',
24
+ 'highlight',
25
+ 'underline',
26
+ 'strikethrough',
27
+ '|',
28
+ 'print',
29
+ 'download',
30
+ ]);
31
+ function PageNumber({ core, snap, t }) {
32
+ const [draft, setDraft] = useState(null);
33
+ const count = snap.sizes.length;
34
+ const commit = () => {
35
+ if (draft === null)
36
+ return;
37
+ const n = Number.parseInt(draft, 10);
38
+ setDraft(null);
39
+ if (Number.isFinite(n))
40
+ core.goToPage(n - 1, 'toolbar');
41
+ };
42
+ return (_jsxs(_Fragment, { children: [_jsx("input", { type: "text", inputMode: "numeric", "aria-label": t.pageNumber, size: 3, value: draft ?? (count ? String(snap.page + 1) : ''), disabled: !count, onChange: (e) => setDraft(e.target.value), onFocus: (e) => e.currentTarget.select(), onBlur: commit, onKeyDown: (e) => {
43
+ if (e.key === 'Enter') {
44
+ e.preventDefault();
45
+ commit();
46
+ }
47
+ else if (e.key === 'Escape')
48
+ setDraft(null);
49
+ } }), _jsx("span", { className: "salmon-pdf-viewer__page-count", children: fill(t.pageOf, { count }) })] }));
50
+ }
51
+ const zoomItems = (t) => [
52
+ { id: 'auto', label: t.zoomAuto },
53
+ { id: 'page-fit', label: t.zoomPageFit },
54
+ { id: 'page-width', label: t.zoomPageWidth },
55
+ { type: 'separator' },
56
+ ...ZOOM_STEPS.map((s) => ({ id: String(s), label: formatScale(s) })),
57
+ ];
58
+ function builtIn(id, { core, snap, t }) {
59
+ const ready = snap.status === 'ready';
60
+ const count = snap.sizes.length;
61
+ const btn = (key, label, icon, onClick, extra = {}) => (_jsx(Button, { "data-item-id": key, variant: "ghost", iconOnly: true, "aria-label": label, title: label, onClick: onClick, ...extra, children: icon }, key));
62
+ switch (id) {
63
+ case 'sidebar':
64
+ return btn('sidebar', t.sidebar, ICONS.sidebar, () => core.setSidebar(snap.sidebar ? null : 'thumbnails'), { 'aria-pressed': !!snap.sidebar, disabled: !count });
65
+ case 'previous':
66
+ return btn('previous', t.previous, ICONS.previous, () => core.stepPage(-1, 'toolbar'), { disabled: !ready || snap.page <= 0 });
67
+ case 'next':
68
+ return btn('next', t.next, ICONS.next, () => core.stepPage(1, 'toolbar'), { disabled: !ready || snap.page >= count - 1 });
69
+ case 'pageNumber':
70
+ return (_jsx(ToolbarItem, { label: t.pageNumber, className: "salmon-pdf-viewer__page-number", overflow: "never", children: _jsx(PageNumber, { core: core, snap: snap, t: t }) }, "pageNumber"));
71
+ case 'zoomOut':
72
+ return btn('zoomOut', t.zoomOut, ICONS.zoomOut, () => core.zoomBy(-1, 'toolbar'), { disabled: snap.scale <= 0.1 });
73
+ case 'zoomIn':
74
+ return btn('zoomIn', t.zoomIn, ICONS.zoomIn, () => core.zoomBy(1, 'toolbar'), { disabled: snap.scale >= 10 });
75
+ case 'zoom':
76
+ return (_jsx(ToolbarItem, { label: t.zoom, overflow: "never", children: _jsx(MenuButton, { "data-item-id": "zoom", variant: "ghost", "aria-label": `${t.zoom}: ${formatScale(snap.scale)}`, items: zoomItems(t), onAction: (event) => {
77
+ const v = Number(event.id);
78
+ core.setZoom((Number.isFinite(v) ? v : event.id), 'toolbar');
79
+ }, children: formatScale(snap.scale) }) }, "zoom"));
80
+ case 'search':
81
+ return btn('search', t.search, ICONS.search, () => core.openFind(!snap.findOpen), { 'aria-expanded': snap.findOpen, disabled: !ready });
82
+ case 'highlight':
83
+ case 'underline':
84
+ case 'strikethrough':
85
+ // Pressing keeps the text selection (no focus move on mouse down).
86
+ return btn(id, t[id], ICONS[id], () => core.addTextMarkup(id), { disabled: !ready || !snap.hasSelection, onMouseDown: (e) => e.preventDefault() });
87
+ case 'print':
88
+ return btn('print', t.print, ICONS.print, () => void core.print(), { disabled: !ready });
89
+ case 'download':
90
+ return btn('download', t.download, ICONS.download, () => void core.download(), { disabled: !ready });
91
+ default:
92
+ return null;
93
+ }
94
+ }
95
+ export function ViewerToolbar({ core, snap, t, props }) {
96
+ const list = props.toolbar === false ? [] : (props.toolbar ?? DEFAULT_TOOLBAR);
97
+ const items = list.map((item, i) => {
98
+ if (item === '|')
99
+ return _jsx(ToolbarSeparator, {}, `sep-${i}`);
100
+ if (item === '-')
101
+ return _jsx(ToolbarSpacer, {}, `spacer-${i}`);
102
+ if (typeof item === 'string')
103
+ return builtIn(item, { core, snap, t });
104
+ if (item.render)
105
+ return _jsx(ToolbarItem, { label: item.label, children: item.render(core.actions) }, item.id);
106
+ const onClick = () => item.onSelect?.(core.actions);
107
+ return item.icon ? (_jsx(Button, { "data-item-id": item.id, variant: "ghost", disabled: item.disabled, iconOnly: true, "aria-label": item.label, title: item.label, onClick: onClick, children: item.icon }, item.id)) : (_jsx(Button, { "data-item-id": item.id, variant: "ghost", disabled: item.disabled, title: item.label, onClick: onClick, children: item.label }, item.id));
108
+ });
109
+ if (props.renderToolbar)
110
+ return _jsx(_Fragment, { children: props.renderToolbar({ items, actions: core.actions, state: core.actions.getState() }) });
111
+ return (_jsx(Toolbar, { "aria-label": t.toolbar, className: ['salmon-pdf-viewer__toolbar', props.classNames?.toolbar].filter(Boolean).join(' '), style: props.styles?.toolbar, localeText: { more: t.more }, children: items }));
112
+ }
113
+ export function FindBar({ core, snap, t, className, style }) {
114
+ const { find } = snap;
115
+ const status = !find.query.trim() ? '' : snap.searching ? '…' : snap.matchTotal ? fill(t.matchCount, { current: snap.matchIndex + 1, total: snap.matchTotal }) : t.noMatches;
116
+ const toggle = (key, label) => (_jsxs("label", { className: "salmon-pdf-viewer__find-option", children: [_jsx("input", { type: "checkbox", checked: find[key], onChange: (e) => core.setFindOption({ [key]: e.target.checked }) }), _jsx("span", { children: label })] }));
117
+ return (_jsxs("div", { className: ['salmon-pdf-viewer__find', className].filter(Boolean).join(' '), style: style, role: "search", "aria-label": t.findLabel, children: [_jsx("input", { ref: (el) => core.setFindInput(el), type: "search", className: "salmon-pdf-viewer__find-input", "aria-label": t.findLabel, placeholder: t.findPlaceholder, value: find.query, onChange: (e) => core.setQuery(e.target.value), onKeyDown: (e) => {
118
+ if (e.key === 'Enter') {
119
+ e.preventDefault();
120
+ core.stepMatch(e.shiftKey ? -1 : 1);
121
+ }
122
+ else if (e.key === 'Escape') {
123
+ e.preventDefault();
124
+ core.openFind(false);
125
+ }
126
+ } }), _jsx(Button, { variant: "ghost", iconOnly: true, "aria-label": t.findPrevious, title: t.findPrevious, disabled: !snap.matchTotal, onClick: () => core.stepMatch(-1), children: ICONS.previous }), _jsx(Button, { variant: "ghost", iconOnly: true, "aria-label": t.findNext, title: t.findNext, disabled: !snap.matchTotal, onClick: () => core.stepMatch(1), children: ICONS.next }), toggle('matchCase', t.matchCase), toggle('wholeWord', t.wholeWord), toggle('highlightAll', t.highlightAll), _jsx("span", { className: "salmon-pdf-viewer__find-status", role: "status", "aria-live": "polite", children: status }), _jsx(Button, { variant: "ghost", iconOnly: true, "aria-label": t.closeFind, title: t.closeFind, onClick: () => core.openFind(false), children: ICONS.close })] }));
127
+ }
128
+ //# sourceMappingURL=toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../src/toolbar.tsx"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,yEAAyE;AACzE,gBAAgB;AAChB,OAAO,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAErG,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAA4B,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAoC,MAAM,CAAC,MAAM,CAAC;IAC5E,SAAS;IACT,GAAG;IACH,UAAU;IACV,MAAM;IACN,YAAY;IACZ,GAAG;IACH,SAAS;IACT,MAAM;IACN,QAAQ;IACR,GAAG;IACH,QAAQ;IACR,WAAW;IACX,WAAW;IACX,eAAe;IACf,GAAG;IACH,OAAO;IACP,UAAU;CACF,CAAC,CAAC;AAQZ,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAO;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAChC,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QAC3B,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,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E,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,YACrI,KAAK,CAAC,IAAI,GACJ,EACR,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,EAChC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,EAChC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,CAAC,EACvC,eAAM,SAAS,EAAC,gCAAgC,EAAC,IAAI,EAAC,QAAQ,eAAW,QAAQ,YAC9E,MAAM,GACF,EACP,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,QAAQ,sBAAa,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,YAC9G,KAAK,CAAC,KAAK,GACL,IACL,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,227 @@
1
+ import type { CSSProperties, HTMLAttributes, ReactNode, Ref, RefObject } from 'react';
2
+ import type { PdfViewerLocaleText } from './locale.js';
3
+ /** A document: a URL (string or `URL`) or the bytes (`ArrayBuffer`, `Uint8Array`, `Blob`). */
4
+ export type PdfViewerSource = string | URL | ArrayBuffer | Uint8Array | Blob;
5
+ /** A scale (`1` = 100 %) or a fit mode. */
6
+ export type PdfViewerZoom = number | 'page-fit' | 'page-width' | 'auto';
7
+ export type PdfViewerScrollMode = 'vertical' | 'horizontal' | 'wrapped' | 'page';
8
+ /** `'odd'` starts spreads on odd pages (1-2, 3-4), `'even'` on even pages (1, 2-3). */
9
+ export type PdfViewerSpreadMode = 'none' | 'odd' | 'even';
10
+ export type PdfViewerSidebar = 'thumbnails' | 'outline';
11
+ /** Page size in PDF points (1/72 inch), in the displayed orientation. */
12
+ export interface PdfPageSize {
13
+ readonly width: number;
14
+ readonly height: number;
15
+ }
16
+ /** A rectangle in PDF user space: `[x1, y1, x2, y2]`, origin at the bottom left of the page. */
17
+ export type PdfRect = readonly [number, number, number, number];
18
+ export type PdfTextMarkupKind = 'highlight' | 'underline' | 'strikethrough';
19
+ /** A text markup annotation. Coordinates are zoom independent. */
20
+ export interface PdfTextMarkupAnnotation {
21
+ readonly id: string;
22
+ readonly kind: PdfTextMarkupKind;
23
+ /** 1-based page number. */
24
+ readonly page: number;
25
+ /** One rectangle per marked line, PDF user space. */
26
+ readonly rects: readonly PdfRect[];
27
+ /** CSS hex color `#rrggbb`. */
28
+ readonly color: string;
29
+ /** 0..1; default 1 (highlights render with a multiply blend). */
30
+ readonly opacity?: number | undefined;
31
+ readonly author?: string | undefined;
32
+ readonly comment?: string | undefined;
33
+ /** The marked text, when known. */
34
+ readonly text?: string | undefined;
35
+ /** ISO 8601 creation time. */
36
+ readonly createdAt?: string | undefined;
37
+ }
38
+ /** AcroForm field values by field name: text and choice fields are strings, list boxes string arrays, check boxes booleans, radio groups the selected export value. */
39
+ export type PdfFormValue = string | boolean | readonly string[];
40
+ export type PdfFormValues = Readonly<Record<string, PdfFormValue>>;
41
+ export type PdfViewerEventSource = 'toolbar' | 'keyboard' | 'scroll' | 'pinch' | 'wheel' | 'api' | 'link' | 'outline' | 'thumbnail' | 'search' | 'prop' | 'load';
42
+ export type PdfViewerToolbarItemId = 'sidebar' | 'previous' | 'next' | 'pageNumber' | 'zoomOut' | 'zoomIn' | 'zoom' | 'search' | 'highlight' | 'underline' | 'strikethrough' | 'print' | 'download';
43
+ /** A custom toolbar button, or any content through `render`. */
44
+ export interface PdfViewerToolbarCustomItem {
45
+ readonly id: string;
46
+ /** Accessible name, tooltip and overflow menu text. */
47
+ readonly label: string;
48
+ readonly icon?: ReactNode;
49
+ readonly disabled?: boolean | undefined;
50
+ readonly onSelect?: ((actions: PdfViewerActions) => void) | undefined;
51
+ /** Replaces the button. */
52
+ readonly render?: ((actions: PdfViewerActions) => ReactNode) | undefined;
53
+ }
54
+ /** Built-in ids, custom items, `'|'` (separator) and `'-'` (spacer). */
55
+ export type PdfViewerToolbarItem = PdfViewerToolbarItemId | '|' | '-' | PdfViewerToolbarCustomItem;
56
+ export interface PdfViewerOutlineItem {
57
+ readonly id: string;
58
+ readonly title: string;
59
+ /** Target page (1-based) when it resolves to one. */
60
+ readonly page: number | null;
61
+ readonly url: string | null;
62
+ readonly items: readonly PdfViewerOutlineItem[];
63
+ }
64
+ export interface PdfViewerLoadInfo {
65
+ readonly pageCount: number;
66
+ readonly pageSizes: readonly PdfPageSize[];
67
+ readonly title: string | null;
68
+ readonly outline: readonly PdfViewerOutlineItem[];
69
+ /** AcroForm field names in document order. */
70
+ readonly formFields: readonly string[];
71
+ }
72
+ export interface PdfViewerPasswordRequest {
73
+ /** `'required'` on the first prompt, `'incorrect'` after a wrong password. */
74
+ readonly reason: 'required' | 'incorrect';
75
+ submit(password: string): void;
76
+ /** Gives up; `onLoadError` reports a `PasswordException`. */
77
+ cancel(): void;
78
+ }
79
+ export interface PdfViewerSearchOptions {
80
+ readonly matchCase?: boolean | undefined;
81
+ readonly wholeWord?: boolean | undefined;
82
+ /** Highlight every match, not only the current one. Default true. */
83
+ readonly highlightAll?: boolean | undefined;
84
+ }
85
+ export interface PdfViewerSearchResult {
86
+ readonly query: string;
87
+ readonly total: number;
88
+ /** 1-based index of the current match; 0 when there is none. */
89
+ readonly current: number;
90
+ /** Page of the current match; 0 when there is none. */
91
+ readonly page: number;
92
+ /** Matches per page (1-based page -> count). */
93
+ readonly pages: Readonly<Record<number, number>>;
94
+ }
95
+ export interface PdfViewerCancelableEvent {
96
+ preventDefault(): void;
97
+ readonly defaultPrevented: boolean;
98
+ }
99
+ export interface PdfViewerLinkEvent extends PdfViewerCancelableEvent {
100
+ /** External link target; `null` for an internal link. */
101
+ readonly url: string | null;
102
+ /** Target page of an internal link; `null` when external or unresolved. */
103
+ readonly page: number | null;
104
+ }
105
+ export interface PdfViewerAnnotationsChangeEvent {
106
+ readonly reason: 'create' | 'remove';
107
+ readonly annotation: PdfTextMarkupAnnotation;
108
+ }
109
+ /** Commands (`actionsRef`). */
110
+ export interface PdfViewerActions {
111
+ /** Scrolls to a page (1-based, clamped). */
112
+ goToPage(page: number): void;
113
+ /** Runs a search over every page; resolves when all pages are searched. */
114
+ search(query: string, options?: PdfViewerSearchOptions): Promise<PdfViewerSearchResult>;
115
+ findNext(): void;
116
+ findPrevious(): void;
117
+ clearSearch(): void;
118
+ setZoom(zoom: PdfViewerZoom): void;
119
+ /** Opens the print dialog; resolves `false` when `onBeforePrint` cancelled. */
120
+ print(): Promise<boolean>;
121
+ /** The document with the current form values and text markup annotations written into it. */
122
+ save(): Promise<Blob>;
123
+ /** Saves and downloads as `fileName` (default the `fileName` prop). */
124
+ download(fileName?: string): Promise<void>;
125
+ /** Marks the current text selection; returns the new annotations (one per page). */
126
+ addTextMarkup(kind: PdfTextMarkupKind, options?: {
127
+ readonly color?: string;
128
+ readonly opacity?: number;
129
+ readonly comment?: string;
130
+ }): readonly PdfTextMarkupAnnotation[];
131
+ removeAnnotation(id: string): void;
132
+ /** Current page, page count and scale. */
133
+ getState(): PdfViewerStateSnapshot;
134
+ /** Opens or closes the find bar. */
135
+ openFind(open?: boolean): void;
136
+ }
137
+ export interface PdfViewerStateSnapshot {
138
+ readonly status: 'empty' | 'loading' | 'password' | 'ready' | 'error';
139
+ readonly page: number;
140
+ readonly pageCount: number;
141
+ /** Effective scale (a fit mode resolved). */
142
+ readonly scale: number;
143
+ readonly zoom: PdfViewerZoom;
144
+ }
145
+ export interface PdfViewerToolbarContext {
146
+ /** The built-in toolbar content (place it in your own bar, or ignore it). */
147
+ readonly items: ReactNode;
148
+ readonly actions: PdfViewerActions;
149
+ readonly state: PdfViewerStateSnapshot;
150
+ }
151
+ export type PdfViewerPart = 'toolbar' | 'sidebar' | 'viewport' | 'findBar';
152
+ export interface PdfViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onLoad' | 'onError' | 'children' | 'defaultValue'> {
153
+ /** The document. Changing it loads the new document. */
154
+ readonly src?: PdfViewerSource | null | undefined;
155
+ /** URL of the pdf.js worker module; default the worker that ships with `pdfjs-dist`, bundled through `new Worker(new URL(...))`. */
156
+ readonly workerSrc?: string | URL | undefined;
157
+ /** Extra `getDocument()` options (`cMapUrl`, `standardFontDataUrl`, `wasmUrl`, `withCredentials`, `httpHeaders`). */
158
+ readonly documentOptions?: Readonly<Record<string, unknown>> | undefined;
159
+ /** Password of an encrypted document. */
160
+ readonly password?: string | undefined;
161
+ /** Replaces the built-in password dialog. */
162
+ readonly onPasswordRequired?: ((request: PdfViewerPasswordRequest) => void) | undefined;
163
+ readonly onLoad?: ((info: PdfViewerLoadInfo) => void) | undefined;
164
+ readonly onLoadError?: ((error: Error) => void) | undefined;
165
+ /** Page sizes in PDF points the server can lay out before the engine loads; one size applies to every page. */
166
+ readonly pageSizes?: readonly PdfPageSize[] | PdfPageSize | undefined;
167
+ /** Number of pages for placeholders when `pageSizes` is a single size. */
168
+ readonly pageCount?: number | undefined;
169
+ /** Controlled 1-based page. */
170
+ readonly page?: number | undefined;
171
+ readonly defaultPage?: number | undefined;
172
+ readonly onPageChange?: ((page: number, event: {
173
+ readonly source: PdfViewerEventSource;
174
+ }) => void) | undefined;
175
+ /** Controlled zoom. Default `'auto'`. */
176
+ readonly zoom?: PdfViewerZoom | undefined;
177
+ readonly defaultZoom?: PdfViewerZoom | undefined;
178
+ readonly onZoomChange?: ((zoom: PdfViewerZoom, event: {
179
+ readonly scale: number;
180
+ readonly source: PdfViewerEventSource;
181
+ }) => void) | undefined;
182
+ /** Default `'vertical'`. */
183
+ readonly scrollMode?: PdfViewerScrollMode | undefined;
184
+ /** Default `'none'`. */
185
+ readonly spreadMode?: PdfViewerSpreadMode | undefined;
186
+ /** Open panel; `null` closes it. */
187
+ readonly sidebar?: PdfViewerSidebar | null | undefined;
188
+ readonly defaultSidebar?: PdfViewerSidebar | null | undefined;
189
+ readonly onSidebarChange?: ((sidebar: PdfViewerSidebar | null) => void) | undefined;
190
+ /** Toolbar items; `false` hides the toolbar. */
191
+ readonly toolbar?: readonly PdfViewerToolbarItem[] | false | undefined;
192
+ /** Replaces the toolbar. */
193
+ readonly renderToolbar?: ((context: PdfViewerToolbarContext) => ReactNode) | undefined;
194
+ /** Native text selection and copy over the text layer. Default true. */
195
+ readonly textSelection?: boolean | undefined;
196
+ /** Where external links open. Default `'_blank'`. */
197
+ readonly linkTarget?: '_blank' | '_self' | '_parent' | '_top' | undefined;
198
+ /** Cancellable; `preventDefault()` keeps the viewer from following the link. */
199
+ readonly onLinkClick?: ((event: PdfViewerLinkEvent) => void) | undefined;
200
+ /** Cancellable. */
201
+ readonly onBeforePrint?: ((event: PdfViewerCancelableEvent) => void) | undefined;
202
+ /** Print resolution in DPI. Default 150. */
203
+ readonly printResolution?: number | undefined;
204
+ /** Download file name. Default `'document.pdf'`. */
205
+ readonly fileName?: string | undefined;
206
+ readonly onSearchResult?: ((result: PdfViewerSearchResult) => void) | undefined;
207
+ /** Controlled text markup annotations. */
208
+ readonly annotations?: readonly PdfTextMarkupAnnotation[] | undefined;
209
+ readonly defaultAnnotations?: readonly PdfTextMarkupAnnotation[] | undefined;
210
+ readonly onAnnotationsChange?: ((annotations: readonly PdfTextMarkupAnnotation[], event: PdfViewerAnnotationsChangeEvent) => void) | undefined;
211
+ /** Author written into new annotations. */
212
+ readonly annotationAuthor?: string | undefined;
213
+ /** Default colors of the markup kinds. */
214
+ readonly annotationColors?: Partial<Record<PdfTextMarkupKind, string>> | undefined;
215
+ /** Controlled AcroForm values by field name; fields not listed keep the document's values. */
216
+ readonly formValues?: PdfFormValues | undefined;
217
+ readonly defaultFormValues?: PdfFormValues | undefined;
218
+ readonly onFormValuesChange?: ((values: PdfFormValues, event: {
219
+ readonly name: string;
220
+ }) => void) | undefined;
221
+ readonly actionsRef?: RefObject<PdfViewerActions | null> | ((actions: PdfViewerActions | null) => void) | undefined;
222
+ readonly localeText?: Partial<PdfViewerLocaleText> | undefined;
223
+ readonly classNames?: Partial<Record<PdfViewerPart, string>> | undefined;
224
+ readonly styles?: Partial<Record<PdfViewerPart, CSSProperties>> | undefined;
225
+ readonly ref?: Ref<HTMLDivElement> | undefined;
226
+ }
227
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,8FAA8F;AAC9F,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,GAAG,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;AAC7E,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;AACjF,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,SAAS,CAAC;AACxD,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AACD,gGAAgG;AAChG,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,GAAG,eAAe,CAAC;AAE5E,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,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C;IAC/C,0CAA0C;IAC1C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IAEnF,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAE9G,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IAC/D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,GAAG,SAAS,CAAC;IAC5E,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;CAChD"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/dist/zoom.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import type { PdfPageSize, PdfViewerScrollMode, PdfViewerSpreadMode, PdfViewerZoom } from './types.js';
2
+ /** CSS pixels per PDF point at scale 1. */
3
+ export declare const PDF_TO_CSS: number;
4
+ export declare const MIN_SCALE = 0.1;
5
+ export declare const MAX_SCALE = 10;
6
+ /** Largest scale `'auto'` picks for a portrait page (pdf.js `MAX_AUTO_SCALE`). */
7
+ export declare const MAX_AUTO_SCALE = 1.25;
8
+ /** Zoom steps of the zoom in / out commands and the zoom menu. */
9
+ export declare const ZOOM_STEPS: readonly number[];
10
+ /** Space around pages (px) kept free by the fit modes. */
11
+ export declare const PAGE_GAP = 12;
12
+ export declare const VIEW_PADDING = 16;
13
+ export declare const clampScale: (scale: number) => number;
14
+ export interface FitContext {
15
+ /** Size of the reference page in PDF points (displayed orientation). */
16
+ readonly page: PdfPageSize;
17
+ /** Size of the scroll viewport in CSS px. */
18
+ readonly viewport: {
19
+ readonly width: number;
20
+ readonly height: number;
21
+ };
22
+ readonly scrollMode?: PdfViewerScrollMode | undefined;
23
+ readonly spreadMode?: PdfViewerSpreadMode | undefined;
24
+ }
25
+ /** Resolves a zoom value to a numeric scale (fit modes measure the reference page against the viewport). */
26
+ export declare function resolveScale(zoom: PdfViewerZoom, context: FitContext): number;
27
+ /** Next zoom step from `scale` (`direction` 1 zooms in, -1 out). */
28
+ export declare function stepScale(scale: number, direction: 1 | -1): number;
29
+ /** Scale after a pinch or Ctrl+wheel gesture: multiplicative and clamped. */
30
+ export declare function pinchScale(start: number, factor: number): number;
31
+ /** Wheel delta (ctrl/pinch wheel events) to a multiplicative factor. */
32
+ export declare const wheelFactor: (deltaY: number) => number;
33
+ /** Percentage label of a scale (`1.25` -> `"125%"`). */
34
+ export declare const formatScale: (scale: number) => string;
35
+ //# sourceMappingURL=zoom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../src/zoom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,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