react-iiif-vault 0.9.20 → 0.9.21

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.
@@ -388,7 +388,7 @@ function getVisibleCanvasesFromCanvasId(vault, manifestOrRange, canvasId, preven
388
388
  }
389
389
  return [{ id: fullCanvas.id, type: "Canvas" }];
390
390
  }
391
- function getManifestSequence(vault, manifestOrRange, { disablePaging } = {}) {
391
+ function getManifestSequence(vault, manifestOrRange, { disablePaging, skipNonPaged } = {}) {
392
392
  const behavior = manifestOrRange.behavior;
393
393
  const isPaged = behavior.includes("paged");
394
394
  const isContinuous = isPaged ? false : behavior.includes("continuous");
@@ -409,20 +409,35 @@ function getManifestSequence(vault, manifestOrRange, { disablePaging } = {}) {
409
409
  }
410
410
  };
411
411
  let offset = 0;
412
+ let flushNextPaged = false;
412
413
  for (let i = 0; i < manifestItems.length; i++) {
413
414
  const canvas = vault.get(manifestItems[i]);
414
415
  if (canvas.behavior.includes("non-paged")) {
415
416
  if (i === offset) {
416
417
  offset++;
417
418
  }
419
+ if (!skipNonPaged) {
420
+ flush();
421
+ ordering.push([i]);
422
+ flush();
423
+ }
418
424
  continue;
419
425
  }
420
426
  if (i === offset || canvas.behavior.includes("facing-pages")) {
427
+ if (currentOrdering.length) {
428
+ flushNextPaged = true;
429
+ }
421
430
  flush();
422
431
  ordering.push([i]);
432
+ flush();
423
433
  continue;
424
434
  }
425
435
  currentOrdering.push(i);
436
+ if (flushNextPaged) {
437
+ flush();
438
+ flushNextPaged = false;
439
+ continue;
440
+ }
426
441
  if (currentOrdering.length > 1) {
427
442
  flush();
428
443
  }