@blocklet/pages-kit 0.2.421 → 0.2.423

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.
@@ -5,9 +5,10 @@ const ufo_1 = require("ufo");
5
5
  const request_1 = require("./request");
6
6
  const presets = {
7
7
  avatar: { w: 80 },
8
+ default: { w: 1200 },
8
9
  };
9
10
  function getAssetUrl({ blockletDid, aid, filename, w, preset, }) {
10
- var _a;
11
+ var _a, _b;
11
12
  const url = filename && aid && !(filename === null || filename === void 0 ? void 0 : filename.startsWith('http'))
12
13
  ? (0, ufo_1.withQuery)((0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/agents', aid, 'assets', filename), {
13
14
  blockletDid,
@@ -15,9 +16,10 @@ function getAssetUrl({ blockletDid, aid, filename, w, preset, }) {
15
16
  : filename;
16
17
  if (!url)
17
18
  return url;
18
- const width = w !== null && w !== void 0 ? w : (_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.w;
19
+ const width = (_b = w !== null && w !== void 0 ? w : (_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.w) !== null && _b !== void 0 ? _b : presets.default.w;
19
20
  return (0, ufo_1.withQuery)(url, {
20
21
  imageFilter: width ? 'resize' : undefined,
22
+ f: 'webp',
21
23
  w: width,
22
24
  });
23
25
  }
@@ -20,6 +20,7 @@ const types_1 = require("@blocklet/ai-runtime/types");
20
20
  const react_1 = require("@iconify/react");
21
21
  const material_1 = require("@mui/material");
22
22
  const react_2 = require("react");
23
+ const ufo_1 = require("ufo");
23
24
  const ux_1 = require("../../../../arcblock/ux");
24
25
  const locale_1 = require("../../../../locale");
25
26
  const session_1 = require("../../../../session");
@@ -57,7 +58,7 @@ function PhotoGalleryItem() {
57
58
  opacity: 1,
58
59
  },
59
60
  },
60
- }, onClick: () => setOpenDialog(true), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: url, alt: "", width: "100%", height: "100%",
61
+ }, onClick: () => setOpenDialog(true), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: (0, ufo_1.withQuery)(url, { imageFilter: 'resize', w: 500 }), alt: "", width: "100%", height: "100%",
61
62
  // 首屏 image 不能用 lazy,会闪烁乱序
62
63
  loading: index < 12 ? 'eager' : 'lazy' }), (0, jsx_runtime_1.jsx)(material_1.Box, { className: "photo-wall-item-alt", sx: {
63
64
  position: 'absolute',