Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Oct 7, 2024
1 parent cfd5828 commit 4ac14ca
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 70 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"build:angular": "yarn workspace angular build",
"build:js:typeless": "npm-run-all build:lib build:companion build:svelte",
"build:js": "npm-run-all build:js:typeless build:locale-pack build:angular build:bundle",
"build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte validate",
"build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte check",
"build:lib": "yarn node ./bin/build-lib.js",
"build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.ts --fix && yarn workspace @uppy-dev/locale-pack test unused",
"build": "npm-run-all --serial build:ts --parallel build:js build:css --serial size",
Expand Down
30 changes: 17 additions & 13 deletions packages/@uppy/svelte/src/lib/components/Dashboard.svelte
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<script lang="ts" generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body">
<script
lang="ts"
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
>
import { onMount, onDestroy } from 'svelte'
import type { Uppy } from '@uppy/core';
import type { Uppy } from '@uppy/core'
import DashboardPlugin from '@uppy/dashboard'
let container: HTMLElement;
let plugin: DashboardPlugin<M, B>;
let container: HTMLElement
let plugin: DashboardPlugin<M, B>
export let uppy: Uppy<M, B>;
export let props: Object | undefined = {};
export let plugins: string[] = [];
export let uppy: Uppy<M, B>
export let props: Object | undefined = {}
export let plugins: string[] = []
const installPlugin = () => {
const options = {
id: 'svelte:Dashboard',
inline: true,
plugins,
...props,
target: container
target: container,
}
uppy.use(DashboardPlugin, options);
plugin = uppy.getPlugin(options.id) as DashboardPlugin<M, B>;
uppy.use(DashboardPlugin, options)
plugin = uppy.getPlugin(options.id) as DashboardPlugin<M, B>
}
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
if (plugin != null) uppyInstance.removePlugin(plugin);
if (plugin != null) uppyInstance.removePlugin(plugin)
}
onMount(() => installPlugin())
Expand All @@ -35,9 +38,10 @@
inline: true,
plugins,
...props,
target: container
target: container,
}
uppy.setOptions(options)
}
</script>
<div class="uppy-Container" bind:this={container} />

<div class="uppy-Container" bind:this={container}></div>
40 changes: 22 additions & 18 deletions packages/@uppy/svelte/src/lib/components/DashboardModal.svelte
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
<script lang="ts" generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body">
<script
lang="ts"
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
>
import { onMount, onDestroy } from 'svelte'
import type { Uppy } from '@uppy/core';
import type { Uppy } from '@uppy/core'
import DashboardPlugin from '@uppy/dashboard'
let container: HTMLElement;
let plugin: DashboardPlugin<M, B>;
let container: HTMLElement
let plugin: DashboardPlugin<M, B>
export let uppy: Uppy<M, B>;
export let props: Object | undefined = {};
export let open: boolean;
let lastOpen: boolean = open;
export let uppy: Uppy<M, B>
export let props: Object | undefined = {}
export let open: boolean
let lastOpen: boolean = open
export let plugins: string[] = [];
export let plugins: string[] = []
const installPlugin = () => {
const options = {
id: 'svelte:DashboardModal',
plugins,
...props,
target: container
target: container,
}
uppy.use(DashboardPlugin, options);
plugin = uppy.getPlugin(options.id) as DashboardPlugin<M, B>;
if(open) plugin.openModal();
uppy.use(DashboardPlugin, options)
plugin = uppy.getPlugin(options.id) as DashboardPlugin<M, B>
if (open) plugin.openModal()
}
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
if (plugin != null) uppyInstance.removePlugin(plugin);
if (plugin != null) uppyInstance.removePlugin(plugin)
}
onMount(() => installPlugin())
Expand All @@ -37,18 +40,19 @@
id: 'svelte:DashboardModal',
plugins,
...props,
target: container
target: container,
}
uppy.setOptions(options)
}
$: {
if(open && !lastOpen) {
if (open && !lastOpen) {
plugin.openModal()
}
if (!open && lastOpen) {
plugin.closeModal()
}
lastOpen = open;
lastOpen = open
}
</script>
<div class="uppy-Container" bind:this={container} />

<div class="uppy-Container" bind:this={container}></div>
28 changes: 16 additions & 12 deletions packages/@uppy/svelte/src/lib/components/DragDrop.svelte
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
<script lang="ts" generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body">
<script
lang="ts"
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
>
import { onMount, onDestroy } from 'svelte'
import type { Uppy } from '@uppy/core';
import type { Uppy } from '@uppy/core'
import DragDropPlugin from '@uppy/drag-drop'
let container: HTMLElement;
let plugin: DragDropPlugin<M, B>;
let container: HTMLElement
let plugin: DragDropPlugin<M, B>
export let uppy: Uppy<M, B>;
export let props: Object | undefined = {};
export let uppy: Uppy<M, B>
export let props: Object | undefined = {}
const installPlugin = () => {
const options = {
id: 'svelte:DragDrop',
inline: true,
...props,
target: container
target: container,
}
uppy.use(DragDropPlugin, options);
plugin = uppy.getPlugin(options.id) as DragDropPlugin<M, B>;
uppy.use(DragDropPlugin, options)
plugin = uppy.getPlugin(options.id) as DragDropPlugin<M, B>
}
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
if (plugin != null) uppyInstance.removePlugin(plugin);
if (plugin != null) uppyInstance.removePlugin(plugin)
}
onMount(() => installPlugin())
Expand All @@ -31,9 +34,10 @@
const options = {
id: 'svelte:DragDrop',
...props,
target: container
target: container,
}
uppy.setOptions(options)
}
</script>
<div class="uppy-Container" bind:this={container} />

<div class="uppy-Container" bind:this={container}></div>
30 changes: 17 additions & 13 deletions packages/@uppy/svelte/src/lib/components/ProgressBar.svelte
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
<script lang="ts" generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body">
<script
lang="ts"
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
>
import { onMount, onDestroy } from 'svelte'
import type { Uppy } from '@uppy/core';
import type { Uppy } from '@uppy/core'
import ProgressBarPlugin from '@uppy/progress-bar'
let container: HTMLElement;
let plugin: ProgressBarPlugin<M, B>;
export let uppy: Uppy<M, B>;
export let props: Object | undefined = {};
let container: HTMLElement
let plugin: ProgressBarPlugin<M, B>
export let uppy: Uppy<M, B>
export let props: Object | undefined = {}
const installPlugin = () => {
const options = {
id: 'svelte:ProgressBar',
inline: true,
...props,
target: container
target: container,
}
uppy.use(ProgressBarPlugin, options);
plugin = uppy.getPlugin(options.id) as ProgressBarPlugin<M, B>;
uppy.use(ProgressBarPlugin, options)
plugin = uppy.getPlugin(options.id) as ProgressBarPlugin<M, B>
}
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
if (plugin != null) uppyInstance.removePlugin(plugin);
if (plugin != null) uppyInstance.removePlugin(plugin)
}
onMount(() => installPlugin())
Expand All @@ -31,9 +34,10 @@
const options = {
id: 'svelte:ProgressBar',
...props,
target: container
target: container,
}
uppy.setOptions(options)
}
</script>
<div class="uppy-Container" bind:this={container} />

<div class="uppy-Container" bind:this={container}></div>
30 changes: 17 additions & 13 deletions packages/@uppy/svelte/src/lib/components/StatusBar.svelte
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
<script lang="ts" generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body">
<script
lang="ts"
generics="M extends import('@uppy/utils/lib/UppyFile').Meta, B extends import('@uppy/utils/lib/UppyFile').Body"
>
import { onMount, onDestroy } from 'svelte'
import type { Uppy } from '@uppy/core';
import type { Uppy } from '@uppy/core'
import StatusBarPlugin from '@uppy/status-bar'
let container: HTMLElement;
let plugin: StatusBarPlugin<M, B>;
export let uppy: Uppy<M, B>;
export let props: Object | undefined = {};
let container: HTMLElement
let plugin: StatusBarPlugin<M, B>
export let uppy: Uppy<M, B>
export let props: Object | undefined = {}
const installPlugin = () => {
const options = {
id: 'svelte:StatusBar',
inline: true,
...props,
target: container
target: container,
}
uppy.use(StatusBarPlugin, options);
plugin = uppy.getPlugin(options.id) as StatusBarPlugin<M, B>;
uppy.use(StatusBarPlugin, options)
plugin = uppy.getPlugin(options.id) as StatusBarPlugin<M, B>
}
const uninstallPlugin = (uppyInstance: Uppy<M, B> = uppy) => {
if (plugin != null) uppyInstance.removePlugin(plugin);
if (plugin != null) uppyInstance.removePlugin(plugin)
}
onMount(() => installPlugin())
Expand All @@ -31,9 +34,10 @@
const options = {
id: 'svelte:StatusBar',
...props,
target: container
target: container,
}
uppy.setOptions(options)
}
</script>
<div class="uppy-Container" bind:this={container} />

<div class="uppy-Container" bind:this={container}></div>

0 comments on commit 4ac14ca

Please sign in to comment.