mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
parent
1cad31b236
commit
4aa708a095
6 changed files with 32 additions and 30 deletions
5
.changeset/curvy-ravens-drum.md
Normal file
5
.changeset/curvy-ravens-drum.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@uppy/svelte": patch
|
||||
---
|
||||
|
||||
Fix prop passing and types
|
||||
|
|
@ -3,15 +3,15 @@
|
|||
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
|
||||
>
|
||||
import type { Uppy } from "@uppy/core";
|
||||
import DashboardPlugin from "@uppy/dashboard";
|
||||
import DashboardPlugin, { type DashboardOptions } from "@uppy/dashboard";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
let container: HTMLElement;
|
||||
let plugin: DashboardPlugin<M, B>;
|
||||
|
||||
export let uppy: Uppy<M, B>;
|
||||
export const props: Object | undefined = {};
|
||||
export const plugins: string[] = [];
|
||||
export let props: DashboardOptions<M, B> | undefined = {};
|
||||
export let plugins: string[] = [];
|
||||
|
||||
const installPlugin = () => {
|
||||
const options = {
|
||||
|
|
@ -20,9 +20,9 @@ const installPlugin = () => {
|
|||
plugins,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies DashboardOptions<M, B>;
|
||||
|
||||
uppy.use(DashboardPlugin, options);
|
||||
uppy.use(DashboardPlugin<M, B>, options);
|
||||
plugin = uppy.getPlugin(options.id) as DashboardPlugin<M, B>;
|
||||
};
|
||||
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
|
||||
|
|
@ -39,7 +39,7 @@ $: {
|
|||
plugins,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies DashboardOptions<M, B>;
|
||||
uppy.setOptions(options);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
|
||||
>
|
||||
import type { Uppy } from "@uppy/core";
|
||||
import DashboardPlugin from "@uppy/dashboard";
|
||||
import DashboardPlugin, { type DashboardOptions } from "@uppy/dashboard";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
let container: HTMLElement;
|
||||
let plugin: DashboardPlugin<M, B>;
|
||||
|
||||
export let uppy: Uppy<M, B>;
|
||||
export const props: Object | undefined = {};
|
||||
export let props: DashboardOptions<M, B> | undefined = {};
|
||||
export let open: boolean;
|
||||
let lastOpen: boolean = open;
|
||||
|
||||
export const plugins: string[] = [];
|
||||
export let plugins: string[] = [];
|
||||
|
||||
const installPlugin = () => {
|
||||
const options = {
|
||||
|
|
@ -22,9 +22,9 @@ const installPlugin = () => {
|
|||
plugins,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies DashboardOptions<M, B>;
|
||||
|
||||
uppy.use(DashboardPlugin, options);
|
||||
uppy.use(DashboardPlugin<M, B>, options);
|
||||
plugin = uppy.getPlugin(options.id) as DashboardPlugin<M, B>;
|
||||
if (open) plugin.openModal();
|
||||
};
|
||||
|
|
@ -41,7 +41,7 @@ $: {
|
|||
plugins,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies DashboardOptions<M, B>;
|
||||
uppy.setOptions(options);
|
||||
}
|
||||
$: {
|
||||
|
|
|
|||
|
|
@ -3,24 +3,23 @@
|
|||
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
|
||||
>
|
||||
import type { Uppy } from "@uppy/core";
|
||||
import DragDropPlugin from "@uppy/drag-drop";
|
||||
import DragDropPlugin, { type DragDropOptions } from "@uppy/drag-drop";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
let container: HTMLElement;
|
||||
let plugin: DragDropPlugin<M, B>;
|
||||
|
||||
export let uppy: Uppy<M, B>;
|
||||
export const props: Object | undefined = {};
|
||||
export let props: DragDropOptions | undefined = {};
|
||||
|
||||
const installPlugin = () => {
|
||||
const options = {
|
||||
id: "svelte:DragDrop",
|
||||
inline: true,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies DragDropOptions;
|
||||
|
||||
uppy.use(DragDropPlugin, options);
|
||||
uppy.use(DragDropPlugin<M, B>, options);
|
||||
plugin = uppy.getPlugin(options.id) as DragDropPlugin<M, B>;
|
||||
};
|
||||
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
|
||||
|
|
@ -35,7 +34,7 @@ $: {
|
|||
id: "svelte:DragDrop",
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies DragDropOptions;
|
||||
uppy.setOptions(options);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,24 +3,23 @@
|
|||
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
|
||||
>
|
||||
import type { Uppy } from "@uppy/core";
|
||||
import ProgressBarPlugin from "@uppy/progress-bar";
|
||||
import ProgressBarPlugin, { type ProgressBarOptions } from "@uppy/progress-bar";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
let container: HTMLElement;
|
||||
let plugin: ProgressBarPlugin<M, B>;
|
||||
|
||||
export let uppy: Uppy<M, B>;
|
||||
export const props: Object | undefined = {};
|
||||
export let props: ProgressBarOptions | undefined = {};
|
||||
|
||||
const installPlugin = () => {
|
||||
const options = {
|
||||
id: "svelte:ProgressBar",
|
||||
inline: true,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies ProgressBarOptions;
|
||||
|
||||
uppy.use(ProgressBarPlugin, options);
|
||||
uppy.use(ProgressBarPlugin<M, B>, options);
|
||||
plugin = uppy.getPlugin(options.id) as ProgressBarPlugin<M, B>;
|
||||
};
|
||||
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
|
||||
|
|
@ -35,7 +34,7 @@ $: {
|
|||
id: "svelte:ProgressBar",
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies ProgressBarOptions;
|
||||
uppy.setOptions(options);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,24 +3,23 @@
|
|||
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
|
||||
>
|
||||
import type { Uppy } from "@uppy/core";
|
||||
import StatusBarPlugin from "@uppy/status-bar";
|
||||
import StatusBarPlugin, { type StatusBarOptions } from "@uppy/status-bar";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
let container: HTMLElement;
|
||||
let plugin: StatusBarPlugin<M, B>;
|
||||
|
||||
export let uppy: Uppy<M, B>;
|
||||
export const props: Object | undefined = {};
|
||||
export let props: StatusBarOptions | undefined = {};
|
||||
|
||||
const installPlugin = () => {
|
||||
const options = {
|
||||
id: "svelte:StatusBar",
|
||||
inline: true,
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies StatusBarOptions;
|
||||
|
||||
uppy.use(StatusBarPlugin, options);
|
||||
uppy.use(StatusBarPlugin<M, B>, options);
|
||||
plugin = uppy.getPlugin(options.id) as StatusBarPlugin<M, B>;
|
||||
};
|
||||
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
|
||||
|
|
@ -35,7 +34,7 @@ $: {
|
|||
id: "svelte:StatusBar",
|
||||
...props,
|
||||
target: container,
|
||||
};
|
||||
} satisfies StatusBarOptions;
|
||||
uppy.setOptions(options);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue