@atlaskit/media-document-viewer 0.7.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +58 -0
- package/CHANGELOG.md +35 -0
- package/dist/cjs/usePageContent.js +6 -6
- package/dist/cjs/utils/useCachedGetImage.js +10 -10
- package/dist/esm/usePageContent.js +6 -6
- package/dist/esm/utils/useCachedGetImage.js +10 -10
- package/package.json +10 -17
- package/dist/types-ts4.5/annotations.d.ts +0 -12
- package/dist/types-ts4.5/documentLinks.d.ts +0 -6
- package/dist/types-ts4.5/documentViewer.d.ts +0 -23
- package/dist/types-ts4.5/index.d.ts +0 -2
- package/dist/types-ts4.5/page.d.ts +0 -23
- package/dist/types-ts4.5/types.d.ts +0 -80
- package/dist/types-ts4.5/usePageContent.d.ts +0 -15
- package/dist/types-ts4.5/utils/getDocumentRoot.d.ts +0 -3
- package/dist/types-ts4.5/utils/useCachedGetImage.d.ts +0 -1
- package/dist/types-ts4.5/utils/useIntersectionObserver.d.ts +0 -5
package/AGENTS.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# media-document-viewer — Agent Guide
|
|
2
|
+
|
|
3
|
+
> **Parent guide:** Always read [`../AGENTS.md`](../AGENTS.md) before working in this package — it
|
|
4
|
+
> contains workspace-wide rules covering platform guidelines, changeset workflow, accessibility
|
|
5
|
+
> standards, and the knowledge index protocol that applies to every Media package.
|
|
6
|
+
|
|
7
|
+
## Package identity
|
|
8
|
+
|
|
9
|
+
| Field | Value |
|
|
10
|
+
| -------- | ------------------------------------------------------------------------------------------------------ |
|
|
11
|
+
| NPM name | `@atlaskit/media-document-viewer` |
|
|
12
|
+
| Path | `media-document-viewer/` |
|
|
13
|
+
| Owner | Media Exif |
|
|
14
|
+
| Purpose | Modern and fast document viewer — renders paginated document previews with annotation and link support |
|
|
15
|
+
|
|
16
|
+
## Knowledge index
|
|
17
|
+
|
|
18
|
+
> Read, search, edit, investigate, and validate the repository knowledge index at
|
|
19
|
+
> `.agents/knowledge-index/`. ALWAYS use this skill before making ANY repo change, or when exploring
|
|
20
|
+
> the codebase. The knowledge index is the canonical starting point for every coding task in this
|
|
21
|
+
> repo, trigger this skill aggressively whenever the user mentions architecture, conventions,
|
|
22
|
+
> packages, modules, services, build, coding, writing code, APIs, feature flags, testing, or
|
|
23
|
+
> anything similar. Also trigger when "is the knowledge index up to date?" / "update the knowledge
|
|
24
|
+
> index" / "what does the knowledge index say about Y?" — even if they don't say the words
|
|
25
|
+
> "knowledge index". Also use it (via the `validate` subcommand) to detect drift between the
|
|
26
|
+
> codebase and the docs after any code change. Use the `generate` subcommand to bootstrap the index
|
|
27
|
+
> in a new repository.
|
|
28
|
+
|
|
29
|
+
**Entry point:** `.agents/knowledge-index/INDEX.md`
|
|
30
|
+
**Unit doc:** `.agents/knowledge-index/domains/media/units/atlaskit-media-document-viewer.md`
|
|
31
|
+
**Standards page:** `.agents/knowledge-index/domains/media/units/atlaskit-media-document-viewer/standards-and-patterns.md`
|
|
32
|
+
**CLI:** `python3 .agents/skills/knowledge-index/scripts/kg.py {find,read,edit,investigate,validate,init,explore,generate} …`
|
|
33
|
+
**Refresh protocol:** never silently bump `Last verified` — always re-read the listed `Sources` first, edit, then `kg.py edit <path> --message "<reason>"`.
|
|
34
|
+
|
|
35
|
+
## Key source files
|
|
36
|
+
|
|
37
|
+
- `src/index.ts` — public API entry point
|
|
38
|
+
- `src/documentViewer.tsx` — main `DocumentViewer` component
|
|
39
|
+
- `src/page.tsx` — individual page rendering
|
|
40
|
+
- `src/annotations.tsx` — annotation overlay
|
|
41
|
+
- `src/documentLinks.tsx` — document link handling
|
|
42
|
+
- `src/usePageContent.ts` — hook for page content fetching
|
|
43
|
+
- `src/utils/` — utilities
|
|
44
|
+
- `__tests__/playwright/` — Playwright integration tests
|
|
45
|
+
- `__tests__/vr-tests/` — visual regression tests
|
|
46
|
+
|
|
47
|
+
## Public API (key exports)
|
|
48
|
+
|
|
49
|
+
`DocumentViewer`, `DOCUMENT_SCROLL_ROOT_ID`
|
|
50
|
+
|
|
51
|
+
## Development notes
|
|
52
|
+
|
|
53
|
+
- Only internal dependency: `@atlaskit/media-common`
|
|
54
|
+
- No feature flags registered in this package
|
|
55
|
+
- Peer dependency: `react`
|
|
56
|
+
- Has both Playwright and VR test suites
|
|
57
|
+
- All new behaviour changes must be behind a feature gate (`fg()` from
|
|
58
|
+
`@atlaskit/platform-feature-flags`)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @atlaskit/media-document-viewer
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ee28cf33718b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee28cf33718b0) -
|
|
8
|
+
Add @atlassian/react-compiler-gating as a runtime dependency to enable React Compiler platform
|
|
9
|
+
gating.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 1.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
|
|
17
|
+
Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
|
|
18
|
+
|
|
19
|
+
Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
|
|
20
|
+
|
|
21
|
+
Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
|
|
22
|
+
|
|
23
|
+
```diff
|
|
24
|
+
- "typesVersions": {
|
|
25
|
+
- ">=4.5 <4.9": {
|
|
26
|
+
- "*": [
|
|
27
|
+
- "dist/types-ts4.5/*",
|
|
28
|
+
- "dist/types-ts4.5/index.d.ts"
|
|
29
|
+
- ]
|
|
30
|
+
- }
|
|
31
|
+
- },
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
3
38
|
## 0.7.2
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -21,29 +21,29 @@ function usePageContent(getContent, paginationSize) {
|
|
|
21
21
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pageInd) {
|
|
22
22
|
var _contentRangesRequest, _contentRangesRequest2;
|
|
23
23
|
var contentRangeInd, startIndex, endIndex, content;
|
|
24
|
-
return _regenerator.default.wrap(function
|
|
24
|
+
return _regenerator.default.wrap(function (_context) {
|
|
25
25
|
while (1) switch (_context.prev = _context.next) {
|
|
26
26
|
case 0:
|
|
27
27
|
contentRangeInd = Math.floor(pageInd / paginationSize); // Content already loaded for this page range
|
|
28
28
|
if (!contentRanges[contentRangeInd]) {
|
|
29
|
-
_context.next =
|
|
29
|
+
_context.next = 1;
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
return _context.abrupt("return");
|
|
33
|
-
case
|
|
33
|
+
case 1:
|
|
34
34
|
startIndex = contentRangeInd * paginationSize;
|
|
35
35
|
endIndex = startIndex + paginationSize;
|
|
36
36
|
(_contentRangesRequest2 = (_contentRangesRequest = contentRangesRequestRef.current)[contentRangeInd]) !== null && _contentRangesRequest2 !== void 0 ? _contentRangesRequest2 : _contentRangesRequest[contentRangeInd] = getContent(startIndex, endIndex);
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 2;
|
|
38
38
|
return contentRangesRequestRef.current[contentRangeInd];
|
|
39
|
-
case
|
|
39
|
+
case 2:
|
|
40
40
|
content = _context.sent;
|
|
41
41
|
setContentRanges(function (prev) {
|
|
42
42
|
var newRanges = (0, _toConsumableArray2.default)(prev);
|
|
43
43
|
newRanges[contentRangeInd] = content;
|
|
44
44
|
return newRanges;
|
|
45
45
|
});
|
|
46
|
-
case
|
|
46
|
+
case 3:
|
|
47
47
|
case "end":
|
|
48
48
|
return _context.stop();
|
|
49
49
|
}
|
|
@@ -23,36 +23,36 @@ var useCachedGetImage = exports.useCachedGetImage = function useCachedGetImage(g
|
|
|
23
23
|
var getImageUrl = (0, _mediaCommon.useStaticCallback)( /*#__PURE__*/function () {
|
|
24
24
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pageNumber, zoom) {
|
|
25
25
|
var key, url, isBlobUrl, blob;
|
|
26
|
-
return _regenerator.default.wrap(function
|
|
26
|
+
return _regenerator.default.wrap(function (_context) {
|
|
27
27
|
while (1) switch (_context.prev = _context.next) {
|
|
28
28
|
case 0:
|
|
29
29
|
key = "".concat(pageNumber, "-").concat(zoom);
|
|
30
30
|
if (!imageUrlRefs.current[key]) {
|
|
31
|
-
_context.next =
|
|
31
|
+
_context.next = 1;
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
return _context.abrupt("return", imageUrlRefs.current[key]);
|
|
35
|
-
case
|
|
36
|
-
_context.next =
|
|
35
|
+
case 1:
|
|
36
|
+
_context.next = 2;
|
|
37
37
|
return getPageImageUrl(pageNumber, zoom);
|
|
38
|
-
case
|
|
38
|
+
case 2:
|
|
39
39
|
url = _context.sent;
|
|
40
40
|
isBlobUrl = url.startsWith('blob:');
|
|
41
41
|
if (isBlobUrl) {
|
|
42
|
-
_context.next =
|
|
42
|
+
_context.next = 4;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
|
-
_context.next =
|
|
45
|
+
_context.next = 3;
|
|
46
46
|
return fetch(url).then(function (res) {
|
|
47
47
|
return res.blob();
|
|
48
48
|
});
|
|
49
|
-
case
|
|
49
|
+
case 3:
|
|
50
50
|
blob = _context.sent;
|
|
51
51
|
url = URL.createObjectURL(blob);
|
|
52
|
-
case
|
|
52
|
+
case 4:
|
|
53
53
|
imageUrlRefs.current[key] = url;
|
|
54
54
|
return _context.abrupt("return", url);
|
|
55
|
-
case
|
|
55
|
+
case 5:
|
|
56
56
|
case "end":
|
|
57
57
|
return _context.stop();
|
|
58
58
|
}
|
|
@@ -14,29 +14,29 @@ export function usePageContent(getContent, paginationSize) {
|
|
|
14
14
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageInd) {
|
|
15
15
|
var _contentRangesRequest, _contentRangesRequest2;
|
|
16
16
|
var contentRangeInd, startIndex, endIndex, content;
|
|
17
|
-
return _regeneratorRuntime.wrap(function
|
|
17
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
20
|
contentRangeInd = Math.floor(pageInd / paginationSize); // Content already loaded for this page range
|
|
21
21
|
if (!contentRanges[contentRangeInd]) {
|
|
22
|
-
_context.next =
|
|
22
|
+
_context.next = 1;
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
return _context.abrupt("return");
|
|
26
|
-
case
|
|
26
|
+
case 1:
|
|
27
27
|
startIndex = contentRangeInd * paginationSize;
|
|
28
28
|
endIndex = startIndex + paginationSize;
|
|
29
29
|
(_contentRangesRequest2 = (_contentRangesRequest = contentRangesRequestRef.current)[contentRangeInd]) !== null && _contentRangesRequest2 !== void 0 ? _contentRangesRequest2 : _contentRangesRequest[contentRangeInd] = getContent(startIndex, endIndex);
|
|
30
|
-
_context.next =
|
|
30
|
+
_context.next = 2;
|
|
31
31
|
return contentRangesRequestRef.current[contentRangeInd];
|
|
32
|
-
case
|
|
32
|
+
case 2:
|
|
33
33
|
content = _context.sent;
|
|
34
34
|
setContentRanges(function (prev) {
|
|
35
35
|
var newRanges = _toConsumableArray(prev);
|
|
36
36
|
newRanges[contentRangeInd] = content;
|
|
37
37
|
return newRanges;
|
|
38
38
|
});
|
|
39
|
-
case
|
|
39
|
+
case 3:
|
|
40
40
|
case "end":
|
|
41
41
|
return _context.stop();
|
|
42
42
|
}
|
|
@@ -16,36 +16,36 @@ export var useCachedGetImage = function useCachedGetImage(getPageImageUrl) {
|
|
|
16
16
|
var getImageUrl = useStaticCallback( /*#__PURE__*/function () {
|
|
17
17
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageNumber, zoom) {
|
|
18
18
|
var key, url, isBlobUrl, blob;
|
|
19
|
-
return _regeneratorRuntime.wrap(function
|
|
19
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
22
|
key = "".concat(pageNumber, "-").concat(zoom);
|
|
23
23
|
if (!imageUrlRefs.current[key]) {
|
|
24
|
-
_context.next =
|
|
24
|
+
_context.next = 1;
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
return _context.abrupt("return", imageUrlRefs.current[key]);
|
|
28
|
-
case
|
|
29
|
-
_context.next =
|
|
28
|
+
case 1:
|
|
29
|
+
_context.next = 2;
|
|
30
30
|
return getPageImageUrl(pageNumber, zoom);
|
|
31
|
-
case
|
|
31
|
+
case 2:
|
|
32
32
|
url = _context.sent;
|
|
33
33
|
isBlobUrl = url.startsWith('blob:');
|
|
34
34
|
if (isBlobUrl) {
|
|
35
|
-
_context.next =
|
|
35
|
+
_context.next = 4;
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
|
-
_context.next =
|
|
38
|
+
_context.next = 3;
|
|
39
39
|
return fetch(url).then(function (res) {
|
|
40
40
|
return res.blob();
|
|
41
41
|
});
|
|
42
|
-
case
|
|
42
|
+
case 3:
|
|
43
43
|
blob = _context.sent;
|
|
44
44
|
url = URL.createObjectURL(blob);
|
|
45
|
-
case
|
|
45
|
+
case 4:
|
|
46
46
|
imageUrlRefs.current[key] = url;
|
|
47
47
|
return _context.abrupt("return", url);
|
|
48
|
-
case
|
|
48
|
+
case 5:
|
|
49
49
|
case "end":
|
|
50
50
|
return _context.stop();
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -18,25 +18,18 @@
|
|
|
18
18
|
"module": "dist/esm/index.js",
|
|
19
19
|
"module:es2019": "dist/es2019/index.js",
|
|
20
20
|
"types": "dist/types/index.d.ts",
|
|
21
|
-
"typesVersions": {
|
|
22
|
-
">=4.5 <5.4": {
|
|
23
|
-
"*": [
|
|
24
|
-
"dist/types-ts4.5/*",
|
|
25
|
-
"dist/types-ts4.5/index.d.ts"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
21
|
"sideEffects": [
|
|
30
22
|
"*.compiled.css"
|
|
31
23
|
],
|
|
32
24
|
"atlaskit:src": "src/index.ts",
|
|
33
25
|
"dependencies": {
|
|
34
|
-
"@atlaskit/browser-apis": "^0.0
|
|
35
|
-
"@atlaskit/css": "^0.
|
|
36
|
-
"@atlaskit/media-common": "^
|
|
37
|
-
"@atlaskit/primitives": "^
|
|
38
|
-
"@atlaskit/spinner": "^
|
|
39
|
-
"@atlaskit/tokens": "^
|
|
26
|
+
"@atlaskit/browser-apis": "^1.0.0",
|
|
27
|
+
"@atlaskit/css": "^1.0.0",
|
|
28
|
+
"@atlaskit/media-common": "^14.1.0",
|
|
29
|
+
"@atlaskit/primitives": "^20.0.0",
|
|
30
|
+
"@atlaskit/spinner": "^20.0.0",
|
|
31
|
+
"@atlaskit/tokens": "^15.0.0",
|
|
32
|
+
"@atlassian/react-compiler-gating": "^0.2.0",
|
|
40
33
|
"@babel/runtime": "^7.0.0",
|
|
41
34
|
"@compiled/react": "^0.20.0"
|
|
42
35
|
},
|
|
@@ -47,11 +40,11 @@
|
|
|
47
40
|
"@af/integration-testing": "workspace:^",
|
|
48
41
|
"@af/visual-regression": "workspace:^",
|
|
49
42
|
"@atlaskit/ssr": "workspace:^",
|
|
50
|
-
"@atlassian/a11y-jest-testing": "^0.
|
|
43
|
+
"@atlassian/a11y-jest-testing": "^0.12.0",
|
|
51
44
|
"@atlassian/feature-flags-test-utils": "^1.1.0",
|
|
52
|
-
"@atlassian/react-compiler-gating": "workspace:^",
|
|
53
45
|
"@testing-library/react": "^16.3.0",
|
|
54
46
|
"@testing-library/user-event": "^14.4.3",
|
|
47
|
+
"react": "^18.2.0",
|
|
55
48
|
"react-dom": "^18.2.0"
|
|
56
49
|
},
|
|
57
50
|
"techstack": {
|
|
@@ -90,7 +83,7 @@
|
|
|
90
83
|
}
|
|
91
84
|
},
|
|
92
85
|
"name": "@atlaskit/media-document-viewer",
|
|
93
|
-
"version": "0.
|
|
86
|
+
"version": "1.0.1",
|
|
94
87
|
"description": "Modern and fast document viewer",
|
|
95
88
|
"author": "Atlassian Pty Ltd",
|
|
96
89
|
"license": "Apache-2.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ComboBoxField, type PageAnnotations, type TextField } from './types';
|
|
2
|
-
export declare const TextInputFormField: ({ field, dataTestId, }: {
|
|
3
|
-
field: TextField;
|
|
4
|
-
dataTestId?: string;
|
|
5
|
-
}) => JSX.Element;
|
|
6
|
-
export declare const ComboBoxFormField: ({ field, dataTestId, }: {
|
|
7
|
-
field: ComboBoxField;
|
|
8
|
-
dataTestId?: string;
|
|
9
|
-
}) => JSX.Element;
|
|
10
|
-
export declare const Annotations: ({ annotations }: {
|
|
11
|
-
annotations: PageAnnotations;
|
|
12
|
-
}) => JSX.Element;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type PageRangeContent } from './types';
|
|
2
|
-
export type DocumentViewerProps = {
|
|
3
|
-
getContent: (pageStart: number, pageEnd: number) => Promise<PageRangeContent>;
|
|
4
|
-
getPageImageUrl: (pageNumber: number, zoom: number) => Promise<string>;
|
|
5
|
-
paginationSize?: number;
|
|
6
|
-
/**
|
|
7
|
-
* The maximum zoom level that will be requested from the image service.
|
|
8
|
-
* This is used to prevent the page from being too large to render server side in a reasonable time.
|
|
9
|
-
*
|
|
10
|
-
* The 'zoom' prop can still be greater than this value, but the server side image service will return
|
|
11
|
-
* a smaller image and the image will be scaled-up client side.
|
|
12
|
-
*/
|
|
13
|
-
maxPageImageZoom?: number;
|
|
14
|
-
zoom: number;
|
|
15
|
-
onSuccess?: () => void;
|
|
16
|
-
/**
|
|
17
|
-
* When true, renders an initial batch of pages and appends more as the user scrolls.
|
|
18
|
-
* Intended for large documents (e.g. large Excel previews).
|
|
19
|
-
* Default: false.
|
|
20
|
-
*/
|
|
21
|
-
enableLazyPageRendering?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare const DocumentViewer: ({ onSuccess, getContent, getPageImageUrl, paginationSize, zoom, enableLazyPageRendering, }: DocumentViewerProps) => JSX.Element;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type Font, type PageContent } from './types';
|
|
2
|
-
type PageProps = {
|
|
3
|
-
getPageSrc: (pageIndex: number, zoom: number) => Promise<string>;
|
|
4
|
-
content?: PageContent;
|
|
5
|
-
fonts: readonly Font[];
|
|
6
|
-
pageIndex: number;
|
|
7
|
-
zoom: number;
|
|
8
|
-
defaultDimensions?: {
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
};
|
|
12
|
-
onVisible: (pageIndex: number) => void;
|
|
13
|
-
onLoad?: () => void;
|
|
14
|
-
/**
|
|
15
|
-
* Called when a local `#page-N` anchor inside this page is clicked.
|
|
16
|
-
* Fast-forwards the lazy page count so the target page exists in the DOM
|
|
17
|
-
* before the browser performs the native anchor scroll.
|
|
18
|
-
* Only provided when `enableLazyPageRendering` is true.
|
|
19
|
-
*/
|
|
20
|
-
appendUpTo?: (n: number) => void;
|
|
21
|
-
};
|
|
22
|
-
export declare const Page: ({ getPageSrc, content, fonts, pageIndex, zoom, defaultDimensions, onVisible, onLoad, appendUpTo, }: PageProps) => JSX.Element;
|
|
23
|
-
export {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
export type Font = {
|
|
2
|
-
name: string;
|
|
3
|
-
size: number;
|
|
4
|
-
weight: number;
|
|
5
|
-
is_all_caps: boolean;
|
|
6
|
-
is_bold_reenforced: boolean;
|
|
7
|
-
is_cursive: boolean;
|
|
8
|
-
is_fixed_pitch: boolean;
|
|
9
|
-
is_italic: boolean;
|
|
10
|
-
is_non_symbolic: boolean;
|
|
11
|
-
is_proportional_pitch: boolean;
|
|
12
|
-
is_sans_serif: boolean;
|
|
13
|
-
is_serif: boolean;
|
|
14
|
-
is_small_caps: boolean;
|
|
15
|
-
is_symbolic: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type Span = {
|
|
18
|
-
text: string;
|
|
19
|
-
fi: number;
|
|
20
|
-
r: number;
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
h: number;
|
|
24
|
-
l: number;
|
|
25
|
-
};
|
|
26
|
-
export type Line = {
|
|
27
|
-
r: number;
|
|
28
|
-
spans: readonly Span[];
|
|
29
|
-
};
|
|
30
|
-
export type PageContent = {
|
|
31
|
-
rotation: number;
|
|
32
|
-
width: number;
|
|
33
|
-
height: number;
|
|
34
|
-
lines: readonly Line[];
|
|
35
|
-
annotations?: PageAnnotations;
|
|
36
|
-
links?: readonly Link[];
|
|
37
|
-
};
|
|
38
|
-
export type PageAnnotations = {
|
|
39
|
-
text_form_fields: readonly TextField[];
|
|
40
|
-
combobox_form_fields: readonly ComboBoxField[];
|
|
41
|
-
};
|
|
42
|
-
export type TextField = {
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
w: number;
|
|
46
|
-
h: number;
|
|
47
|
-
f: number;
|
|
48
|
-
multiline: boolean;
|
|
49
|
-
text: string;
|
|
50
|
-
};
|
|
51
|
-
export type ComboBoxField = {
|
|
52
|
-
x: number;
|
|
53
|
-
y: number;
|
|
54
|
-
w: number;
|
|
55
|
-
h: number;
|
|
56
|
-
f: number;
|
|
57
|
-
text: string;
|
|
58
|
-
};
|
|
59
|
-
export type Link = {
|
|
60
|
-
type: 'uri';
|
|
61
|
-
dest: string;
|
|
62
|
-
x: number;
|
|
63
|
-
y: number;
|
|
64
|
-
w: number;
|
|
65
|
-
h: number;
|
|
66
|
-
} | {
|
|
67
|
-
type: 'local';
|
|
68
|
-
p_num: number;
|
|
69
|
-
x: number;
|
|
70
|
-
y: number;
|
|
71
|
-
w: number;
|
|
72
|
-
h: number;
|
|
73
|
-
};
|
|
74
|
-
export type PageRangeContent = {
|
|
75
|
-
start_index: number;
|
|
76
|
-
end_index: number;
|
|
77
|
-
total_pages: number;
|
|
78
|
-
fonts: readonly Font[];
|
|
79
|
-
pages: readonly PageContent[];
|
|
80
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Font, PageContent, PageRangeContent } from './types';
|
|
2
|
-
export declare function usePageContent(getContent: (startIndex: number, endIndex: number) => Promise<PageRangeContent>, paginationSize: number): {
|
|
3
|
-
getPageContent: (pageInd: number) => {
|
|
4
|
-
page: PageContent;
|
|
5
|
-
fonts: readonly Font[];
|
|
6
|
-
};
|
|
7
|
-
loadPageContent: (pageInd: number) => Promise<void>;
|
|
8
|
-
documentMetadata: {
|
|
9
|
-
defaultDimensions: {
|
|
10
|
-
height: number;
|
|
11
|
-
width: number;
|
|
12
|
-
} | undefined;
|
|
13
|
-
pageCount: number;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useCachedGetImage: (getPageImageUrl: (pageNumber: number, zoom: number) => Promise<string>) => ((pageNumber: number, zoom: number) => Promise<string>);
|