@fewangsit/wangsvue-fats 1.0.1-alpha.36 → 1.0.1-alpha.37
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/image/index.d.ts +6 -3
- package/image/index.es.js +8 -2
- package/package.json +1 -1
- package/stats.html +1 -1
- package/wangsvue-fats.esm.browser.js +8 -2
- package/wangsvue-fats.system.js +1 -1
package/image/index.d.ts
CHANGED
|
@@ -271,21 +271,24 @@ export interface ImageProps {
|
|
|
271
271
|
unstyled?: boolean;
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
|
-
* Returns the full image URL or a
|
|
274
|
+
* Returns the full image URL or a ObjetctURL from Blob for an image resource, based on the provided path and dimensions.
|
|
275
275
|
*
|
|
276
276
|
* If the image is publicly accessible, this typically returns a fully qualified URL.
|
|
277
|
-
* If the image requires authentication or protected access, this may return a
|
|
277
|
+
* If the image requires authentication or protected access, this may return a ObjetctURL from Blob (e.g., Base64-encoded).
|
|
278
278
|
*
|
|
279
279
|
* @param path - The image path as provided in the API response JSON. Can be null or undefined.
|
|
280
280
|
* @param width - Optional width of the image in pixels.
|
|
281
281
|
* @param height - Optional height of the image in pixels.
|
|
282
282
|
*
|
|
283
|
-
* @returns A string representing either the full image URL or a
|
|
283
|
+
* @returns A string representing either the full image URL or a ObjetctURL from Blob. Returns `undefined` if the path is invalid.
|
|
284
|
+
* @example res.blob().then((blob) => resolve(URL.createObjectURL(blob)))
|
|
285
|
+
*
|
|
284
286
|
*/
|
|
285
287
|
getImageURL?: (
|
|
286
288
|
path?: string | null,
|
|
287
289
|
width?: number,
|
|
288
290
|
height?: number,
|
|
291
|
+
returnURLOnly?: boolean, // Default is undefined or will return Promise when using Auth, when it manually sets to true, return the url only
|
|
289
292
|
) => string | undefined | Promise<string | undefined>;
|
|
290
293
|
|
|
291
294
|
/**
|
package/image/index.es.js
CHANGED
|
@@ -54,7 +54,7 @@ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /*
|
|
|
54
54
|
}, R = I(() => a.width != null ? a.width : a.size === "small" ? 30 : a.size === "medium" ? 80 : 125), m = J(
|
|
55
55
|
async () => {
|
|
56
56
|
var e, t;
|
|
57
|
-
return !a.src || f.value ? i.value.placeholder : typeof a.src == "string" ? (a.src.includes("http") || // From public image
|
|
57
|
+
return !a.src || f.value ? i.value.placeholder : typeof a.src == "string" ? (a.src.includes("http") || // From public image or ObjectURL from Blob e.g 'blob:http://localhost:5173/ca48705d-1fc1-4a74-af38-353ffce7e02a'
|
|
58
58
|
/^data:image\/[a-zA-Z0-9.+-]+;base64,/.test(a.src) ? a.src : await ((t = (e = i.value).getImageURL) == null ? void 0 : t.call(e, a.src, R.value))) || i.value.placeholder : a.src;
|
|
59
59
|
},
|
|
60
60
|
i.value.placeholder
|
|
@@ -64,7 +64,13 @@ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /*
|
|
|
64
64
|
if (y.value != null) return;
|
|
65
65
|
let e = m.value;
|
|
66
66
|
if (typeof e == "string") {
|
|
67
|
-
const l = (r = (t = i.value).getImageURL) == null ? void 0 : r.call(
|
|
67
|
+
const l = (r = (t = i.value).getImageURL) == null ? void 0 : r.call(
|
|
68
|
+
t,
|
|
69
|
+
"preview",
|
|
70
|
+
void 0,
|
|
71
|
+
void 0,
|
|
72
|
+
!0
|
|
73
|
+
), n = typeof l == "string" && !(l != null && l.includes("undefined")) ? new URL(l).origin : "", B = n && e.includes(n) || // For getImageURL that return the image full url
|
|
68
74
|
l instanceof Promise;
|
|
69
75
|
e = e.includes("http") && !B || // From public resource
|
|
70
76
|
e.includes("data:image/svg+xml") ? e : await ((c = (o = i.value).getImageURL) == null ? void 0 : c.call(o, a.src));
|