@idetik/core 0.29.0 → 0.29.1

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.d.ts CHANGED
@@ -260,7 +260,8 @@ declare class ChunkManager {
260
260
  private readonly disposeTexture_?;
261
261
  private readonly getGpuResidentBytes_;
262
262
  private readonly memoryLimitBytes_;
263
- constructor(uploadTexture?: (texture: Texture) => void, disposeTexture?: (texture: Texture) => void, getGpuResidentBytes?: () => number, memoryLimitBytes?: number);
263
+ private readonly maxGpuUploadsPerUpdate_;
264
+ constructor(uploadTexture?: (texture: Texture) => void, disposeTexture?: (texture: Texture) => void, getGpuResidentBytes?: () => number, memoryLimitBytes?: number, maxConcurrentRequests?: number, maxGpuUploadsPerUpdate?: number);
264
265
  get memoryLimitBytes(): number;
265
266
  get queueStats(): QueueStats;
266
267
  get memoryStats(): {
@@ -651,6 +652,8 @@ type IdetikParams = {
651
652
  overlays?: Overlay[];
652
653
  showStats?: boolean;
653
654
  memoryLimitMB?: number;
655
+ maxConcurrentRequests?: number;
656
+ maxGpuUploadsPerUpdate?: number;
654
657
  };
655
658
  type IdetikContext = {
656
659
  chunkManager: ChunkManager;
package/dist/index.js CHANGED
@@ -8646,16 +8646,15 @@ function Ho(C) {
8646
8646
  return "image_scalar_u32";
8647
8647
  }
8648
8648
  }
8649
- const qo = 8;
8650
8649
  function EB(C, A) {
8651
8650
  const I = C.priority ?? Number.MAX_SAFE_INTEGER, g = A.priority ?? Number.MAX_SAFE_INTEGER;
8652
8651
  return I === g ? (C.orderKey ?? Number.MAX_SAFE_INTEGER) - (A.orderKey ?? Number.MAX_SAFE_INTEGER) : I - g;
8653
8652
  }
8654
- class po {
8653
+ class qo {
8655
8654
  maxConcurrent_;
8656
8655
  pending_ = [];
8657
8656
  running_ = /* @__PURE__ */ new Map();
8658
- constructor(A = qo) {
8657
+ constructor(A) {
8659
8658
  this.maxConcurrent_ = Math.max(1, A);
8660
8659
  }
8661
8660
  enqueue(A, I) {
@@ -8701,13 +8700,13 @@ class po {
8701
8700
  }
8702
8701
  }
8703
8702
  let tg = 0, eg = 0;
8704
- function mo(C, A) {
8703
+ function po(C, A) {
8705
8704
  C.data && (tg -= C.data.byteLength, eg -= 1), C.data = A, tg += A.byteLength, eg += 1;
8706
8705
  }
8707
8706
  function dC(C) {
8708
8707
  C.data && (tg -= C.data.byteLength, eg -= 1), C.data = void 0, C.texture?.releaseCpuData();
8709
8708
  }
8710
- function xo() {
8709
+ function mo() {
8711
8710
  return { cpuChunkBytes: tg, cpuChunkCount: eg };
8712
8711
  }
8713
8712
  function lC(C, A, I = 1e-6) {
@@ -8722,7 +8721,7 @@ const LC = [
8722
8721
  Uint32Array,
8723
8722
  Float32Array
8724
8723
  ];
8725
- function bo(C) {
8724
+ function xo(C) {
8726
8725
  if (LC.some((I) => C instanceof I))
8727
8726
  return !0;
8728
8727
  const A = LC.map((I) => I.name);
@@ -8731,14 +8730,14 @@ function bo(C) {
8731
8730
  `Unsupported chunk data type: ${C}. Supported data types: ${A}`
8732
8731
  ), !1;
8733
8732
  }
8734
- function To(C, A) {
8733
+ function bo(C, A) {
8735
8734
  return Math.round((A - C.translation) / C.scale);
8736
8735
  }
8737
8736
  function TA(C, A, I) {
8738
8737
  return Math.max(A, Math.min(I, C));
8739
8738
  }
8740
8739
  const dg = Symbol("INTERNAL_POLICY_KEY");
8741
- class Wo {
8740
+ class To {
8742
8741
  store_;
8743
8742
  policy_;
8744
8743
  policyChanged_ = !1;
@@ -9009,7 +9008,7 @@ class Wo {
9009
9008
  }
9010
9009
  timeIndex(A) {
9011
9010
  const I = this.store_.dimensions.t;
9012
- return A.t === void 0 || I === void 0 ? 0 : To(I.lods[0], A.t);
9011
+ return A.t === void 0 || I === void 0 ? 0 : bo(I.lods[0], A.t);
9013
9012
  }
9014
9013
  getZBounds(A) {
9015
9014
  const I = this.store_.dimensions.z;
@@ -9069,7 +9068,7 @@ class Wo {
9069
9068
  function dI(C) {
9070
9069
  C.visible = !1, C.prefetch = !1, C.priority = null, C.orderKey = null;
9071
9070
  }
9072
- class vo {
9071
+ class Wo {
9073
9072
  // Chunks indexed as chunks_[lod][t][c][z][y][x].
9074
9073
  chunks_;
9075
9074
  lowestResLOD_;
@@ -9149,7 +9148,7 @@ class vo {
9149
9148
  return this.lowestResLOD_;
9150
9149
  }
9151
9150
  addView(A) {
9152
- const I = new Wo(this, A);
9151
+ const I = new To(this, A);
9153
9152
  return this.views_.push(I), this.hasHadViews_ = !0, I;
9154
9153
  }
9155
9154
  get views() {
@@ -9242,16 +9241,17 @@ class vo {
9242
9241
  };
9243
9242
  }
9244
9243
  }
9245
- const Zo = 4;
9244
+ const vo = 8, Zo = 4;
9246
9245
  class Po {
9247
9246
  stores_ = [];
9248
- queue_ = new po();
9247
+ queue_;
9249
9248
  uploadTexture_;
9250
9249
  disposeTexture_;
9251
9250
  getGpuResidentBytes_;
9252
9251
  memoryLimitBytes_;
9253
- constructor(A, I, g = () => 0, B = 1 / 0) {
9254
- this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = g, this.memoryLimitBytes_ = B;
9252
+ maxGpuUploadsPerUpdate_;
9253
+ constructor(A, I, g = () => 0, B = 1 / 0, Q = vo, E = Zo) {
9254
+ this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = g, this.memoryLimitBytes_ = B, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new qo(Q);
9255
9255
  }
9256
9256
  get memoryLimitBytes() {
9257
9257
  return this.memoryLimitBytes_;
@@ -9263,11 +9263,11 @@ class Po {
9263
9263
  };
9264
9264
  }
9265
9265
  get memoryStats() {
9266
- return xo();
9266
+ return mo();
9267
9267
  }
9268
9268
  addView(A, I) {
9269
9269
  let g = this.stores_.find((B) => B.source === A)?.store;
9270
- return g || (g = new vo(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: g })), g.addView(I);
9270
+ return g || (g = new Wo(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: g })), g.addView(I);
9271
9271
  }
9272
9272
  update() {
9273
9273
  const A = [];
@@ -9304,7 +9304,7 @@ class Po {
9304
9304
  B.state === "loaded" && B.texture === void 0 && I.push(B);
9305
9305
  if (I.length === 0) return;
9306
9306
  I.sort(EB);
9307
- const g = Math.min(I.length, Zo);
9307
+ const g = Math.min(I.length, this.maxGpuUploadsPerUpdate_);
9308
9308
  for (let B = 0; B < g; B++) {
9309
9309
  const Q = I[B], E = TI.createWithChunk(Q);
9310
9310
  this.uploadTexture_(E), Q.texture = E, dC(Q);
@@ -9693,7 +9693,9 @@ class IE {
9693
9693
  (E) => this.renderer_.uploadTexture(E),
9694
9694
  (E) => this.renderer_.disposeTexture(E),
9695
9695
  () => this.renderer_.gpuTextureBytes,
9696
- B
9696
+ B,
9697
+ A.maxConcurrentRequests,
9698
+ A.maxGpuUploadsPerUpdate
9697
9699
  ), this.context_ = {
9698
9700
  chunkManager: this.chunkManager_
9699
9701
  }, this.viewports_ = JC(
@@ -15165,7 +15167,7 @@ async function zs(C, A, I, g, B) {
15165
15167
  throw Q;
15166
15168
  H.warn("ZarrWorker", "Falling back to main thread", Q);
15167
15169
  const E = await C.getChunk(I, B);
15168
- if (!bo(E.data))
15170
+ if (!xo(E.data))
15169
15171
  throw new Error(
15170
15172
  `Unsupported chunk data type: ${E.data.constructor.name}`
15171
15173
  );
@@ -15234,7 +15236,7 @@ class At {
15234
15236
  throw new Error(
15235
15237
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
15236
15238
  );
15237
- A.rowAlignmentBytes = t, mo(A, s);
15239
+ A.rowAlignmentBytes = t, po(A, s);
15238
15240
  }
15239
15241
  }
15240
15242
  const jC = {