mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
tools: enable linter for TypeScript (#2997)
* tools: enable linter for TypeScript files and code snippets * types: remove remaning namespaces * tools: remove unused Babel decorator plugin
This commit is contained in:
parent
ce58c057df
commit
5630f7dc07
113 changed files with 3549 additions and 6656 deletions
36
.eslintrc.js
36
.eslintrc.js
|
|
@ -9,6 +9,7 @@ const svgPresentationAttributes = [
|
|||
]
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['transloadit'],
|
||||
env: {
|
||||
es6: true,
|
||||
|
|
@ -133,6 +134,7 @@ module.exports = {
|
|||
packages: path.resolve(__dirname, 'packages'),
|
||||
},
|
||||
},
|
||||
'import/core-modules': ['tsd'],
|
||||
react: {
|
||||
pragma: 'h',
|
||||
},
|
||||
|
|
@ -224,12 +226,7 @@ module.exports = {
|
|||
sourceType: 'module',
|
||||
},
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': ['off'],
|
||||
'import/no-unresolved': ['off'],
|
||||
'react/destructuring-assignment': ['off'],
|
||||
'no-console': ['off'],
|
||||
'no-undef': ['off'],
|
||||
'no-unused-vars': ['off'],
|
||||
'react/destructuring-assignment': 'off',
|
||||
'no-restricted-globals': [
|
||||
'error',
|
||||
{
|
||||
|
|
@ -255,6 +252,33 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts', '**/*.md/*.ts', '**/*.md/*.typescript'],
|
||||
excludedFiles: ['examples/angular-example/**/*.ts', 'packages/@uppy/angular/**/*.ts'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
rules: {
|
||||
'import/prefer-default-export': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.md/*.*'],
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
'import/no-unresolved': 'off',
|
||||
'no-console': 'off',
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/react/*.md/*.js', '**/react.md/*.js', '**/react-*.md/*.js'],
|
||||
settings: {
|
||||
|
|
|
|||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
run: npm run test:unit
|
||||
|
||||
lint_js:
|
||||
name: Lint JavaScript
|
||||
name: Lint JavaScript/TypeScript
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
|||
68
examples/angular-example/.eslintrc.json
Normal file
68
examples/angular-example/.eslintrc.json
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"ignorePatterns": [
|
||||
"projects/**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"examples/angular-example/tsconfig.json",
|
||||
"examples/angular-example/e2e/tsconfig.json"
|
||||
],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@angular-eslint/ng-cli-compat",
|
||||
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
],
|
||||
"rules": {
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": "app",
|
||||
"style": "kebab-case"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "app",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"dot-notation": "error",
|
||||
"import/no-unresolved": "off",
|
||||
"import/prefer-default-export": "off",
|
||||
"indent": "error",
|
||||
"no-empty-function": "off",
|
||||
"no-shadow": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-use-before-define": "off",
|
||||
"quotes": "error",
|
||||
"semi": ["error", "never"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["e2e/**/*.ts"],
|
||||
"rules": {
|
||||
"import/no-extraneous-dependencies": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"star.html"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:@angular-eslint/template/recommended"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -105,15 +105,11 @@
|
|||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"builder": "@angular-eslint/builder:lint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"tsconfig.app.json",
|
||||
"tsconfig.spec.json",
|
||||
"e2e/tsconfig.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
"lintFilePatterns": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.html"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -132,5 +128,8 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "angular-example"
|
||||
"defaultProject": "angular-example",
|
||||
"cli": {
|
||||
"defaultCollection": "@angular-eslint/schematics"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
import { browser, logging } from 'protractor';
|
||||
import { AppPage } from './app.po';
|
||||
/* global jasmine */
|
||||
import { browser, logging } from 'protractor'
|
||||
import { AppPage } from './app.po'
|
||||
|
||||
describe('workspace-project App', () => {
|
||||
let page: AppPage;
|
||||
let page: AppPage
|
||||
|
||||
beforeEach(() => {
|
||||
page = new AppPage();
|
||||
});
|
||||
page = new AppPage()
|
||||
})
|
||||
|
||||
it('should display welcome message', async () => {
|
||||
await page.navigateTo();
|
||||
expect(await page.getTitleText()).toEqual('angular-example app is running!');
|
||||
});
|
||||
await page.navigateTo()
|
||||
expect(await page.getTitleText()).toEqual('angular-example app is running!')
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
// Assert that there are no errors emitted from the browser
|
||||
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
|
||||
const logs = await browser.manage().logs().get(logging.Type.BROWSER)
|
||||
expect(logs).not.toContain(jasmine.objectContaining({
|
||||
level: logging.Level.SEVERE,
|
||||
} as logging.Entry));
|
||||
});
|
||||
});
|
||||
} as logging.Entry))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import { browser, by, element } from 'protractor';
|
||||
/* eslint-disable class-methods-use-this */
|
||||
import { browser, by, element } from 'protractor'
|
||||
|
||||
export class AppPage {
|
||||
async navigateTo(): Promise<unknown> {
|
||||
return browser.get(browser.baseUrl);
|
||||
return browser.get(browser.baseUrl)
|
||||
}
|
||||
|
||||
async getTitleText(): Promise<string> {
|
||||
return element(by.css('app-root .content span')).getText();
|
||||
return element(by.css('app-root .content span')).getText()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
"@angular/router": "~12.1.0",
|
||||
"@uppy/angular": "file:../../packages/@uppy/angular",
|
||||
"@uppy/core": "file:../../packages/@uppy/core",
|
||||
"@uppy/google-drive": "file:../../packages/@uppy/google-drive",
|
||||
"@uppy/drag-drop": "file:../../packages/@uppy/drag-drop",
|
||||
"@uppy/google-drive": "file:../../packages/@uppy/google-drive",
|
||||
"@uppy/progress-bar": "file:../../packages/@uppy/progress-bar",
|
||||
"@uppy/tus": "file:../../packages/@uppy/tus",
|
||||
"@uppy/webcam": "file:../../packages/@uppy/webcam",
|
||||
|
|
@ -31,11 +31,21 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~12.1.0",
|
||||
"@angular-eslint/builder": "12.2.0",
|
||||
"@angular-eslint/eslint-plugin": "12.2.0",
|
||||
"@angular-eslint/eslint-plugin-template": "12.2.0",
|
||||
"@angular-eslint/schematics": "12.2.0",
|
||||
"@angular-eslint/template-parser": "12.2.0",
|
||||
"@angular/cli": "~12.1.0",
|
||||
"@angular/compiler-cli": "~12.1.0",
|
||||
"@types/jasmine": "~3.6.0",
|
||||
"@types/node": "^12.11.1",
|
||||
"codelyzer": "^6.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
||||
"@typescript-eslint/parser": "^4.28.2",
|
||||
"eslint": "^7.22.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jsdoc": "^35.4.1",
|
||||
"eslint-plugin-prefer-arrow": "latest",
|
||||
"jasmine-core": "~3.6.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
"karma": "~6.1.0",
|
||||
|
|
@ -45,7 +55,6 @@
|
|||
"karma-jasmine-html-reporter": "^1.5.0",
|
||||
"protractor": "~7.0.0",
|
||||
"ts-node": "~8.3.0",
|
||||
"tslint": "~6.1.0",
|
||||
"typescript": "~4.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { AppComponent } from './app.component'
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
AppComponent,
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
}).compileComponents()
|
||||
})
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
const fixture = TestBed.createComponent(AppComponent)
|
||||
const app = fixture.componentInstance
|
||||
expect(app).toBeTruthy()
|
||||
})
|
||||
|
||||
it(`should have as title 'angular-example'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('angular-example');
|
||||
});
|
||||
const fixture = TestBed.createComponent(AppComponent)
|
||||
const app = fixture.componentInstance
|
||||
expect(app.title).toEqual('angular-example')
|
||||
})
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement;
|
||||
expect(compiled.querySelector('.content span').textContent).toContain('angular-example app is running!');
|
||||
});
|
||||
});
|
||||
const fixture = TestBed.createComponent(AppComponent)
|
||||
fixture.detectChanges()
|
||||
const compiled = fixture.nativeElement
|
||||
expect(compiled.querySelector('.content span').textContent).toContain('angular-example app is running!')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { Uppy } from '@uppy/core'
|
||||
import Webcam from '@uppy/webcam'
|
||||
import Tus from '@uppy/tus'
|
||||
|
|
@ -6,17 +6,17 @@ import GoogleDrive from '@uppy/google-drive'
|
|||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
template: /*html*/`
|
||||
template: /* html */`
|
||||
<h1>Uppy Angular Example!</h1>
|
||||
<h2>Inline dashboard</h2>
|
||||
<label>
|
||||
<input
|
||||
<input
|
||||
type="checkbox"
|
||||
(change)="showInline = $event.target.checked"
|
||||
[checked]="showInline"
|
||||
/>
|
||||
Show Dashboard
|
||||
</label>
|
||||
Show Dashboard
|
||||
</label>
|
||||
|
||||
<uppy-dashboard [uppy]='uppy' [props]='dashboardProps' *ngIf="showInline"></uppy-dashboard>
|
||||
|
||||
|
|
@ -42,24 +42,27 @@ import GoogleDrive from '@uppy/google-drive'
|
|||
'../../../../packages/@uppy/drag-drop/dist/style.min.css',
|
||||
'../../../../packages/@uppy/progress-bar/dist/style.min.css',
|
||||
'../../../../packages/@uppy/dashboard/dist/style.min.css',
|
||||
]
|
||||
],
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'angular-example';
|
||||
export class AppComponent implements OnInit {
|
||||
title = 'angular-example'
|
||||
|
||||
showInline = false
|
||||
|
||||
showModal = false
|
||||
|
||||
dashboardProps = {
|
||||
plugins: ['Webcam']
|
||||
plugins: ['Webcam'],
|
||||
}
|
||||
|
||||
dashboardModalProps = {
|
||||
target: document.body,
|
||||
onRequestCloseModal: () => this.showModal = false
|
||||
onRequestCloseModal: (): void => { this.showModal = false },
|
||||
}
|
||||
|
||||
|
||||
uppy: Uppy = new Uppy({ debug: true, autoProceed: true })
|
||||
ngOnInit() {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.uppy
|
||||
.use(Webcam)
|
||||
.use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })
|
||||
|
|
|
|||
|
|
@ -1,25 +1,28 @@
|
|||
import { NgModule } from '@angular/core'
|
||||
import { BrowserModule } from '@angular/platform-browser'
|
||||
|
||||
import {
|
||||
UppyAngularDashboardModule,
|
||||
UppyAngularStatusBarModule,
|
||||
UppyAngularDragDropModule,
|
||||
UppyAngularProgressBarModule,
|
||||
UppyAngularDashboardModalModule
|
||||
} from '@uppy/angular'
|
||||
import { AppComponent } from './app.component'
|
||||
|
||||
import { UppyAngularDashboardModule, UppyAngularStatusBarModule, UppyAngularDragDropModule, UppyAngularProgressBarModule, UppyAngularDashboardModalModule } from '@uppy/angular'
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
declarations: [AppComponent],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
UppyAngularDashboardModule,
|
||||
UppyAngularStatusBarModule,
|
||||
UppyAngularDashboardModalModule,
|
||||
UppyAngularDragDropModule,
|
||||
UppyAngularProgressBarModule
|
||||
UppyAngularProgressBarModule,
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
class AppModule { }
|
||||
class AppModule {}
|
||||
|
||||
export { AppModule }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
production: true,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
production: false,
|
||||
}
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { enableProdMode } from '@angular/core'
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
import { AppModule } from './app/app.module'
|
||||
import { environment } from './environments/environment'
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
enableProdMode()
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
.catch(err => console.error(err))
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
/** *************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
|
|
@ -54,12 +54,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
/** *************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
import 'zone.js/dist/zone' // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
/** *************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import 'zone.js/dist/zone-testing'
|
||||
import { getTestBed } from '@angular/core/testing'
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing'
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
keys(): string[];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
)
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
const context = require.context('./', true, /\.spec\.ts$/)
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
context.keys().map(context)
|
||||
|
|
|
|||
|
|
@ -1,152 +0,0 @@
|
|||
{
|
||||
"extends": "tslint:recommended",
|
||||
"rulesDirectory": [
|
||||
"codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"align": {
|
||||
"options": [
|
||||
"parameters",
|
||||
"statements"
|
||||
]
|
||||
},
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": true,
|
||||
"curly": true,
|
||||
"deprecation": {
|
||||
"severity": "warning"
|
||||
},
|
||||
"eofline": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": {
|
||||
"options": [
|
||||
"spaces"
|
||||
]
|
||||
},
|
||||
"max-classes-per-file": false,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-empty": false,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-non-null-assertion": true,
|
||||
"no-redundant-jsdoc": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-var-requires": false,
|
||||
"object-literal-key-quotes": [
|
||||
true,
|
||||
"as-needed"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"semicolon": {
|
||||
"options": [
|
||||
"always"
|
||||
]
|
||||
},
|
||||
"space-before-function-paren": {
|
||||
"options": {
|
||||
"anonymous": "never",
|
||||
"asyncArrow": "always",
|
||||
"constructor": "never",
|
||||
"method": "never",
|
||||
"named": "never"
|
||||
}
|
||||
},
|
||||
"typedef": [
|
||||
true,
|
||||
"call-signature"
|
||||
],
|
||||
"typedef-whitespace": {
|
||||
"options": [
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
},
|
||||
{
|
||||
"call-signature": "onespace",
|
||||
"index-signature": "onespace",
|
||||
"parameter": "onespace",
|
||||
"property-declaration": "onespace",
|
||||
"variable-declaration": "onespace"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable-name": {
|
||||
"options": [
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-pascal-case"
|
||||
]
|
||||
},
|
||||
"whitespace": {
|
||||
"options": [
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-typecast"
|
||||
]
|
||||
},
|
||||
"component-class-suffix": true,
|
||||
"contextual-lifecycle": true,
|
||||
"directive-class-suffix": true,
|
||||
"no-conflicting-lifecycle": true,
|
||||
"no-host-metadata-property": true,
|
||||
"no-input-rename": true,
|
||||
"no-inputs-metadata-property": true,
|
||||
"no-output-native": true,
|
||||
"no-output-on-prefix": true,
|
||||
"no-output-rename": true,
|
||||
"no-outputs-metadata-property": true,
|
||||
"template-banana-in-box": true,
|
||||
"template-no-negated-async": true,
|
||||
"use-lifecycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"app",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import App from './App.svelte';
|
||||
import App from './App.svelte'
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
||||
});
|
||||
target: document.body,
|
||||
})
|
||||
|
||||
export default app;
|
||||
export default app
|
||||
|
|
|
|||
8334
package-lock.json
generated
8334
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,8 @@
|
|||
"*.md": [
|
||||
"remark -f -q -i .gitignore",
|
||||
"eslint --fix"
|
||||
]
|
||||
],
|
||||
"*.ts": "eslint --fix"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
|
|
@ -46,6 +47,8 @@
|
|||
"@goto-bus-stop/envify": "^5.0.0",
|
||||
"@jamen/lorem": "^0.2.0",
|
||||
"@size-limit/preset-big-lib": "4.5.6",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
||||
"@typescript-eslint/parser": "^4.28.2",
|
||||
"@wdio/cli": "^5.18.6",
|
||||
"@wdio/local-runner": "^5.18.6",
|
||||
"@wdio/mocha-framework": "^5.18.6",
|
||||
|
|
|
|||
45
packages/@uppy/angular/.eslintrc.json
Normal file
45
packages/@uppy/angular/.eslintrc.json
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"ignorePatterns": [
|
||||
"projects/**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"packages/@uppy/angular/tsconfig.json"
|
||||
],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@angular-eslint/ng-cli-compat",
|
||||
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"dot-notation": "error",
|
||||
"import/no-unresolved": "off",
|
||||
"import/prefer-default-export": "off",
|
||||
"indent": "error",
|
||||
"no-empty-function": "off",
|
||||
"no-shadow": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-use-before-define": "off",
|
||||
"quotes": "error",
|
||||
"semi": ["error", "never"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.html"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:@angular-eslint/template/recommended"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ Uppy is being developed by the folks at [Transloadit](https://transloadit.com),
|
|||
## Example
|
||||
|
||||
```ts
|
||||
// TODO
|
||||
// TODO
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
|
|
|||
|
|
@ -30,18 +30,19 @@
|
|||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"builder": "@angular-eslint/builder:lint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"projects/angular/tsconfig.lib.json",
|
||||
"projects/angular/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
"lintFilePatterns": [
|
||||
"projects/angular/**/*.ts",
|
||||
"projects/angular/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}},
|
||||
"defaultProject": "angular"
|
||||
}
|
||||
},
|
||||
"defaultProject": "angular",
|
||||
"cli": {
|
||||
"defaultCollection": "@angular-eslint/schematics"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~12.1.0",
|
||||
"@angular-eslint/builder": "12.2.0",
|
||||
"@angular-eslint/eslint-plugin": "12.2.0",
|
||||
"@angular-eslint/eslint-plugin-template": "12.2.0",
|
||||
"@angular-eslint/schematics": "12.2.0",
|
||||
"@angular-eslint/template-parser": "12.2.0",
|
||||
"@angular/cli": "~12.1.0",
|
||||
"@angular/compiler-cli": "~12.1.0",
|
||||
"@babel/core": "^7.10.5",
|
||||
|
|
@ -48,8 +53,13 @@
|
|||
"@types/jasmine": "~3.6.0",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "^12.11.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
||||
"@typescript-eslint/parser": "^4.28.2",
|
||||
"babel-loader": "^8.1.0",
|
||||
"codelyzer": "^6.0.0",
|
||||
"eslint": "^7.22.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jsdoc": "^35.4.1",
|
||||
"eslint-plugin-prefer-arrow": "latest",
|
||||
"jasmine-core": "~3.6.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
"karma": "~6.1.0",
|
||||
|
|
@ -61,7 +71,6 @@
|
|||
"protractor": "~7.0.0",
|
||||
"redux": "^4.0.5",
|
||||
"ts-node": "~8.3.0",
|
||||
"tslint": "~6.1.0",
|
||||
"typescript": "~4.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
|
|
|||
52
packages/@uppy/angular/projects/angular/.eslintrc.json
Normal file
52
packages/@uppy/angular/projects/angular/.eslintrc.json
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"extends": "../../.eslintrc.json",
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"packages/@uppy/angular/projects/angular/tsconfig.lib.json",
|
||||
"packages/@uppy/angular/projects/angular/tsconfig.spec.json"
|
||||
],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"rules": {
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": "uppy",
|
||||
"style": "kebab-case"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "uppy",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"dot-notation": "error",
|
||||
"indent": "error",
|
||||
"no-empty-function": "off",
|
||||
"no-shadow": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-use-before-define": "off",
|
||||
"quotes": "error",
|
||||
"semi": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.html"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
* Public API Surface of @uppy/angular
|
||||
*/
|
||||
|
||||
export { UppyAngularDashboardModule } from './lib/components/dashboard/dashboard.module';
|
||||
export { UppyAngularDashboardModalModule } from './lib/components/dashboard-modal/dashboard-modal.module';
|
||||
export { UppyAngularProgressBarModule } from './lib/components/progress-bar/progress-bar.module';
|
||||
export { UppyAngularStatusBarModule } from './lib/components/status-bar/status-bar.module';
|
||||
export { UppyAngularDragDropModule } from './lib/components/drag-drop/drag-drop.module';
|
||||
export { StatusBarComponent } from './lib/components/status-bar/status-bar.component';
|
||||
export { ProgressBarComponent } from './lib/components/progress-bar/progress-bar.component';
|
||||
export { DragDropComponent } from './lib/components/drag-drop/drag-drop.component';
|
||||
export { DashboardComponent } from './lib/components/dashboard/dashboard.component';
|
||||
export { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component';
|
||||
export { UppyAngularDashboardModule } from './lib/components/dashboard/dashboard.module'
|
||||
export { UppyAngularDashboardModalModule } from './lib/components/dashboard-modal/dashboard-modal.module'
|
||||
export { UppyAngularProgressBarModule } from './lib/components/progress-bar/progress-bar.module'
|
||||
export { UppyAngularStatusBarModule } from './lib/components/status-bar/status-bar.module'
|
||||
export { UppyAngularDragDropModule } from './lib/components/drag-drop/drag-drop.module'
|
||||
export { StatusBarComponent } from './lib/components/status-bar/status-bar.component'
|
||||
export { ProgressBarComponent } from './lib/components/progress-bar/progress-bar.component'
|
||||
export { DragDropComponent } from './lib/components/drag-drop/drag-drop.component'
|
||||
export { DashboardComponent } from './lib/components/dashboard/dashboard.component'
|
||||
export { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component'
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import 'zone.js/dist/zone'
|
||||
import 'zone.js/dist/zone-testing'
|
||||
import { getTestBed } from '@angular/core/testing'
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing'
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
)
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
const context = require.context('./', true, /\.spec\.ts$/)
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
context.keys().map(context)
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"uppy",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"uppy",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -11,15 +11,9 @@
|
|||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["es2018", "dom"],
|
||||
"paths": {
|
||||
"angular": [
|
||||
"dist/angular/angular",
|
||||
"dist/angular"
|
||||
]
|
||||
"angular": ["dist/angular/angular", "dist/angular"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,140 +0,0 @@
|
|||
{
|
||||
"extends": "tslint:recommended",
|
||||
"rulesDirectory": [
|
||||
"codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"align": {
|
||||
"options": [
|
||||
"parameters",
|
||||
"statements"
|
||||
]
|
||||
},
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": true,
|
||||
"curly": true,
|
||||
"deprecation": {
|
||||
"severity": "warning"
|
||||
},
|
||||
"eofline": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": {
|
||||
"options": [
|
||||
"spaces"
|
||||
]
|
||||
},
|
||||
"max-classes-per-file": false,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-empty": false,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-non-null-assertion": true,
|
||||
"no-redundant-jsdoc": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-var-requires": false,
|
||||
"object-literal-key-quotes": [
|
||||
true,
|
||||
"as-needed"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"semicolon": {
|
||||
"options": [
|
||||
"always"
|
||||
]
|
||||
},
|
||||
"space-before-function-paren": {
|
||||
"options": {
|
||||
"anonymous": "never",
|
||||
"asyncArrow": "always",
|
||||
"constructor": "never",
|
||||
"method": "never",
|
||||
"named": "never"
|
||||
}
|
||||
},
|
||||
"typedef": [
|
||||
true,
|
||||
"call-signature"
|
||||
],
|
||||
"typedef-whitespace": {
|
||||
"options": [
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
},
|
||||
{
|
||||
"call-signature": "onespace",
|
||||
"index-signature": "onespace",
|
||||
"parameter": "onespace",
|
||||
"property-declaration": "onespace",
|
||||
"variable-declaration": "onespace"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable-name": {
|
||||
"options": [
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-pascal-case"
|
||||
]
|
||||
},
|
||||
"whitespace": {
|
||||
"options": [
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-typecast"
|
||||
]
|
||||
},
|
||||
"component-class-suffix": true,
|
||||
"contextual-lifecycle": true,
|
||||
"directive-class-suffix": true,
|
||||
"no-conflicting-lifecycle": true,
|
||||
"no-host-metadata-property": true,
|
||||
"no-input-rename": true,
|
||||
"no-inputs-metadata-property": true,
|
||||
"no-output-native": true,
|
||||
"no-output-on-prefix": true,
|
||||
"no-output-rename": true,
|
||||
"no-outputs-metadata-property": true,
|
||||
"template-banana-in-box": true,
|
||||
"template-no-negated-async": true,
|
||||
"use-lifecycle-interface": true,
|
||||
"use-pipe-transform-interface": true
|
||||
}
|
||||
}
|
||||
16
packages/@uppy/aws-s3-multipart/types/index.d.ts
vendored
16
packages/@uppy/aws-s3-multipart/types/index.d.ts
vendored
|
|
@ -2,14 +2,13 @@ import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core'
|
|||
|
||||
type MaybePromise<T> = T | Promise<T>
|
||||
|
||||
declare module AwsS3Multipart {
|
||||
interface AwsS3Part {
|
||||
PartNumber?: number
|
||||
Size?: number
|
||||
ETag?: string
|
||||
}
|
||||
export interface AwsS3Part {
|
||||
PartNumber?: number
|
||||
Size?: number
|
||||
ETag?: string
|
||||
}
|
||||
|
||||
interface AwsS3MultipartOptions extends PluginOptions {
|
||||
interface AwsS3MultipartOptions extends PluginOptions {
|
||||
companionHeaders?: { [type: string]: string }
|
||||
companionUrl?: string
|
||||
getChunkSize?: (file: UppyFile) => number
|
||||
|
|
@ -35,11 +34,10 @@ declare module AwsS3Multipart {
|
|||
timeout?: number
|
||||
limit?: number
|
||||
retryDelays?: number[] | null
|
||||
}
|
||||
}
|
||||
|
||||
declare class AwsS3Multipart extends BasePlugin<
|
||||
AwsS3Multipart.AwsS3MultipartOptions
|
||||
AwsS3MultipartOptions
|
||||
> {}
|
||||
|
||||
export default AwsS3Multipart
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { expectError, expectType } from 'tsd'
|
||||
import Uppy from '@uppy/core'
|
||||
import type { UppyFile } from '@uppy/core'
|
||||
import AwsS3Multipart from '../'
|
||||
import AwsS3Multipart from '..'
|
||||
import type { AwsS3Part } from '..'
|
||||
|
||||
{
|
||||
const uppy = new Uppy()
|
||||
|
|
@ -33,9 +34,9 @@ import AwsS3Multipart from '../'
|
|||
expectType<UppyFile>(file)
|
||||
expectType<string>(opts.uploadId)
|
||||
expectType<string>(opts.key)
|
||||
expectType<AwsS3Multipart.AwsS3Part>(opts.parts[0])
|
||||
expectType<AwsS3Part>(opts.parts[0])
|
||||
return {}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
10
packages/@uppy/aws-s3/types/index.d.ts
vendored
10
packages/@uppy/aws-s3/types/index.d.ts
vendored
|
|
@ -2,23 +2,21 @@ import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core'
|
|||
|
||||
type MaybePromise<T> = T | Promise<T>
|
||||
|
||||
declare module AwsS3 {
|
||||
interface AwsS3UploadParameters {
|
||||
interface AwsS3UploadParameters {
|
||||
method?: string
|
||||
url: string
|
||||
fields?: { [type: string]: string }
|
||||
headers?: { [type: string]: string }
|
||||
}
|
||||
}
|
||||
|
||||
interface AwsS3Options extends PluginOptions {
|
||||
interface AwsS3Options extends PluginOptions {
|
||||
companionUrl?: string
|
||||
getUploadParameters?: (file: UppyFile) => MaybePromise<AwsS3UploadParameters>
|
||||
metaFields?: string[]
|
||||
timeout?: number
|
||||
limit?: number
|
||||
}
|
||||
}
|
||||
|
||||
declare class AwsS3 extends BasePlugin<AwsS3.AwsS3Options> {}
|
||||
declare class AwsS3 extends BasePlugin<AwsS3Options> {}
|
||||
|
||||
export default AwsS3
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { expectType } from 'tsd'
|
||||
import Uppy from '@uppy/core'
|
||||
import type { UppyFile } from '@uppy/core'
|
||||
import AwsS3 from '../'
|
||||
import AwsS3 from '..'
|
||||
|
||||
{
|
||||
const uppy = new Uppy()
|
||||
|
|
@ -9,6 +9,6 @@ import AwsS3 from '../'
|
|||
getUploadParameters (file) {
|
||||
expectType<UppyFile>(file)
|
||||
return { url: '' }
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
6
packages/@uppy/box/types/index.d.ts
vendored
6
packages/@uppy/box/types/index.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
import type { PluginOptions, PluginTarget, UIPlugin } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
declare module Box {
|
||||
interface BoxOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface BoxOptions extends PluginOptions, PublicProviderOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
}
|
||||
|
||||
declare class Box extends UIPlugin<Box.BoxOptions> {}
|
||||
declare class Box extends UIPlugin<BoxOptions> {}
|
||||
|
||||
export default Box
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import Box = require('../')
|
||||
// import Box from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
31
packages/@uppy/companion-client/types/index.d.ts
vendored
31
packages/@uppy/companion-client/types/index.d.ts
vendored
|
|
@ -1,3 +1,5 @@
|
|||
import type { Uppy } from '@uppy/core'
|
||||
|
||||
/**
|
||||
* Async storage interface, similar to `localStorage`. This can be used to
|
||||
* implement custom storages for authentication tokens.
|
||||
|
|
@ -10,15 +12,18 @@ export interface TokenStorage {
|
|||
|
||||
export interface RequestClientOptions {
|
||||
companionUrl: string
|
||||
companionHeaders?: object
|
||||
companionHeaders?: Record<string, unknown>
|
||||
companionCookiesRule?: RequestCredentials
|
||||
}
|
||||
|
||||
export class RequestClient {
|
||||
constructor (uppy: any, opts: RequestClientOptions)
|
||||
constructor (uppy: Uppy, opts: RequestClientOptions)
|
||||
|
||||
get (path: string): Promise<any>
|
||||
post (path: string, data: object): Promise<any>
|
||||
delete (path: string, data: object): Promise<any>
|
||||
|
||||
post (path: string, data: Record<string, unknown>): Promise<any>
|
||||
|
||||
delete (path: string, data: Record<string, unknown>): Promise<any>
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,13 +44,19 @@ export interface ProviderOptions extends PublicProviderOptions {
|
|||
}
|
||||
|
||||
export class Provider extends RequestClient {
|
||||
constructor (uppy: any, opts: ProviderOptions)
|
||||
constructor (uppy: Uppy, opts: ProviderOptions)
|
||||
|
||||
checkAuth (): Promise<boolean>
|
||||
|
||||
authUrl (): string
|
||||
|
||||
fileUrl (id: string): string
|
||||
|
||||
list (directory: string): Promise<any>
|
||||
|
||||
logout (redirect?: string): Promise<any>
|
||||
static initPlugin (plugin: any, opts: object, defaultOpts?: object): void
|
||||
|
||||
static initPlugin (plugin: unknown, opts: Record<string, unknown>, defaultOpts?: Record<string, unknown>): void
|
||||
}
|
||||
|
||||
export interface SocketOptions {
|
||||
|
|
@ -57,10 +68,16 @@ export class Socket {
|
|||
isOpen: boolean
|
||||
|
||||
constructor (opts: SocketOptions)
|
||||
|
||||
open (): void
|
||||
|
||||
close (): void
|
||||
send (action: string, payload: any): void
|
||||
|
||||
send (action: string, payload: unknown): void
|
||||
|
||||
on (action: string, handler: (param: any) => void): void
|
||||
|
||||
once (action: string, handler: (param: any) => void): void
|
||||
|
||||
emit (action: string, payload: (param: any) => void): void
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import { RequestClient, Provider, Socket } from '../'
|
||||
// import { RequestClient, Provider, Socket } from '..'
|
||||
// TODO tests
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// We need explicit type declarations for `errors.js` because of a typescript bug when generating declaration files. I think it's this one:
|
||||
// We need explicit type declarations for `errors.js` because of a typescript bug when generating declaration files.
|
||||
// I think it's this one:
|
||||
// https://github.com/microsoft/TypeScript/issues/37832
|
||||
//
|
||||
// We could try removing this file when we upgrade to 4.1 :)
|
||||
|
|
|
|||
187
packages/@uppy/core/types/index.d.ts
vendored
187
packages/@uppy/core/types/index.d.ts
vendored
|
|
@ -1,58 +1,59 @@
|
|||
import * as UppyUtils from "@uppy/utils"
|
||||
import * as UppyUtils from '@uppy/utils'
|
||||
|
||||
// Utility types
|
||||
type OmitKey<T, Key> = Pick<T, Exclude<keyof T, Key>>
|
||||
|
||||
type UploadHandler = (fileIDs: string[]) => Promise<void>
|
||||
|
||||
export interface IndexedObject<T> {
|
||||
[key: string]: T
|
||||
[key: number]: T
|
||||
}
|
||||
|
||||
// These are defined in @uppy/utils instead of core so it can be used there without creating import cycles
|
||||
export type UppyFile<
|
||||
TMeta extends IndexedObject<any> = Record<string, unknown>,
|
||||
TBody extends IndexedObject<any> = Record<string, unknown>
|
||||
> = UppyUtils.UppyFile<TMeta, TBody>
|
||||
|
||||
// Replace the `meta` property type with one that allows omitting internal metadata addFile() will add that
|
||||
type UppyFileWithoutMeta<TMeta, TBody> = OmitKey<
|
||||
UppyFile<TMeta, TBody>,
|
||||
"meta"
|
||||
'meta'
|
||||
>
|
||||
|
||||
type LocaleStrings<TNames extends string> = {
|
||||
[K in TNames]?: string | { [n: number]: string }
|
||||
}
|
||||
|
||||
type LogLevel = "info" | "warning" | "error"
|
||||
type LogLevel = 'info' | 'warning' | 'error'
|
||||
|
||||
// This hack accepts _any_ string for `Event`, but also tricks VSCode and friends into providing autocompletions
|
||||
// for the names listed. https://github.com/microsoft/TypeScript/issues/29729#issuecomment-505826972
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>)
|
||||
|
||||
type Event = LiteralUnion<
|
||||
| "file-added"
|
||||
| "file-removed"
|
||||
| "upload"
|
||||
| "upload-progress"
|
||||
| "upload-success"
|
||||
| "complete"
|
||||
| "error"
|
||||
| "upload-error"
|
||||
| "upload-retry"
|
||||
| "info-visible"
|
||||
| "info-hidden"
|
||||
| "cancel-all"
|
||||
| "restriction-failed"
|
||||
| "reset-progress"
|
||||
| 'file-added'
|
||||
| 'file-removed'
|
||||
| 'upload'
|
||||
| 'upload-progress'
|
||||
| 'upload-success'
|
||||
| 'complete'
|
||||
| 'error'
|
||||
| 'upload-error'
|
||||
| 'upload-retry'
|
||||
| 'info-visible'
|
||||
| 'info-hidden'
|
||||
| 'cancel-all'
|
||||
| 'restriction-failed'
|
||||
| 'reset-progress'
|
||||
>
|
||||
|
||||
// These are defined in @uppy/utils instead of core so it can be used there without creating import cycles
|
||||
export type UppyFile<
|
||||
TMeta extends IndexedObject<any> = {},
|
||||
TBody extends IndexedObject<any> = {}
|
||||
> = UppyUtils.UppyFile<TMeta, TBody>
|
||||
|
||||
export type Store = UppyUtils.Store
|
||||
|
||||
export type InternalMetadata = UppyUtils.InternalMetadata
|
||||
|
||||
export interface IndexedObject<T> {
|
||||
[key: string]: T
|
||||
[key: number]: T
|
||||
}
|
||||
|
||||
export interface UploadedUppyFile<TMeta, TBody> extends UppyFile<TMeta, TBody> {
|
||||
uploadURL: string
|
||||
}
|
||||
|
|
@ -80,25 +81,46 @@ export interface DefaultPluginOptions extends PluginOptions {
|
|||
|
||||
export class BasePlugin<TOptions extends PluginOptions = DefaultPluginOptions> {
|
||||
id: string
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
uppy: Uppy
|
||||
|
||||
type: string
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
constructor(uppy: Uppy, opts?: TOptions)
|
||||
|
||||
setOptions(update: Partial<TOptions>): void
|
||||
getPluginState(): object
|
||||
setPluginState(update: IndexedObject<any>): object
|
||||
|
||||
getPluginState(): Record<string, unknown>
|
||||
|
||||
setPluginState(update: IndexedObject<any>): Record<string, unknown>
|
||||
|
||||
install(): void
|
||||
|
||||
uninstall(): void
|
||||
}
|
||||
|
||||
export class UIPlugin<TOptions extends PluginOptions = DefaultPluginOptions> extends BasePlugin<TOptions> {
|
||||
id: string
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
uppy: Uppy
|
||||
|
||||
type: string
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
constructor(uppy: Uppy, opts?: TOptions)
|
||||
update(state?: object): void
|
||||
|
||||
update(state?: Record<string, unknown>): void
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
mount(target: PluginTarget, plugin: typeof UIPlugin): void
|
||||
render(state: object): void
|
||||
|
||||
render(state: Record<string, unknown>): void
|
||||
|
||||
addTarget<TPlugin extends UIPlugin>(plugin: TPlugin): void
|
||||
|
||||
unmount(): void
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +144,7 @@ export interface Restrictions {
|
|||
allowedFileTypes?: string[] | null
|
||||
}
|
||||
|
||||
export interface UppyOptions<TMeta extends IndexedObject<any> = {}> {
|
||||
export interface UppyOptions<TMeta extends IndexedObject<any> = Record<string, unknown>> {
|
||||
id?: string
|
||||
autoProceed?: boolean
|
||||
allowMultipleUploads?: boolean
|
||||
|
|
@ -142,19 +164,19 @@ export interface UppyOptions<TMeta extends IndexedObject<any> = {}> {
|
|||
}
|
||||
|
||||
export interface UploadResult<
|
||||
TMeta extends IndexedObject<any> = {},
|
||||
TBody extends IndexedObject<any> = {}
|
||||
TMeta extends IndexedObject<any> = Record<string, unknown>,
|
||||
TBody extends IndexedObject<any> = Record<string, unknown>
|
||||
> {
|
||||
successful: UploadedUppyFile<TMeta, TBody>[]
|
||||
failed: FailedUppyFile<TMeta, TBody>[]
|
||||
}
|
||||
|
||||
export interface State<
|
||||
TMeta extends IndexedObject<any> = {},
|
||||
TBody extends IndexedObject<any> = {}
|
||||
TMeta extends IndexedObject<any> = Record<string, unknown>,
|
||||
TBody extends IndexedObject<any> = Record<string, unknown>
|
||||
> extends IndexedObject<any> {
|
||||
capabilities?: { resumableUploads?: boolean }
|
||||
currentUploads: {}
|
||||
currentUploads: Record<string, unknown>
|
||||
error?: string
|
||||
files: {
|
||||
[key: string]:
|
||||
|
|
@ -176,44 +198,71 @@ type UploadCompleteCallback<T> = (result: UploadResult<T>) => void
|
|||
|
||||
export class Uppy {
|
||||
constructor(opts?: UppyOptions)
|
||||
on<TMeta extends IndexedObject<any> = {}>(event: 'upload-success', callback: UploadSuccessCallback<TMeta>): this
|
||||
on<TMeta extends IndexedObject<any> = {}>(event: 'complete', callback: UploadCompleteCallback<TMeta>): this
|
||||
|
||||
on<TMeta extends IndexedObject<any> = Record<string, unknown>>(event: 'upload-success', callback: UploadSuccessCallback<TMeta>): this
|
||||
|
||||
on<TMeta extends IndexedObject<any> = Record<string, unknown>>(event: 'complete', callback: UploadCompleteCallback<TMeta>): this
|
||||
|
||||
on(event: Event, callback: (...args: any[]) => void): this
|
||||
once<TMeta extends IndexedObject<any> = {}>(event: 'upload-success', callback: UploadSuccessCallback<TMeta>): this
|
||||
once<TMeta extends IndexedObject<any> = {}>(event: 'complete', callback: UploadCompleteCallback<TMeta>): this
|
||||
|
||||
once<TMeta extends IndexedObject<any> = Record<string, unknown>>(event: 'upload-success', callback: UploadSuccessCallback<TMeta>): this
|
||||
|
||||
once<TMeta extends IndexedObject<any> = Record<string, unknown>>(event: 'complete', callback: UploadCompleteCallback<TMeta>): this
|
||||
|
||||
once(event: Event, callback: (...args: any[]) => void): this
|
||||
|
||||
off(event: Event, callback: (...args: any[]) => void): this
|
||||
|
||||
off(event: Event, callback: (...args: any[]) => void): this
|
||||
|
||||
/**
|
||||
* For use by plugins only.
|
||||
*/
|
||||
emit(event: Event, ...args: any[]): void
|
||||
updateAll(state: object): void
|
||||
|
||||
updateAll(state: Record<string, unknown>): void
|
||||
|
||||
setOptions(update: Partial<UppyOptions>): void
|
||||
setState(patch: object): void
|
||||
getState<TMeta extends IndexedObject<any> = {}>(): State<TMeta>
|
||||
|
||||
setState(patch: Record<string, unknown>): void
|
||||
|
||||
getState<TMeta extends IndexedObject<any> = Record<string, unknown>>(): State<TMeta>
|
||||
|
||||
readonly state: State
|
||||
setFileState(fileID: string, state: object): void
|
||||
|
||||
setFileState(fileID: string, state: Record<string, unknown>): void
|
||||
|
||||
resetProgress(): void
|
||||
|
||||
addPreProcessor(fn: UploadHandler): void
|
||||
|
||||
removePreProcessor(fn: UploadHandler): void
|
||||
|
||||
addPostProcessor(fn: UploadHandler): void
|
||||
|
||||
removePostProcessor(fn: UploadHandler): void
|
||||
|
||||
addUploader(fn: UploadHandler): void
|
||||
|
||||
removeUploader(fn: UploadHandler): void
|
||||
setMeta<TMeta extends IndexedObject<any> = {}>(data: TMeta): void
|
||||
setFileMeta<TMeta extends IndexedObject<any> = {}>(
|
||||
|
||||
setMeta<TMeta extends IndexedObject<any> = Record<string, unknown>>(data: TMeta): void
|
||||
|
||||
setFileMeta<TMeta extends IndexedObject<any> = Record<string, unknown>>(
|
||||
fileID: string,
|
||||
data: TMeta
|
||||
): void
|
||||
|
||||
getFile<
|
||||
TMeta extends IndexedObject<any> = {},
|
||||
TBody extends IndexedObject<any> = {}
|
||||
TMeta extends IndexedObject<any> = Record<string, unknown>,
|
||||
TBody extends IndexedObject<any> = Record<string, unknown>
|
||||
>(fileID: string): UppyFile<TMeta, TBody>
|
||||
|
||||
getFiles<
|
||||
TMeta extends IndexedObject<any> = {},
|
||||
TBody extends IndexedObject<any> = {}
|
||||
TMeta extends IndexedObject<any> = Record<string, unknown>,
|
||||
TBody extends IndexedObject<any> = Record<string, unknown>
|
||||
>(): Array<UppyFile<TMeta, TBody>>
|
||||
|
||||
getObjectOfFilesPerState(): {
|
||||
newFiles: Array<UppyFile>
|
||||
startedFiles: Array<UppyFile>
|
||||
|
|
@ -231,43 +280,65 @@ export class Uppy {
|
|||
isUploadInProgress: boolean
|
||||
isSomeGhost: boolean
|
||||
}
|
||||
addFile<TMeta extends IndexedObject<any> = {}>(
|
||||
|
||||
addFile<TMeta extends IndexedObject<any> = Record<string, unknown>>(
|
||||
file: AddFileOptions<TMeta>
|
||||
): string
|
||||
|
||||
removeFile(fileID: string): void
|
||||
|
||||
pauseResume(fileID: string): boolean
|
||||
|
||||
pauseAll(): void
|
||||
|
||||
resumeAll(): void
|
||||
retryAll<TMeta extends IndexedObject<any> = {}>(): Promise<
|
||||
|
||||
retryAll<TMeta extends IndexedObject<any> = Record<string, unknown>>(): Promise<
|
||||
UploadResult<TMeta>
|
||||
>
|
||||
|
||||
cancelAll(): void
|
||||
retryUpload<TMeta extends IndexedObject<any> = {}>(
|
||||
|
||||
retryUpload<TMeta extends IndexedObject<any> = Record<string, unknown>>(
|
||||
fileID: string
|
||||
): Promise<UploadResult<TMeta>>
|
||||
|
||||
reset(): void
|
||||
|
||||
getID(): string
|
||||
|
||||
use<TOptions, TInstance extends UIPlugin | BasePlugin<TOptions>>(
|
||||
pluginClass: new (uppy: this, opts: TOptions) => TInstance,
|
||||
opts?: TOptions
|
||||
): this
|
||||
|
||||
getPlugin<TPlugin extends UIPlugin | BasePlugin>(name: string): TPlugin
|
||||
|
||||
iteratePlugins(callback: (plugin: UIPlugin | BasePlugin) => void): void
|
||||
|
||||
removePlugin(instance: UIPlugin | BasePlugin): void
|
||||
|
||||
close(): void
|
||||
|
||||
logout(): void
|
||||
|
||||
info(
|
||||
message: string | { message: string; details: string },
|
||||
type?: LogLevel,
|
||||
duration?: number
|
||||
): void
|
||||
|
||||
hideInfo(): void
|
||||
|
||||
log(msg: string, type?: LogLevel): void
|
||||
restore<TMeta extends IndexedObject<any> = {}>(
|
||||
|
||||
restore<TMeta extends IndexedObject<any> = Record<string, unknown>>(
|
||||
uploadID: string
|
||||
): Promise<UploadResult<TMeta>>
|
||||
addResultData(uploadID: string, data: object): void
|
||||
upload<TMeta extends IndexedObject<any> = {}>(): Promise<UploadResult<TMeta>>
|
||||
|
||||
addResultData(uploadID: string, data: Record<string, unknown>): void
|
||||
|
||||
upload<TMeta extends IndexedObject<any> = Record<string, unknown>>(): Promise<UploadResult<TMeta>>
|
||||
}
|
||||
|
||||
export default Uppy
|
||||
|
|
|
|||
|
|
@ -1,25 +1,27 @@
|
|||
import { expectError, expectType } from 'tsd'
|
||||
import Uppy, { UIPlugin } from '../'
|
||||
import type { UploadedUppyFile, FailedUppyFile, PluginOptions } from '../'
|
||||
import DefaultStore from '@uppy/store-default'
|
||||
import Uppy, { UIPlugin } from '..'
|
||||
import type { UploadedUppyFile, FailedUppyFile, PluginOptions } from '..'
|
||||
|
||||
type anyObject = Record<string, unknown>
|
||||
|
||||
{
|
||||
const uppy = new Uppy()
|
||||
uppy.addFile({
|
||||
data: new Blob([new ArrayBuffer(1024)], {
|
||||
type: 'application/octet-stream'
|
||||
})
|
||||
type: 'application/octet-stream',
|
||||
}),
|
||||
})
|
||||
|
||||
uppy.upload().then((result) => {
|
||||
expectType<UploadedUppyFile<{}, {}>>(result.successful[0])
|
||||
expectType<FailedUppyFile<{}, {}>>(result.failed[0])
|
||||
expectType<UploadedUppyFile<anyObject, anyObject>>(result.successful[0])
|
||||
expectType<FailedUppyFile<anyObject, anyObject>>(result.failed[0])
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const store = DefaultStore()
|
||||
new Uppy({ store })
|
||||
new Uppy({ store }) // eslint-disable-line no-new
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -33,17 +35,17 @@ import DefaultStore from '@uppy/store-default'
|
|||
if (f && f.response && f.response.status === 200) {
|
||||
expectType(f.response.body)
|
||||
}
|
||||
expectType<number>(f.response!.status)
|
||||
expectType<number>(f.response!.status) // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
||||
}
|
||||
|
||||
{
|
||||
type Meta = {}
|
||||
type Meta = Record<string, never>
|
||||
type ResponseBody = {
|
||||
averageColor: string
|
||||
}
|
||||
const uppy = new Uppy()
|
||||
const f = uppy.getFile<Meta, ResponseBody>('virtual')!
|
||||
expectType<ResponseBody>(f.response!.body)
|
||||
const f = uppy.getFile<Meta, ResponseBody>('virtual')
|
||||
expectType<ResponseBody>(f.response!.body) // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -51,7 +53,7 @@ import DefaultStore from '@uppy/store-default'
|
|||
uppy.addFile({
|
||||
name: 'empty.json',
|
||||
data: new Blob(['null'], { type: 'application/json' }),
|
||||
meta: { path: 'path/to/file' }
|
||||
meta: { path: 'path/to/file' },
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +70,7 @@ import DefaultStore from '@uppy/store-default'
|
|||
}
|
||||
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
const uppy = new Uppy()
|
||||
// can emit events with internal event types
|
||||
uppy.emit('upload')
|
||||
|
|
@ -88,14 +91,15 @@ import DefaultStore from '@uppy/store-default'
|
|||
// can register listeners on custom events
|
||||
uppy.on('dashboard:modal-closed', () => {})
|
||||
uppy.once('dashboard:modal-closed', () => {})
|
||||
/* eslint-enable @typescript-eslint/no-empty-function */
|
||||
}
|
||||
|
||||
{
|
||||
const uppy = new Uppy()
|
||||
uppy.setOptions({
|
||||
restrictions: {
|
||||
allowedFileTypes: ['.png']
|
||||
}
|
||||
allowedFileTypes: ['.png'],
|
||||
},
|
||||
})
|
||||
expectError(uppy.setOptions({ restrictions: false }))
|
||||
expectError(uppy.setOptions({ unknownKey: false }))
|
||||
|
|
|
|||
11
packages/@uppy/dashboard/types/index.d.ts
vendored
11
packages/@uppy/dashboard/types/index.d.ts
vendored
|
|
@ -7,7 +7,7 @@ type FieldRenderOptions = {
|
|||
onChange: (newVal: string) => void
|
||||
}
|
||||
|
||||
type PreactRender = (node: any, params: object | null, ...children: any[]) => any
|
||||
type PreactRender = (node: any, params: Record<string, unknown> | null, ...children: any[]) => any
|
||||
|
||||
interface MetaField {
|
||||
id: string
|
||||
|
|
@ -57,12 +57,19 @@ export interface DashboardOptions extends PluginOptions {
|
|||
|
||||
declare class Dashboard extends UIPlugin<DashboardOptions> {
|
||||
addTarget (plugin: UIPlugin): HTMLElement
|
||||
|
||||
hideAllPanels (): void
|
||||
|
||||
openModal (): void
|
||||
|
||||
closeModal (): void
|
||||
|
||||
isModalOpen (): boolean
|
||||
render (state: object): void
|
||||
|
||||
render (state: Record<string, unknown>): void
|
||||
|
||||
install (): void
|
||||
|
||||
uninstall (): void
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { expectType, expectError } from 'tsd'
|
||||
import Uppy from '@uppy/core'
|
||||
import Dashboard from '../'
|
||||
import Dashboard from '..'
|
||||
|
||||
{
|
||||
const uppy = new Uppy()
|
||||
uppy.use(Dashboard, {
|
||||
target: 'body'
|
||||
target: 'body',
|
||||
})
|
||||
|
||||
const plugin = uppy.getPlugin<Dashboard>('Dashboard')
|
||||
|
|
@ -24,7 +24,7 @@ import Dashboard from '../'
|
|||
{
|
||||
id: 'license',
|
||||
name: 'License',
|
||||
placeholder: 'Creative Commons, Apache 2.0, ...'
|
||||
placeholder: 'Creative Commons, Apache 2.0, ...',
|
||||
},
|
||||
{
|
||||
id: 'public',
|
||||
|
|
@ -44,9 +44,9 @@ import Dashboard from '../'
|
|||
}
|
||||
})
|
||||
*/
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -58,24 +58,24 @@ import Dashboard from '../'
|
|||
// Dashboard string
|
||||
addMoreFiles: 'yaddayadda',
|
||||
// StatusBar string
|
||||
uploading: '^^^^'
|
||||
}
|
||||
}
|
||||
uploading: '^^^^',
|
||||
},
|
||||
},
|
||||
})
|
||||
expectError(uppy.use(Dashboard, {
|
||||
locale: {
|
||||
strings: {
|
||||
somethingThatDoesNotExist: 'wrong'
|
||||
}
|
||||
}
|
||||
somethingThatDoesNotExist: 'wrong',
|
||||
},
|
||||
},
|
||||
}))
|
||||
const wrongType = 1234
|
||||
expectError(uppy.use(Dashboard, {
|
||||
locale: {
|
||||
strings: {
|
||||
addMoreFiles: wrongType
|
||||
}
|
||||
}
|
||||
addMoreFiles: wrongType,
|
||||
},
|
||||
},
|
||||
}))
|
||||
}
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
import Uppy from "@uppy/core"
|
||||
import Uppy from '@uppy/core'
|
||||
|
||||
import DragDrop from "../"
|
||||
import DragDrop from '..'
|
||||
|
||||
{
|
||||
const uppy = new Uppy();
|
||||
const uppy = new Uppy()
|
||||
|
||||
uppy.use(DragDrop, {
|
||||
replaceTargetContent: true,
|
||||
target: "body",
|
||||
inputName: "test",
|
||||
target: 'body',
|
||||
inputName: 'test',
|
||||
allowMultipleFiles: true,
|
||||
width: 100,
|
||||
height: "100",
|
||||
note: "note",
|
||||
height: '100',
|
||||
note: 'note',
|
||||
locale: {
|
||||
strings: {
|
||||
dropHereOr: "test",
|
||||
browse: "test",
|
||||
dropHereOr: 'test',
|
||||
browse: 'test',
|
||||
},
|
||||
},
|
||||
onDragOver: (event) => event.clientX,
|
||||
onDragLeave: (event) => event.clientY,
|
||||
onDrop: (event) => event,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
|
|
|||
8
packages/@uppy/drop-target/types/index.d.ts
vendored
8
packages/@uppy/drop-target/types/index.d.ts
vendored
|
|
@ -1,11 +1,9 @@
|
|||
import type { PluginOptions, BasePlugin} from '@uppy/core'
|
||||
import type { PluginOptions, BasePlugin } from '@uppy/core'
|
||||
|
||||
declare module DropTarget {
|
||||
interface DropTargetOptions extends PluginOptions {
|
||||
interface DropTargetOptions extends PluginOptions {
|
||||
target: string | Element
|
||||
}
|
||||
}
|
||||
|
||||
declare class DropTarget extends BasePlugin<DropTarget.DropTargetOptions> {}
|
||||
declare class DropTarget extends BasePlugin<DropTargetOptions> {}
|
||||
|
||||
export default DropTarget
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import DropTarget = require('../')
|
||||
// import DropTarget from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/dropbox/types/index.d.ts
vendored
6
packages/@uppy/dropbox/types/index.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
declare module Dropbox {
|
||||
interface DropboxOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface DropboxOptions extends PluginOptions, PublicProviderOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
}
|
||||
|
||||
declare class Dropbox extends UIPlugin<Dropbox.DropboxOptions> {}
|
||||
declare class Dropbox extends UIPlugin<DropboxOptions> {}
|
||||
|
||||
export default Dropbox
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import Dropbox = require('../')
|
||||
// import Dropbox from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/facebook/types/index.d.ts
vendored
6
packages/@uppy/facebook/types/index.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
declare module Facebook {
|
||||
interface FacebookOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface FacebookOptions extends PluginOptions, PublicProviderOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
}
|
||||
|
||||
declare class Facebook extends UIPlugin<Facebook.FacebookOptions> {}
|
||||
declare class Facebook extends UIPlugin<FacebookOptions> {}
|
||||
|
||||
export default Facebook
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import Facebook = require('../')
|
||||
// import Facebook from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/file-input/types/index.d.ts
vendored
6
packages/@uppy/file-input/types/index.d.ts
vendored
|
|
@ -1,16 +1,14 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import FileInputLocale from './generatedLocale'
|
||||
|
||||
declare module FileInput {
|
||||
export interface FileInputOptions extends PluginOptions {
|
||||
export interface FileInputOptions extends PluginOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
pretty?: boolean
|
||||
inputName?: string
|
||||
locale?: FileInputLocale
|
||||
}
|
||||
}
|
||||
|
||||
declare class FileInput extends UIPlugin<FileInput.FileInputOptions> {}
|
||||
declare class FileInput extends UIPlugin<FileInputOptions> {}
|
||||
|
||||
export default FileInput
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
import FileInput = require('../')
|
||||
// import FileInput from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/form/types/index.d.ts
vendored
6
packages/@uppy/form/types/index.d.ts
vendored
|
|
@ -1,7 +1,6 @@
|
|||
import type { PluginOptions, PluginTarget, BasePlugin } from '@uppy/core'
|
||||
|
||||
declare module Form {
|
||||
interface FormOptions extends PluginOptions {
|
||||
interface FormOptions extends PluginOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
resultName?: string
|
||||
|
|
@ -9,9 +8,8 @@ declare module Form {
|
|||
addResultToForm?: boolean
|
||||
submitOnSuccess?: boolean
|
||||
triggerUploadOnSubmit?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
declare class Form extends BasePlugin<Form.FormOptions> {}
|
||||
declare class Form extends BasePlugin<FormOptions> {}
|
||||
|
||||
export default Form
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
import Form = require('../')
|
||||
// import Form from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
import type { PluginOptions, BasePlugin } from '@uppy/core'
|
||||
|
||||
declare module GoldenRetriever {
|
||||
interface GoldenRetrieverOptions extends PluginOptions {
|
||||
interface GoldenRetrieverOptions extends PluginOptions {
|
||||
expires?: number
|
||||
serviceWorker?: boolean
|
||||
indexedDB?: any
|
||||
}
|
||||
}
|
||||
|
||||
declare class GoldenRetriever extends BasePlugin<
|
||||
GoldenRetriever.GoldenRetrieverOptions
|
||||
> {}
|
||||
declare class GoldenRetriever extends BasePlugin<GoldenRetrieverOptions> {}
|
||||
|
||||
export default GoldenRetriever
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
import GoldenRetriever = require('../')
|
||||
// import GoldenRetriever from '..'
|
||||
// TODO implements
|
||||
|
|
|
|||
4
packages/@uppy/google-drive/types/index.d.ts
vendored
4
packages/@uppy/google-drive/types/index.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
declare module GoogleDrive {
|
||||
interface GoogleDriveOptions extends PluginOptions, PublicProviderOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
}
|
||||
|
||||
declare class GoogleDrive extends UIPlugin<GoogleDrive.GoogleDriveOptions> {}
|
||||
declare class GoogleDrive extends UIPlugin<GoogleDriveOptions> {}
|
||||
|
||||
export default GoogleDrive
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import Uppy, { UIPlugin } from '@uppy/core'
|
||||
import GoogleDrive from '../'
|
||||
import Uppy, { UIPlugin, PluginOptions } from '@uppy/core'
|
||||
import GoogleDrive from '..'
|
||||
|
||||
class SomePlugin extends UIPlugin<{}> {}
|
||||
class SomePlugin extends UIPlugin<PluginOptions> {}
|
||||
|
||||
const uppy = new Uppy()
|
||||
uppy.use(GoogleDrive, { companionUrl: '' })
|
||||
uppy.use(GoogleDrive, { target: SomePlugin, companionUrl: '' })
|
||||
uppy.use(GoogleDrive, { target: document.querySelector('#gdrive')!, companionUrl: '' })
|
||||
uppy.use(GoogleDrive, { target: document.querySelector('#gdrive') || (undefined as never), companionUrl: '' })
|
||||
|
|
|
|||
40
packages/@uppy/image-editor/types/index.d.ts
vendored
40
packages/@uppy/image-editor/types/index.d.ts
vendored
|
|
@ -1,28 +1,26 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import ImageEditorLocale from './generatedLocale'
|
||||
|
||||
declare module ImageEditor {
|
||||
type Actions = {
|
||||
revert: boolean
|
||||
rotate: boolean
|
||||
granularRotate: boolean
|
||||
flip: boolean
|
||||
zoomIn: boolean
|
||||
zoomOut: boolean
|
||||
cropSquare: boolean
|
||||
cropWidescreen: boolean
|
||||
cropWidescreenVertical: boolean
|
||||
}
|
||||
|
||||
export interface ImageEditorOptions extends PluginOptions {
|
||||
cropperOptions?: object
|
||||
actions?: Actions
|
||||
quality?: number
|
||||
target?: PluginTarget
|
||||
locale?: ImageEditorLocale
|
||||
}
|
||||
type Actions = {
|
||||
revert: boolean
|
||||
rotate: boolean
|
||||
granularRotate: boolean
|
||||
flip: boolean
|
||||
zoomIn: boolean
|
||||
zoomOut: boolean
|
||||
cropSquare: boolean
|
||||
cropWidescreen: boolean
|
||||
cropWidescreenVertical: boolean
|
||||
}
|
||||
|
||||
declare class ImageEditor extends UIPlugin<ImageEditor.ImageEditorOptions> {}
|
||||
export interface ImageEditorOptions extends PluginOptions {
|
||||
cropperOptions?: Record<string, unknown>
|
||||
actions?: Actions
|
||||
quality?: number
|
||||
target?: PluginTarget
|
||||
locale?: ImageEditorLocale
|
||||
}
|
||||
|
||||
declare class ImageEditor extends UIPlugin<ImageEditorOptions> {}
|
||||
|
||||
export default ImageEditor
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
import ImageEditor = require('../')
|
||||
// import ImageEditor from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
10
packages/@uppy/informer/types/index.d.ts
vendored
10
packages/@uppy/informer/types/index.d.ts
vendored
|
|
@ -1,12 +1,10 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
|
||||
declare module Informer {
|
||||
interface InformerOptions extends PluginOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
}
|
||||
interface InformerOptions extends PluginOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
}
|
||||
|
||||
declare class Informer extends UIPlugin<Informer.InformerOptions> {}
|
||||
declare class Informer extends UIPlugin<InformerOptions> {}
|
||||
|
||||
export default Informer
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
import Informer = require('../')
|
||||
// import Informer from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/instagram/types/index.d.ts
vendored
6
packages/@uppy/instagram/types/index.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
declare module Instagram {
|
||||
interface InstagramOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface InstagramOptions extends PluginOptions, PublicProviderOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
}
|
||||
|
||||
declare class Instagram extends UIPlugin<Instagram.InstagramOptions> {}
|
||||
declare class Instagram extends UIPlugin<InstagramOptions> {}
|
||||
|
||||
export default Instagram
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import Instagram = require('../')
|
||||
// import Instagram from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/onedrive/types/index.d.ts
vendored
6
packages/@uppy/onedrive/types/index.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
declare module OneDrive {
|
||||
interface OneDriveOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface OneDriveOptions extends PluginOptions, PublicProviderOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
}
|
||||
|
||||
declare class OneDrive extends UIPlugin<OneDrive.OneDriveOptions> {}
|
||||
declare class OneDrive extends UIPlugin<OneDriveOptions> {}
|
||||
|
||||
export default OneDrive
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import OneDrive = require('../')
|
||||
// import OneDrive from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
1
packages/@uppy/progress-bar/types/index.d.ts
vendored
1
packages/@uppy/progress-bar/types/index.d.ts
vendored
|
|
@ -7,7 +7,6 @@ export interface ProgressBarOptions extends PluginOptions {
|
|||
fixed?: boolean
|
||||
}
|
||||
|
||||
|
||||
declare class ProgressBar extends UIPlugin<ProgressBarOptions> {}
|
||||
|
||||
export default ProgressBar
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import ProgressBar = require('../')
|
||||
// import ProgressBar from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ interface OnFirstRenderer {
|
|||
onFirstRender: () => any
|
||||
}
|
||||
|
||||
|
||||
declare class ProviderView {
|
||||
constructor (plugin: UIPlugin & OnFirstRenderer, opts: ProviderViewOptions)
|
||||
// @todo add other provider view methods
|
||||
constructor (plugin: UIPlugin & OnFirstRenderer, opts: ProviderViewOptions)
|
||||
// @todo add other provider view methods
|
||||
}
|
||||
|
||||
export default ProviderView
|
||||
|
|
|
|||
2
packages/@uppy/react/src/Dashboard.d.ts
vendored
2
packages/@uppy/react/src/Dashboard.d.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import * as React from 'react'
|
||||
import type { DashboardOptions } from '@uppy/dashboard'
|
||||
import { Omit, ToUppyProps } from './CommonTypes'
|
||||
import type {DashboardOptions} from '@uppy/dashboard'
|
||||
|
||||
// This type is mapped into `DashboardProps` below so IntelliSense doesn't display this big mess of nested types
|
||||
type DashboardPropsInner = Omit<
|
||||
|
|
|
|||
2
packages/@uppy/react/src/DashboardModal.d.ts
vendored
2
packages/@uppy/react/src/DashboardModal.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { Omit, ToUppyProps } from './CommonTypes'
|
||||
import type { DashboardOptions } from '@uppy/dashboard'
|
||||
import { Omit, ToUppyProps } from './CommonTypes'
|
||||
|
||||
// This type is mapped into `DashboardModalProps` below so IntelliSense doesn't display this big mess of nested types
|
||||
type DashboardModalPropsInner = {
|
||||
|
|
|
|||
6
packages/@uppy/react/src/DragDrop.d.ts
vendored
6
packages/@uppy/react/src/DragDrop.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { ToUppyProps } from './CommonTypes'
|
||||
import type { DragDropOptions } from '@uppy/drag-drop'
|
||||
import { ToUppyProps } from './CommonTypes'
|
||||
|
||||
export type DragDropProps = ToUppyProps<DragDropOptions> & React.BaseHTMLAttributes<HTMLDivElement>
|
||||
|
||||
|
|
@ -7,5 +7,5 @@ export type DragDropProps = ToUppyProps<DragDropOptions> & React.BaseHTMLAttrib
|
|||
* React component that renders an area in which files can be dropped to be
|
||||
* uploaded.
|
||||
*/
|
||||
declare const DragDropComponent: React.ComponentType<DragDropProps>;
|
||||
export default DragDropComponent;
|
||||
declare const DragDropComponent: React.ComponentType<DragDropProps>
|
||||
export default DragDropComponent
|
||||
|
|
|
|||
9
packages/@uppy/react/src/FileInput.d.ts
vendored
9
packages/@uppy/react/src/FileInput.d.ts
vendored
|
|
@ -1,12 +1,11 @@
|
|||
import type { FileInputOptions } from '@uppy/file-input'
|
||||
import { ToUppyProps } from './CommonTypes'
|
||||
import FileInput from '@uppy/file-input'
|
||||
|
||||
export type FileInputProps = ToUppyProps<FileInput.FileInputOptions>
|
||||
export type FileInputProps = ToUppyProps<FileInputOptions>
|
||||
|
||||
/**
|
||||
* React component that renders an area in which files can be dropped to be
|
||||
* uploaded.
|
||||
*/
|
||||
declare const FileInputComponent: React.ComponentType<FileInputProps>;
|
||||
export default FileInputComponent;
|
||||
|
||||
declare const FileInputComponent: React.ComponentType<FileInputProps>
|
||||
export default FileInputComponent
|
||||
|
|
|
|||
2
packages/@uppy/react/src/ProgressBar.d.ts
vendored
2
packages/@uppy/react/src/ProgressBar.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { ToUppyProps } from './CommonTypes'
|
||||
import type { ProgressBarOptions } from '@uppy/progress-bar'
|
||||
import { ToUppyProps } from './CommonTypes'
|
||||
|
||||
export type ProgressBarProps = ToUppyProps<ProgressBarOptions> & React.BaseHTMLAttributes<HTMLDivElement>
|
||||
|
||||
|
|
|
|||
2
packages/@uppy/react/src/StatusBar.d.ts
vendored
2
packages/@uppy/react/src/StatusBar.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { ToUppyProps } from './CommonTypes'
|
||||
import type { StatusBarOptions } from '@uppy/status-bar'
|
||||
import { ToUppyProps } from './CommonTypes'
|
||||
|
||||
export type StatusBarProps = ToUppyProps<StatusBarOptions> & React.BaseHTMLAttributes<HTMLDivElement>
|
||||
|
||||
|
|
|
|||
4
packages/@uppy/react/src/useUppy.d.ts
vendored
4
packages/@uppy/react/src/useUppy.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import type Uppy from "@uppy/core"
|
||||
import type Uppy from '@uppy/core'
|
||||
|
||||
declare function useUppy(factory: () => Uppy): Uppy
|
||||
|
||||
export = useUppy
|
||||
export default useUppy
|
||||
|
|
|
|||
4
packages/@uppy/react/types/index.d.ts
vendored
4
packages/@uppy/react/types/index.d.ts
vendored
|
|
@ -4,6 +4,4 @@ export { default as DragDrop } from '../src/DragDrop'
|
|||
export { default as ProgressBar } from '../src/ProgressBar'
|
||||
export { default as StatusBar } from '../src/StatusBar'
|
||||
export { default as FileInput } from '../src/FileInput'
|
||||
|
||||
import useUppy = require('../src/useUppy')
|
||||
export { useUppy }
|
||||
export { default as useUppy } from '../src/useUppy'
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin } from '@uppy/core'
|
||||
|
||||
declare module ReduxDevTools {
|
||||
interface ReduxDevToolsOptions extends PluginOptions {}
|
||||
}
|
||||
type ReduxDevToolsOptions = PluginOptions
|
||||
|
||||
declare class ReduxDevTools extends UIPlugin<
|
||||
ReduxDevTools.ReduxDevToolsOptions
|
||||
> {}
|
||||
declare class ReduxDevTools extends UIPlugin<ReduxDevToolsOptions> {}
|
||||
|
||||
export default ReduxDevTools
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import ReduxDevTools = require('../')
|
||||
// import ReduxDevTools from '..'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { PluginOptions, UIPlugin } from '@uppy/core'
|
||||
|
||||
declare module ScreenCapture {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_shared_screen_tracks
|
||||
// TODO: use the global DisplayMediaStreamConstraints once typescript includes it by default
|
||||
interface DisplayMediaStreamConstraints {
|
||||
|
|
@ -12,13 +11,12 @@ declare module ScreenCapture {
|
|||
});
|
||||
}
|
||||
|
||||
export interface ScreenCaptureOptions extends PluginOptions {
|
||||
export interface ScreenCaptureOptions extends PluginOptions {
|
||||
displayMediaConstraints?: DisplayMediaStreamConstraints,
|
||||
userMediaConstraints?: MediaStreamConstraints,
|
||||
preferredVideoMimeType?: string
|
||||
}
|
||||
}
|
||||
|
||||
declare class ScreenCapture extends UIPlugin<ScreenCapture.ScreenCaptureOptions> {}
|
||||
declare class ScreenCapture extends UIPlugin<ScreenCaptureOptions> {}
|
||||
|
||||
export default ScreenCapture
|
||||
|
|
|
|||
|
|
@ -1,23 +1,19 @@
|
|||
import { expectError } from 'tsd'
|
||||
import Uppy from '@uppy/core'
|
||||
import ScreenCapture from '../'
|
||||
import ScreenCapture from '..'
|
||||
|
||||
{
|
||||
new Uppy().use(ScreenCapture)
|
||||
new Uppy().use(ScreenCapture, {})
|
||||
new Uppy().use(ScreenCapture, { preferredVideoMimeType: 'video/mp4' })
|
||||
expectError(new Uppy().use(ScreenCapture, { preferredVideoMimeType: 10 }))
|
||||
}
|
||||
new Uppy().use(ScreenCapture)
|
||||
new Uppy().use(ScreenCapture, {})
|
||||
new Uppy().use(ScreenCapture, { preferredVideoMimeType: 'video/mp4' })
|
||||
expectError(new Uppy().use(ScreenCapture, { preferredVideoMimeType: 10 }))
|
||||
|
||||
{
|
||||
new Uppy().use(ScreenCapture, {
|
||||
displayMediaConstraints: {
|
||||
video: { displaySurface: 'window' }
|
||||
}
|
||||
})
|
||||
expectError(new Uppy().use(ScreenCapture, {
|
||||
displayMediaConstraints: {
|
||||
video: { displaySurface: 'some nonsense' }
|
||||
}
|
||||
}))
|
||||
}
|
||||
new Uppy().use(ScreenCapture, {
|
||||
displayMediaConstraints: {
|
||||
video: { displaySurface: 'window' },
|
||||
},
|
||||
})
|
||||
expectError(new Uppy().use(ScreenCapture, {
|
||||
displayMediaConstraints: {
|
||||
video: { displaySurface: 'some nonsense' },
|
||||
},
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import StatusBar = require('../')
|
||||
// import StatusBar from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
12
packages/@uppy/store-default/types/index.d.ts
vendored
12
packages/@uppy/store-default/types/index.d.ts
vendored
|
|
@ -1,10 +1,16 @@
|
|||
import type { Store } from '@uppy/utils'
|
||||
|
||||
type State = Record<string, unknown>
|
||||
type StateChangeListener = (prevState: State, nextState: State, patch: State) => void
|
||||
|
||||
declare class DefaultStore implements Store {
|
||||
constructor ()
|
||||
getState (): object
|
||||
setState (patch: object): void
|
||||
subscribe (listener: any): () => void
|
||||
|
||||
getState (): State
|
||||
|
||||
setState (patch: State): void
|
||||
|
||||
subscribe (listener: StateChangeListener): () => void
|
||||
}
|
||||
|
||||
declare function createDefaultStore (): DefaultStore
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import DefaultStore from '../'
|
||||
import DefaultStore from '..'
|
||||
|
||||
const store = DefaultStore()
|
||||
|
||||
|
|
|
|||
16
packages/@uppy/store-redux/types/index.d.ts
vendored
16
packages/@uppy/store-redux/types/index.d.ts
vendored
|
|
@ -1,17 +1,23 @@
|
|||
import type { Store } from '@uppy/utils'
|
||||
import type { Reducer, Middleware, Store as Redux } from 'redux'
|
||||
|
||||
type State = Record<string, unknown>
|
||||
type StateChangeListener = (prevState: State, nextState: State, patch: State) => void
|
||||
|
||||
interface ReduxStoreOptions {
|
||||
store: Redux<object>
|
||||
store: Redux<State>
|
||||
id?: string
|
||||
selector?: (state: any) => object
|
||||
selector?: (state: any) => State
|
||||
}
|
||||
|
||||
export class ReduxStore implements Store {
|
||||
constructor (opts: ReduxStoreOptions)
|
||||
getState (): object
|
||||
setState (patch: object): void
|
||||
subscribe (listener: any): () => void
|
||||
|
||||
getState (): State
|
||||
|
||||
setState (patch: State): void
|
||||
|
||||
subscribe (listener: StateChangeListener): () => void
|
||||
}
|
||||
|
||||
export const reducer: Reducer<any>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { createStore, combineReducers } from 'redux'
|
||||
import ReduxStore, { reducer as uppy } from '..'
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,15 @@ import type { PluginOptions, UIPlugin } from '@uppy/core'
|
|||
|
||||
import ThumbnailGeneratorLocale from './generatedLocale'
|
||||
|
||||
declare module ThumbnailGenerator {
|
||||
interface ThumbnailGeneratorOptions extends PluginOptions {
|
||||
interface ThumbnailGeneratorOptions extends PluginOptions {
|
||||
thumbnailWidth?: number,
|
||||
thumbnailHeight?: number,
|
||||
thumbnailType?: string,
|
||||
thumbnailType?: string,
|
||||
waitForThumbnailsBeforeUpload?: boolean,
|
||||
lazy?: boolean,
|
||||
locale?: ThumbnailGeneratorLocale,
|
||||
}
|
||||
}
|
||||
|
||||
declare class ThumbnailGenerator extends UIPlugin<
|
||||
ThumbnailGenerator.ThumbnailGeneratorOptions
|
||||
> {}
|
||||
declare class ThumbnailGenerator extends UIPlugin<ThumbnailGeneratorOptions> {}
|
||||
|
||||
export default ThumbnailGenerator
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import ThumbnailGenerator = require('../')
|
||||
// import ThumbnailGenerator from '..'
|
||||
// TODO implement
|
||||
|
|
|
|||
19
packages/@uppy/transloadit/types/index.d.ts
vendored
19
packages/@uppy/transloadit/types/index.d.ts
vendored
|
|
@ -1,25 +1,24 @@
|
|||
import type { PluginOptions, UppyFile, BasePlugin } from '@uppy/core'
|
||||
import TransloaditLocale from './generatedLocale'
|
||||
|
||||
declare module Transloadit {
|
||||
interface AssemblyParameters {
|
||||
interface AssemblyParameters {
|
||||
auth: {
|
||||
key: string,
|
||||
expires?: string
|
||||
}
|
||||
template_id?: string
|
||||
steps?: { [step: string]: object }
|
||||
steps?: { [step: string]: Record<string, unknown> }
|
||||
notify_url?: string
|
||||
fields?: { [name: string]: number | string }
|
||||
}
|
||||
|
||||
interface AssemblyOptions {
|
||||
interface AssemblyOptions {
|
||||
params: AssemblyParameters
|
||||
fields?: { [name: string]: number | string }
|
||||
signature?: string
|
||||
}
|
||||
|
||||
interface TransloaditOptionsBase extends PluginOptions {
|
||||
interface TransloaditOptionsBase extends PluginOptions {
|
||||
service?: string
|
||||
errorReporting?: boolean
|
||||
waitForEncoding?: boolean
|
||||
|
|
@ -28,19 +27,19 @@ declare module Transloadit {
|
|||
alwaysRunAssembly?: boolean
|
||||
locale?: TransloaditLocale
|
||||
limit?: number
|
||||
}
|
||||
}
|
||||
|
||||
// Either have a getAssemblyOptions() that returns an AssemblyOptions, *or* have them embedded in the options
|
||||
type TransloaditOptions = TransloaditOptionsBase &
|
||||
// Either have a getAssemblyOptions() that returns an AssemblyOptions, *or* have them embedded in the options
|
||||
type TransloaditOptions = TransloaditOptionsBase &
|
||||
(
|
||||
| {
|
||||
getAssemblyOptions?: (file: UppyFile) => AssemblyOptions | Promise<AssemblyOptions>
|
||||
}
|
||||
| AssemblyOptions)
|
||||
}
|
||||
|
||||
declare class Transloadit extends BasePlugin<Transloadit.TransloaditOptions> {
|
||||
declare class Transloadit extends BasePlugin<TransloaditOptions> {
|
||||
static COMPANION: string
|
||||
|
||||
static COMPANION_PATTERN: RegExp
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { expectError, expectType } from 'tsd'
|
||||
import Uppy from '@uppy/core'
|
||||
import type { UppyFile } from '@uppy/core'
|
||||
import Transloadit from '../'
|
||||
import Transloadit from '..'
|
||||
|
||||
expectType<string>(Transloadit.COMPANION)
|
||||
expectType<RegExp>(Transloadit.COMPANION_PATTERN)
|
||||
|
||||
const validParams = {
|
||||
auth: { key: 'not so secret key' }
|
||||
auth: { key: 'not so secret key' },
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -22,8 +22,8 @@ const validParams = {
|
|||
importFromUploadURLs: false,
|
||||
params: {
|
||||
auth: { key: 'abc' },
|
||||
steps: {}
|
||||
}
|
||||
steps: {},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -46,22 +46,22 @@ const validParams = {
|
|||
expectError(
|
||||
uppy.use(Transloadit, {
|
||||
params: {
|
||||
auth: { key: null }
|
||||
}
|
||||
auth: { key: null },
|
||||
},
|
||||
})
|
||||
)
|
||||
expectError(
|
||||
uppy.use(Transloadit, {
|
||||
params: {
|
||||
auth: { key: 'abc' },
|
||||
steps: 'test'
|
||||
}
|
||||
steps: 'test',
|
||||
},
|
||||
})
|
||||
)
|
||||
uppy.use(Transloadit, {
|
||||
params: {
|
||||
auth: { key: 'abc' },
|
||||
steps: { name: {} }
|
||||
}
|
||||
steps: { name: {} },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
6
packages/@uppy/tus/types/index.d.ts
vendored
6
packages/@uppy/tus/types/index.d.ts
vendored
|
|
@ -1,7 +1,6 @@
|
|||
import type { PluginOptions, BasePlugin } from '@uppy/core'
|
||||
import type { UploadOptions } from 'tus-js-client'
|
||||
|
||||
declare module Tus {
|
||||
type TusUploadOptions = Pick<UploadOptions, Exclude<keyof UploadOptions,
|
||||
| 'fingerprint'
|
||||
| 'metadata'
|
||||
|
|
@ -13,14 +12,13 @@ declare module Tus {
|
|||
| 'uploadSize'
|
||||
>>
|
||||
|
||||
export interface TusOptions extends PluginOptions, TusUploadOptions {
|
||||
export interface TusOptions extends PluginOptions, TusUploadOptions {
|
||||
metaFields?: string[] | null
|
||||
limit?: number
|
||||
useFastRemoteRetry?: boolean
|
||||
withCredentials?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
declare class Tus extends BasePlugin<Tus.TusOptions> {}
|
||||
declare class Tus extends BasePlugin<TusOptions> {}
|
||||
|
||||
export default Tus
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import Tus = require('../')
|
||||
// import Tus from '../'
|
||||
|
|
|
|||
6
packages/@uppy/unsplash/types/index.d.ts
vendored
6
packages/@uppy/unsplash/types/index.d.ts
vendored
|
|
@ -1,14 +1,12 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { RequestClientOptions } from '@uppy/companion-client'
|
||||
|
||||
declare module Unsplash {
|
||||
interface UnsplashOptions extends PluginOptions, RequestClientOptions {
|
||||
interface UnsplashOptions extends PluginOptions, RequestClientOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
}
|
||||
}
|
||||
|
||||
declare class Unsplash extends UIPlugin<Unsplash.UnsplashOptions> {}
|
||||
declare class Unsplash extends UIPlugin<UnsplashOptions> {}
|
||||
|
||||
export default Unsplash
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import Unsplash = require('../')
|
||||
// import Unsplash from '../'
|
||||
// TODO implement
|
||||
|
|
|
|||
6
packages/@uppy/url/types/index.d.ts
vendored
6
packages/@uppy/url/types/index.d.ts
vendored
|
|
@ -2,15 +2,13 @@ import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
|||
import type { RequestClientOptions } from '@uppy/companion-client'
|
||||
import UrlLocale from './generatedLocale'
|
||||
|
||||
declare module Url {
|
||||
export interface UrlOptions extends PluginOptions, RequestClientOptions {
|
||||
export interface UrlOptions extends PluginOptions, RequestClientOptions {
|
||||
replaceTargetContent?: boolean
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
locale?: UrlLocale
|
||||
}
|
||||
}
|
||||
|
||||
declare class Url extends UIPlugin<Url.UrlOptions> {}
|
||||
declare class Url extends UIPlugin<UrlOptions> {}
|
||||
|
||||
export default Url
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import Url = require('../')
|
||||
// import Url from '../'
|
||||
// TODO implement
|
||||
|
|
|
|||
24
packages/@uppy/utils/types/index.d.ts
vendored
24
packages/@uppy/utils/types/index.d.ts
vendored
|
|
@ -10,8 +10,10 @@ declare module '@uppy/utils/lib/Translator' {
|
|||
|
||||
class Translator {
|
||||
constructor (opts: Translator.Locale | Translator.Locale[])
|
||||
translate (key: string, options: object): string
|
||||
translateArray (key: string, options: object): any[]
|
||||
|
||||
translate (key: string, options: Record<string, unknown>): string
|
||||
|
||||
translateArray (key: string, options: Record<string, unknown>): any[]
|
||||
}
|
||||
|
||||
export = Translator
|
||||
|
|
@ -28,7 +30,9 @@ declare module '@uppy/utils/lib/EventTracker' {
|
|||
|
||||
class EventTracker {
|
||||
constructor (emitter: EventTracker.Emitter)
|
||||
|
||||
on (event: string, handler: EventTracker.EventHandler): void
|
||||
|
||||
remove (): void
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +42,9 @@ declare module '@uppy/utils/lib/EventTracker' {
|
|||
declare module '@uppy/utils/lib/ProgressTimeout' {
|
||||
class ProgressTimeout {
|
||||
constructor (timeout: number, timeoutHandler: () => void)
|
||||
|
||||
progress (): void
|
||||
|
||||
done (): void
|
||||
}
|
||||
export = ProgressTimeout
|
||||
|
|
@ -59,10 +65,12 @@ declare module '@uppy/utils/lib/RateLimitedQueue' {
|
|||
|
||||
export class RateLimitedQueue {
|
||||
constructor(limit: number)
|
||||
|
||||
run(
|
||||
fn: () => RateLimitedQueue.AbortFunction,
|
||||
queueOptions?: RateLimitedQueue.QueueOptions
|
||||
): RateLimitedQueue.QueueEntry
|
||||
|
||||
wrapPromiseFunction(
|
||||
fn: () => RateLimitedQueue.PromiseFunction,
|
||||
queueOptions?: RateLimitedQueue.QueueOptions
|
||||
|
|
@ -107,7 +115,7 @@ declare module '@uppy/utils/lib/emitSocketProgress' {
|
|||
}
|
||||
|
||||
function emitSocketProgress (
|
||||
uploader: object,
|
||||
uploader: unknown,
|
||||
progressData: ProgressData,
|
||||
file: UppyUtils.UppyFile
|
||||
): void
|
||||
|
|
@ -140,7 +148,7 @@ declare module '@uppy/utils/lib/getBytesRemaining' {
|
|||
}
|
||||
|
||||
declare module '@uppy/utils/lib/getETA' {
|
||||
function getETA (progress: object): number
|
||||
function getETA (progress: unknown): number
|
||||
export = getETA
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +239,7 @@ declare module '@uppy/utils/lib/toArray' {
|
|||
declare module '@uppy/utils/lib/getDroppedFiles' {
|
||||
function getDroppedFiles (
|
||||
dataTransfer: DataTransfer,
|
||||
options?: object
|
||||
options?: Record<string, unknown>
|
||||
): Promise<File[]>
|
||||
export = getDroppedFiles
|
||||
}
|
||||
|
|
@ -264,7 +272,7 @@ declare module '@uppy/utils' {
|
|||
remote?: {
|
||||
host: string
|
||||
url: string
|
||||
body?: object
|
||||
body?: Record<string, unknown>
|
||||
}
|
||||
size: number
|
||||
source?: string
|
||||
|
|
@ -276,8 +284,8 @@ declare module '@uppy/utils' {
|
|||
}
|
||||
}
|
||||
export interface Store {
|
||||
getState (): object
|
||||
setState (patch: object): void
|
||||
getState (): Record<string, unknown>
|
||||
setState (patch: Record<string, unknown>): void
|
||||
subscribe (listener: any): () => void
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
packages/@uppy/vue/types/dashboard-modal.d.ts
vendored
12
packages/@uppy/vue/types/dashboard-modal.d.ts
vendored
|
|
@ -1,13 +1,13 @@
|
|||
import Vue from 'vue';
|
||||
import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core';
|
||||
import type DashboardPlugin from '@uppy/dashboard';
|
||||
import Vue from 'vue'
|
||||
import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core'
|
||||
import type DashboardPlugin from '@uppy/dashboard'
|
||||
|
||||
interface Data {
|
||||
plugin: DashboardPlugin;
|
||||
}
|
||||
interface Props {
|
||||
uppy: Uppy;
|
||||
props: Object;
|
||||
props: Record<string, unknown>;
|
||||
plugins: Array<UIPlugin | BasePlugin>
|
||||
open: boolean;
|
||||
}
|
||||
|
|
@ -15,5 +15,5 @@ interface Methods {
|
|||
installPlugin(): void;
|
||||
uninstallPlugin(uppy: Uppy): void;
|
||||
}
|
||||
declare const _default: import("vue/types/vue").ExtendedVue<Vue, Data, Methods, unknown, Props>;
|
||||
export default _default;
|
||||
declare const exports: import('vue/types/vue').ExtendedVue<Vue, Data, Methods, unknown, Props>
|
||||
export default exports
|
||||
|
|
|
|||
12
packages/@uppy/vue/types/dashboard.d.ts
vendored
12
packages/@uppy/vue/types/dashboard.d.ts
vendored
|
|
@ -1,18 +1,18 @@
|
|||
import Vue from 'vue';
|
||||
import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core';
|
||||
import type DashboardPlugin from '@uppy/dashboard';
|
||||
import Vue from 'vue'
|
||||
import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core'
|
||||
import type DashboardPlugin from '@uppy/dashboard'
|
||||
|
||||
interface Data {
|
||||
plugin: DashboardPlugin;
|
||||
}
|
||||
interface Props {
|
||||
uppy: Uppy;
|
||||
props: Object;
|
||||
props: Record<string, unknown>;
|
||||
plugins: Array<UIPlugin | BasePlugin>
|
||||
}
|
||||
interface Methods {
|
||||
installPlugin(): void;
|
||||
uninstallPlugin(uppy: Uppy): void;
|
||||
}
|
||||
declare const _default: import("vue/types/vue").ExtendedVue<Vue, Data, Methods, unknown, Props>;
|
||||
export default _default;
|
||||
declare const exports: import('vue/types/vue').ExtendedVue<Vue, Data, Methods, unknown, Props>
|
||||
export default exports
|
||||
|
|
|
|||
10
packages/@uppy/vue/types/drag-drop.d.ts
vendored
10
packages/@uppy/vue/types/drag-drop.d.ts
vendored
|
|
@ -1,17 +1,17 @@
|
|||
import Vue from 'vue';
|
||||
import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core';
|
||||
import Vue from 'vue'
|
||||
import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core'
|
||||
|
||||
interface Data {
|
||||
plugin: UIPlugin | BasePlugin;
|
||||
}
|
||||
interface Props {
|
||||
uppy: Uppy;
|
||||
props: Object;
|
||||
props: Record<string, unknown>;
|
||||
}
|
||||
interface Methods {
|
||||
installPlugin(): void;
|
||||
uninstallPlugin(uppy: Uppy): void;
|
||||
}
|
||||
declare const _default: import("vue/types/vue").ExtendedVue<Vue, Data, Methods, unknown, Props>;
|
||||
declare const exports: import('vue/types/vue').ExtendedVue<Vue, Data, Methods, unknown, Props>
|
||||
|
||||
export default _default;
|
||||
export default exports
|
||||
|
|
|
|||
10
packages/@uppy/vue/types/index.d.ts
vendored
10
packages/@uppy/vue/types/index.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
export { default as Dashboard } from './dashboard';
|
||||
export { default as DashboardModal } from './dashboard-modal';
|
||||
export { default as DragDrop } from './drag-drop';
|
||||
export { default as ProgressBar } from './progress-bar';
|
||||
export { default as StatusBar } from './status-bar';
|
||||
export { default as Dashboard } from './dashboard'
|
||||
export { default as DashboardModal } from './dashboard-modal'
|
||||
export { default as DragDrop } from './drag-drop'
|
||||
export { default as ProgressBar } from './progress-bar'
|
||||
export { default as StatusBar } from './status-bar'
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue