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