@thi.ng/blurhash 0.1.0 → 0.1.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,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-01-26T18:03:04Z
3
+ - **Last updated**: 2024-01-29T21:04:46Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -7,9 +7,13 @@
7
7
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/blurhash.svg)
8
8
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
9
9
 
10
- This is a standalone project, maintained as part of the
11
- [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and
12
- anti-framework.
10
+ > [!NOTE]
11
+ > This is one of 189 standalone projects, maintained as part
12
+ > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
13
+ > and anti-framework.
14
+ >
15
+ > 🚀 Help me to work full-time on these projects by [sponsoring me on
16
+ > GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
13
17
 
14
18
  - [About](#about)
15
19
  - [Status](#status)
@@ -0,0 +1,3 @@
1
+ export declare const __ensureDetail: (detailX: number, detailY: number) => void;
2
+ export declare const __ensureSize: (pixels: Uint32Array, width: number, height: number) => void;
3
+ //# sourceMappingURL=ensure.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { assert } from "@thi.ng/errors/assert";
2
+ import { inRange } from "@thi.ng/math/interval";
3
+ const __ensureDetail = (detailX, detailY) => assert(
4
+ inRange(detailX, 1, 9) && inRange(detailY, 1, 9),
5
+ "detail must be in [1,9] range"
6
+ );
7
+ const __ensureSize = (pixels, width, height) => assert(
8
+ width * height === pixels.length,
9
+ "width & height must match number of pixels"
10
+ );
11
+ export {
12
+ __ensureDetail,
13
+ __ensureSize
14
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Using simplified approximation only - precision not needed for this use case.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare const __toLinear: (x: number, shift?: number) => number;
7
+ /**
8
+ * Using simplified approximation only - precision not needed for this use case.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare const __fromLinear: (x: number, shift?: number) => number;
13
+ //# sourceMappingURL=linear.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { clamp01 } from "@thi.ng/math/interval";
2
+ const G = 1 / 2.2;
3
+ const __toLinear = (x, shift = 0) => ((x >> shift & 255) / 255) ** 2.2;
4
+ const __fromLinear = (x, shift = 0) => clamp01(x) ** G * 255 + 0.5 << shift;
5
+ export {
6
+ __fromLinear,
7
+ __toLinear
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/blurhash",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Fast, optimized TS implementation of the Wolt Blurhash algorithm",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,11 +35,11 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.18",
39
- "@thi.ng/base-n": "^2.6.0",
40
- "@thi.ng/canvas": "^0.2.0",
41
- "@thi.ng/errors": "^2.4.11",
42
- "@thi.ng/math": "^5.8.0"
38
+ "@thi.ng/api": "^8.9.20",
39
+ "@thi.ng/base-n": "^2.6.2",
40
+ "@thi.ng/canvas": "^0.2.2",
41
+ "@thi.ng/errors": "^2.4.13",
42
+ "@thi.ng/math": "^5.8.2"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-extractor": "^7.39.0",
@@ -73,7 +73,8 @@
73
73
  },
74
74
  "files": [
75
75
  "./*.js",
76
- "./*.d.ts"
76
+ "./*.d.ts",
77
+ "internal"
77
78
  ],
78
79
  "exports": {
79
80
  ".": {
@@ -90,5 +91,5 @@
90
91
  "status": "alpha",
91
92
  "year": 2023
92
93
  },
93
- "gitHead": "7426e2ae6fca5482c6eaf649872296fc89955374\n"
94
+ "gitHead": "3fa30b2dc2de762f24fd64b881b68d4da33d4c38\n"
94
95
  }