Upgrade outdated dependencies

This commit is contained in:
Jamie Kyle 2024-11-18 11:20:23 -08:00 committed by GitHub
parent e4aa4de5e1
commit 8fde907b17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 2047 additions and 3751 deletions

View file

@ -1,16 +1,26 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { encode } from 'blurhash';
import { encode83 } from 'blurhash/dist/base83';
/* eslint-disable no-bitwise */
export function generateBlurHash(argb = 4294704123): string {
const R = 0xff & (argb >> 16);
const G = 0xff & (argb >> 8);
const B = 0xff & (argb >> 0);
const value = (R << 16) + (G << 8) + B;
return `00${encode83(value, 4)}`;
/**
* This generates a blurhash for a single pixel of a given color.
*
* The color is specified as an ARGB value, where the alpha channel is ignored.
*/
export function generateBlurHash(argb: number = 0xff_fbfbfb): string {
return encode(
new Uint8ClampedArray([
/* eslint-disable no-bitwise */
// Flipping from argb to rgba
0xff & (argb >> 16), // R
0xff & (argb >> 8), // G
0xff & (argb >> 0), // B
0xff, // A (ignored)
/* eslint-enable no-bitwise */
]),
1, // width (data is just one pixel)
1, // height (data is just one pixel)
1, // x components (just the average color)
1 // y components (just the average color)
);
}
/* eslint-enable no-bitwise */