@blocklet/list 0.14.5 → 0.14.6

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 +286 -271
  2. package/package.json +3 -3
package/lib/index.es.js CHANGED
@@ -1,14 +1,14 @@
1
- import { jsx as t, jsxs as p, Fragment as z } from "react/jsx-runtime";
2
- import { styled as E, useTheme as xe } from "@arcblock/ux/lib/Theme";
1
+ import { jsx as t, jsxs as p, Fragment as A } from "react/jsx-runtime";
2
+ import { styled as _, useTheme as xe } from "@arcblock/ux/lib/Theme";
3
3
  import { Global as we, css as ke } from "@emotion/react";
4
4
  import { ErrorFallback as ee } from "@arcblock/ux/lib/ErrorBoundary";
5
- import { Button as te, useTheme as ve, useMediaQuery as D, Drawer as Je, Box as C, CircularProgress as re, MenuList as Ke, SvgIcon as Ze, Popper as et, Grow as tt, Paper as rt, ClickAwayListener as ot, MenuItem as nt, Stack as I, FormControlLabel as Ce, Checkbox as Se, Typography as L, Link as lt, Grid as he, Chip as at, OutlinedInput as it, InputAdornment as me } from "@mui/material";
5
+ import { Button as te, useTheme as ve, useMediaQuery as N, Drawer as Je, Box as C, CircularProgress as re, MenuList as Ke, SvgIcon as Ze, Popper as et, Grow as tt, Paper as rt, ClickAwayListener as ot, MenuItem as nt, Stack as L, FormControlLabel as Ce, Checkbox as Se, Typography as $, Link as lt, Grid as he, Chip as at, OutlinedInput as it, InputAdornment as me } from "@mui/material";
6
6
  import { ErrorBoundary as st } from "react-error-boundary";
7
7
  import ct from "@iconify-icons/tabler/compass";
8
8
  import { Icon as Be } from "@iconify/react";
9
9
  import Re from "@mui/icons-material/Close";
10
- import { createContext as Pe, useState as q, useMemo as M, useContext as Te, useCallback as Z, useEffect as W, forwardRef as dt, useRef as G, memo as ut, createElement as pt, Fragment as ht } from "react";
11
- import { createAxios as Ie } from "@blocklet/js-sdk";
10
+ import { createContext as Pe, useState as q, useMemo as M, useContext as Ie, useCallback as Z, useEffect as W, forwardRef as dt, useRef as G, memo as ut, createElement as pt, Fragment as ht } from "react";
11
+ import { createAxios as Te } from "@blocklet/js-sdk";
12
12
  import mt from "lodash/orderBy";
13
13
  import { useInfiniteScroll as ft, useRequest as oe, useReactive as gt, useDebounceFn as yt } from "ahooks";
14
14
  import bt from "lodash/omitBy";
@@ -17,39 +17,40 @@ import wt from "color";
17
17
  import "lodash/cloneDeep";
18
18
  import { parseURL as kt, parseQuery as vt, parseFilename as Ct, stringifyParsedURL as St, withQuery as Le, joinURL as Bt } from "ufo";
19
19
  import fe from "flat";
20
- import w from "prop-types";
21
- import Rt from "@mui/icons-material/KeyboardArrowDown";
22
- import Pt from "lodash/isEmpty";
23
- import Fe from "@mui/material/Box";
20
+ import Rt from "@mui/icons-material/Check";
21
+ import Pt from "@mui/icons-material/KeyboardArrowDown";
22
+ import It from "lodash/isEmpty";
23
+ import k from "prop-types";
24
+ import $e from "@mui/material/Box";
24
25
  import Tt from "@arcblock/ux/lib/Avatar";
25
- import It from "@arcblock/ux/lib/Img";
26
- import Lt from "@iconify-icons/tabler/cloud-download";
27
- import Ft from "@mui/icons-material/ChevronLeft";
28
- import $t from "@mui/icons-material/ChevronRight";
29
- import _t from "react-image-gallery";
26
+ import Lt from "@arcblock/ux/lib/Img";
27
+ import $t from "@iconify-icons/tabler/cloud-download";
28
+ import zt from "@mui/icons-material/ChevronLeft";
29
+ import Ft from "@mui/icons-material/ChevronRight";
30
+ import At from "react-image-gallery";
30
31
  import "react-image-gallery/styles/css/image-gallery.css";
31
- import zt from "@arcblock/ux/lib/Empty";
32
- import At from "react-infinite-scroll-hook";
33
- import $e from "@mui/material/Typography";
34
- import Et from "@mui/icons-material/Menu";
32
+ import Et from "@arcblock/ux/lib/Empty";
33
+ import _t from "react-infinite-scroll-hook";
34
+ import ze from "@mui/material/Typography";
35
+ import Dt from "@mui/icons-material/Menu";
35
36
  import { createRoot as Nt } from "react-dom/client";
36
- import { autocomplete as Dt } from "@algolia/autocomplete-js";
37
- import { useHotkeys as Mt } from "react-hotkeys-hook";
38
- import Ot from "@mui/icons-material/Search";
37
+ import { autocomplete as Mt } from "@algolia/autocomplete-js";
38
+ import { useHotkeys as Ot } from "react-hotkeys-hook";
39
+ import jt from "@mui/icons-material/Search";
39
40
  import "@algolia/autocomplete-theme-classic/dist/theme.css";
40
- const _e = Pe({
41
+ const Fe = Pe({
41
42
  open: !1,
42
43
  toggleOpen: (e) => {
43
44
  }
44
45
  });
45
- function jt({ children: e }) {
46
+ function qt({ children: e }) {
46
47
  const [r, o] = q(!1), l = (a) => {
47
48
  o(a ?? !a);
48
49
  }, n = M(() => ({ open: r, toggleOpen: l }), [r]);
49
- return /* @__PURE__ */ t(_e.Provider, { value: n, children: e });
50
+ return /* @__PURE__ */ t(Fe.Provider, { value: n, children: e });
50
51
  }
51
52
  function ne() {
52
- return Te(_e);
53
+ return Ie(Fe);
53
54
  }
54
55
  const T = {
55
56
  nameAsc: "title",
@@ -65,7 +66,7 @@ const T = {
65
66
  explorePath: "/api/blocklets/explore",
66
67
  exploreDidsPath: "/api/blocklets/dids",
67
68
  cacheSize: 100
68
- }, qt = (e, r, o, l) => ft(
69
+ }, Wt = (e, r, o, l) => ft(
69
70
  async (n) => {
70
71
  n || (o.currentPage = o.defaultCurrentPage);
71
72
  const { currentPage: a, pageSize: d } = o, c = {
@@ -84,13 +85,13 @@ const T = {
84
85
  reloadDeps: [e, xt(r)],
85
86
  onError: l
86
87
  }
87
- ), Wt = (e) => oe(
88
+ ), Vt = (e) => oe(
88
89
  async () => {
89
90
  const { data: r } = await e.get(T.categoriesPath);
90
91
  return Array.isArray(r) ? r : [];
91
92
  },
92
93
  { manual: !0 }
93
- ), ze = (e) => [
94
+ ), Ae = (e) => [
94
95
  {
95
96
  name: e("sort.popularity"),
96
97
  value: "popularity"
@@ -103,7 +104,7 @@ const T = {
103
104
  // name: t('sort.rating'),
104
105
  // value: 'rating',
105
106
  // },
106
- ], Vt = (e, r, o) => {
107
+ ], Ut = (e, r, o) => {
107
108
  var f, m;
108
109
  const l = kt(e), n = vt(l.search);
109
110
  if ((f = Ct(e, { strict: !0 })) == null ? void 0 : f.endsWith(".gif"))
@@ -115,14 +116,14 @@ const T = {
115
116
  ...c || s ? { imageFilter: "resize", w: c, h: s } : {},
116
117
  v: d
117
118
  });
118
- }, Ut = (e) => [
119
+ }, Gt = (e) => [
119
120
  { name: e("blocklet.free"), value: "free" },
120
121
  { name: e("blocklet.payment"), value: "payment" }
121
- ], Gt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Ht = (e, r) => (
122
+ ], Ht = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Qt = (e, r) => (
122
123
  // eslint-disable-next-line no-prototype-builtins
123
124
  e == null ? void 0 : e.replace(/{(\w*)}/g, (o, l) => r.hasOwnProperty(l) ? r[l] : "")
124
- ), Qt = () => window.innerWidth <= 600, Xt = (e) => wt(e).rgb().object();
125
- function Yt(e, r) {
125
+ ), Xt = () => window.innerWidth <= 600, Yt = (e) => wt(e).rgb().object();
126
+ function Jt(e, r) {
126
127
  let o;
127
128
  return function(...n) {
128
129
  return o && clearTimeout(o), new Promise((a) => {
@@ -130,7 +131,7 @@ function Yt(e, r) {
130
131
  });
131
132
  };
132
133
  }
133
- const Jt = Yt((e) => Promise.resolve(e), 300), Kt = {
134
+ const Kt = Jt((e) => Promise.resolve(e), 300), Zt = {
134
135
  common: {
135
136
  title: "Blocklet Store",
136
137
  searchStore: "Search Blocklet",
@@ -178,7 +179,7 @@ const Jt = Yt((e) => Promise.resolve(e), 300), Kt = {
178
179
  autocomplete: {
179
180
  expandResult: 'View all search results for "{name}"'
180
181
  }
181
- }, Zt = {
182
+ }, er = {
182
183
  common: {
183
184
  title: "Blocklet 商店",
184
185
  searchStore: "搜索 Blocklet",
@@ -227,15 +228,15 @@ const Jt = Yt((e) => Promise.resolve(e), 300), Kt = {
227
228
  expandResult: "查看 “{name}” 的所有搜索结果"
228
229
  }
229
230
  }, K = {
230
- en: fe(Kt),
231
- zh: fe(Zt)
232
- }, Ae = (e, r) => {
231
+ en: fe(Zt),
232
+ zh: fe(er)
233
+ }, Ee = (e, r) => {
233
234
  const o = {};
234
235
  return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
235
- }, er = (e) => (r, o) => {
236
+ }, tr = (e) => (r, o) => {
236
237
  const l = K[e] ? K[e][r] : K.en[r];
237
- return Ht(l, o) || r;
238
- }, Ee = {
238
+ return Qt(l, o) || r;
239
+ }, _e = {
239
240
  errors: {
240
241
  fetchBlockletsError: null,
241
242
  fetchCategoriesError: null
@@ -291,8 +292,8 @@ const Jt = Yt((e) => Promise.resolve(e), 300), Kt = {
291
292
  developerName: "",
292
293
  handleSearchSelect: () => {
293
294
  }
294
- }, Ne = Pe(Ee), { Provider: tr, Consumer: no } = Ne;
295
- function rr(e) {
295
+ }, De = Pe(_e), { Provider: rr, Consumer: ao } = De;
296
+ function or(e) {
296
297
  var ue;
297
298
  const {
298
299
  locale: r = "zh",
@@ -308,41 +309,41 @@ function rr(e) {
308
309
  layout: s = {},
309
310
  wrapChildren: f = (i) => i,
310
311
  extraFilter: m = (i) => i,
311
- baseSearch: k = !1,
312
- fetchCategoryDelay: F = 0,
312
+ baseSearch: v = !1,
313
+ fetchCategoryDelay: z = 0,
313
314
  showResourcesSwitch: R = !1,
314
315
  showCategory: S = !0,
315
316
  tagFilters: u = [],
316
317
  children: x,
317
318
  storeVersion: h,
318
319
  endpoint: g,
319
- blockletRender: v
320
- } = e, _ = Ae(l, h), $ = M(() => Ie({ baseURL: g, headers: _ }), [g]), y = { sortBy: "popularity", sortDirection: "desc", ...o };
320
+ blockletRender: w
321
+ } = e, P = Ee(l, h), F = M(() => Te({ baseURL: g, headers: P }), [g]), y = { sortBy: "popularity", sortDirection: "desc", ...o };
321
322
  !y.category && !s.showExplore && (y.category = "All");
322
- const N = y.category, We = gt({
323
+ const D = y.category, We = gt({
323
324
  currentPage: T.currentPage,
324
- pageSize: Qt() ? T.mobilePageSize : T.pageSize,
325
+ pageSize: Xt() ? T.mobilePageSize : T.pageSize,
325
326
  defaultCurrentPage: T.defaultCurrentPage
326
- }), [Ve, Ue] = q(null), A = qt($, y, We, Ue), {
327
+ }), [Ve, Ue] = q(null), E = Wt(F, y, We, Ue), {
327
328
  data: Y = [],
328
329
  error: Ge,
329
330
  loading: He,
330
331
  run: se
331
- } = Wt($), J = M(() => {
332
- const i = mt(Y, [(P) => P.name], ["asc"]), b = i.findIndex((P) => P.name === "All" || P.locales.en === "All");
332
+ } = Vt(F), J = M(() => {
333
+ const i = mt(Y, [(I) => I.name], ["asc"]), b = i.findIndex((I) => I.name === "All" || I.locales.en === "All");
333
334
  return b > -1 ? [{ ...i[b], _id: "All" }, ...i.slice(0, b), ...i.slice(b + 1)] : i;
334
335
  }, [Y]), ce = M(
335
336
  () => {
336
337
  var i;
337
- return m(((i = A.data) == null ? void 0 : i.list) || []) || [];
338
+ return m(((i = E.data) == null ? void 0 : i.list) || []) || [];
338
339
  },
339
- [A.data, m]
340
- ), de = Z(er(r), [r]), Qe = M(() => Gt(J, r), [J, r]), Xe = Ut(de), Ye = {
340
+ [E.data, m]
341
+ ), de = Z(tr(r), [r]), Qe = M(() => Ht(J, r), [J, r]), Xe = Gt(de), Ye = {
341
342
  errors: { fetchBlockletsError: Ve, fetchCategoriesError: Ge },
342
343
  loadings: {
343
- fetchBlockletsLoading: A.loading,
344
+ fetchBlockletsLoading: E.loading,
344
345
  fetchCategoriesLoading: He,
345
- loadingMore: A.loadingMore
346
+ loadingMore: E.loadingMore
346
347
  },
347
348
  endpoint: g,
348
349
  queryFilter: c,
@@ -354,27 +355,27 @@ function rr(e) {
354
355
  },
355
356
  minItemWidth: d,
356
357
  blockletList: ce,
357
- total: ((ue = A.data) == null ? void 0 : ue.total) || 0,
358
+ total: ((ue = E.data) == null ? void 0 : ue.total) || 0,
358
359
  wrapChildren: f,
359
360
  t: de,
360
361
  storeVersion: h,
361
362
  serverVersion: l,
362
363
  filters: y,
363
- selectedCategory: N,
364
+ selectedCategory: D,
364
365
  categoryList: J,
365
- blockletRender: v,
366
+ blockletRender: w,
366
367
  locale: r,
367
368
  categoryOptions: Qe,
368
369
  priceOptions: Xe,
369
- storeApi: $,
370
- baseSearch: k,
370
+ storeApi: F,
371
+ baseSearch: v,
371
372
  showResourcesSwitch: R,
372
373
  showCategory: S,
373
374
  tagFilters: u,
374
- hasNextPage: !A.noMore,
375
+ hasNextPage: !E.noMore,
375
376
  onFilterChange: n,
376
377
  cleanFilter: (i) => {
377
- const b = i ? bt(y, (P, O) => i == null ? void 0 : i.includes(O)) : {};
378
+ const b = i ? bt(y, (I, O) => i == null ? void 0 : i.includes(O)) : {};
378
379
  n(b);
379
380
  },
380
381
  handleSort: (i) => {
@@ -390,8 +391,8 @@ function rr(e) {
390
391
  n(b);
391
392
  },
392
393
  handleCategory: (i) => {
393
- const b = i === "all" || i === y.category ? "" : i, P = { ...y, category: b };
394
- n(P);
394
+ const b = i === "all" || i === y.category ? "" : i, I = { ...y, category: b };
395
+ n(I);
395
396
  },
396
397
  handleDeveloper: (i) => {
397
398
  const b = { ...y, owner: i || void 0 };
@@ -405,32 +406,32 @@ function rr(e) {
405
406
  const i = { ...y };
406
407
  n(i);
407
408
  },
408
- loadMore: A.loadMore,
409
+ loadMore: E.loadMore,
409
410
  getCategoryLocale: (i) => {
410
411
  if (!i)
411
412
  return null;
412
- const b = Y.find((P) => P._id === i);
413
+ const b = Y.find((I) => I._id === i);
413
414
  return b ? b.locales[r] || b.locales.en : null;
414
415
  },
415
416
  get developerName() {
416
- var b, P;
417
+ var b, I;
417
418
  const i = ce.find((O) => {
418
419
  var pe;
419
420
  return ((pe = O == null ? void 0 : O.owner) == null ? void 0 : pe.did) === y.owner;
420
421
  });
421
- return ((b = i == null ? void 0 : i.owner) == null ? void 0 : b.fullName) || ((P = i == null ? void 0 : i.author) == null ? void 0 : P.name) || "";
422
+ return ((b = i == null ? void 0 : i.owner) == null ? void 0 : b.fullName) || ((I = i == null ? void 0 : i.author) == null ? void 0 : I.name) || "";
422
423
  },
423
424
  handleSearchSelect: a
424
425
  };
425
426
  return W(() => {
426
- setTimeout(se, F || 0);
427
- }, [g, se, F]), /* @__PURE__ */ t(tr, { value: Ye, children: x });
427
+ setTimeout(se, z || 0);
428
+ }, [g, se, z]), /* @__PURE__ */ t(rr, { value: Ye, children: x });
428
429
  }
429
430
  function B() {
430
- const e = Te(Ne);
431
- return e || Ee;
431
+ const e = Ie(De);
432
+ return e || _e;
432
433
  }
433
- function De({
434
+ function Ne({
434
435
  children: e,
435
436
  onClick: r,
436
437
  size: o = 32
@@ -466,13 +467,13 @@ function Q({
466
467
  xl: n,
467
468
  exact: a
468
469
  }) {
469
- const d = ve(), c = D(d.breakpoints.down("sm")), s = D(d.breakpoints.between("sm", "md")), f = D(d.breakpoints.between("md", "lg")), m = D(d.breakpoints.between("lg", "xl"));
470
+ const d = ve(), c = N(d.breakpoints.down("sm")), s = N(d.breakpoints.between("sm", "md")), f = N(d.breakpoints.between("md", "lg")), m = N(d.breakpoints.between("lg", "xl"));
470
471
  if (a)
471
472
  return c ? e || null : s ? r || null : f ? o || null : m ? l || null : n || null;
472
- let k = e;
473
- return c || (k = V(r, k), s) || (k = V(o, k), f) || (k = V(l, k), m) ? k : V(n, k);
473
+ let v = e;
474
+ return c || (v = V(r, v), s) || (v = V(o, v), f) || (v = V(l, v), m) ? v : V(n, v);
474
475
  }
475
- function or({ children: e }) {
476
+ function nr({ children: e }) {
476
477
  const { open: r, toggleOpen: o } = ne();
477
478
  return /* @__PURE__ */ t(
478
479
  Q,
@@ -482,10 +483,10 @@ function or({ children: e }) {
482
483
  }
483
484
  );
484
485
  }
485
- const nr = E(te)`
486
+ const lr = _(te)`
486
487
  border-radius: 4px;
487
488
  `, le = dt(({ children: e, rounded: r, loading: o, disabled: l, ...n }, a) => /* @__PURE__ */ t(
488
- nr,
489
+ lr,
489
490
  {
490
491
  ref: a,
491
492
  disableElevation: !0,
@@ -496,10 +497,10 @@ const nr = E(te)`
496
497
  }
497
498
  ));
498
499
  le.propTypes = {
499
- children: w.any,
500
- rounded: w.bool,
501
- loading: w.bool,
502
- disabled: w.bool
500
+ children: k.any,
501
+ rounded: k.bool,
502
+ loading: k.bool,
503
+ disabled: k.bool
503
504
  };
504
505
  le.defaultProps = {
505
506
  children: null,
@@ -508,64 +509,61 @@ le.defaultProps = {
508
509
  disabled: !1
509
510
  };
510
511
  function X({ title: e, value: r, icon: o, prepend: l, options: n, onChange: a, itemRender: d, ...c }) {
511
- const s = G(null), f = xe(), [m, k] = q(!1), [F, R] = q(r !== null ? r : ""), S = D(f.breakpoints.down("sm"));
512
+ const s = G(null), f = xe(), [m, v] = q(!1), [z, R] = q(r !== null ? r : ""), S = N(f.breakpoints.down("sm"));
512
513
  W(() => {
513
514
  R(r !== null ? r : "");
514
515
  }, [r]);
515
516
  const u = Z(() => {
516
- k(!1);
517
+ v(!1);
517
518
  }, []), x = Z(() => {
518
- k(!0);
519
+ v(!0);
519
520
  }, []);
520
- function h(v) {
521
- R(v.value), a(v.value), S && u();
521
+ function h(w) {
522
+ R(w.value), a(w.value), S && u();
522
523
  }
523
- function g(v) {
524
- return v === F;
524
+ function g(w) {
525
+ return w === z;
525
526
  }
526
- return /* @__PURE__ */ p(z, { children: [
527
+ return /* @__PURE__ */ p(A, { children: [
527
528
  /* @__PURE__ */ p(
528
- lr,
529
+ ar,
529
530
  {
530
531
  ref: s,
531
532
  onClick: x,
532
533
  variant: "outlined",
533
534
  size: "small",
534
- className: ["my-select__selector", Pt(F) ? "" : "my-select__selector--active"].join(" "),
535
+ className: ["my-select__selector", It(z) ? "" : "my-select__selector--active"].join(" "),
535
536
  sx: { minWidth: "auto" },
536
537
  ...c,
537
538
  children: [
538
539
  /* @__PURE__ */ t("div", { className: "my-select__icon", children: o }),
539
540
  e,
540
- /* @__PURE__ */ t(Ze, { className: "my-select__arrowdown", component: Rt, fontSize: "small" })
541
+ /* @__PURE__ */ t(Ze, { className: "my-select__arrowdown", component: Pt, fontSize: "small" })
541
542
  ]
542
543
  }
543
544
  ),
544
- /* @__PURE__ */ t(et, { open: m, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: v, placement: _ }) => /* @__PURE__ */ t(tt, { ...v, sx: { transformOrigin: _ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t(ot, { onClickAway: u, children: /* @__PURE__ */ p(ar, { autoFocusItem: m, onMouseEnter: x, onMouseLeave: u, children: [
545
+ /* @__PURE__ */ t(et, { open: m, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: w, placement: P }) => /* @__PURE__ */ t(tt, { ...w, sx: { transformOrigin: P === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t(ot, { onClickAway: u, children: /* @__PURE__ */ p(ir, { autoFocusItem: m, onMouseEnter: x, onMouseLeave: u, children: [
545
546
  l,
546
- n.map(($) => d ? d($) : /* @__PURE__ */ t(
547
- nt,
548
- {
549
- onClick: () => h($),
550
- className: [
551
- "my-select__option",
552
- g($.value) ? "my-select__option--active" : ""
553
- ].join(" "),
554
- children: $.name
555
- },
556
- $.value
557
- ))
547
+ n.map((F) => d ? d(F) : /* @__PURE__ */ p(nt, { onClick: () => h(F), children: [
548
+ /* @__PURE__ */ t(
549
+ Rt,
550
+ {
551
+ sx: { mr: 1, fontSize: 16, visibility: g(F.value) ? "visible" : "hidden" }
552
+ }
553
+ ),
554
+ F.name
555
+ ] }, F.value))
558
556
  ] }) }) }) }) })
559
557
  ] });
560
558
  }
561
559
  X.propTypes = {
562
- options: w.array.isRequired,
563
- value: w.oneOfType([w.string, w.number, w.array]),
564
- onChange: w.func,
565
- itemRender: w.func,
566
- title: w.string.isRequired,
567
- icon: w.any,
568
- prepend: w.any
560
+ options: k.array.isRequired,
561
+ value: k.oneOfType([k.string, k.number, k.array]),
562
+ onChange: k.func,
563
+ itemRender: k.func,
564
+ title: k.string.isRequired,
565
+ icon: k.any,
566
+ prepend: k.any
569
567
  };
570
568
  X.defaultProps = {
571
569
  value: null,
@@ -575,7 +573,7 @@ X.defaultProps = {
575
573
  onChange: () => {
576
574
  }
577
575
  };
578
- const lr = E(le)`
576
+ const ar = _(le)`
579
577
  border: 1px solid #f0f0f0;
580
578
  padding: 6px 8px 6px 12px;
581
579
  font-weight: ${(e) => e.theme.typography.fontWeightRegular};
@@ -606,7 +604,7 @@ const lr = E(le)`
606
604
  margin-right: 3px;
607
605
  }
608
606
  }
609
- `, ar = E(Ke)`
607
+ `, ir = _(Ke)`
610
608
  .my-select__option__icon {
611
609
  color: transparent;
612
610
  font-size: 14px;
@@ -625,9 +623,9 @@ const lr = E(le)`
625
623
  `;
626
624
  function Me() {
627
625
  var d;
628
- const { filters: e, handleSort: r, handlePrice: o, t: l } = B(), n = ze(l), a = ((d = n.find((c) => c.value === e.sortBy)) == null ? void 0 : d.name) || l("sort.sort");
626
+ const { filters: e, handleSort: r, handlePrice: o, t: l } = B(), n = Ae(l), a = ((d = n.find((c) => c.value === e.sortBy)) == null ? void 0 : d.name) || l("sort.sort");
629
627
  return /* @__PURE__ */ p(
630
- I,
628
+ L,
631
629
  {
632
630
  direction: { xs: "row", md: "column" },
633
631
  alignItems: { xs: "center", md: "flex-start" },
@@ -666,14 +664,14 @@ function Me() {
666
664
  }
667
665
  );
668
666
  }
669
- function ir() {
667
+ function sr() {
670
668
  const { selectedCategory: e, handleCategory: r, t: o, categoryOptions: l, filters: n, cleanFilter: a, loadings: d, layout: c } = B(), { toggleOpen: s } = ne();
671
- return c.showCategory ? /* @__PURE__ */ p(or, { children: [
669
+ return c.showCategory ? /* @__PURE__ */ p(nr, { children: [
672
670
  /* @__PURE__ */ t(
673
671
  Q,
674
672
  {
675
673
  xs: /* @__PURE__ */ p(
676
- I,
674
+ L,
677
675
  {
678
676
  direction: "row",
679
677
  justifyContent: "space-between",
@@ -684,8 +682,8 @@ function ir() {
684
682
  borderBottom: 1,
685
683
  borderColor: "divider",
686
684
  children: [
687
- /* @__PURE__ */ t(De, { onClick: () => s(!1), children: /* @__PURE__ */ t(Re, {}) }),
688
- /* @__PURE__ */ t(L, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
685
+ /* @__PURE__ */ t(Ne, { onClick: () => s(!1), children: /* @__PURE__ */ t(Re, {}) }),
686
+ /* @__PURE__ */ t($, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
689
687
  ]
690
688
  }
691
689
  ),
@@ -693,18 +691,18 @@ function ir() {
693
691
  }
694
692
  ),
695
693
  /* @__PURE__ */ t(
696
- I,
694
+ L,
697
695
  {
698
696
  visibility: d.fetchCategoriesLoading ? "hidden" : "visible",
699
697
  width: { xs: 268, md: 200 },
700
698
  boxSizing: "content-box",
701
699
  p: { xs: 2, md: 0 },
702
700
  pr: { md: 6 },
703
- children: n.keyword ? /* @__PURE__ */ t(Me, {}) : /* @__PURE__ */ p(z, { children: [
701
+ children: n.keyword ? /* @__PURE__ */ t(Me, {}) : /* @__PURE__ */ p(A, { children: [
704
702
  c.showExplore && /* @__PURE__ */ p(C, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
705
703
  /* @__PURE__ */ t(Be, { icon: ct }),
706
704
  /* @__PURE__ */ t(
707
- L,
705
+ $,
708
706
  {
709
707
  variant: "body1",
710
708
  color: e ? "text.lighter" : "text.primary",
@@ -717,8 +715,8 @@ function ir() {
717
715
  }
718
716
  )
719
717
  ] }),
720
- !!l.length && /* @__PURE__ */ t(I, { gap: 2, children: l.map((f) => /* @__PURE__ */ t(
721
- L,
718
+ !!l.length && /* @__PURE__ */ t(L, { gap: 2, children: l.map((f) => /* @__PURE__ */ t(
719
+ $,
722
720
  {
723
721
  variant: "body1",
724
722
  title: f.name,
@@ -739,7 +737,7 @@ function ir() {
739
737
  ] }) : null;
740
738
  }
741
739
  function Oe() {
742
- const { endpoint: e, serverVersion: r, storeVersion: o } = B(), l = Ae(r, o), n = M(() => Ie({
740
+ const { endpoint: e, serverVersion: r, storeVersion: o } = B(), l = Ee(r, o), n = M(() => Te({
743
741
  baseURL: e,
744
742
  headers: l
745
743
  }), [e]);
@@ -755,7 +753,7 @@ function Oe() {
755
753
  };
756
754
  }
757
755
  const je = ut(function(r) {
758
- return /* @__PURE__ */ t(Fe, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(re, {}) });
756
+ return /* @__PURE__ */ t($e, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(re, {}) });
759
757
  });
760
758
  function ge({
761
759
  icon: e,
@@ -763,10 +761,10 @@ function ge({
763
761
  maxWidth: o = 100,
764
762
  title: l
765
763
  }) {
766
- return (r === 0 || r) && /* @__PURE__ */ p(I, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
764
+ return (r === 0 || r) && /* @__PURE__ */ p(L, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
767
765
  e,
768
766
  /* @__PURE__ */ t(
769
- L,
767
+ $,
770
768
  {
771
769
  flex: 1,
772
770
  variant: "body2",
@@ -778,9 +776,9 @@ function ge({
778
776
  ] });
779
777
  }
780
778
  const ye = 292;
781
- function sr() {
779
+ function cr() {
782
780
  var R, S;
783
- const { t: e } = B(), { get: r } = Oe(), o = ve(), l = D(o.breakpoints.down("md")), n = ((S = (R = window.blocklet) == null ? void 0 : R.preferences) == null ? void 0 : S.homeBanner) || [], { data: a = [], error: d } = oe(async () => {
781
+ const { t: e } = B(), { get: r } = Oe(), o = ve(), l = N(o.breakpoints.down("md")), n = ((S = (R = window.blocklet) == null ? void 0 : R.preferences) == null ? void 0 : S.homeBanner) || [], { data: a = [], error: d } = oe(async () => {
784
782
  const u = await r(
785
783
  Le(T.blockletsPath, { didList: n.map((x) => x.did).join(",") })
786
784
  );
@@ -795,73 +793,90 @@ function sr() {
795
793
  cursor: "pointer",
796
794
  color: "text.lighter"
797
795
  };
798
- return !d && n.length > 0 ? /* @__PURE__ */ p(z, { children: [
799
- /* @__PURE__ */ t(L, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
800
- /* @__PURE__ */ t(C, { height: { xs: "auto", md: ye }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
801
- _t,
796
+ return !d && n.length > 0 ? /* @__PURE__ */ p(A, { children: [
797
+ /* @__PURE__ */ t($, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
798
+ /* @__PURE__ */ t(
799
+ C,
802
800
  {
803
- showNav: !0,
804
- autoPlay: !0,
805
- slideDuration: 1e3,
806
- slideInterval: 5e3,
807
- showPlayButton: !1,
808
- showIndex: !1,
809
- showBullets: !1,
810
- showThumbnails: !1,
811
- showFullscreenButton: !1,
812
- renderLeftNav: (u) => /* @__PURE__ */ t(C, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Ft, { sx: { ...c, left: 5 } }) }),
813
- renderRightNav: (u) => /* @__PURE__ */ t(C, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t($t, { sx: { ...c, right: 5 } }) }),
814
- items: n.map((u, x) => ({
815
- original: u.did,
816
- renderItem: () => {
817
- var g;
818
- const h = a[x] || {};
819
- return /* @__PURE__ */ p(
820
- I,
821
- {
822
- height: { xs: "auto", md: ye },
823
- display: "flex",
824
- direction: { xs: "column", md: "row" },
825
- justifyContent: "center",
826
- alignItems: { xs: "flex-start", md: "center" },
827
- p: { xs: 2, md: 5 },
828
- gap: { xs: 2, md: 5 },
829
- children: [
830
- s(u.cover || dr(u.did, (g = h.screenshots) == null ? void 0 : g[0])),
831
- /* @__PURE__ */ p(I, { flex: 1, height: "100%", gap: 3, children: [
832
- /* @__PURE__ */ p(C, { flex: 1, children: [
833
- f(u.name || h.title || u.name),
834
- m(u.desc || h.description)
835
- ] }),
836
- h.did && k(h, u.baseNum),
837
- F(u.link, u.did)
838
- ] })
839
- ]
801
+ height: { xs: "auto", md: ye },
802
+ position: "relative",
803
+ border: 1,
804
+ borderColor: "divider",
805
+ borderRadius: 3,
806
+ overflow: "hidden",
807
+ children: /* @__PURE__ */ t(
808
+ At,
809
+ {
810
+ showNav: !0,
811
+ autoPlay: !0,
812
+ slideDuration: 1e3,
813
+ slideInterval: 5e3,
814
+ showPlayButton: !1,
815
+ showIndex: !1,
816
+ showBullets: !1,
817
+ showThumbnails: !1,
818
+ showFullscreenButton: !1,
819
+ renderLeftNav: (u) => /* @__PURE__ */ t(C, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(zt, { sx: { ...c, left: 5 } }) }),
820
+ renderRightNav: (u) => /* @__PURE__ */ t(C, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Ft, { sx: { ...c, right: 5 } }) }),
821
+ items: n.map((u, x) => ({
822
+ original: u.did,
823
+ renderItem: () => {
824
+ var P;
825
+ const h = a[x] || {}, g = u.cover || ur(u.did, (P = h.screenshots) == null ? void 0 : P[0]), w = Ut(g, { h: 400, w: 700 });
826
+ return /* @__PURE__ */ p(
827
+ L,
828
+ {
829
+ height: { xs: "auto", md: ye },
830
+ sx: {
831
+ "&::before": {
832
+ content: '""',
833
+ position: "absolute",
834
+ top: 0,
835
+ left: 0,
836
+ right: 0,
837
+ bottom: 0,
838
+ backgroundImage: `url("${w}")`,
839
+ backgroundSize: "cover",
840
+ filter: "blur(8px)",
841
+ opacity: 0.15,
842
+ zIndex: 0
843
+ }
844
+ },
845
+ display: "flex",
846
+ direction: { xs: "column", md: "row" },
847
+ justifyContent: "center",
848
+ alignItems: { xs: "flex-start", md: "center" },
849
+ p: { xs: 2, md: 5 },
850
+ gap: { xs: 2, md: 5 },
851
+ children: [
852
+ s(w),
853
+ /* @__PURE__ */ p(L, { flex: 1, height: "100%", gap: 3, children: [
854
+ /* @__PURE__ */ p(C, { flex: 1, children: [
855
+ f(u.name || h.title || u.name),
856
+ m(u.desc || h.description)
857
+ ] }),
858
+ h.did && v(h, u.baseNum),
859
+ z(u.link, u.did)
860
+ ] })
861
+ ]
862
+ }
863
+ );
840
864
  }
841
- );
865
+ }))
842
866
  }
843
- }))
867
+ )
844
868
  }
845
- ) })
869
+ )
846
870
  ] }) : null;
847
871
  function s(u) {
848
- return /* @__PURE__ */ t(C, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
849
- It,
850
- {
851
- src: Vt(u, { h: 400, w: 700 }),
852
- alt: "",
853
- width: l ? void 0 : 338,
854
- height: 210,
855
- style: { objectFit: "cover" }
856
- }
857
- ) });
872
+ return /* @__PURE__ */ t(C, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(Lt, { src: u, alt: "", width: l ? void 0 : 338, height: 210, style: { objectFit: "cover" } }) });
858
873
  }
859
874
  function f(u) {
860
- return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children: u });
875
+ return /* @__PURE__ */ t($, { variant: "h2", width: "100%", children: u });
861
876
  }
862
877
  function m(u) {
863
878
  return /* @__PURE__ */ t(
864
- L,
879
+ $,
865
880
  {
866
881
  variant: "body2",
867
882
  color: "text.secondary",
@@ -881,14 +896,14 @@ function sr() {
881
896
  }
882
897
  );
883
898
  }
884
- function k(u, x = 0) {
885
- const { did: h, owner: g, stats: v } = u;
899
+ function v(u, x = 0) {
900
+ const { did: h, owner: g, stats: w } = u;
886
901
  return /* @__PURE__ */ p(C, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
887
902
  /* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Tt, { src: g.avatar, did: h, size: 20, variant: "circle" }), children: g.fullName }),
888
- /* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Be, { icon: Lt }), title: `${v.downloads + x}`, children: cr(v.downloads + x) })
903
+ /* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Be, { icon: $t }), title: `${w.downloads + x}`, children: dr(w.downloads + x) })
889
904
  ] });
890
905
  }
891
- function F(u, x) {
906
+ function z(u, x) {
892
907
  return /* @__PURE__ */ t(lt, { href: u || `/blocklets/${x}`, align: "left", width: 100, children: /* @__PURE__ */ t(
893
908
  te,
894
909
  {
@@ -905,15 +920,15 @@ function sr() {
905
920
  ) });
906
921
  }
907
922
  }
908
- const cr = (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`, dr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
909
- function ur({ title: e, blocklets: r }) {
923
+ const dr = (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`, ur = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
924
+ function pr({ title: e, blocklets: r }) {
910
925
  const { blockletRender: o, serverVersion: l } = B();
911
926
  return /* @__PURE__ */ p(C, { mt: 3, children: [
912
- /* @__PURE__ */ t(L, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
927
+ /* @__PURE__ */ t($, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
913
928
  /* @__PURE__ */ t(he, { container: !0, spacing: 2, children: r.map((n) => /* @__PURE__ */ t(he, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": n.did, children: /* @__PURE__ */ t(C, { padding: "1px", children: o({ blocklet: n, blocklets: r, serverVersion: l }) }) }, n.did)) })
914
929
  ] });
915
930
  }
916
- function pr() {
931
+ function hr() {
917
932
  const { get: e } = Oe(), { t: r } = B(), {
918
933
  data: o = [],
919
934
  error: l,
@@ -922,18 +937,18 @@ function pr() {
922
937
  const a = await e(T.explorePath);
923
938
  return Array.isArray(a) ? a : [];
924
939
  });
925
- return l ? /* @__PURE__ */ t(ee, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : n ? /* @__PURE__ */ t(je, { mt: 15 }) : /* @__PURE__ */ p(z, { children: [
926
- /* @__PURE__ */ t(sr, {}),
940
+ return l ? /* @__PURE__ */ t(ee, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : n ? /* @__PURE__ */ t(je, { mt: 15 }) : /* @__PURE__ */ p(A, { children: [
941
+ /* @__PURE__ */ t(cr, {}),
927
942
  o.map(
928
- (a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(ur, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
943
+ (a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(pr, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
929
944
  )
930
945
  ] });
931
946
  }
932
- function hr() {
947
+ function mr() {
933
948
  var f;
934
- const { filters: e, handleSort: r, handlePrice: o, t: l, getCategoryLocale: n, developerName: a, handleDeveloper: d } = B(), c = ze(l), s = ((f = c.find((m) => m.value === e.sortBy)) == null ? void 0 : f.name) || l("sort.sort");
949
+ const { filters: e, handleSort: r, handlePrice: o, t: l, getCategoryLocale: n, developerName: a, handleDeveloper: d } = B(), c = Ae(l), s = ((f = c.find((m) => m.value === e.sortBy)) == null ? void 0 : f.name) || l("sort.sort");
935
950
  return /* @__PURE__ */ p(
936
- I,
951
+ L,
937
952
  {
938
953
  direction: { xs: "column", md: "row" },
939
954
  alignItems: { xs: "flex-start", md: "center" },
@@ -943,9 +958,9 @@ function hr() {
943
958
  px: 0,
944
959
  pb: 3,
945
960
  children: [
946
- /* @__PURE__ */ t(L, { variant: "h2", textTransform: "capitalize", children: n(e.category) }),
961
+ /* @__PURE__ */ t($, { variant: "h2", textTransform: "capitalize", children: n(e.category) }),
947
962
  /* @__PURE__ */ p(
948
- I,
963
+ L,
949
964
  {
950
965
  direction: "row",
951
966
  alignItems: "center",
@@ -991,11 +1006,11 @@ function hr() {
991
1006
  }
992
1007
  function be() {
993
1008
  const { t: e } = B();
994
- return /* @__PURE__ */ t($e, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
1009
+ return /* @__PURE__ */ t(ze, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
995
1010
  }
996
1011
  function j({ filterTip: e, keywordTip: r }) {
997
1012
  const { t: o, locale: l } = B(), n = () => l === "zh" ? "、" : " , ";
998
- return /* @__PURE__ */ p(Fe, { className: "tips", children: [
1013
+ return /* @__PURE__ */ p($e, { className: "tips", children: [
999
1014
  /* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
1000
1015
  e && /* @__PURE__ */ t("span", { children: o("blocklet.filterTip") }),
1001
1016
  e && r && n(),
@@ -1003,15 +1018,15 @@ function j({ filterTip: e, keywordTip: r }) {
1003
1018
  ] });
1004
1019
  }
1005
1020
  j.propTypes = {
1006
- filterTip: w.bool,
1007
- keywordTip: w.bool
1021
+ filterTip: k.bool,
1022
+ keywordTip: k.bool
1008
1023
  };
1009
1024
  j.defaultProps = {
1010
1025
  filterTip: !1,
1011
1026
  keywordTip: !1
1012
1027
  };
1013
1028
  function H({ primaryStart: e, primaryEnd: r, filter: o }) {
1014
- return /* @__PURE__ */ p($e, { variant: "subtitle2", children: [
1029
+ return /* @__PURE__ */ p(ze, { variant: "subtitle2", children: [
1015
1030
  /* @__PURE__ */ t("span", { children: e }),
1016
1031
  /* @__PURE__ */ p("span", { className: "primary", children: [
1017
1032
  " ",
@@ -1025,9 +1040,9 @@ function H({ primaryStart: e, primaryEnd: r, filter: o }) {
1025
1040
  ] });
1026
1041
  }
1027
1042
  H.propTypes = {
1028
- primaryStart: w.string.isRequired,
1029
- primaryEnd: w.string.isRequired,
1030
- filter: w.string.isRequired
1043
+ primaryStart: k.string.isRequired,
1044
+ primaryEnd: k.string.isRequired,
1045
+ filter: k.string.isRequired
1031
1046
  };
1032
1047
  function qe({ blocklets: e, ...r }) {
1033
1048
  const {
@@ -1040,19 +1055,19 @@ function qe({ blocklets: e, ...r }) {
1040
1055
  t: s,
1041
1056
  serverVersion: f,
1042
1057
  hasNextPage: m,
1043
- loadMore: k,
1044
- endpoint: F,
1058
+ loadMore: v,
1059
+ endpoint: z,
1045
1060
  minItemWidth: R
1046
- } = B(), S = !!a || !!c.price, [u] = At({
1061
+ } = B(), S = !!a || !!c.price, [u] = _t({
1047
1062
  loading: n.fetchBlockletsLoading || n.loadingMore,
1048
1063
  hasNextPage: m,
1049
- onLoadMore: k
1064
+ onLoadMore: v
1050
1065
  });
1051
1066
  if (l.fetchBlockletsError)
1052
1067
  return /* @__PURE__ */ t(
1053
1068
  ee,
1054
1069
  {
1055
- error: new Error(`Failed to fetch blocklets from ${F}: ${l.fetchBlockletsError.message}`)
1070
+ error: new Error(`Failed to fetch blocklets from ${z}: ${l.fetchBlockletsError.message}`)
1056
1071
  }
1057
1072
  );
1058
1073
  if (n.fetchBlockletsLoading)
@@ -1095,7 +1110,7 @@ function qe({ blocklets: e, ...r }) {
1095
1110
  /* @__PURE__ */ t(j, { filterTip: !0 })
1096
1111
  ] });
1097
1112
  }
1098
- return e.length === 0 ? /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */ p(z, { children: [
1113
+ return e.length === 0 ? /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */ p(A, { children: [
1099
1114
  /* @__PURE__ */ t(
1100
1115
  C,
1101
1116
  {
@@ -1111,9 +1126,9 @@ function qe({ blocklets: e, ...r }) {
1111
1126
  ] });
1112
1127
  }
1113
1128
  qe.propTypes = {
1114
- blocklets: w.array.isRequired
1129
+ blocklets: k.array.isRequired
1115
1130
  };
1116
- const U = E(zt)`
1131
+ const U = _(Et)`
1117
1132
  text-align: center;
1118
1133
  margin-top: 100px;
1119
1134
  .primary {
@@ -1124,9 +1139,9 @@ const U = E(zt)`
1124
1139
  }
1125
1140
  `;
1126
1141
  function ae({ onSelect: e, wrapChildren: r }) {
1127
- const o = G(null), l = G(null), n = G(null), { storeApi: a, blockletRender: d, filters: c, endpoint: s, handleKeyword: f, t: m, serverVersion: k } = B(), F = async (h) => {
1128
- const { data: g } = await a.get(T.blockletsPath, { params: h }), v = g.dataList || [];
1129
- return v.length > 0 && v.unshift({ type: "more-result", total: g.total || 0 }), v;
1142
+ const o = G(null), l = G(null), n = G(null), { storeApi: a, blockletRender: d, filters: c, endpoint: s, handleKeyword: f, t: m, serverVersion: v } = B(), z = async (h) => {
1143
+ const { data: g } = await a.get(T.blockletsPath, { params: h }), w = g.dataList || [];
1144
+ return w.length > 0 && w.unshift({ type: "more-result", total: g.total || 0 }), w;
1130
1145
  }, R = (h) => {
1131
1146
  f(h.state.query), h.setIsOpen(!1);
1132
1147
  }, S = () => {
@@ -1139,7 +1154,7 @@ function ae({ onSelect: e, wrapChildren: r }) {
1139
1154
  }, x = ({ prevState: h, state: g }) => {
1140
1155
  h.query !== g.query && (g.query || (f(), S()));
1141
1156
  };
1142
- return Mt(
1157
+ return Ot(
1143
1158
  "ctrl + k, command + k",
1144
1159
  (h) => (h.stopPropagation(), h.preventDefault(), S(), !1),
1145
1160
  { enableOnTags: ["INPUT"] }
@@ -1148,13 +1163,13 @@ function ae({ onSelect: e, wrapChildren: r }) {
1148
1163
  }, [s]), W(() => {
1149
1164
  if (!o.current)
1150
1165
  return;
1151
- const h = Dt({
1166
+ const h = Mt({
1152
1167
  container: o.current,
1153
1168
  renderer: { createElement: pt, Fragment: ht, render: () => {
1154
1169
  } },
1155
- render({ children: g }, v) {
1156
- var _;
1157
- (!l.current || n.current !== v) && (n.current = v, (_ = l.current) == null || _.unmount(), l.current = Nt(v)), l.current.render(r(g));
1170
+ render({ children: g }, w) {
1171
+ var P;
1172
+ (!l.current || n.current !== w) && (n.current = w, (P = l.current) == null || P.unmount(), l.current = Nt(w)), l.current.render(r(g));
1158
1173
  },
1159
1174
  autoFocus: !0,
1160
1175
  openOnFocus: !1,
@@ -1184,34 +1199,34 @@ function ae({ onSelect: e, wrapChildren: r }) {
1184
1199
  onReset(g) {
1185
1200
  u(g);
1186
1201
  },
1187
- getSources({ query: g, state: v, ..._ }) {
1188
- const $ = {
1202
+ getSources({ query: g, state: w, ...P }) {
1203
+ const F = {
1189
1204
  sortBy: T.nameDesc,
1190
1205
  page: 1,
1191
1206
  pageSize: 10,
1192
1207
  keyword: g
1193
1208
  };
1194
- return Jt([
1209
+ return Kt([
1195
1210
  {
1196
1211
  sourceId: "blocklets",
1197
1212
  getItems() {
1198
- return F($);
1213
+ return z(F);
1199
1214
  },
1200
1215
  // 选中后填充 搜索框中值
1201
1216
  getItemInputValue({ item: y }) {
1202
1217
  return y.type === "more-result" ? g : y.title;
1203
1218
  },
1204
1219
  // 选中或者点击自动完成列表中的 item 时触发
1205
- onSelect({ event: y, item: N }) {
1206
- return N.type === "more-result" ? (_.setIsOpen(!1), f(g)) : y.type === "keydown" ? f(N.title) : e({
1207
- blocklet: N,
1208
- detailUrl: Bt(s, "/blocklets", N.did),
1220
+ onSelect({ event: y, item: D }) {
1221
+ return D.type === "more-result" ? (P.setIsOpen(!1), f(g)) : y.type === "keydown" ? f(D.title) : e({
1222
+ blocklet: D,
1223
+ detailUrl: Bt(s, "/blocklets", D.did),
1209
1224
  storeUrl: s
1210
1225
  });
1211
1226
  },
1212
1227
  templates: {
1213
1228
  item({ item: y }) {
1214
- return y.type === "more-result" ? /* @__PURE__ */ t("div", { children: m("autocomplete.expandResult", { name: g, number: y.total.toLocaleString() }) }) : d({ blocklet: y, autocompleteSetters: _, serverVersion: k });
1229
+ return y.type === "more-result" ? /* @__PURE__ */ t("div", { children: m("autocomplete.expandResult", { name: g, number: y.total.toLocaleString() }) }) : d({ blocklet: y, autocompleteSetters: P, serverVersion: v });
1215
1230
  },
1216
1231
  noResults() {
1217
1232
  return m("blocklet.noResults");
@@ -1224,7 +1239,7 @@ function ae({ onSelect: e, wrapChildren: r }) {
1224
1239
  return () => {
1225
1240
  h.destroy();
1226
1241
  };
1227
- }, [c, d]), /* @__PURE__ */ p(z, { children: [
1242
+ }, [c, d]), /* @__PURE__ */ p(A, { children: [
1228
1243
  /* @__PURE__ */ t(
1229
1244
  we,
1230
1245
  {
@@ -1247,8 +1262,8 @@ function ae({ onSelect: e, wrapChildren: r }) {
1247
1262
  ] });
1248
1263
  }
1249
1264
  ae.propTypes = {
1250
- onSelect: w.func.isRequired,
1251
- wrapChildren: w.func
1265
+ onSelect: k.func.isRequired,
1266
+ wrapChildren: k.func
1252
1267
  };
1253
1268
  ae.defaultProps = {
1254
1269
  wrapChildren: (e) => e
@@ -1263,29 +1278,29 @@ function ie({ placeholder: e, ...r }) {
1263
1278
  return W(() => {
1264
1279
  a(o.keyword || "");
1265
1280
  }, [o.keyword]), /* @__PURE__ */ t(
1266
- mr,
1281
+ fr,
1267
1282
  {
1268
1283
  inputProps: {
1269
1284
  "data-cy": "search-blocklet"
1270
1285
  },
1271
- startAdornment: /* @__PURE__ */ t(me, { position: "start", children: /* @__PURE__ */ t(fr, {}) }),
1286
+ startAdornment: /* @__PURE__ */ t(me, { position: "start", children: /* @__PURE__ */ t(gr, {}) }),
1272
1287
  onChange: c,
1273
1288
  placeholder: e,
1274
1289
  value: n,
1275
1290
  title: e,
1276
1291
  "data-cy": "search",
1277
- endAdornment: n && /* @__PURE__ */ t(me, { position: "end", children: /* @__PURE__ */ t(gr, { "data-cy": "search-delete", onClick: s }) }),
1292
+ endAdornment: n && /* @__PURE__ */ t(me, { position: "end", children: /* @__PURE__ */ t(yr, { "data-cy": "search-delete", onClick: s }) }),
1278
1293
  ...r
1279
1294
  }
1280
1295
  );
1281
1296
  }
1282
1297
  ie.propTypes = {
1283
- placeholder: w.string
1298
+ placeholder: k.string
1284
1299
  };
1285
1300
  ie.defaultProps = {
1286
1301
  placeholder: "Type to search..."
1287
1302
  };
1288
- const mr = E(it)`
1303
+ const fr = _(it)`
1289
1304
  background-color: ${(e) => e.theme.palette.grey[50]};
1290
1305
  font-size: 14px;
1291
1306
  border-radius: 6px;
@@ -1302,21 +1317,21 @@ const mr = E(it)`
1302
1317
  color: transparent;
1303
1318
  }
1304
1319
  }
1305
- `, fr = E(Ot)`
1320
+ `, gr = _(jt)`
1306
1321
  color: ${(e) => e.theme.palette.grey[500]};
1307
1322
  font-size: 28px;
1308
1323
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
1309
1324
  font-size: 24px;
1310
1325
  }
1311
- `, gr = E(Re)`
1326
+ `, yr = _(Re)`
1312
1327
  color: ${(e) => e.theme.palette.grey[500]};
1313
1328
  font-size: 16px;
1314
1329
  cursor: pointer;
1315
1330
  `;
1316
- function yr() {
1331
+ function br() {
1317
1332
  const { filters: e, handleSearchSelect: r, t: o, wrapChildren: l, baseSearch: n, layout: a } = B(), { toggleOpen: d } = ne(), c = !!e.keyword;
1318
1333
  return a.showTitle || a.showSearch ? /* @__PURE__ */ p(
1319
- I,
1334
+ L,
1320
1335
  {
1321
1336
  className: "title-bar",
1322
1337
  direction: "row",
@@ -1331,8 +1346,8 @@ function yr() {
1331
1346
  /* @__PURE__ */ t(
1332
1347
  Q,
1333
1348
  {
1334
- xs: !c && /* @__PURE__ */ t(De, { onClick: () => d(!0), children: /* @__PURE__ */ t(Et, {}) }),
1335
- md: a.showTitle ? /* @__PURE__ */ t(L, { variant: "h1", children: o("common.title") }) : /* @__PURE__ */ t(C, {})
1349
+ xs: !c && /* @__PURE__ */ t(Ne, { onClick: () => d(!0), children: /* @__PURE__ */ t(Dt, {}) }),
1350
+ md: a.showTitle ? /* @__PURE__ */ t($, { variant: "h1", children: o("common.title") }) : /* @__PURE__ */ t(C, {})
1336
1351
  }
1337
1352
  ),
1338
1353
  a.showSearch ? /* @__PURE__ */ t(
@@ -1352,30 +1367,30 @@ function yr() {
1352
1367
  }
1353
1368
  ) : null;
1354
1369
  }
1355
- function br() {
1370
+ function xr() {
1356
1371
  const { blockletList: e, total: r, filters: o, t: l } = B(), n = o.category || o.keyword || o.price;
1357
- return /* @__PURE__ */ t(jt, { children: /* @__PURE__ */ p(st, { FallbackComponent: ee, children: [
1358
- /* @__PURE__ */ t(yr, {}),
1372
+ return /* @__PURE__ */ t(qt, { children: /* @__PURE__ */ p(st, { FallbackComponent: ee, children: [
1373
+ /* @__PURE__ */ t(br, {}),
1359
1374
  /* @__PURE__ */ p(C, { display: "flex", height: "100%", children: [
1360
- /* @__PURE__ */ t(ir, {}),
1361
- /* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: n ? /* @__PURE__ */ p(z, { children: [
1362
- o.keyword ? /* @__PURE__ */ p(z, { children: [
1375
+ /* @__PURE__ */ t(sr, {}),
1376
+ /* @__PURE__ */ t(L, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: n ? /* @__PURE__ */ p(A, { children: [
1377
+ o.keyword ? /* @__PURE__ */ p(A, { children: [
1363
1378
  /* @__PURE__ */ t(Q, { xs: /* @__PURE__ */ t(Me, {}), md: null }),
1364
1379
  a()
1365
- ] }) : /* @__PURE__ */ t(hr, {}),
1380
+ ] }) : /* @__PURE__ */ t(mr, {}),
1366
1381
  /* @__PURE__ */ t(qe, { blocklets: e, height: "100%" })
1367
- ] }) : /* @__PURE__ */ t(pr, {}) })
1382
+ ] }) : /* @__PURE__ */ t(hr, {}) })
1368
1383
  ] })
1369
1384
  ] }) });
1370
1385
  function a() {
1371
- return /* @__PURE__ */ p(I, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
1372
- /* @__PURE__ */ t(L, { variant: "h3", children: l("blocklet.search", { keyword: o.keyword }) }),
1373
- /* @__PURE__ */ t(L, { variant: "body1", color: "text.lighter", fontSize: 13, children: l("blocklet.resultCount", { count: r }) })
1386
+ return /* @__PURE__ */ p(L, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
1387
+ /* @__PURE__ */ t($, { variant: "h3", children: l("blocklet.search", { keyword: o.keyword }) }),
1388
+ /* @__PURE__ */ t($, { variant: "body1", color: "text.lighter", fontSize: 13, children: l("blocklet.resultCount", { count: r }) })
1374
1389
  ] });
1375
1390
  }
1376
1391
  }
1377
- function lo(e) {
1378
- const r = xe(), o = Xt(r.palette.primary.main), l = {
1392
+ function io(e) {
1393
+ const r = xe(), o = Yt(r.palette.primary.main), l = {
1379
1394
  autocomplete: ke`
1380
1395
  :root {
1381
1396
  --aa-detached-media-query: (max-width: ${r.breakpoints.values.md}px) !important;
@@ -1414,11 +1429,11 @@ function lo(e) {
1414
1429
  }
1415
1430
  `
1416
1431
  };
1417
- return /* @__PURE__ */ p(rr, { ...e, children: [
1432
+ return /* @__PURE__ */ p(or, { ...e, children: [
1418
1433
  /* @__PURE__ */ t(we, { styles: l.autocomplete }),
1419
- /* @__PURE__ */ t(br, {})
1434
+ /* @__PURE__ */ t(xr, {})
1420
1435
  ] });
1421
1436
  }
1422
1437
  export {
1423
- lo as default
1438
+ io as default
1424
1439
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/list",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "Common ux components of blocklet",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -53,7 +53,7 @@
53
53
  "@algolia/autocomplete-js": "^1.17.0",
54
54
  "@algolia/autocomplete-theme-classic": "^1.17.0",
55
55
  "@blocklet/js-sdk": "^1.16.32",
56
- "@blocklet/util": "0.14.5",
56
+ "@blocklet/util": "0.14.6",
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": "a6ce7177531b7939ff5b46f0af4d68b5da95d3dc"
93
+ "gitHead": "4b2569e52998f0a80c4caf7e29be404c7c10aea5"
94
94
  }