tsv2-library 1.0.61-alpha.20 → 1.0.61-alpha.22

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: string, width?: number, height?: number) => string;
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
  *
@@ -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: { default: Placeholder },
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,42 @@ 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
+ return Placeholder;
55318
+ }
55319
+ if (typeof props.thumbnail === "string") {
55320
+ return props.thumbnail.includes("http") || props.thumbnail.includes("data:image/svg+xml") ? props.thumbnail : await getImageURL(props.thumbnail);
55321
+ }
55322
+ return props.thumbnail;
55323
+ }
55324
+ );
55325
+ const imagePreview = computedAsync(async () => {
55326
+ const preview = props.preview || imageThumbnail.value;
55327
+ if (typeof preview === "string") {
55328
+ return preview.includes("http") || preview.includes("data:image/svg+xml") ? preview : await getImageURL(preview);
55329
+ }
55330
+ return preview;
55331
+ });
55332
+ const resolveGallerySrcs = async () => {
55333
+ var _a;
55334
+ if (!((_a = props.galleries) == null ? void 0 : _a.length)) {
55335
+ resolvedGallerySrcs.value = [];
55336
+ return;
55337
+ }
55338
+ const srcs = await Promise.all(
55339
+ props.galleries.map(
55340
+ ({ preview, thumbnail }) => getGalleryImageSrc(preview, thumbnail)
55341
+ )
55342
+ );
55343
+ resolvedGallerySrcs.value = srcs.map((src) => src ?? "");
55344
+ };
55312
55345
  const nextImage = () => {
55313
55346
  const images = props.galleries ?? [];
55314
55347
  currentGalleryImage.value = (currentGalleryImage.value + 1) % images.length;
@@ -55335,23 +55368,6 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
55335
55368
  intervalId.value = void 0;
55336
55369
  }
55337
55370
  };
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
55371
  const handleThumbnailClick = (index2) => {
55356
55372
  stopInterval();
55357
55373
  if (typeof index2 === "number")
@@ -55368,13 +55384,14 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
55368
55384
  errorLoadImage.value = true;
55369
55385
  }
55370
55386
  };
55371
- const getGalleryImageSrc = (preview, thumbnail) => {
55387
+ const getGalleryImageSrc = async (preview, thumbnail) => {
55372
55388
  const image2 = preview || thumbnail;
55373
55389
  if (typeof image2 === "string") {
55374
- return image2.includes("http") ? image2 : getImageURL(image2);
55390
+ return image2.includes("http") ? image2 : await getImageURL(image2);
55375
55391
  }
55376
55392
  return image2;
55377
55393
  };
55394
+ watch(() => props.galleries, resolveGallerySrcs, { immediate: true });
55378
55395
  return (_ctx, _cache) => {
55379
55396
  return openBlock(), createBlock(unref(script$h), mergeProps(_ctx.$props, {
55380
55397
  class: [
@@ -55409,12 +55426,12 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
55409
55426
  src: unref(imagePreview),
55410
55427
  style: normalizeStyle(slotProps.style)
55411
55428
  }, null, 12, _hoisted_2$y)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
55412
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({ preview, thumbnail, description }, index2) => {
55429
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({ description }, index2) => {
55413
55430
  return withDirectives((openBlock(), createElementBlock("img", {
55414
55431
  key: index2,
55415
55432
  alt: description,
55416
55433
  onerror: onErrorLoadImage,
55417
- src: getGalleryImageSrc(preview, thumbnail),
55434
+ src: resolvedGallerySrcs.value[index2],
55418
55435
  style: normalizeStyle(slotProps.style),
55419
55436
  "data-ts-section": "image-gallery"
55420
55437
  }, null, 12, _hoisted_3$l)), [
@@ -55440,7 +55457,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
55440
55457
  severity: "secondary",
55441
55458
  text: ""
55442
55459
  }),
55443
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({ thumbnail, description }, index2) => {
55460
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.galleries, ({ description }, index2) => {
55444
55461
  return openBlock(), createElementBlock("img", {
55445
55462
  key: index2,
55446
55463
  alt: description ?? "TAG Samurai Gallery",
@@ -55449,7 +55466,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
55449
55466
  { "!opacity-100": currentGalleryImage.value == index2 }
55450
55467
  ]),
55451
55468
  onerror: onErrorLoadImage,
55452
- src: unref(getImageURL)(thumbnail),
55469
+ src: resolvedGallerySrcs.value[index2],
55453
55470
  style: normalizeStyle(slotProps.style),
55454
55471
  onClick: withModifiers(($event) => handleThumbnailClick(index2), ["stop"]),
55455
55472
  "data-ts-section": "thumbnail-image"
@@ -70485,6 +70502,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
70485
70502
  const removeBadge = (index2) => {
70486
70503
  var _a;
70487
70504
  (_a = field2.value) == null ? void 0 : _a.splice(index2, 1, ...props.preserveDeletedIndex ? [null] : []);
70505
+ emit("update:modelValue", field2.value);
70488
70506
  };
70489
70507
  const onKeydown3 = (event2) => {
70490
70508
  var _a, _b;