jupyterlab_advanced_image_viewer_extension 1.1.4 → 1.1.5
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/README.md +1 -1
- package/lib/index.js +22 -3
- package/package.json +1 -1
- package/src/index.ts +25 -3
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ The viewer toolbar adds zoom in / out / fit controls and a `help` link that list
|
|
|
23
23
|
- **Arrow-key navigation** - Left and Right open the previous and next image in the same folder, in the order the file browser lists them, advancing within one viewer instead of opening new tabs
|
|
24
24
|
- **Copy to clipboard** - right-click a raster image (PNG/JPG/…) and choose "Copy to Clipboard" to copy it as PNG to the system clipboard
|
|
25
25
|
- **Refresh** - a toolbar refresh button reloads the image from disk, the same control the HTML viewer provides
|
|
26
|
-
- **WebP support** - `.webp` files open in the image viewer with every feature above; stock JupyterLab
|
|
26
|
+
- **WebP and AVIF support** - `.webp` and `.avif` files open in the image viewer with every feature above; stock JupyterLab does not open them and shows a File Load Error
|
|
27
27
|
|
|
28
28
|
## Requirements
|
|
29
29
|
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { PathExt } from '@jupyterlab/coreutils';
|
|
|
3
3
|
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
|
|
4
4
|
import { IImageTracker } from '@jupyterlab/imageviewer';
|
|
5
5
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
6
|
-
import { refreshIcon } from '@jupyterlab/ui-components';
|
|
6
|
+
import { imageIcon, refreshIcon } from '@jupyterlab/ui-components';
|
|
7
7
|
import { Widget } from '@lumino/widgets';
|
|
8
8
|
import { ViewerController } from './controller';
|
|
9
9
|
const PLUGIN_ID = 'jupyterlab_advanced_image_viewer_extension:plugin';
|
|
@@ -22,11 +22,20 @@ const IMAGE_EXTS = new Set([
|
|
|
22
22
|
'.gif',
|
|
23
23
|
'.bmp',
|
|
24
24
|
'.svg',
|
|
25
|
-
'.webp'
|
|
25
|
+
'.webp',
|
|
26
|
+
'.avif'
|
|
26
27
|
]);
|
|
27
28
|
// Raster formats that can be drawn to a canvas and copied as PNG. SVG is
|
|
28
29
|
// excluded - the drawio/SVG extension already adds its own "Copy as PNG".
|
|
29
|
-
const RASTER_EXTS = new Set([
|
|
30
|
+
const RASTER_EXTS = new Set([
|
|
31
|
+
'.png',
|
|
32
|
+
'.jpg',
|
|
33
|
+
'.jpeg',
|
|
34
|
+
'.gif',
|
|
35
|
+
'.bmp',
|
|
36
|
+
'.webp',
|
|
37
|
+
'.avif'
|
|
38
|
+
]);
|
|
30
39
|
const defaults = {
|
|
31
40
|
navEnabled: true,
|
|
32
41
|
zoomStep: 0.1
|
|
@@ -148,6 +157,16 @@ const plugin = {
|
|
|
148
157
|
if (webp) {
|
|
149
158
|
app.docRegistry.addFileType(webp, ['Image']);
|
|
150
159
|
}
|
|
160
|
+
// JupyterLab registers no 'avif' file type at all, so add one with the
|
|
161
|
+
// same shape as its other image types, bound to the same factory.
|
|
162
|
+
app.docRegistry.addFileType({
|
|
163
|
+
name: 'avif',
|
|
164
|
+
displayName: 'Image',
|
|
165
|
+
mimeTypes: ['image/avif'],
|
|
166
|
+
extensions: ['.avif'],
|
|
167
|
+
icon: imageIcon,
|
|
168
|
+
fileFormat: 'base64'
|
|
169
|
+
}, ['Image']);
|
|
151
170
|
app.commands.addCommand(CommandIDs.zoomIn, {
|
|
152
171
|
label: 'Zoom In (Advanced Image Viewer)',
|
|
153
172
|
isEnabled: () => currentController() !== null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyterlab_advanced_image_viewer_extension",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "JupyterLab extension for advanced image viewing: fit-to-screen, cursor-anchored wheel zoom, drag-to-pan, and Left/Right arrow keys to move to the previous and next image in a folder",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { IImageTracker, ImageViewer } from '@jupyterlab/imageviewer';
|
|
|
20
20
|
|
|
21
21
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
22
22
|
|
|
23
|
-
import { refreshIcon } from '@jupyterlab/ui-components';
|
|
23
|
+
import { imageIcon, refreshIcon } from '@jupyterlab/ui-components';
|
|
24
24
|
|
|
25
25
|
import { IDisposable } from '@lumino/disposable';
|
|
26
26
|
|
|
@@ -46,12 +46,21 @@ const IMAGE_EXTS = new Set([
|
|
|
46
46
|
'.gif',
|
|
47
47
|
'.bmp',
|
|
48
48
|
'.svg',
|
|
49
|
-
'.webp'
|
|
49
|
+
'.webp',
|
|
50
|
+
'.avif'
|
|
50
51
|
]);
|
|
51
52
|
|
|
52
53
|
// Raster formats that can be drawn to a canvas and copied as PNG. SVG is
|
|
53
54
|
// excluded - the drawio/SVG extension already adds its own "Copy as PNG".
|
|
54
|
-
const RASTER_EXTS = new Set([
|
|
55
|
+
const RASTER_EXTS = new Set([
|
|
56
|
+
'.png',
|
|
57
|
+
'.jpg',
|
|
58
|
+
'.jpeg',
|
|
59
|
+
'.gif',
|
|
60
|
+
'.bmp',
|
|
61
|
+
'.webp',
|
|
62
|
+
'.avif'
|
|
63
|
+
]);
|
|
55
64
|
|
|
56
65
|
interface ISettingsState {
|
|
57
66
|
navEnabled: boolean;
|
|
@@ -209,6 +218,19 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
209
218
|
if (webp) {
|
|
210
219
|
app.docRegistry.addFileType(webp, ['Image']);
|
|
211
220
|
}
|
|
221
|
+
// JupyterLab registers no 'avif' file type at all, so add one with the
|
|
222
|
+
// same shape as its other image types, bound to the same factory.
|
|
223
|
+
app.docRegistry.addFileType(
|
|
224
|
+
{
|
|
225
|
+
name: 'avif',
|
|
226
|
+
displayName: 'Image',
|
|
227
|
+
mimeTypes: ['image/avif'],
|
|
228
|
+
extensions: ['.avif'],
|
|
229
|
+
icon: imageIcon,
|
|
230
|
+
fileFormat: 'base64'
|
|
231
|
+
},
|
|
232
|
+
['Image']
|
|
233
|
+
);
|
|
212
234
|
|
|
213
235
|
app.commands.addCommand(CommandIDs.zoomIn, {
|
|
214
236
|
label: 'Zoom In (Advanced Image Viewer)',
|