@marianmeres/stuic 2.41.0 → 2.41.2
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.
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
import { X } from "../X/index.js";
|
|
32
32
|
import { preloadImgs } from "../../utils/preload-img.js";
|
|
33
33
|
import { fade } from "svelte/transition";
|
|
34
|
+
import { C } from "vitest/dist/chunks/reporters.d.BFLkQcL6.js";
|
|
34
35
|
|
|
35
36
|
export type AssetPreviewUrlObj = {
|
|
36
37
|
// o
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
export interface Props {
|
|
59
|
+
class?: string;
|
|
58
60
|
assets: string[] | AssetPreview[];
|
|
59
61
|
classControls?: string;
|
|
60
62
|
/** Optional translate function */
|
|
@@ -67,6 +69,8 @@
|
|
|
67
69
|
close: () => void;
|
|
68
70
|
}
|
|
69
71
|
) => void;
|
|
72
|
+
/** optional "do not display file name" switch flag */
|
|
73
|
+
noName?: boolean;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
export function getAssetIcon(ext?: string) {
|
|
@@ -163,7 +167,14 @@
|
|
|
163
167
|
<script lang="ts">
|
|
164
168
|
const clog = createClog("AssetsPreview", { color: "auto" });
|
|
165
169
|
|
|
166
|
-
let {
|
|
170
|
+
let {
|
|
171
|
+
class: classProp,
|
|
172
|
+
assets: _assets,
|
|
173
|
+
t = t_default,
|
|
174
|
+
classControls = "",
|
|
175
|
+
onDelete,
|
|
176
|
+
noName,
|
|
177
|
+
}: Props = $props();
|
|
167
178
|
|
|
168
179
|
let assets: AssetPreviewNormalized[] = $derived(
|
|
169
180
|
(_assets ?? []).map(normalizeInput).filter(Boolean) as AssetPreviewNormalized[]
|
|
@@ -378,7 +389,7 @@
|
|
|
378
389
|
onEscape={modal?.close}
|
|
379
390
|
classBackdrop="p-4 md:p-4"
|
|
380
391
|
classInner="max-w-full h-full"
|
|
381
|
-
class="max-h-full md:max-h-full rounded-lg"
|
|
392
|
+
class="max-h-full md:max-h-full rounded-lg {classProp}"
|
|
382
393
|
classMain="flex items-center justify-center relative stuic-assets-preview stuic-assets-preview-open"
|
|
383
394
|
>
|
|
384
395
|
{@const previewAsset = assets?.[previewIdx]}
|
|
@@ -501,14 +512,14 @@
|
|
|
501
512
|
</button>
|
|
502
513
|
</div>
|
|
503
514
|
|
|
504
|
-
{#if previewAsset?.name}
|
|
515
|
+
{#if !noName && previewAsset?.name}
|
|
505
516
|
<span class="absolute top-4 left-4 bg-white px-1 rounded">
|
|
506
517
|
{previewAsset?.name}
|
|
507
518
|
</span>
|
|
508
519
|
{/if}
|
|
509
520
|
|
|
510
521
|
{#if assets.length > 1}
|
|
511
|
-
{#if dotTooltip}
|
|
522
|
+
{#if !noName && dotTooltip}
|
|
512
523
|
<div
|
|
513
524
|
class="absolute bottom-10 left-0 right-0 text-center"
|
|
514
525
|
transition:fade={{ duration: 100 }}
|
|
@@ -10,6 +10,7 @@ export interface AssetPreview {
|
|
|
10
10
|
type?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface Props {
|
|
13
|
+
class?: string;
|
|
13
14
|
assets: string[] | AssetPreview[];
|
|
14
15
|
classControls?: string;
|
|
15
16
|
/** Optional translate function */
|
|
@@ -18,6 +19,8 @@ export interface Props {
|
|
|
18
19
|
onDelete?: (asset: AssetPreview, index: number, controls: {
|
|
19
20
|
close: () => void;
|
|
20
21
|
}) => void;
|
|
22
|
+
/** optional "do not display file name" switch flag */
|
|
23
|
+
noName?: boolean;
|
|
21
24
|
}
|
|
22
25
|
export declare function getAssetIcon(ext?: string): CallableFunction;
|
|
23
26
|
declare const AssetsPreview: import("svelte").Component<Props, {
|