jazz-tools 0.11.5 → 0.11.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.11.5 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.11.6 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -11,12 +11,12 @@
11
11
  ESM Build start
12
12
  ESM dist/index.js 1.50 KB
13
13
  ESM dist/testing.js 6.18 KB
14
- ESM dist/chunk-IOK4K3XC.js 120.99 KB
14
+ ESM dist/chunk-2LO7CLFD.js 121.15 KB
15
15
  ESM dist/index.js.map 259.00 B
16
16
  ESM dist/testing.js.map 12.24 KB
17
- ESM dist/chunk-IOK4K3XC.js.map 287.57 KB
18
- ESM ⚡️ Build success in 51ms
17
+ ESM dist/chunk-2LO7CLFD.js.map 288.04 KB
18
+ ESM ⚡️ Build success in 79ms
19
19
 
20
- > jazz-tools@0.11.5 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.11.6 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.11.6
4
+
5
+ ### Patch Changes
6
+
7
+ - e7c85b7: Add targetWidth to highestResAvailable to add a way to fetch the next size up
8
+ - Updated dependencies [8ed144e]
9
+ - cojson@0.11.6
10
+
3
11
  ## 0.11.5
4
12
 
5
13
  ### Patch Changes
@@ -3489,22 +3489,26 @@ var ImageDefinition = class extends (_b = CoMap, _a = co.items, _b) {
3489
3489
  );
3490
3490
  }
3491
3491
  const resolutions = Object.keys(this).filter(
3492
- (key) => key.match(/^\d+x\d+$/) && (options?.maxWidth === void 0 || Number(key.split("x")[0]) <= options.maxWidth)
3492
+ (key) => key.match(/^\d+x\d+$/)
3493
3493
  );
3494
- resolutions.sort((a, b) => {
3494
+ let maxWidth = options?.maxWidth;
3495
+ if (options?.targetWidth) {
3496
+ const targetWidth = options.targetWidth;
3497
+ const widths = resolutions.map((res) => Number(res.split("x")[0]));
3498
+ maxWidth = Math.min(...widths.filter((w) => w >= targetWidth));
3499
+ }
3500
+ const validResolutions = resolutions.filter(
3501
+ (key) => maxWidth === void 0 || Number(key.split("x")[0]) <= maxWidth
3502
+ );
3503
+ validResolutions.sort((a, b) => {
3495
3504
  const aWidth = Number(a.split("x")[0]);
3496
3505
  const bWidth = Number(b.split("x")[0]);
3497
3506
  return aWidth - bWidth;
3498
3507
  });
3499
3508
  let highestAvailableResolution;
3500
- for (const resolution of resolutions) {
3509
+ for (const resolution of validResolutions) {
3501
3510
  if (this[resolution] && this[resolution]?.getChunks()) {
3502
3511
  highestAvailableResolution = resolution;
3503
- } else {
3504
- return highestAvailableResolution && {
3505
- res: highestAvailableResolution,
3506
- stream: this[highestAvailableResolution]
3507
- };
3508
3512
  }
3509
3513
  }
3510
3514
  return highestAvailableResolution && {
@@ -4218,4 +4222,4 @@ export {
4218
4222
  consumeInviteLink
4219
4223
  };
4220
4224
  /* istanbul ignore file -- @preserve */
4221
- //# sourceMappingURL=chunk-IOK4K3XC.js.map
4225
+ //# sourceMappingURL=chunk-2LO7CLFD.js.map