@uppy/utils
Advanced tools
Comparing version 5.7.4 to 5.7.5
# @uppy/utils | ||
## 5.7.5 | ||
Released: 2024-03-27 | ||
Included in: Uppy v3.24.0 | ||
- @uppy/utils: fix `RateLimitedQueue#wrapPromiseFunction` types (Antoine du Hamel / #5007) | ||
- @uppy/utils: fix `findAllDOMElements` type (Antoine du Hamel / #4997) | ||
- @uppy/utils: fix `AbortablePromise` type (Antoine du Hamel / #4988) | ||
- @uppy/utils: migrate RateLimitedQueue to TS (Merlijn Vos / #4981) | ||
## 5.7.4 | ||
@@ -4,0 +14,0 @@ |
import isDOMElement from "./isDOMElement.js"; | ||
/** | ||
* Find one or more DOM elements. | ||
*/ | ||
export default function findAllDOMElements(element) { | ||
function findAllDOMElements(element) { | ||
if (typeof element === 'string') { | ||
@@ -15,2 +14,3 @@ const elements = document.querySelectorAll(element); | ||
return null; | ||
} | ||
} | ||
export default findAllDOMElements; |
@@ -270,2 +270,5 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
const next = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].shift(); | ||
if (next == null) { | ||
throw new Error('Invariant violation: next is null'); | ||
} | ||
const handler = _classPrivateFieldLooseBase(this, _call)[_call](next.fn); | ||
@@ -276,8 +279,5 @@ next.abort = handler.abort; | ||
function _queue2(fn, options) { | ||
if (options === void 0) { | ||
options = {}; | ||
} | ||
const handler = { | ||
fn, | ||
priority: options.priority || 0, | ||
priority: (options == null ? void 0 : options.priority) || 0, | ||
abort: () => { | ||
@@ -284,0 +284,0 @@ _classPrivateFieldLooseBase(this, _dequeue)[_dequeue](handler); |
{ | ||
"name": "@uppy/utils", | ||
"description": "Shared utility functions for Uppy Core and plugins maintained by the Uppy team.", | ||
"version": "5.7.4", | ||
"version": "5.7.5", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "types": "types/index.d.ts", |
@@ -25,2 +25,12 @@ /** | ||
} | ||
custom?: { | ||
isSharedDrive: boolean | ||
imageHeight: number | ||
imageWidth: number | ||
imageRotation: number | ||
imageDateTime: string | ||
videoHeight: number | ||
videoWidth: number | ||
videoDurationMillis: number | ||
} | ||
} |
import isDOMElement from './isDOMElement.ts' | ||
function findAllDOMElements<T>( | ||
element: T, | ||
context?: ParentNode, | ||
): T extends Element ? [T] | ||
: T extends Node | string ? Element[] | null | ||
: null | ||
/** | ||
* Find one or more DOM elements. | ||
*/ | ||
export default function findAllDOMElements( | ||
element: string | Node, | ||
): Node[] | null { | ||
function findAllDOMElements(element: unknown): Node[] | null { | ||
if (typeof element === 'string') { | ||
@@ -20,1 +25,3 @@ const elements = document.querySelectorAll(element) | ||
} | ||
export default findAllDOMElements |
@@ -45,5 +45,7 @@ import type { FileProgress } from './FileProgress' | ||
// The user facing type for UppyFile used in uppy.addFile() and uppy.setOptions() | ||
/* | ||
* The user facing type for UppyFile used in uppy.addFile() and uppy.setOptions() | ||
*/ | ||
export type MinimalRequiredUppyFile<M extends Meta, B extends Body> = Required< | ||
Pick<UppyFile<M, B>, 'name' | 'data'> | ||
Pick<UppyFile<M, B>, 'name'> | ||
> & | ||
@@ -55,2 +57,41 @@ Partial< | ||
// that is not required. | ||
> & { meta?: M } | ||
> & { meta?: M; data: { size: number | null } } | ||
/* | ||
* We are not entirely sure what a "tag file" is. | ||
* It is used as an intermidiate type between `CompanionFile` and `UppyFile` | ||
* in `@uppy/provider-views` and `@uppy/url`. | ||
* TODO: remove this in favor of UppyFile | ||
*/ | ||
export type TagFile<M extends Meta> = { | ||
id?: string | ||
source: string | ||
name: string | ||
type: string | ||
isRemote: boolean | ||
preview?: string | ||
data: { | ||
size: number | null | ||
} | ||
body?: { | ||
url?: string | ||
fileId?: string | ||
} | ||
meta?: { | ||
authorName?: string | ||
authorUrl?: string | ||
relativePath?: string | null | ||
absolutePath?: string | ||
} & M | ||
remote: { | ||
companionUrl: string | ||
url: string | ||
body: { | ||
fileId: string | ||
url?: string | ||
} | ||
providerName?: string | ||
provider?: string | ||
requestClientId: string | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
322131
4412
1