@useupup/svelte 3.3.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.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/UpupUploader.svelte +96 -0
- package/dist/UpupUploader.svelte.d.ts +5 -0
- package/dist/UpupUploader.svelte.d.ts.map +1 -0
- package/dist/assets/logos.d.ts +5 -0
- package/dist/assets/logos.d.ts.map +1 -0
- package/dist/assets/logos.js +4 -0
- package/dist/components/AudioUploader.svelte +220 -0
- package/dist/components/AudioUploader.svelte.d.ts +4 -0
- package/dist/components/AudioUploader.svelte.d.ts.map +1 -0
- package/dist/components/AudioWaveform.svelte +72 -0
- package/dist/components/AudioWaveform.svelte.d.ts +7 -0
- package/dist/components/AudioWaveform.svelte.d.ts.map +1 -0
- package/dist/components/BoxUploader.svelte +17 -0
- package/dist/components/BoxUploader.svelte.d.ts +19 -0
- package/dist/components/BoxUploader.svelte.d.ts.map +1 -0
- package/dist/components/CameraUploader.svelte +140 -0
- package/dist/components/CameraUploader.svelte.d.ts +4 -0
- package/dist/components/CameraUploader.svelte.d.ts.map +1 -0
- package/dist/components/ClientBoxUploader.svelte +60 -0
- package/dist/components/ClientBoxUploader.svelte.d.ts +19 -0
- package/dist/components/ClientBoxUploader.svelte.d.ts.map +1 -0
- package/dist/components/ClientDropboxUploader.svelte +60 -0
- package/dist/components/ClientDropboxUploader.svelte.d.ts +19 -0
- package/dist/components/ClientDropboxUploader.svelte.d.ts.map +1 -0
- package/dist/components/ClientGoogleDriveUploader.svelte +57 -0
- package/dist/components/ClientGoogleDriveUploader.svelte.d.ts +19 -0
- package/dist/components/ClientGoogleDriveUploader.svelte.d.ts.map +1 -0
- package/dist/components/ClientOneDriveUploader.svelte +60 -0
- package/dist/components/ClientOneDriveUploader.svelte.d.ts +19 -0
- package/dist/components/ClientOneDriveUploader.svelte.d.ts.map +1 -0
- package/dist/components/DefaultAddMoreIcon.svelte +11 -0
- package/dist/components/DefaultAddMoreIcon.svelte.d.ts +8 -0
- package/dist/components/DefaultAddMoreIcon.svelte.d.ts.map +1 -0
- package/dist/components/DefaultLoaderIcon.svelte +5 -0
- package/dist/components/DefaultLoaderIcon.svelte.d.ts +19 -0
- package/dist/components/DefaultLoaderIcon.svelte.d.ts.map +1 -0
- package/dist/components/DropboxUploader.svelte +17 -0
- package/dist/components/DropboxUploader.svelte.d.ts +19 -0
- package/dist/components/DropboxUploader.svelte.d.ts.map +1 -0
- package/dist/components/EmptyIcon.svelte +3 -0
- package/dist/components/EmptyIcon.svelte.d.ts +19 -0
- package/dist/components/EmptyIcon.svelte.d.ts.map +1 -0
- package/dist/components/FileHero.svelte +152 -0
- package/dist/components/FileHero.svelte.d.ts +8 -0
- package/dist/components/FileHero.svelte.d.ts.map +1 -0
- package/dist/components/FileIcon.svelte +23 -0
- package/dist/components/FileIcon.svelte.d.ts +8 -0
- package/dist/components/FileIcon.svelte.d.ts.map +1 -0
- package/dist/components/FileItem.svelte +95 -0
- package/dist/components/FileItem.svelte.d.ts +12 -0
- package/dist/components/FileItem.svelte.d.ts.map +1 -0
- package/dist/components/FileList.svelte +442 -0
- package/dist/components/FileList.svelte.d.ts +4 -0
- package/dist/components/FileList.svelte.d.ts.map +1 -0
- package/dist/components/FilePreview.svelte +218 -0
- package/dist/components/FilePreview.svelte.d.ts +17 -0
- package/dist/components/FilePreview.svelte.d.ts.map +1 -0
- package/dist/components/FilePreviewPortal.svelte +189 -0
- package/dist/components/FilePreviewPortal.svelte.d.ts +12 -0
- package/dist/components/FilePreviewPortal.svelte.d.ts.map +1 -0
- package/dist/components/FilePreviewThumbnail.svelte +87 -0
- package/dist/components/FilePreviewThumbnail.svelte.d.ts +17 -0
- package/dist/components/FilePreviewThumbnail.svelte.d.ts.map +1 -0
- package/dist/components/FileRow.svelte +192 -0
- package/dist/components/FileRow.svelte.d.ts +10 -0
- package/dist/components/FileRow.svelte.d.ts.map +1 -0
- package/dist/components/GoogleDriveUploader.svelte +17 -0
- package/dist/components/GoogleDriveUploader.svelte.d.ts +19 -0
- package/dist/components/GoogleDriveUploader.svelte.d.ts.map +1 -0
- package/dist/components/Icon.svelte +24 -0
- package/dist/components/Icon.svelte.d.ts +10 -0
- package/dist/components/Icon.svelte.d.ts.map +1 -0
- package/dist/components/Icons.d.ts +10 -0
- package/dist/components/Icons.d.ts.map +1 -0
- package/dist/components/Icons.js +9 -0
- package/dist/components/ImageEditorStub.svelte +3 -0
- package/dist/components/ImageEditorStub.svelte.d.ts +19 -0
- package/dist/components/ImageEditorStub.svelte.d.ts.map +1 -0
- package/dist/components/OneDriveUploader.svelte +17 -0
- package/dist/components/OneDriveUploader.svelte.d.ts +19 -0
- package/dist/components/OneDriveUploader.svelte.d.ts.map +1 -0
- package/dist/components/ScreenCaptureUploader.svelte +254 -0
- package/dist/components/ScreenCaptureUploader.svelte.d.ts +4 -0
- package/dist/components/ScreenCaptureUploader.svelte.d.ts.map +1 -0
- package/dist/components/ServerModeDriveUploader.svelte +250 -0
- package/dist/components/ServerModeDriveUploader.svelte.d.ts +10 -0
- package/dist/components/ServerModeDriveUploader.svelte.d.ts.map +1 -0
- package/dist/components/SourceSelector.svelte +292 -0
- package/dist/components/SourceSelector.svelte.d.ts +19 -0
- package/dist/components/SourceSelector.svelte.d.ts.map +1 -0
- package/dist/components/SourceView.svelte +100 -0
- package/dist/components/SourceView.svelte.d.ts +4 -0
- package/dist/components/SourceView.svelte.d.ts.map +1 -0
- package/dist/components/TrashIcon.svelte +11 -0
- package/dist/components/TrashIcon.svelte.d.ts +8 -0
- package/dist/components/TrashIcon.svelte.d.ts.map +1 -0
- package/dist/components/UploaderPanel.svelte +363 -0
- package/dist/components/UploaderPanel.svelte.d.ts +4 -0
- package/dist/components/UploaderPanel.svelte.d.ts.map +1 -0
- package/dist/components/UrlUploader.svelte +71 -0
- package/dist/components/UrlUploader.svelte.d.ts +4 -0
- package/dist/components/UrlUploader.svelte.d.ts.map +1 -0
- package/dist/components/icons/AudioIcon.svelte +5 -0
- package/dist/components/icons/AudioIcon.svelte.d.ts +7 -0
- package/dist/components/icons/AudioIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/BoxIcon.svelte +5 -0
- package/dist/components/icons/BoxIcon.svelte.d.ts +7 -0
- package/dist/components/icons/BoxIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/CameraIcon.svelte +5 -0
- package/dist/components/icons/CameraIcon.svelte.d.ts +7 -0
- package/dist/components/icons/CameraIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/DropboxIcon.svelte +5 -0
- package/dist/components/icons/DropboxIcon.svelte.d.ts +7 -0
- package/dist/components/icons/DropboxIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/GoogleDriveIcon.svelte +5 -0
- package/dist/components/icons/GoogleDriveIcon.svelte.d.ts +7 -0
- package/dist/components/icons/GoogleDriveIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/LinkIcon.svelte +5 -0
- package/dist/components/icons/LinkIcon.svelte.d.ts +7 -0
- package/dist/components/icons/LinkIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/MyDeviceIcon.svelte +5 -0
- package/dist/components/icons/MyDeviceIcon.svelte.d.ts +7 -0
- package/dist/components/icons/MyDeviceIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/OneDriveIcon.svelte +5 -0
- package/dist/components/icons/OneDriveIcon.svelte.d.ts +7 -0
- package/dist/components/icons/OneDriveIcon.svelte.d.ts.map +1 -0
- package/dist/components/icons/ScreenCaptureIcon.svelte +5 -0
- package/dist/components/icons/ScreenCaptureIcon.svelte.d.ts +7 -0
- package/dist/components/icons/ScreenCaptureIcon.svelte.d.ts.map +1 -0
- package/dist/components/shared/DriveAuthFallback.svelte +60 -0
- package/dist/components/shared/DriveAuthFallback.svelte.d.ts +12 -0
- package/dist/components/shared/DriveAuthFallback.svelte.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowser.svelte +209 -0
- package/dist/components/shared/DriveBrowser.svelte.d.ts +25 -0
- package/dist/components/shared/DriveBrowser.svelte.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowserHeader.svelte +191 -0
- package/dist/components/shared/DriveBrowserHeader.svelte.d.ts +14 -0
- package/dist/components/shared/DriveBrowserHeader.svelte.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowserIcon.svelte +39 -0
- package/dist/components/shared/DriveBrowserIcon.svelte.d.ts +8 -0
- package/dist/components/shared/DriveBrowserIcon.svelte.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowserItem.svelte +63 -0
- package/dist/components/shared/DriveBrowserItem.svelte.d.ts +10 -0
- package/dist/components/shared/DriveBrowserItem.svelte.d.ts.map +1 -0
- package/dist/components/shared/FileSuccessCheck.svelte +47 -0
- package/dist/components/shared/FileSuccessCheck.svelte.d.ts +10 -0
- package/dist/components/shared/FileSuccessCheck.svelte.d.ts.map +1 -0
- package/dist/components/shared/ProgressBar.svelte +81 -0
- package/dist/components/shared/ProgressBar.svelte.d.ts +10 -0
- package/dist/components/shared/ProgressBar.svelte.d.ts.map +1 -0
- package/dist/components/shared/SourceViewContainer.svelte +27 -0
- package/dist/components/shared/SourceViewContainer.svelte.d.ts +10 -0
- package/dist/components/shared/SourceViewContainer.svelte.d.ts.map +1 -0
- package/dist/components/shared/UploaderHeader.svelte +156 -0
- package/dist/components/shared/UploaderHeader.svelte.d.ts +13 -0
- package/dist/components/shared/UploaderHeader.svelte.d.ts.map +1 -0
- package/dist/composables/use-tiles-per-row.d.ts +19 -0
- package/dist/composables/use-tiles-per-row.d.ts.map +1 -0
- package/dist/composables/use-tiles-per-row.js +30 -0
- package/dist/composables/useBox.d.ts +28 -0
- package/dist/composables/useBox.d.ts.map +1 -0
- package/dist/composables/useBox.js +61 -0
- package/dist/composables/useCameraUploader.d.ts +23 -0
- package/dist/composables/useCameraUploader.d.ts.map +1 -0
- package/dist/composables/useCameraUploader.js +114 -0
- package/dist/composables/useDropbox.d.ts +28 -0
- package/dist/composables/useDropbox.d.ts.map +1 -0
- package/dist/composables/useDropbox.js +61 -0
- package/dist/composables/useFetchFileByUrl.d.ts +9 -0
- package/dist/composables/useFetchFileByUrl.d.ts.map +1 -0
- package/dist/composables/useFetchFileByUrl.js +33 -0
- package/dist/composables/useGoogleDrive.d.ts +28 -0
- package/dist/composables/useGoogleDrive.d.ts.map +1 -0
- package/dist/composables/useGoogleDrive.js +65 -0
- package/dist/composables/useOneDrive.d.ts +29 -0
- package/dist/composables/useOneDrive.d.ts.map +1 -0
- package/dist/composables/useOneDrive.js +64 -0
- package/dist/composables/useSSEProcessing.d.ts +20 -0
- package/dist/composables/useSSEProcessing.d.ts.map +1 -0
- package/dist/composables/useSSEProcessing.js +17 -0
- package/dist/composables/useServerModeDrive.d.ts +17 -0
- package/dist/composables/useServerModeDrive.d.ts.map +1 -0
- package/dist/composables/useServerModeDrive.js +33 -0
- package/dist/composables/useSourceSelector.d.ts +13 -0
- package/dist/composables/useSourceSelector.d.ts.map +1 -0
- package/dist/composables/useSourceSelector.js +36 -0
- package/dist/composables/useUploaderPanel.d.ts +12 -0
- package/dist/composables/useUploaderPanel.d.ts.map +1 -0
- package/dist/composables/useUploaderPanel.js +43 -0
- package/dist/context/create-uploader-context.d.ts +4 -0
- package/dist/context/create-uploader-context.d.ts.map +1 -0
- package/dist/context/create-uploader-context.js +324 -0
- package/dist/context/source-view-header-extra.d.ts +14 -0
- package/dist/context/source-view-header-extra.d.ts.map +1 -0
- package/dist/context/source-view-header-extra.js +41 -0
- package/dist/context/uploader-context.d.ts +109 -0
- package/dist/context/uploader-context.d.ts.map +1 -0
- package/dist/context/uploader-context.js +96 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/lib/constants.d.ts +13 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +67 -0
- package/dist/lib/to-readable.d.ts +14 -0
- package/dist/lib/to-readable.d.ts.map +1 -0
- package/dist/lib/to-readable.js +15 -0
- package/dist/lib/view-mode.d.ts +24 -0
- package/dist/lib/view-mode.d.ts.map +1 -0
- package/dist/lib/view-mode.js +31 -0
- package/dist/shared/types.d.ts +15 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +1 -0
- package/dist/styles.d.ts +4 -0
- package/dist/tailwind-prefixed.css +2479 -0
- package/dist/tailwind.css +74 -0
- package/dist/use-upup-upload.d.ts +38 -0
- package/dist/use-upup-upload.d.ts.map +1 -0
- package/dist/use-upup-upload.js +81 -0
- package/package.json +101 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, onDestroy } from 'svelte'
|
|
3
|
+
import { formatUiMessage as t } from '@useupup/core'
|
|
4
|
+
import { cn } from '@useupup/core/internal'
|
|
5
|
+
import { fileGetIsImage, fileGetIsPdf, fileGetIsText, PREVIEW_MAX_TEXT_SIZE, PREVIEW_TEXT_TRUNCATE_LENGTH } from '@useupup/core/internal'
|
|
6
|
+
import { useUploaderI18n, useUploaderTheme } from '../context/uploader-context'
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
fileUrl,
|
|
10
|
+
fileName,
|
|
11
|
+
fileType,
|
|
12
|
+
fileSize,
|
|
13
|
+
onClose,
|
|
14
|
+
onStopPropagation,
|
|
15
|
+
}: {
|
|
16
|
+
fileUrl: string
|
|
17
|
+
fileName: string
|
|
18
|
+
fileType: string
|
|
19
|
+
fileSize?: number
|
|
20
|
+
onClose: () => void
|
|
21
|
+
onStopPropagation?: (e: MouseEvent) => void
|
|
22
|
+
} = $props()
|
|
23
|
+
|
|
24
|
+
const { isDark: dark, slotOverrides: slotClasses } = useUploaderTheme()
|
|
25
|
+
const { translations: tr } = useUploaderI18n()
|
|
26
|
+
|
|
27
|
+
const isImage = $derived(fileGetIsImage(fileType))
|
|
28
|
+
const isPdf = $derived(fileGetIsPdf(fileType, fileName))
|
|
29
|
+
const isText = $derived(fileGetIsText(fileType, fileName))
|
|
30
|
+
const isOversizedText = $derived(
|
|
31
|
+
isText && fileSize !== undefined && fileSize > PREVIEW_MAX_TEXT_SIZE,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
let textContent = $state('')
|
|
35
|
+
let textLoading = $state(false)
|
|
36
|
+
let textError = $state<string | undefined>(undefined)
|
|
37
|
+
let isTruncated = $state(false)
|
|
38
|
+
|
|
39
|
+
// Portal DOM node — SSR-safe: only accessed in onMount (client only)
|
|
40
|
+
let portalEl: HTMLDivElement | null = null
|
|
41
|
+
let containerEl: HTMLDivElement | null = $state(null)
|
|
42
|
+
|
|
43
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
44
|
+
if (event.key === 'Escape') onClose()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function loadText() {
|
|
48
|
+
if (!isText) return
|
|
49
|
+
try {
|
|
50
|
+
textLoading = true
|
|
51
|
+
if (isOversizedText) {
|
|
52
|
+
const res = await fetch(fileUrl)
|
|
53
|
+
const reader = res.body?.getReader()
|
|
54
|
+
if (!reader) throw new Error('Cannot read file')
|
|
55
|
+
const decoder = new TextDecoder()
|
|
56
|
+
let result = ''
|
|
57
|
+
let done = false
|
|
58
|
+
while (!done && result.length < PREVIEW_TEXT_TRUNCATE_LENGTH) {
|
|
59
|
+
const { value, done: streamDone } = await reader.read()
|
|
60
|
+
done = streamDone
|
|
61
|
+
if (value) result += decoder.decode(value, { stream: !done })
|
|
62
|
+
}
|
|
63
|
+
reader.cancel()
|
|
64
|
+
const wasTruncated = !done || result.length > PREVIEW_TEXT_TRUNCATE_LENGTH
|
|
65
|
+
if (wasTruncated) result = result.slice(0, PREVIEW_TEXT_TRUNCATE_LENGTH)
|
|
66
|
+
isTruncated = wasTruncated
|
|
67
|
+
textContent = result
|
|
68
|
+
} else {
|
|
69
|
+
const res = await fetch(fileUrl)
|
|
70
|
+
textContent = await res.text()
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
textError = (e as Error)?.message || 'Preview error'
|
|
74
|
+
} finally {
|
|
75
|
+
textLoading = false
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onBackdropClick() {
|
|
80
|
+
onClose()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function onContentClick(e: MouseEvent) {
|
|
84
|
+
onStopPropagation?.(e)
|
|
85
|
+
e.stopPropagation()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onMount(() => {
|
|
89
|
+
// Create a wrapper div and move the rendered content into document.body (portal)
|
|
90
|
+
portalEl = document.createElement('div')
|
|
91
|
+
document.body.appendChild(portalEl)
|
|
92
|
+
if (containerEl) portalEl.appendChild(containerEl)
|
|
93
|
+
|
|
94
|
+
window.addEventListener('keydown', handleKeyDown)
|
|
95
|
+
loadText()
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
onDestroy(() => {
|
|
99
|
+
window.removeEventListener('keydown', handleKeyDown)
|
|
100
|
+
if (portalEl && document.body.contains(portalEl)) {
|
|
101
|
+
document.body.removeChild(portalEl)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<!-- Container rendered in-place initially; onMount moves it into document.body -->
|
|
107
|
+
<div bind:this={containerEl}>
|
|
108
|
+
<div class="upup-scope" data-upup-slot="file-preview-portal">
|
|
109
|
+
<div
|
|
110
|
+
class="upup-fixed upup-inset-0 upup-z-[2147483647] upup-flex upup-items-center upup-justify-center upup-bg-black/40"
|
|
111
|
+
role="dialog"
|
|
112
|
+
aria-modal="true"
|
|
113
|
+
aria-label={fileName}
|
|
114
|
+
tabindex={-1}
|
|
115
|
+
onclick={onBackdropClick}
|
|
116
|
+
onkeydown={(e) => { if (e.key === 'Escape') onClose() }}
|
|
117
|
+
>
|
|
118
|
+
<div class="upup-relative upup-h-[90vh] upup-w-[90vw] upup-p-4">
|
|
119
|
+
<div
|
|
120
|
+
class={cn(
|
|
121
|
+
'upup-absolute upup-inset-0 upup-m-4 upup-bg-white',
|
|
122
|
+
{ 'upup-bg-[#232323] dark:upup-bg-[#232323]': $dark },
|
|
123
|
+
$slotClasses.filePreviewPortal,
|
|
124
|
+
)}
|
|
125
|
+
role="presentation"
|
|
126
|
+
onclick={onContentClick}
|
|
127
|
+
onkeydown={undefined}
|
|
128
|
+
>
|
|
129
|
+
<button
|
|
130
|
+
type="button"
|
|
131
|
+
aria-label={tr.cancel}
|
|
132
|
+
class="upup-absolute upup-right-3 upup-top-3 upup-z-10 upup-flex upup-size-8 upup-items-center upup-justify-center upup-rounded-full upup-bg-black/70 upup-text-sm upup-font-semibold upup-text-white upup-shadow-sm hover:upup-bg-black focus:upup-outline-none focus:upup-ring-2 focus:upup-ring-white"
|
|
133
|
+
onclick={onClose}
|
|
134
|
+
>
|
|
135
|
+
x
|
|
136
|
+
</button>
|
|
137
|
+
|
|
138
|
+
{#if isImage}
|
|
139
|
+
<img
|
|
140
|
+
src={fileUrl}
|
|
141
|
+
alt={fileName}
|
|
142
|
+
class="upup-h-full upup-w-full upup-rounded upup-object-contain"
|
|
143
|
+
/>
|
|
144
|
+
{/if}
|
|
145
|
+
|
|
146
|
+
{#if isPdf}
|
|
147
|
+
<embed
|
|
148
|
+
src={fileUrl}
|
|
149
|
+
type="application/pdf"
|
|
150
|
+
width="100%"
|
|
151
|
+
height="100%"
|
|
152
|
+
class="upup-rounded"
|
|
153
|
+
title={fileName}
|
|
154
|
+
/>
|
|
155
|
+
{/if}
|
|
156
|
+
|
|
157
|
+
{#if !isImage && !isPdf}
|
|
158
|
+
{#if isText}
|
|
159
|
+
<div class="upup-h-full upup-w-full upup-overflow-auto upup-p-4 upup-font-mono upup-text-xs">
|
|
160
|
+
{#if textLoading}<p>{tr.loading}</p>{/if}
|
|
161
|
+
{#if textError}<p>{t(tr.previewError, { message: textError })}</p>{/if}
|
|
162
|
+
{#if !textLoading && !textError}
|
|
163
|
+
<pre class="upup-whitespace-pre-wrap">{textContent}</pre>
|
|
164
|
+
{#if isTruncated}
|
|
165
|
+
<div class="upup-mt-4 upup-rounded upup-border upup-border-yellow-500/30 upup-bg-yellow-500/10 upup-px-3 upup-py-2 upup-text-xs upup-text-yellow-400">
|
|
166
|
+
Content truncated - file is too large to preview in full.
|
|
167
|
+
</div>
|
|
168
|
+
{/if}
|
|
169
|
+
{/if}
|
|
170
|
+
</div>
|
|
171
|
+
{/if}
|
|
172
|
+
{#if !isText}
|
|
173
|
+
<object
|
|
174
|
+
data={fileUrl}
|
|
175
|
+
width="100%"
|
|
176
|
+
height="100%"
|
|
177
|
+
name={fileName}
|
|
178
|
+
title={fileName}
|
|
179
|
+
type={fileType}
|
|
180
|
+
>
|
|
181
|
+
<p>{tr.loading}</p>
|
|
182
|
+
</object>
|
|
183
|
+
{/if}
|
|
184
|
+
{/if}
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
fileUrl: string;
|
|
3
|
+
fileName: string;
|
|
4
|
+
fileType: string;
|
|
5
|
+
fileSize?: number;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onStopPropagation?: (e: MouseEvent) => void;
|
|
8
|
+
};
|
|
9
|
+
declare const FilePreviewPortal: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type FilePreviewPortal = ReturnType<typeof FilePreviewPortal>;
|
|
11
|
+
export default FilePreviewPortal;
|
|
12
|
+
//# sourceMappingURL=FilePreviewPortal.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilePreviewPortal.svelte.d.ts","sourceRoot":"","sources":["../../src/components/FilePreviewPortal.svelte.ts"],"names":[],"mappings":"AASC,KAAK,gBAAgB,GAAI;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;CAC5C,CAAC;AAsJJ,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Translations } from '@useupup/core'
|
|
3
|
+
import type { InternalFlatClassNames } from '@useupup/core/internal'
|
|
4
|
+
import { fileGetExtension, fileGetIsPdf, fileGetIsText, fileIs3D, cn } from '@useupup/core/internal'
|
|
5
|
+
import FileIcon from './FileIcon.svelte'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
canPreview,
|
|
9
|
+
fileType,
|
|
10
|
+
fileName,
|
|
11
|
+
fileUrl,
|
|
12
|
+
fileSize,
|
|
13
|
+
slotClasses,
|
|
14
|
+
allowPreview,
|
|
15
|
+
labels,
|
|
16
|
+
onUpdateCanPreview,
|
|
17
|
+
}: {
|
|
18
|
+
canPreview: boolean
|
|
19
|
+
fileType: string
|
|
20
|
+
fileName: string
|
|
21
|
+
fileUrl: string
|
|
22
|
+
fileSize?: number | undefined
|
|
23
|
+
slotClasses: InternalFlatClassNames
|
|
24
|
+
allowPreview: boolean
|
|
25
|
+
labels: Translations
|
|
26
|
+
onUpdateCanPreview?: ((val: boolean) => void) | undefined
|
|
27
|
+
} = $props()
|
|
28
|
+
|
|
29
|
+
const extension = $derived(fileGetExtension(fileType, fileName))
|
|
30
|
+
const is3D = $derived(fileIs3D(extension?.toLowerCase() ?? ''))
|
|
31
|
+
const isPdf = $derived(fileGetIsPdf(fileType, fileName))
|
|
32
|
+
// Text files render as a static doc icon (cross-framework parity).
|
|
33
|
+
const isText = $derived(fileGetIsText(fileType, fileName))
|
|
34
|
+
|
|
35
|
+
function onObjectLoad() {
|
|
36
|
+
onUpdateCanPreview?.(true)
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
{#if isPdf || is3D || isText}
|
|
41
|
+
<!-- PDFs, 3D files, and text -> static icon -->
|
|
42
|
+
<div class="upup-flex upup-flex-col upup-items-center upup-gap-2">
|
|
43
|
+
<FileIcon {extension} class={slotClasses.fileIcon} />
|
|
44
|
+
</div>
|
|
45
|
+
{:else}
|
|
46
|
+
{#if !canPreview}
|
|
47
|
+
<object
|
|
48
|
+
data={fileUrl}
|
|
49
|
+
width="0%"
|
|
50
|
+
height="0%"
|
|
51
|
+
name={fileName}
|
|
52
|
+
title={fileName}
|
|
53
|
+
type={fileType}
|
|
54
|
+
onload={onObjectLoad}
|
|
55
|
+
>
|
|
56
|
+
<p>{labels.loading}</p>
|
|
57
|
+
</object>
|
|
58
|
+
<FileIcon {extension} />
|
|
59
|
+
{/if}
|
|
60
|
+
|
|
61
|
+
{#if canPreview}
|
|
62
|
+
<FileIcon
|
|
63
|
+
{extension}
|
|
64
|
+
class={cn(
|
|
65
|
+
{ 'md:upup-hidden': allowPreview },
|
|
66
|
+
slotClasses.fileIcon,
|
|
67
|
+
)}
|
|
68
|
+
/>
|
|
69
|
+
<div
|
|
70
|
+
class={cn(
|
|
71
|
+
`upup-relative upup-hidden upup-h-full upup-w-full ${allowPreview ? 'md:upup-block' : ''}`,
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
<object
|
|
75
|
+
data={fileUrl}
|
|
76
|
+
width="100%"
|
|
77
|
+
height="100%"
|
|
78
|
+
name={fileName}
|
|
79
|
+
title={fileName}
|
|
80
|
+
type={fileType}
|
|
81
|
+
class="upup-absolute upup-h-full upup-w-full"
|
|
82
|
+
>
|
|
83
|
+
<p>{labels.loading}</p>
|
|
84
|
+
</object>
|
|
85
|
+
</div>
|
|
86
|
+
{/if}
|
|
87
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Translations } from '@useupup/core';
|
|
2
|
+
import type { InternalFlatClassNames } from '@useupup/core/internal';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
canPreview: boolean;
|
|
5
|
+
fileType: string;
|
|
6
|
+
fileName: string;
|
|
7
|
+
fileUrl: string;
|
|
8
|
+
fileSize?: number | undefined;
|
|
9
|
+
slotClasses: InternalFlatClassNames;
|
|
10
|
+
allowPreview: boolean;
|
|
11
|
+
labels: Translations;
|
|
12
|
+
onUpdateCanPreview?: ((val: boolean) => void) | undefined;
|
|
13
|
+
};
|
|
14
|
+
declare const FilePreviewThumbnail: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
15
|
+
type FilePreviewThumbnail = ReturnType<typeof FilePreviewThumbnail>;
|
|
16
|
+
export default FilePreviewThumbnail;
|
|
17
|
+
//# sourceMappingURL=FilePreviewThumbnail.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilePreviewThumbnail.svelte.d.ts","sourceRoot":"","sources":["../../src/components/FilePreviewThumbnail.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAInE,KAAK,gBAAgB,GAAI;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,WAAW,EAAE,sBAAsB,CAAA;IACnC,YAAY,EAAE,OAAO,CAAA;IACrB,MAAM,EAAE,YAAY,CAAA;IACpB,kBAAkB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;CAC1D,CAAC;AA4DJ,QAAA,MAAM,oBAAoB,sDAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, isFileRemovalLocked } from '@useupup/core/internal'
|
|
3
|
+
import {
|
|
4
|
+
UploadStatus,
|
|
5
|
+
fileTypeIconName,
|
|
6
|
+
type IconName,
|
|
7
|
+
type UploadFile,
|
|
8
|
+
type Translations,
|
|
9
|
+
} from '@useupup/core'
|
|
10
|
+
import { fileGetExtension, fileGetIsImage } from '@useupup/core/internal'
|
|
11
|
+
import {
|
|
12
|
+
useUploaderFiles,
|
|
13
|
+
useUploaderI18n,
|
|
14
|
+
useUploaderOptions,
|
|
15
|
+
useUploaderTheme,
|
|
16
|
+
useUploaderUploadControls,
|
|
17
|
+
} from '../context/uploader-context'
|
|
18
|
+
import Icon from './Icon.svelte'
|
|
19
|
+
import ProgressBar from './shared/ProgressBar.svelte'
|
|
20
|
+
import FileSuccessCheck from './shared/FileSuccessCheck.svelte'
|
|
21
|
+
|
|
22
|
+
const ARCHIVE_EXTENSIONS = new Set(['zip', 'rar', '7z', 'tar', 'gz', 'bz2', 'xz'])
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Per-category thumbnail treatment for non-media rows so pdf / archive / audio /
|
|
26
|
+
* generic no longer all read as the same blue doc: a distinct gradient tint plus
|
|
27
|
+
* the type-specific glyph (audio uses the waveform icon; the rest use the
|
|
28
|
+
* file-<ext> registry icon, falling back to the generic file glyph).
|
|
29
|
+
*/
|
|
30
|
+
function nonMediaThumb(
|
|
31
|
+
type: string,
|
|
32
|
+
name: string,
|
|
33
|
+
): { gradient: string; icon: IconName } {
|
|
34
|
+
const ext = fileGetExtension(type, name)
|
|
35
|
+
if (type.startsWith('audio/'))
|
|
36
|
+
return {
|
|
37
|
+
gradient: 'linear-gradient(135deg,#a855f7,#6366f1)',
|
|
38
|
+
icon: 'audio',
|
|
39
|
+
}
|
|
40
|
+
if (ext === 'pdf' || type === 'application/pdf')
|
|
41
|
+
return {
|
|
42
|
+
gradient: 'linear-gradient(135deg,#f43f5e,#ec4899)',
|
|
43
|
+
icon: 'file-pdf',
|
|
44
|
+
}
|
|
45
|
+
if (ARCHIVE_EXTENSIONS.has(ext) || type.includes('zip'))
|
|
46
|
+
return {
|
|
47
|
+
gradient: 'linear-gradient(135deg,#f59e0b,#f97316)',
|
|
48
|
+
icon: fileTypeIconName(ext === 'zip' ? 'zip' : ext),
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
gradient: 'linear-gradient(135deg,#0ea5e9,#6366f1)',
|
|
52
|
+
icon: fileTypeIconName(ext),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Compact list-mode row (spec §4 state 3, states-tour-v2.html "multiple files").
|
|
58
|
+
* A horizontal card: thumbnail · name/size · remove. The grid-mode tile
|
|
59
|
+
* (FilePreview) keeps the richer affordances (edit, click-to-preview); the row
|
|
60
|
+
* is the dense overview and matches the mockup exactly.
|
|
61
|
+
*/
|
|
62
|
+
let {
|
|
63
|
+
file,
|
|
64
|
+
index = 0,
|
|
65
|
+
}: {
|
|
66
|
+
file: UploadFile
|
|
67
|
+
/** Position in the sorted list — drives the completion-check stagger. */
|
|
68
|
+
index?: number
|
|
69
|
+
} = $props()
|
|
70
|
+
|
|
71
|
+
const { handleFileRemove } = useUploaderFiles()
|
|
72
|
+
const { translations: tr } = useUploaderI18n()
|
|
73
|
+
const { icons: { FileDeleteIcon } } = useUploaderOptions()
|
|
74
|
+
const { isDark: dark } = useUploaderTheme()
|
|
75
|
+
const { upload: { filesProgressMap } } = useUploaderUploadControls()
|
|
76
|
+
|
|
77
|
+
const type = $derived(file.type ?? '')
|
|
78
|
+
const isImage = $derived(fileGetIsImage(type))
|
|
79
|
+
const isVideo = $derived(type.startsWith('video/'))
|
|
80
|
+
const isSuccessful = $derived(file.status === UploadStatus.SUCCESSFUL)
|
|
81
|
+
const thumb = $derived(nonMediaThumb(type, file.name))
|
|
82
|
+
const thumbStyle = $derived(
|
|
83
|
+
isImage
|
|
84
|
+
? `background-image: url(${file.url ?? ''})`
|
|
85
|
+
: isVideo
|
|
86
|
+
? undefined
|
|
87
|
+
: `background: ${thumb.gradient}`,
|
|
88
|
+
)
|
|
89
|
+
const progress = $derived.by(() => {
|
|
90
|
+
const p = $filesProgressMap[file.id]
|
|
91
|
+
const loaded = p?.loaded ?? NaN
|
|
92
|
+
const total = p?.total ?? NaN
|
|
93
|
+
const pct = Math.floor((loaded / total) * 100)
|
|
94
|
+
// No progress entry ⇒ NaN; total === 0 ⇒ Infinity. Either would render
|
|
95
|
+
// width:NaN%/aria-valuenow=NaN in ProgressBar while an upload is active.
|
|
96
|
+
return Number.isFinite(pct) ? pct : 0
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
function formatFileSize(bytes: number | undefined, t: Translations): string {
|
|
100
|
+
if (!bytes || bytes === 0) return t.zeroBytes
|
|
101
|
+
const k = 1024
|
|
102
|
+
const sizes = [t.bytes, t.kb, t.mb, t.gb]
|
|
103
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
104
|
+
return Math.round((bytes / Math.pow(k, i)) * 10) / 10 + ' ' + sizes[i]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function onRemove(e: MouseEvent) {
|
|
108
|
+
e.stopPropagation()
|
|
109
|
+
handleFileRemove(file.id)
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<div
|
|
114
|
+
class={cn(
|
|
115
|
+
'upup-fx-hover-lift upup-flex upup-w-full upup-items-center upup-gap-3 upup-rounded-xl upup-px-3 upup-py-2.5 upup-ring-1',
|
|
116
|
+
$dark
|
|
117
|
+
? 'upup-bg-white/[0.04] upup-ring-white/[0.07]'
|
|
118
|
+
: 'upup-bg-black/[0.04] upup-ring-black/[0.06]',
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<div
|
|
122
|
+
class="upup-relative upup-flex upup-h-10 upup-w-10 upup-flex-none upup-items-center upup-justify-center upup-overflow-hidden upup-rounded-[9px] upup-bg-center upup-bg-cover upup-bg-no-repeat"
|
|
123
|
+
style={thumbStyle}
|
|
124
|
+
>
|
|
125
|
+
{#if isVideo}
|
|
126
|
+
<!-- Real first-frame video thumbnail (no controls chrome). Uses the
|
|
127
|
+
local object URL, which persists through upload (updateFile keeps
|
|
128
|
+
`url`), so the preview survives a completed run. -->
|
|
129
|
+
<video
|
|
130
|
+
src={file.url ?? ''}
|
|
131
|
+
muted
|
|
132
|
+
playsinline
|
|
133
|
+
preload="metadata"
|
|
134
|
+
class="upup-pointer-events-none upup-absolute upup-inset-0 upup-h-full upup-w-full upup-object-cover"
|
|
135
|
+
></video>
|
|
136
|
+
{:else if !isImage}
|
|
137
|
+
<Icon name={thumb.icon} size={20} class="upup-text-white" />
|
|
138
|
+
{/if}
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<div class="upup-flex upup-min-w-0 upup-flex-1 upup-flex-col upup-gap-0.5">
|
|
142
|
+
<div
|
|
143
|
+
class={cn(
|
|
144
|
+
'upup-truncate upup-text-[13px]',
|
|
145
|
+
$dark ? 'upup-text-[#e2e8f0]' : 'upup-text-gray-900',
|
|
146
|
+
)}
|
|
147
|
+
>
|
|
148
|
+
{file.name}
|
|
149
|
+
</div>
|
|
150
|
+
<div
|
|
151
|
+
class={cn(
|
|
152
|
+
'upup-text-[12px]',
|
|
153
|
+
$dark ? 'upup-text-[#94a3b8]' : 'upup-text-gray-500',
|
|
154
|
+
)}
|
|
155
|
+
>
|
|
156
|
+
{formatFileSize(file.size, tr)}
|
|
157
|
+
</div>
|
|
158
|
+
{#if !!progress}
|
|
159
|
+
<ProgressBar
|
|
160
|
+
class="upup-mt-1"
|
|
161
|
+
progressBarClassName="upup-rounded"
|
|
162
|
+
{progress}
|
|
163
|
+
showValue
|
|
164
|
+
/>
|
|
165
|
+
{/if}
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
{#if isSuccessful}
|
|
169
|
+
<FileSuccessCheck {index} size={22} class="upup-flex-none" />
|
|
170
|
+
{/if}
|
|
171
|
+
|
|
172
|
+
<!-- Once a file has uploaded successfully its delete control is gone —
|
|
173
|
+
the completion check is the only trailing affordance. -->
|
|
174
|
+
{#if !isSuccessful}
|
|
175
|
+
<button
|
|
176
|
+
class={cn(
|
|
177
|
+
'upup-fx-remove upup-fx-press upup-flex upup-h-8 upup-w-8 upup-flex-none upup-items-center upup-justify-center upup-rounded-lg',
|
|
178
|
+
$dark
|
|
179
|
+
? 'upup-text-[#64748b] hover:upup-bg-white/[0.06]'
|
|
180
|
+
: 'upup-text-gray-500 hover:upup-bg-black/[0.06]',
|
|
181
|
+
'disabled:upup-cursor-not-allowed disabled:upup-opacity-50',
|
|
182
|
+
)}
|
|
183
|
+
onclick={onRemove}
|
|
184
|
+
type="button"
|
|
185
|
+
disabled={isFileRemovalLocked(progress, file.status)}
|
|
186
|
+
aria-label={tr.removeFile}
|
|
187
|
+
data-testid="upup-file-remove"
|
|
188
|
+
>
|
|
189
|
+
<FileDeleteIcon class="upup-h-5 upup-w-5" />
|
|
190
|
+
</button>
|
|
191
|
+
{/if}
|
|
192
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type UploadFile } from '@useupup/core';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
file: UploadFile;
|
|
4
|
+
/** Position in the sorted list — drives the completion-check stagger. */
|
|
5
|
+
index?: number;
|
|
6
|
+
};
|
|
7
|
+
declare const FileRow: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type FileRow = ReturnType<typeof FileRow>;
|
|
9
|
+
export default FileRow;
|
|
10
|
+
//# sourceMappingURL=FileRow.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileRow.svelte.d.ts","sourceRoot":"","sources":["../../src/components/FileRow.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,EAIH,KAAK,UAAU,EAEhB,MAAM,eAAe,CAAA;AAavB,KAAK,gBAAgB,GAAI;IACtB,IAAI,EAAE,UAAU,CAAA;IAChB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AAsJJ,QAAA,MAAM,OAAO,sDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useUploaderRuntime, useUploaderSource } from '../context/uploader-context'
|
|
3
|
+
import ClientGoogleDriveUploader from './ClientGoogleDriveUploader.svelte'
|
|
4
|
+
import ServerModeDriveUploader from './ServerModeDriveUploader.svelte'
|
|
5
|
+
|
|
6
|
+
const { mode } = useUploaderRuntime()
|
|
7
|
+
const { setActiveSource } = useUploaderSource()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if mode === 'server'}
|
|
11
|
+
<ServerModeDriveUploader
|
|
12
|
+
provider="google-drive"
|
|
13
|
+
onBack={() => setActiveSource(undefined)}
|
|
14
|
+
/>
|
|
15
|
+
{:else}
|
|
16
|
+
<ClientGoogleDriveUploader />
|
|
17
|
+
{/if}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const GoogleDriveUploader: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type GoogleDriveUploader = InstanceType<typeof GoogleDriveUploader>;
|
|
18
|
+
export default GoogleDriveUploader;
|
|
19
|
+
//# sourceMappingURL=GoogleDriveUploader.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoogleDriveUploader.svelte.d.ts","sourceRoot":"","sources":["../../src/components/GoogleDriveUploader.svelte.ts"],"names":[],"mappings":"AAwBA,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,mBAAmB;;kBAA+E,CAAC;AACvF,KAAK,mBAAmB,GAAG,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ICONS, type IconName } from '@useupup/core'
|
|
3
|
+
import { cn } from '@useupup/core/internal'
|
|
4
|
+
let {
|
|
5
|
+
name,
|
|
6
|
+
size = undefined,
|
|
7
|
+
class: className = '',
|
|
8
|
+
}: {
|
|
9
|
+
name: IconName
|
|
10
|
+
size?: number | undefined
|
|
11
|
+
class?: string | undefined
|
|
12
|
+
} = $props()
|
|
13
|
+
const def = $derived(ICONS[name])
|
|
14
|
+
const px = $derived(size ?? def.defaultSize)
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<svg
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
viewBox={def.viewBox}
|
|
20
|
+
width={px}
|
|
21
|
+
height={px}
|
|
22
|
+
{...def.attrs}
|
|
23
|
+
class={cn(def.className, className)}
|
|
24
|
+
>{@html def.inner}</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IconName } from '@useupup/core';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
name: IconName;
|
|
4
|
+
size?: number | undefined;
|
|
5
|
+
class?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Icon = ReturnType<typeof Icon>;
|
|
9
|
+
export default Icon;
|
|
10
|
+
//# sourceMappingURL=Icon.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../../src/components/Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGnD,KAAK,gBAAgB,GAAI;IACtB,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAC;AAiBJ,QAAA,MAAM,IAAI,sDAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as MyDeviceIcon } from './icons/MyDeviceIcon.svelte';
|
|
2
|
+
export { default as BoxIcon } from './icons/BoxIcon.svelte';
|
|
3
|
+
export { default as DropboxIcon } from './icons/DropboxIcon.svelte';
|
|
4
|
+
export { default as GoogleDriveIcon } from './icons/GoogleDriveIcon.svelte';
|
|
5
|
+
export { default as OneDriveIcon } from './icons/OneDriveIcon.svelte';
|
|
6
|
+
export { default as LinkIcon } from './icons/LinkIcon.svelte';
|
|
7
|
+
export { default as CameraIcon } from './icons/CameraIcon.svelte';
|
|
8
|
+
export { default as AudioIcon } from './icons/AudioIcon.svelte';
|
|
9
|
+
export { default as ScreenCaptureIcon } from './icons/ScreenCaptureIcon.svelte';
|
|
10
|
+
//# sourceMappingURL=Icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.d.ts","sourceRoot":"","sources":["../../src/components/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as MyDeviceIcon } from './icons/MyDeviceIcon.svelte';
|
|
2
|
+
export { default as BoxIcon } from './icons/BoxIcon.svelte';
|
|
3
|
+
export { default as DropboxIcon } from './icons/DropboxIcon.svelte';
|
|
4
|
+
export { default as GoogleDriveIcon } from './icons/GoogleDriveIcon.svelte';
|
|
5
|
+
export { default as OneDriveIcon } from './icons/OneDriveIcon.svelte';
|
|
6
|
+
export { default as LinkIcon } from './icons/LinkIcon.svelte';
|
|
7
|
+
export { default as CameraIcon } from './icons/CameraIcon.svelte';
|
|
8
|
+
export { default as AudioIcon } from './icons/AudioIcon.svelte';
|
|
9
|
+
export { default as ScreenCaptureIcon } from './icons/ScreenCaptureIcon.svelte';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ImageEditorStub: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ImageEditorStub = InstanceType<typeof ImageEditorStub>;
|
|
18
|
+
export default ImageEditorStub;
|
|
19
|
+
//# sourceMappingURL=ImageEditorStub.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageEditorStub.svelte.d.ts","sourceRoot":"","sources":["../../src/components/ImageEditorStub.svelte.ts"],"names":[],"mappings":"AASA,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,eAAe;;kBAA+E,CAAC;AACnF,KAAK,eAAe,GAAG,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAe,eAAe,CAAC"}
|