@silurus/ooxml 0.89.3 → 0.89.4

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/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { t as e } from "./docx-GXxH0AwW.js";
2
2
  import { t } from "./pptx-CLyebeF_.js";
3
- import { t as n } from "./xlsx-DelYm4VZ.js";
3
+ import { t as n } from "./xlsx-lvftmF1U.js";
4
4
  export { e as docx, t as pptx, n as xlsx };
@@ -1,10 +1,10 @@
1
1
  import { t as e } from "./model-source-COXegBNA.js";
2
- var t = "0.89.3", n = class extends Error {
2
+ var t = "0.89.4", n = class extends Error {
3
3
  constructor(n, r) {
4
4
  super(`Companion requires @silurus/ooxml ${n} (${r}); installed runtime is ${t} (${e})`), this.code = "companion-runtime-mismatch", this.name = "CompanionRuntimeMismatchError";
5
5
  }
6
6
  };
7
7
  function r(e, t) {
8
- if (e !== "0.89.3" || t !== "ooxml-model-source-module/v2") throw new n(e, t);
8
+ if (e !== "0.89.4" || t !== "ooxml-model-source-module/v2") throw new n(e, t);
9
9
  }
10
10
  export { n as CompanionRuntimeMismatchError, e as MODEL_SOURCE_MODULE_PROTOCOL, r as assertCompanionRuntime };
@@ -4799,7 +4799,7 @@ interface XlsxRenderViewportOptions {
4799
4799
  } | null;
4800
4800
  }
4801
4801
  //#endregion
4802
- //#region dist/.types-work/xlsx-MBk1F2bM.d.ts
4802
+ //#region dist/.types-work/xlsx-s1Y5IqCI.d.ts
4803
4803
  type ResolvedList = {
4804
4804
  kind: 'values';
4805
4805
  values: string[];
@@ -5120,6 +5120,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
5120
5120
  private get activeCell();
5121
5121
  private get selectionMode();
5122
5122
  private _pendingZoomAnchor;
5123
+ private displayedViewport;
5123
5124
  private readonly selectionController;
5124
5125
  private readonly notifier;
5125
5126
  private readonly contextReader;
@@ -5180,7 +5181,9 @@ declare class XlsxViewerEngine implements ZoomableViewer {
5180
5181
  scrollToCell(ref: string, options?: XlsxScrollToCellOptions): Promise<void>;
5181
5182
  private _stepSheet;
5182
5183
  private _initialSheet;
5184
+ private displayedViewportOffset;
5183
5185
  getCellAt(clientX: number, clientY: number): CellAddress | null;
5186
+ private cellAtGeometry;
5184
5187
  private elementContextViewport;
5185
5188
  private elementContextAt;
5186
5189
  private _cellRect;
@@ -2426,7 +2426,7 @@ interface XlsxRenderViewportOptions {
2426
2426
  } | null;
2427
2427
  }
2428
2428
  //#endregion
2429
- //#region dist/.types-work/xlsx-MBk1F2bM.d.ts
2429
+ //#region dist/.types-work/xlsx-s1Y5IqCI.d.ts
2430
2430
  type ResolvedList = {
2431
2431
  kind: 'values';
2432
2432
  values: string[];
@@ -2747,6 +2747,7 @@ declare class XlsxViewerEngine implements ZoomableViewer {
2747
2747
  private get activeCell();
2748
2748
  private get selectionMode();
2749
2749
  private _pendingZoomAnchor;
2750
+ private displayedViewport;
2750
2751
  private readonly selectionController;
2751
2752
  private readonly notifier;
2752
2753
  private readonly contextReader;
@@ -2807,7 +2808,9 @@ declare class XlsxViewerEngine implements ZoomableViewer {
2807
2808
  scrollToCell(ref: string, options?: XlsxScrollToCellOptions): Promise<void>;
2808
2809
  private _stepSheet;
2809
2810
  private _initialSheet;
2811
+ private displayedViewportOffset;
2810
2812
  getCellAt(clientX: number, clientY: number): CellAddress | null;
2813
+ private cellAtGeometry;
2811
2814
  private elementContextViewport;
2812
2815
  private elementContextAt;
2813
2816
  private _cellRect;
@@ -2,7 +2,7 @@ import { N as e, j as t, qt as n } from "./bounded-raw-part-cache-Bi_VqXmg.js";
2
2
  import { T as r } from "./canvas-viewer-mechanics-ycCX6v-z.js";
3
3
  import { a as i, g as a } from "./renderer-DFDF48zw.js";
4
4
  import { b as o } from "./worksheet-pull-client-D5zAevQv.js";
5
- import { c as s, l as c } from "./xlsx-DelYm4VZ.js";
5
+ import { c as s, l as c } from "./xlsx-lvftmF1U.js";
6
6
  import { n as l, o as u, r as d } from "./model-source-COXegBNA.js";
7
7
  import { t as f } from "./bundled-asset-url-BMJ8vNHP.js";
8
8
  import { n as p } from "./host-layout-Cz_lCuTZ.js";
@@ -836,7 +836,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
836
836
  if (n = {
837
837
  ...n,
838
838
  xlsxWorksheetLimits: r.worksheet
839
- }, n.legacyXls !== void 0) return (await import("./workbook-model-source-ChIQjX9a.js")).loadXlsxModelSource(t, n, e);
839
+ }, n.legacyXls !== void 0) return (await import("./workbook-model-source-CZtKSWad.js")).loadXlsxModelSource(t, n, e);
840
840
  n = {
841
841
  ...n,
842
842
  cjkFallback: F(n.cjkFallback)
@@ -3089,28 +3089,31 @@ var xi = class {
3089
3089
  beginSelectionDrag(e) {
3090
3090
  this.pendingTap?.pointerId !== e && (this.pendingTap = null), this.pendingClick?.pointerId !== e && (this.pendingClick = null), this.host.selection.beginDrag(e);
3091
3091
  }
3092
- getHeaderHit(e, t) {
3093
- let n = this.host.worksheet();
3094
- if (!n) return null;
3095
- let r = this.host.scale(), i = this.host.canvasArea.getBoundingClientRect(), a = this.host.screenX(e - i.left, 0), o = t - i.top, s = Math.round(50 * r), c = Math.round(22 * r), l = a < s, u = o < c;
3096
- if (!l && !u) return null;
3097
- if (l && u) return { kind: "corner" };
3098
- let d = V(n);
3099
- if (l) {
3100
- let e = o - c;
3092
+ getHeaderHit(e, t, n = "displayed") {
3093
+ let r = this.host.worksheet();
3094
+ if (!r) return null;
3095
+ let i = this.host.scale(), a = this.host.canvasArea.getBoundingClientRect(), o = this.host.screenX(e - a.left, 0), s = t - a.top, c = Math.round(50 * i), l = Math.round(22 * i), u = o < c, d = s < l;
3096
+ if (!u && !d) return null;
3097
+ if (u && d) return { kind: "corner" };
3098
+ let f = V(r), p = n === "logical" ? {
3099
+ x: this.host.scrollLeft(),
3100
+ y: this.host.scrollTop()
3101
+ } : this.host.displayedViewportOffset();
3102
+ if (u) {
3103
+ let e = s - l;
3101
3104
  if (e < 0) return { kind: "corner" };
3102
- let t = d.rowAt(e, this.host.scrollTop(), r);
3105
+ let t = f.rowAt(e, p.y, i);
3103
3106
  return t === null ? null : {
3104
3107
  kind: "row",
3105
3108
  row: t
3106
3109
  };
3107
3110
  }
3108
- let f = a - s;
3109
- if (f < 0) return { kind: "corner" };
3110
- let p = d.colAt(f, this.host.scrollLeft(), r);
3111
- return p === null ? null : {
3111
+ let m = o - c;
3112
+ if (m < 0) return { kind: "corner" };
3113
+ let h = f.colAt(m, p.x, i);
3114
+ return h === null ? null : {
3112
3115
  kind: "col",
3113
- col: p
3116
+ col: h
3114
3117
  };
3115
3118
  }
3116
3119
  getResizeTarget(e, t) {
@@ -3304,27 +3307,27 @@ var xi = class {
3304
3307
  };
3305
3308
  }
3306
3309
  extendDragSelection(e, t, n) {
3307
- let r = e, i = t, a = this.viewportInputBounds(), o = e < a.left || e >= a.left + a.width || t < a.top || t >= a.top + a.height;
3308
- if (n || o) {
3309
- let e = this.host.scale(), t = Math.round(50 * e), n = Math.round(22 * e), o = a.left + (this.host.isRtl() ? 0 : t), s = a.left + a.width - (this.host.isRtl() ? t : 0);
3310
- r = Math.min(s - 1, Math.max(o + 1, r)), i = Math.min(a.top + a.height - 1, Math.max(a.top + n + 1, i));
3310
+ let r = e, i = t, a = n || this.selectionAutoScrollFrame !== null ? "logical" : "displayed", o = this.viewportInputBounds(), s = e < o.left || e >= o.left + o.width || t < o.top || t >= o.top + o.height;
3311
+ if (n || s) {
3312
+ let e = this.host.scale(), t = Math.round(50 * e), n = Math.round(22 * e), a = o.left + (this.host.isRtl() ? 0 : t), s = o.left + o.width - (this.host.isRtl() ? t : 0);
3313
+ r = Math.min(s - 1, Math.max(a + 1, r)), i = Math.min(o.top + o.height - 1, Math.max(o.top + n + 1, i));
3311
3314
  }
3312
3315
  if (this.selectionMode === "rows") {
3313
- let e = n ? null : this.getHeaderHit(r, i), t = e?.kind === "row" ? e.row : this.host.cellAt(r, i)?.row;
3316
+ let e = n ? null : this.getHeaderHit(r, i, a), t = e?.kind === "row" ? e.row : this.host.cellAt(r, i, a)?.row;
3314
3317
  return !t || t === this.activeCell?.row ? !1 : (this.host.selection.extend({
3315
3318
  row: t,
3316
3319
  col: 1
3317
3320
  }), !0);
3318
3321
  }
3319
3322
  if (this.selectionMode === "cols") {
3320
- let e = n ? null : this.getHeaderHit(r, i), t = e?.kind === "col" ? e.col : this.host.cellAt(r, i)?.col;
3323
+ let e = n ? null : this.getHeaderHit(r, i, a), t = e?.kind === "col" ? e.col : this.host.cellAt(r, i, a)?.col;
3321
3324
  return !t || t === this.activeCell?.col ? !1 : (this.host.selection.extend({
3322
3325
  row: 1,
3323
3326
  col: t
3324
3327
  }), !0);
3325
3328
  }
3326
- let s = this.host.cellAt(r, i);
3327
- return !s || s.row === this.activeCell?.row && s.col === this.activeCell?.col ? !1 : (this.host.selection.extend(s), !0);
3329
+ let c = this.host.cellAt(r, i, a);
3330
+ return !c || c.row === this.activeCell?.row && c.col === this.activeCell?.col ? !1 : (this.host.selection.extend(c), !0);
3328
3331
  }
3329
3332
  selectionAutoScrollSpeed() {
3330
3333
  let e = this.selectionAutoScrollPointer;
@@ -3372,7 +3375,7 @@ var xi = class {
3372
3375
  let a = this.host.scrollLeft(), o = this.host.scrollTop();
3373
3376
  this.host.setScrollLeft(a + n.x * i), this.host.setScrollTop(o + n.y * i);
3374
3377
  let s = this.host.scrollLeft() !== a || this.host.scrollTop() !== o, c = s && this.extendDragSelection(t.clientX, t.clientY, !0);
3375
- if (s && (this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.scheduleRender(), this.host.emitViewportChange(), c && this.host.emitSelectionChange()), !s) {
3378
+ if (s && (this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.scheduleRender(!0), this.host.emitViewportChange(), c && this.host.emitSelectionChange()), !s) {
3376
3379
  this.stopSelectionAutoScroll();
3377
3380
  return;
3378
3381
  }
@@ -3494,7 +3497,7 @@ var xi = class {
3494
3497
  let t = this.host.cellAt(e.clientX, e.clientY);
3495
3498
  t ? this.host.comments.scheduleForCell(t) : this.host.hideCommentPopup(), this.host.scrollHost.style.cursor = t && this.host.hyperlinks.at(t) ? "pointer" : "";
3496
3499
  }
3497
- !this.isSelecting || e.pointerId !== this.selectionPointerId || (this.trackSelectionAutoScroll(e), this.extendDragSelection(e.clientX, e.clientY, !1) && (this.host.updateSelectionOverlay(), this.host.scheduleRender(), this.host.emitSelectionChange()));
3500
+ !this.isSelecting || e.pointerId !== this.selectionPointerId || (this.trackSelectionAutoScroll(e), this.extendDragSelection(e.clientX, e.clientY, !1) && (this.host.updateSelectionOverlay(), this.host.scheduleRender(this.selectionAutoScrollFrame !== null), this.host.emitSelectionChange()));
3498
3501
  }), this.on("pointerup", (e) => {
3499
3502
  if (this.resizeDrag && this.resizeDrag.pointerId === e.pointerId) {
3500
3503
  this.finishResize(e.pointerId);
@@ -3533,7 +3536,7 @@ var xi = class {
3533
3536
  if (!this.host.nativeScrollbars) {
3534
3537
  e.preventDefault();
3535
3538
  let t = e.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? Math.max(1, this.host.scrollHost.clientHeight) : 1, n = (e.shiftKey ? e.deltaY : e.deltaX) * t, r = (e.shiftKey ? 0 : e.deltaY) * t;
3536
- this.host.setScrollLeft(this.host.scrollLeft() + n), this.host.setScrollTop(this.host.scrollTop() + r), this.host.scheduleRender(), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
3539
+ this.host.setScrollLeft(this.host.scrollLeft() + n), this.host.setScrollTop(this.host.scrollTop() + r), this.host.scheduleRender(!0), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
3537
3540
  }
3538
3541
  return;
3539
3542
  }
@@ -4298,10 +4301,10 @@ var Yi = class {
4298
4301
  cssHeight: r
4299
4302
  });
4300
4303
  }
4301
- schedule(e) {
4304
+ schedule(e, t = !1) {
4302
4305
  if (!this.destroyed) {
4303
4306
  if (this.pendingRender = e, this.activeRender) {
4304
- this.begin();
4307
+ t || this.begin();
4305
4308
  return;
4306
4309
  }
4307
4310
  this.animationFrame === null && this.queuePendingRender();
@@ -4692,6 +4695,7 @@ var da = class {
4692
4695
  return this.selectionController.mode;
4693
4696
  }
4694
4697
  _pendingZoomAnchor = null;
4698
+ displayedViewport = null;
4695
4699
  selectionController = new Zi();
4696
4700
  notifier;
4697
4701
  contextReader = new Ii();
@@ -4814,7 +4818,7 @@ var da = class {
4814
4818
  let e = this.scrollHost.scrollLeft, t = this.isRtl ? this.maxScrollLeft - e : e;
4815
4819
  this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.viewport.setOffset(t, this.scrollHost.scrollTop);
4816
4820
  }
4817
- this.emitViewportChange(), this.scheduleRender(), this.updateSelectionOverlay(), this.updateFindOverlay();
4821
+ this.emitViewportChange(), this.scheduleRender(!0), this.updateSelectionOverlay(), this.updateFindOverlay();
4818
4822
  });
4819
4823
  let a = new this.hostWindow.ResizeObserver(() => {
4820
4824
  let e = {
@@ -4839,9 +4843,10 @@ var da = class {
4839
4843
  scale: () => this.viewport.scale,
4840
4844
  isRtl: () => this.isRtl,
4841
4845
  isDestroyed: () => this._destroyed,
4842
- cellAt: (e, t) => this.getCellAt(e, t),
4846
+ cellAt: (e, t, n) => this.cellAtGeometry(e, t, n),
4843
4847
  cellRect: (e, t) => this._cellRect(e, t),
4844
4848
  screenX: (e, t) => this.screenX(e, t),
4849
+ displayedViewportOffset: () => this.displayedViewportOffset(),
4845
4850
  scrollLeft: () => this.effectiveScrollLeft,
4846
4851
  scrollTop: () => this.viewportTop,
4847
4852
  setScrollLeft: (e) => this.setViewportLeft(e),
@@ -4860,7 +4865,7 @@ var da = class {
4860
4865
  copySelection: () => this.copySelection(),
4861
4866
  updateSelectionOverlay: () => this.updateSelectionOverlay(),
4862
4867
  updateFindOverlay: () => this.updateFindOverlay(),
4863
- scheduleRender: () => this.scheduleRender(),
4868
+ scheduleRender: (e) => this.scheduleRender(e),
4864
4869
  renderCurrentSheet: () => this.renderCurrentSheet(),
4865
4870
  emitSelectionChange: () => this.emitSelectionChange(),
4866
4871
  emitViewportChange: () => this.emitViewportChange(),
@@ -5010,13 +5015,13 @@ var da = class {
5010
5015
  a?.(), c && ot(c);
5011
5016
  return;
5012
5017
  }
5013
- this.selectionInput.clearSheetGestures(), this.viewEdits.restoreRowResizeRanges(e, r), c !== void 0 && this.installInitialAnchorReference(n, e, c), this.currentAutoRowHeightsPrepared = l, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = a ?? null, this.sheetViews.clear(), this.sheetViews.set(e, r), this.currentSheet = e, this.currentWorksheet = r, this.previewCompletion = o, this.firstPreviewRender = o !== null, this.previewPreparedViewport = s, o && o.then((i) => {
5018
+ this.selectionInput.clearSheetGestures(), this.viewEdits.restoreRowResizeRanges(e, r), c !== void 0 && this.installInitialAnchorReference(n, e, c), this.currentAutoRowHeightsPrepared = l, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = a ?? null, this.sheetViews.clear(), this.sheetViews.set(e, r), this.currentSheet = e, this.displayedViewport = null, this.currentWorksheet = r, this.previewCompletion = o, this.firstPreviewRender = o !== null, this.previewPreparedViewport = s, o && o.then((i) => {
5014
5019
  if (!this.isCurrentSheetRequest(t, n) || this.currentWorksheet !== r) return;
5015
5020
  this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null;
5016
5021
  let a = !!i.parseError;
5017
5022
  this.selectionInput.clearSheetGestures();
5018
5023
  let o = this.createVisibleSheetView(i), s = a ? void 0 : this.initialAnchorReferenceFor(n, e);
5019
- if (s && Ve(o, s), this.viewEdits.restoreSheetViewState(e, o), this.currentWorksheet = o, this.sheetViews.set(e, o), a) {
5024
+ if (s && Ve(o, s), this.viewEdits.restoreSheetViewState(e, o), this.displayedViewport = null, this.currentWorksheet = o, this.sheetViews.set(e, o), a) {
5020
5025
  this.currentSourceComments = [], this.sourceCommentMap.clear(), this.selectionController.reset(), this.emitSelectionChange(), this.updateSelectionOverlay(), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender();
5021
5026
  return;
5022
5027
  }
@@ -5025,7 +5030,7 @@ var da = class {
5025
5030
  c && (n[Bn](o, c), this.currentAutoRowHeightsPrepared = !0), this.viewEdits.syncAutomaticRowOverrides(e, o), this.currentSourceComments = i.comments ?? [], this.sourceCommentMap = Gi(this.currentSourceComments), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender(), this.scheduleSelectionContextNotification();
5026
5031
  }).catch((e) => {
5027
5032
  if (!(!this.isCurrentSheetRequest(t, n) || this.currentWorksheet !== r)) {
5028
- if (this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null, this.selectionInput.clearSheetGestures(), this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.renderDispatcher.begin(), this._mode === "worker") {
5033
+ if (this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null, this.selectionInput.clearSheetGestures(), this.displayedViewport = null, this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.renderDispatcher.begin(), this._mode === "worker") {
5029
5034
  let e = new OffscreenCanvas(1, 1);
5030
5035
  e.getContext("2d");
5031
5036
  let t = e.transferToImageBitmap();
@@ -5172,8 +5177,14 @@ var da = class {
5172
5177
  emitViewportChange() {
5173
5178
  let e = this.opts.onViewportChange;
5174
5179
  if (!e) return;
5175
- let t = this.getViewportOffset(), n = this._lastViewportNotification;
5176
- n && n.x === t.x && n.y === t.y || (this._lastViewportNotification = t, e(t));
5180
+ let t = this.getViewportOffset(), n = this.displayedViewportOffset(), r = {
5181
+ x: n.x,
5182
+ y: n.y
5183
+ }, i = this._lastViewportNotification;
5184
+ i && i.offset.x === t.x && i.offset.y === t.y && i.displayed.x === r.x && i.displayed.y === r.y || (this._lastViewportNotification = {
5185
+ offset: t,
5186
+ displayed: r
5187
+ }, e(t));
5177
5188
  }
5178
5189
  async setViewportOffset(e) {
5179
5190
  if (!Number.isFinite(e.x) || !Number.isFinite(e.y)) throw TypeError("XLSX viewport offsets must be finite numbers");
@@ -5193,17 +5204,30 @@ var da = class {
5193
5204
  _initialSheet() {
5194
5205
  return this._hiddenSheetMode === "skip" && this.wb ? Bt(0, (e) => this.wb.isHidden(e), this.sheetCount) : 0;
5195
5206
  }
5207
+ displayedViewportOffset() {
5208
+ let e = this.displayedViewport;
5209
+ return e && e.worksheet === this.currentWorksheet && e.scale === this.viewport.scale && e.width === this.canvasArea.clientWidth && e.height === this.canvasArea.clientHeight ? e : {
5210
+ x: this.effectiveScrollLeft,
5211
+ y: this.viewportTop
5212
+ };
5213
+ }
5196
5214
  getCellAt(e, t) {
5215
+ return this.cellAtGeometry(e, t, "displayed");
5216
+ }
5217
+ cellAtGeometry(e, t, n = "displayed") {
5197
5218
  if (this._destroyed) return null;
5198
- let n = this.currentWorksheet;
5199
- if (!n) return null;
5200
- let r = this.viewport.scale, i = this.canvasArea.getBoundingClientRect(), a = this.screenX(e - i.left, 0), o = t - i.top, s = Math.round(50 * r), c = Math.round(22 * r);
5201
- if (a < s || o < c) return null;
5202
- let l = a - s, u = o - c;
5203
- return V(n).cellAt(l, u, {
5204
- scrollX: this.effectiveScrollLeft,
5205
- scrollY: this.viewportTop,
5206
- scale: r
5219
+ let r = this.currentWorksheet;
5220
+ if (!r) return null;
5221
+ let i = this.viewport.scale, a = this.canvasArea.getBoundingClientRect(), o = this.screenX(e - a.left, 0), s = t - a.top, c = Math.round(50 * i), l = Math.round(22 * i);
5222
+ if (o < c || s < l) return null;
5223
+ let u = o - c, d = s - l, f = n === "logical" ? {
5224
+ x: this.effectiveScrollLeft,
5225
+ y: this.viewportTop
5226
+ } : this.displayedViewportOffset();
5227
+ return V(r).cellAt(u, d, {
5228
+ scrollX: f.x,
5229
+ scrollY: f.y,
5230
+ scale: i
5207
5231
  });
5208
5232
  }
5209
5233
  elementContextViewport() {
@@ -5215,8 +5239,8 @@ var da = class {
5215
5239
  width: t,
5216
5240
  height: n,
5217
5241
  scale: r,
5218
- scrollX: this.effectiveScrollLeft,
5219
- scrollY: this.viewportTop,
5242
+ scrollX: this.displayedViewportOffset().x,
5243
+ scrollY: this.displayedViewportOffset().y,
5220
5244
  headerWidth: 50,
5221
5245
  headerHeight: 22,
5222
5246
  buffer: 2
@@ -5248,8 +5272,8 @@ var da = class {
5248
5272
  let r = this.viewport.scale;
5249
5273
  return V(n).cellRect(e, t, {
5250
5274
  scale: r,
5251
- scrollX: this.effectiveScrollLeft,
5252
- scrollY: this.viewportTop,
5275
+ scrollX: this.displayedViewportOffset().x,
5276
+ scrollY: this.displayedViewportOffset().y,
5253
5277
  headerWidth: 50,
5254
5278
  headerHeight: 22
5255
5279
  });
@@ -5464,8 +5488,8 @@ var da = class {
5464
5488
  let i = V(e).roundedContentExtent(n, r, t, 50, 22), a = i.width, o = i.height;
5465
5489
  this.spacer.style.width = `${a}px`, this.spacer.style.height = `${o}px`, this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.viewport.setExtent(a, o), this.setViewportLeft(this.viewport.x), this.viewportTop = this.viewport.y;
5466
5490
  }
5467
- scheduleRender() {
5468
- this.renderDispatcher.schedule(() => this.renderCurrentSheet().catch((e) => this._reportRenderError(e)));
5491
+ scheduleRender(e = !1) {
5492
+ this.renderDispatcher.schedule(() => this.renderCurrentSheet().catch((e) => this._reportRenderError(e)), e && this._mode === "worker");
5469
5493
  }
5470
5494
  async renderCurrentSheet() {
5471
5495
  let e = this.renderDispatcher.begin(), t = this.selectionInput.rowResizePreview;
@@ -5492,44 +5516,52 @@ var da = class {
5492
5516
  }
5493
5517
  let t = this.currentWorksheet, n = this.canvasArea.clientWidth, r = this.canvasArea.clientHeight;
5494
5518
  if (n <= 0 || r <= 0) return;
5495
- let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = V(t).visibleRange({
5519
+ let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = this.effectiveScrollLeft, l = this.viewportTop, u = V(t).visibleRange({
5496
5520
  width: n,
5497
5521
  height: r,
5498
5522
  scale: i,
5499
- scrollX: this.effectiveScrollLeft,
5500
- scrollY: this.viewportTop,
5523
+ scrollX: c,
5524
+ scrollY: l,
5501
5525
  headerWidth: 50,
5502
5526
  headerHeight: 22,
5503
5527
  buffer: 2
5504
- }), l = c.range, { offsetX: u, offsetY: d } = c, { selectedRowRange: f, selectedColRange: p } = this.computeHeaderHighlight(), m = {
5528
+ }), d = u.range, { offsetX: f, offsetY: p } = u, { selectedRowRange: m, selectedColRange: h } = this.computeHeaderHighlight(), g = {
5505
5529
  width: n,
5506
5530
  height: r,
5507
5531
  dpr: a,
5508
5532
  imageResources: this.opts.imageResources,
5509
5533
  cellScale: i,
5510
- scrollOffsetX: u,
5511
- scrollOffsetY: d,
5534
+ scrollOffsetX: f,
5535
+ scrollOffsetY: p,
5512
5536
  freezeRows: o,
5513
5537
  freezeCols: s,
5514
- selectedRowRange: f,
5515
- selectedColRange: p,
5538
+ selectedRowRange: m,
5539
+ selectedColRange: h,
5516
5540
  chromeColors: this.chromeColors
5517
- }, h = this.wireSizeOverrides(), g = t.parseError ? void 0 : this.initialAnchorReferenceFor(this.workbook, this.currentSheet) ?? void 0, _ = h || g ? {
5541
+ }, _ = this.wireSizeOverrides(), v = t.parseError ? void 0 : this.initialAnchorReferenceFor(this.workbook, this.currentSheet) ?? void 0, y = _ || v ? {
5518
5542
  id: this.projectionId,
5519
5543
  revision: this.viewEdits.sizeRevision(this.currentSheet),
5520
5544
  autoRowHeightsPrepared: this.currentAutoRowHeightsPrepared,
5521
- ...g ? { initialAnchorSizes: g } : {}
5522
- } : void 0, v = Dn(h ? {
5523
- ...m,
5524
- sizeOverrides: h.overrides
5525
- } : m, V(t).maximumDigitWidth, {
5545
+ ...v ? { initialAnchorSizes: v } : {}
5546
+ } : void 0, b = Dn(_ ? {
5547
+ ...g,
5548
+ sizeOverrides: _.overrides
5549
+ } : g, V(t).maximumDigitWidth, {
5526
5550
  worksheet: t,
5527
- projection: _
5551
+ projection: y
5528
5552
  });
5529
5553
  if (this._mode === "worker") {
5530
- let t = await this.workbook.renderViewportToBitmap(this.currentSheet, l, v);
5531
- if (!this.renderDispatcher.commitBitmap(e, t, n, r)) return;
5532
- } else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, l, tn(v, () => !this._destroyed && this.renderDispatcher.isCurrent(e))), !this.renderDispatcher.isCurrent(e) || this._destroyed) return;
5554
+ let a = await this.workbook.renderViewportToBitmap(this.currentSheet, d, b);
5555
+ if (!this.renderDispatcher.commitBitmap(e, a, n, r)) return;
5556
+ this.displayedViewport = {
5557
+ worksheet: t,
5558
+ x: c,
5559
+ y: l,
5560
+ scale: i,
5561
+ width: n,
5562
+ height: r
5563
+ }, this.updateSelectionOverlay(), this.updateFindOverlay(), this._lastViewportNotification && this.emitViewportChange();
5564
+ } else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, d, tn(b, () => !this._destroyed && this.renderDispatcher.isCurrent(e))), !this.renderDispatcher.isCurrent(e) || this._destroyed) return;
5533
5565
  this.renderGutters(), this.firstPreviewRender = !1, this.committedFrameCount++;
5534
5566
  }
5535
5567
  computeHeaderHighlight() {
@@ -5549,7 +5581,7 @@ var da = class {
5549
5581
  if (this._destroyed) return;
5550
5582
  this._destroyed = !0, this.notifier.destroy(), this.selectionInput.destroy(), this.sheetRequestGeneration++, this.resizeObserver?.disconnect(), this.chromeTheme.destroy(), this.renderDispatcher.destroy(), this.surface.destroy(), this.overlayHost.destroy(), this.sheetTabs?.destroy(), this.zoomControl?.destroy(), this.comments.destroy(), this.validation.destroy(), this.finder.destroy(), this.releaseHostFonts();
5551
5583
  let e = this.wb?.[Vn];
5552
- typeof e == "function" && e.call(this.wb, this.projectionId), this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.sheetViews.clear(), this.releaseInitialAnchorReferences(), this.viewEdits.destroy(), this.currentSourceComments = [], this.sourceCommentMap.clear(), this.hyperlinks.destroy(), this.preparedWorkbook = null, this.outlineGutter.destroy(), this.elementContext = null, this.selectionController.reset(), this.acquisition.destroy(), this.wrapper.remove();
5584
+ typeof e == "function" && e.call(this.wb, this.projectionId), this.displayedViewport = null, this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.sheetViews.clear(), this.releaseInitialAnchorReferences(), this.viewEdits.destroy(), this.currentSourceComments = [], this.sourceCommentMap.clear(), this.hyperlinks.destroy(), this.preparedWorkbook = null, this.outlineGutter.destroy(), this.elementContext = null, this.selectionController.reset(), this.acquisition.destroy(), this.wrapper.remove();
5553
5585
  }
5554
5586
  assertOpen() {
5555
5587
  if (this._destroyed) throw this.destroyedError();
package/dist/xlsx.mjs CHANGED
@@ -4,5 +4,5 @@ import { f as r, u as i } from "./pixel-budget-DI82Hn3R.js";
4
4
  import { i as a, t as o } from "./tiff-contract-DEd8CGuz.js";
5
5
  import { D as s } from "./canvas-viewer-mechanics-ycCX6v-z.js";
6
6
  import { a as c } from "./worksheet-pull-client-D5zAevQv.js";
7
- import { a as l, i as u, n as d, o as f, r as p, s as m } from "./xlsx-DelYm4VZ.js";
7
+ import { a as l, i as u, n as d, o as f, r as p, s as m } from "./xlsx-lvftmF1U.js";
8
8
  export { u as MAX_SELECTION_AREAS, l as MAX_SELECTION_CONTEXT_CELLS, f as MAX_SELECTION_CONTEXT_TEXT_CHARACTERS, i as OoxmlDecodedImageLimitError, e as OoxmlError, t as OoxmlResourceLimitError, o as TiffDecodeError, d as XlsxSheetViewer, p as XlsxViewer, m as XlsxWorkbook, s as autoResize, r as isOoxmlDecodedImageLimitError, a as isTiffDecodeError, n as openExternalHyperlink, c as resolveSharedStrings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silurus/ooxml",
3
- "version": "0.89.3",
3
+ "version": "0.89.4",
4
4
  "description": "Browser-based OOXML viewer (docx/xlsx/pptx) — Rust/WASM parser + Canvas renderer",
5
5
  "license": "MIT",
6
6
  "author": "Yuki Yokotani <silurus.dev@gmail.com>",