@blocklet/list 0.14.8 → 0.14.10

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.
Files changed (2) hide show
  1. package/lib/index.es.js +305 -286
  2. package/package.json +3 -3
package/lib/index.es.js CHANGED
@@ -1,17 +1,17 @@
1
- import { jsx as t, jsxs as f, Fragment as M } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as f, Fragment as N } from "react/jsx-runtime";
2
2
  import { styled as q, useTheme as de } from "@arcblock/ux/lib/Theme";
3
3
  import Ge from "@mui/material/styles/createTheme";
4
4
  import Ke from "@mui/material/styles/ThemeProvider";
5
5
  import Xe from "lodash/merge";
6
6
  import { ErrorFallback as ue } from "@arcblock/ux/lib/ErrorBoundary";
7
- import k from "@mui/material/Box";
8
- import A from "@mui/material/Stack";
7
+ import w from "@mui/material/Box";
8
+ import T from "@mui/material/Stack";
9
9
  import { ErrorBoundary as Qe } from "react-error-boundary";
10
10
  import Ye from "@iconify-icons/tabler/compass";
11
11
  import { Icon as Be } from "@iconify/react";
12
12
  import he from "@mui/icons-material/Close";
13
13
  import x from "@mui/material/Typography";
14
- import { createContext as Re, useState as F, useMemo as $, useContext as Pe, useCallback as ae, useEffect as j, forwardRef as Ze, useRef as ce, memo as Je } from "react";
14
+ import { createContext as Re, useState as L, useMemo as $, useContext as Pe, useCallback as ae, useEffect as j, forwardRef as Ze, useRef as ce, memo as Je } from "react";
15
15
  import { createAxios as Te } from "@blocklet/js-sdk";
16
16
  import et from "lodash/orderBy";
17
17
  import { useRequest as Z, useDebounceFn as Ae, useInfiniteScroll as tt, useReactive as rt } from "ahooks";
@@ -38,33 +38,34 @@ import ft from "@mui/material/SvgIcon";
38
38
  import gt from "lodash/isEmpty";
39
39
  import ee from "@mui/material/CircularProgress";
40
40
  import _e from "@arcblock/ux/lib/Avatar";
41
- import yt from "@arcblock/ux/lib/Img";
42
- import xt from "@iconify-icons/tabler/cloud-download";
43
- import bt from "@mui/icons-material/ChevronLeft";
41
+ import yt from "@iconify-icons/tabler/cloud-download";
42
+ import xt from "@mui/icons-material/ChevronLeft";
44
43
  import wt from "@mui/icons-material/ChevronRight";
45
- import kt from "react-image-gallery";
44
+ import bt from "react-image-gallery";
45
+ import kt from "@arcblock/ux/lib/Img";
46
+ import vt from "@mui/material/Skeleton";
46
47
  import "react-image-gallery/styles/css/image-gallery.css";
47
- import be from "@mui/material/Grid";
48
- import vt from "react-infinite-scroll-hook";
49
- import Ct from "@mui/material/Chip";
48
+ import we from "@mui/material/Grid";
49
+ import Ct from "react-infinite-scroll-hook";
50
+ import St from "@mui/material/Chip";
50
51
  import Y from "@mui/icons-material/Search";
51
- import St from "@mui/icons-material/Verified";
52
- import It from "@mui/material/Autocomplete";
53
- import Bt from "@mui/material/Dialog";
52
+ import It from "@mui/icons-material/Verified";
53
+ import Bt from "@mui/material/Autocomplete";
54
+ import Rt from "@mui/material/Dialog";
54
55
  import Ee from "@mui/material/OutlinedInput";
55
- import Rt from "@mui/material/TextField";
56
- import { useHotkeys as Pt } from "react-hotkeys-hook";
57
- import we from "@mui/material/InputAdornment";
58
- import Tt from "@arcblock/ux/lib/Empty";
59
- import At from "json-stable-stringify";
60
- import Ft from "@mui/icons-material/Menu";
56
+ import Pt from "@mui/material/TextField";
57
+ import { useHotkeys as Tt } from "react-hotkeys-hook";
58
+ import be from "@mui/material/InputAdornment";
59
+ import At from "@arcblock/ux/lib/Empty";
60
+ import Ft from "json-stable-stringify";
61
+ import Lt from "@mui/icons-material/Menu";
61
62
  const Me = Re({
62
63
  open: !1,
63
64
  toggleOpen: (e) => {
64
65
  }
65
66
  });
66
- function Lt({ children: e }) {
67
- const [r, o] = F(!1), n = (s) => {
67
+ function Ot({ children: e }) {
68
+ const [r, o] = L(!1), n = (s) => {
68
69
  o(s ?? !s);
69
70
  }, i = $(() => ({ open: r, toggleOpen: n }), [r]);
70
71
  return /* @__PURE__ */ t(Me.Provider, { value: i, children: e });
@@ -86,14 +87,14 @@ const P = {
86
87
  explorePath: "/api/blocklets/explore",
87
88
  exploreDidsPath: "/api/blocklets/dids",
88
89
  cacheSize: 100
89
- }, Ot = (e) => Z(
90
+ }, zt = (e) => Z(
90
91
  async () => {
91
92
  const { data: r } = await e.get(P.categoriesPath);
92
93
  return Array.isArray(r) ? r : [];
93
94
  },
94
95
  { manual: !0 }
95
96
  );
96
- function zt(e, r) {
97
+ function _t(e, r) {
97
98
  const o = { sortBy: "popularity", sortDirection: "desc", ...e }, {
98
99
  onFilterChange: n,
99
100
  onSearchSelect: i = (l) => {
@@ -103,17 +104,17 @@ function zt(e, r) {
103
104
  } = r;
104
105
  !o.category && !s && (o.category = "All");
105
106
  const c = (l) => {
106
- const u = { ...o, ...l };
107
- n(re(u, (d) => d === "" || d === void 0));
107
+ const p = { ...o, ...l };
108
+ n(re(p, (d) => d === "" || d === void 0));
108
109
  };
109
110
  return {
110
111
  filters: e,
111
112
  cleanFilter: (l) => {
112
- const u = l ? re(o, (d, g) => l.includes(g)) : {};
113
- n(re(u, (d) => d === "" || d === void 0));
113
+ const p = l ? re(o, (d, g) => l.includes(g)) : {};
114
+ n(re(p, (d) => d === "" || d === void 0));
114
115
  },
115
- handleSort: (l, u) => {
116
- c({ sortBy: l, sortDirection: u || l === "nameAsc" ? "asc" : "desc" });
116
+ handleSort: (l, p) => {
117
+ c({ sortBy: l, sortDirection: p || l === "nameAsc" ? "asc" : "desc" });
117
118
  },
118
119
  handleKeyword: (l) => {
119
120
  c({ category: void 0, keyword: l || void 0 });
@@ -138,7 +139,7 @@ function zt(e, r) {
138
139
  }
139
140
  };
140
141
  }
141
- const _t = (e, r, o) => e && r || !o, Ne = (e) => [
142
+ const Et = (e, r, o) => e && r || !o, Ne = (e) => [
142
143
  {
143
144
  name: e("sort.popularity"),
144
145
  value: "popularity"
@@ -158,18 +159,18 @@ const _t = (e, r, o) => e && r || !o, Ne = (e) => [
158
159
  return i.imageFilter ? it({ ...n, search: "" }) : e;
159
160
  if (i.imageFilter)
160
161
  return e;
161
- const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: l, h: u } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
162
+ const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: l, h: p } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
162
163
  return pe(e, {
163
- ...l || u ? { imageFilter: "resize", w: l, h: u } : {},
164
+ ...l || p ? { imageFilter: "resize", w: l, h: p } : {},
164
165
  v: c
165
166
  });
166
- }, Et = (e) => [
167
+ }, Mt = (e) => [
167
168
  { name: e("blocklet.free"), value: "free" },
168
169
  { name: e("blocklet.payment"), value: "payment" }
169
- ], Mt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Nt = (e, r) => (
170
+ ], Nt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Dt = (e, r) => (
170
171
  // eslint-disable-next-line no-prototype-builtins
171
172
  e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
172
- ), Dt = () => window.innerWidth <= 600, Wt = {
173
+ ), Wt = () => window.innerWidth <= 600, $t = {
173
174
  common: {
174
175
  title: "Blocklet Store",
175
176
  searchStore: "Search Blocklet",
@@ -218,7 +219,7 @@ const _t = (e, r, o) => e && r || !o, Ne = (e) => [
218
219
  autocomplete: {
219
220
  expandResult: 'View all search results for "{name}"'
220
221
  }
221
- }, $t = {
222
+ }, jt = {
222
223
  common: {
223
224
  title: "Blocklet 商店",
224
225
  searchStore: "搜索 Blocklet",
@@ -268,14 +269,14 @@ const _t = (e, r, o) => e && r || !o, Ne = (e) => [
268
269
  expandResult: "查看 “{name}” 的所有搜索结果"
269
270
  }
270
271
  }, oe = {
271
- en: xe(Wt),
272
- zh: xe($t)
272
+ en: xe($t),
273
+ zh: xe(jt)
273
274
  }, We = (e, r) => {
274
275
  const o = {};
275
276
  return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
276
- }, jt = (e) => (r, o) => {
277
+ }, Ut = (e) => (r, o) => {
277
278
  const n = oe[e] ? oe[e][r] : oe.en[r];
278
- return Nt(n, o) || r;
279
+ return Dt(n, o) || r;
279
280
  }, $e = {
280
281
  errors: {
281
282
  fetchCategoriesError: null
@@ -328,8 +329,8 @@ const _t = (e, r, o) => e && r || !o, Ne = (e) => [
328
329
  handlePage: () => {
329
330
  }
330
331
  }
331
- }, je = Re($e), { Provider: Ut, Consumer: wo } = je;
332
- function Vt(e) {
332
+ }, je = Re($e), { Provider: Vt, Consumer: Co } = je;
333
+ function Ht(e) {
333
334
  const {
334
335
  locale: r = "zh",
335
336
  filters: o = {},
@@ -339,35 +340,35 @@ function Vt(e) {
339
340
  minItemWidth: s = 350,
340
341
  queryFilter: c = !0,
341
342
  layout: l = {},
342
- wrapChildren: u = (R) => R,
343
+ wrapChildren: p = (R) => R,
343
344
  extraFilter: d = (R) => R,
344
345
  baseSearch: g = !1,
345
346
  fetchCategoryDelay: h = 0,
346
- showResourcesSwitch: p = !1,
347
- showCategory: C = !0,
348
- tagFilters: S = [],
349
- children: I,
350
- storeVersion: m,
351
- onSearchSelect: y = () => {
347
+ showResourcesSwitch: m = !1,
348
+ showCategory: k = !0,
349
+ tagFilters: C = [],
350
+ children: S,
351
+ storeVersion: B,
352
+ onSearchSelect: u = () => {
352
353
  },
353
- endpoint: b,
354
- blockletRender: w
355
- } = e, T = We(n, m), O = $(() => Te({ baseURL: b, headers: T }), [b]), N = zt(o, { onFilterChange: i, emptyCategory: !l.showExplore, onSearchSelect: y }), [z, U] = F(""), {
354
+ endpoint: v,
355
+ blockletRender: y
356
+ } = e, A = We(n, B), F = $(() => Te({ baseURL: v, headers: A }), [v]), O = _t(o, { onFilterChange: i, emptyCategory: !l.showExplore, onSearchSelect: u }), [_, U] = L(""), {
356
357
  data: V = [],
357
358
  error: te,
358
359
  loading: G,
359
360
  run: K
360
- } = Ot(O), D = $(() => {
361
- const R = et(V, [(E) => E.name], ["asc"]), L = R.findIndex((E) => E.name === "All" || E.locales.en === "All");
362
- return L > -1 ? [{ ...R[L], _id: "All" }, ...R.slice(0, L), ...R.slice(L + 1)] : R;
363
- }, [V]), H = ae(jt(r), [r]), a = $(() => Mt(D, r), [D, r]), v = Et(H), _ = {
364
- search: N,
361
+ } = zt(F), D = $(() => {
362
+ const R = et(V, [(M) => M.name], ["asc"]), z = R.findIndex((M) => M.name === "All" || M.locales.en === "All");
363
+ return z > -1 ? [{ ...R[z], _id: "All" }, ...R.slice(0, z), ...R.slice(z + 1)] : R;
364
+ }, [V]), H = ae(Ut(r), [r]), a = $(() => Nt(D, r), [D, r]), b = Mt(H), E = {
365
+ search: O,
365
366
  errors: { fetchCategoriesError: te },
366
367
  loadings: {
367
368
  fetchCategoriesLoading: G
368
369
  },
369
370
  extraFilter: d,
370
- endpoint: b,
371
+ endpoint: v,
371
372
  queryFilter: c,
372
373
  layout: {
373
374
  showExplore: l.showExplore ?? !1,
@@ -376,38 +377,38 @@ function Vt(e) {
376
377
  showSearch: l.showSearch ?? !0
377
378
  },
378
379
  minItemWidth: s,
379
- wrapChildren: u,
380
+ wrapChildren: p,
380
381
  t: H,
381
- storeVersion: m,
382
+ storeVersion: B,
382
383
  serverVersion: n,
383
- selectedCategory: N.filters.category || (l.showExplore ? "" : "All"),
384
+ selectedCategory: O.filters.category || (l.showExplore ? "" : "All"),
384
385
  categoryList: D,
385
- blockletRender: w,
386
+ blockletRender: y,
386
387
  locale: r,
387
388
  categoryOptions: a,
388
- priceOptions: v,
389
- storeApi: O,
389
+ priceOptions: b,
390
+ storeApi: F,
390
391
  baseSearch: g,
391
- showResourcesSwitch: p,
392
- showCategory: C,
393
- tagFilters: S,
392
+ showResourcesSwitch: m,
393
+ showCategory: k,
394
+ tagFilters: C,
394
395
  onFilterChange: i,
395
396
  getCategoryLocale: (R) => {
396
397
  if (!R)
397
398
  return null;
398
- const L = V.find((E) => E._id === R || E.locales.en === "All");
399
- return L ? L.locales[r] || L.locales.en : null;
399
+ const z = V.find((M) => M._id === R || M.locales.en === "All");
400
+ return z ? z.locales[r] || z.locales.en : null;
400
401
  },
401
402
  get developerName() {
402
- return z;
403
+ return _;
403
404
  },
404
405
  updateDeveloperName: U
405
406
  };
406
407
  return j(() => {
407
408
  setTimeout(K, h || 0);
408
- }, [b, K, h]), /* @__PURE__ */ t(Ut, { value: _, children: I });
409
+ }, [v, K, h]), /* @__PURE__ */ t(Vt, { value: E, children: S });
409
410
  }
410
- function B() {
411
+ function I() {
411
412
  const e = Pe(je);
412
413
  return e || $e;
413
414
  }
@@ -452,23 +453,23 @@ function fe({
452
453
  xl: i,
453
454
  exact: s
454
455
  }) {
455
- const c = st(), l = W(c.breakpoints.down("sm")), u = W(c.breakpoints.between("sm", "md")), d = W(c.breakpoints.between("md", "lg")), g = W(c.breakpoints.between("lg", "xl"));
456
+ const c = st(), l = W(c.breakpoints.down("sm")), p = W(c.breakpoints.between("sm", "md")), d = W(c.breakpoints.between("md", "lg")), g = W(c.breakpoints.between("lg", "xl"));
456
457
  if (s)
457
- return l ? e || null : u ? r || null : d ? o || null : g ? n || null : i || null;
458
+ return l ? e || null : p ? r || null : d ? o || null : g ? n || null : i || null;
458
459
  let h = e;
459
- return l || (h = X(r, h), u) || (h = X(o, h), d) || (h = X(n, h), g) ? h : X(i, h);
460
+ return l || (h = X(r, h), p) || (h = X(o, h), d) || (h = X(n, h), g) ? h : X(i, h);
460
461
  }
461
- function Ht({ children: e }) {
462
+ function qt({ children: e }) {
462
463
  const { open: r, toggleOpen: o } = me();
463
464
  return /* @__PURE__ */ t(
464
465
  fe,
465
466
  {
466
467
  xs: /* @__PURE__ */ t(at, { open: r, onClose: () => o(!1), children: e }),
467
- md: /* @__PURE__ */ t(k, { children: e })
468
+ md: /* @__PURE__ */ t(w, { children: e })
468
469
  }
469
470
  );
470
471
  }
471
- const qt = Ze(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
472
+ const Gt = Ze(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
472
473
  J,
473
474
  {
474
475
  ref: n,
@@ -480,58 +481,58 @@ const qt = Ze(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
480
481
  }
481
482
  ));
482
483
  function Ve({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
483
- var m;
484
- const s = ce(null), c = de(), [l, u] = F(!1), [d, g] = F(e !== null ? e : ""), h = W(c.breakpoints.down("sm"));
484
+ var B;
485
+ const s = ce(null), c = de(), [l, p] = L(!1), [d, g] = L(e !== null ? e : ""), h = W(c.breakpoints.down("sm"));
485
486
  j(() => {
486
487
  g(e !== null ? e : "");
487
488
  }, [e]);
488
- const p = ae(() => {
489
- u(!1);
490
- }, []), C = ae(() => {
491
- u(!0);
489
+ const m = ae(() => {
490
+ p(!1);
491
+ }, []), k = ae(() => {
492
+ p(!0);
492
493
  }, []);
493
- function S(y) {
494
- g(y.value), o(y.value), h && p();
494
+ function C(u) {
495
+ g(u.value), o(u.value), h && m();
495
496
  }
496
- function I(y) {
497
- return y === d;
497
+ function S(u) {
498
+ return u === d;
498
499
  }
499
- return /* @__PURE__ */ f(M, { children: [
500
+ return /* @__PURE__ */ f(N, { children: [
500
501
  /* @__PURE__ */ f(
501
- Gt,
502
+ Kt,
502
503
  {
503
504
  ref: s,
504
- onClick: C,
505
+ onClick: k,
505
506
  variant: "outlined",
506
507
  size: "small",
507
508
  className: ["my-select__selector", gt(d) ? "" : "my-select__selector--active"].join(" "),
508
509
  sx: { minWidth: "auto", color: "text.primary" },
509
510
  ...i,
510
511
  children: [
511
- ((m = r.find((y) => y.value === d)) == null ? void 0 : m.name) || n,
512
+ ((B = r.find((u) => u.value === d)) == null ? void 0 : B.name) || n,
512
513
  /* @__PURE__ */ t(ft, { className: "my-select__arrowdown", component: dt, fontSize: "small" })
513
514
  ]
514
515
  }
515
516
  ),
516
- /* @__PURE__ */ t(mt, { open: l, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: y, placement: b }) => /* @__PURE__ */ t(
517
+ /* @__PURE__ */ t(mt, { open: l, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: u, placement: v }) => /* @__PURE__ */ t(
517
518
  ht,
518
519
  {
519
- ...y,
520
- style: { transformOrigin: b === "bottom" ? "center top" : "center bottom" },
521
- children: /* @__PURE__ */ t(pt, { children: /* @__PURE__ */ t(ut, { onClickAway: p, children: /* @__PURE__ */ t(Kt, { autoFocusItem: l, onMouseEnter: C, onMouseLeave: p, children: r.map((w) => /* @__PURE__ */ f(Oe, { onClick: () => S(w), children: [
520
+ ...u,
521
+ style: { transformOrigin: v === "bottom" ? "center top" : "center bottom" },
522
+ children: /* @__PURE__ */ t(pt, { children: /* @__PURE__ */ t(ut, { onClickAway: m, children: /* @__PURE__ */ t(Xt, { autoFocusItem: l, onMouseEnter: k, onMouseLeave: m, children: r.map((y) => /* @__PURE__ */ f(Oe, { onClick: () => C(y), children: [
522
523
  /* @__PURE__ */ t(
523
524
  ct,
524
525
  {
525
- sx: { mr: 1, fontSize: 16, visibility: I(w.value) ? "visible" : "hidden" }
526
+ sx: { mr: 1, fontSize: 16, visibility: S(y.value) ? "visible" : "hidden" }
526
527
  }
527
528
  ),
528
- w.name
529
- ] }, w.value)) }) }) })
529
+ y.name
530
+ ] }, y.value)) }) }) })
530
531
  }
531
532
  ) })
532
533
  ] });
533
534
  }
534
- const Gt = q(qt)`
535
+ const Kt = q(Gt)`
535
536
  border: 1px solid #f0f0f0;
536
537
  padding: 6px 8px 6px 12px;
537
538
  font-weight: ${(e) => e.theme.typography.fontWeightRegular};
@@ -559,7 +560,7 @@ const Gt = q(qt)`
559
560
  margin-right: 3px;
560
561
  }
561
562
  }
562
- `, Kt = q(ze)`
563
+ `, Xt = q(ze)`
563
564
  .my-select__option__icon {
564
565
  color: transparent;
565
566
  font-size: 14px;
@@ -577,9 +578,9 @@ const Gt = q(qt)`
577
578
  }
578
579
  `;
579
580
  function He() {
580
- const { search: e, t: r } = B(), { filters: o, handleSort: n, handlePrice: i } = e, s = Ne(r);
581
+ const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice: i } = e, s = Ne(r);
581
582
  return /* @__PURE__ */ f(
582
- A,
583
+ T,
583
584
  {
584
585
  direction: { xs: "row", md: "column" },
585
586
  alignItems: { xs: "center", md: "flex-start" },
@@ -615,18 +616,18 @@ function He() {
615
616
  }
616
617
  );
617
618
  }
618
- function Xt() {
619
- const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout: s, baseSearch: c } = B(), { filters: l, handleCategory: u, cleanFilter: d } = r, { toggleOpen: g } = me();
619
+ function Qt() {
620
+ const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout: s, baseSearch: c } = I(), { filters: l, handleCategory: p, cleanFilter: d } = r, { toggleOpen: g } = me();
620
621
  j(() => {
621
622
  g(!1);
622
623
  }, [Object.values(l).join("")]);
623
- const h = _t(c, s.showSearch, l.keyword);
624
- return s.showCategory ? /* @__PURE__ */ f(Ht, { children: [
624
+ const h = Et(c, s.showSearch, l.keyword);
625
+ return s.showCategory ? /* @__PURE__ */ f(qt, { children: [
625
626
  /* @__PURE__ */ t(
626
627
  fe,
627
628
  {
628
629
  xs: /* @__PURE__ */ f(
629
- A,
630
+ T,
630
631
  {
631
632
  direction: "row",
632
633
  justifyContent: "space-between",
@@ -646,15 +647,15 @@ function Xt() {
646
647
  }
647
648
  ),
648
649
  /* @__PURE__ */ t(
649
- A,
650
+ T,
650
651
  {
651
652
  visibility: i.fetchCategoriesLoading ? "hidden" : "visible",
652
653
  width: { xs: 268, md: 200 },
653
654
  boxSizing: "content-box",
654
655
  p: { xs: 2, md: 0 },
655
656
  pr: { md: 6 },
656
- children: h ? /* @__PURE__ */ f(M, { children: [
657
- s.showExplore && /* @__PURE__ */ f(k, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
657
+ children: h ? /* @__PURE__ */ f(N, { children: [
658
+ s.showExplore && /* @__PURE__ */ f(w, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
658
659
  /* @__PURE__ */ t(Be, { icon: Ye }),
659
660
  /* @__PURE__ */ t(
660
661
  x,
@@ -670,21 +671,21 @@ function Xt() {
670
671
  }
671
672
  )
672
673
  ] }),
673
- !!n.length && /* @__PURE__ */ t(A, { gap: 2, children: n.map((p) => /* @__PURE__ */ t(
674
+ !!n.length && /* @__PURE__ */ t(T, { gap: 2, children: n.map((m) => /* @__PURE__ */ t(
674
675
  x,
675
676
  {
676
677
  variant: "body1",
677
- title: p.name,
678
+ title: m.name,
678
679
  sx: { cursor: "pointer" },
679
680
  "data-cy": "filter",
680
- color: e === p.value ? "text.primary" : "text.lighter",
681
+ color: e === m.value ? "text.primary" : "text.lighter",
681
682
  textTransform: "capitalize",
682
683
  onClick: () => {
683
- e === p.value ? d() : u(p.value), g(!1);
684
+ e === m.value ? d() : p(m.value), g(!1);
684
685
  },
685
- children: p.name
686
+ children: m.name
686
687
  },
687
- p.value
688
+ m.value
688
689
  )) })
689
690
  ] }) : /* @__PURE__ */ t(He, {})
690
691
  }
@@ -692,7 +693,7 @@ function Xt() {
692
693
  ] }) : null;
693
694
  }
694
695
  function ge() {
695
- const { endpoint: e, serverVersion: r, storeVersion: o } = B(), n = We(r, o), i = $(() => Te({
696
+ const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n = We(r, o), i = $(() => Te({
696
697
  baseURL: e,
697
698
  headers: n
698
699
  }), [e]);
@@ -708,15 +709,18 @@ function ge() {
708
709
  };
709
710
  }
710
711
  const qe = Je(function(r) {
711
- return /* @__PURE__ */ t(k, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(ee, {}) });
712
+ return /* @__PURE__ */ t(w, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(ee, {}) });
712
713
  });
714
+ function Yt({ showSkeleton: e, ...r }) {
715
+ return e ? /* @__PURE__ */ t(vt, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(kt, { ...r });
716
+ }
713
717
  function ke({
714
718
  icon: e,
715
719
  children: r,
716
720
  maxWidth: o = 100,
717
721
  title: n
718
722
  }) {
719
- return (r === 0 || r) && /* @__PURE__ */ f(A, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
723
+ return (r === 0 || r) && /* @__PURE__ */ f(T, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
720
724
  e,
721
725
  /* @__PURE__ */ t(
722
726
  x,
@@ -731,16 +735,20 @@ function ke({
731
735
  ] });
732
736
  }
733
737
  const ve = 292;
734
- function Qt() {
735
- var S, I;
736
- const { t: e, search: r } = B(), { get: o } = ge(), n = de(), i = W(n.breakpoints.down("md")), s = ((I = (S = window.blocklet) == null ? void 0 : S.preferences) == null ? void 0 : I.homeBanner) || [], { data: c = [], error: l } = Z(async () => {
737
- const m = await o(
738
- pe(P.blockletsPath, { didList: s.map((y) => y.did).join(",") })
738
+ function Zt() {
739
+ var S, B;
740
+ const { t: e, search: r } = I(), { get: o } = ge(), n = de(), i = W(n.breakpoints.down("md")), s = ((B = (S = window.blocklet) == null ? void 0 : S.preferences) == null ? void 0 : B.homeBanner) || [], {
741
+ data: c = [],
742
+ error: l,
743
+ loading: p
744
+ } = Z(async () => {
745
+ const u = await o(
746
+ pe(P.blockletsPath, { didList: s.map((v) => v.did).join(",") })
739
747
  );
740
- return m != null && m.dataList ? s.map((y) => m.dataList.find((b) => b.did === y.did)) : [];
748
+ return u != null && u.dataList ? s.map((v) => u.dataList.find((y) => y.did === v.did)) : [];
741
749
  });
742
750
  l && console.error("Get Banner Blocklets error:", l);
743
- const u = {
751
+ const d = {
744
752
  position: "absolute",
745
753
  top: "50%",
746
754
  transform: "translateY(-50%)",
@@ -748,10 +756,10 @@ function Qt() {
748
756
  cursor: "pointer",
749
757
  color: "text.lighter"
750
758
  };
751
- return !l && s.length > 0 ? /* @__PURE__ */ f(M, { children: [
759
+ return !l && s.length > 0 ? /* @__PURE__ */ f(N, { children: [
752
760
  /* @__PURE__ */ t(x, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
753
761
  /* @__PURE__ */ t(
754
- k,
762
+ w,
755
763
  {
756
764
  height: { xs: "auto", md: ve },
757
765
  position: "relative",
@@ -760,26 +768,26 @@ function Qt() {
760
768
  borderRadius: 3,
761
769
  overflow: "hidden",
762
770
  children: /* @__PURE__ */ t(
763
- kt,
771
+ bt,
764
772
  {
765
773
  showNav: !0,
766
774
  autoPlay: !0,
767
- slideDuration: 1e3,
775
+ slideDuration: i ? 500 : 1e3,
768
776
  slideInterval: 5e3,
769
777
  showPlayButton: !1,
770
778
  showIndex: !1,
771
779
  showBullets: !1,
772
780
  showThumbnails: !1,
773
781
  showFullscreenButton: !1,
774
- renderLeftNav: (m) => /* @__PURE__ */ t(k, { onClick: m, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(bt, { sx: { ...u, left: 5 } }) }),
775
- renderRightNav: (m) => /* @__PURE__ */ t(k, { onClick: m, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(wt, { sx: { ...u, right: 5 } }) }),
776
- items: s.map((m, y) => ({
777
- original: m.did,
782
+ renderLeftNav: (u) => /* @__PURE__ */ t(w, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(xt, { sx: { ...d, left: 5 } }) }),
783
+ renderRightNav: (u) => /* @__PURE__ */ t(w, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(wt, { sx: { ...d, right: 5 } }) }),
784
+ items: s.map((u, v) => ({
785
+ original: u.did,
778
786
  renderItem: () => {
779
787
  var O;
780
- const b = c[y] || {}, w = m.cover || Zt(m.did, (O = b.screenshots) == null ? void 0 : O[0]), T = De(w, { h: 400, w: 700 });
788
+ const y = c[v] || {}, A = u.cover || er(u.did, (O = y.screenshots) == null ? void 0 : O[0]), F = De(A, { h: 400, w: 700 });
781
789
  return /* @__PURE__ */ f(
782
- A,
790
+ T,
783
791
  {
784
792
  height: { xs: "auto", md: ve },
785
793
  sx: {
@@ -791,7 +799,7 @@ function Qt() {
791
799
  right: 0,
792
800
  bottom: 0,
793
801
  cursor: "pointer",
794
- backgroundImage: `url("${T}")`,
802
+ backgroundImage: `url("${F}")`,
795
803
  backgroundSize: "cover",
796
804
  filter: "blur(50px)",
797
805
  opacity: 0.15,
@@ -803,17 +811,17 @@ function Qt() {
803
811
  justifyContent: "center",
804
812
  alignItems: { xs: "flex-start", md: "center" },
805
813
  p: { xs: 2, md: 5 },
806
- onClick: () => r.handleSearchSelect(b),
814
+ onClick: () => r.handleSearchSelect(y),
807
815
  gap: { xs: 2, md: 5 },
808
816
  children: [
809
- d(T),
810
- /* @__PURE__ */ f(A, { flex: 1, height: "100%", gap: 3, children: [
811
- /* @__PURE__ */ f(k, { flex: 1, children: [
812
- g(m.name || b.title || m.name),
813
- h(m.desc || b.description)
817
+ g(F),
818
+ /* @__PURE__ */ f(T, { flex: 1, height: "100%", gap: 3, children: [
819
+ /* @__PURE__ */ f(w, { flex: 1, children: [
820
+ h(u.name || y.title || u.name),
821
+ m(u.desc || y.description)
814
822
  ] }),
815
- b.did && p(b, m.baseNum),
816
- C(b)
823
+ y.did && k(y, u.baseNum),
824
+ C(y)
817
825
  ] })
818
826
  ]
819
827
  }
@@ -825,13 +833,23 @@ function Qt() {
825
833
  }
826
834
  )
827
835
  ] }) : null;
828
- function d(m) {
829
- return /* @__PURE__ */ t(k, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(yt, { src: m, alt: "", width: i ? void 0 : 338, height: 210, style: { objectFit: "cover" } }) });
836
+ function g(u) {
837
+ return /* @__PURE__ */ t(w, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
838
+ Yt,
839
+ {
840
+ showSkeleton: p,
841
+ src: u,
842
+ alt: "",
843
+ width: i ? void 0 : 338,
844
+ height: 210,
845
+ style: { objectFit: "cover" }
846
+ }
847
+ ) });
830
848
  }
831
- function g(m) {
832
- return /* @__PURE__ */ t(x, { variant: "h2", width: "100%", children: m });
849
+ function h(u) {
850
+ return /* @__PURE__ */ t(x, { variant: "h2", width: "100%", children: u });
833
851
  }
834
- function h(m) {
852
+ function m(u) {
835
853
  return /* @__PURE__ */ t(
836
854
  x,
837
855
  {
@@ -851,24 +869,24 @@ function Qt() {
851
869
  overflow: "hidden",
852
870
  WebkitBoxOrient: "vertical"
853
871
  },
854
- children: m
872
+ children: u
855
873
  }
856
874
  );
857
875
  }
858
- function p(m, y = 0) {
859
- const { did: b, owner: w, stats: T } = m;
860
- return /* @__PURE__ */ f(k, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
861
- /* @__PURE__ */ t(ke, { icon: /* @__PURE__ */ t(_e, { src: w.avatar, did: b, size: 20, variant: "circle" }), children: w.fullName }),
862
- /* @__PURE__ */ t(ke, { icon: /* @__PURE__ */ t(Be, { icon: xt }), title: `${T.downloads + y}`, children: Yt(T.downloads + y) })
876
+ function k(u, v = 0) {
877
+ const { did: y, owner: A, stats: F } = u;
878
+ return /* @__PURE__ */ f(w, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
879
+ /* @__PURE__ */ t(ke, { icon: /* @__PURE__ */ t(_e, { src: A.avatar, did: y, size: 20, variant: "circle" }), children: A.fullName }),
880
+ /* @__PURE__ */ t(ke, { icon: /* @__PURE__ */ t(Be, { icon: yt }), title: `${F.downloads + v}`, children: Jt(F.downloads + v) })
863
881
  ] });
864
882
  }
865
- function C(m) {
883
+ function C(u) {
866
884
  return /* @__PURE__ */ t(
867
885
  J,
868
886
  {
869
887
  variant: "outlined",
870
888
  size: "small",
871
- onClick: () => r.handleSearchSelect(m),
889
+ onClick: () => r.handleSearchSelect(u),
872
890
  sx: {
873
891
  width: "fit-content",
874
892
  textTransform: "none",
@@ -882,16 +900,16 @@ function Qt() {
882
900
  );
883
901
  }
884
902
  }
885
- const Yt = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`, Zt = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
886
- function Jt({ title: e, blocklets: r }) {
887
- const { blockletRender: o, serverVersion: n } = B();
888
- return /* @__PURE__ */ f(k, { mt: 3, children: [
903
+ const Jt = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`, er = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
904
+ function tr({ title: e, blocklets: r }) {
905
+ const { blockletRender: o, serverVersion: n } = I();
906
+ return /* @__PURE__ */ f(w, { mt: 3, children: [
889
907
  /* @__PURE__ */ t(x, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
890
- /* @__PURE__ */ t(be, { container: !0, spacing: 2, children: r.map((i) => /* @__PURE__ */ t(be, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": i.did, children: /* @__PURE__ */ t(k, { padding: "1px", children: o({ blocklet: i, blocklets: r, serverVersion: n }) }) }, i.did)) })
908
+ /* @__PURE__ */ t(we, { container: !0, spacing: 2, children: r.map((i) => /* @__PURE__ */ t(we, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": i.did, children: /* @__PURE__ */ t(w, { padding: "1px", children: o({ blocklet: i, blocklets: r, serverVersion: n }) }) }, i.did)) })
891
909
  ] });
892
910
  }
893
- function er() {
894
- const { get: e } = ge(), { t: r } = B(), {
911
+ function rr() {
912
+ const { get: e } = ge(), { t: r } = I(), {
895
913
  data: o = [],
896
914
  error: n,
897
915
  loading: i
@@ -899,15 +917,15 @@ function er() {
899
917
  const s = await e(P.explorePath);
900
918
  return Array.isArray(s) ? s : [];
901
919
  });
902
- return n ? /* @__PURE__ */ t(ue, { error: new Error(`Failed to fetch blocklets from ${P.explorePath}`) }) : i ? /* @__PURE__ */ t(qe, { mt: 15 }) : /* @__PURE__ */ f(M, { children: [
903
- /* @__PURE__ */ t(Qt, {}),
920
+ return n ? /* @__PURE__ */ t(ue, { error: new Error(`Failed to fetch blocklets from ${P.explorePath}`) }) : i ? /* @__PURE__ */ t(qe, { mt: 15 }) : /* @__PURE__ */ f(N, { children: [
921
+ /* @__PURE__ */ t(Zt, {}),
904
922
  o.map(
905
- (s) => s.blocklets.length > 0 ? /* @__PURE__ */ t(Jt, { title: r(`explore.${s.type}`), blocklets: s.blocklets }, s.type) : null
923
+ (s) => s.blocklets.length > 0 ? /* @__PURE__ */ t(tr, { title: r(`explore.${s.type}`), blocklets: s.blocklets }, s.type) : null
906
924
  )
907
925
  ] });
908
926
  }
909
927
  const ne = "__FREE_TEXT__", Ce = "__NO_RESULT__", le = 40;
910
- function tr({
928
+ function or({
911
929
  endpoint: e,
912
930
  t: r,
913
931
  locale: o,
@@ -916,12 +934,12 @@ function tr({
916
934
  handleSearchSelect: s,
917
935
  ...c
918
936
  }) {
919
- const l = ce(null), u = ce(!1), [d, g] = F(!1), [h, p] = F(""), [C, S] = F(!1), I = ge(), [m, y] = F(!1), b = async (a) => {
920
- y(!0);
921
- const v = await I.get(ye(e, pe(P.blockletsPath, a)));
922
- return y(!1), v.dataList || [];
923
- }, { data: w, run: T } = Z(
924
- (a) => a ? b({
937
+ const l = ce(null), p = ce(!1), [d, g] = L(!1), [h, m] = L(""), [k, C] = L(!1), S = ge(), [B, u] = L(!1), v = async (a) => {
938
+ u(!0);
939
+ const b = await S.get(ye(e, pe(P.blockletsPath, a)));
940
+ return u(!1), b.dataList || [];
941
+ }, { data: y, run: A } = Z(
942
+ (a) => a ? v({
925
943
  sortBy: P.nameDesc,
926
944
  page: 1,
927
945
  pageSize: 10,
@@ -932,20 +950,20 @@ function tr({
932
950
  }
933
951
  );
934
952
  j(() => {
935
- y(!0), T(n.keyword), p(n.keyword || "");
936
- }, [n.keyword, T]), Pt(
953
+ u(!0), A(n.keyword), m(n.keyword || "");
954
+ }, [n.keyword, A]), Tt(
937
955
  "ctrl + k, command + k",
938
956
  (a) => {
939
- var v, _;
940
- return a.stopPropagation(), a.preventDefault(), (_ = (v = l.current) == null ? void 0 : v.querySelector("input")) == null || _.focus(), !1;
957
+ var b, E;
958
+ return a.stopPropagation(), a.preventDefault(), (E = (b = l.current) == null ? void 0 : b.querySelector("input")) == null || E.focus(), !1;
941
959
  },
942
960
  { enableOnTags: ["INPUT"] }
943
961
  );
944
- const O = Ae((a) => T(a), { wait: 300 }), N = { name: ne, title: h, did: "" };
945
- let z = [];
946
- return h && (m ? z = [N] : w != null && w.length ? z = [N, ...w] : z = [{ name: Ce, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ f(M, { children: [
947
- /* @__PURE__ */ f(Bt, { fullScreen: !0, open: C, sx: { display: { md: "none" } }, children: [
948
- /* @__PURE__ */ f(k, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
962
+ const F = Ae((a) => A(a), { wait: 300 }), O = { name: ne, title: h, did: "" };
963
+ let _ = [];
964
+ return h && (B ? _ = [O] : y != null && y.length ? _ = [O, ...y] : _ = [{ name: Ce, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ f(N, { children: [
965
+ /* @__PURE__ */ f(Rt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
966
+ /* @__PURE__ */ f(w, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
949
967
  /* @__PURE__ */ t(
950
968
  Ee,
951
969
  {
@@ -969,7 +987,7 @@ function tr({
969
987
  className: "bl-autocomplete-input",
970
988
  value: h,
971
989
  onChange: (a) => U(a.target.value),
972
- startAdornment: D(C),
990
+ startAdornment: D(k),
973
991
  endAdornment: H()
974
992
  }
975
993
  ),
@@ -978,35 +996,35 @@ function tr({
978
996
  {
979
997
  variant: "outlined",
980
998
  onClick: () => {
981
- S(!1), p(n.keyword || "");
999
+ C(!1), m(n.keyword || "");
982
1000
  },
983
1001
  children: r("common.cancel")
984
1002
  }
985
1003
  )
986
1004
  ] }),
987
- /* @__PURE__ */ t(ze, { sx: { p: 0.5 }, children: z.map((a) => G(a)) })
1005
+ /* @__PURE__ */ t(ze, { sx: { p: 0.5 }, children: _.map((a) => G(a)) })
988
1006
  ] }),
989
1007
  /* @__PURE__ */ t(
990
1008
  Y,
991
1009
  {
992
1010
  sx: { display: { sx: "block", md: "none" }, fontSize: 28, color: "text.lighter" },
993
- onClick: () => S(!0)
1011
+ onClick: () => C(!0)
994
1012
  }
995
1013
  ),
996
1014
  /* @__PURE__ */ t(
997
- It,
1015
+ Bt,
998
1016
  {
999
1017
  ref: l,
1000
1018
  open: !!h && d,
1001
1019
  size: "small",
1002
1020
  onOpen: () => g(!0),
1003
- onClose: (a, v) => {
1004
- g(!1), v === "selectOption" && !u.current && i(h);
1021
+ onClose: (a, b) => {
1022
+ g(!1), b === "selectOption" && !p.current && i(h);
1005
1023
  },
1006
1024
  disableClearable: !0,
1007
1025
  inputValue: h,
1008
- onInputChange: (a, v) => U(v),
1009
- isOptionEqualToValue: (a, v) => a.name === v.name,
1026
+ onInputChange: (a, b) => U(b),
1027
+ isOptionEqualToValue: (a, b) => a.name === b.name,
1010
1028
  getOptionLabel: (a) => a.title,
1011
1029
  getOptionKey: (a) => a.name,
1012
1030
  noOptionsText: r("blocklet.noResults"),
@@ -1023,7 +1041,7 @@ function tr({
1023
1041
  }
1024
1042
  },
1025
1043
  renderInput: (a) => /* @__PURE__ */ t(
1026
- Rt,
1044
+ Pt,
1027
1045
  {
1028
1046
  ...a,
1029
1047
  InputProps: {
@@ -1039,9 +1057,9 @@ function tr({
1039
1057
  ),
1040
1058
  filterOptions: (a) => a,
1041
1059
  ...c,
1042
- options: z,
1043
- renderOption: (a, v) => G(v),
1044
- value: N,
1060
+ options: _,
1061
+ renderOption: (a, b) => G(b),
1062
+ value: O,
1045
1063
  sx: [
1046
1064
  {
1047
1065
  bgcolor: "#F9FAFB",
@@ -1062,16 +1080,16 @@ function tr({
1062
1080
  )
1063
1081
  ] });
1064
1082
  function U(a) {
1065
- y(!0), p(a), u.current = !1, O.run(a);
1083
+ u(!0), m(a), p.current = !1, F.run(a);
1066
1084
  }
1067
1085
  function V() {
1068
- S(!1), p(""), U(""), i("");
1086
+ C(!1), m(""), U(""), i("");
1069
1087
  }
1070
1088
  function te(a) {
1071
- a != null && a.did ? (S(!1), u.current = !0, p(""), s(a)) : a.name === ne && (S(!1), i(h));
1089
+ a != null && a.did ? (C(!1), p.current = !0, m(""), s(a)) : a.name === ne && (C(!1), i(h));
1072
1090
  }
1073
1091
  function G(a) {
1074
- var v, _;
1092
+ var b, E;
1075
1093
  return /* @__PURE__ */ f(
1076
1094
  Oe,
1077
1095
  {
@@ -1083,9 +1101,9 @@ function tr({
1083
1101
  /* @__PURE__ */ f(x, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: [
1084
1102
  a.title,
1085
1103
  " ",
1086
- /* @__PURE__ */ t(St, { sx: { color: "#D97706", fontSize: 16, display: "none" } })
1104
+ /* @__PURE__ */ t(It, { sx: { color: "#D97706", fontSize: 16, display: "none" } })
1087
1105
  ] }),
1088
- /* @__PURE__ */ t(x, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((_ = (v = a.category) == null ? void 0 : v.locales) == null ? void 0 : _[o || "en"]) || "" })
1106
+ /* @__PURE__ */ t(x, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((E = (b = a.category) == null ? void 0 : b.locales) == null ? void 0 : E[o || "en"]) || "" })
1089
1107
  ] })
1090
1108
  ]
1091
1109
  },
@@ -1095,7 +1113,7 @@ function tr({
1095
1113
  function K(a) {
1096
1114
  if ([ne, Ce].includes(a.name))
1097
1115
  return /* @__PURE__ */ t(
1098
- k,
1116
+ w,
1099
1117
  {
1100
1118
  width: le,
1101
1119
  p: "6px",
@@ -1108,18 +1126,18 @@ function tr({
1108
1126
  children: /* @__PURE__ */ t(Y, { sx: { fontSize: 28 } })
1109
1127
  }
1110
1128
  );
1111
- let v = "";
1112
- return a.logo && (v = ye(e, "assets", a.did, De(a.logo, le, a.version))), /* @__PURE__ */ t(_e, { src: v, size: le, style: { borderRadius: "8px", overflow: "hidden" } });
1129
+ let b = "";
1130
+ return a.logo && (b = ye(e, "assets", a.did, De(a.logo, le, a.version))), /* @__PURE__ */ t(_e, { src: b, size: le, style: { borderRadius: "8px", overflow: "hidden" } });
1113
1131
  }
1114
1132
  function D(a = !0) {
1115
- return /* @__PURE__ */ t(k, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: a && h && m ? /* @__PURE__ */ t(ee, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(Y, { sx: { fontSize: 16, cursor: "default" } }) });
1133
+ return /* @__PURE__ */ t(w, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: a && h && B ? /* @__PURE__ */ t(ee, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(Y, { sx: { fontSize: 16, cursor: "default" } }) });
1116
1134
  }
1117
1135
  function H() {
1118
- return h ? /* @__PURE__ */ t(k, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(he, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => V() }) }) : null;
1136
+ return h ? /* @__PURE__ */ t(w, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(he, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => V() }) }) : null;
1119
1137
  }
1120
1138
  }
1121
- function rr({ placeholder: e = "Type to search...", ...r }) {
1122
- const { search: o } = B(), { filters: n, handleKeyword: i } = o, [s, c] = F(n.keyword || ""), l = Ae(i, { wait: 300 }), u = (g) => {
1139
+ function nr({ placeholder: e = "Type to search...", ...r }) {
1140
+ const { search: o } = I(), { filters: n, handleKeyword: i } = o, [s, c] = L(n.keyword || ""), l = Ae(i, { wait: 300 }), p = (g) => {
1123
1141
  const { value: h } = g.target;
1124
1142
  c(h), l.run(h);
1125
1143
  }, d = () => {
@@ -1128,23 +1146,23 @@ function rr({ placeholder: e = "Type to search...", ...r }) {
1128
1146
  return j(() => {
1129
1147
  c(n.keyword || "");
1130
1148
  }, [n.keyword]), /* @__PURE__ */ t(
1131
- or,
1149
+ lr,
1132
1150
  {
1133
1151
  inputProps: {
1134
1152
  "data-cy": "search-blocklet"
1135
1153
  },
1136
- startAdornment: /* @__PURE__ */ t(we, { position: "start", children: /* @__PURE__ */ t(nr, {}) }),
1137
- onChange: u,
1154
+ startAdornment: /* @__PURE__ */ t(be, { position: "start", children: /* @__PURE__ */ t(ir, {}) }),
1155
+ onChange: p,
1138
1156
  placeholder: e,
1139
1157
  value: s,
1140
1158
  title: e,
1141
1159
  "data-cy": "search",
1142
- endAdornment: s && /* @__PURE__ */ t(we, { position: "end", children: /* @__PURE__ */ t(lr, { "data-cy": "search-delete", onClick: d }) }),
1160
+ endAdornment: s && /* @__PURE__ */ t(be, { position: "end", children: /* @__PURE__ */ t(sr, { "data-cy": "search-delete", onClick: d }) }),
1143
1161
  ...r
1144
1162
  }
1145
1163
  );
1146
1164
  }
1147
- const or = q(Ee)`
1165
+ const lr = q(Ee)`
1148
1166
  background-color: ${(e) => e.theme.palette.grey[50]};
1149
1167
  font-size: 14px;
1150
1168
  border-radius: 6px;
@@ -1161,21 +1179,21 @@ const or = q(Ee)`
1161
1179
  color: transparent;
1162
1180
  }
1163
1181
  }
1164
- `, nr = q(Y)`
1182
+ `, ir = q(Y)`
1165
1183
  color: ${(e) => e.theme.palette.grey[500]};
1166
1184
  font-size: 28px;
1167
1185
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
1168
1186
  font-size: 24px;
1169
1187
  }
1170
- `, lr = q(he)`
1188
+ `, sr = q(he)`
1171
1189
  color: ${(e) => e.theme.palette.grey[500]};
1172
1190
  font-size: 16px;
1173
1191
  cursor: pointer;
1174
1192
  `;
1175
- function ir() {
1176
- const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName: s, showResourcesSwitch: c, layout: l, baseSearch: u } = B(), { filters: d, handleSort: g, handlePrice: h, handleDeveloper: p, handleSwitchShowResources: C } = e, S = Ne(r);
1193
+ function ar() {
1194
+ const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName: s, showResourcesSwitch: c, layout: l, baseSearch: p } = I(), { filters: d, handleSort: g, handlePrice: h, handleDeveloper: m, handleSwitchShowResources: k } = e, C = Ne(r);
1177
1195
  return /* @__PURE__ */ f(
1178
- A,
1196
+ T,
1179
1197
  {
1180
1198
  className: "filter-bar",
1181
1199
  direction: { xs: "column", md: "row" },
@@ -1189,7 +1207,7 @@ function ir() {
1189
1207
  children: [
1190
1208
  /* @__PURE__ */ t(x, { variant: "h2", textTransform: "capitalize", children: i(d.category) }),
1191
1209
  /* @__PURE__ */ f(
1192
- A,
1210
+ T,
1193
1211
  {
1194
1212
  flex: 1,
1195
1213
  direction: "row",
@@ -1198,8 +1216,8 @@ function ir() {
1198
1216
  justifyContent: { xs: "space-between", md: "flex-end" },
1199
1217
  gap: 2,
1200
1218
  children: [
1201
- l.showSearch ? /* @__PURE__ */ t(k, { flex: 1, children: u ? /* @__PURE__ */ t(rr, {}) : /* @__PURE__ */ t(
1202
- tr,
1219
+ l.showSearch ? /* @__PURE__ */ t(w, { flex: 1, children: p ? /* @__PURE__ */ t(nr, {}) : /* @__PURE__ */ t(
1220
+ or,
1203
1221
  {
1204
1222
  locale: n,
1205
1223
  endpoint: o,
@@ -1215,12 +1233,12 @@ function ir() {
1215
1233
  handleSearchSelect: e.handleSearchSelect
1216
1234
  }
1217
1235
  ) }) : null,
1218
- d.owner && s && /* @__PURE__ */ t(Ct, { label: s, size: "small", onDelete: () => p("") }),
1236
+ d.owner && s && /* @__PURE__ */ t(St, { label: s, size: "small", onDelete: () => m("") }),
1219
1237
  c ? /* @__PURE__ */ t(
1220
1238
  Se,
1221
1239
  {
1222
1240
  checked: d.showResources === "true",
1223
- onChange: (I) => C(I ? "true" : ""),
1241
+ onChange: (S) => k(S ? "true" : ""),
1224
1242
  label: r("common.showResources")
1225
1243
  }
1226
1244
  ) : null,
@@ -1228,17 +1246,17 @@ function ir() {
1228
1246
  Se,
1229
1247
  {
1230
1248
  checked: d.price === "free",
1231
- onChange: (I) => h(I ? "free" : ""),
1249
+ onChange: (S) => h(S ? "free" : ""),
1232
1250
  label: r("blocklet.free")
1233
1251
  }
1234
1252
  ),
1235
1253
  /* @__PURE__ */ t(
1236
1254
  Ve,
1237
1255
  {
1238
- value: d.sortBy || S[0].value,
1239
- options: S,
1256
+ value: d.sortBy || C[0].value,
1257
+ options: C,
1240
1258
  placeholder: r("sort.sort"),
1241
- onChange: (I) => g(I)
1259
+ onChange: (S) => g(S)
1242
1260
  }
1243
1261
  )
1244
1262
  ]
@@ -1271,18 +1289,18 @@ function Se({
1271
1289
  );
1272
1290
  }
1273
1291
  function Q({ children: e }) {
1274
- return /* @__PURE__ */ f(k, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
1275
- /* @__PURE__ */ t(Tt, {}),
1292
+ return /* @__PURE__ */ f(w, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
1293
+ /* @__PURE__ */ t(At, {}),
1276
1294
  e
1277
1295
  ] });
1278
1296
  }
1279
1297
  function Ie() {
1280
- const { t: e } = B();
1298
+ const { t: e } = I();
1281
1299
  return /* @__PURE__ */ t(x, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
1282
1300
  }
1283
1301
  function ie({ filterTip: e, keywordTip: r }) {
1284
- const { t: o, locale: n } = B(), i = () => n === "zh" ? "、" : " , ";
1285
- return /* @__PURE__ */ f(k, { mt: 1, display: "flex", children: [
1302
+ const { t: o, locale: n } = I(), i = () => n === "zh" ? "、" : " , ";
1303
+ return /* @__PURE__ */ f(w, { mt: 1, display: "flex", children: [
1286
1304
  /* @__PURE__ */ t(x, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
1287
1305
  e && /* @__PURE__ */ t(x, { children: o("blocklet.filterTip") }),
1288
1306
  e && r && i(),
@@ -1303,8 +1321,8 @@ function se({
1303
1321
  ] })
1304
1322
  ] });
1305
1323
  }
1306
- function sr() {
1307
- const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = B(), { filters: i } = r, s = !!n || !!i.price;
1324
+ function cr() {
1325
+ const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: i } = r, s = !!n || !!i.price;
1308
1326
  if (i.keyword && s)
1309
1327
  return /* @__PURE__ */ f(Q, { children: [
1310
1328
  /* @__PURE__ */ t(
@@ -1345,7 +1363,7 @@ function sr() {
1345
1363
  }
1346
1364
  return /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(Ie, {}) });
1347
1365
  }
1348
- const ar = (e, r, o, n) => tt(
1366
+ const dr = (e, r, o, n) => tt(
1349
1367
  async (i) => {
1350
1368
  i || (o.currentPage = o.defaultCurrentPage);
1351
1369
  const { currentPage: s, pageSize: c } = o, l = {
@@ -1356,31 +1374,31 @@ const ar = (e, r, o, n) => tt(
1356
1374
  pageSize: c
1357
1375
  };
1358
1376
  n(null);
1359
- const { data: u = {} } = await e.get(P.blockletsPath, { params: l });
1360
- return o.currentPage++, { page: s, pageSize: c, list: (u == null ? void 0 : u.dataList) || [], total: (u == null ? void 0 : u.total) || 0 };
1377
+ const { data: p = {} } = await e.get(P.blockletsPath, { params: l });
1378
+ return o.currentPage++, { page: s, pageSize: c, list: (p == null ? void 0 : p.dataList) || [], total: (p == null ? void 0 : p.total) || 0 };
1361
1379
  },
1362
1380
  {
1363
1381
  isNoMore: (i) => i ? i.page * i.pageSize >= i.total : !1,
1364
- reloadDeps: [e, At(r)],
1382
+ reloadDeps: [e, Ft(r)],
1365
1383
  onError: n
1366
1384
  }
1367
1385
  );
1368
- function cr() {
1386
+ function ur() {
1369
1387
  var h;
1370
- const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = B(), { filters: s } = r, c = rt({
1388
+ const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters: s } = r, c = rt({
1371
1389
  currentPage: P.currentPage,
1372
- pageSize: Dt() ? P.mobilePageSize : P.pageSize,
1390
+ pageSize: Wt() ? P.mobilePageSize : P.pageSize,
1373
1391
  defaultCurrentPage: P.defaultCurrentPage
1374
- }), [l, u] = F(null), d = ar(e, s, c, u), g = $(
1392
+ }), [l, p] = L(null), d = dr(e, s, c, p), g = $(
1375
1393
  () => {
1376
- var p, C;
1377
- return o ? o(((p = d.data) == null ? void 0 : p.list) || []) : ((C = d.data) == null ? void 0 : C.list) || [];
1394
+ var m, k;
1395
+ return o ? o(((m = d.data) == null ? void 0 : m.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
1378
1396
  },
1379
1397
  [d.data, o]
1380
1398
  );
1381
1399
  return j(() => {
1382
- const p = g.find((C) => C.owner.did === s.owner);
1383
- i((p == null ? void 0 : p.owner.fullName) || (p == null ? void 0 : p.author.name) || "");
1400
+ const m = g.find((k) => k.owner.did === s.owner);
1401
+ i((m == null ? void 0 : m.owner.fullName) || (m == null ? void 0 : m.author.name) || "");
1384
1402
  }, [s.owner, g, i]), {
1385
1403
  blocklets: g,
1386
1404
  fetchBlockletsError: l,
@@ -1397,41 +1415,41 @@ function cr() {
1397
1415
  }
1398
1416
  };
1399
1417
  }
1400
- function dr() {
1401
- const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: s, layout: c, baseSearch: l } = B(), { filters: u } = r, { blocklets: d, errors: g, loadMore: h, loadings: p, hasNextPage: C, total: S } = cr(), [I] = vt({
1402
- loading: p.fetchBlockletsLoading || p.loadingMore,
1403
- hasNextPage: C,
1418
+ function hr() {
1419
+ const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: s, layout: c, baseSearch: l } = I(), { filters: p } = r, { blocklets: d, errors: g, loadMore: h, loadings: m, hasNextPage: k, total: C } = ur(), [S] = Ct({
1420
+ loading: m.fetchBlockletsLoading || m.loadingMore,
1421
+ hasNextPage: k,
1404
1422
  onLoadMore: h
1405
1423
  });
1406
1424
  if (g.fetchBlockletsError) {
1407
- const w = new Error(`Failed to fetch blocklets from ${o}: ${g.fetchBlockletsError.message}`);
1408
- return /* @__PURE__ */ t(ue, { error: w });
1425
+ const y = new Error(`Failed to fetch blocklets from ${o}: ${g.fetchBlockletsError.message}`);
1426
+ return /* @__PURE__ */ t(ue, { error: y });
1409
1427
  }
1410
- const m = l && c.showSearch || !u.keyword;
1411
- return /* @__PURE__ */ f(M, { children: [
1412
- m ? /* @__PURE__ */ t(ir, {}) : /* @__PURE__ */ f(M, { children: [
1428
+ const B = l && c.showSearch || !p.keyword;
1429
+ return /* @__PURE__ */ f(N, { children: [
1430
+ B ? /* @__PURE__ */ t(ar, {}) : /* @__PURE__ */ f(N, { children: [
1413
1431
  /* @__PURE__ */ t(fe, { xs: /* @__PURE__ */ t(He, {}), md: null }),
1414
- b()
1432
+ v()
1415
1433
  ] }),
1416
- y(),
1417
- !p.fetchBlockletsLoading && C && /* @__PURE__ */ t(k, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: I, children: /* @__PURE__ */ t(ee, {}) })
1434
+ u(),
1435
+ !m.fetchBlockletsLoading && k && /* @__PURE__ */ t(w, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: S, children: /* @__PURE__ */ t(ee, {}) })
1418
1436
  ] });
1419
- function y() {
1420
- return p.fetchBlockletsLoading ? /* @__PURE__ */ t(qe, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
1421
- k,
1437
+ function u() {
1438
+ return m.fetchBlockletsLoading ? /* @__PURE__ */ t(qe, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
1439
+ w,
1422
1440
  {
1423
1441
  className: "blocklet-list",
1424
1442
  display: "grid",
1425
1443
  gridTemplateColumns: `repeat(auto-fill, minmax(${s}px, 1fr))`,
1426
1444
  p: "2px",
1427
1445
  gap: 2,
1428
- children: d.map((w) => /* @__PURE__ */ t(k, { "data-blocklet-did": w.did, sx: { minWidth: s }, children: n({ blocklet: w, blocklets: d, serverVersion: i }) }, w.did))
1446
+ children: d.map((y) => /* @__PURE__ */ t(w, { "data-blocklet-did": y.did, sx: { minWidth: s }, children: n({ blocklet: y, blocklets: d, serverVersion: i }) }, y.did))
1429
1447
  }
1430
- ) : /* @__PURE__ */ t(sr, {});
1448
+ ) : /* @__PURE__ */ t(cr, {});
1431
1449
  }
1432
- function b() {
1450
+ function v() {
1433
1451
  return /* @__PURE__ */ f(
1434
- A,
1452
+ T,
1435
1453
  {
1436
1454
  direction: "row",
1437
1455
  className: "search-result-title",
@@ -1440,15 +1458,15 @@ function dr() {
1440
1458
  mb: 2,
1441
1459
  mt: { xs: 2, md: 0 },
1442
1460
  children: [
1443
- /* @__PURE__ */ t(x, { variant: "h3", children: e("blocklet.search", { keyword: u.keyword }) }),
1444
- /* @__PURE__ */ t(x, { variant: "body1", color: "text.lighter", fontSize: 13, children: e("blocklet.resultCount", { count: S }) })
1461
+ /* @__PURE__ */ t(x, { variant: "h3", children: e("blocklet.search", { keyword: p.keyword }) }),
1462
+ /* @__PURE__ */ t(x, { variant: "body1", color: "text.lighter", fontSize: 13, children: e("blocklet.resultCount", { count: C }) })
1445
1463
  ]
1446
1464
  }
1447
1465
  );
1448
1466
  }
1449
1467
  }
1450
- function ur() {
1451
- const { t: e, selectedCategory: r, getCategoryLocale: o } = B(), { toggleOpen: n } = me();
1468
+ function pr() {
1469
+ const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = me();
1452
1470
  return /* @__PURE__ */ f(
1453
1471
  x,
1454
1472
  {
@@ -1459,23 +1477,23 @@ function ur() {
1459
1477
  py: 2,
1460
1478
  fontWeight: "fontWeightMedium",
1461
1479
  children: [
1462
- /* @__PURE__ */ t(Ue, { onClick: () => n(!0), children: /* @__PURE__ */ t(Ft, {}) }),
1480
+ /* @__PURE__ */ t(Ue, { onClick: () => n(!0), children: /* @__PURE__ */ t(Lt, {}) }),
1463
1481
  o(r) || e("common.category")
1464
1482
  ]
1465
1483
  }
1466
1484
  );
1467
1485
  }
1468
- function hr() {
1469
- const { search: e, layout: r } = B(), { filters: o } = e, n = o.category || o.keyword || o.price;
1470
- return /* @__PURE__ */ t(Lt, { children: /* @__PURE__ */ f(Qe, { FallbackComponent: ue, children: [
1471
- /* @__PURE__ */ t(ur, {}),
1472
- /* @__PURE__ */ f(k, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
1473
- /* @__PURE__ */ t(Xt, {}),
1474
- /* @__PURE__ */ t(A, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(er, {}) : /* @__PURE__ */ t(dr, {}) })
1486
+ function mr() {
1487
+ const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
1488
+ return /* @__PURE__ */ t(Ot, { children: /* @__PURE__ */ f(Qe, { FallbackComponent: ue, children: [
1489
+ /* @__PURE__ */ t(pr, {}),
1490
+ /* @__PURE__ */ f(w, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
1491
+ /* @__PURE__ */ t(Qt, {}),
1492
+ /* @__PURE__ */ t(T, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(rr, {}) : /* @__PURE__ */ t(hr, {}) })
1475
1493
  ] })
1476
1494
  ] }) });
1477
1495
  }
1478
- function ko(e) {
1496
+ function So(e) {
1479
1497
  const r = de(), o = Ge(
1480
1498
  Xe({
1481
1499
  ...r,
@@ -1505,10 +1523,11 @@ function ko(e) {
1505
1523
  }
1506
1524
  })
1507
1525
  );
1508
- return /* @__PURE__ */ t(Ke, { theme: o, children: /* @__PURE__ */ t(Vt, { ...e, children: /* @__PURE__ */ t(hr, {}) }) });
1526
+ return /* @__PURE__ */ t(Ke, { theme: o, children: /* @__PURE__ */ t(Ht, { ...e, children: /* @__PURE__ */ t(mr, {}) }) });
1509
1527
  }
1510
1528
  export {
1511
- tr as Autocomplete,
1512
- ko as default,
1513
- zt as useSearch
1529
+ or as Autocomplete,
1530
+ Yt as Image,
1531
+ So as default,
1532
+ _t as useSearch
1514
1533
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/list",
3
- "version": "0.14.8",
3
+ "version": "0.14.10",
4
4
  "description": "Common ux components of blocklet",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@blocklet/js-sdk": "^1.16.32",
56
- "@blocklet/util": "0.14.8",
56
+ "@blocklet/util": "0.14.10",
57
57
  "@emotion/react": "^11.10.0",
58
58
  "@emotion/styled": "^11.10.0",
59
59
  "@iconify-icons/tabler": "^1.2.95",
@@ -90,5 +90,5 @@
90
90
  "prettier": "^3.3.2",
91
91
  "vite": "^5.2.12"
92
92
  },
93
- "gitHead": "98158d034972b4f73f97c059948cce665fb78f87"
93
+ "gitHead": "95adeb5cdcdcc3c16d048913a3d3740caa22adbb"
94
94
  }