mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-30 05:23:05 +00:00
Merge branch 'main' of https://github.com/transloadit/uppy
This commit is contained in:
commit
fc27c005d9
8 changed files with 37 additions and 9 deletions
|
|
@ -444,7 +444,7 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts', '**/*.md/*.ts', '**/*.md/*.typescript'],
|
||||
files: ['**/*.ts', '**/*.md/*.ts', '**/*.md/*.typescript', '**/*.tsx', '**/*.md/*.tsx'],
|
||||
excludedFiles: ['examples/angular-example/**/*.ts', 'packages/@uppy/angular/**/*.ts'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
settings: {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
"start:companion": "bash bin/companion.sh",
|
||||
"start:companion:with-loadbalancer": "e2e/start-companion-with-load-balancer.mjs",
|
||||
"build:bundle": "yarn node ./bin/build-bundle.mjs",
|
||||
"build:clean": "git clean -e node_modules -xfd packages e2e .parcel-cache coverage",
|
||||
"build:clean": "git clean -e node_modules -Xfd packages e2e .parcel-cache coverage",
|
||||
"build:companion": "yarn workspace @uppy/companion build",
|
||||
"build:css": "yarn node ./bin/build-css.js",
|
||||
"build:svelte": "yarn workspace @uppy/svelte build",
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
"format": "prettier -w .",
|
||||
"release": "PACKAGES=$(yarn workspaces list --json) yarn workspace @uppy-dev/release interactive",
|
||||
"size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c",
|
||||
"e2e": "build:clean && yarn build && yarn e2e:skip-build",
|
||||
"e2e": "yarn build:clean && yarn build && yarn e2e:skip-build",
|
||||
"e2e:skip-build": "npm-run-all --parallel watch:js:lib e2e:client start:companion:with-loadbalancer e2e:cypress",
|
||||
"e2e:ci": "start-server-and-test 'npm-run-all --parallel e2e:client start:companion:with-loadbalancer' '1234|3020' e2e:headless",
|
||||
"e2e:client": "yarn workspace e2e client:start",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ import type { I18n, Locale } from '@uppy/utils/lib/Translator'
|
|||
import type { Body, Meta } from '@uppy/utils/lib/UppyFile'
|
||||
import type { Uppy } from '.'
|
||||
|
||||
export type PluginOpts = { locale?: Locale; [key: string]: unknown }
|
||||
export type PluginOpts = {
|
||||
locale?: Locale
|
||||
id?: string
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export default class BasePlugin<
|
||||
Opts extends PluginOpts,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ function debounce<T extends (...args: any[]) => any>(
|
|||
}
|
||||
}
|
||||
|
||||
export interface UIPluginOptions extends PluginOpts {
|
||||
replaceTargetContent?: boolean
|
||||
direction?: 'ltr' | 'rtl'
|
||||
}
|
||||
|
||||
/**
|
||||
* UIPlugin is the extended version of BasePlugin to incorporate rendering with Preact.
|
||||
* Use this for plugins that need a user interface.
|
||||
|
|
@ -39,7 +44,7 @@ function debounce<T extends (...args: any[]) => any>(
|
|||
* For plugins without an user interface, see BasePlugin.
|
||||
*/
|
||||
class UIPlugin<
|
||||
Opts extends PluginOpts & { direction?: 'ltr' | 'rtl' },
|
||||
Opts extends UIPluginOptions,
|
||||
M extends Meta,
|
||||
B extends Body,
|
||||
> extends BasePlugin<Opts, M, B> {
|
||||
|
|
@ -51,6 +56,8 @@ class UIPlugin<
|
|||
|
||||
parent: unknown
|
||||
|
||||
title: string
|
||||
|
||||
getTargetPlugin(target: unknown): UIPlugin<any, any, any> | undefined {
|
||||
let targetPlugin
|
||||
if (typeof target === 'object' && target instanceof UIPlugin) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export interface State<M extends Meta, B extends Body>
|
|||
}
|
||||
currentUploads: Record<string, CurrentUpload<M, B>>
|
||||
allowNewUpload: boolean
|
||||
recoveredState: null
|
||||
recoveredState: null | State<M, B>
|
||||
error: string | null
|
||||
files: {
|
||||
[key: string]: UppyFile<M, B>
|
||||
|
|
@ -251,6 +251,7 @@ export interface _UppyEventMap<M extends Meta, B extends Body> {
|
|||
progress: ProgressCallback
|
||||
'reset-progress': GenericEventCallback
|
||||
restored: GenericEventCallback
|
||||
'restore-confirmed': GenericEventCallback
|
||||
'restriction-failed': RestrictionFailedCallback<M, B>
|
||||
'resume-all': GenericEventCallback
|
||||
'retry-all': RetryAllCallback
|
||||
|
|
|
|||
|
|
@ -3,3 +3,5 @@ export { default as Uppy } from './Uppy.ts'
|
|||
export { default as UIPlugin } from './UIPlugin.ts'
|
||||
export { default as BasePlugin } from './BasePlugin.ts'
|
||||
export { debugLogger } from './loggers.ts'
|
||||
|
||||
export type { UIPluginOptions } from './UIPlugin.ts'
|
||||
|
|
|
|||
|
|
@ -1,10 +1,24 @@
|
|||
export interface DeterminateFileProcessing {
|
||||
mode: 'determinate'
|
||||
message: string
|
||||
value: number
|
||||
}
|
||||
export interface IndeterminateFileProcessing {
|
||||
mode: 'indeterminate'
|
||||
message?: undefined
|
||||
value?: 0
|
||||
}
|
||||
export type FileProcessingInfo =
|
||||
| IndeterminateFileProcessing
|
||||
| DeterminateFileProcessing
|
||||
|
||||
interface FileProgressBase {
|
||||
progress?: number
|
||||
uploadComplete: boolean
|
||||
percentage: number
|
||||
bytesTotal: number
|
||||
preprocess?: { mode: string; message?: string; value?: number }
|
||||
postprocess?: { mode: string; message?: string; value?: number }
|
||||
preprocess?: FileProcessingInfo
|
||||
postprocess?: FileProcessingInfo
|
||||
}
|
||||
|
||||
// FileProgress is either started or not started. We want to make sure TS doesn't
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const config = {
|
|||
replacement: `${PACKAGES_ROOT}@uppy/$1/src/index`,
|
||||
},
|
||||
{
|
||||
find: /^@uppy\/([^/]+)\/lib\/(.+)$/,
|
||||
find: /^@uppy\/([^/]+)\/lib\/(.+?)(\.js)?$/,
|
||||
replacement: `${PACKAGES_ROOT}@uppy/$1/src/$2`,
|
||||
},
|
||||
// {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue