New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tldraw/utils

Package Overview
Dependencies
Maintainers
0
Versions
2327
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tldraw/utils - npm Package Compare versions

Comparing version 3.9.0-internal.7f0e15f4f7d9 to 3.9.0

30

CHANGELOG.md

@@ -0,1 +1,31 @@

# v3.9.0 (Mon Mar 03 2025)
### Release Notes
#### getImageSize: Fix inaccurate PNG image width height calculation by using exact pixels per meter value ([#5509](https://github.com/tldraw/tldraw/pull/5509))
- Fixed a bug with `getImageSize` using inaccurate pixels per meter value which leads to discrepancies in calculating width and height in pixels for PNG images.
---
#### 🐛 Bug Fix
- Update discord links [#5500](https://github.com/tldraw/tldraw/pull/5500) ([@SomeHats](https://github.com/SomeHats) [@huppy-bot[bot]](https://github.com/huppy-bot[bot]) [@steveruizok](https://github.com/steveruizok) [@TodePond](https://github.com/TodePond))
- switch to pg-logical-replication [#5433](https://github.com/tldraw/tldraw/pull/5433) ([@ds300](https://github.com/ds300))
#### 🐛 Bug Fixes
- getImageSize: Fix inaccurate PNG image width height calculation by using exact pixels per meter value [#5509](https://github.com/tldraw/tldraw/pull/5509) ([@xmliszt](https://github.com/xmliszt))
#### Authors: 6
- [@huppy-bot[bot]](https://github.com/huppy-bot[bot])
- alex ([@SomeHats](https://github.com/SomeHats))
- David Sheldrick ([@ds300](https://github.com/ds300))
- Li Yuxuan ([@xmliszt](https://github.com/xmliszt))
- Lu Wilson ([@TodePond](https://github.com/TodePond))
- Steve Ruiz ([@steveruizok](https://github.com/steveruizok))
---
# v3.8.0 (Wed Feb 12 2025)

@@ -2,0 +32,0 @@

10

dist-cjs/index.d.ts

@@ -102,12 +102,8 @@ import { default as throttle } from 'lodash.throttle';

/**
* @deprecated Use `urlToArrayBuffer` instead.
* @param dataURL - The file as a string.
*
* from https://stackoverflow.com/a/53817185
*/
static dataUrlToArrayBuffer(dataURL: string): Promise<ArrayBuffer>;
/**
* @param url - The url of the file.
*/
static urlToArrayBuffer(url: string): Promise<ArrayBuffer>;
static urlToBlob(url: string): Promise<Blob>;
static urlToDataUrl(url: string): Promise<string>;
/**
* Convert a file to a base64 encoded data url.

@@ -114,0 +110,0 @@ *

@@ -161,5 +161,5 @@ "use strict";

"@tldraw/utils",
"3.9.0-internal.7f0e15f4f7d9",
"3.9.0",
"cjs"
);
//# sourceMappingURL=index.js.map

@@ -27,3 +27,5 @@ "use strict";

/**
* @deprecated Use `urlToArrayBuffer` instead.
* @param dataURL - The file as a string.
*
* from https://stackoverflow.com/a/53817185
*/

@@ -36,18 +38,2 @@ static async dataUrlToArrayBuffer(dataURL) {

/**
* @param url - The url of the file.
*/
static async urlToArrayBuffer(url) {
const response = await (0, import_network.fetch)(url);
return await response.arrayBuffer();
}
static async urlToBlob(url) {
const response = await (0, import_network.fetch)(url);
return await response.blob();
}
static async urlToDataUrl(url) {
if (url.startsWith("data:")) return url;
const blob = await FileHelpers.urlToBlob(url);
return await FileHelpers.blobToDataUrl(blob);
}
/**
* Convert a file to a base64 encoded data url.

@@ -54,0 +40,0 @@ *

@@ -170,3 +170,4 @@ "use strict";

if (physData.unit === 0 && physData.ppux === physData.ppuy) {
const pixelRatio = Math.max(physData.ppux / 2834.5, 1);
const pixelsPerMeter = 72 / 0.0254;
const pixelRatio = Math.max(physData.ppux / pixelsPerMeter, 1);
return {

@@ -173,0 +174,0 @@ w: Math.round(image.naturalWidth / pixelRatio),

{
"name": "@tldraw/utils",
"description": "A tiny little drawing app (private utilities).",
"version": "3.9.0-internal.7f0e15f4f7d9",
"version": "3.9.0",
"author": {

@@ -6,0 +6,0 @@ "name": "tldraw Inc.",

@@ -23,2 +23,2 @@ ## @tldraw/utils

Have questions, comments or feedback? [Join our discord](https://discord.gg/rhsyWMUJxd) or [start a discussion](https://github.com/tldraw/tldraw/discussions/new). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev).
Have questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=social&utm_campaign=sociallink). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev).

@@ -10,3 +10,5 @@ import { fetch } from './network'

/**
* @deprecated Use `urlToArrayBuffer` instead.
* @param dataURL - The file as a string.
*
* from https://stackoverflow.com/a/53817185
*/

@@ -20,21 +22,2 @@ static async dataUrlToArrayBuffer(dataURL: string) {

/**
* @param url - The url of the file.
*/
static async urlToArrayBuffer(url: string) {
const response = await fetch(url)
return await response.arrayBuffer()
}
static async urlToBlob(url: string) {
const response = await fetch(url)
return await response.blob()
}
static async urlToDataUrl(url: string) {
if (url.startsWith('data:')) return url
const blob = await FileHelpers.urlToBlob(url)
return await FileHelpers.blobToDataUrl(blob)
}
/**
* Convert a file to a base64 encoded data url.

@@ -41,0 +24,0 @@ *

@@ -166,3 +166,8 @@ import { promiseWithResolve } from '../control'

if (physData.unit === 0 && physData.ppux === physData.ppuy) {
const pixelRatio = Math.max(physData.ppux / 2834.5, 1)
// Calculate pixels per meter:
// - 1 inch = 0.0254 meters
// - 72 DPI is 72 dots per inch
// - pixels per meter = 72 / 0.0254
const pixelsPerMeter = 72 / 0.0254
const pixelRatio = Math.max(physData.ppux / pixelsPerMeter, 1)
return {

@@ -169,0 +174,0 @@ w: Math.round(image.naturalWidth / pixelRatio),

@@ -12,4 +12,2 @@ /** @internal */

/** @internal */
export function getOwnProperty<O extends object>(obj: O, key: string): O[keyof O] | undefined
/** @internal */
export function getOwnProperty(obj: object, key: string): unknown

@@ -16,0 +14,0 @@ /** @internal */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc