use-tus 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +71 -30
  2. package/dist/TusClientProvider/TusClientProvider.d.ts +6 -3
  3. package/dist/TusClientProvider/constants.d.ts +4 -0
  4. package/dist/TusClientProvider/index.d.ts +3 -2
  5. package/dist/{core → TusClientProvider/store}/contexts.d.ts +3 -3
  6. package/dist/{core → TusClientProvider/store}/tucClientActions.d.ts +9 -10
  7. package/dist/{core → TusClientProvider/store}/tusClientReducer.d.ts +5 -5
  8. package/dist/TusClientProvider/types.d.ts +2 -0
  9. package/dist/__stories__/Basic.stories.d.ts +1 -1
  10. package/dist/__stories__/CacheKey.stories.d.ts +1 -1
  11. package/dist/__stories__/DefaultOptions.stories.d.ts +1 -1
  12. package/dist/__stories__/components/BasicButton/BasicButton.d.ts +4 -4
  13. package/dist/__stories__/components/BasicButton/index.d.ts +1 -1
  14. package/dist/__stories__/components/LoadingCircle/LoadingCircle.d.ts +2 -2
  15. package/dist/__stories__/components/LoadingCircle/index.d.ts +1 -1
  16. package/dist/__stories__/components/ProgressBar/ProgressBar.d.ts +2 -2
  17. package/dist/__stories__/components/ProgressBar/index.d.ts +1 -1
  18. package/dist/__stories__/components/UploadIcon/UploadIcon.d.ts +2 -2
  19. package/dist/__stories__/components/UploadIcon/index.d.ts +1 -1
  20. package/dist/__tests__/useTusStore.test.d.ts +1 -0
  21. package/dist/__tests__/utils/getDefaultOptions.d.ts +2 -0
  22. package/dist/__tests__/utils/mock.d.ts +6 -1
  23. package/dist/index.cjs.js +266 -343
  24. package/dist/index.d.ts +3 -4
  25. package/dist/index.esm.js +267 -324
  26. package/dist/index.js +175 -211
  27. package/dist/useTus/index.d.ts +3 -2
  28. package/dist/useTus/types.d.ts +8 -9
  29. package/dist/useTus/useTus.d.ts +2 -2
  30. package/dist/useTus/useTusStore.d.ts +2 -0
  31. package/dist/useTus/utils/createUpload.d.ts +7 -0
  32. package/dist/useTus/utils/startOrResumeUpload.d.ts +2 -0
  33. package/dist/useTus/utils/useAutoAbort.d.ts +2 -0
  34. package/dist/useTus/utils/useMergeTusOptions.d.ts +6 -0
  35. package/dist/useTusClient/index.d.ts +1 -1
  36. package/dist/useTusClient/useTusClient.d.ts +1 -1
  37. package/package.json +9 -10
  38. package/dist/TusClientProvider/TusController.d.ts +0 -4
  39. package/dist/core/constants.d.ts +0 -4
  40. package/dist/core/tusHandler.d.ts +0 -17
  41. package/dist/core/types.d.ts +0 -8
  42. package/dist/useTus/utils.d.ts +0 -16
  43. package/dist/utils/uid.d.ts +0 -1
@@ -1,17 +0,0 @@
1
- import * as tus from 'tus-js-client';
2
- import { Upload } from 'tus-js-client';
3
- export declare type DefaultOptions = (file: Upload['file']) => tus.UploadOptions;
4
- export declare type TusConfigs = Partial<{
5
- canStoreURLs: boolean;
6
- defaultOptions: DefaultOptions;
7
- }>;
8
- export declare type Tus = Readonly<Omit<typeof tus, 'defaultOptions'> & Required<TusConfigs>>;
9
- export declare const initialDefaultOptions: DefaultOptions;
10
- export declare class TusHandler {
11
- private tus;
12
- constructor(tusConfigs?: TusConfigs);
13
- get getTus(): Readonly<Omit<typeof tus, "defaultOptions"> & Required<Partial<{
14
- canStoreURLs: boolean;
15
- defaultOptions: DefaultOptions;
16
- }>>>;
17
- }
@@ -1,8 +0,0 @@
1
- import { Upload } from 'tus-js-client';
2
- export declare type BaseUseTusResult = {
3
- upload?: Upload;
4
- setUpload: (file: Upload['file'], options?: Upload['options']) => void;
5
- isSuccess: boolean;
6
- error?: Error;
7
- };
8
- export declare type BaseUseTusOptions = {};
@@ -1,16 +0,0 @@
1
- import { SetStateAction } from 'react';
2
- import { Upload } from 'tus-js-client';
3
- import { TusClientActions } from '../core/tucClientActions';
4
- import { UseTusOptions, UseTusState } from './types';
5
- export declare type Dispatcher = {
6
- dispatch: (value: TusClientActions) => void;
7
- internalDispatch: (value: SetStateAction<UseTusState>) => void;
8
- cacheKey: UseTusOptions['cacheKey'];
9
- };
10
- declare type OptionHandler = Pick<Upload['options'], 'onError' | 'onSuccess'>;
11
- declare type CreateUpload = (file: Upload['file'], options: Upload['options'], dispatcher: Dispatcher) => Upload;
12
- declare type CreateOptionHandler = (handlers: OptionHandler, dispatcher: Dispatcher) => OptionHandler;
13
- export declare const createOptionHandler: CreateOptionHandler;
14
- export declare const startOrResumeUpload: (upload: Upload) => void;
15
- export declare const createUpload: CreateUpload;
16
- export {};
@@ -1 +0,0 @@
1
- export declare const createUid: () => string;