@triiiceratops/plugin-image-export 1.0.0-rc.5 → 1.0.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/dist/catalog.d.ts +5 -6
- package/dist/exportImage.d.ts +29 -7
- package/dist/identity.d.ts +10 -0
- package/dist/iife.js +1 -200
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -3579
- package/dist/plugin.d.ts +2 -2
- package/dist/reportError.d.ts +1 -1
- package/dist/styles.d.ts +3 -11
- package/package.json +9 -9
package/dist/catalog.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { LocaleCatalog } from '@triiiceratops/plugin-sdk';
|
|
2
2
|
/**
|
|
3
3
|
* The plugin's package-owned localization catalog (CONTEXT.md **Active
|
|
4
|
-
* locale**)
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `{filename}` param through the locale service.
|
|
4
|
+
* locale**): ships with the plugin rather than living in core's catalogs, so
|
|
5
|
+
* core carries no plugin keys. `en` is the required fallback; a missing key
|
|
6
|
+
* resolves to `en` and then to the key itself.
|
|
7
|
+
* `image_download_result_downloaded` interpolates a `{filename}` param
|
|
8
|
+
* through the locale service.
|
|
10
9
|
*/
|
|
11
10
|
export declare const catalog: LocaleCatalog;
|
package/dist/exportImage.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { ViewerState } from 'triiiceratops';
|
|
2
2
|
import { type ExportSizeOption, type ResolvedCanvasImage } from 'triiiceratops/image-export';
|
|
3
|
+
export { isCrossOriginImageFailure } from 'triiiceratops/image-export';
|
|
3
4
|
export type ImageDownloadFormat = 'image/png' | 'image/jpeg';
|
|
4
5
|
export type ImageDownloadMode = 'composite' | 'single' | 'world';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The default name for a downloaded image: the manifest's label and the canvas's
|
|
8
|
+
* label, in that order, sanitized for a filesystem.
|
|
9
|
+
*
|
|
10
|
+
* Both labels are localized IIIF language maps, so the caller resolves them in
|
|
11
|
+
* the viewer's **active locale** rather than passing raw JSON here — a reader
|
|
12
|
+
* browsing in French should get `Evangiles-Folio-2r.jpg`, not the English label.
|
|
13
|
+
* Either may resolve to nothing (a manifest with no label, an unlabeled canvas),
|
|
14
|
+
* and whichever survives is used alone.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildImageDownloadFilename(canvasLabel: string, mode: ImageDownloadMode, format: ImageDownloadFormat, manifestLabel?: string | null): string;
|
|
6
17
|
type ExportOptions = {
|
|
7
18
|
format?: ImageDownloadFormat;
|
|
8
19
|
getSelectedChoice?: (canvasId: string) => string | undefined;
|
|
9
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* The image server a resolved image comes from, for an error message that names
|
|
23
|
+
* who declined. `null` when there is no absolute URL to read a host from.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getImageHost(resolved: ResolvedCanvasImage): string | null;
|
|
10
26
|
/**
|
|
11
27
|
* Every painting image on `canvas` resolved for the "single image" picker
|
|
12
28
|
* and to detect whether "composite canvas" mode has more than one image to
|
|
@@ -27,20 +43,26 @@ export declare function resolveCompositeCanvasSizeOptions(canvas: any, getSelect
|
|
|
27
43
|
export declare function exportSingleImage(resolvedImage: ResolvedCanvasImage, sizeOption: ExportSizeOption): Promise<Blob>;
|
|
28
44
|
export declare function exportCompositeCanvas(canvas: any, sizeOption: ExportSizeOption, options?: ExportOptions): Promise<Blob>;
|
|
29
45
|
/**
|
|
30
|
-
* Every canvas currently laid out together in the viewer
|
|
31
|
-
* a spread in `paged` mode).
|
|
32
|
-
*
|
|
33
|
-
* instead of only ever the active
|
|
46
|
+
* Every canvas currently laid out together in the viewer that this plugin can
|
|
47
|
+
* actually produce an image from (e.g. both pages of a spread in `paged` mode).
|
|
48
|
+
* Used both to build the "current view" composite and to let "single image"
|
|
49
|
+
* mode target one of several visible canvases instead of only ever the active
|
|
50
|
+
* one.
|
|
51
|
+
*
|
|
52
|
+
* A canvas whose painting bodies are all non-image — the **unsupported
|
|
53
|
+
* presentation**, a video or a sound recording sharing the spread — is left out
|
|
54
|
+
* here rather than downstream. It is the difference between an export the
|
|
55
|
+
* reader is never offered and one offered, chosen, and then refused for want of
|
|
56
|
+
* a resolution to pick.
|
|
34
57
|
*/
|
|
35
58
|
export declare function getVisibleCanvasesForDownload(viewerState: ViewerState): any[];
|
|
36
59
|
/**
|
|
37
60
|
* Resolution options for downloading everything currently laid out together
|
|
38
61
|
* in the viewer (e.g. a two-page spread in `paged` viewing mode). Reuses the
|
|
39
|
-
* same layout math
|
|
62
|
+
* same layout math the viewer itself uses (`getCanvasDisplayLayouts`), so the
|
|
40
63
|
* downloaded image matches what's on screen; there's no single native
|
|
41
64
|
* reference size across canvases, so this offers a relative ladder against
|
|
42
65
|
* the first image's own native width as the reference scale.
|
|
43
66
|
*/
|
|
44
67
|
export declare function resolveWorldSizeOptions(viewerState: ViewerState, getSelectedChoice?: (canvasId: string) => string | undefined): ExportSizeOption[];
|
|
45
68
|
export declare function exportCurrentWorld(viewerState: ViewerState, sizeOption: ExportSizeOption, options?: ExportOptions): Promise<Blob>;
|
|
46
|
-
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This plugin's identity, in one place.
|
|
3
|
+
*
|
|
4
|
+
* `definePlugin` and the `pluginerror` reporter both need it, and writing the
|
|
5
|
+
* version out at each site is how the two drifted from each other.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PLUGIN_META: {
|
|
8
|
+
readonly name: "@triiiceratops/plugin-image-export";
|
|
9
|
+
readonly version: "1.0.0";
|
|
10
|
+
};
|