@files-preview-app/preview-file 1.3.5 → 1.3.6

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/vue.cjs CHANGED
@@ -528,6 +528,7 @@ var ICON_COPY = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" str
528
528
  var ICON_FAST_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 19 22 12 13 5 13 19"></polygon><polygon points="2 19 11 12 2 5 2 19"></polygon></svg>`;
529
529
  var ICON_REWIND = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="11 19 2 12 11 5 11 19"></polygon><polygon points="22 19 13 12 22 5 22 19"></polygon></svg>`;
530
530
  var ICON_EXTERNAL_WINDOW = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"></rect><line x1="3" y1="8" x2="21" y2="8"></line><circle cx="6" cy="5.5" r="0.75" fill="currentColor"></circle><circle cx="8.5" cy="5.5" r="0.75" fill="currentColor"></circle><polyline points="14 13 18 13 18 17"></polyline><line x1="11" y1="20" x2="18" y2="13"></line></svg>`;
531
+ var ICON_RESET_ZOOM = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><path d="M13 11a3 3 0 1 0-3 3"></path><path d="M10 11v3h3"></path></svg>`;
531
532
  var ICON_MAP = {
532
533
  "zoom-in": ICON_ZOOM_IN,
533
534
  "zoom-out": ICON_ZOOM_OUT,
@@ -557,7 +558,10 @@ var ICON_MAP = {
557
558
  "open-window": ICON_EXTERNAL_WINDOW,
558
559
  "external-window": ICON_EXTERNAL_WINDOW,
559
560
  "openWindow": ICON_EXTERNAL_WINDOW,
560
- "openSeparateWindow": ICON_EXTERNAL_WINDOW
561
+ "openSeparateWindow": ICON_EXTERNAL_WINDOW,
562
+ "reset-zoom": ICON_RESET_ZOOM,
563
+ "zoom-reset": ICON_RESET_ZOOM,
564
+ "resetZoom": ICON_RESET_ZOOM
561
565
  };
562
566
  var ToolbarController = class {
563
567
  el;
@@ -590,6 +594,10 @@ var ToolbarController = class {
590
594
  this.config.fitToPage = false;
591
595
  this.config.fitWidth = false;
592
596
  }
597
+ if (actionId === "reset-zoom" || actionId === "zoom-reset" || actionId === "resetZoom") {
598
+ this.config.resetZoom = false;
599
+ this.config.zoomReset = false;
600
+ }
593
601
  if (actionId === "rotate-cw" || actionId === "rotate" || actionId === "rotateCW") this.config.rotate = false;
594
602
  if (actionId === "fullscreen") this.config.fullscreen = false;
595
603
  if (actionId === "download") this.config.download = false;
@@ -614,6 +622,10 @@ var ToolbarController = class {
614
622
  this.config.fitToPage = true;
615
623
  this.config.fitWidth = true;
616
624
  }
625
+ if (actionId === "reset-zoom" || actionId === "zoom-reset" || actionId === "resetZoom") {
626
+ this.config.resetZoom = true;
627
+ this.config.zoomReset = true;
628
+ }
617
629
  if (actionId === "rotate-cw" || actionId === "rotate" || actionId === "rotateCW") this.config.rotate = true;
618
630
  if (actionId === "fullscreen") this.config.fullscreen = true;
619
631
  if (actionId === "download") this.config.download = true;
@@ -633,6 +645,7 @@ var ToolbarController = class {
633
645
  if (actionId === "zoomIn") return "zoom-in";
634
646
  if (actionId === "zoomOut") return "zoom-out";
635
647
  if (actionId === "fitPage" || actionId === "fitToPage" || actionId === "fitWidth") return "fit-page";
648
+ if (actionId === "resetZoom" || actionId === "zoomReset") return "reset-zoom";
636
649
  if (actionId === "rotateCW") return "rotate-cw";
637
650
  if (actionId === "rotateCCW") return "rotate-ccw";
638
651
  if (actionId === "openWindow" || actionId === "openSeparateWindow") return "open-window";
@@ -675,6 +688,9 @@ var ToolbarController = class {
675
688
  if ((id === "fit-page" || id === "fit-width" || id === "fit-slide") && (c.fitPage === false || c.fitToPage === false || c.fitWidth === false || c["fit-page"] === false || c["fit-width"] === false)) {
676
689
  return false;
677
690
  }
691
+ if ((id === "reset-zoom" || id === "zoom-reset") && (c.resetZoom === false || c.zoomReset === false || c["reset-zoom"] === false || c["zoom-reset"] === false)) {
692
+ return false;
693
+ }
678
694
  if ((id === "rotate-cw" || id === "rotate-ccw" || id === "rotate") && (c.rotate === false || c.rotateCW === false || c.rotateCCW === false || c["rotate-cw"] === false)) {
679
695
  return false;
680
696
  }
@@ -1121,6 +1137,9 @@ var FilePreviewViewer = class _FilePreviewViewer {
1121
1137
  this.activeInstance = instance;
1122
1138
  instance.openInSeparateWindow = () => this.openInSeparateWindow();
1123
1139
  instance.toggleThumbnails = () => this.toggleThumbnails();
1140
+ if (!instance.resetZoom && instance.fitToPage) {
1141
+ instance.resetZoom = () => instance.fitToPage?.();
1142
+ }
1124
1143
  this.hideLoading();
1125
1144
  this.eventEmitter.emit("loaded", { metadata, plugin: matchedPlugin.id });
1126
1145
  const isToolbarVisible = options.showToolbar !== false && options.toolbar !== false;
@@ -1404,6 +1423,16 @@ var FilePreviewViewer = class _FilePreviewViewer {
1404
1423
  fitToPage() {
1405
1424
  this.activeInstance?.fitToPage?.();
1406
1425
  }
1426
+ /**
1427
+ * Reset zoom level to initial/default fit state.
1428
+ */
1429
+ resetZoom() {
1430
+ if (this.activeInstance?.resetZoom) {
1431
+ this.activeInstance.resetZoom();
1432
+ } else if (this.activeInstance?.fitToPage) {
1433
+ this.activeInstance.fitToPage();
1434
+ }
1435
+ }
1407
1436
  /**
1408
1437
  * Zoom in.
1409
1438
  */
@@ -2025,6 +2054,14 @@ var PdfPlugin = class {
2025
2054
  group: "zoom",
2026
2055
  execute: () => instance.fitToPage?.()
2027
2056
  },
2057
+ {
2058
+ id: "reset-zoom",
2059
+ icon: "reset-zoom",
2060
+ label: "Reset Zoom",
2061
+ type: "button",
2062
+ group: "zoom",
2063
+ execute: () => instance.resetZoom?.()
2064
+ },
2028
2065
  {
2029
2066
  id: "fit-width",
2030
2067
  icon: "fit-width",
@@ -2287,6 +2324,14 @@ var PdfPlugin = class {
2287
2324
  zoomScale = 1;
2288
2325
  renderPage(currentPage);
2289
2326
  },
2327
+ resetZoom: () => {
2328
+ fitMode = "page";
2329
+ zoomScale = 1;
2330
+ rotation = 0;
2331
+ container.scrollTop = 0;
2332
+ container.scrollLeft = 0;
2333
+ renderPage(currentPage);
2334
+ },
2290
2335
  fitToWidth: () => {
2291
2336
  fitMode = "width";
2292
2337
  zoomScale = 1;
@@ -2454,6 +2499,16 @@ var MediaPlugin = class {
2454
2499
  instance.fitToPage?.();
2455
2500
  }
2456
2501
  },
2502
+ {
2503
+ id: "reset-zoom",
2504
+ icon: "reset-zoom",
2505
+ label: "Reset Zoom",
2506
+ type: "button",
2507
+ group: "zoom",
2508
+ execute: () => {
2509
+ instance.resetZoom?.();
2510
+ }
2511
+ },
2457
2512
  {
2458
2513
  id: "rotate-cw",
2459
2514
  icon: "rotate-cw",
@@ -2627,6 +2682,13 @@ var MediaPlugin = class {
2627
2682
  rotation = 0;
2628
2683
  applyTransform();
2629
2684
  } : void 0,
2685
+ resetZoom: isImage ? () => {
2686
+ currentZoom = 1;
2687
+ rotation = 0;
2688
+ ctx.container.scrollTop = 0;
2689
+ ctx.container.scrollLeft = 0;
2690
+ applyTransform();
2691
+ } : void 0,
2630
2692
  rotateCW: isImage || isVideo ? () => {
2631
2693
  rotation = (rotation + 90) % 360;
2632
2694
  applyTransform();
@@ -2743,6 +2805,14 @@ var DocxPlugin = class {
2743
2805
  group: "zoom",
2744
2806
  execute: () => instance.fitToPage?.()
2745
2807
  },
2808
+ {
2809
+ id: "reset-zoom",
2810
+ icon: "reset-zoom",
2811
+ label: "Reset Zoom",
2812
+ type: "button",
2813
+ group: "zoom",
2814
+ execute: () => instance.resetZoom?.()
2815
+ },
2746
2816
  {
2747
2817
  id: "rotate-cw",
2748
2818
  icon: "rotate-cw",
@@ -3059,6 +3129,14 @@ var DocxPlugin = class {
3059
3129
  rotation = 0;
3060
3130
  applyTransform();
3061
3131
  },
3132
+ resetZoom: () => {
3133
+ isUserZoomed = false;
3134
+ scale = calculateFitScale("page");
3135
+ rotation = 0;
3136
+ ctx.container.scrollTop = 0;
3137
+ ctx.container.scrollLeft = 0;
3138
+ applyTransform();
3139
+ },
3062
3140
  rotateCW: () => {
3063
3141
  rotation = (rotation + 90) % 360;
3064
3142
  applyTransform();
@@ -3508,6 +3586,16 @@ var ExcelPlugin = class {
3508
3586
  instance.zoomIn?.();
3509
3587
  }
3510
3588
  },
3589
+ {
3590
+ id: "reset-zoom",
3591
+ icon: "reset-zoom",
3592
+ label: "Reset Zoom",
3593
+ type: "button",
3594
+ group: "zoom",
3595
+ execute: () => {
3596
+ instance.resetZoom?.();
3597
+ }
3598
+ },
3511
3599
  {
3512
3600
  id: "download",
3513
3601
  icon: "download",
@@ -3695,6 +3783,12 @@ var ExcelPlugin = class {
3695
3783
  scale = calculateFitScale();
3696
3784
  applyTransform();
3697
3785
  },
3786
+ resetZoom: () => {
3787
+ scale = calculateFitScale();
3788
+ contentArea.scrollTop = 0;
3789
+ contentArea.scrollLeft = 0;
3790
+ applyTransform();
3791
+ },
3698
3792
  rotateCW: () => {
3699
3793
  },
3700
3794
  rotateCCW: () => {
@@ -3825,6 +3919,16 @@ var CsvPlugin = class {
3825
3919
  instance.zoomIn?.();
3826
3920
  }
3827
3921
  },
3922
+ {
3923
+ id: "reset-zoom",
3924
+ icon: "reset-zoom",
3925
+ label: "Reset Zoom",
3926
+ type: "button",
3927
+ group: "zoom",
3928
+ execute: () => {
3929
+ instance.resetZoom?.();
3930
+ }
3931
+ },
3828
3932
  {
3829
3933
  id: "download",
3830
3934
  icon: "download",
@@ -4014,6 +4118,12 @@ var CsvPlugin = class {
4014
4118
  scale = calculateFitScale();
4015
4119
  applyScale();
4016
4120
  },
4121
+ resetZoom: () => {
4122
+ scale = calculateFitScale();
4123
+ container.scrollTop = 0;
4124
+ container.scrollLeft = 0;
4125
+ applyScale();
4126
+ },
4017
4127
  rotateCW: () => {
4018
4128
  },
4019
4129
  rotateCCW: () => {
@@ -4129,6 +4239,16 @@ var CodePlugin = class {
4129
4239
  instance.zoomIn?.();
4130
4240
  }
4131
4241
  },
4242
+ {
4243
+ id: "reset-zoom",
4244
+ icon: "reset-zoom",
4245
+ label: "Reset Zoom",
4246
+ type: "button",
4247
+ group: "zoom",
4248
+ execute: () => {
4249
+ instance.resetZoom?.();
4250
+ }
4251
+ },
4132
4252
  {
4133
4253
  id: "copy",
4134
4254
  icon: "copy",
@@ -4408,6 +4528,15 @@ var CodePlugin = class {
4408
4528
  zoomLevel = isTxt ? calculateTxtFit() : 1;
4409
4529
  updateTransform();
4410
4530
  },
4531
+ resetZoom: () => {
4532
+ isUserZoomed = false;
4533
+ fontSize = 13;
4534
+ rotation = 0;
4535
+ zoomLevel = isTxt ? calculateTxtFit() : 1;
4536
+ container.scrollTop = 0;
4537
+ container.scrollLeft = 0;
4538
+ updateTransform();
4539
+ },
4411
4540
  rotateCW: () => {
4412
4541
  rotation = (rotation + 90) % 360;
4413
4542
  updateTransform();
@@ -4470,11 +4599,19 @@ var ArchivePlugin = class {
4470
4599
  {
4471
4600
  id: "fit-page",
4472
4601
  icon: "fit-page",
4473
- label: "Reset Zoom",
4602
+ label: "Fit to Page",
4474
4603
  type: "button",
4475
4604
  group: "zoom",
4476
4605
  execute: () => instance.fitToPage?.()
4477
4606
  },
4607
+ {
4608
+ id: "reset-zoom",
4609
+ icon: "reset-zoom",
4610
+ label: "Reset Zoom",
4611
+ type: "button",
4612
+ group: "zoom",
4613
+ execute: () => instance.resetZoom?.()
4614
+ },
4478
4615
  {
4479
4616
  id: "download",
4480
4617
  icon: "download",
@@ -4629,7 +4766,13 @@ var ArchivePlugin = class {
4629
4766
  },
4630
4767
  fitToPage: () => {
4631
4768
  scale = 1;
4632
- wrapper.style.transform = `scale(1)`;
4769
+ wrapper.style.transform = "scale(1)";
4770
+ },
4771
+ resetZoom: () => {
4772
+ scale = 1;
4773
+ wrapper.style.transform = "scale(1)";
4774
+ ctx.container.scrollTop = 0;
4775
+ ctx.container.scrollLeft = 0;
4633
4776
  },
4634
4777
  download: () => {
4635
4778
  downloadFile(ctx.buffer, ctx.metadata.name || "archive.zip", "application/zip");
@@ -4681,6 +4824,14 @@ var MarkdownPlugin = class {
4681
4824
  group: "zoom",
4682
4825
  execute: () => instance.fitToPage?.()
4683
4826
  },
4827
+ {
4828
+ id: "reset-zoom",
4829
+ icon: "reset-zoom",
4830
+ label: "Reset Zoom",
4831
+ type: "button",
4832
+ group: "zoom",
4833
+ execute: () => instance.resetZoom?.()
4834
+ },
4684
4835
  {
4685
4836
  id: "copy",
4686
4837
  icon: "copy",
@@ -4834,6 +4985,12 @@ var MarkdownPlugin = class {
4834
4985
  fontSize = 15;
4835
4986
  wrapper.style.fontSize = "15px";
4836
4987
  },
4988
+ resetZoom: () => {
4989
+ fontSize = 15;
4990
+ wrapper.style.fontSize = "15px";
4991
+ ctx.container.scrollTop = 0;
4992
+ ctx.container.scrollLeft = 0;
4993
+ },
4837
4994
  download: () => {
4838
4995
  downloadFile(ctx.buffer, ctx.metadata.name || "document.md", "text/markdown");
4839
4996
  },
@@ -4927,6 +5084,14 @@ var PptxPlugin = class {
4927
5084
  group: "zoom",
4928
5085
  execute: () => instance.fitToPage?.()
4929
5086
  },
5087
+ {
5088
+ id: "reset-zoom",
5089
+ icon: "reset-zoom",
5090
+ label: "Reset Zoom",
5091
+ type: "button",
5092
+ group: "zoom",
5093
+ execute: () => instance.resetZoom?.()
5094
+ },
4930
5095
  {
4931
5096
  id: "rotate-cw",
4932
5097
  icon: "rotate-cw",
@@ -5046,6 +5211,13 @@ var PptxPlugin = class {
5046
5211
  rotation = 0;
5047
5212
  applyTransform();
5048
5213
  },
5214
+ resetZoom: () => {
5215
+ scale = calculateFitScale();
5216
+ rotation = 0;
5217
+ wrapper.scrollTop = 0;
5218
+ wrapper.scrollLeft = 0;
5219
+ applyTransform();
5220
+ },
5049
5221
  rotateCW: () => {
5050
5222
  rotation = (rotation + 90) % 360;
5051
5223
  applyTransform();
@@ -5121,6 +5293,14 @@ var ThreeDPlugin = class {
5121
5293
  group: "zoom",
5122
5294
  execute: () => instance.fitToPage?.()
5123
5295
  },
5296
+ {
5297
+ id: "reset-zoom",
5298
+ icon: "reset-zoom",
5299
+ label: "Reset Zoom",
5300
+ type: "button",
5301
+ group: "zoom",
5302
+ execute: () => instance.resetZoom?.()
5303
+ },
5124
5304
  {
5125
5305
  id: "rotate-cw",
5126
5306
  icon: "rotate-cw",
@@ -5257,6 +5437,7 @@ var ThreeDPlugin = class {
5257
5437
  controls.update();
5258
5438
  },
5259
5439
  fitToPage: fitCamera,
5440
+ resetZoom: fitCamera,
5260
5441
  rotateCW: () => {
5261
5442
  isWireframe = !isWireframe;
5262
5443
  materials.forEach((m) => {
@@ -5471,6 +5652,14 @@ var RtfPlugin = class {
5471
5652
  group: "zoom",
5472
5653
  execute: () => instance.fitToPage?.()
5473
5654
  },
5655
+ {
5656
+ id: "reset-zoom",
5657
+ icon: "reset-zoom",
5658
+ label: "Reset Zoom",
5659
+ type: "button",
5660
+ group: "zoom",
5661
+ execute: () => instance.resetZoom?.()
5662
+ },
5474
5663
  {
5475
5664
  id: "rotate-cw",
5476
5665
  icon: "rotate-cw",
@@ -5940,6 +6129,15 @@ var RtfPlugin = class {
5940
6129
  rotation = 0;
5941
6130
  applyTransform();
5942
6131
  },
6132
+ resetZoom: () => {
6133
+ isUserZoomed = false;
6134
+ fitMode = "width";
6135
+ scale = calculateFitScale("width");
6136
+ rotation = 0;
6137
+ ctx.container.scrollTop = 0;
6138
+ ctx.container.scrollLeft = 0;
6139
+ applyTransform();
6140
+ },
5943
6141
  rotateCW: () => {
5944
6142
  rotation = (rotation + 90) % 360;
5945
6143
  applyTransform();
@@ -6007,6 +6205,14 @@ var HtmlPreviewPlugin = class {
6007
6205
  group: "zoom",
6008
6206
  execute: () => instance.fitToPage?.()
6009
6207
  },
6208
+ {
6209
+ id: "reset-zoom",
6210
+ icon: "reset-zoom",
6211
+ label: "Reset Zoom",
6212
+ type: "button",
6213
+ group: "zoom",
6214
+ execute: () => instance.resetZoom?.()
6215
+ },
6010
6216
  {
6011
6217
  id: "copy",
6012
6218
  icon: "copy",
@@ -6079,6 +6285,12 @@ var HtmlPreviewPlugin = class {
6079
6285
  scale = 1;
6080
6286
  iframe.style.transform = "scale(1)";
6081
6287
  },
6288
+ resetZoom: () => {
6289
+ scale = 1;
6290
+ iframe.style.transform = "scale(1)";
6291
+ ctx.container.scrollTop = 0;
6292
+ ctx.container.scrollLeft = 0;
6293
+ },
6082
6294
  copy: () => {
6083
6295
  navigator.clipboard.writeText(rawHtml);
6084
6296
  },
@@ -6179,6 +6391,14 @@ var OpenDocumentPlugin = class {
6179
6391
  group: "zoom",
6180
6392
  execute: () => instance.fitToPage?.()
6181
6393
  },
6394
+ {
6395
+ id: "reset-zoom",
6396
+ icon: "reset-zoom",
6397
+ label: "Reset Zoom",
6398
+ type: "button",
6399
+ group: "zoom",
6400
+ execute: () => instance.resetZoom?.()
6401
+ },
6182
6402
  {
6183
6403
  id: "rotate-cw",
6184
6404
  icon: "rotate-cw",
@@ -6446,6 +6666,15 @@ var OpenDocumentPlugin = class {
6446
6666
  rotation = 0;
6447
6667
  applyTransform();
6448
6668
  },
6669
+ resetZoom: () => {
6670
+ isUserZoomed = false;
6671
+ fitMode = "width";
6672
+ scale = calculateFitScale("width");
6673
+ rotation = 0;
6674
+ container.scrollTop = 0;
6675
+ container.scrollLeft = 0;
6676
+ applyTransform();
6677
+ },
6449
6678
  rotateCW: () => {
6450
6679
  rotation = (rotation + 90) % 360;
6451
6680
  applyTransform();
@@ -6789,6 +7018,14 @@ var DocPlugin = class {
6789
7018
  group: "zoom",
6790
7019
  execute: () => instance.fitToPage?.()
6791
7020
  },
7021
+ {
7022
+ id: "reset-zoom",
7023
+ icon: "reset-zoom",
7024
+ label: "Reset Zoom",
7025
+ type: "button",
7026
+ group: "zoom",
7027
+ execute: () => instance.resetZoom?.()
7028
+ },
6792
7029
  {
6793
7030
  id: "rotate-cw",
6794
7031
  icon: "rotate-cw",
@@ -6995,6 +7232,15 @@ var DocPlugin = class {
6995
7232
  rotation = 0;
6996
7233
  applyTransform();
6997
7234
  },
7235
+ resetZoom: () => {
7236
+ isUserZoomed = false;
7237
+ fitMode = "width";
7238
+ scale = calculateFitScale("width");
7239
+ rotation = 0;
7240
+ ctx.container.scrollTop = 0;
7241
+ ctx.container.scrollLeft = 0;
7242
+ applyTransform();
7243
+ },
6998
7244
  rotateCW: () => {
6999
7245
  rotation = (rotation + 90) % 360;
7000
7246
  applyTransform();
@@ -7475,6 +7721,14 @@ var PptPlugin = class {
7475
7721
  group: "zoom",
7476
7722
  execute: () => instance.fitToPage?.()
7477
7723
  },
7724
+ {
7725
+ id: "reset-zoom",
7726
+ icon: "reset-zoom",
7727
+ label: "Reset Zoom",
7728
+ type: "button",
7729
+ group: "zoom",
7730
+ execute: () => instance.resetZoom?.()
7731
+ },
7478
7732
  {
7479
7733
  id: "rotate-cw",
7480
7734
  icon: "rotate-cw",
@@ -7663,6 +7917,13 @@ var PptPlugin = class {
7663
7917
  rotation = 0;
7664
7918
  applyTransform();
7665
7919
  },
7920
+ resetZoom: () => {
7921
+ scale = calculateFitScale();
7922
+ rotation = 0;
7923
+ container.scrollTop = 0;
7924
+ container.scrollLeft = 0;
7925
+ applyTransform();
7926
+ },
7666
7927
  rotateCW: () => {
7667
7928
  rotation = (rotation + 90) % 360;
7668
7929
  applyTransform();