fangguo-component 1.2.4 → 1.2.5
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/dist/FgCascader.css +2 -6
- package/dist/{FgCascader.vue_vue_type_style_index_0_lang-DzvTfHp4.js → FgCascader.vue_vue_type_style_index_0_lang-CtUPO8fk.js} +19 -16
- package/dist/{ViewImg-CD4QJK4R.js → ViewImg-CLRjYOUN.js} +250 -51
- package/dist/ViewImg.css +41 -12
- package/dist/{ViewImgPopover-D-1b2nEa.js → ViewImgPopover-BtFnYval.js} +70 -104
- package/dist/ViewImgPopover.css +8 -29
- package/dist/components/cascader/index.js +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/viewImg/ViewImg.vue.d.ts +21 -14
- package/dist/components/viewImg/ViewImgErrorFallback.vue.d.ts +6 -3
- package/dist/components/viewImg/defaults.d.ts +2 -2
- package/dist/components/viewImg/index.js +1 -1
- package/dist/components/viewImgPopover/ViewImgPopover.vue.d.ts +86 -70
- package/dist/components/viewImgPopover/index.js +1 -1
- package/dist/{index-rEz2pixF.js → index-DsfY1yqo.js} +2 -1
- package/dist/{index-CALlgLrT.js → index-wDrpgKQT.js} +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -13
- package/dist/{montageImgUrl-DP5jMHCX.js → montageImgUrl-B9ZmJ7TF.js} +35 -16
- package/dist/tools/imgUrl/imageUrl.d.ts +42 -5
- package/dist/tools/imgUrl/index.d.ts +1 -1
- package/dist/tools/imgUrl/index.js +6 -5
- package/dist/tools/index.js +8 -7
- package/package.json +2 -2
|
@@ -161,6 +161,8 @@ function getSheinOriginalImageUrl(url) {
|
|
|
161
161
|
let base = removeImageUrlQuery(url);
|
|
162
162
|
base = base.replace(/_thumbnail_\d+x\d*\.(webp|png|jpg|jpeg)/gi, "_thumbnail_fullx.$1");
|
|
163
163
|
base = base.replace(/_square_thumbnail_\d+x\d*\.(webp|png|jpg|jpeg)/gi, "_square_thumbnail_fullx.$1");
|
|
164
|
+
base = base.replace(/_thumbnail\.(webp|png|jpg|jpeg)/gi, "_thumbnail_fullx.$1");
|
|
165
|
+
base = base.replace(/_square_thumbnail\.(webp|png|jpg|jpeg)/gi, "_square_thumbnail_fullx.$1");
|
|
164
166
|
return base;
|
|
165
167
|
}
|
|
166
168
|
function getAmazonOriginalImageUrl(url) {
|
|
@@ -206,13 +208,9 @@ function buildSheinImageResizeUrl(url, options = {}) {
|
|
|
206
208
|
const height = toPositiveInteger(options.height) || toPositiveInteger(options.width);
|
|
207
209
|
if (!width || !height) return url;
|
|
208
210
|
const base = removeImageUrlQuery(url);
|
|
209
|
-
const
|
|
210
|
-
/
|
|
211
|
-
`
|
|
212
|
-
);
|
|
213
|
-
const next = thumbnailUrl.replace(
|
|
214
|
-
/_square_thumbnail_\d+x\d*\.(webp|png|jpg|jpeg)/gi,
|
|
215
|
-
`_square_thumbnail_${width}x${height}.$1`
|
|
211
|
+
const next = base.replace(
|
|
212
|
+
/_((?:square_)?thumbnail)(?:_\d+x\d*|_fullx)?\.(webp|png|jpg|jpeg)/gi,
|
|
213
|
+
`_$1_${width}x${height}.$2`
|
|
216
214
|
);
|
|
217
215
|
return next === base ? url : next;
|
|
218
216
|
}
|
|
@@ -259,6 +257,9 @@ function resolveOssLinks(options = {}) {
|
|
|
259
257
|
var _a;
|
|
260
258
|
return (_a = options.ossLinks) != null ? _a : getOssLinks();
|
|
261
259
|
}
|
|
260
|
+
function hasOssProcessParam(url) {
|
|
261
|
+
return url.includes("x-oss-process=");
|
|
262
|
+
}
|
|
262
263
|
function isOssImageUrl(url, options = {}) {
|
|
263
264
|
const ossLinks2 = resolveOssLinks(options);
|
|
264
265
|
if (!ossLinks2.length) return false;
|
|
@@ -266,7 +267,8 @@ function isOssImageUrl(url, options = {}) {
|
|
|
266
267
|
}
|
|
267
268
|
function buildOssImageResizeUrl(url, options = {}) {
|
|
268
269
|
var _a;
|
|
269
|
-
|
|
270
|
+
const hasProcess = hasOssProcessParam(url);
|
|
271
|
+
if (!hasProcess && !isOssImageUrl(url, options)) return url;
|
|
270
272
|
const width = toPositiveInteger(options.width);
|
|
271
273
|
const height = toPositiveInteger(options.height);
|
|
272
274
|
const qualityVal = (_a = options.Q) != null ? _a : options.q;
|
|
@@ -274,7 +276,6 @@ function buildOssImageResizeUrl(url, options = {}) {
|
|
|
274
276
|
const formatPart = format ? `/format,${format}` : "";
|
|
275
277
|
const useAbsoluteQuality = options.Q != null;
|
|
276
278
|
let finalUrl = url;
|
|
277
|
-
const hasProcess = url.includes("x-oss-process=");
|
|
278
279
|
if (hasProcess) {
|
|
279
280
|
if (height) finalUrl = finalUrl.replace(/h_\d+/, `h_${height}`);
|
|
280
281
|
if (width) finalUrl = finalUrl.replace(/w_\d+/, `w_${width}`);
|
|
@@ -324,7 +325,8 @@ const IMAGE_RESIZE_RULES = [
|
|
|
324
325
|
},
|
|
325
326
|
{
|
|
326
327
|
name: "oss",
|
|
327
|
-
|
|
328
|
+
// 白名单命中,或 URL 已带 x-oss-process(业务侧已拼参、悬停需改尺寸)
|
|
329
|
+
match: (url, options) => isOssImageUrl(url.href, options) || hasOssProcessParam(url.href),
|
|
328
330
|
build: buildOssImageResizeUrl
|
|
329
331
|
}
|
|
330
332
|
];
|
|
@@ -359,6 +361,21 @@ function buildPlatformImageResizeUrl(url, options = {}) {
|
|
|
359
361
|
if (!rule) return url;
|
|
360
362
|
return rule.build(raw, options);
|
|
361
363
|
}
|
|
364
|
+
function hasPlatformImageResizeParams(url) {
|
|
365
|
+
const raw = (url || "").trim();
|
|
366
|
+
if (!raw) return false;
|
|
367
|
+
if (hasOssProcessParam(raw)) return true;
|
|
368
|
+
if (/[?&]imageView2\//i.test(raw) || /[?&]imageMogr2\//i.test(raw) || raw.includes("imageView2/")) {
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
const path = removeImageUrlQuery(raw);
|
|
372
|
+
if (/_(?:square_)?thumbnail(?:_\d+x\d*|_fullx)?\./i.test(path)) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
if (/\._AC_(?:UL|SR|SL|SX|SY|SF|SC)/i.test(path)) return true;
|
|
376
|
+
if (/il_(?:\d+|full)x(?:\d+|full)\./i.test(path)) return true;
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
362
379
|
function getPlatformOriginalImageUrl(url) {
|
|
363
380
|
const raw = (url || "").trim();
|
|
364
381
|
if (!raw) return "";
|
|
@@ -414,8 +431,9 @@ function montageImgUrl(url = "", imgSize, options = {}) {
|
|
|
414
431
|
const ruleName = getImageResizeRuleName(url);
|
|
415
432
|
const ossLinks2 = (_a = options.ossLinks) != null ? _a : getOssLinks();
|
|
416
433
|
const hitOssByLinks = ossLinks2.some((domain) => url.includes(domain));
|
|
417
|
-
|
|
418
|
-
|
|
434
|
+
const hasOssProcess = url.includes("x-oss-process=");
|
|
435
|
+
if (ruleName === "oss" || !ruleName && hitOssByLinks || !ruleName && hasOssProcess) {
|
|
436
|
+
if (!hitOssByLinks && !hasOssProcess) return url;
|
|
419
437
|
const networkOpts = getNetworkAdaptiveOptions(imgSize || { h: 260, Q: 92 });
|
|
420
438
|
return buildPlatformImageResizeUrl(url, toPlatformResizeOptions(__spreadValues(__spreadValues({}, imgSize), networkOpts), ossLinks2));
|
|
421
439
|
}
|
|
@@ -433,13 +451,14 @@ export {
|
|
|
433
451
|
getOssLinks as e,
|
|
434
452
|
getPlatformOriginalImageUrl as f,
|
|
435
453
|
getImageResizeRuleName as g,
|
|
436
|
-
|
|
454
|
+
hasPlatformImageResizeParams as h,
|
|
437
455
|
imgUrlConfigKey as i,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
456
|
+
initNetworkListener as j,
|
|
457
|
+
isUnsupportedImg as k,
|
|
458
|
+
notSupportedImgTypes as l,
|
|
441
459
|
montageImgUrl as m,
|
|
442
460
|
networkKey as n,
|
|
461
|
+
replaceUnsupportedImg as o,
|
|
443
462
|
removeImageUrlQuery as r,
|
|
444
463
|
temuThumbUrl as t
|
|
445
464
|
};
|
|
@@ -35,14 +35,20 @@ export declare function getTemuOriginalImageUrl(url: string): string;
|
|
|
35
35
|
* Shein / ltwebstatic 获取原图。
|
|
36
36
|
*
|
|
37
37
|
* 当前采集规则:
|
|
38
|
-
* - _thumbnail_405x552.jpg -> _thumbnail_fullx.jpg
|
|
39
|
-
* - _square_thumbnail_405x552.jpg -> _square_thumbnail_fullx.jpg
|
|
38
|
+
* - _thumbnail.jpg / _thumbnail_405x552.jpg -> _thumbnail_fullx.jpg
|
|
39
|
+
* - _square_thumbnail.jpg / _square_thumbnail_405x552.jpg -> _square_thumbnail_fullx.jpg
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* getSheinOriginalImageUrl(
|
|
43
43
|
* '//img.ltwebstatic.com/v4/j/pi/2025/12/12/22/a_thumbnail_405x552.jpg'
|
|
44
44
|
* )
|
|
45
45
|
* // '//img.ltwebstatic.com/v4/j/pi/2025/12/12/22/a_thumbnail_fullx.jpg'
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* getSheinOriginalImageUrl(
|
|
49
|
+
* 'http://img.ltwebstatic.com/v4/j/spmp/a_thumbnail.jpg'
|
|
50
|
+
* )
|
|
51
|
+
* // 'http://img.ltwebstatic.com/v4/j/spmp/a_thumbnail_fullx.jpg'
|
|
46
52
|
*/
|
|
47
53
|
export declare function getSheinOriginalImageUrl(url: string): string;
|
|
48
54
|
/**
|
|
@@ -82,7 +88,10 @@ export declare function buildTemuImageResizeUrl(url: string, options?: ImageResi
|
|
|
82
88
|
/**
|
|
83
89
|
* Shein / ltwebstatic
|
|
84
90
|
*
|
|
85
|
-
* Shein 尺寸在文件路径里,不在 query
|
|
91
|
+
* Shein 尺寸在文件路径里,不在 query 中;通过替换路径里的 thumbnail 后缀实现。
|
|
92
|
+
* 支持:
|
|
93
|
+
* - `_thumbnail.jpg` / `_square_thumbnail.jpg`(无尺寸)
|
|
94
|
+
* - `_thumbnail_405x552.jpg` / `_thumbnail_fullx.jpg`
|
|
86
95
|
* 宽高缺一时用另一个回填。
|
|
87
96
|
*
|
|
88
97
|
* @example
|
|
@@ -91,6 +100,13 @@ export declare function buildTemuImageResizeUrl(url: string, options?: ImageResi
|
|
|
91
100
|
* { width: 300, height: 409 }
|
|
92
101
|
* )
|
|
93
102
|
* // '//img.ltwebstatic.com/v4/j/pi/2025/12/12/22/a_thumbnail_300x409.jpg'
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* buildSheinImageResizeUrl(
|
|
106
|
+
* 'http://img.ltwebstatic.com/v4/j/spmp/a_thumbnail.jpg',
|
|
107
|
+
* { width: 420, height: 420 }
|
|
108
|
+
* )
|
|
109
|
+
* // 'http://img.ltwebstatic.com/v4/j/spmp/a_thumbnail_420x420.jpg'
|
|
94
110
|
*/
|
|
95
111
|
export declare function buildSheinImageResizeUrl(url: string, options?: ImageResizeOptions): string;
|
|
96
112
|
/**
|
|
@@ -132,8 +148,8 @@ export declare function buildEtsyImageResizeUrl(url: string, options?: ImageResi
|
|
|
132
148
|
* OSS(阿里云等)图片处理参数拼接。
|
|
133
149
|
*
|
|
134
150
|
* 规则对齐 montageImgUrl:
|
|
135
|
-
* - 命中 ossLinks
|
|
136
|
-
* - 已有 x-oss-process
|
|
151
|
+
* - 命中 ossLinks 白名单才新建 process
|
|
152
|
+
* - 已有 x-oss-process 时允许原地替换(即使未命中白名单,避免业务侧已拼参的 URL 悬停改不了尺寸)
|
|
137
153
|
* - 否则追加 ?x-oss-process=image/resize,w_{width}|h_{height}
|
|
138
154
|
* - 新建 process 且宽高都缺失时,默认 l_120(与 montageImgUrl 一致)
|
|
139
155
|
*
|
|
@@ -175,6 +191,27 @@ export declare function buildOssImageResizeUrl(url: string, options?: ImageResiz
|
|
|
175
191
|
* // 'https://example.com/a.jpg'
|
|
176
192
|
*/
|
|
177
193
|
export declare function buildPlatformImageResizeUrl(url: string, options?: ImageResizeOptions): string;
|
|
194
|
+
/**
|
|
195
|
+
* 判断 URL 是否已带平台 / OSS 缩放参数(不是仅域名命中)。
|
|
196
|
+
* 用于悬停图:已有缩放参数时按 hoverImgSize 改写,而不是原样放大糊图。
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* hasPlatformImageResizeParams(
|
|
200
|
+
* 'https://img.kwcdn.com/a.jpeg?imageView2/2/w/200/q/50/format/avif%7CimageVqr/2'
|
|
201
|
+
* )
|
|
202
|
+
* // true
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* hasPlatformImageResizeParams(
|
|
206
|
+
* 'https://fangguo-dev.oss-cn-shenzhen.aliyuncs.com/a.jpeg?x-oss-process=image/resize,h_260'
|
|
207
|
+
* )
|
|
208
|
+
* // true
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* hasPlatformImageResizeParams('https://img.kwcdn.com/a.jpeg')
|
|
212
|
+
* // false
|
|
213
|
+
*/
|
|
214
|
+
export declare function hasPlatformImageResizeParams(url: string): boolean;
|
|
178
215
|
/**
|
|
179
216
|
* 按当前商品采集规则获取主图/原图。
|
|
180
217
|
* 未匹配的平台会原链接返回。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { configureImgUrl, DEFAULT_IMG_FASTEN, getImgFasten, getOssLinks, imgUrlConfigKey } from './config';
|
|
2
2
|
export { getNetworkAdaptiveOptions, initNetworkListener, networkKey } from './networkAdaptive';
|
|
3
3
|
export { isUnsupportedImg, montageImgUrl, notSupportedImgTypes, replaceUnsupportedImg, temuThumbUrl, } from './montageImgUrl';
|
|
4
|
-
export { buildPlatformImageResizeUrl, getImageResizeRuleName, getPlatformOriginalImageUrl, removeImageUrlQuery, } from './imageUrl';
|
|
4
|
+
export { buildPlatformImageResizeUrl, getImageResizeRuleName, getPlatformOriginalImageUrl, hasPlatformImageResizeParams, removeImageUrlQuery, } from './imageUrl';
|
|
5
5
|
export type { ImageResizeOptions } from './imageUrl';
|
|
6
6
|
export type { ImgFastenConfig, ImgSizeOptions, ImgUrlConfig, MontageImgUrlOptions } from './types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, b, c, g, a, d, e, f,
|
|
1
|
+
import { D, b, c, g, a, d, e, f, h, i, j, k, m, n, l, r, o, t } from "../../montageImgUrl-B9ZmJ7TF.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEFAULT_IMG_FASTEN,
|
|
4
4
|
b as buildPlatformImageResizeUrl,
|
|
@@ -8,13 +8,14 @@ export {
|
|
|
8
8
|
d as getNetworkAdaptiveOptions,
|
|
9
9
|
e as getOssLinks,
|
|
10
10
|
f as getPlatformOriginalImageUrl,
|
|
11
|
+
h as hasPlatformImageResizeParams,
|
|
11
12
|
i as imgUrlConfigKey,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
j as initNetworkListener,
|
|
14
|
+
k as isUnsupportedImg,
|
|
14
15
|
m as montageImgUrl,
|
|
15
16
|
n as networkKey,
|
|
16
|
-
|
|
17
|
+
l as notSupportedImgTypes,
|
|
17
18
|
r as removeImageUrlQuery,
|
|
18
|
-
|
|
19
|
+
o as replaceUnsupportedImg,
|
|
19
20
|
t as temuThumbUrl
|
|
20
21
|
};
|
package/dist/tools/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D, b, c, g, a, d, e, f,
|
|
2
|
-
import { a as a2, b as b2, c as c2, d as d2, e as e2, f as f2, g as g2, h as h2, i as i2, j as j2, k as k2, l as l2, m as m2, n as n2, o, p, q, r as r2, s, t as t2, u, v, w, x, y, z, A, B, C, D as D2, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as } from "../common-D0EYVGB2.js";
|
|
1
|
+
import { D, b, c, g, a, d, e, f, h, i, j, k, m, n, l, r, o, t } from "../montageImgUrl-B9ZmJ7TF.js";
|
|
2
|
+
import { a as a2, b as b2, c as c2, d as d2, e as e2, f as f2, g as g2, h as h2, i as i2, j as j2, k as k2, l as l2, m as m2, n as n2, o as o2, p, q, r as r2, s, t as t2, u, v, w, x, y, z, A, B, C, D as D2, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as } from "../common-D0EYVGB2.js";
|
|
3
3
|
import { detectFileType, formatFileSize, parseFile, parseFiles, parseImage, parseImageFile, parsePSD, parsePSDFile, parseTIFF, parseTIFFFile } from "./ImageParserUtils/index.js";
|
|
4
4
|
import { s as s2 } from "../dateShortcuts-DjFC_Txu.js";
|
|
5
5
|
export {
|
|
@@ -20,7 +20,7 @@ export {
|
|
|
20
20
|
l2 as copyText,
|
|
21
21
|
m2 as copyWord,
|
|
22
22
|
n2 as createFileLocalUrl,
|
|
23
|
-
|
|
23
|
+
o2 as createUuid,
|
|
24
24
|
p as currentDaysLessFivedays,
|
|
25
25
|
q as debounce,
|
|
26
26
|
detectFileType,
|
|
@@ -59,14 +59,15 @@ export {
|
|
|
59
59
|
R as getUrlSuffix,
|
|
60
60
|
S as getXmlKeyValue,
|
|
61
61
|
T as hasInvalidFileNameChars,
|
|
62
|
+
h as hasPlatformImageResizeParams,
|
|
62
63
|
i as imgUrlConfigKey,
|
|
63
|
-
|
|
64
|
+
j as initNetworkListener,
|
|
64
65
|
U as isCmykPsd,
|
|
65
66
|
V as isFuction,
|
|
66
67
|
W as isMobileDevice,
|
|
67
68
|
X as isPdfUrl,
|
|
68
69
|
Y as isSameDay,
|
|
69
|
-
|
|
70
|
+
k as isUnsupportedImg,
|
|
70
71
|
Z as localUrlToFile,
|
|
71
72
|
_ as longestContinuousMatch,
|
|
72
73
|
$ as mergeColumns,
|
|
@@ -77,7 +78,7 @@ export {
|
|
|
77
78
|
m as montageImgUrl,
|
|
78
79
|
a4 as nameReg,
|
|
79
80
|
n as networkKey,
|
|
80
|
-
|
|
81
|
+
l as notSupportedImgTypes,
|
|
81
82
|
a5 as numberFilter,
|
|
82
83
|
a6 as numberToChinese,
|
|
83
84
|
a7 as numberToRatio,
|
|
@@ -100,7 +101,7 @@ export {
|
|
|
100
101
|
ag as pwdReg,
|
|
101
102
|
ah as ratioToNumber,
|
|
102
103
|
r as removeImageUrlQuery,
|
|
103
|
-
|
|
104
|
+
o as replaceUnsupportedImg,
|
|
104
105
|
s2 as shortcuts,
|
|
105
106
|
ai as sleep,
|
|
106
107
|
aj as splitArray,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fangguo-component",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"lint:fix": "oxlint --fix",
|
|
85
85
|
"typecheck": "vue-tsc --noEmit -p tsconfig.check-src.json",
|
|
86
86
|
"build:npm": "vite build --mode npm",
|
|
87
|
-
"publish:npm": "pnpm publish --no-git-checks",
|
|
87
|
+
"publish:npm": "pnpm build:npm && pnpm publish --no-git-checks",
|
|
88
88
|
"docs:gen": "npx tsx scripts/gen-docs.ts",
|
|
89
89
|
"docs:dev": "vitepress dev docs",
|
|
90
90
|
"docs:build": "vitepress build docs && pnpm --dir mcp/fangguo-component-mcp-server exec tsx src/generateCatalog.ts --out ../../docs/.vitepress/dist/catalog.json",
|