@blocklet/list 0.14.15 → 0.14.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.es.js +404 -383
- package/package.json +7 -7
package/lib/index.es.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { jsx as t, jsxs as h, Fragment as
|
|
2
|
-
import { styled as K, useTheme as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { ErrorFallback as
|
|
1
|
+
import { jsx as t, jsxs as h, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { styled as K, useTheme as ge } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import Je from "@mui/material/styles/createTheme";
|
|
4
|
+
import et from "@mui/material/styles/ThemeProvider";
|
|
5
|
+
import tt from "lodash/merge";
|
|
6
|
+
import { ErrorFallback as xe } from "@arcblock/ux/lib/ErrorBoundary";
|
|
7
7
|
import y from "@mui/material/Box";
|
|
8
|
-
import
|
|
9
|
-
import { ErrorBoundary as
|
|
10
|
-
import
|
|
11
|
-
import { Icon as
|
|
12
|
-
import
|
|
8
|
+
import A from "@mui/material/Stack";
|
|
9
|
+
import { ErrorBoundary as rt } from "react-error-boundary";
|
|
10
|
+
import ot from "@iconify-icons/tabler/compass";
|
|
11
|
+
import { Icon as Le } from "@iconify/react";
|
|
12
|
+
import ye from "@mui/icons-material/Close";
|
|
13
13
|
import w from "@mui/material/Typography";
|
|
14
|
-
import { createContext as
|
|
15
|
-
import { createAxios as
|
|
16
|
-
import
|
|
17
|
-
import { useRequest as
|
|
18
|
-
import
|
|
14
|
+
import { createContext as Ee, useState as P, useMemo as H, useContext as Oe, useCallback as pe, useEffect as U, forwardRef as nt, useRef as me, memo as it } from "react";
|
|
15
|
+
import { createAxios as _e } from "@blocklet/js-sdk";
|
|
16
|
+
import lt from "lodash/orderBy";
|
|
17
|
+
import { useRequest as te, useDebounceFn as ze, useInfiniteScroll as at, useReactive as st } from "ahooks";
|
|
18
|
+
import ie from "lodash/omitBy";
|
|
19
19
|
import "color";
|
|
20
20
|
import "lodash/cloneDeep";
|
|
21
|
-
import { parseURL as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
21
|
+
import { parseURL as ct, parseQuery as dt, parseFilename as ut, stringifyParsedURL as ht, withQuery as we, joinURL as Ce } from "ufo";
|
|
22
|
+
import Se from "flat";
|
|
23
|
+
import re from "@mui/material/Button";
|
|
24
|
+
import pt from "@mui/material/styles/useTheme";
|
|
25
25
|
import j from "@mui/material/useMediaQuery";
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import It from "@arcblock/ux/lib/Img";
|
|
26
|
+
import mt from "@mui/material/Drawer";
|
|
27
|
+
import Me from "@mui/material/Checkbox";
|
|
28
|
+
import Ne from "@mui/material/FormControlLabel";
|
|
29
|
+
import ft from "@mui/icons-material/Check";
|
|
30
|
+
import gt from "@mui/icons-material/KeyboardArrowDown";
|
|
31
|
+
import xt from "@mui/material/ClickAwayListener";
|
|
32
|
+
import yt from "@mui/material/Grow";
|
|
33
|
+
import De from "@mui/material/MenuItem";
|
|
34
|
+
import We from "@mui/material/MenuList";
|
|
35
|
+
import wt from "@mui/material/Paper";
|
|
36
|
+
import bt from "@mui/material/Popper";
|
|
37
|
+
import kt from "@mui/material/SvgIcon";
|
|
38
|
+
import vt from "lodash/isEmpty";
|
|
39
|
+
import oe from "@mui/material/CircularProgress";
|
|
40
|
+
import $e from "@arcblock/ux/lib/Avatar";
|
|
41
|
+
import Ct from "@iconify-icons/tabler/cloud-download";
|
|
42
|
+
import St from "@mui/icons-material/ChevronLeft";
|
|
43
|
+
import It from "@mui/icons-material/ChevronRight";
|
|
44
|
+
import _ from "@mui/material/Skeleton";
|
|
45
|
+
import Bt from "react-image-gallery";
|
|
47
46
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
47
|
+
import Ie from "@mui/material/Grid";
|
|
48
|
+
import Rt from "react-infinite-scroll-hook";
|
|
49
|
+
import Be from "@mui/material/Chip";
|
|
51
50
|
import J from "@mui/icons-material/Search";
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import { useHotkeys as
|
|
57
|
-
import
|
|
58
|
-
import
|
|
51
|
+
import Tt from "@mui/material/Autocomplete";
|
|
52
|
+
import Pt from "@mui/material/Dialog";
|
|
53
|
+
import je from "@mui/material/OutlinedInput";
|
|
54
|
+
import At from "@mui/material/TextField";
|
|
55
|
+
import { useHotkeys as Ft } from "react-hotkeys-hook";
|
|
56
|
+
import Re from "@mui/material/InputAdornment";
|
|
57
|
+
import Lt from "@arcblock/ux/lib/Empty";
|
|
59
58
|
import Et from "json-stable-stringify";
|
|
60
|
-
import
|
|
61
|
-
import { Card as
|
|
62
|
-
|
|
59
|
+
import Ot from "@mui/icons-material/Menu";
|
|
60
|
+
import { Card as _t, Box as le, Skeleton as O } from "@mui/material";
|
|
61
|
+
import zt from "@arcblock/ux/lib/Img";
|
|
62
|
+
const He = Ee({
|
|
63
63
|
open: !1,
|
|
64
64
|
toggleOpen: (e) => {
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
function
|
|
68
|
-
const [r, o] =
|
|
67
|
+
function Mt({ children: e }) {
|
|
68
|
+
const [r, o] = P(!1), n = (a) => {
|
|
69
69
|
o(a ?? !a);
|
|
70
|
-
},
|
|
71
|
-
return /* @__PURE__ */ t(
|
|
70
|
+
}, l = H(() => ({ open: r, toggleOpen: n }), [r]);
|
|
71
|
+
return /* @__PURE__ */ t(He.Provider, { value: l, children: e });
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
73
|
+
function be() {
|
|
74
|
+
return Oe(He);
|
|
75
75
|
}
|
|
76
76
|
const T = {
|
|
77
77
|
nameAsc: "title",
|
|
@@ -87,59 +87,59 @@ const T = {
|
|
|
87
87
|
explorePath: "/api/blocklets/explore",
|
|
88
88
|
exploreDidsPath: "/api/blocklets/dids",
|
|
89
89
|
cacheSize: 100
|
|
90
|
-
},
|
|
90
|
+
}, Nt = (e) => te(
|
|
91
91
|
async () => {
|
|
92
92
|
const { data: r } = await e.get(T.categoriesPath);
|
|
93
93
|
return Array.isArray(r) ? r : [];
|
|
94
94
|
},
|
|
95
95
|
{ manual: !0 }
|
|
96
96
|
);
|
|
97
|
-
function
|
|
97
|
+
function Dt(e, r) {
|
|
98
98
|
const o = { sortBy: "popularity", sortDirection: "desc", ...e }, {
|
|
99
99
|
onFilterChange: n,
|
|
100
|
-
onSearchSelect:
|
|
101
|
-
r.onFilterChange({ ...o, keyword:
|
|
100
|
+
onSearchSelect: l = (i) => {
|
|
101
|
+
r.onFilterChange({ ...o, keyword: i.title });
|
|
102
102
|
},
|
|
103
103
|
emptyCategory: a
|
|
104
104
|
} = r;
|
|
105
105
|
!o.category && !a && (o.category = "All");
|
|
106
|
-
const c = (
|
|
107
|
-
const
|
|
108
|
-
n(
|
|
106
|
+
const c = (i) => {
|
|
107
|
+
const m = { ...o, ...i };
|
|
108
|
+
n(ie(m, (d) => d === "" || d === void 0));
|
|
109
109
|
};
|
|
110
110
|
return {
|
|
111
111
|
filters: e,
|
|
112
|
-
cleanFilter: (
|
|
113
|
-
const
|
|
114
|
-
n(
|
|
112
|
+
cleanFilter: (i) => {
|
|
113
|
+
const m = i ? ie(o, (d, g) => i.includes(g)) : {};
|
|
114
|
+
n(ie(m, (d) => d === "" || d === void 0));
|
|
115
115
|
},
|
|
116
|
-
handleSort: (
|
|
117
|
-
c({ sortBy:
|
|
116
|
+
handleSort: (i, m) => {
|
|
117
|
+
c({ sortBy: i, sortDirection: m || i === "nameAsc" ? "asc" : "desc" });
|
|
118
118
|
},
|
|
119
|
-
handleKeyword: (
|
|
120
|
-
c({ category: void 0, keyword:
|
|
119
|
+
handleKeyword: (i) => {
|
|
120
|
+
c({ category: void 0, keyword: i || void 0 });
|
|
121
121
|
},
|
|
122
|
-
handlePrice: (
|
|
123
|
-
c({ price:
|
|
122
|
+
handlePrice: (i) => {
|
|
123
|
+
c({ price: i === e.price ? void 0 : i });
|
|
124
124
|
},
|
|
125
|
-
handleCategory: (
|
|
126
|
-
c({ category:
|
|
125
|
+
handleCategory: (i) => {
|
|
126
|
+
c({ category: i === e.category ? "" : i });
|
|
127
127
|
},
|
|
128
|
-
handleDeveloper: (
|
|
129
|
-
c({ owner:
|
|
128
|
+
handleDeveloper: (i) => {
|
|
129
|
+
c({ owner: i || void 0 });
|
|
130
130
|
},
|
|
131
|
-
handlePage: (
|
|
132
|
-
c({ currentPage:
|
|
131
|
+
handlePage: (i) => {
|
|
132
|
+
c({ currentPage: i });
|
|
133
133
|
},
|
|
134
|
-
handleSwitchShowResources: (
|
|
135
|
-
c({ showResources:
|
|
134
|
+
handleSwitchShowResources: (i) => {
|
|
135
|
+
c({ showResources: i });
|
|
136
136
|
},
|
|
137
|
-
handleSearchSelect: (
|
|
138
|
-
i
|
|
137
|
+
handleSearchSelect: (i) => {
|
|
138
|
+
l(i);
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const Wt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
143
143
|
{
|
|
144
144
|
name: e("sort.popularity"),
|
|
145
145
|
value: "popularity"
|
|
@@ -152,25 +152,25 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
152
152
|
// name: t('sort.rating'),
|
|
153
153
|
// value: 'rating',
|
|
154
154
|
// },
|
|
155
|
-
],
|
|
155
|
+
], Ve = (e, r, o) => {
|
|
156
156
|
var d, g;
|
|
157
|
-
const n =
|
|
158
|
-
if ((d =
|
|
159
|
-
return
|
|
160
|
-
if (
|
|
157
|
+
const n = ct(e), l = dt(n.search);
|
|
158
|
+
if ((d = ut(e, { strict: !0 })) == null ? void 0 : d.endsWith(".gif"))
|
|
159
|
+
return l.imageFilter ? ht({ ...n, search: "" }) : e;
|
|
160
|
+
if (l.imageFilter)
|
|
161
161
|
return e;
|
|
162
|
-
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w:
|
|
163
|
-
return
|
|
164
|
-
...
|
|
162
|
+
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: i, h: m } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
163
|
+
return we(e, {
|
|
164
|
+
...i || m ? { imageFilter: "resize", w: i, h: m } : {},
|
|
165
165
|
v: c
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, $t = (e) => [
|
|
168
168
|
{ name: e("blocklet.free"), value: "free" },
|
|
169
169
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
170
|
-
],
|
|
170
|
+
], jt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Ht = (e, r) => (
|
|
171
171
|
// eslint-disable-next-line no-prototype-builtins
|
|
172
172
|
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
|
|
173
|
-
),
|
|
173
|
+
), Ut = () => window.innerWidth <= 600, Vt = {
|
|
174
174
|
common: {
|
|
175
175
|
title: "Blocklet Store",
|
|
176
176
|
searchStore: "Search Blocklet",
|
|
@@ -221,7 +221,7 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
221
221
|
autocomplete: {
|
|
222
222
|
expandResult: 'View all search results for "{name}"'
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, Gt = {
|
|
225
225
|
common: {
|
|
226
226
|
title: "Blocklet 商店",
|
|
227
227
|
searchStore: "搜索 Blocklet",
|
|
@@ -272,16 +272,16 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
272
272
|
autocomplete: {
|
|
273
273
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
274
274
|
}
|
|
275
|
-
},
|
|
276
|
-
en:
|
|
277
|
-
zh:
|
|
278
|
-
},
|
|
275
|
+
}, ae = {
|
|
276
|
+
en: Se(Vt),
|
|
277
|
+
zh: Se(Gt)
|
|
278
|
+
}, Ge = (e, r) => {
|
|
279
279
|
const o = {};
|
|
280
280
|
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
281
|
-
},
|
|
282
|
-
const n =
|
|
283
|
-
return
|
|
284
|
-
},
|
|
281
|
+
}, qt = (e) => (r, o) => {
|
|
282
|
+
const n = ae[e] ? ae[e][r] : ae.en[r];
|
|
283
|
+
return Ht(n, o) || r;
|
|
284
|
+
}, qe = {
|
|
285
285
|
errors: {
|
|
286
286
|
fetchCategoriesError: null
|
|
287
287
|
},
|
|
@@ -333,21 +333,21 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
333
333
|
handlePage: () => {
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
},
|
|
337
|
-
function
|
|
336
|
+
}, Ke = Ee(qe), { Provider: Kt, Consumer: Ro } = Ke;
|
|
337
|
+
function Xt(e) {
|
|
338
338
|
const {
|
|
339
339
|
locale: r = "zh",
|
|
340
340
|
filters: o = {},
|
|
341
341
|
serverVersion: n = "",
|
|
342
|
-
onFilterChange:
|
|
342
|
+
onFilterChange: l = () => {
|
|
343
343
|
},
|
|
344
344
|
minItemWidth: a = 350,
|
|
345
345
|
queryFilter: c = !0,
|
|
346
|
-
layout:
|
|
347
|
-
wrapChildren:
|
|
346
|
+
layout: i = {},
|
|
347
|
+
wrapChildren: m = (R) => R,
|
|
348
348
|
extraFilter: d = (R) => R,
|
|
349
349
|
baseSearch: g = !1,
|
|
350
|
-
fetchCategoryDelay:
|
|
350
|
+
fetchCategoryDelay: p = 0,
|
|
351
351
|
showResourcesSwitch: f = !1,
|
|
352
352
|
showCategory: k = !0,
|
|
353
353
|
tagFilters: S = [],
|
|
@@ -357,17 +357,17 @@ function qt(e) {
|
|
|
357
357
|
},
|
|
358
358
|
endpoint: C,
|
|
359
359
|
blockletRender: x
|
|
360
|
-
} = e,
|
|
360
|
+
} = e, F = Ge(n, v), L = H(() => _e({ baseURL: C, headers: F }), [C]), E = Dt(o, { onFilterChange: l, emptyCategory: !i.showExplore, onSearchSelect: u }), [N, V] = P(""), {
|
|
361
361
|
data: G = [],
|
|
362
|
-
error:
|
|
362
|
+
error: ne,
|
|
363
363
|
loading: X,
|
|
364
364
|
run: Q
|
|
365
|
-
} =
|
|
366
|
-
const R =
|
|
367
|
-
return
|
|
368
|
-
}, [G]), q =
|
|
369
|
-
search:
|
|
370
|
-
errors: { fetchCategoriesError:
|
|
365
|
+
} = Nt(L), $ = H(() => {
|
|
366
|
+
const R = lt(G, [(W) => W.name], ["asc"]), z = R.findIndex((W) => W.name === "All" || W.locales.en === "All");
|
|
367
|
+
return z > -1 ? [{ ...R[z], _id: "All" }, ...R.slice(0, z), ...R.slice(z + 1)] : R;
|
|
368
|
+
}, [G]), q = pe(qt(r), [r]), s = H(() => jt($, r), [$, r]), b = $t(q), D = {
|
|
369
|
+
search: E,
|
|
370
|
+
errors: { fetchCategoriesError: ne },
|
|
371
371
|
loadings: {
|
|
372
372
|
fetchCategoriesLoading: X
|
|
373
373
|
},
|
|
@@ -375,55 +375,54 @@ function qt(e) {
|
|
|
375
375
|
endpoint: C,
|
|
376
376
|
queryFilter: c,
|
|
377
377
|
layout: {
|
|
378
|
-
showExplore:
|
|
379
|
-
showCategory:
|
|
380
|
-
showTitle:
|
|
381
|
-
showSearch:
|
|
378
|
+
showExplore: i.showExplore ?? !1,
|
|
379
|
+
showCategory: i.showCategory ?? !0,
|
|
380
|
+
showTitle: i.showTitle ?? !0,
|
|
381
|
+
showSearch: i.showSearch ?? !0
|
|
382
382
|
},
|
|
383
383
|
minItemWidth: a,
|
|
384
|
-
wrapChildren:
|
|
384
|
+
wrapChildren: m,
|
|
385
385
|
t: q,
|
|
386
386
|
storeVersion: v,
|
|
387
387
|
serverVersion: n,
|
|
388
|
-
selectedCategory:
|
|
388
|
+
selectedCategory: E.filters.category || (i.showExplore ? "" : "All"),
|
|
389
389
|
categoryList: $,
|
|
390
390
|
blockletRender: x,
|
|
391
391
|
locale: r,
|
|
392
392
|
categoryOptions: s,
|
|
393
393
|
priceOptions: b,
|
|
394
|
-
storeApi:
|
|
394
|
+
storeApi: L,
|
|
395
395
|
baseSearch: g,
|
|
396
396
|
showResourcesSwitch: f,
|
|
397
397
|
showCategory: k,
|
|
398
398
|
tagFilters: S,
|
|
399
|
-
onFilterChange:
|
|
399
|
+
onFilterChange: l,
|
|
400
400
|
getCategoryLocale: (R) => {
|
|
401
|
-
if (!R)
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
return _ ? _.locales[r] || _.locales.en : null;
|
|
401
|
+
if (!R) return null;
|
|
402
|
+
const z = G.find((W) => W._id === R || W.locales.en === "All");
|
|
403
|
+
return z ? z.locales[r] || z.locales.en : null;
|
|
405
404
|
},
|
|
406
405
|
get developerName() {
|
|
407
|
-
return
|
|
406
|
+
return N;
|
|
408
407
|
},
|
|
409
408
|
updateDeveloperName: V
|
|
410
409
|
};
|
|
411
410
|
return U(() => {
|
|
412
|
-
setTimeout(Q,
|
|
413
|
-
}, [C, Q,
|
|
411
|
+
setTimeout(Q, p || 0);
|
|
412
|
+
}, [C, Q, p]), /* @__PURE__ */ t(Kt, { value: D, children: B });
|
|
414
413
|
}
|
|
415
414
|
function I() {
|
|
416
|
-
const e =
|
|
417
|
-
return e ||
|
|
415
|
+
const e = Oe(Ke);
|
|
416
|
+
return e || qe;
|
|
418
417
|
}
|
|
419
|
-
function
|
|
418
|
+
function Xe({
|
|
420
419
|
children: e,
|
|
421
420
|
onClick: r,
|
|
422
421
|
size: o = 32,
|
|
423
422
|
...n
|
|
424
423
|
}) {
|
|
425
424
|
return /* @__PURE__ */ t(
|
|
426
|
-
|
|
425
|
+
re,
|
|
427
426
|
{
|
|
428
427
|
...n,
|
|
429
428
|
onClick: r,
|
|
@@ -449,83 +448,83 @@ function qe({
|
|
|
449
448
|
function Y(e, r) {
|
|
450
449
|
return e === void 0 ? r : e;
|
|
451
450
|
}
|
|
452
|
-
function
|
|
451
|
+
function ke({
|
|
453
452
|
xs: e,
|
|
454
453
|
sm: r,
|
|
455
454
|
md: o,
|
|
456
455
|
lg: n,
|
|
457
|
-
xl:
|
|
456
|
+
xl: l,
|
|
458
457
|
exact: a
|
|
459
458
|
}) {
|
|
460
|
-
const c =
|
|
459
|
+
const c = pt(), i = j(c.breakpoints.down("sm")), m = j(c.breakpoints.between("sm", "md")), d = j(c.breakpoints.between("md", "lg")), g = j(c.breakpoints.between("lg", "xl"));
|
|
461
460
|
if (a)
|
|
462
|
-
return
|
|
463
|
-
let
|
|
464
|
-
return
|
|
461
|
+
return i ? e || null : m ? r || null : d ? o || null : g ? n || null : l || null;
|
|
462
|
+
let p = e;
|
|
463
|
+
return i || (p = Y(r, p), m) || (p = Y(o, p), d) || (p = Y(n, p), g) ? p : Y(l, p);
|
|
465
464
|
}
|
|
466
|
-
function
|
|
467
|
-
const { open: r, toggleOpen: o } =
|
|
465
|
+
function Qt({ children: e }) {
|
|
466
|
+
const { open: r, toggleOpen: o } = be();
|
|
468
467
|
return /* @__PURE__ */ t(
|
|
469
|
-
|
|
468
|
+
ke,
|
|
470
469
|
{
|
|
471
|
-
xs: /* @__PURE__ */ t(
|
|
470
|
+
xs: /* @__PURE__ */ t(mt, { open: r, onClose: () => o(!1), children: e }),
|
|
472
471
|
md: /* @__PURE__ */ t(y, { children: e })
|
|
473
472
|
}
|
|
474
473
|
);
|
|
475
474
|
}
|
|
476
|
-
const
|
|
477
|
-
|
|
475
|
+
const Yt = nt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
476
|
+
re,
|
|
478
477
|
{
|
|
479
478
|
ref: n,
|
|
480
479
|
disableElevation: !0,
|
|
481
480
|
disabled: r || e,
|
|
482
481
|
...o,
|
|
483
482
|
sx: [{ borderRadius: "4px" }, ...Array.isArray(o.sx) ? o.sx : [o.sx]],
|
|
484
|
-
startIcon: e && /* @__PURE__ */ t(
|
|
483
|
+
startIcon: e && /* @__PURE__ */ t(oe, { size: "1em" })
|
|
485
484
|
}
|
|
486
485
|
));
|
|
487
|
-
function
|
|
486
|
+
function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
488
487
|
var v;
|
|
489
|
-
const a =
|
|
488
|
+
const a = me(null), c = ge(), [i, m] = P(!1), [d, g] = P(e !== null ? e : ""), p = j(c.breakpoints.down("sm"));
|
|
490
489
|
U(() => {
|
|
491
490
|
g(e !== null ? e : "");
|
|
492
491
|
}, [e]);
|
|
493
|
-
const f =
|
|
494
|
-
|
|
495
|
-
}, []), k =
|
|
496
|
-
|
|
492
|
+
const f = pe(() => {
|
|
493
|
+
m(!1);
|
|
494
|
+
}, []), k = pe(() => {
|
|
495
|
+
m(!0);
|
|
497
496
|
}, []);
|
|
498
497
|
function S(u) {
|
|
499
|
-
g(u.value), o(u.value),
|
|
498
|
+
g(u.value), o(u.value), p && f();
|
|
500
499
|
}
|
|
501
500
|
function B(u) {
|
|
502
501
|
return u === d;
|
|
503
502
|
}
|
|
504
|
-
return /* @__PURE__ */ h(
|
|
503
|
+
return /* @__PURE__ */ h(M, { children: [
|
|
505
504
|
/* @__PURE__ */ h(
|
|
506
|
-
|
|
505
|
+
Zt,
|
|
507
506
|
{
|
|
508
507
|
ref: a,
|
|
509
508
|
onClick: k,
|
|
510
509
|
variant: "outlined",
|
|
511
510
|
size: "small",
|
|
512
|
-
className: ["my-select__selector",
|
|
511
|
+
className: ["my-select__selector", vt(d) ? "" : "my-select__selector--active"].join(" "),
|
|
513
512
|
sx: { minWidth: "auto", color: "text.primary" },
|
|
514
|
-
...
|
|
513
|
+
...l,
|
|
515
514
|
children: [
|
|
516
515
|
((v = r.find((u) => u.value === d)) == null ? void 0 : v.name) || n,
|
|
517
|
-
/* @__PURE__ */ t(
|
|
516
|
+
/* @__PURE__ */ t(kt, { className: "my-select__arrowdown", component: gt, fontSize: "small" })
|
|
518
517
|
]
|
|
519
518
|
}
|
|
520
519
|
),
|
|
521
|
-
/* @__PURE__ */ t(
|
|
522
|
-
|
|
520
|
+
/* @__PURE__ */ t(bt, { open: i, anchorEl: a.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: u, placement: C }) => /* @__PURE__ */ t(
|
|
521
|
+
yt,
|
|
523
522
|
{
|
|
524
523
|
...u,
|
|
525
524
|
style: { transformOrigin: C === "bottom" ? "center top" : "center bottom" },
|
|
526
|
-
children: /* @__PURE__ */ t(
|
|
525
|
+
children: /* @__PURE__ */ t(wt, { children: /* @__PURE__ */ t(xt, { onClickAway: f, children: /* @__PURE__ */ t(Jt, { autoFocusItem: i, onMouseEnter: k, onMouseLeave: f, children: r.map((x) => /* @__PURE__ */ h(De, { onClick: () => S(x), children: [
|
|
527
526
|
/* @__PURE__ */ t(
|
|
528
|
-
|
|
527
|
+
ft,
|
|
529
528
|
{
|
|
530
529
|
sx: { mr: 1, fontSize: 16, visibility: B(x.value) ? "visible" : "hidden" }
|
|
531
530
|
}
|
|
@@ -536,7 +535,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
|
536
535
|
) })
|
|
537
536
|
] });
|
|
538
537
|
}
|
|
539
|
-
const
|
|
538
|
+
const Zt = K(Yt)`
|
|
540
539
|
border: 1px solid #f0f0f0;
|
|
541
540
|
padding: 6px 8px 6px 12px;
|
|
542
541
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -564,7 +563,7 @@ const Qt = K(Xt)`
|
|
|
564
563
|
margin-right: 3px;
|
|
565
564
|
}
|
|
566
565
|
}
|
|
567
|
-
`,
|
|
566
|
+
`, Jt = K(We)`
|
|
568
567
|
.my-select__option__icon {
|
|
569
568
|
color: transparent;
|
|
570
569
|
font-size: 14px;
|
|
@@ -581,10 +580,10 @@ const Qt = K(Xt)`
|
|
|
581
580
|
}
|
|
582
581
|
}
|
|
583
582
|
`;
|
|
584
|
-
function
|
|
585
|
-
const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice:
|
|
583
|
+
function Ye() {
|
|
584
|
+
const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice: l } = e, a = Ue(r);
|
|
586
585
|
return /* @__PURE__ */ h(
|
|
587
|
-
|
|
586
|
+
A,
|
|
588
587
|
{
|
|
589
588
|
direction: { xs: "row", md: "column" },
|
|
590
589
|
alignItems: { xs: "center", md: "flex-start" },
|
|
@@ -593,22 +592,22 @@ function Xe() {
|
|
|
593
592
|
justifyContent: "space-between",
|
|
594
593
|
children: [
|
|
595
594
|
/* @__PURE__ */ t(
|
|
596
|
-
|
|
595
|
+
Ne,
|
|
597
596
|
{
|
|
598
597
|
control: /* @__PURE__ */ t(
|
|
599
|
-
|
|
598
|
+
Me,
|
|
600
599
|
{
|
|
601
600
|
checked: o.price === "free",
|
|
602
601
|
size: "small",
|
|
603
602
|
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
604
|
-
onChange: (c) =>
|
|
603
|
+
onChange: (c) => l(c.target.checked ? "free" : "")
|
|
605
604
|
}
|
|
606
605
|
),
|
|
607
606
|
label: r("blocklet.free")
|
|
608
607
|
}
|
|
609
608
|
),
|
|
610
609
|
/* @__PURE__ */ t(
|
|
611
|
-
|
|
610
|
+
Qe,
|
|
612
611
|
{
|
|
613
612
|
value: o.sortBy || a[0].value,
|
|
614
613
|
options: a,
|
|
@@ -620,18 +619,18 @@ function Xe() {
|
|
|
620
619
|
}
|
|
621
620
|
);
|
|
622
621
|
}
|
|
623
|
-
function
|
|
624
|
-
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings:
|
|
622
|
+
function er() {
|
|
623
|
+
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: l, layout: a, baseSearch: c } = I(), { filters: i, handleCategory: m, cleanFilter: d } = r, { toggleOpen: g } = be();
|
|
625
624
|
U(() => {
|
|
626
625
|
g(!1);
|
|
627
|
-
}, [Object.values(
|
|
628
|
-
const
|
|
629
|
-
return a.showCategory ? /* @__PURE__ */ h(
|
|
626
|
+
}, [Object.values(i).join("")]);
|
|
627
|
+
const p = Wt(c, a.showSearch, i.keyword);
|
|
628
|
+
return a.showCategory ? /* @__PURE__ */ h(Qt, { children: [
|
|
630
629
|
/* @__PURE__ */ t(
|
|
631
|
-
|
|
630
|
+
ke,
|
|
632
631
|
{
|
|
633
632
|
xs: /* @__PURE__ */ h(
|
|
634
|
-
|
|
633
|
+
A,
|
|
635
634
|
{
|
|
636
635
|
direction: "row",
|
|
637
636
|
justifyContent: "space-between",
|
|
@@ -642,7 +641,7 @@ function Zt() {
|
|
|
642
641
|
borderBottom: 1,
|
|
643
642
|
borderColor: "divider",
|
|
644
643
|
children: [
|
|
645
|
-
/* @__PURE__ */ t(
|
|
644
|
+
/* @__PURE__ */ t(Xe, { onClick: () => g(!1), children: /* @__PURE__ */ t(ye, {}) }),
|
|
646
645
|
/* @__PURE__ */ t(w, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: o("common.category") })
|
|
647
646
|
]
|
|
648
647
|
}
|
|
@@ -651,16 +650,16 @@ function Zt() {
|
|
|
651
650
|
}
|
|
652
651
|
),
|
|
653
652
|
/* @__PURE__ */ t(
|
|
654
|
-
|
|
653
|
+
A,
|
|
655
654
|
{
|
|
656
|
-
visibility:
|
|
655
|
+
visibility: l.fetchCategoriesLoading ? "hidden" : "visible",
|
|
657
656
|
width: { xs: 268, md: 200 },
|
|
658
657
|
boxSizing: "content-box",
|
|
659
658
|
p: { xs: 2, md: 0 },
|
|
660
659
|
pr: { md: 6 },
|
|
661
|
-
children:
|
|
660
|
+
children: p ? /* @__PURE__ */ h(M, { children: [
|
|
662
661
|
a.showExplore && /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
663
|
-
/* @__PURE__ */ t(
|
|
662
|
+
/* @__PURE__ */ t(Le, { icon: ot }),
|
|
664
663
|
/* @__PURE__ */ t(
|
|
665
664
|
w,
|
|
666
665
|
{
|
|
@@ -675,7 +674,7 @@ function Zt() {
|
|
|
675
674
|
}
|
|
676
675
|
)
|
|
677
676
|
] }),
|
|
678
|
-
!!n.length && /* @__PURE__ */ t(
|
|
677
|
+
!!n.length && /* @__PURE__ */ t(A, { gap: 2, children: n.map((f) => /* @__PURE__ */ t(
|
|
679
678
|
w,
|
|
680
679
|
{
|
|
681
680
|
variant: "body1",
|
|
@@ -685,46 +684,43 @@ function Zt() {
|
|
|
685
684
|
color: e === f.value ? "text.primary" : "text.lighter",
|
|
686
685
|
textTransform: "capitalize",
|
|
687
686
|
onClick: () => {
|
|
688
|
-
e === f.value ? d() :
|
|
687
|
+
e === f.value ? d() : m(f.value), g(!1);
|
|
689
688
|
},
|
|
690
689
|
children: f.name
|
|
691
690
|
},
|
|
692
691
|
f.value
|
|
693
692
|
)) })
|
|
694
|
-
] }) : /* @__PURE__ */ t(
|
|
693
|
+
] }) : /* @__PURE__ */ t(Ye, {})
|
|
695
694
|
}
|
|
696
695
|
)
|
|
697
696
|
] }) : null;
|
|
698
697
|
}
|
|
699
|
-
function
|
|
700
|
-
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n =
|
|
698
|
+
function ve() {
|
|
699
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n = Ge(r, o), l = H(() => _e({
|
|
701
700
|
baseURL: e,
|
|
702
701
|
headers: n
|
|
703
702
|
}), [e]);
|
|
704
703
|
return {
|
|
705
704
|
get: async (a) => {
|
|
706
|
-
const { data: c } = await
|
|
705
|
+
const { data: c } = await l.get(a);
|
|
707
706
|
return c;
|
|
708
707
|
},
|
|
709
708
|
post: async (a, c) => {
|
|
710
|
-
const { data:
|
|
711
|
-
return
|
|
709
|
+
const { data: i } = await l.post(a, c);
|
|
710
|
+
return i;
|
|
712
711
|
}
|
|
713
712
|
};
|
|
714
713
|
}
|
|
715
|
-
const
|
|
716
|
-
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(
|
|
714
|
+
const Ze = it(function(r) {
|
|
715
|
+
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(oe, {}) });
|
|
717
716
|
});
|
|
718
|
-
function
|
|
719
|
-
return e ? /* @__PURE__ */ t(z, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(It, { ...r });
|
|
720
|
-
}
|
|
721
|
-
function Be({
|
|
717
|
+
function Te({
|
|
722
718
|
icon: e,
|
|
723
719
|
children: r,
|
|
724
720
|
maxWidth: o = 100,
|
|
725
721
|
title: n
|
|
726
722
|
}) {
|
|
727
|
-
return (r === 0 || r) && /* @__PURE__ */ h(
|
|
723
|
+
return (r === 0 || r) && /* @__PURE__ */ h(A, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
|
|
728
724
|
e,
|
|
729
725
|
/* @__PURE__ */ t(
|
|
730
726
|
w,
|
|
@@ -738,20 +734,20 @@ function Be({
|
|
|
738
734
|
)
|
|
739
735
|
] });
|
|
740
736
|
}
|
|
741
|
-
const
|
|
742
|
-
function
|
|
737
|
+
const se = 292, fe = 210, ee = 336;
|
|
738
|
+
function tr() {
|
|
743
739
|
var B, v;
|
|
744
|
-
const { t: e, search: r } = I(), { get: o } =
|
|
740
|
+
const { t: e, search: r } = I(), { get: o } = ve(), n = ge(), l = j(n.breakpoints.down("md")), a = ((v = (B = window.blocklet) == null ? void 0 : B.preferences) == null ? void 0 : v.homeBanner) || [], {
|
|
745
741
|
data: c = [],
|
|
746
|
-
error:
|
|
747
|
-
loading:
|
|
748
|
-
} =
|
|
742
|
+
error: i,
|
|
743
|
+
loading: m
|
|
744
|
+
} = te(async () => {
|
|
749
745
|
const u = await o(
|
|
750
|
-
|
|
746
|
+
we(T.blockletsPath, { didList: a.map((C) => C.did).join(",") })
|
|
751
747
|
);
|
|
752
748
|
return u != null && u.dataList ? a.map((C) => u.dataList.find((x) => x.did === C.did)) : [];
|
|
753
749
|
});
|
|
754
|
-
|
|
750
|
+
i && console.error("Get Banner Blocklets error:", i);
|
|
755
751
|
const d = {
|
|
756
752
|
position: "absolute",
|
|
757
753
|
top: "50%",
|
|
@@ -760,52 +756,53 @@ function rr() {
|
|
|
760
756
|
cursor: "pointer",
|
|
761
757
|
color: "text.lighter"
|
|
762
758
|
};
|
|
763
|
-
return !
|
|
759
|
+
return !i && a.length > 0 ? /* @__PURE__ */ h(M, { children: [
|
|
764
760
|
/* @__PURE__ */ t(w, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
765
761
|
/* @__PURE__ */ t(
|
|
766
762
|
y,
|
|
767
763
|
{
|
|
768
|
-
height: { xs: "auto", md:
|
|
764
|
+
height: { xs: "auto", md: se },
|
|
765
|
+
minHeight: se,
|
|
769
766
|
position: "relative",
|
|
770
767
|
border: 1,
|
|
771
768
|
borderColor: "divider",
|
|
772
769
|
borderRadius: 3,
|
|
773
770
|
overflow: "hidden",
|
|
774
|
-
children:
|
|
775
|
-
/* @__PURE__ */ t(
|
|
771
|
+
children: m ? /* @__PURE__ */ h(y, { p: 5, display: { md: "flex" }, gap: 5, alignItems: "center", justifyContent: "center", children: [
|
|
772
|
+
/* @__PURE__ */ t(_, { variant: "rounded", height: fe, width: ee }),
|
|
776
773
|
/* @__PURE__ */ h(y, { flex: 1, height: "100%", children: [
|
|
777
|
-
/* @__PURE__ */ t(
|
|
778
|
-
/* @__PURE__ */ t(
|
|
779
|
-
/* @__PURE__ */ t(
|
|
774
|
+
/* @__PURE__ */ t(_, { variant: "text", height: 50, width: 100 }),
|
|
775
|
+
/* @__PURE__ */ t(_, { variant: "text", height: 40, width: "100%" }),
|
|
776
|
+
/* @__PURE__ */ t(_, { variant: "text", height: 40, width: 300 }),
|
|
780
777
|
/* @__PURE__ */ h(y, { display: "flex", gap: 1, my: 2, children: [
|
|
781
|
-
/* @__PURE__ */ t(
|
|
782
|
-
/* @__PURE__ */ t(
|
|
778
|
+
/* @__PURE__ */ t(_, { variant: "circular", height: 20, width: 20 }),
|
|
779
|
+
/* @__PURE__ */ t(_, { variant: "text", height: 20, width: 50 })
|
|
783
780
|
] }),
|
|
784
|
-
/* @__PURE__ */ t(
|
|
781
|
+
/* @__PURE__ */ t(_, { variant: "rounded", height: 30, width: 100 })
|
|
785
782
|
] })
|
|
786
783
|
] }) : /* @__PURE__ */ t(
|
|
787
|
-
|
|
784
|
+
Bt,
|
|
788
785
|
{
|
|
789
786
|
showNav: !0,
|
|
790
787
|
autoPlay: !0,
|
|
791
|
-
slideDuration:
|
|
788
|
+
slideDuration: l ? 500 : 1e3,
|
|
792
789
|
slideInterval: 5e3,
|
|
793
790
|
showPlayButton: !1,
|
|
794
791
|
showIndex: !1,
|
|
795
792
|
showBullets: !1,
|
|
796
793
|
showThumbnails: !1,
|
|
797
794
|
showFullscreenButton: !1,
|
|
798
|
-
renderLeftNav: (u) => /* @__PURE__ */ t(y, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(
|
|
799
|
-
renderRightNav: (u) => /* @__PURE__ */ t(y, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(
|
|
795
|
+
renderLeftNav: (u) => /* @__PURE__ */ t(y, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(St, { sx: { ...d, left: 5 } }) }),
|
|
796
|
+
renderRightNav: (u) => /* @__PURE__ */ t(y, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(It, { sx: { ...d, right: 5 } }) }),
|
|
800
797
|
items: a.map((u, C) => ({
|
|
801
798
|
original: u.did,
|
|
802
799
|
renderItem: () => {
|
|
803
|
-
var
|
|
804
|
-
const x = c[C] || {},
|
|
800
|
+
var E;
|
|
801
|
+
const x = c[C] || {}, F = u.cover || or(u.did, (E = x.screenshots) == null ? void 0 : E[0]), L = Ve(F, n.breakpoints.values.md * 2);
|
|
805
802
|
return /* @__PURE__ */ h(
|
|
806
|
-
|
|
803
|
+
A,
|
|
807
804
|
{
|
|
808
|
-
height: { xs: "auto", md:
|
|
805
|
+
height: { xs: "auto", md: se },
|
|
809
806
|
sx: {
|
|
810
807
|
cursor: "pointer",
|
|
811
808
|
"&::before": {
|
|
@@ -815,7 +812,7 @@ function rr() {
|
|
|
815
812
|
left: 0,
|
|
816
813
|
right: 0,
|
|
817
814
|
bottom: 0,
|
|
818
|
-
backgroundImage: `url("${
|
|
815
|
+
backgroundImage: `url("${L}")`,
|
|
819
816
|
backgroundSize: "cover",
|
|
820
817
|
filter: "blur(50px)",
|
|
821
818
|
opacity: 0.15,
|
|
@@ -830,10 +827,10 @@ function rr() {
|
|
|
830
827
|
onClick: () => r.handleSearchSelect(x),
|
|
831
828
|
gap: { xs: 2, md: 5 },
|
|
832
829
|
children: [
|
|
833
|
-
g(
|
|
834
|
-
/* @__PURE__ */ h(
|
|
830
|
+
g(L),
|
|
831
|
+
/* @__PURE__ */ h(A, { flex: 1, height: "100%", gap: 3, children: [
|
|
835
832
|
/* @__PURE__ */ h(y, { flex: 1, children: [
|
|
836
|
-
|
|
833
|
+
p(u.name || x.title || u.name),
|
|
837
834
|
f(u.desc || x.description)
|
|
838
835
|
] }),
|
|
839
836
|
x.did && k(x, u.baseNum),
|
|
@@ -850,19 +847,9 @@ function rr() {
|
|
|
850
847
|
)
|
|
851
848
|
] }) : null;
|
|
852
849
|
function g(u) {
|
|
853
|
-
return /* @__PURE__ */ t(y, {
|
|
854
|
-
Jt,
|
|
855
|
-
{
|
|
856
|
-
showSkeleton: p,
|
|
857
|
-
src: u,
|
|
858
|
-
alt: "",
|
|
859
|
-
width: i ? void 0 : 338,
|
|
860
|
-
height: 210,
|
|
861
|
-
style: { objectFit: "cover", cursor: "pointer" }
|
|
862
|
-
}
|
|
863
|
-
) });
|
|
850
|
+
return /* @__PURE__ */ t(y, { borderRadius: 2, overflow: "hidden", position: "relative", width: { xs: "100%", md: ee }, children: /* @__PURE__ */ t(nr, { url: u }) });
|
|
864
851
|
}
|
|
865
|
-
function
|
|
852
|
+
function p(u) {
|
|
866
853
|
return /* @__PURE__ */ t(w, { variant: "h2", width: "100%", children: u });
|
|
867
854
|
}
|
|
868
855
|
function f(u) {
|
|
@@ -890,15 +877,15 @@ function rr() {
|
|
|
890
877
|
);
|
|
891
878
|
}
|
|
892
879
|
function k(u, C = 0) {
|
|
893
|
-
const { did: x, owner:
|
|
880
|
+
const { did: x, owner: F, stats: L } = u;
|
|
894
881
|
return /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
895
|
-
/* @__PURE__ */ t(
|
|
896
|
-
/* @__PURE__ */ t(
|
|
882
|
+
/* @__PURE__ */ t(Te, { icon: /* @__PURE__ */ t($e, { src: F.avatar, did: x, size: 20, variant: "circle" }), children: F.fullName }),
|
|
883
|
+
/* @__PURE__ */ t(Te, { icon: /* @__PURE__ */ t(Le, { icon: Ct }), title: `${L.downloads + C}`, children: rr(L.downloads + C) })
|
|
897
884
|
] });
|
|
898
885
|
}
|
|
899
886
|
function S(u) {
|
|
900
887
|
return /* @__PURE__ */ t(
|
|
901
|
-
|
|
888
|
+
re,
|
|
902
889
|
{
|
|
903
890
|
variant: "outlined",
|
|
904
891
|
size: "small",
|
|
@@ -916,45 +903,76 @@ function rr() {
|
|
|
916
903
|
);
|
|
917
904
|
}
|
|
918
905
|
}
|
|
919
|
-
const
|
|
920
|
-
function
|
|
906
|
+
const rr = (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`, or = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
907
|
+
function nr({ url: e }) {
|
|
908
|
+
const [r, o] = P(!0);
|
|
909
|
+
return /* @__PURE__ */ h(M, { children: [
|
|
910
|
+
r && /* @__PURE__ */ t(
|
|
911
|
+
_,
|
|
912
|
+
{
|
|
913
|
+
variant: "rectangular",
|
|
914
|
+
sx: {
|
|
915
|
+
width: { xs: "100%", md: ee },
|
|
916
|
+
height: { xs: "auto", md: fe }
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ t(
|
|
921
|
+
y,
|
|
922
|
+
{
|
|
923
|
+
display: r ? "none" : "block",
|
|
924
|
+
component: "img",
|
|
925
|
+
src: e,
|
|
926
|
+
width: { xs: "100%", md: ee },
|
|
927
|
+
height: { xs: "auto", md: fe },
|
|
928
|
+
borderRadius: 2,
|
|
929
|
+
border: 1,
|
|
930
|
+
borderColor: "divider",
|
|
931
|
+
sx: { objectFit: "container", cursor: "pointer", aspectRatio: 16 / 10 },
|
|
932
|
+
onLoad: () => o(!1),
|
|
933
|
+
onError: () => o(!1)
|
|
934
|
+
}
|
|
935
|
+
)
|
|
936
|
+
] });
|
|
937
|
+
}
|
|
938
|
+
function ir({ title: e, blocklets: r }) {
|
|
921
939
|
const { blockletRender: o, serverVersion: n } = I();
|
|
922
940
|
return /* @__PURE__ */ h(y, { mt: 3, children: [
|
|
923
941
|
/* @__PURE__ */ t(w, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
924
|
-
/* @__PURE__ */ t(
|
|
942
|
+
/* @__PURE__ */ t(Ie, { container: !0, spacing: 2, children: r.map((l) => /* @__PURE__ */ t(Ie, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": l.did, children: /* @__PURE__ */ t(y, { padding: "1px", children: o({ blocklet: l, blocklets: r, serverVersion: n }) }) }, l.did)) })
|
|
925
943
|
] });
|
|
926
944
|
}
|
|
927
|
-
function
|
|
928
|
-
const { get: e } =
|
|
945
|
+
function lr() {
|
|
946
|
+
const { get: e } = ve(), { t: r } = I(), {
|
|
929
947
|
data: o = [],
|
|
930
948
|
error: n,
|
|
931
|
-
loading:
|
|
932
|
-
} =
|
|
949
|
+
loading: l
|
|
950
|
+
} = te(async () => {
|
|
933
951
|
const a = await e(T.explorePath);
|
|
934
952
|
return Array.isArray(a) ? a : [];
|
|
935
953
|
});
|
|
936
|
-
return n ? /* @__PURE__ */ t(
|
|
937
|
-
/* @__PURE__ */ t(
|
|
954
|
+
return n ? /* @__PURE__ */ t(xe, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : l ? /* @__PURE__ */ t(Ze, { mt: 15 }) : /* @__PURE__ */ h(M, { children: [
|
|
955
|
+
/* @__PURE__ */ t(tr, {}),
|
|
938
956
|
o.map(
|
|
939
|
-
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(
|
|
957
|
+
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(ir, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
940
958
|
)
|
|
941
959
|
] });
|
|
942
960
|
}
|
|
943
|
-
const
|
|
961
|
+
const ce = "__FREE_TEXT__", Pe = "__NO_RESULT__", de = 40;
|
|
944
962
|
function ar({
|
|
945
963
|
endpoint: e,
|
|
946
964
|
t: r,
|
|
947
965
|
locale: o,
|
|
948
966
|
filters: n,
|
|
949
|
-
handleKeyword:
|
|
967
|
+
handleKeyword: l,
|
|
950
968
|
handleSearchSelect: a,
|
|
951
969
|
...c
|
|
952
970
|
}) {
|
|
953
|
-
const
|
|
971
|
+
const i = me(null), m = me(!1), [d, g] = P(!1), [p, f] = P(""), [k, S] = P(!1), B = ve(), [v, u] = P(!1), C = async (s) => {
|
|
954
972
|
u(!0);
|
|
955
|
-
const b = await B.get(
|
|
973
|
+
const b = await B.get(Ce(e, we(T.blockletsPath, s)));
|
|
956
974
|
return u(!1), b.dataList || [];
|
|
957
|
-
}, { data: x, run:
|
|
975
|
+
}, { data: x, run: F } = te(
|
|
958
976
|
(s) => s ? C({
|
|
959
977
|
sortBy: T.nameDesc,
|
|
960
978
|
page: 1,
|
|
@@ -967,22 +985,22 @@ function ar({
|
|
|
967
985
|
}
|
|
968
986
|
);
|
|
969
987
|
U(() => {
|
|
970
|
-
u(!0),
|
|
971
|
-
}, [n.keyword,
|
|
988
|
+
u(!0), F(n.keyword), f(n.keyword || "");
|
|
989
|
+
}, [n.keyword, F]), Ft(
|
|
972
990
|
"ctrl + k, command + k",
|
|
973
991
|
(s) => {
|
|
974
|
-
var b,
|
|
975
|
-
return s.stopPropagation(), s.preventDefault(), (
|
|
992
|
+
var b, D;
|
|
993
|
+
return s.stopPropagation(), s.preventDefault(), (D = (b = i.current) == null ? void 0 : b.querySelector("input")) == null || D.focus(), !1;
|
|
976
994
|
},
|
|
977
995
|
{ enableOnTags: ["INPUT"] }
|
|
978
996
|
);
|
|
979
|
-
const
|
|
980
|
-
let
|
|
981
|
-
return
|
|
982
|
-
/* @__PURE__ */ h(
|
|
997
|
+
const L = ze((s) => F(s), { wait: 300 }), E = { name: ce, title: p, did: "" };
|
|
998
|
+
let N = [];
|
|
999
|
+
return p && (v ? N = [E] : x != null && x.length ? N = [E, ...x] : N = [{ name: Pe, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ h(M, { children: [
|
|
1000
|
+
/* @__PURE__ */ h(Pt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
|
|
983
1001
|
/* @__PURE__ */ h(y, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
|
|
984
1002
|
/* @__PURE__ */ t(
|
|
985
|
-
|
|
1003
|
+
je,
|
|
986
1004
|
{
|
|
987
1005
|
fullWidth: !0,
|
|
988
1006
|
sx: {
|
|
@@ -1002,14 +1020,14 @@ function ar({
|
|
|
1002
1020
|
autoFocus: !0,
|
|
1003
1021
|
placeholder: r("common.searchStore"),
|
|
1004
1022
|
className: "bl-autocomplete-input",
|
|
1005
|
-
value:
|
|
1023
|
+
value: p,
|
|
1006
1024
|
onChange: (s) => V(s.target.value),
|
|
1007
1025
|
startAdornment: $(k),
|
|
1008
1026
|
endAdornment: q()
|
|
1009
1027
|
}
|
|
1010
1028
|
),
|
|
1011
1029
|
/* @__PURE__ */ t(
|
|
1012
|
-
|
|
1030
|
+
re,
|
|
1013
1031
|
{
|
|
1014
1032
|
variant: "outlined",
|
|
1015
1033
|
onClick: () => {
|
|
@@ -1019,7 +1037,7 @@ function ar({
|
|
|
1019
1037
|
}
|
|
1020
1038
|
)
|
|
1021
1039
|
] }),
|
|
1022
|
-
/* @__PURE__ */ t(
|
|
1040
|
+
/* @__PURE__ */ t(We, { sx: { p: 0.5 }, children: N.map((s) => X(s)) })
|
|
1023
1041
|
] }),
|
|
1024
1042
|
/* @__PURE__ */ t(
|
|
1025
1043
|
J,
|
|
@@ -1029,17 +1047,17 @@ function ar({
|
|
|
1029
1047
|
}
|
|
1030
1048
|
),
|
|
1031
1049
|
/* @__PURE__ */ t(
|
|
1032
|
-
|
|
1050
|
+
Tt,
|
|
1033
1051
|
{
|
|
1034
|
-
ref:
|
|
1035
|
-
open: !!
|
|
1052
|
+
ref: i,
|
|
1053
|
+
open: !!p && d,
|
|
1036
1054
|
size: "small",
|
|
1037
1055
|
onOpen: () => g(!0),
|
|
1038
1056
|
onClose: (s, b) => {
|
|
1039
|
-
g(!1), b === "selectOption" && !
|
|
1057
|
+
g(!1), b === "selectOption" && !m.current && l(p);
|
|
1040
1058
|
},
|
|
1041
1059
|
disableClearable: !0,
|
|
1042
|
-
inputValue:
|
|
1060
|
+
inputValue: p,
|
|
1043
1061
|
onInputChange: (s, b) => V(b),
|
|
1044
1062
|
isOptionEqualToValue: (s, b) => s.name === b.name,
|
|
1045
1063
|
getOptionLabel: (s) => s.title,
|
|
@@ -1058,7 +1076,7 @@ function ar({
|
|
|
1058
1076
|
}
|
|
1059
1077
|
},
|
|
1060
1078
|
renderInput: (s) => /* @__PURE__ */ t(
|
|
1061
|
-
|
|
1079
|
+
At,
|
|
1062
1080
|
{
|
|
1063
1081
|
...s,
|
|
1064
1082
|
InputProps: {
|
|
@@ -1066,7 +1084,7 @@ function ar({
|
|
|
1066
1084
|
autoFocus: !0,
|
|
1067
1085
|
placeholder: r("common.searchStore"),
|
|
1068
1086
|
className: "bl-autocomplete-input",
|
|
1069
|
-
value:
|
|
1087
|
+
value: p,
|
|
1070
1088
|
startAdornment: $(d),
|
|
1071
1089
|
endAdornment: q()
|
|
1072
1090
|
}
|
|
@@ -1074,9 +1092,9 @@ function ar({
|
|
|
1074
1092
|
),
|
|
1075
1093
|
filterOptions: (s) => s,
|
|
1076
1094
|
...c,
|
|
1077
|
-
options:
|
|
1095
|
+
options: N,
|
|
1078
1096
|
renderOption: (s, b) => X(b),
|
|
1079
|
-
value:
|
|
1097
|
+
value: E,
|
|
1080
1098
|
sx: [
|
|
1081
1099
|
{
|
|
1082
1100
|
bgcolor: "#F9FAFB",
|
|
@@ -1097,26 +1115,26 @@ function ar({
|
|
|
1097
1115
|
)
|
|
1098
1116
|
] });
|
|
1099
1117
|
function V(s) {
|
|
1100
|
-
u(!0), f(s),
|
|
1118
|
+
u(!0), f(s), m.current = !1, L.run(s);
|
|
1101
1119
|
}
|
|
1102
1120
|
function G() {
|
|
1103
|
-
S(!1), f(""), V(""),
|
|
1121
|
+
S(!1), f(""), V(""), l("");
|
|
1104
1122
|
}
|
|
1105
|
-
function
|
|
1106
|
-
s != null && s.did ? (S(!1),
|
|
1123
|
+
function ne(s) {
|
|
1124
|
+
s != null && s.did ? (S(!1), m.current = !0, f(""), a(s)) : s.name === ce && (S(!1), l(p));
|
|
1107
1125
|
}
|
|
1108
1126
|
function X(s) {
|
|
1109
|
-
var b,
|
|
1127
|
+
var b, D;
|
|
1110
1128
|
return /* @__PURE__ */ h(
|
|
1111
|
-
|
|
1129
|
+
De,
|
|
1112
1130
|
{
|
|
1113
1131
|
sx: { display: "flex", alignItems: "center", gap: 1, p: 1.5, borderRadius: "8px" },
|
|
1114
|
-
onClick: () =>
|
|
1132
|
+
onClick: () => ne(s),
|
|
1115
1133
|
children: [
|
|
1116
1134
|
Q(s),
|
|
1117
1135
|
/* @__PURE__ */ h(w, { variant: "body1", children: [
|
|
1118
1136
|
/* @__PURE__ */ t(w, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: s.title }),
|
|
1119
|
-
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((
|
|
1137
|
+
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((D = (b = s.category) == null ? void 0 : b.locales) == null ? void 0 : D[o || "en"]) || "" })
|
|
1120
1138
|
] })
|
|
1121
1139
|
]
|
|
1122
1140
|
},
|
|
@@ -1124,11 +1142,11 @@ function ar({
|
|
|
1124
1142
|
);
|
|
1125
1143
|
}
|
|
1126
1144
|
function Q(s) {
|
|
1127
|
-
if ([
|
|
1145
|
+
if ([ce, Pe].includes(s.name))
|
|
1128
1146
|
return /* @__PURE__ */ t(
|
|
1129
1147
|
y,
|
|
1130
1148
|
{
|
|
1131
|
-
width:
|
|
1149
|
+
width: de,
|
|
1132
1150
|
p: "6px",
|
|
1133
1151
|
display: "flex",
|
|
1134
1152
|
justifyContent: "center",
|
|
@@ -1140,21 +1158,21 @@ function ar({
|
|
|
1140
1158
|
}
|
|
1141
1159
|
);
|
|
1142
1160
|
let b = "";
|
|
1143
|
-
return s.logo && (b =
|
|
1161
|
+
return s.logo && (b = Ce(e, "assets", s.did, Ve(s.logo, de, s.version))), /* @__PURE__ */ t($e, { src: b, size: de, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1144
1162
|
}
|
|
1145
1163
|
function $(s = !0) {
|
|
1146
|
-
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s &&
|
|
1164
|
+
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s && p && v ? /* @__PURE__ */ t(oe, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 16, cursor: "default" } }) });
|
|
1147
1165
|
}
|
|
1148
1166
|
function q() {
|
|
1149
|
-
return
|
|
1167
|
+
return p ? /* @__PURE__ */ t(y, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(ye, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => G() }) }) : null;
|
|
1150
1168
|
}
|
|
1151
1169
|
}
|
|
1152
1170
|
function sr({ placeholder: e = "Type to search...", ...r }) {
|
|
1153
|
-
const { search: o } = I(), { filters: n, handleKeyword:
|
|
1154
|
-
const { value:
|
|
1155
|
-
c(
|
|
1171
|
+
const { search: o } = I(), { filters: n, handleKeyword: l } = o, [a, c] = P(n.keyword || ""), i = ze(l, { wait: 300 }), m = (g) => {
|
|
1172
|
+
const { value: p } = g.target;
|
|
1173
|
+
c(p), i.run(p);
|
|
1156
1174
|
}, d = () => {
|
|
1157
|
-
c(""),
|
|
1175
|
+
c(""), l("");
|
|
1158
1176
|
};
|
|
1159
1177
|
return U(() => {
|
|
1160
1178
|
c(n.keyword || "");
|
|
@@ -1164,18 +1182,18 @@ function sr({ placeholder: e = "Type to search...", ...r }) {
|
|
|
1164
1182
|
inputProps: {
|
|
1165
1183
|
"data-cy": "search-blocklet"
|
|
1166
1184
|
},
|
|
1167
|
-
startAdornment: /* @__PURE__ */ t(
|
|
1168
|
-
onChange:
|
|
1185
|
+
startAdornment: /* @__PURE__ */ t(Re, { position: "start", children: /* @__PURE__ */ t(dr, {}) }),
|
|
1186
|
+
onChange: m,
|
|
1169
1187
|
placeholder: e,
|
|
1170
1188
|
value: a,
|
|
1171
1189
|
title: e,
|
|
1172
1190
|
"data-cy": "search",
|
|
1173
|
-
endAdornment: a && /* @__PURE__ */ t(
|
|
1191
|
+
endAdornment: a && /* @__PURE__ */ t(Re, { position: "end", children: /* @__PURE__ */ t(ur, { "data-cy": "search-delete", onClick: d }) }),
|
|
1174
1192
|
...r
|
|
1175
1193
|
}
|
|
1176
1194
|
);
|
|
1177
1195
|
}
|
|
1178
|
-
const cr = K(
|
|
1196
|
+
const cr = K(je)`
|
|
1179
1197
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1180
1198
|
font-size: 14px;
|
|
1181
1199
|
border-radius: 6px;
|
|
@@ -1198,15 +1216,15 @@ const cr = K(We)`
|
|
|
1198
1216
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1199
1217
|
font-size: 24px;
|
|
1200
1218
|
}
|
|
1201
|
-
`, ur = K(
|
|
1219
|
+
`, ur = K(ye)`
|
|
1202
1220
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1203
1221
|
font-size: 16px;
|
|
1204
1222
|
cursor: pointer;
|
|
1205
1223
|
`;
|
|
1206
1224
|
function hr() {
|
|
1207
|
-
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale:
|
|
1225
|
+
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: l, developerName: a, showResourcesSwitch: c, layout: i, baseSearch: m } = I(), { filters: d, handleSort: g, handlePrice: p, handleDeveloper: f, handleSwitchShowResources: k, cleanFilter: S } = e, B = Ue(r);
|
|
1208
1226
|
return /* @__PURE__ */ h(
|
|
1209
|
-
|
|
1227
|
+
A,
|
|
1210
1228
|
{
|
|
1211
1229
|
className: "filter-bar",
|
|
1212
1230
|
direction: { xs: "column", md: "row" },
|
|
@@ -1218,9 +1236,9 @@ function hr() {
|
|
|
1218
1236
|
px: 0,
|
|
1219
1237
|
pb: 3,
|
|
1220
1238
|
children: [
|
|
1221
|
-
/* @__PURE__ */ t(w, { variant: "h2", textTransform: "capitalize", children:
|
|
1239
|
+
/* @__PURE__ */ t(w, { variant: "h2", textTransform: "capitalize", children: l(d.category) }),
|
|
1222
1240
|
/* @__PURE__ */ h(
|
|
1223
|
-
|
|
1241
|
+
A,
|
|
1224
1242
|
{
|
|
1225
1243
|
flex: 1,
|
|
1226
1244
|
direction: "row",
|
|
@@ -1229,7 +1247,7 @@ function hr() {
|
|
|
1229
1247
|
justifyContent: { xs: "space-between", md: "flex-end" },
|
|
1230
1248
|
gap: 2,
|
|
1231
1249
|
children: [
|
|
1232
|
-
|
|
1250
|
+
i.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: m ? /* @__PURE__ */ t(sr, {}) : /* @__PURE__ */ t(
|
|
1233
1251
|
ar,
|
|
1234
1252
|
{
|
|
1235
1253
|
locale: n,
|
|
@@ -1247,7 +1265,7 @@ function hr() {
|
|
|
1247
1265
|
}
|
|
1248
1266
|
) }) : null,
|
|
1249
1267
|
d.owner && a && /* @__PURE__ */ t(
|
|
1250
|
-
|
|
1268
|
+
Be,
|
|
1251
1269
|
{
|
|
1252
1270
|
label: r("blocklet.authorTag", { name: a }),
|
|
1253
1271
|
size: "small",
|
|
@@ -1255,7 +1273,7 @@ function hr() {
|
|
|
1255
1273
|
}
|
|
1256
1274
|
),
|
|
1257
1275
|
d.resourceDid && d.resourceBlocklet && /* @__PURE__ */ t(
|
|
1258
|
-
|
|
1276
|
+
Be,
|
|
1259
1277
|
{
|
|
1260
1278
|
label: r("blocklet.resourceTag", { name: d.resourceBlocklet }),
|
|
1261
1279
|
size: "small",
|
|
@@ -1263,7 +1281,7 @@ function hr() {
|
|
|
1263
1281
|
}
|
|
1264
1282
|
),
|
|
1265
1283
|
c ? /* @__PURE__ */ t(
|
|
1266
|
-
|
|
1284
|
+
Ae,
|
|
1267
1285
|
{
|
|
1268
1286
|
checked: d.showResources === "true",
|
|
1269
1287
|
onChange: (v) => k(v ? "true" : ""),
|
|
@@ -1271,15 +1289,15 @@ function hr() {
|
|
|
1271
1289
|
}
|
|
1272
1290
|
) : null,
|
|
1273
1291
|
/* @__PURE__ */ t(
|
|
1274
|
-
|
|
1292
|
+
Ae,
|
|
1275
1293
|
{
|
|
1276
1294
|
checked: d.price === "free",
|
|
1277
|
-
onChange: (v) =>
|
|
1295
|
+
onChange: (v) => p(v ? "free" : ""),
|
|
1278
1296
|
label: r("blocklet.free")
|
|
1279
1297
|
}
|
|
1280
1298
|
),
|
|
1281
1299
|
/* @__PURE__ */ t(
|
|
1282
|
-
|
|
1300
|
+
Qe,
|
|
1283
1301
|
{
|
|
1284
1302
|
value: d.sortBy || B[0].value,
|
|
1285
1303
|
options: B,
|
|
@@ -1294,17 +1312,17 @@ function hr() {
|
|
|
1294
1312
|
}
|
|
1295
1313
|
);
|
|
1296
1314
|
}
|
|
1297
|
-
function
|
|
1315
|
+
function Ae({
|
|
1298
1316
|
checked: e,
|
|
1299
1317
|
onChange: r,
|
|
1300
1318
|
label: o
|
|
1301
1319
|
}) {
|
|
1302
1320
|
return /* @__PURE__ */ t(
|
|
1303
|
-
|
|
1321
|
+
Ne,
|
|
1304
1322
|
{
|
|
1305
1323
|
sx: { m: 0 },
|
|
1306
1324
|
control: /* @__PURE__ */ t(
|
|
1307
|
-
|
|
1325
|
+
Me,
|
|
1308
1326
|
{
|
|
1309
1327
|
checked: e,
|
|
1310
1328
|
size: "small",
|
|
@@ -1318,24 +1336,24 @@ function Te({
|
|
|
1318
1336
|
}
|
|
1319
1337
|
function Z({ children: e }) {
|
|
1320
1338
|
return /* @__PURE__ */ h(y, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
|
|
1321
|
-
/* @__PURE__ */ t(
|
|
1339
|
+
/* @__PURE__ */ t(Lt, {}),
|
|
1322
1340
|
e
|
|
1323
1341
|
] });
|
|
1324
1342
|
}
|
|
1325
|
-
function
|
|
1343
|
+
function Fe() {
|
|
1326
1344
|
const { t: e } = I();
|
|
1327
1345
|
return /* @__PURE__ */ t(w, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
1328
1346
|
}
|
|
1329
|
-
function
|
|
1330
|
-
const { t: o, locale: n } = I(),
|
|
1347
|
+
function ue({ filterTip: e, keywordTip: r }) {
|
|
1348
|
+
const { t: o, locale: n } = I(), l = () => n === "zh" ? "、" : " , ";
|
|
1331
1349
|
return /* @__PURE__ */ h(y, { mt: 1, display: "flex", children: [
|
|
1332
1350
|
/* @__PURE__ */ t(w, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1333
1351
|
e && /* @__PURE__ */ t(w, { children: o("blocklet.filterTip") }),
|
|
1334
|
-
e && r &&
|
|
1352
|
+
e && r && l(),
|
|
1335
1353
|
r && /* @__PURE__ */ t(w, { children: o("blocklet.keywordTip") })
|
|
1336
1354
|
] });
|
|
1337
1355
|
}
|
|
1338
|
-
function
|
|
1356
|
+
function he({
|
|
1339
1357
|
primaryStart: e,
|
|
1340
1358
|
primaryEnd: r,
|
|
1341
1359
|
filter: o
|
|
@@ -1350,51 +1368,51 @@ function ue({
|
|
|
1350
1368
|
] });
|
|
1351
1369
|
}
|
|
1352
1370
|
function pr() {
|
|
1353
|
-
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters:
|
|
1354
|
-
if (
|
|
1371
|
+
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: l } = r, a = !!n || !!l.price;
|
|
1372
|
+
if (l.keyword && a)
|
|
1355
1373
|
return /* @__PURE__ */ h(Z, { children: [
|
|
1356
1374
|
/* @__PURE__ */ t(
|
|
1357
|
-
|
|
1375
|
+
he,
|
|
1358
1376
|
{
|
|
1359
1377
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1360
1378
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1361
|
-
filter:
|
|
1379
|
+
filter: l.keyword
|
|
1362
1380
|
}
|
|
1363
1381
|
),
|
|
1364
|
-
/* @__PURE__ */ t(
|
|
1382
|
+
/* @__PURE__ */ t(ue, { keywordTip: !0, filterTip: !0 })
|
|
1365
1383
|
] });
|
|
1366
|
-
if (
|
|
1384
|
+
if (l.keyword)
|
|
1367
1385
|
return /* @__PURE__ */ h(Z, { children: [
|
|
1368
1386
|
/* @__PURE__ */ t(
|
|
1369
|
-
|
|
1387
|
+
he,
|
|
1370
1388
|
{
|
|
1371
1389
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1372
1390
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1373
|
-
filter:
|
|
1391
|
+
filter: l.keyword
|
|
1374
1392
|
}
|
|
1375
1393
|
),
|
|
1376
|
-
/* @__PURE__ */ t(
|
|
1394
|
+
/* @__PURE__ */ t(ue, { keywordTip: !0 })
|
|
1377
1395
|
] });
|
|
1378
1396
|
if (a) {
|
|
1379
1397
|
const c = o(n);
|
|
1380
1398
|
return /* @__PURE__ */ h(Z, { children: [
|
|
1381
1399
|
c ? /* @__PURE__ */ t(
|
|
1382
|
-
|
|
1400
|
+
he,
|
|
1383
1401
|
{
|
|
1384
1402
|
primaryStart: e("blocklet.noCategoryResults1"),
|
|
1385
1403
|
primaryEnd: e("blocklet.noCategoryResults2"),
|
|
1386
1404
|
filter: c
|
|
1387
1405
|
}
|
|
1388
|
-
) : /* @__PURE__ */ t(
|
|
1389
|
-
/* @__PURE__ */ t(
|
|
1406
|
+
) : /* @__PURE__ */ t(Fe, {}),
|
|
1407
|
+
/* @__PURE__ */ t(ue, { filterTip: !0 })
|
|
1390
1408
|
] });
|
|
1391
1409
|
}
|
|
1392
|
-
return /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(
|
|
1410
|
+
return /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(Fe, {}) });
|
|
1393
1411
|
}
|
|
1394
|
-
const mr = (e, r, o, n) =>
|
|
1395
|
-
async (
|
|
1396
|
-
|
|
1397
|
-
const { currentPage: a, pageSize: c } = o,
|
|
1412
|
+
const mr = (e, r, o, n) => at(
|
|
1413
|
+
async (l) => {
|
|
1414
|
+
l || (o.currentPage = o.defaultCurrentPage);
|
|
1415
|
+
const { currentPage: a, pageSize: c } = o, i = {
|
|
1398
1416
|
...r,
|
|
1399
1417
|
category: r.category === "All" ? "" : r.category,
|
|
1400
1418
|
sortBy: T[r.sortBy],
|
|
@@ -1402,22 +1420,22 @@ const mr = (e, r, o, n) => lt(
|
|
|
1402
1420
|
pageSize: c
|
|
1403
1421
|
};
|
|
1404
1422
|
n(null);
|
|
1405
|
-
const { data:
|
|
1406
|
-
return o.currentPage++, { page: a, pageSize: c, list: (
|
|
1423
|
+
const { data: m = {} } = await e.get(T.blockletsPath, { params: i });
|
|
1424
|
+
return o.currentPage++, { page: a, pageSize: c, list: (m == null ? void 0 : m.dataList) || [], total: (m == null ? void 0 : m.total) || 0 };
|
|
1407
1425
|
},
|
|
1408
1426
|
{
|
|
1409
|
-
isNoMore: (
|
|
1427
|
+
isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
|
|
1410
1428
|
reloadDeps: [e, Et(r)],
|
|
1411
1429
|
onError: n
|
|
1412
1430
|
}
|
|
1413
1431
|
);
|
|
1414
1432
|
function fr() {
|
|
1415
|
-
var
|
|
1416
|
-
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName:
|
|
1433
|
+
var p;
|
|
1434
|
+
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: l } = I(), { filters: a } = r, c = st({
|
|
1417
1435
|
currentPage: T.currentPage,
|
|
1418
|
-
pageSize:
|
|
1436
|
+
pageSize: Ut() ? T.mobilePageSize : T.pageSize,
|
|
1419
1437
|
defaultCurrentPage: T.defaultCurrentPage
|
|
1420
|
-
}), [
|
|
1438
|
+
}), [i, m] = P(null), d = mr(e, a, c, m), g = H(
|
|
1421
1439
|
() => {
|
|
1422
1440
|
var f, k;
|
|
1423
1441
|
return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
|
|
@@ -1426,44 +1444,44 @@ function fr() {
|
|
|
1426
1444
|
);
|
|
1427
1445
|
return U(() => {
|
|
1428
1446
|
const f = g.find((k) => k.owner.did === a.owner);
|
|
1429
|
-
|
|
1430
|
-
}, [a.owner, g,
|
|
1447
|
+
l((f == null ? void 0 : f.owner.fullName) || (f == null ? void 0 : f.author.name) || "");
|
|
1448
|
+
}, [a.owner, g, l]), {
|
|
1431
1449
|
blocklets: g,
|
|
1432
|
-
fetchBlockletsError:
|
|
1450
|
+
fetchBlockletsError: i,
|
|
1433
1451
|
loadMore: d.loadMore,
|
|
1434
1452
|
hasNextPage: !d.noMore,
|
|
1435
|
-
total: ((
|
|
1453
|
+
total: ((p = d.data) == null ? void 0 : p.total) || 0,
|
|
1436
1454
|
loadings: {
|
|
1437
1455
|
fetchBlockletsLoading: d.loading,
|
|
1438
1456
|
loadingMore: d.loadingMore
|
|
1439
1457
|
},
|
|
1440
1458
|
errors: {
|
|
1441
1459
|
...n,
|
|
1442
|
-
fetchBlockletsError:
|
|
1460
|
+
fetchBlockletsError: i
|
|
1443
1461
|
}
|
|
1444
1462
|
};
|
|
1445
1463
|
}
|
|
1446
1464
|
function gr() {
|
|
1447
|
-
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion:
|
|
1465
|
+
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: l, minItemWidth: a, layout: c, baseSearch: i } = I(), { filters: m } = r, { blocklets: d, errors: g, loadMore: p, loadings: f, hasNextPage: k, total: S } = fr(), [B] = Rt({
|
|
1448
1466
|
loading: f.fetchBlockletsLoading || f.loadingMore,
|
|
1449
1467
|
hasNextPage: k,
|
|
1450
|
-
onLoadMore:
|
|
1468
|
+
onLoadMore: p
|
|
1451
1469
|
});
|
|
1452
1470
|
if (g.fetchBlockletsError) {
|
|
1453
1471
|
const x = new Error(`Failed to fetch blocklets from ${o}: ${g.fetchBlockletsError.message}`);
|
|
1454
|
-
return /* @__PURE__ */ t(
|
|
1472
|
+
return /* @__PURE__ */ t(xe, { error: x });
|
|
1455
1473
|
}
|
|
1456
|
-
const v =
|
|
1457
|
-
return /* @__PURE__ */ h(
|
|
1458
|
-
v ? /* @__PURE__ */ t(hr, {}) : /* @__PURE__ */ h(
|
|
1459
|
-
/* @__PURE__ */ t(
|
|
1474
|
+
const v = i && c.showSearch || !m.keyword;
|
|
1475
|
+
return /* @__PURE__ */ h(M, { children: [
|
|
1476
|
+
v ? /* @__PURE__ */ t(hr, {}) : /* @__PURE__ */ h(M, { children: [
|
|
1477
|
+
/* @__PURE__ */ t(ke, { xs: /* @__PURE__ */ t(Ye, {}), md: null }),
|
|
1460
1478
|
C()
|
|
1461
1479
|
] }),
|
|
1462
1480
|
u(),
|
|
1463
|
-
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(y, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: B, children: /* @__PURE__ */ t(
|
|
1481
|
+
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(y, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: B, children: /* @__PURE__ */ t(oe, {}) })
|
|
1464
1482
|
] });
|
|
1465
1483
|
function u() {
|
|
1466
|
-
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(
|
|
1484
|
+
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(Ze, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
|
|
1467
1485
|
y,
|
|
1468
1486
|
{
|
|
1469
1487
|
className: "blocklet-list",
|
|
@@ -1471,13 +1489,13 @@ function gr() {
|
|
|
1471
1489
|
gridTemplateColumns: `repeat(auto-fill, minmax(${a}px, 1fr))`,
|
|
1472
1490
|
p: "2px",
|
|
1473
1491
|
gap: 2,
|
|
1474
|
-
children: d.map((x) => /* @__PURE__ */ t(y, { "data-blocklet-did": x.did, sx: { minWidth: a }, children: n({ blocklet: x, blocklets: d, serverVersion:
|
|
1492
|
+
children: d.map((x) => /* @__PURE__ */ t(y, { "data-blocklet-did": x.did, sx: { minWidth: a }, children: n({ blocklet: x, blocklets: d, serverVersion: l }) }, x.did))
|
|
1475
1493
|
}
|
|
1476
1494
|
) : /* @__PURE__ */ t(pr, {});
|
|
1477
1495
|
}
|
|
1478
1496
|
function C() {
|
|
1479
1497
|
return /* @__PURE__ */ h(
|
|
1480
|
-
|
|
1498
|
+
A,
|
|
1481
1499
|
{
|
|
1482
1500
|
direction: "row",
|
|
1483
1501
|
className: "search-result-title",
|
|
@@ -1486,7 +1504,7 @@ function gr() {
|
|
|
1486
1504
|
mb: 2,
|
|
1487
1505
|
mt: { xs: 2, md: 0 },
|
|
1488
1506
|
children: [
|
|
1489
|
-
/* @__PURE__ */ t(w, { variant: "h3", children: e("blocklet.search", { keyword:
|
|
1507
|
+
/* @__PURE__ */ t(w, { variant: "h3", children: e("blocklet.search", { keyword: m.keyword }) }),
|
|
1490
1508
|
/* @__PURE__ */ t(w, { variant: "body1", color: "text.lighter", fontSize: 13, children: e("blocklet.resultCount", { count: S }) })
|
|
1491
1509
|
]
|
|
1492
1510
|
}
|
|
@@ -1494,7 +1512,7 @@ function gr() {
|
|
|
1494
1512
|
}
|
|
1495
1513
|
}
|
|
1496
1514
|
function xr() {
|
|
1497
|
-
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } =
|
|
1515
|
+
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = be();
|
|
1498
1516
|
return /* @__PURE__ */ h(
|
|
1499
1517
|
w,
|
|
1500
1518
|
{
|
|
@@ -1505,7 +1523,7 @@ function xr() {
|
|
|
1505
1523
|
py: 2,
|
|
1506
1524
|
fontWeight: "fontWeightMedium",
|
|
1507
1525
|
children: [
|
|
1508
|
-
/* @__PURE__ */ t(
|
|
1526
|
+
/* @__PURE__ */ t(Xe, { onClick: () => n(!0), children: /* @__PURE__ */ t(Ot, {}) }),
|
|
1509
1527
|
o(r) || e("common.category")
|
|
1510
1528
|
]
|
|
1511
1529
|
}
|
|
@@ -1513,16 +1531,16 @@ function xr() {
|
|
|
1513
1531
|
}
|
|
1514
1532
|
function yr() {
|
|
1515
1533
|
const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
|
|
1516
|
-
return /* @__PURE__ */ t(
|
|
1534
|
+
return /* @__PURE__ */ t(Mt, { children: /* @__PURE__ */ h(rt, { FallbackComponent: xe, children: [
|
|
1517
1535
|
/* @__PURE__ */ t(xr, {}),
|
|
1518
1536
|
/* @__PURE__ */ h(y, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1519
|
-
/* @__PURE__ */ t(
|
|
1520
|
-
/* @__PURE__ */ t(
|
|
1537
|
+
/* @__PURE__ */ t(er, {}),
|
|
1538
|
+
/* @__PURE__ */ t(A, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(lr, {}) : /* @__PURE__ */ t(gr, {}) })
|
|
1521
1539
|
] })
|
|
1522
1540
|
] }) });
|
|
1523
1541
|
}
|
|
1524
1542
|
function To(e) {
|
|
1525
|
-
return /* @__PURE__ */ h(
|
|
1543
|
+
return /* @__PURE__ */ h(_t, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
|
|
1526
1544
|
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, pb: 1, children: [
|
|
1527
1545
|
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, flex: 1, children: [
|
|
1528
1546
|
/* @__PURE__ */ t(O, { variant: "rounded", width: 48, height: 48 }),
|
|
@@ -1540,9 +1558,12 @@ function To(e) {
|
|
|
1540
1558
|
] })
|
|
1541
1559
|
] });
|
|
1542
1560
|
}
|
|
1543
|
-
function Po(e) {
|
|
1544
|
-
|
|
1545
|
-
|
|
1561
|
+
function Po({ showSkeleton: e, ...r }) {
|
|
1562
|
+
return e ? /* @__PURE__ */ t(_, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(zt, { ...r });
|
|
1563
|
+
}
|
|
1564
|
+
function Ao(e) {
|
|
1565
|
+
const r = ge(), o = Je(
|
|
1566
|
+
tt({
|
|
1546
1567
|
...r,
|
|
1547
1568
|
typography: {
|
|
1548
1569
|
h1: {
|
|
@@ -1570,12 +1591,12 @@ function Po(e) {
|
|
|
1570
1591
|
}
|
|
1571
1592
|
})
|
|
1572
1593
|
);
|
|
1573
|
-
return /* @__PURE__ */ t(
|
|
1594
|
+
return /* @__PURE__ */ t(et, { theme: o, children: /* @__PURE__ */ t(Xt, { ...e, children: /* @__PURE__ */ t(yr, {}) }) });
|
|
1574
1595
|
}
|
|
1575
1596
|
export {
|
|
1576
1597
|
ar as Autocomplete,
|
|
1577
1598
|
To as CardSkeleton,
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1599
|
+
Po as Image,
|
|
1600
|
+
Ao as default,
|
|
1601
|
+
Dt as useSearch
|
|
1581
1602
|
};
|