@monogrid/gainmap-js 3.0.1 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.0.2](https://github.com/MONOGRID/gainmap-js/compare/v3.0.1...v3.0.2) (2024-01-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **encode:** encodes a valid image when an invalid tonemapping value was provided as input ([94cec23](https://github.com/MONOGRID/gainmap-js/commit/94cec2363aa0dcb3cc46fca048c68ed7e555ebd0))
7
+
1
8
  ## [3.0.1](https://github.com/MONOGRID/gainmap-js/compare/v3.0.0...v3.0.1) (2023-12-03)
2
9
 
3
10
 
@@ -60,7 +60,7 @@ representative at an online or offline event.
60
60
 
61
61
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
62
  reported to the community leaders responsible for enforcement at
63
- rnd@mono-grid.com.
63
+ rnd@monogrid.com.
64
64
  All complaints will be reviewed and investigated promptly and fairly.
65
65
 
66
66
  All community leaders are obligated to respect the privacy and security of the
package/CONTRIBUTING.md CHANGED
@@ -81,7 +81,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform
81
81
  <!-- omit in toc -->
82
82
  #### How Do I Submit a Good Bug Report?
83
83
 
84
- > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <rnd@mono-grid.com>.
84
+ > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <rnd@monogrid.com>.
85
85
  <!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->
86
86
 
87
87
  We use GitHub issues to track bugs and errors. If you run into an issue with the project:
package/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # gainmap-js
2
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js?ref=badge_shield)
3
+
2
4
  A Javascript (TypeScript) Encoder/Decoder Implementation of Adobe's Gain Map Technology for storing HDR Images using an SDR Image + a "Gain map"
3
5
 
4
6
  > :warning: This library **is primarily intended** for encoding and decoding gain map images for the [three.js](https://github.com/mrdoob/three.js/) 3D Library
@@ -14,7 +16,7 @@ Compares loading:
14
16
  2. a `webp` sdr file + a `webp` gain map + metadata JSON
15
17
  3. a comparable size `.hdr` file for comparison
16
18
 
17
- ## [Free online encoder](https://gainmap-creator.mono-grid.com)
19
+ ## [Free online encoder](https://gainmap-creator.monogrid.com)
18
20
 
19
21
  Use it to convert `.hdr` and `.exr` files into gain maps. It's free and the whole process happens in your browser.
20
22
 
@@ -254,3 +256,7 @@ module.exports = defineConfig({
254
256
 
255
257
  * [Adobe Gainmap Specification](https://helpx.adobe.com/camera-raw/using/gain-map.html)
256
258
  * [Ultra HDR Image Format v1.0](https://developer.android.com/guide/topics/media/platform/hdr-image-format)
259
+
260
+
261
+ ## License
262
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js?ref=badge_large)
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  import { RGBAFormat, LinearFilter, ClampToEdgeWrapping, Scene, OrthographicCamera, HalfFloatType, FloatType, Mesh, PlaneGeometry, WebGLRenderTarget, UVMapping, WebGLRenderer, DataTexture, LinearSRGBColorSpace, ShaderMaterial, Texture, IntType, ShortType, ByteType, UnsignedIntType, UnsignedByteType, MeshBasicMaterial } from 'three';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  /**
@@ -13,17 +13,24 @@
13
13
  * @returns
14
14
  */
15
15
  const canvasToBlob = async (canvas, mimeType, quality) => {
16
- if (canvas instanceof OffscreenCanvas) {
16
+ if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
17
17
  return canvas.convertToBlob({ type: mimeType, quality: quality || 0.9 });
18
18
  }
19
- return new Promise((resolve, reject) => {
20
- canvas.toBlob((res) => {
21
- if (res)
22
- resolve(res);
23
- else
24
- reject(new Error('Failed to convert canvas to blob'));
25
- }, mimeType, quality || 0.9);
26
- });
19
+ else if (canvas instanceof HTMLCanvasElement) {
20
+ return new Promise((resolve, reject) => {
21
+ canvas.toBlob((res) => {
22
+ if (res)
23
+ resolve(res);
24
+ else
25
+ reject(new Error('Failed to convert canvas to blob'));
26
+ }, mimeType, quality || 0.9);
27
+ });
28
+ }
29
+ /* istanbul ignore next
30
+ as long as this function is not exported this is only here
31
+ to satisfy TS strict mode internally
32
+ */
33
+ throw new Error('Unsupported canvas element');
27
34
  };
28
35
  /**
29
36
  * Converts a RAW RGBA image buffer into the provided `mimeType` using the provided `quality`
@@ -59,6 +66,8 @@ const compress = async (params) => {
59
66
  }
60
67
  else {
61
68
  canvas = document.createElement('canvas');
69
+ canvas.width = width;
70
+ canvas.height = height;
62
71
  }
63
72
  const ctx = canvas.getContext('2d');
64
73
  if (!ctx)
@@ -1,4 +1,4 @@
1
- type MPFExtractorOptions = {
1
+ export type MPFExtractorOptions = {
2
2
  debug: boolean;
3
3
  extractFII: boolean;
4
4
  extractNonFII: boolean;
@@ -19,4 +19,3 @@ export declare class MPFExtractor {
19
19
  constructor(options?: Partial<MPFExtractorOptions>);
20
20
  extract(imageArrayBuffer: Uint8Array): Promise<Blob[]>;
21
21
  }
22
- export {};
package/dist/decode.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
- import { Q as QuadRenderer } from './QuadRenderer-pEe6Kzcn.js';
6
+ import { Q as QuadRenderer } from './QuadRenderer-Nn9ZcWDa.js';
7
7
  import { ShaderMaterial, Vector3, NoBlending, SRGBColorSpace, LinearSRGBColorSpace, HalfFloatType, Loader, LoadingManager, Texture, UVMapping, ClampToEdgeWrapping, LinearFilter, LinearMipMapLinearFilter, RGBAFormat, UnsignedByteType, FileLoader } from 'three';
8
8
 
9
9
  const vertexShader = /* glsl */ `
@@ -212,7 +212,7 @@ const decode = (params) => {
212
212
  }
213
213
  sdr.needsUpdate = true;
214
214
  if (gainMap.colorSpace !== LinearSRGBColorSpace) {
215
- console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*');
215
+ console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*, setting it automatically');
216
216
  gainMap.colorSpace = LinearSRGBColorSpace;
217
217
  }
218
218
  gainMap.needsUpdate = true;
@@ -759,6 +759,9 @@ class GainMapLoader extends LoaderBase {
759
759
  sdrLoader.setPath(this.path);
760
760
  sdrLoader.setWithCredentials(this.withCredentials);
761
761
  sdrLoader.load(sdrUrl, async (buffer) => {
762
+ /* istanbul ignore if
763
+ this condition exists only because of three.js types + strict mode
764
+ */
762
765
  if (typeof buffer === 'string')
763
766
  throw new Error('Invalid sdr buffer');
764
767
  sdr = buffer;
@@ -779,6 +782,9 @@ class GainMapLoader extends LoaderBase {
779
782
  gainMapLoader.setPath(this.path);
780
783
  gainMapLoader.setWithCredentials(this.withCredentials);
781
784
  gainMapLoader.load(gainMapUrl, async (buffer) => {
785
+ /* istanbul ignore if
786
+ this condition exists only because of three.js types + strict mode
787
+ */
782
788
  if (typeof buffer === 'string')
783
789
  throw new Error('Invalid gainmap buffer');
784
790
  gainMap = buffer;
@@ -799,6 +805,9 @@ class GainMapLoader extends LoaderBase {
799
805
  metadataLoader.setPath(this.path);
800
806
  metadataLoader.setWithCredentials(this.withCredentials);
801
807
  metadataLoader.load(metadataUrl, async (json) => {
808
+ /* istanbul ignore if
809
+ this condition exists only because of three.js types + strict mode
810
+ */
802
811
  if (typeof json !== 'string')
803
812
  throw new Error('Invalid metadata string');
804
813
  // TODO: implement check on JSON file and remove this eslint disable
@@ -887,6 +896,9 @@ class HDRJPGLoader extends LoaderBase {
887
896
  loader.setWithCredentials(this.withCredentials);
888
897
  this.manager.itemStart(url);
889
898
  loader.load(url, async (jpeg) => {
899
+ /* istanbul ignore if
900
+ this condition exists only because of three.js types + strict mode
901
+ */
890
902
  if (typeof jpeg === 'string')
891
903
  throw new Error('Invalid buffer, received [string], was expecting [ArrayBuffer]');
892
904
  const jpegBuffer = new Uint8Array(jpeg);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  (function (global, factory) {
@@ -508,7 +508,7 @@ void main() {
508
508
  }
509
509
  sdr.needsUpdate = true;
510
510
  if (gainMap.colorSpace !== three.LinearSRGBColorSpace) {
511
- console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*');
511
+ console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*, setting it automatically');
512
512
  gainMap.colorSpace = three.LinearSRGBColorSpace;
513
513
  }
514
514
  gainMap.needsUpdate = true;
@@ -1055,6 +1055,9 @@ void main() {
1055
1055
  sdrLoader.setPath(this.path);
1056
1056
  sdrLoader.setWithCredentials(this.withCredentials);
1057
1057
  sdrLoader.load(sdrUrl, async (buffer) => {
1058
+ /* istanbul ignore if
1059
+ this condition exists only because of three.js types + strict mode
1060
+ */
1058
1061
  if (typeof buffer === 'string')
1059
1062
  throw new Error('Invalid sdr buffer');
1060
1063
  sdr = buffer;
@@ -1075,6 +1078,9 @@ void main() {
1075
1078
  gainMapLoader.setPath(this.path);
1076
1079
  gainMapLoader.setWithCredentials(this.withCredentials);
1077
1080
  gainMapLoader.load(gainMapUrl, async (buffer) => {
1081
+ /* istanbul ignore if
1082
+ this condition exists only because of three.js types + strict mode
1083
+ */
1078
1084
  if (typeof buffer === 'string')
1079
1085
  throw new Error('Invalid gainmap buffer');
1080
1086
  gainMap = buffer;
@@ -1095,6 +1101,9 @@ void main() {
1095
1101
  metadataLoader.setPath(this.path);
1096
1102
  metadataLoader.setWithCredentials(this.withCredentials);
1097
1103
  metadataLoader.load(metadataUrl, async (json) => {
1104
+ /* istanbul ignore if
1105
+ this condition exists only because of three.js types + strict mode
1106
+ */
1098
1107
  if (typeof json !== 'string')
1099
1108
  throw new Error('Invalid metadata string');
1100
1109
  // TODO: implement check on JSON file and remove this eslint disable
@@ -1183,6 +1192,9 @@ void main() {
1183
1192
  loader.setWithCredentials(this.withCredentials);
1184
1193
  this.manager.itemStart(url);
1185
1194
  loader.load(url, async (jpeg) => {
1195
+ /* istanbul ignore if
1196
+ this condition exists only because of three.js types + strict mode
1197
+ */
1186
1198
  if (typeof jpeg === 'string')
1187
1199
  throw new Error('Invalid buffer, received [string], was expecting [ArrayBuffer]');
1188
1200
  const jpegBuffer = new Uint8Array(jpeg);
package/dist/encode.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
- import { c as compress } from './compress-6L6-d1aM.js';
6
+ import { c as compress } from './compress-_yA6snVA.js';
7
7
  import { DataTexture, RGBAFormat, UVMapping, RepeatWrapping, LinearFilter, LinearSRGBColorSpace, ShaderMaterial, Vector3, NoBlending, UnsignedByteType, ACESFilmicToneMapping, LinearToneMapping, CineonToneMapping, ReinhardToneMapping, SRGBColorSpace, Vector2, WebGLRenderTarget, NearestFilter, ClampToEdgeWrapping, FloatType, DataUtils } from 'three';
8
- import { Q as QuadRenderer } from './QuadRenderer-pEe6Kzcn.js';
8
+ import { Q as QuadRenderer } from './QuadRenderer-Nn9ZcWDa.js';
9
9
 
10
10
  /**
11
11
  * Utility function to obtain a `DataTexture` from various input formats
@@ -370,24 +370,32 @@ class SDRMaterial extends ShaderMaterial {
370
370
  }
371
371
  get toneMapping() { return this._toneMapping; }
372
372
  set toneMapping(value) {
373
+ let valid = false;
373
374
  switch (value) {
374
375
  case ACESFilmicToneMapping:
375
376
  this.defines.TONEMAPPING_FUNCTION = 'ACESFilmicToneMapping';
377
+ valid = true;
376
378
  break;
377
379
  case ReinhardToneMapping:
378
380
  this.defines.TONEMAPPING_FUNCTION = 'ReinhardToneMapping';
381
+ valid = true;
379
382
  break;
380
383
  case CineonToneMapping:
381
384
  this.defines.TONEMAPPING_FUNCTION = 'CineonToneMapping';
385
+ valid = true;
382
386
  break;
383
387
  case LinearToneMapping:
384
388
  this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
389
+ valid = true;
385
390
  break;
386
391
  default:
387
- console.error('Unsupported toneMapping');
388
- return;
392
+ console.error(`Unsupported toneMapping: ${value}. Using LinearToneMapping.`);
393
+ this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
394
+ this._toneMapping = LinearToneMapping;
395
+ }
396
+ if (valid) {
397
+ this._toneMapping = value;
389
398
  }
390
- this._toneMapping = value;
391
399
  this.needsUpdate = true;
392
400
  }
393
401
  get brightness() { return this._brightness; }
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  (function (global, factory) {
@@ -19,17 +19,24 @@
19
19
  * @returns
20
20
  */
21
21
  const canvasToBlob = async (canvas, mimeType, quality) => {
22
- if (canvas instanceof OffscreenCanvas) {
22
+ if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
23
23
  return canvas.convertToBlob({ type: mimeType, quality: quality || 0.9 });
24
24
  }
25
- return new Promise((resolve, reject) => {
26
- canvas.toBlob((res) => {
27
- if (res)
28
- resolve(res);
29
- else
30
- reject(new Error('Failed to convert canvas to blob'));
31
- }, mimeType, quality || 0.9);
32
- });
25
+ else if (canvas instanceof HTMLCanvasElement) {
26
+ return new Promise((resolve, reject) => {
27
+ canvas.toBlob((res) => {
28
+ if (res)
29
+ resolve(res);
30
+ else
31
+ reject(new Error('Failed to convert canvas to blob'));
32
+ }, mimeType, quality || 0.9);
33
+ });
34
+ }
35
+ /* istanbul ignore next
36
+ as long as this function is not exported this is only here
37
+ to satisfy TS strict mode internally
38
+ */
39
+ throw new Error('Unsupported canvas element');
33
40
  };
34
41
  /**
35
42
  * Converts a RAW RGBA image buffer into the provided `mimeType` using the provided `quality`
@@ -65,6 +72,8 @@
65
72
  }
66
73
  else {
67
74
  canvas = document.createElement('canvas');
75
+ canvas.width = width;
76
+ canvas.height = height;
68
77
  }
69
78
  const ctx = canvas.getContext('2d');
70
79
  if (!ctx)
@@ -741,24 +750,32 @@ void main() {
741
750
  }
742
751
  get toneMapping() { return this._toneMapping; }
743
752
  set toneMapping(value) {
753
+ let valid = false;
744
754
  switch (value) {
745
755
  case three.ACESFilmicToneMapping:
746
756
  this.defines.TONEMAPPING_FUNCTION = 'ACESFilmicToneMapping';
757
+ valid = true;
747
758
  break;
748
759
  case three.ReinhardToneMapping:
749
760
  this.defines.TONEMAPPING_FUNCTION = 'ReinhardToneMapping';
761
+ valid = true;
750
762
  break;
751
763
  case three.CineonToneMapping:
752
764
  this.defines.TONEMAPPING_FUNCTION = 'CineonToneMapping';
765
+ valid = true;
753
766
  break;
754
767
  case three.LinearToneMapping:
755
768
  this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
769
+ valid = true;
756
770
  break;
757
771
  default:
758
- console.error('Unsupported toneMapping');
759
- return;
772
+ console.error(`Unsupported toneMapping: ${value}. Using LinearToneMapping.`);
773
+ this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
774
+ this._toneMapping = three.LinearToneMapping;
775
+ }
776
+ if (valid) {
777
+ this._toneMapping = value;
760
778
  }
761
- this._toneMapping = value;
762
779
  this.needsUpdate = true;
763
780
  }
764
781
  get brightness() { return this._brightness; }
@@ -4,7 +4,7 @@ import { GainMapMetadata } from '../core/types';
4
4
  *
5
5
  * @category Decoding
6
6
  * @group Decoding
7
- *
7
+ * @deprecated
8
8
  * @example
9
9
  * import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'
10
10
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  var Module = (() => {
@@ -6546,12 +6546,13 @@ const getLibrary = async () => {
6546
6546
  };
6547
6547
 
6548
6548
  /**
6549
- *
6549
+ * @deprecated
6550
6550
  * @param description
6551
6551
  * @param name
6552
6552
  * @param defaultValue
6553
6553
  * @returns
6554
6554
  */
6555
+ /* istanbul ignore next */
6555
6556
  const getAttribute = (description, name, defaultValue) => {
6556
6557
  var _a;
6557
6558
  let returnValue;
@@ -6584,7 +6585,7 @@ const getAttribute = (description, name, defaultValue) => {
6584
6585
  *
6585
6586
  * @category Decoding
6586
6587
  * @group Decoding
6587
- *
6588
+ * @deprecated
6588
6589
  * @example
6589
6590
  * import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'
6590
6591
  *
@@ -6598,6 +6599,7 @@ const getAttribute = (description, name, defaultValue) => {
6598
6599
  * @returns The decoded data
6599
6600
  * @throws {Error} if the provided file cannot be parsed or does not contain a valid Gainmap
6600
6601
  */
6602
+ /* istanbul ignore next */
6601
6603
  const decodeJPEGMetadata = async (file) => {
6602
6604
  var _a, _b;
6603
6605
  const lib = await getLibrary();
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  (function (global, factory) {
@@ -6553,12 +6553,13 @@
6553
6553
  };
6554
6554
 
6555
6555
  /**
6556
- *
6556
+ * @deprecated
6557
6557
  * @param description
6558
6558
  * @param name
6559
6559
  * @param defaultValue
6560
6560
  * @returns
6561
6561
  */
6562
+ /* istanbul ignore next */
6562
6563
  const getAttribute = (description, name, defaultValue) => {
6563
6564
  var _a;
6564
6565
  let returnValue;
@@ -6591,7 +6592,7 @@
6591
6592
  *
6592
6593
  * @category Decoding
6593
6594
  * @group Decoding
6594
- *
6595
+ * @deprecated
6595
6596
  * @example
6596
6597
  * import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'
6597
6598
  *
@@ -6605,6 +6606,7 @@
6605
6606
  * @returns The decoded data
6606
6607
  * @throws {Error} if the provided file cannot be parsed or does not contain a valid Gainmap
6607
6608
  */
6609
+ /* istanbul ignore next */
6608
6610
  const decodeJPEGMetadata = async (file) => {
6609
6611
  var _a, _b;
6610
6612
  const lib = await getLibrary();
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-Gkwpb-h5.js';
6
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-A76t2eR6.js';
7
7
 
8
8
  var lib$1;
9
9
  var hasRequiredLib$1;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  (function (global, factory) {
package/dist/worker.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers-Gkwpb-h5.js';
7
- import { c as compress } from './compress-6L6-d1aM.js';
6
+ import { g as getDefaultExportFromCjs } from './_commonjsHelpers-A76t2eR6.js';
7
+ import { c as compress } from './compress-_yA6snVA.js';
8
8
 
9
9
  var isPromise$2 = {exports: {}};
10
10
 
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.0.1
3
- * With ❤️, by MONOGRID <hello@mono-grid.com>
2
+ * @monogrid/gainmap-js v3.0.2
3
+ * With ❤️, by MONOGRID <rnd@monogrid.com>
4
4
  */
5
5
 
6
6
  (function (factory) {
@@ -124,17 +124,24 @@
124
124
  * @returns
125
125
  */
126
126
  const canvasToBlob = async (canvas, mimeType, quality) => {
127
- if (canvas instanceof OffscreenCanvas) {
127
+ if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
128
128
  return canvas.convertToBlob({ type: mimeType, quality: quality || 0.9 });
129
129
  }
130
- return new Promise((resolve, reject) => {
131
- canvas.toBlob((res) => {
132
- if (res)
133
- resolve(res);
134
- else
135
- reject(new Error('Failed to convert canvas to blob'));
136
- }, mimeType, quality || 0.9);
137
- });
130
+ else if (canvas instanceof HTMLCanvasElement) {
131
+ return new Promise((resolve, reject) => {
132
+ canvas.toBlob((res) => {
133
+ if (res)
134
+ resolve(res);
135
+ else
136
+ reject(new Error('Failed to convert canvas to blob'));
137
+ }, mimeType, quality || 0.9);
138
+ });
139
+ }
140
+ /* istanbul ignore next
141
+ as long as this function is not exported this is only here
142
+ to satisfy TS strict mode internally
143
+ */
144
+ throw new Error('Unsupported canvas element');
138
145
  };
139
146
  /**
140
147
  * Converts a RAW RGBA image buffer into the provided `mimeType` using the provided `quality`
@@ -170,6 +177,8 @@
170
177
  }
171
178
  else {
172
179
  canvas = document.createElement('canvas');
180
+ canvas.width = width;
181
+ canvas.height = height;
173
182
  }
174
183
  const ctx = canvas.getContext('2d');
175
184
  if (!ctx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monogrid/gainmap-js",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "A Javascript (TypeScript) Port of Adobe Gainmap Technology for storing HDR Images using an SDR Image + a gain map",
5
5
  "homepage": "https://github.com/MONOGRID/gainmap-js#readme",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  "three",
15
15
  "threejs"
16
16
  ],
17
- "author": "MONOGRID <hello@mono-grid.com>",
17
+ "author": "MONOGRID <rnd@monogrid.com>",
18
18
  "license": "MIT",
19
19
  "bugs": {
20
20
  "url": "https://github.com/MONOGRID/gainmap-js/issues"
@@ -78,9 +78,8 @@
78
78
  "build": "rollup -c",
79
79
  "dev": "concurrently -n rollup,servez -c magenta,green \"rollup -c -w\" \"servez\"",
80
80
  "start": "concurrently -n rollup,servez -c magenta,green \"rollup -c -w\" \"servez\"",
81
- "test": "playwright test",
81
+ "test": "nyc --reporter=text --reporter=lcov playwright test",
82
82
  "test:startserver": "rollup -c && servez",
83
- "test:report-coverage": "nyc report --reporter=text --reporter=cobertura --reporter=html --reporter=json-summary",
84
83
  "test:docker": "docker run --rm --network host -v $(pwd):/work -w /work -it -u $(id -u ${USER}):$(id -g ${USER}) mcr.microsoft.com/playwright:v1.40.0-jammy /bin/bash",
85
84
  "test:codegen": "playwright codegen http://localhost:8080",
86
85
  "prepack": "npm run build",
@@ -119,13 +118,13 @@
119
118
  "@semantic-release/npm": "^11.0.1",
120
119
  "@semantic-release/release-notes-generator": "^12.1.0",
121
120
  "@types/node": "^20.9.0",
122
- "@types/three": "^0.158.2",
121
+ "@types/three": "^0.160.0",
123
122
  "@typescript-eslint/eslint-plugin": "^6.13.1",
124
123
  "@typescript-eslint/parser": "^6.13.1",
125
124
  "concurrently": "^8.2.2",
126
125
  "conventional-changelog-conventionalcommits": "^7.0.2",
127
126
  "cz-conventional-changelog": "^3.3.0",
128
- "eslint": "^8.54.0",
127
+ "eslint": "^8.55.0",
129
128
  "eslint-config-mdcs": "^5.0.0",
130
129
  "eslint-config-standard": "^17.0.0",
131
130
  "eslint-plugin-compat": "^4.2.0",
@@ -133,7 +132,6 @@
133
132
  "eslint-plugin-import": "^2.29.0",
134
133
  "eslint-plugin-n": "^16.3.1",
135
134
  "eslint-plugin-promise": "^6.0.0",
136
- "eslint-plugin-quasar": "^1.1.0",
137
135
  "eslint-plugin-simple-import-sort": "^10.0.0",
138
136
  "eslint-plugin-unused-imports": "^3.0.0",
139
137
  "nyc": "^15.1.0",
@@ -145,7 +143,7 @@
145
143
  "semantic-release": "^22.0.8",
146
144
  "servez": "^2.1.2",
147
145
  "sharp": "^0.33.0",
148
- "three": "^0.159.0",
146
+ "three": "^0.160.1",
149
147
  "typedoc": "^0.25.4",
150
148
  "typedoc-github-wiki-theme": "^1.1.0",
151
149
  "typedoc-plugin-markdown": "^3.17.1",