tsv2-library 1.0.61-alpha.20 → 1.0.61-alpha.21
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const buildFileURL: (name
|
|
1
|
+
export declare const buildFileURL: (name?: string, width?: number, height?: number) => string;
|
|
2
2
|
export declare const fetchBlobFile: (url: string, token: string) => Promise<Blob>;
|
|
3
3
|
/**
|
|
4
4
|
*
|
package/dist/tsv2-library.es.js
CHANGED
|
@@ -19574,7 +19574,7 @@ const useToast = () => {
|
|
|
19574
19574
|
};
|
|
19575
19575
|
const buildFileURL = (name, width2, height) => {
|
|
19576
19576
|
const BASE_URL2 = new URL("https://dev-api.tagsamurai.com/fam").origin;
|
|
19577
|
-
let url = name.startsWith("http") ? name : `${BASE_URL2}/file-storage/api/file/${name.replace(/^\/+/, "")}`;
|
|
19577
|
+
let url = (name == null ? void 0 : name.startsWith("http")) ? name : `${BASE_URL2}/file-storage/api/file/${name == null ? void 0 : name.replace(/^\/+/, "")}`;
|
|
19578
19578
|
if (width2 || height) {
|
|
19579
19579
|
const params = new URLSearchParams();
|
|
19580
19580
|
if (width2) {
|
|
@@ -55277,7 +55277,7 @@ const _hoisted_4$e = ["alt", "src", "onClick"];
|
|
|
55277
55277
|
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
55278
55278
|
__name: "Image",
|
|
55279
55279
|
props: {
|
|
55280
|
-
thumbnail: {
|
|
55280
|
+
thumbnail: {},
|
|
55281
55281
|
preview: {},
|
|
55282
55282
|
rounded: { type: Boolean, default: false },
|
|
55283
55283
|
description: { default: "TAG Samurai Image Resource" },
|
|
@@ -55297,6 +55297,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55297
55297
|
setTimeout(() => {
|
|
55298
55298
|
startInterval();
|
|
55299
55299
|
}, 3e3);
|
|
55300
|
+
resolveGallerySrcs();
|
|
55300
55301
|
});
|
|
55301
55302
|
onUnmounted(() => {
|
|
55302
55303
|
stopInterval();
|
|
@@ -55305,10 +55306,45 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55305
55306
|
const intervalId = shallowRef();
|
|
55306
55307
|
const timeOutId = shallowRef();
|
|
55307
55308
|
const errorLoadImage = shallowRef(false);
|
|
55309
|
+
const resolvedGallerySrcs = ref([]);
|
|
55308
55310
|
const usePreview = computed(() => {
|
|
55309
|
-
var _a;
|
|
55310
|
-
return !errorLoadImage.value && (!!props.preview || !((_a = imageThumbnail.value) == null ? void 0 : _a.toString().includes("data:image/svg+xml")));
|
|
55311
|
+
var _a, _b;
|
|
55312
|
+
return !errorLoadImage.value && (!!props.preview || !((_a = imageThumbnail.value) == null ? void 0 : _a.toString().includes("data:image/svg+xml"))) && !((_b = imageThumbnail.value) == null ? void 0 : _b.toString().toLowerCase().includes("placeholder"));
|
|
55311
55313
|
});
|
|
55314
|
+
const imageThumbnail = computedAsync(
|
|
55315
|
+
async () => {
|
|
55316
|
+
if (!props.thumbnail || errorLoadImage.value) {
|
|
55317
|
+
console.log("👽👽👽 1:");
|
|
55318
|
+
return Placeholder;
|
|
55319
|
+
}
|
|
55320
|
+
if (typeof props.thumbnail === "string") {
|
|
55321
|
+
console.log("👽👽👽 2:");
|
|
55322
|
+
return props.thumbnail.includes("http") || props.thumbnail.includes("data:image/svg+xml") ? props.thumbnail : await getImageURL(props.thumbnail);
|
|
55323
|
+
}
|
|
55324
|
+
console.log("👽👽👽 3:");
|
|
55325
|
+
return props.thumbnail;
|
|
55326
|
+
}
|
|
55327
|
+
);
|
|
55328
|
+
const imagePreview = computedAsync(async () => {
|
|
55329
|
+
const preview = props.preview || imageThumbnail.value;
|
|
55330
|
+
if (typeof preview === "string") {
|
|
55331
|
+
return preview.includes("http") || preview.includes("data:image/svg+xml") ? preview : await getImageURL(preview);
|
|
55332
|
+
}
|
|
55333
|
+
return preview;
|
|
55334
|
+
});
|
|
55335
|
+
const resolveGallerySrcs = async () => {
|
|
55336
|
+
var _a;
|
|
55337
|
+
if (!((_a = props.galleries) == null ? void 0 : _a.length)) {
|
|
55338
|
+
resolvedGallerySrcs.value = [];
|
|
55339
|
+
return;
|
|
55340
|
+
}
|
|
55341
|
+
const srcs = await Promise.all(
|
|
55342
|
+
props.galleries.map(
|
|
55343
|
+
({ preview, thumbnail }) => getGalleryImageSrc(preview, thumbnail)
|
|
55344
|
+
)
|
|
55345
|
+
);
|
|
55346
|
+
resolvedGallerySrcs.value = srcs.map((src) => src ?? "");
|
|
55347
|
+
};
|
|
55312
55348
|
const nextImage = () => {
|
|
55313
55349
|
const images = props.galleries ?? [];
|
|
55314
55350
|
currentGalleryImage.value = (currentGalleryImage.value + 1) % images.length;
|
|
@@ -55335,23 +55371,6 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55335
55371
|
intervalId.value = void 0;
|
|
55336
55372
|
}
|
|
55337
55373
|
};
|
|
55338
|
-
const imageThumbnail = computedAsync(
|
|
55339
|
-
async () => {
|
|
55340
|
-
if (!props.thumbnail || errorLoadImage.value)
|
|
55341
|
-
return Placeholder;
|
|
55342
|
-
if (typeof props.thumbnail === "string") {
|
|
55343
|
-
return props.thumbnail.includes("http") || props.thumbnail.includes("data:image/svg+xml") ? props.thumbnail : await getImageURL(props.thumbnail);
|
|
55344
|
-
}
|
|
55345
|
-
return props.thumbnail;
|
|
55346
|
-
}
|
|
55347
|
-
);
|
|
55348
|
-
const imagePreview = computedAsync(async () => {
|
|
55349
|
-
const preview = props.preview || imageThumbnail.value;
|
|
55350
|
-
if (typeof preview === "string") {
|
|
55351
|
-
return preview.includes("http") || preview.includes("data:image/svg+xml") ? preview : await getImageURL(preview);
|
|
55352
|
-
}
|
|
55353
|
-
return preview;
|
|
55354
|
-
});
|
|
55355
55374
|
const handleThumbnailClick = (index2) => {
|
|
55356
55375
|
stopInterval();
|
|
55357
55376
|
if (typeof index2 === "number")
|
|
@@ -55368,13 +55387,14 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55368
55387
|
errorLoadImage.value = true;
|
|
55369
55388
|
}
|
|
55370
55389
|
};
|
|
55371
|
-
const getGalleryImageSrc = (preview, thumbnail) => {
|
|
55390
|
+
const getGalleryImageSrc = async (preview, thumbnail) => {
|
|
55372
55391
|
const image2 = preview || thumbnail;
|
|
55373
55392
|
if (typeof image2 === "string") {
|
|
55374
|
-
return image2.includes("http") ? image2 : getImageURL(image2);
|
|
55393
|
+
return image2.includes("http") ? image2 : await getImageURL(image2);
|
|
55375
55394
|
}
|
|
55376
55395
|
return image2;
|
|
55377
55396
|
};
|
|
55397
|
+
watch(() => props.galleries, resolveGallerySrcs, { immediate: true });
|
|
55378
55398
|
return (_ctx, _cache) => {
|
|
55379
55399
|
return openBlock(), createBlock(unref(script$h), mergeProps(_ctx.$props, {
|
|
55380
55400
|
class: [
|
|
@@ -55409,12 +55429,12 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55409
55429
|
src: unref(imagePreview),
|
|
55410
55430
|
style: normalizeStyle(slotProps.style)
|
|
55411
55431
|
}, null, 12, _hoisted_2$y)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
55412
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({
|
|
55432
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({ description }, index2) => {
|
|
55413
55433
|
return withDirectives((openBlock(), createElementBlock("img", {
|
|
55414
55434
|
key: index2,
|
|
55415
55435
|
alt: description,
|
|
55416
55436
|
onerror: onErrorLoadImage,
|
|
55417
|
-
src:
|
|
55437
|
+
src: resolvedGallerySrcs.value[index2],
|
|
55418
55438
|
style: normalizeStyle(slotProps.style),
|
|
55419
55439
|
"data-ts-section": "image-gallery"
|
|
55420
55440
|
}, null, 12, _hoisted_3$l)), [
|
|
@@ -55440,7 +55460,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55440
55460
|
severity: "secondary",
|
|
55441
55461
|
text: ""
|
|
55442
55462
|
}),
|
|
55443
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({
|
|
55463
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({ description }, index2) => {
|
|
55444
55464
|
return openBlock(), createElementBlock("img", {
|
|
55445
55465
|
key: index2,
|
|
55446
55466
|
alt: description ?? "TAG Samurai Gallery",
|
|
@@ -55449,7 +55469,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55449
55469
|
{ "!opacity-100": currentGalleryImage.value == index2 }
|
|
55450
55470
|
]),
|
|
55451
55471
|
onerror: onErrorLoadImage,
|
|
55452
|
-
src:
|
|
55472
|
+
src: resolvedGallerySrcs.value[index2],
|
|
55453
55473
|
style: normalizeStyle(slotProps.style),
|
|
55454
55474
|
onClick: withModifiers(($event) => handleThumbnailClick(index2), ["stop"]),
|
|
55455
55475
|
"data-ts-section": "thumbnail-image"
|