@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/angular.cjs CHANGED
@@ -576,6 +576,7 @@ var ICON_COPY = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" str
576
576
  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>`;
577
577
  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>`;
578
578
  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>`;
579
+ 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>`;
579
580
  var ICON_MAP = {
580
581
  "zoom-in": ICON_ZOOM_IN,
581
582
  "zoom-out": ICON_ZOOM_OUT,
@@ -605,7 +606,10 @@ var ICON_MAP = {
605
606
  "open-window": ICON_EXTERNAL_WINDOW,
606
607
  "external-window": ICON_EXTERNAL_WINDOW,
607
608
  "openWindow": ICON_EXTERNAL_WINDOW,
608
- "openSeparateWindow": ICON_EXTERNAL_WINDOW
609
+ "openSeparateWindow": ICON_EXTERNAL_WINDOW,
610
+ "reset-zoom": ICON_RESET_ZOOM,
611
+ "zoom-reset": ICON_RESET_ZOOM,
612
+ "resetZoom": ICON_RESET_ZOOM
609
613
  };
610
614
  var ToolbarController = class {
611
615
  el;
@@ -638,6 +642,10 @@ var ToolbarController = class {
638
642
  this.config.fitToPage = false;
639
643
  this.config.fitWidth = false;
640
644
  }
645
+ if (actionId === "reset-zoom" || actionId === "zoom-reset" || actionId === "resetZoom") {
646
+ this.config.resetZoom = false;
647
+ this.config.zoomReset = false;
648
+ }
641
649
  if (actionId === "rotate-cw" || actionId === "rotate" || actionId === "rotateCW") this.config.rotate = false;
642
650
  if (actionId === "fullscreen") this.config.fullscreen = false;
643
651
  if (actionId === "download") this.config.download = false;
@@ -662,6 +670,10 @@ var ToolbarController = class {
662
670
  this.config.fitToPage = true;
663
671
  this.config.fitWidth = true;
664
672
  }
673
+ if (actionId === "reset-zoom" || actionId === "zoom-reset" || actionId === "resetZoom") {
674
+ this.config.resetZoom = true;
675
+ this.config.zoomReset = true;
676
+ }
665
677
  if (actionId === "rotate-cw" || actionId === "rotate" || actionId === "rotateCW") this.config.rotate = true;
666
678
  if (actionId === "fullscreen") this.config.fullscreen = true;
667
679
  if (actionId === "download") this.config.download = true;
@@ -681,6 +693,7 @@ var ToolbarController = class {
681
693
  if (actionId === "zoomIn") return "zoom-in";
682
694
  if (actionId === "zoomOut") return "zoom-out";
683
695
  if (actionId === "fitPage" || actionId === "fitToPage" || actionId === "fitWidth") return "fit-page";
696
+ if (actionId === "resetZoom" || actionId === "zoomReset") return "reset-zoom";
684
697
  if (actionId === "rotateCW") return "rotate-cw";
685
698
  if (actionId === "rotateCCW") return "rotate-ccw";
686
699
  if (actionId === "openWindow" || actionId === "openSeparateWindow") return "open-window";
@@ -723,6 +736,9 @@ var ToolbarController = class {
723
736
  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)) {
724
737
  return false;
725
738
  }
739
+ if ((id === "reset-zoom" || id === "zoom-reset") && (c.resetZoom === false || c.zoomReset === false || c["reset-zoom"] === false || c["zoom-reset"] === false)) {
740
+ return false;
741
+ }
726
742
  if ((id === "rotate-cw" || id === "rotate-ccw" || id === "rotate") && (c.rotate === false || c.rotateCW === false || c.rotateCCW === false || c["rotate-cw"] === false)) {
727
743
  return false;
728
744
  }
@@ -1169,6 +1185,9 @@ var FilePreviewViewer = class _FilePreviewViewer {
1169
1185
  this.activeInstance = instance;
1170
1186
  instance.openInSeparateWindow = () => this.openInSeparateWindow();
1171
1187
  instance.toggleThumbnails = () => this.toggleThumbnails();
1188
+ if (!instance.resetZoom && instance.fitToPage) {
1189
+ instance.resetZoom = () => instance.fitToPage?.();
1190
+ }
1172
1191
  this.hideLoading();
1173
1192
  this.eventEmitter.emit("loaded", { metadata, plugin: matchedPlugin.id });
1174
1193
  const isToolbarVisible = options.showToolbar !== false && options.toolbar !== false;
@@ -1452,6 +1471,16 @@ var FilePreviewViewer = class _FilePreviewViewer {
1452
1471
  fitToPage() {
1453
1472
  this.activeInstance?.fitToPage?.();
1454
1473
  }
1474
+ /**
1475
+ * Reset zoom level to initial/default fit state.
1476
+ */
1477
+ resetZoom() {
1478
+ if (this.activeInstance?.resetZoom) {
1479
+ this.activeInstance.resetZoom();
1480
+ } else if (this.activeInstance?.fitToPage) {
1481
+ this.activeInstance.fitToPage();
1482
+ }
1483
+ }
1455
1484
  /**
1456
1485
  * Zoom in.
1457
1486
  */
@@ -2073,6 +2102,14 @@ var PdfPlugin = class {
2073
2102
  group: "zoom",
2074
2103
  execute: () => instance.fitToPage?.()
2075
2104
  },
2105
+ {
2106
+ id: "reset-zoom",
2107
+ icon: "reset-zoom",
2108
+ label: "Reset Zoom",
2109
+ type: "button",
2110
+ group: "zoom",
2111
+ execute: () => instance.resetZoom?.()
2112
+ },
2076
2113
  {
2077
2114
  id: "fit-width",
2078
2115
  icon: "fit-width",
@@ -2335,6 +2372,14 @@ var PdfPlugin = class {
2335
2372
  zoomScale = 1;
2336
2373
  renderPage(currentPage);
2337
2374
  },
2375
+ resetZoom: () => {
2376
+ fitMode = "page";
2377
+ zoomScale = 1;
2378
+ rotation = 0;
2379
+ container.scrollTop = 0;
2380
+ container.scrollLeft = 0;
2381
+ renderPage(currentPage);
2382
+ },
2338
2383
  fitToWidth: () => {
2339
2384
  fitMode = "width";
2340
2385
  zoomScale = 1;
@@ -2502,6 +2547,16 @@ var MediaPlugin = class {
2502
2547
  instance.fitToPage?.();
2503
2548
  }
2504
2549
  },
2550
+ {
2551
+ id: "reset-zoom",
2552
+ icon: "reset-zoom",
2553
+ label: "Reset Zoom",
2554
+ type: "button",
2555
+ group: "zoom",
2556
+ execute: () => {
2557
+ instance.resetZoom?.();
2558
+ }
2559
+ },
2505
2560
  {
2506
2561
  id: "rotate-cw",
2507
2562
  icon: "rotate-cw",
@@ -2675,6 +2730,13 @@ var MediaPlugin = class {
2675
2730
  rotation = 0;
2676
2731
  applyTransform();
2677
2732
  } : void 0,
2733
+ resetZoom: isImage ? () => {
2734
+ currentZoom = 1;
2735
+ rotation = 0;
2736
+ ctx.container.scrollTop = 0;
2737
+ ctx.container.scrollLeft = 0;
2738
+ applyTransform();
2739
+ } : void 0,
2678
2740
  rotateCW: isImage || isVideo ? () => {
2679
2741
  rotation = (rotation + 90) % 360;
2680
2742
  applyTransform();
@@ -2791,6 +2853,14 @@ var DocxPlugin = class {
2791
2853
  group: "zoom",
2792
2854
  execute: () => instance.fitToPage?.()
2793
2855
  },
2856
+ {
2857
+ id: "reset-zoom",
2858
+ icon: "reset-zoom",
2859
+ label: "Reset Zoom",
2860
+ type: "button",
2861
+ group: "zoom",
2862
+ execute: () => instance.resetZoom?.()
2863
+ },
2794
2864
  {
2795
2865
  id: "rotate-cw",
2796
2866
  icon: "rotate-cw",
@@ -3107,6 +3177,14 @@ var DocxPlugin = class {
3107
3177
  rotation = 0;
3108
3178
  applyTransform();
3109
3179
  },
3180
+ resetZoom: () => {
3181
+ isUserZoomed = false;
3182
+ scale = calculateFitScale("page");
3183
+ rotation = 0;
3184
+ ctx.container.scrollTop = 0;
3185
+ ctx.container.scrollLeft = 0;
3186
+ applyTransform();
3187
+ },
3110
3188
  rotateCW: () => {
3111
3189
  rotation = (rotation + 90) % 360;
3112
3190
  applyTransform();
@@ -3556,6 +3634,16 @@ var ExcelPlugin = class {
3556
3634
  instance.zoomIn?.();
3557
3635
  }
3558
3636
  },
3637
+ {
3638
+ id: "reset-zoom",
3639
+ icon: "reset-zoom",
3640
+ label: "Reset Zoom",
3641
+ type: "button",
3642
+ group: "zoom",
3643
+ execute: () => {
3644
+ instance.resetZoom?.();
3645
+ }
3646
+ },
3559
3647
  {
3560
3648
  id: "download",
3561
3649
  icon: "download",
@@ -3743,6 +3831,12 @@ var ExcelPlugin = class {
3743
3831
  scale = calculateFitScale();
3744
3832
  applyTransform();
3745
3833
  },
3834
+ resetZoom: () => {
3835
+ scale = calculateFitScale();
3836
+ contentArea.scrollTop = 0;
3837
+ contentArea.scrollLeft = 0;
3838
+ applyTransform();
3839
+ },
3746
3840
  rotateCW: () => {
3747
3841
  },
3748
3842
  rotateCCW: () => {
@@ -3873,6 +3967,16 @@ var CsvPlugin = class {
3873
3967
  instance.zoomIn?.();
3874
3968
  }
3875
3969
  },
3970
+ {
3971
+ id: "reset-zoom",
3972
+ icon: "reset-zoom",
3973
+ label: "Reset Zoom",
3974
+ type: "button",
3975
+ group: "zoom",
3976
+ execute: () => {
3977
+ instance.resetZoom?.();
3978
+ }
3979
+ },
3876
3980
  {
3877
3981
  id: "download",
3878
3982
  icon: "download",
@@ -4062,6 +4166,12 @@ var CsvPlugin = class {
4062
4166
  scale = calculateFitScale();
4063
4167
  applyScale();
4064
4168
  },
4169
+ resetZoom: () => {
4170
+ scale = calculateFitScale();
4171
+ container.scrollTop = 0;
4172
+ container.scrollLeft = 0;
4173
+ applyScale();
4174
+ },
4065
4175
  rotateCW: () => {
4066
4176
  },
4067
4177
  rotateCCW: () => {
@@ -4177,6 +4287,16 @@ var CodePlugin = class {
4177
4287
  instance.zoomIn?.();
4178
4288
  }
4179
4289
  },
4290
+ {
4291
+ id: "reset-zoom",
4292
+ icon: "reset-zoom",
4293
+ label: "Reset Zoom",
4294
+ type: "button",
4295
+ group: "zoom",
4296
+ execute: () => {
4297
+ instance.resetZoom?.();
4298
+ }
4299
+ },
4180
4300
  {
4181
4301
  id: "copy",
4182
4302
  icon: "copy",
@@ -4456,6 +4576,15 @@ var CodePlugin = class {
4456
4576
  zoomLevel = isTxt ? calculateTxtFit() : 1;
4457
4577
  updateTransform();
4458
4578
  },
4579
+ resetZoom: () => {
4580
+ isUserZoomed = false;
4581
+ fontSize = 13;
4582
+ rotation = 0;
4583
+ zoomLevel = isTxt ? calculateTxtFit() : 1;
4584
+ container.scrollTop = 0;
4585
+ container.scrollLeft = 0;
4586
+ updateTransform();
4587
+ },
4459
4588
  rotateCW: () => {
4460
4589
  rotation = (rotation + 90) % 360;
4461
4590
  updateTransform();
@@ -4518,11 +4647,19 @@ var ArchivePlugin = class {
4518
4647
  {
4519
4648
  id: "fit-page",
4520
4649
  icon: "fit-page",
4521
- label: "Reset Zoom",
4650
+ label: "Fit to Page",
4522
4651
  type: "button",
4523
4652
  group: "zoom",
4524
4653
  execute: () => instance.fitToPage?.()
4525
4654
  },
4655
+ {
4656
+ id: "reset-zoom",
4657
+ icon: "reset-zoom",
4658
+ label: "Reset Zoom",
4659
+ type: "button",
4660
+ group: "zoom",
4661
+ execute: () => instance.resetZoom?.()
4662
+ },
4526
4663
  {
4527
4664
  id: "download",
4528
4665
  icon: "download",
@@ -4677,7 +4814,13 @@ var ArchivePlugin = class {
4677
4814
  },
4678
4815
  fitToPage: () => {
4679
4816
  scale = 1;
4680
- wrapper.style.transform = `scale(1)`;
4817
+ wrapper.style.transform = "scale(1)";
4818
+ },
4819
+ resetZoom: () => {
4820
+ scale = 1;
4821
+ wrapper.style.transform = "scale(1)";
4822
+ ctx.container.scrollTop = 0;
4823
+ ctx.container.scrollLeft = 0;
4681
4824
  },
4682
4825
  download: () => {
4683
4826
  downloadFile(ctx.buffer, ctx.metadata.name || "archive.zip", "application/zip");
@@ -4729,6 +4872,14 @@ var MarkdownPlugin = class {
4729
4872
  group: "zoom",
4730
4873
  execute: () => instance.fitToPage?.()
4731
4874
  },
4875
+ {
4876
+ id: "reset-zoom",
4877
+ icon: "reset-zoom",
4878
+ label: "Reset Zoom",
4879
+ type: "button",
4880
+ group: "zoom",
4881
+ execute: () => instance.resetZoom?.()
4882
+ },
4732
4883
  {
4733
4884
  id: "copy",
4734
4885
  icon: "copy",
@@ -4882,6 +5033,12 @@ var MarkdownPlugin = class {
4882
5033
  fontSize = 15;
4883
5034
  wrapper.style.fontSize = "15px";
4884
5035
  },
5036
+ resetZoom: () => {
5037
+ fontSize = 15;
5038
+ wrapper.style.fontSize = "15px";
5039
+ ctx.container.scrollTop = 0;
5040
+ ctx.container.scrollLeft = 0;
5041
+ },
4885
5042
  download: () => {
4886
5043
  downloadFile(ctx.buffer, ctx.metadata.name || "document.md", "text/markdown");
4887
5044
  },
@@ -4975,6 +5132,14 @@ var PptxPlugin = class {
4975
5132
  group: "zoom",
4976
5133
  execute: () => instance.fitToPage?.()
4977
5134
  },
5135
+ {
5136
+ id: "reset-zoom",
5137
+ icon: "reset-zoom",
5138
+ label: "Reset Zoom",
5139
+ type: "button",
5140
+ group: "zoom",
5141
+ execute: () => instance.resetZoom?.()
5142
+ },
4978
5143
  {
4979
5144
  id: "rotate-cw",
4980
5145
  icon: "rotate-cw",
@@ -5094,6 +5259,13 @@ var PptxPlugin = class {
5094
5259
  rotation = 0;
5095
5260
  applyTransform();
5096
5261
  },
5262
+ resetZoom: () => {
5263
+ scale = calculateFitScale();
5264
+ rotation = 0;
5265
+ wrapper.scrollTop = 0;
5266
+ wrapper.scrollLeft = 0;
5267
+ applyTransform();
5268
+ },
5097
5269
  rotateCW: () => {
5098
5270
  rotation = (rotation + 90) % 360;
5099
5271
  applyTransform();
@@ -5169,6 +5341,14 @@ var ThreeDPlugin = class {
5169
5341
  group: "zoom",
5170
5342
  execute: () => instance.fitToPage?.()
5171
5343
  },
5344
+ {
5345
+ id: "reset-zoom",
5346
+ icon: "reset-zoom",
5347
+ label: "Reset Zoom",
5348
+ type: "button",
5349
+ group: "zoom",
5350
+ execute: () => instance.resetZoom?.()
5351
+ },
5172
5352
  {
5173
5353
  id: "rotate-cw",
5174
5354
  icon: "rotate-cw",
@@ -5305,6 +5485,7 @@ var ThreeDPlugin = class {
5305
5485
  controls.update();
5306
5486
  },
5307
5487
  fitToPage: fitCamera,
5488
+ resetZoom: fitCamera,
5308
5489
  rotateCW: () => {
5309
5490
  isWireframe = !isWireframe;
5310
5491
  materials.forEach((m) => {
@@ -5519,6 +5700,14 @@ var RtfPlugin = class {
5519
5700
  group: "zoom",
5520
5701
  execute: () => instance.fitToPage?.()
5521
5702
  },
5703
+ {
5704
+ id: "reset-zoom",
5705
+ icon: "reset-zoom",
5706
+ label: "Reset Zoom",
5707
+ type: "button",
5708
+ group: "zoom",
5709
+ execute: () => instance.resetZoom?.()
5710
+ },
5522
5711
  {
5523
5712
  id: "rotate-cw",
5524
5713
  icon: "rotate-cw",
@@ -5988,6 +6177,15 @@ var RtfPlugin = class {
5988
6177
  rotation = 0;
5989
6178
  applyTransform();
5990
6179
  },
6180
+ resetZoom: () => {
6181
+ isUserZoomed = false;
6182
+ fitMode = "width";
6183
+ scale = calculateFitScale("width");
6184
+ rotation = 0;
6185
+ ctx.container.scrollTop = 0;
6186
+ ctx.container.scrollLeft = 0;
6187
+ applyTransform();
6188
+ },
5991
6189
  rotateCW: () => {
5992
6190
  rotation = (rotation + 90) % 360;
5993
6191
  applyTransform();
@@ -6055,6 +6253,14 @@ var HtmlPreviewPlugin = class {
6055
6253
  group: "zoom",
6056
6254
  execute: () => instance.fitToPage?.()
6057
6255
  },
6256
+ {
6257
+ id: "reset-zoom",
6258
+ icon: "reset-zoom",
6259
+ label: "Reset Zoom",
6260
+ type: "button",
6261
+ group: "zoom",
6262
+ execute: () => instance.resetZoom?.()
6263
+ },
6058
6264
  {
6059
6265
  id: "copy",
6060
6266
  icon: "copy",
@@ -6127,6 +6333,12 @@ var HtmlPreviewPlugin = class {
6127
6333
  scale = 1;
6128
6334
  iframe.style.transform = "scale(1)";
6129
6335
  },
6336
+ resetZoom: () => {
6337
+ scale = 1;
6338
+ iframe.style.transform = "scale(1)";
6339
+ ctx.container.scrollTop = 0;
6340
+ ctx.container.scrollLeft = 0;
6341
+ },
6130
6342
  copy: () => {
6131
6343
  navigator.clipboard.writeText(rawHtml);
6132
6344
  },
@@ -6227,6 +6439,14 @@ var OpenDocumentPlugin = class {
6227
6439
  group: "zoom",
6228
6440
  execute: () => instance.fitToPage?.()
6229
6441
  },
6442
+ {
6443
+ id: "reset-zoom",
6444
+ icon: "reset-zoom",
6445
+ label: "Reset Zoom",
6446
+ type: "button",
6447
+ group: "zoom",
6448
+ execute: () => instance.resetZoom?.()
6449
+ },
6230
6450
  {
6231
6451
  id: "rotate-cw",
6232
6452
  icon: "rotate-cw",
@@ -6494,6 +6714,15 @@ var OpenDocumentPlugin = class {
6494
6714
  rotation = 0;
6495
6715
  applyTransform();
6496
6716
  },
6717
+ resetZoom: () => {
6718
+ isUserZoomed = false;
6719
+ fitMode = "width";
6720
+ scale = calculateFitScale("width");
6721
+ rotation = 0;
6722
+ container.scrollTop = 0;
6723
+ container.scrollLeft = 0;
6724
+ applyTransform();
6725
+ },
6497
6726
  rotateCW: () => {
6498
6727
  rotation = (rotation + 90) % 360;
6499
6728
  applyTransform();
@@ -6837,6 +7066,14 @@ var DocPlugin = class {
6837
7066
  group: "zoom",
6838
7067
  execute: () => instance.fitToPage?.()
6839
7068
  },
7069
+ {
7070
+ id: "reset-zoom",
7071
+ icon: "reset-zoom",
7072
+ label: "Reset Zoom",
7073
+ type: "button",
7074
+ group: "zoom",
7075
+ execute: () => instance.resetZoom?.()
7076
+ },
6840
7077
  {
6841
7078
  id: "rotate-cw",
6842
7079
  icon: "rotate-cw",
@@ -7043,6 +7280,15 @@ var DocPlugin = class {
7043
7280
  rotation = 0;
7044
7281
  applyTransform();
7045
7282
  },
7283
+ resetZoom: () => {
7284
+ isUserZoomed = false;
7285
+ fitMode = "width";
7286
+ scale = calculateFitScale("width");
7287
+ rotation = 0;
7288
+ ctx.container.scrollTop = 0;
7289
+ ctx.container.scrollLeft = 0;
7290
+ applyTransform();
7291
+ },
7046
7292
  rotateCW: () => {
7047
7293
  rotation = (rotation + 90) % 360;
7048
7294
  applyTransform();
@@ -7523,6 +7769,14 @@ var PptPlugin = class {
7523
7769
  group: "zoom",
7524
7770
  execute: () => instance.fitToPage?.()
7525
7771
  },
7772
+ {
7773
+ id: "reset-zoom",
7774
+ icon: "reset-zoom",
7775
+ label: "Reset Zoom",
7776
+ type: "button",
7777
+ group: "zoom",
7778
+ execute: () => instance.resetZoom?.()
7779
+ },
7526
7780
  {
7527
7781
  id: "rotate-cw",
7528
7782
  icon: "rotate-cw",
@@ -7711,6 +7965,13 @@ var PptPlugin = class {
7711
7965
  rotation = 0;
7712
7966
  applyTransform();
7713
7967
  },
7968
+ resetZoom: () => {
7969
+ scale = calculateFitScale();
7970
+ rotation = 0;
7971
+ container.scrollTop = 0;
7972
+ container.scrollLeft = 0;
7973
+ applyTransform();
7974
+ },
7714
7975
  rotateCW: () => {
7715
7976
  rotation = (rotation + 90) % 360;
7716
7977
  applyTransform();