@blocklet/list 0.17.23 → 0.17.24
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 +355 -331
- package/package.json +4 -4
package/lib/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as t, jsxs as p, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
-
import { styled as K, useTheme as
|
|
3
|
-
import { useTheme as Le, Box as ee, Card as rt, Skeleton as
|
|
2
|
+
import { styled as K, useTheme as we } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import { useTheme as Le, Box as ee, Card as rt, Skeleton as E, createTheme as ot, ThemeProvider as nt } from "@mui/material";
|
|
4
4
|
import { pick as it, omitBy as ae, orderBy as lt, isEmpty as at, merge as st } from "lodash-es";
|
|
5
|
-
import { ErrorFallback as
|
|
5
|
+
import { ErrorFallback as be } from "@arcblock/ux/lib/ErrorBoundary";
|
|
6
6
|
import g from "@mui/material/Box";
|
|
7
|
-
import
|
|
8
|
-
import { createContext as Me, useState as
|
|
7
|
+
import O from "@mui/material/Stack";
|
|
8
|
+
import { createContext as Me, useState as A, useMemo as H, useContext as ze, useCallback as ge, useEffect as U, useRef as te, memo as ct } from "react";
|
|
9
9
|
import { ErrorBoundary as dt } from "react-error-boundary";
|
|
10
10
|
import ut from "@iconify-icons/tabler/compass";
|
|
11
11
|
import { Icon as M } from "@iconify/react";
|
|
@@ -14,8 +14,8 @@ import k from "@mui/material/Typography";
|
|
|
14
14
|
import { createAxios as Fe } from "@blocklet/js-sdk";
|
|
15
15
|
import { useRequest as oe, useDebounceFn as Ne, useInfiniteScroll as ht, useReactive as pt } from "ahooks";
|
|
16
16
|
import "color";
|
|
17
|
-
import { parseURL as mt, parseQuery as ft, parseFilename as gt, stringifyParsedURL as xt, withQuery as
|
|
18
|
-
import
|
|
17
|
+
import { parseURL as mt, parseQuery as ft, parseFilename as gt, stringifyParsedURL as xt, withQuery as ke, joinURL as Ie } from "ufo";
|
|
18
|
+
import Be from "flat";
|
|
19
19
|
import ne from "@mui/material/Button";
|
|
20
20
|
import j from "@mui/material/useMediaQuery";
|
|
21
21
|
import yt from "@mui/material/Drawer";
|
|
@@ -38,11 +38,11 @@ import Pt from "@mui/icons-material/ChevronRight";
|
|
|
38
38
|
import L from "@mui/material/Skeleton";
|
|
39
39
|
import Tt from "react-image-gallery";
|
|
40
40
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
41
|
-
import
|
|
41
|
+
import Re from "@mui/material/Grid";
|
|
42
42
|
import At from "react-infinite-scroll-hook";
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
43
|
+
import Ot from "@iconify-icons/tabler/square";
|
|
44
|
+
import Et from "@iconify-icons/tabler/square-check-filled";
|
|
45
|
+
import Pe from "@mui/material/Chip";
|
|
46
46
|
import se from "@iconify-icons/tabler/search";
|
|
47
47
|
import Lt from "@iconify-icons/tabler/x";
|
|
48
48
|
import Mt from "@mui/material/Autocomplete";
|
|
@@ -51,7 +51,7 @@ import Ue from "@mui/material/OutlinedInput";
|
|
|
51
51
|
import _t from "@mui/material/TextField";
|
|
52
52
|
import { useHotkeys as Ft } from "react-hotkeys-hook";
|
|
53
53
|
import Nt from "@mui/icons-material/Search";
|
|
54
|
-
import
|
|
54
|
+
import Te from "@mui/material/InputAdornment";
|
|
55
55
|
import Dt from "@arcblock/ux/lib/Empty";
|
|
56
56
|
import Wt from "json-stable-stringify";
|
|
57
57
|
import $t from "@mui/icons-material/Menu";
|
|
@@ -63,15 +63,15 @@ const Ve = Me({
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
function Ut({ children: e }) {
|
|
66
|
-
const [r, o] =
|
|
66
|
+
const [r, o] = A(!1), i = (a) => {
|
|
67
67
|
o(a ?? !a);
|
|
68
|
-
},
|
|
69
|
-
return /* @__PURE__ */ t(Ve.Provider, { value:
|
|
68
|
+
}, l = H(() => ({ open: r, toggleOpen: i }), [r]);
|
|
69
|
+
return /* @__PURE__ */ t(Ve.Provider, { value: l, children: e });
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function ve() {
|
|
72
72
|
return ze(Ve);
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const T = {
|
|
75
75
|
nameAsc: "title",
|
|
76
76
|
nameDesc: "title",
|
|
77
77
|
popularity: "stats.downloads",
|
|
@@ -87,7 +87,7 @@ const P = {
|
|
|
87
87
|
cacheSize: 100
|
|
88
88
|
}, Vt = (e) => oe(
|
|
89
89
|
async () => {
|
|
90
|
-
const { data: r } = await e.get(
|
|
90
|
+
const { data: r } = await e.get(T.categoriesPath);
|
|
91
91
|
return Array.isArray(r) ? r : [];
|
|
92
92
|
},
|
|
93
93
|
{ manual: !0 }
|
|
@@ -105,49 +105,52 @@ function Gt(e, r) {
|
|
|
105
105
|
...e,
|
|
106
106
|
menu: void 0
|
|
107
107
|
}, {
|
|
108
|
-
onFilterChange:
|
|
109
|
-
onSearchSelect:
|
|
110
|
-
r.onFilterChange({ ...o, keyword:
|
|
108
|
+
onFilterChange: i,
|
|
109
|
+
onSearchSelect: l = (n) => {
|
|
110
|
+
r.onFilterChange({ ...o, keyword: n.title });
|
|
111
111
|
},
|
|
112
112
|
emptyCategory: a
|
|
113
113
|
} = r;
|
|
114
114
|
!o.category && !a && (o.category = "All");
|
|
115
|
-
const s = (
|
|
116
|
-
const m = { ...o, ...
|
|
117
|
-
|
|
115
|
+
const s = (n) => {
|
|
116
|
+
const m = { ...o, ...n };
|
|
117
|
+
i(ae(m, (h) => h === "" || h === void 0));
|
|
118
118
|
};
|
|
119
119
|
return {
|
|
120
120
|
filters: e,
|
|
121
|
-
cleanFilter: (
|
|
122
|
-
const m =
|
|
123
|
-
|
|
121
|
+
cleanFilter: (n) => {
|
|
122
|
+
const m = n ? ae(o, (h, f) => n.includes(f)) : {};
|
|
123
|
+
i(ae(m, (h) => h === "" || h === void 0));
|
|
124
|
+
},
|
|
125
|
+
handleActiveMenu: (n) => {
|
|
126
|
+
n !== e.menu && i({ menu: n });
|
|
124
127
|
},
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
handleSort: (n, m) => {
|
|
129
|
+
s({ sortBy: n, sortDirection: m || n === "nameAsc" ? "asc" : "desc" });
|
|
127
130
|
},
|
|
128
|
-
|
|
129
|
-
s({
|
|
131
|
+
handleKeyword: (n) => {
|
|
132
|
+
s({ category: void 0, keyword: n || void 0 });
|
|
130
133
|
},
|
|
131
|
-
|
|
132
|
-
s({
|
|
134
|
+
handlePrice: (n) => {
|
|
135
|
+
s({ price: n === e.price ? void 0 : n });
|
|
133
136
|
},
|
|
134
|
-
|
|
135
|
-
s({
|
|
137
|
+
handleCategory: (n) => {
|
|
138
|
+
s({ category: n === e.category ? "" : n });
|
|
136
139
|
},
|
|
137
|
-
|
|
138
|
-
s({
|
|
140
|
+
handleDeveloper: (n) => {
|
|
141
|
+
s({ owner: n || void 0 });
|
|
139
142
|
},
|
|
140
|
-
|
|
141
|
-
s({
|
|
143
|
+
handlePage: (n) => {
|
|
144
|
+
s({ currentPage: n });
|
|
142
145
|
},
|
|
143
|
-
|
|
144
|
-
s({
|
|
146
|
+
handleSwitchIsOfficial: (n) => {
|
|
147
|
+
s({ isOfficial: n === "true" ? "true" : "" });
|
|
145
148
|
},
|
|
146
|
-
handleSwitchShowResources: (
|
|
147
|
-
s({ showResources:
|
|
149
|
+
handleSwitchShowResources: (n) => {
|
|
150
|
+
s({ showResources: n });
|
|
148
151
|
},
|
|
149
|
-
handleSearchSelect: (
|
|
150
|
-
|
|
152
|
+
handleSearchSelect: (n) => {
|
|
153
|
+
l(n);
|
|
151
154
|
}
|
|
152
155
|
};
|
|
153
156
|
}
|
|
@@ -165,14 +168,14 @@ const qt = (e, r, o) => e && r || !o, Ge = (e) => [
|
|
|
165
168
|
// value: 'rating',
|
|
166
169
|
// },
|
|
167
170
|
], qe = (e, r, o) => {
|
|
168
|
-
const
|
|
171
|
+
const i = mt(e), l = ft(i.search);
|
|
169
172
|
if (gt(e, { strict: !0 })?.endsWith(".gif"))
|
|
170
|
-
return
|
|
171
|
-
if (
|
|
173
|
+
return l.imageFilter ? xt({ ...i, search: "" }) : e;
|
|
174
|
+
if (l.imageFilter)
|
|
172
175
|
return e;
|
|
173
|
-
const s = o || window.blocklet?.version, { w:
|
|
174
|
-
return
|
|
175
|
-
...
|
|
176
|
+
const s = o || window.blocklet?.version, { w: n, h: m } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
177
|
+
return ke(e, {
|
|
178
|
+
...n || m ? { imageFilter: "resize", w: n, h: m } : {},
|
|
176
179
|
v: s
|
|
177
180
|
});
|
|
178
181
|
}, Kt = (e) => [
|
|
@@ -181,12 +184,13 @@ const qt = (e, r, o) => e && r || !o, Ge = (e) => [
|
|
|
181
184
|
], Xt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Qt = (e) => Array.isArray(e) ? e.map((r) => r.message).join(`
|
|
182
185
|
`) : e.response?.data?.error ? e.response.data.error.message || e.response.data.error : e.message || e, Yt = (e, r) => (
|
|
183
186
|
// eslint-disable-next-line no-prototype-builtins
|
|
184
|
-
e?.replace(/{(\w*)}/g, (o,
|
|
187
|
+
e?.replace(/{(\w*)}/g, (o, i) => r.hasOwnProperty(i) ? r[i] : "")
|
|
185
188
|
), Zt = () => window.innerWidth <= 600, Jt = {
|
|
186
189
|
common: {
|
|
187
190
|
title: "Blocklet Store",
|
|
188
191
|
searchStore: "Search Blocklet",
|
|
189
192
|
showResources: "Show extensions",
|
|
193
|
+
official: "Official Blocklets",
|
|
190
194
|
price: "Price",
|
|
191
195
|
category: "Category",
|
|
192
196
|
categories: "Categories",
|
|
@@ -239,6 +243,7 @@ const qt = (e, r, o) => e && r || !o, Ge = (e) => [
|
|
|
239
243
|
title: "Blocklet 商店",
|
|
240
244
|
searchStore: "搜索 Blocklet",
|
|
241
245
|
showResources: "显示扩展",
|
|
246
|
+
official: "官方 Blocklet",
|
|
242
247
|
price: "价格",
|
|
243
248
|
category: "类别",
|
|
244
249
|
categories: "类别",
|
|
@@ -287,14 +292,14 @@ const qt = (e, r, o) => e && r || !o, Ge = (e) => [
|
|
|
287
292
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
288
293
|
}
|
|
289
294
|
}, ce = {
|
|
290
|
-
en:
|
|
291
|
-
zh:
|
|
295
|
+
en: Be(Jt),
|
|
296
|
+
zh: Be(er)
|
|
292
297
|
}, Ke = (e, r) => {
|
|
293
298
|
const o = {};
|
|
294
299
|
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
295
300
|
}, tr = (e) => (r, o) => {
|
|
296
|
-
const
|
|
297
|
-
return Yt(
|
|
301
|
+
const i = ce[e] ? ce[e][r] : ce.en[r];
|
|
302
|
+
return Yt(i, o) || r;
|
|
298
303
|
}, Xe = {
|
|
299
304
|
errors: {
|
|
300
305
|
fetchCategoriesError: null
|
|
@@ -345,6 +350,8 @@ const qt = (e, r, o) => e && r || !o, Ge = (e) => [
|
|
|
345
350
|
},
|
|
346
351
|
handleSwitchShowResources: () => {
|
|
347
352
|
},
|
|
353
|
+
handleSwitchIsOfficial: () => {
|
|
354
|
+
},
|
|
348
355
|
handleSearchSelect: () => {
|
|
349
356
|
},
|
|
350
357
|
handlePage: () => {
|
|
@@ -355,16 +362,16 @@ function or(e) {
|
|
|
355
362
|
const {
|
|
356
363
|
locale: r = "zh",
|
|
357
364
|
filters: o = {},
|
|
358
|
-
serverVersion:
|
|
359
|
-
onFilterChange:
|
|
365
|
+
serverVersion: i = "",
|
|
366
|
+
onFilterChange: l = () => {
|
|
360
367
|
},
|
|
361
368
|
minItemWidth: a = 350,
|
|
362
369
|
queryFilter: s = !0,
|
|
363
|
-
layout:
|
|
364
|
-
wrapChildren: m = (
|
|
365
|
-
extraFilter: h = (
|
|
370
|
+
layout: n = {},
|
|
371
|
+
wrapChildren: m = (P) => P,
|
|
372
|
+
extraFilter: h = (P) => P,
|
|
366
373
|
baseSearch: f = !1,
|
|
367
|
-
fetchCategoryDelay:
|
|
374
|
+
fetchCategoryDelay: c = 0,
|
|
368
375
|
showResourcesSwitch: w = !1,
|
|
369
376
|
showCategory: y = !0,
|
|
370
377
|
tagFilters: S = [],
|
|
@@ -373,19 +380,19 @@ function or(e) {
|
|
|
373
380
|
onSearchSelect: b = () => {
|
|
374
381
|
},
|
|
375
382
|
endpoint: v,
|
|
376
|
-
blockletRender:
|
|
377
|
-
compact:
|
|
378
|
-
} = e, V = Ke(
|
|
383
|
+
blockletRender: B,
|
|
384
|
+
compact: C = !1
|
|
385
|
+
} = e, V = Ke(i, x), X = H(() => Fe({ baseURL: v, headers: V }), [v]), D = Gt(o, { onFilterChange: l, emptyCategory: !n.showExplore, onSearchSelect: b }), [F, G] = A(""), {
|
|
379
386
|
data: W = [],
|
|
380
387
|
error: le,
|
|
381
388
|
loading: Q,
|
|
382
389
|
run: Y
|
|
383
390
|
} = Vt(X), $ = H(() => {
|
|
384
|
-
const
|
|
385
|
-
return z > -1 ? [{ ...
|
|
386
|
-
}, [W]), q =
|
|
391
|
+
const P = lt(W, [(N) => N.name], ["asc"]), z = P.findIndex((N) => N.name === "All" || N.locales.en === "All");
|
|
392
|
+
return z > -1 ? [{ ...P[z], _id: "All" }, ...P.slice(0, z), ...P.slice(z + 1)] : P;
|
|
393
|
+
}, [W]), q = ge(tr(r), [r]), d = H(() => Xt($, r), [$, r]), R = Kt(q), tt = {
|
|
387
394
|
search: D,
|
|
388
|
-
compact:
|
|
395
|
+
compact: C,
|
|
389
396
|
errors: { fetchCategoriesError: le },
|
|
390
397
|
loadings: {
|
|
391
398
|
fetchCategoriesLoading: Q
|
|
@@ -394,31 +401,31 @@ function or(e) {
|
|
|
394
401
|
endpoint: v,
|
|
395
402
|
queryFilter: s,
|
|
396
403
|
layout: {
|
|
397
|
-
showExplore:
|
|
398
|
-
showCategory:
|
|
399
|
-
showTitle:
|
|
400
|
-
showSearch:
|
|
404
|
+
showExplore: n.showExplore ?? !1,
|
|
405
|
+
showCategory: n.showCategory ?? !0,
|
|
406
|
+
showTitle: n.showTitle ?? !0,
|
|
407
|
+
showSearch: n.showSearch ?? !0
|
|
401
408
|
},
|
|
402
409
|
minItemWidth: a,
|
|
403
410
|
wrapChildren: m,
|
|
404
411
|
t: q,
|
|
405
412
|
storeVersion: x,
|
|
406
|
-
serverVersion:
|
|
407
|
-
selectedCategory: D.filters.category || (
|
|
413
|
+
serverVersion: i,
|
|
414
|
+
selectedCategory: D.filters.category || (n.showExplore ? "" : "All"),
|
|
408
415
|
categoryList: $,
|
|
409
|
-
blockletRender:
|
|
416
|
+
blockletRender: B,
|
|
410
417
|
locale: r,
|
|
411
|
-
categoryOptions:
|
|
412
|
-
priceOptions:
|
|
418
|
+
categoryOptions: d,
|
|
419
|
+
priceOptions: R,
|
|
413
420
|
storeApi: X,
|
|
414
421
|
baseSearch: f,
|
|
415
422
|
showResourcesSwitch: w,
|
|
416
423
|
showCategory: y,
|
|
417
424
|
tagFilters: S,
|
|
418
|
-
onFilterChange:
|
|
419
|
-
getCategoryLocale: (
|
|
420
|
-
if (!
|
|
421
|
-
const z = W.find((N) => N._id ===
|
|
425
|
+
onFilterChange: l,
|
|
426
|
+
getCategoryLocale: (P) => {
|
|
427
|
+
if (!P) return null;
|
|
428
|
+
const z = W.find((N) => N._id === P || N.locales.en === "All");
|
|
422
429
|
return z ? z.locales[r] || z.locales.en : null;
|
|
423
430
|
},
|
|
424
431
|
get developerName() {
|
|
@@ -427,8 +434,8 @@ function or(e) {
|
|
|
427
434
|
updateDeveloperName: G
|
|
428
435
|
};
|
|
429
436
|
return U(() => {
|
|
430
|
-
setTimeout(Y,
|
|
431
|
-
}, [v, Y,
|
|
437
|
+
setTimeout(Y, c || 0);
|
|
438
|
+
}, [v, Y, c]), /* @__PURE__ */ t(rr, { value: tt, children: u });
|
|
432
439
|
}
|
|
433
440
|
function I() {
|
|
434
441
|
const e = ze(Qe);
|
|
@@ -438,12 +445,12 @@ function Ye({
|
|
|
438
445
|
children: e,
|
|
439
446
|
onClick: r,
|
|
440
447
|
size: o = 32,
|
|
441
|
-
...
|
|
448
|
+
...i
|
|
442
449
|
}) {
|
|
443
450
|
return /* @__PURE__ */ t(
|
|
444
451
|
ne,
|
|
445
452
|
{
|
|
446
|
-
...
|
|
453
|
+
...i,
|
|
447
454
|
onClick: r,
|
|
448
455
|
variant: "outlined",
|
|
449
456
|
sx: [
|
|
@@ -458,7 +465,7 @@ function Ye({
|
|
|
458
465
|
borderRadius: 2,
|
|
459
466
|
color: "text.secondary"
|
|
460
467
|
},
|
|
461
|
-
...Array.isArray(
|
|
468
|
+
...Array.isArray(i.sx) ? i.sx : [i.sx]
|
|
462
469
|
],
|
|
463
470
|
children: e
|
|
464
471
|
}
|
|
@@ -467,24 +474,24 @@ function Ye({
|
|
|
467
474
|
function Z(e, r) {
|
|
468
475
|
return e === void 0 ? r : e;
|
|
469
476
|
}
|
|
470
|
-
function
|
|
477
|
+
function Ce({
|
|
471
478
|
xs: e = void 0,
|
|
472
479
|
sm: r = void 0,
|
|
473
480
|
md: o = void 0,
|
|
474
|
-
lg:
|
|
475
|
-
xl:
|
|
481
|
+
lg: i = void 0,
|
|
482
|
+
xl: l = void 0,
|
|
476
483
|
exact: a = !1
|
|
477
484
|
}) {
|
|
478
|
-
const s = Le(),
|
|
485
|
+
const s = Le(), n = j(s.breakpoints.down("sm")), m = j(s.breakpoints.between("sm", "md")), h = j(s.breakpoints.between("md", "lg")), f = j(s.breakpoints.between("lg", "xl"));
|
|
479
486
|
if (a)
|
|
480
|
-
return
|
|
481
|
-
let
|
|
482
|
-
return
|
|
487
|
+
return n ? e || null : m ? r || null : h ? o || null : f ? i || null : l || null;
|
|
488
|
+
let c = e;
|
|
489
|
+
return n || (c = Z(r, c), m) || (c = Z(o, c), h) || (c = Z(i, c), f) ? c : Z(l, c);
|
|
483
490
|
}
|
|
484
491
|
function nr({ children: e }) {
|
|
485
|
-
const { open: r, toggleOpen: o } =
|
|
492
|
+
const { open: r, toggleOpen: o } = ve();
|
|
486
493
|
return /* @__PURE__ */ t(
|
|
487
|
-
|
|
494
|
+
Ce,
|
|
488
495
|
{
|
|
489
496
|
xs: /* @__PURE__ */ t(yt, { open: r, onClose: () => o(!1), children: e }),
|
|
490
497
|
md: /* @__PURE__ */ t(g, { children: e })
|
|
@@ -503,18 +510,18 @@ function ir({ loading: e = !1, disabled: r, ...o }) {
|
|
|
503
510
|
}
|
|
504
511
|
);
|
|
505
512
|
}
|
|
506
|
-
function
|
|
507
|
-
const a = te(null), s =
|
|
513
|
+
function xe({ value: e, options: r, onChange: o, placeholder: i = "", ...l }) {
|
|
514
|
+
const a = te(null), s = we(), [n, m] = A(!1), [h, f] = A(e !== null ? e : ""), c = j(s.breakpoints.down("sm"));
|
|
508
515
|
U(() => {
|
|
509
516
|
f(e !== null ? e : "");
|
|
510
517
|
}, [e]);
|
|
511
|
-
const w =
|
|
518
|
+
const w = ge(() => {
|
|
512
519
|
m(!1);
|
|
513
|
-
}, []), y =
|
|
520
|
+
}, []), y = ge(() => {
|
|
514
521
|
m(!0);
|
|
515
522
|
}, []);
|
|
516
523
|
function S(x) {
|
|
517
|
-
f(x.value), o(x.value),
|
|
524
|
+
f(x.value), o(x.value), c && w();
|
|
518
525
|
}
|
|
519
526
|
function u(x) {
|
|
520
527
|
return x === h;
|
|
@@ -529,19 +536,19 @@ function ge({ value: e, options: r, onChange: o, placeholder: n = "", ...i }) {
|
|
|
529
536
|
size: "medium",
|
|
530
537
|
className: ["my-select__selector", at(h) ? "" : "my-select__selector--active"].join(" "),
|
|
531
538
|
sx: { minWidth: { xs: "100px", md: "auto" }, color: "text.primary", borderRadius: "8px" },
|
|
532
|
-
...
|
|
539
|
+
...l,
|
|
533
540
|
children: [
|
|
534
|
-
r.find((x) => x.value === h)?.name ||
|
|
541
|
+
r.find((x) => x.value === h)?.name || i,
|
|
535
542
|
/* @__PURE__ */ t(It, { className: "my-select__arrowdown", component: bt, sx: { width: 18, height: 18 } })
|
|
536
543
|
]
|
|
537
544
|
}
|
|
538
545
|
),
|
|
539
|
-
/* @__PURE__ */ t(St, { open:
|
|
546
|
+
/* @__PURE__ */ t(St, { open: n, anchorEl: a.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: x, placement: b }) => /* @__PURE__ */ t(
|
|
540
547
|
vt,
|
|
541
548
|
{
|
|
542
549
|
...x,
|
|
543
550
|
style: { transformOrigin: b === "bottom" ? "center top" : "center bottom" },
|
|
544
|
-
children: /* @__PURE__ */ t(Ct, { children: /* @__PURE__ */ t(kt, { onClickAway: w, children: /* @__PURE__ */ t(ar, { autoFocusItem:
|
|
551
|
+
children: /* @__PURE__ */ t(Ct, { children: /* @__PURE__ */ t(kt, { onClickAway: w, children: /* @__PURE__ */ t(ar, { autoFocusItem: n, onMouseEnter: y, onMouseLeave: w, children: r.map((v) => /* @__PURE__ */ p($e, { onClick: () => S(v), sx: { fontSize: 14 }, children: [
|
|
545
552
|
/* @__PURE__ */ t(
|
|
546
553
|
wt,
|
|
547
554
|
{
|
|
@@ -596,9 +603,9 @@ const lr = K(ir)`
|
|
|
596
603
|
}
|
|
597
604
|
`;
|
|
598
605
|
function Ze() {
|
|
599
|
-
const { search: e, t: r } = I(), { filters: o, handleSort:
|
|
606
|
+
const { search: e, t: r } = I(), { filters: o, handleSort: i, handlePrice: l } = e, a = Ge(r);
|
|
600
607
|
return /* @__PURE__ */ p(
|
|
601
|
-
|
|
608
|
+
O,
|
|
602
609
|
{
|
|
603
610
|
direction: { xs: "row", md: "column" },
|
|
604
611
|
sx: {
|
|
@@ -617,18 +624,18 @@ function Ze() {
|
|
|
617
624
|
checked: o.price === "free",
|
|
618
625
|
size: "small",
|
|
619
626
|
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.hint" } },
|
|
620
|
-
onChange: (s) =>
|
|
627
|
+
onChange: (s) => l(s.target.checked ? "free" : "")
|
|
621
628
|
}
|
|
622
629
|
),
|
|
623
630
|
label: r("blocklet.free")
|
|
624
631
|
}
|
|
625
632
|
),
|
|
626
633
|
/* @__PURE__ */ t(
|
|
627
|
-
|
|
634
|
+
xe,
|
|
628
635
|
{
|
|
629
636
|
value: o.sortBy || a[0].value,
|
|
630
637
|
options: a,
|
|
631
|
-
onChange: (s) =>
|
|
638
|
+
onChange: (s) => i(s),
|
|
632
639
|
placeholder: r("sort.sort")
|
|
633
640
|
}
|
|
634
641
|
)
|
|
@@ -637,17 +644,17 @@ function Ze() {
|
|
|
637
644
|
);
|
|
638
645
|
}
|
|
639
646
|
function sr({ menus: e = [] }) {
|
|
640
|
-
const { selectedCategory: r, search: o, t:
|
|
647
|
+
const { selectedCategory: r, search: o, t: i, categoryOptions: l, loadings: a, layout: s, baseSearch: n, compact: m } = I(), { filters: h, handleActiveMenu: f, handleCategory: c, cleanFilter: w } = o, { toggleOpen: y } = ve();
|
|
641
648
|
U(() => {
|
|
642
649
|
y(!1);
|
|
643
650
|
}, [Object.values(h).join("")]);
|
|
644
|
-
const S = qt(
|
|
651
|
+
const S = qt(n, s.showSearch, h.keyword);
|
|
645
652
|
return s.showCategory && !m ? /* @__PURE__ */ p(nr, { children: [
|
|
646
653
|
/* @__PURE__ */ t(
|
|
647
|
-
|
|
654
|
+
Ce,
|
|
648
655
|
{
|
|
649
656
|
xs: /* @__PURE__ */ p(
|
|
650
|
-
|
|
657
|
+
O,
|
|
651
658
|
{
|
|
652
659
|
direction: "row",
|
|
653
660
|
justifyContent: "space-between",
|
|
@@ -659,7 +666,7 @@ function sr({ menus: e = [] }) {
|
|
|
659
666
|
borderColor: "divider",
|
|
660
667
|
children: [
|
|
661
668
|
/* @__PURE__ */ t(Ye, { onClick: () => y(!1), children: /* @__PURE__ */ t(_e, {}) }),
|
|
662
|
-
/* @__PURE__ */ t(k, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children:
|
|
669
|
+
/* @__PURE__ */ t(k, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: i("common.category") })
|
|
663
670
|
]
|
|
664
671
|
}
|
|
665
672
|
),
|
|
@@ -667,7 +674,7 @@ function sr({ menus: e = [] }) {
|
|
|
667
674
|
}
|
|
668
675
|
),
|
|
669
676
|
/* @__PURE__ */ t(
|
|
670
|
-
|
|
677
|
+
O,
|
|
671
678
|
{
|
|
672
679
|
visibility: a.fetchCategoriesLoading ? "hidden" : "visible",
|
|
673
680
|
width: { xs: 268, md: 200 },
|
|
@@ -688,7 +695,7 @@ function sr({ menus: e = [] }) {
|
|
|
688
695
|
onClick: () => {
|
|
689
696
|
y(!1), w();
|
|
690
697
|
},
|
|
691
|
-
children:
|
|
698
|
+
children: i("explore.title")
|
|
692
699
|
}
|
|
693
700
|
)
|
|
694
701
|
] }),
|
|
@@ -709,7 +716,7 @@ function sr({ menus: e = [] }) {
|
|
|
709
716
|
)
|
|
710
717
|
] }, u.key))
|
|
711
718
|
] }),
|
|
712
|
-
!!
|
|
719
|
+
!!l.length && /* @__PURE__ */ t(O, { gap: 2, children: l.map((u) => /* @__PURE__ */ t(
|
|
713
720
|
k,
|
|
714
721
|
{
|
|
715
722
|
variant: "body1",
|
|
@@ -719,7 +726,7 @@ function sr({ menus: e = [] }) {
|
|
|
719
726
|
color: r === u.value ? "text.primary" : "grey.400",
|
|
720
727
|
textTransform: "capitalize",
|
|
721
728
|
onClick: () => {
|
|
722
|
-
r === u.value ? w() :
|
|
729
|
+
r === u.value ? w() : c(u.value), y(!1);
|
|
723
730
|
},
|
|
724
731
|
children: u.name
|
|
725
732
|
},
|
|
@@ -730,19 +737,19 @@ function sr({ menus: e = [] }) {
|
|
|
730
737
|
)
|
|
731
738
|
] }) : null;
|
|
732
739
|
}
|
|
733
|
-
function
|
|
734
|
-
const { endpoint: e, serverVersion: r, storeVersion: o } = I(),
|
|
740
|
+
function Se() {
|
|
741
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), i = Ke(r, o), l = H(() => Fe({
|
|
735
742
|
baseURL: e,
|
|
736
|
-
headers:
|
|
743
|
+
headers: i
|
|
737
744
|
}), [e]);
|
|
738
745
|
return {
|
|
739
746
|
get: async (a) => {
|
|
740
|
-
const { data: s } = await
|
|
747
|
+
const { data: s } = await l.get(a);
|
|
741
748
|
return s;
|
|
742
749
|
},
|
|
743
750
|
post: async (a, s) => {
|
|
744
|
-
const { data:
|
|
745
|
-
return
|
|
751
|
+
const { data: n } = await l.post(a, s);
|
|
752
|
+
return n;
|
|
746
753
|
}
|
|
747
754
|
};
|
|
748
755
|
}
|
|
@@ -764,14 +771,14 @@ const Je = ct(function(r) {
|
|
|
764
771
|
}
|
|
765
772
|
);
|
|
766
773
|
});
|
|
767
|
-
function
|
|
774
|
+
function Ae({
|
|
768
775
|
icon: e = null,
|
|
769
776
|
children: r = null,
|
|
770
777
|
maxWidth: o = 100,
|
|
771
|
-
title:
|
|
778
|
+
title: i = ""
|
|
772
779
|
}) {
|
|
773
780
|
return (r === 0 || r) && /* @__PURE__ */ p(
|
|
774
|
-
|
|
781
|
+
O,
|
|
775
782
|
{
|
|
776
783
|
direction: "row",
|
|
777
784
|
sx: {
|
|
@@ -786,7 +793,7 @@ function Te({
|
|
|
786
793
|
k,
|
|
787
794
|
{
|
|
788
795
|
variant: "body2",
|
|
789
|
-
title:
|
|
796
|
+
title: i || (typeof r == "string" ? r : void 0),
|
|
790
797
|
sx: {
|
|
791
798
|
flex: 1,
|
|
792
799
|
overflow: "hidden",
|
|
@@ -800,19 +807,19 @@ function Te({
|
|
|
800
807
|
}
|
|
801
808
|
);
|
|
802
809
|
}
|
|
803
|
-
const cr = 16 / 9, de = 292,
|
|
810
|
+
const cr = 16 / 9, de = 292, ye = 189, re = 336;
|
|
804
811
|
function dr() {
|
|
805
|
-
const { t: e, search: r } = I(), { get: o } =
|
|
812
|
+
const { t: e, search: r } = I(), { get: o } = Se(), i = we(), l = j(i.breakpoints.down("md")), a = window.blocklet?.preferences?.homeBanner || [], {
|
|
806
813
|
data: s = [],
|
|
807
|
-
error:
|
|
814
|
+
error: n,
|
|
808
815
|
loading: m
|
|
809
816
|
} = oe(async () => {
|
|
810
817
|
const u = await o(
|
|
811
|
-
|
|
818
|
+
ke(T.blockletsPath, { didList: a.map((x) => x.did).join(",") })
|
|
812
819
|
);
|
|
813
820
|
return u?.dataList ? a.map((x) => u.dataList.find((b) => b.did === x.did)) : [];
|
|
814
821
|
});
|
|
815
|
-
|
|
822
|
+
n && console.error("Get Banner Blocklets error:", n);
|
|
816
823
|
const h = {
|
|
817
824
|
position: "absolute",
|
|
818
825
|
top: "50%",
|
|
@@ -821,7 +828,7 @@ function dr() {
|
|
|
821
828
|
cursor: "pointer",
|
|
822
829
|
color: "text.hint"
|
|
823
830
|
};
|
|
824
|
-
return !
|
|
831
|
+
return !n && a.length > 0 ? /* @__PURE__ */ p(_, { children: [
|
|
825
832
|
/* @__PURE__ */ t(
|
|
826
833
|
k,
|
|
827
834
|
{
|
|
@@ -857,7 +864,7 @@ function dr() {
|
|
|
857
864
|
justifyContent: "center"
|
|
858
865
|
},
|
|
859
866
|
children: [
|
|
860
|
-
/* @__PURE__ */ t(L, { variant: "rounded", height:
|
|
867
|
+
/* @__PURE__ */ t(L, { variant: "rounded", height: ye, width: re }),
|
|
861
868
|
/* @__PURE__ */ p(
|
|
862
869
|
g,
|
|
863
870
|
{
|
|
@@ -894,7 +901,7 @@ function dr() {
|
|
|
894
901
|
{
|
|
895
902
|
showNav: !0,
|
|
896
903
|
autoPlay: !0,
|
|
897
|
-
slideDuration:
|
|
904
|
+
slideDuration: l ? 500 : 1e3,
|
|
898
905
|
slideInterval: 5e3,
|
|
899
906
|
showPlayButton: !1,
|
|
900
907
|
showIndex: !1,
|
|
@@ -906,9 +913,9 @@ function dr() {
|
|
|
906
913
|
items: a.map((u, x) => ({
|
|
907
914
|
original: u.did,
|
|
908
915
|
renderItem: () => {
|
|
909
|
-
const b = s[x] || {}, v = u.cover || hr(u.did, b.screenshots?.[0]),
|
|
916
|
+
const b = s[x] || {}, v = u.cover || hr(u.did, b.screenshots?.[0]), B = qe(v, i.breakpoints.values.md * 2);
|
|
910
917
|
return /* @__PURE__ */ p(
|
|
911
|
-
|
|
918
|
+
O,
|
|
912
919
|
{
|
|
913
920
|
direction: { xs: "column", md: "row" },
|
|
914
921
|
onClick: () => r.handleSearchSelect(b),
|
|
@@ -927,7 +934,7 @@ function dr() {
|
|
|
927
934
|
left: 0,
|
|
928
935
|
right: 0,
|
|
929
936
|
bottom: 0,
|
|
930
|
-
backgroundImage: `url("${
|
|
937
|
+
backgroundImage: `url("${B}")`,
|
|
931
938
|
backgroundSize: "cover",
|
|
932
939
|
filter: "blur(50px)",
|
|
933
940
|
opacity: 0.15,
|
|
@@ -935,9 +942,9 @@ function dr() {
|
|
|
935
942
|
}
|
|
936
943
|
},
|
|
937
944
|
children: [
|
|
938
|
-
f(
|
|
945
|
+
f(B),
|
|
939
946
|
/* @__PURE__ */ p(
|
|
940
|
-
|
|
947
|
+
O,
|
|
941
948
|
{
|
|
942
949
|
sx: {
|
|
943
950
|
flex: 1,
|
|
@@ -952,7 +959,7 @@ function dr() {
|
|
|
952
959
|
flex: 1
|
|
953
960
|
},
|
|
954
961
|
children: [
|
|
955
|
-
|
|
962
|
+
c(u.name || b.title || u.name),
|
|
956
963
|
w(u.desc || b.description)
|
|
957
964
|
]
|
|
958
965
|
}
|
|
@@ -986,7 +993,7 @@ function dr() {
|
|
|
986
993
|
}
|
|
987
994
|
);
|
|
988
995
|
}
|
|
989
|
-
function
|
|
996
|
+
function c(u) {
|
|
990
997
|
return /* @__PURE__ */ t(
|
|
991
998
|
k,
|
|
992
999
|
{
|
|
@@ -1022,7 +1029,7 @@ function dr() {
|
|
|
1022
1029
|
);
|
|
1023
1030
|
}
|
|
1024
1031
|
function y(u, x = 0) {
|
|
1025
|
-
const { did: b, owner: v, stats:
|
|
1032
|
+
const { did: b, owner: v, stats: B } = u;
|
|
1026
1033
|
return /* @__PURE__ */ p(
|
|
1027
1034
|
g,
|
|
1028
1035
|
{
|
|
@@ -1033,8 +1040,8 @@ function dr() {
|
|
|
1033
1040
|
color: "text.secondary"
|
|
1034
1041
|
},
|
|
1035
1042
|
children: [
|
|
1036
|
-
/* @__PURE__ */ t(
|
|
1037
|
-
/* @__PURE__ */ t(
|
|
1043
|
+
/* @__PURE__ */ t(Ae, { icon: /* @__PURE__ */ t(He, { src: v.avatar, did: b, size: 20, variant: "circle" }), children: v.fullName }),
|
|
1044
|
+
/* @__PURE__ */ t(Ae, { icon: /* @__PURE__ */ t(M, { icon: Bt }), title: `${B.downloads + x}`, children: ur(B.downloads + x) })
|
|
1038
1045
|
]
|
|
1039
1046
|
}
|
|
1040
1047
|
);
|
|
@@ -1060,7 +1067,7 @@ function dr() {
|
|
|
1060
1067
|
}
|
|
1061
1068
|
const ur = (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`, hr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
1062
1069
|
function pr({ url: e }) {
|
|
1063
|
-
const [r, o] =
|
|
1070
|
+
const [r, o] = A(!0);
|
|
1064
1071
|
return /* @__PURE__ */ p(_, { children: [
|
|
1065
1072
|
r && /* @__PURE__ */ t(
|
|
1066
1073
|
L,
|
|
@@ -1068,7 +1075,7 @@ function pr({ url: e }) {
|
|
|
1068
1075
|
variant: "rectangular",
|
|
1069
1076
|
sx: {
|
|
1070
1077
|
width: { xs: "100%", md: re },
|
|
1071
|
-
height: { xs: "auto", md:
|
|
1078
|
+
height: { xs: "auto", md: ye }
|
|
1072
1079
|
}
|
|
1073
1080
|
}
|
|
1074
1081
|
),
|
|
@@ -1083,7 +1090,7 @@ function pr({ url: e }) {
|
|
|
1083
1090
|
sx: {
|
|
1084
1091
|
display: r ? "none" : "block",
|
|
1085
1092
|
width: { xs: "100%", md: re },
|
|
1086
|
-
height: { xs: "auto", md:
|
|
1093
|
+
height: { xs: "auto", md: ye },
|
|
1087
1094
|
borderRadius: 2,
|
|
1088
1095
|
border: 1,
|
|
1089
1096
|
borderColor: "divider",
|
|
@@ -1096,7 +1103,7 @@ function pr({ url: e }) {
|
|
|
1096
1103
|
] });
|
|
1097
1104
|
}
|
|
1098
1105
|
function mr({ title: e, blocklets: r }) {
|
|
1099
|
-
const { blockletRender: o, serverVersion:
|
|
1106
|
+
const { blockletRender: o, serverVersion: i } = I();
|
|
1100
1107
|
return /* @__PURE__ */ p(
|
|
1101
1108
|
g,
|
|
1102
1109
|
{
|
|
@@ -1106,7 +1113,7 @@ function mr({ title: e, blocklets: r }) {
|
|
|
1106
1113
|
children: [
|
|
1107
1114
|
/* @__PURE__ */ t(k, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
1108
1115
|
/* @__PURE__ */ t(
|
|
1109
|
-
|
|
1116
|
+
Re,
|
|
1110
1117
|
{
|
|
1111
1118
|
container: !0,
|
|
1112
1119
|
spacing: 2,
|
|
@@ -1114,10 +1121,10 @@ function mr({ title: e, blocklets: r }) {
|
|
|
1114
1121
|
boxSizing: "border-box",
|
|
1115
1122
|
maxWidth: "calc(100vw - 16px)"
|
|
1116
1123
|
},
|
|
1117
|
-
children: r.map((
|
|
1118
|
-
|
|
1124
|
+
children: r.map((l) => /* @__PURE__ */ t(
|
|
1125
|
+
Re,
|
|
1119
1126
|
{
|
|
1120
|
-
"data-blocklet-did":
|
|
1127
|
+
"data-blocklet-did": l.did,
|
|
1121
1128
|
sx: {
|
|
1122
1129
|
p: "2px"
|
|
1123
1130
|
},
|
|
@@ -1131,11 +1138,11 @@ function mr({ title: e, blocklets: r }) {
|
|
|
1131
1138
|
sx: {
|
|
1132
1139
|
padding: "1px"
|
|
1133
1140
|
},
|
|
1134
|
-
children: o({ blocklet:
|
|
1141
|
+
children: o({ blocklet: l, blocklets: r, serverVersion: i })
|
|
1135
1142
|
}
|
|
1136
1143
|
)
|
|
1137
1144
|
},
|
|
1138
|
-
|
|
1145
|
+
l.did
|
|
1139
1146
|
))
|
|
1140
1147
|
}
|
|
1141
1148
|
)
|
|
@@ -1144,41 +1151,41 @@ function mr({ title: e, blocklets: r }) {
|
|
|
1144
1151
|
);
|
|
1145
1152
|
}
|
|
1146
1153
|
function fr() {
|
|
1147
|
-
const { get: e } =
|
|
1154
|
+
const { get: e } = Se(), { t: r } = I(), {
|
|
1148
1155
|
data: o = [],
|
|
1149
|
-
error:
|
|
1150
|
-
loading:
|
|
1156
|
+
error: i,
|
|
1157
|
+
loading: l
|
|
1151
1158
|
} = oe(async () => {
|
|
1152
|
-
const a = await e(
|
|
1159
|
+
const a = await e(T.explorePath);
|
|
1153
1160
|
return Array.isArray(a) ? a : [];
|
|
1154
1161
|
});
|
|
1155
|
-
return
|
|
1162
|
+
return i ? /* @__PURE__ */ t(be, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : l ? /* @__PURE__ */ t(Je, { mt: 15 }) : /* @__PURE__ */ p(_, { children: [
|
|
1156
1163
|
/* @__PURE__ */ t(dr, {}),
|
|
1157
1164
|
o.map(
|
|
1158
1165
|
(a) => a.blocklets?.length > 0 ? /* @__PURE__ */ t(mr, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
1159
1166
|
)
|
|
1160
1167
|
] });
|
|
1161
1168
|
}
|
|
1162
|
-
const ue = "__FREE_TEXT__",
|
|
1169
|
+
const ue = "__FREE_TEXT__", Oe = "__NO_RESULT__", he = 40;
|
|
1163
1170
|
function et({
|
|
1164
1171
|
endpoint: e,
|
|
1165
1172
|
t: r,
|
|
1166
1173
|
locale: o,
|
|
1167
|
-
filters:
|
|
1168
|
-
handleKeyword:
|
|
1174
|
+
filters: i,
|
|
1175
|
+
handleKeyword: l,
|
|
1169
1176
|
handleSearchSelect: a,
|
|
1170
1177
|
...s
|
|
1171
1178
|
}) {
|
|
1172
|
-
const
|
|
1179
|
+
const n = te(null), m = te(!1), [h, f] = A(!1), [c, w] = A(""), [y, S] = A(!1), u = Se(), [x, b] = A(!1), v = s?.placeholder || r("common.searchStore"), B = async (d) => {
|
|
1173
1180
|
b(!0);
|
|
1174
|
-
const
|
|
1175
|
-
return b(!1),
|
|
1176
|
-
}, { data:
|
|
1177
|
-
(
|
|
1178
|
-
sortBy:
|
|
1181
|
+
const R = await u.get(Ie(e, ke(T.blockletsPath, d)));
|
|
1182
|
+
return b(!1), R.dataList || [];
|
|
1183
|
+
}, { data: C, run: V } = oe(
|
|
1184
|
+
(d) => d ? B({
|
|
1185
|
+
sortBy: T.nameDesc,
|
|
1179
1186
|
page: 1,
|
|
1180
1187
|
pageSize: 10,
|
|
1181
|
-
keyword:
|
|
1188
|
+
keyword: d,
|
|
1182
1189
|
showResources: "true"
|
|
1183
1190
|
}) : Promise.resolve([]),
|
|
1184
1191
|
{
|
|
@@ -1186,15 +1193,15 @@ function et({
|
|
|
1186
1193
|
}
|
|
1187
1194
|
);
|
|
1188
1195
|
U(() => {
|
|
1189
|
-
b(!0), V(
|
|
1190
|
-
}, [
|
|
1196
|
+
b(!0), V(i.keyword), w(i.keyword || "");
|
|
1197
|
+
}, [i.keyword, V]), Ft(
|
|
1191
1198
|
"ctrl + k, command + k",
|
|
1192
|
-
(
|
|
1199
|
+
(d) => (d.stopPropagation(), d.preventDefault(), n.current?.querySelector("input")?.focus(), !1),
|
|
1193
1200
|
{ enableOnTags: ["INPUT"] }
|
|
1194
1201
|
);
|
|
1195
|
-
const X = Ne((
|
|
1202
|
+
const X = Ne((d) => V(d), { wait: 300 }), D = { name: ue, title: c, did: "" };
|
|
1196
1203
|
let F = [];
|
|
1197
|
-
return
|
|
1204
|
+
return c && (x ? F = [D] : C?.length ? F = [D, ...C] : F = [{ name: Oe, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ p(_, { children: [
|
|
1198
1205
|
/* @__PURE__ */ p(zt, { fullScreen: !0, open: y, sx: { display: { md: "none" } }, children: [
|
|
1199
1206
|
/* @__PURE__ */ p(
|
|
1200
1207
|
g,
|
|
@@ -1228,8 +1235,8 @@ function et({
|
|
|
1228
1235
|
autoFocus: !0,
|
|
1229
1236
|
placeholder: v,
|
|
1230
1237
|
className: "bl-autocomplete-input",
|
|
1231
|
-
value:
|
|
1232
|
-
onChange: (
|
|
1238
|
+
value: c,
|
|
1239
|
+
onChange: (d) => G(d.target.value),
|
|
1233
1240
|
startAdornment: $(y),
|
|
1234
1241
|
endAdornment: q()
|
|
1235
1242
|
}
|
|
@@ -1239,7 +1246,7 @@ function et({
|
|
|
1239
1246
|
{
|
|
1240
1247
|
variant: "outlined",
|
|
1241
1248
|
onClick: () => {
|
|
1242
|
-
S(!1), w(
|
|
1249
|
+
S(!1), w(i.keyword || "");
|
|
1243
1250
|
},
|
|
1244
1251
|
children: r("common.cancel")
|
|
1245
1252
|
}
|
|
@@ -1247,28 +1254,28 @@ function et({
|
|
|
1247
1254
|
]
|
|
1248
1255
|
}
|
|
1249
1256
|
),
|
|
1250
|
-
/* @__PURE__ */ t(je, { sx: { p: 0.5 }, children: F.map((
|
|
1257
|
+
/* @__PURE__ */ t(je, { sx: { p: 0.5 }, children: F.map((d) => Q(d)) })
|
|
1251
1258
|
] }),
|
|
1252
1259
|
/* @__PURE__ */ t(g, { sx: { display: { sx: "block", md: "none" }, paddingTop: 1, opacity: 0.5 }, children: /* @__PURE__ */ t(M, { icon: se, style: { fontSize: 22, color: "inherit" }, onClick: () => S(!0) }) }),
|
|
1253
1260
|
/* @__PURE__ */ t(
|
|
1254
1261
|
Mt,
|
|
1255
1262
|
{
|
|
1256
|
-
ref:
|
|
1257
|
-
open: !!
|
|
1263
|
+
ref: n,
|
|
1264
|
+
open: !!c && h,
|
|
1258
1265
|
size: "small",
|
|
1259
1266
|
onOpen: () => f(!0),
|
|
1260
|
-
onClose: (
|
|
1261
|
-
f(!1),
|
|
1267
|
+
onClose: (d, R) => {
|
|
1268
|
+
f(!1), R === "selectOption" && !m.current && l(c);
|
|
1262
1269
|
},
|
|
1263
|
-
onKeyDown: (
|
|
1264
|
-
|
|
1270
|
+
onKeyDown: (d) => {
|
|
1271
|
+
d.key === "Enter" && !c && W();
|
|
1265
1272
|
},
|
|
1266
1273
|
disableClearable: !0,
|
|
1267
|
-
inputValue:
|
|
1268
|
-
onInputChange: (
|
|
1269
|
-
isOptionEqualToValue: (
|
|
1270
|
-
getOptionLabel: (
|
|
1271
|
-
getOptionKey: (
|
|
1274
|
+
inputValue: c,
|
|
1275
|
+
onInputChange: (d, R) => G(R),
|
|
1276
|
+
isOptionEqualToValue: (d, R) => d.name === R.name,
|
|
1277
|
+
getOptionLabel: (d) => d.title,
|
|
1278
|
+
getOptionKey: (d) => d.name,
|
|
1272
1279
|
noOptionsText: r("blocklet.noResults"),
|
|
1273
1280
|
autoHighlight: !0,
|
|
1274
1281
|
forcePopupIcon: !1,
|
|
@@ -1282,25 +1289,25 @@ function et({
|
|
|
1282
1289
|
}
|
|
1283
1290
|
}
|
|
1284
1291
|
},
|
|
1285
|
-
renderInput: (
|
|
1292
|
+
renderInput: (d) => /* @__PURE__ */ t(
|
|
1286
1293
|
_t,
|
|
1287
1294
|
{
|
|
1288
|
-
...
|
|
1295
|
+
...d,
|
|
1289
1296
|
InputProps: {
|
|
1290
|
-
...
|
|
1297
|
+
...d.InputProps,
|
|
1291
1298
|
autoFocus: !0,
|
|
1292
1299
|
placeholder: v,
|
|
1293
1300
|
className: "bl-autocomplete-input",
|
|
1294
|
-
value:
|
|
1301
|
+
value: c,
|
|
1295
1302
|
startAdornment: $(h),
|
|
1296
1303
|
endAdornment: q()
|
|
1297
1304
|
}
|
|
1298
1305
|
}
|
|
1299
1306
|
),
|
|
1300
|
-
filterOptions: (
|
|
1307
|
+
filterOptions: (d) => d,
|
|
1301
1308
|
...s,
|
|
1302
1309
|
options: F,
|
|
1303
|
-
renderOption: (
|
|
1310
|
+
renderOption: (d, R) => Q(R),
|
|
1304
1311
|
value: D,
|
|
1305
1312
|
sx: [
|
|
1306
1313
|
{
|
|
@@ -1321,23 +1328,23 @@ function et({
|
|
|
1321
1328
|
}
|
|
1322
1329
|
)
|
|
1323
1330
|
] });
|
|
1324
|
-
function G(
|
|
1325
|
-
b(!0), w(
|
|
1331
|
+
function G(d) {
|
|
1332
|
+
b(!0), w(d), m.current = !1, X.run(d);
|
|
1326
1333
|
}
|
|
1327
1334
|
function W() {
|
|
1328
|
-
S(!1), w(""), G(""),
|
|
1335
|
+
S(!1), w(""), G(""), l("");
|
|
1329
1336
|
}
|
|
1330
|
-
function le(
|
|
1331
|
-
|
|
1337
|
+
function le(d) {
|
|
1338
|
+
d?.did ? (S(!1), m.current = !0, w(""), a(d)) : d.name === ue && (S(!1), l(c));
|
|
1332
1339
|
}
|
|
1333
|
-
function Q(
|
|
1340
|
+
function Q(d) {
|
|
1334
1341
|
return /* @__PURE__ */ p(
|
|
1335
1342
|
$e,
|
|
1336
1343
|
{
|
|
1337
1344
|
sx: { display: "flex", alignItems: "center", gap: 1, p: 1.5, borderRadius: "8px" },
|
|
1338
|
-
onClick: () => le(
|
|
1345
|
+
onClick: () => le(d),
|
|
1339
1346
|
children: [
|
|
1340
|
-
Y(
|
|
1347
|
+
Y(d),
|
|
1341
1348
|
/* @__PURE__ */ p(k, { variant: "body1", children: [
|
|
1342
1349
|
/* @__PURE__ */ t(
|
|
1343
1350
|
k,
|
|
@@ -1348,7 +1355,7 @@ function et({
|
|
|
1348
1355
|
alignItems: "center",
|
|
1349
1356
|
gap: 1
|
|
1350
1357
|
},
|
|
1351
|
-
children:
|
|
1358
|
+
children: d.title
|
|
1352
1359
|
}
|
|
1353
1360
|
),
|
|
1354
1361
|
/* @__PURE__ */ t(
|
|
@@ -1358,17 +1365,17 @@ function et({
|
|
|
1358
1365
|
fontSize: "13px",
|
|
1359
1366
|
color: "text.hint"
|
|
1360
1367
|
},
|
|
1361
|
-
children:
|
|
1368
|
+
children: d.category?.locales?.[o || "en"] || ""
|
|
1362
1369
|
}
|
|
1363
1370
|
)
|
|
1364
1371
|
] })
|
|
1365
1372
|
]
|
|
1366
1373
|
},
|
|
1367
|
-
|
|
1374
|
+
d.did
|
|
1368
1375
|
);
|
|
1369
1376
|
}
|
|
1370
|
-
function Y(
|
|
1371
|
-
if ([ue,
|
|
1377
|
+
function Y(d) {
|
|
1378
|
+
if ([ue, Oe].includes(d.name))
|
|
1372
1379
|
return /* @__PURE__ */ t(
|
|
1373
1380
|
g,
|
|
1374
1381
|
{
|
|
@@ -1385,14 +1392,14 @@ function et({
|
|
|
1385
1392
|
children: /* @__PURE__ */ t(M, { icon: se, style: { fontSize: 28 } })
|
|
1386
1393
|
}
|
|
1387
1394
|
);
|
|
1388
|
-
let
|
|
1389
|
-
return
|
|
1395
|
+
let R = "";
|
|
1396
|
+
return d.logo && (R = Ie(e, "assets", d.did, qe(d.logo, he, d.version))), /* @__PURE__ */ t(He, { src: R, size: he, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1390
1397
|
}
|
|
1391
|
-
function $(
|
|
1392
|
-
return /* @__PURE__ */ t(g, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.hint" }, children:
|
|
1398
|
+
function $(d = !0) {
|
|
1399
|
+
return /* @__PURE__ */ t(g, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.hint" }, children: d && c && x ? /* @__PURE__ */ t(ie, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(M, { icon: se, style: { fontSize: 16, cursor: "default" } }) });
|
|
1393
1400
|
}
|
|
1394
1401
|
function q() {
|
|
1395
|
-
return
|
|
1402
|
+
return c ? /* @__PURE__ */ t(g, { sx: { display: "flex", alignItems: "center", color: "text.hint" }, children: /* @__PURE__ */ t(
|
|
1396
1403
|
M,
|
|
1397
1404
|
{
|
|
1398
1405
|
icon: Lt,
|
|
@@ -1403,29 +1410,29 @@ function et({
|
|
|
1403
1410
|
}
|
|
1404
1411
|
}
|
|
1405
1412
|
function gr({ placeholder: e, ...r }) {
|
|
1406
|
-
const { search: o, t:
|
|
1413
|
+
const { search: o, t: i } = I(), { filters: l, handleKeyword: a } = o, [s, n] = A(l.keyword || ""), m = Ne(a, { wait: 300 }), h = (w) => {
|
|
1407
1414
|
const { value: y } = w.target;
|
|
1408
|
-
|
|
1415
|
+
n(y), m.run(y);
|
|
1409
1416
|
}, f = () => {
|
|
1410
|
-
|
|
1417
|
+
n(""), a("");
|
|
1411
1418
|
};
|
|
1412
1419
|
U(() => {
|
|
1413
|
-
l
|
|
1414
|
-
}, [
|
|
1415
|
-
const
|
|
1420
|
+
n(l.keyword || "");
|
|
1421
|
+
}, [l.keyword]);
|
|
1422
|
+
const c = e || i("common.searchPlaceholder");
|
|
1416
1423
|
return /* @__PURE__ */ t(
|
|
1417
1424
|
xr,
|
|
1418
1425
|
{
|
|
1419
1426
|
inputProps: {
|
|
1420
1427
|
"data-cy": "search-blocklet"
|
|
1421
1428
|
},
|
|
1422
|
-
startAdornment: /* @__PURE__ */ t(
|
|
1429
|
+
startAdornment: /* @__PURE__ */ t(Te, { position: "start", children: /* @__PURE__ */ t(yr, { sx: { fontSize: 18, ml: -0.5 } }) }),
|
|
1423
1430
|
onChange: h,
|
|
1424
|
-
placeholder:
|
|
1431
|
+
placeholder: c,
|
|
1425
1432
|
value: s,
|
|
1426
|
-
title:
|
|
1433
|
+
title: c,
|
|
1427
1434
|
"data-cy": "search",
|
|
1428
|
-
endAdornment: s && /* @__PURE__ */ t(
|
|
1435
|
+
endAdornment: s && /* @__PURE__ */ t(Te, { position: "end", children: /* @__PURE__ */ t(wr, { "data-cy": "search-delete", onClick: f }) }),
|
|
1429
1436
|
...r
|
|
1430
1437
|
}
|
|
1431
1438
|
);
|
|
@@ -1459,17 +1466,26 @@ function br() {
|
|
|
1459
1466
|
search: e,
|
|
1460
1467
|
t: r,
|
|
1461
1468
|
endpoint: o,
|
|
1462
|
-
locale:
|
|
1463
|
-
getCategoryLocale:
|
|
1469
|
+
locale: i,
|
|
1470
|
+
getCategoryLocale: l,
|
|
1464
1471
|
developerName: a,
|
|
1465
1472
|
showResourcesSwitch: s,
|
|
1466
|
-
layout:
|
|
1473
|
+
layout: n,
|
|
1467
1474
|
baseSearch: m,
|
|
1468
1475
|
categoryOptions: h,
|
|
1469
1476
|
compact: f
|
|
1470
|
-
} = I(), {
|
|
1477
|
+
} = I(), {
|
|
1478
|
+
filters: c,
|
|
1479
|
+
handleSort: w,
|
|
1480
|
+
handlePrice: y,
|
|
1481
|
+
handleDeveloper: S,
|
|
1482
|
+
handleSwitchShowResources: u,
|
|
1483
|
+
cleanFilter: x,
|
|
1484
|
+
handleCategory: b,
|
|
1485
|
+
handleSwitchIsOfficial: v
|
|
1486
|
+
} = e, B = Ge(r);
|
|
1471
1487
|
return /* @__PURE__ */ p(
|
|
1472
|
-
|
|
1488
|
+
O,
|
|
1473
1489
|
{
|
|
1474
1490
|
className: "filter-bar",
|
|
1475
1491
|
direction: { xs: "column", md: "row" },
|
|
@@ -1494,11 +1510,11 @@ function br() {
|
|
|
1494
1510
|
sx: {
|
|
1495
1511
|
textTransform: "capitalize"
|
|
1496
1512
|
},
|
|
1497
|
-
children:
|
|
1513
|
+
children: l(c.category)
|
|
1498
1514
|
}
|
|
1499
1515
|
),
|
|
1500
1516
|
/* @__PURE__ */ p(
|
|
1501
|
-
|
|
1517
|
+
O,
|
|
1502
1518
|
{
|
|
1503
1519
|
direction: "row",
|
|
1504
1520
|
sx: {
|
|
@@ -1510,7 +1526,7 @@ function br() {
|
|
|
1510
1526
|
gap: 2
|
|
1511
1527
|
},
|
|
1512
1528
|
children: [
|
|
1513
|
-
|
|
1529
|
+
n.showSearch ? /* @__PURE__ */ t(
|
|
1514
1530
|
g,
|
|
1515
1531
|
{
|
|
1516
1532
|
sx: {
|
|
@@ -1520,7 +1536,7 @@ function br() {
|
|
|
1520
1536
|
children: m ? /* @__PURE__ */ t(gr, {}) : /* @__PURE__ */ t(
|
|
1521
1537
|
et,
|
|
1522
1538
|
{
|
|
1523
|
-
locale:
|
|
1539
|
+
locale: i,
|
|
1524
1540
|
endpoint: o,
|
|
1525
1541
|
sx: {
|
|
1526
1542
|
display: { md: "block", xs: "none" },
|
|
@@ -1536,52 +1552,60 @@ function br() {
|
|
|
1536
1552
|
)
|
|
1537
1553
|
}
|
|
1538
1554
|
) : null,
|
|
1539
|
-
|
|
1540
|
-
|
|
1555
|
+
c.owner && a && /* @__PURE__ */ t(
|
|
1556
|
+
Pe,
|
|
1541
1557
|
{
|
|
1542
1558
|
label: r("blocklet.authorTag", { name: a }),
|
|
1543
1559
|
size: "small",
|
|
1544
1560
|
onDelete: () => S("")
|
|
1545
1561
|
}
|
|
1546
1562
|
),
|
|
1547
|
-
|
|
1548
|
-
|
|
1563
|
+
c.resourceDid && c.resourceBlocklet && /* @__PURE__ */ t(
|
|
1564
|
+
Pe,
|
|
1549
1565
|
{
|
|
1550
|
-
label: r("blocklet.resourceTag", { name:
|
|
1566
|
+
label: r("blocklet.resourceTag", { name: c.resourceBlocklet }),
|
|
1551
1567
|
size: "small",
|
|
1552
1568
|
onDelete: () => x(["resourceDid", "resourceBlocklet", "showResources"])
|
|
1553
1569
|
}
|
|
1554
1570
|
),
|
|
1571
|
+
/* @__PURE__ */ t(
|
|
1572
|
+
pe,
|
|
1573
|
+
{
|
|
1574
|
+
checked: c.isOfficial === "true",
|
|
1575
|
+
onChange: (C) => v(C ? "true" : "false"),
|
|
1576
|
+
label: r("common.official")
|
|
1577
|
+
}
|
|
1578
|
+
),
|
|
1555
1579
|
s ? /* @__PURE__ */ t(
|
|
1556
|
-
|
|
1580
|
+
pe,
|
|
1557
1581
|
{
|
|
1558
|
-
checked:
|
|
1582
|
+
checked: c.showResources !== "false",
|
|
1559
1583
|
onChange: (C) => u(C ? "true" : "false"),
|
|
1560
1584
|
label: r("common.showResources")
|
|
1561
1585
|
}
|
|
1562
1586
|
) : null,
|
|
1563
1587
|
/* @__PURE__ */ t(
|
|
1564
|
-
|
|
1588
|
+
pe,
|
|
1565
1589
|
{
|
|
1566
|
-
checked:
|
|
1590
|
+
checked: c.price === "free",
|
|
1567
1591
|
onChange: (C) => y(C ? "free" : ""),
|
|
1568
1592
|
label: r("blocklet.free")
|
|
1569
1593
|
}
|
|
1570
1594
|
),
|
|
1571
1595
|
f && /* @__PURE__ */ t(g, { children: /* @__PURE__ */ t(
|
|
1572
|
-
|
|
1596
|
+
xe,
|
|
1573
1597
|
{
|
|
1574
|
-
value:
|
|
1598
|
+
value: c.category || h[0]?.value,
|
|
1575
1599
|
options: h,
|
|
1576
1600
|
placeholder: r("common.category"),
|
|
1577
1601
|
onChange: (C) => b(C)
|
|
1578
1602
|
}
|
|
1579
1603
|
) }),
|
|
1580
1604
|
/* @__PURE__ */ t(
|
|
1581
|
-
|
|
1605
|
+
xe,
|
|
1582
1606
|
{
|
|
1583
|
-
value:
|
|
1584
|
-
options:
|
|
1607
|
+
value: c.sortBy || B[0].value,
|
|
1608
|
+
options: B,
|
|
1585
1609
|
placeholder: r("sort.sort"),
|
|
1586
1610
|
onChange: (C) => w(C)
|
|
1587
1611
|
}
|
|
@@ -1593,12 +1617,12 @@ function br() {
|
|
|
1593
1617
|
}
|
|
1594
1618
|
);
|
|
1595
1619
|
}
|
|
1596
|
-
function
|
|
1620
|
+
function pe({
|
|
1597
1621
|
checked: e,
|
|
1598
1622
|
onChange: r,
|
|
1599
1623
|
label: o
|
|
1600
1624
|
}) {
|
|
1601
|
-
const
|
|
1625
|
+
const i = Le();
|
|
1602
1626
|
return /* @__PURE__ */ t(
|
|
1603
1627
|
We,
|
|
1604
1628
|
{
|
|
@@ -1608,11 +1632,11 @@ function Ee({
|
|
|
1608
1632
|
De,
|
|
1609
1633
|
{
|
|
1610
1634
|
checked: e,
|
|
1611
|
-
icon: /* @__PURE__ */ t(M, { style: { padding: 0, color:
|
|
1612
|
-
checkedIcon: /* @__PURE__ */ t(M, { style: { padding: 0, color:
|
|
1635
|
+
icon: /* @__PURE__ */ t(M, { style: { padding: 0, color: i.palette.text.secondary }, icon: Ot }),
|
|
1636
|
+
checkedIcon: /* @__PURE__ */ t(M, { style: { padding: 0, color: i.palette.primary.main }, icon: Et }),
|
|
1613
1637
|
size: "large",
|
|
1614
1638
|
sx: { p: 0, mr: 1 },
|
|
1615
|
-
onChange: (
|
|
1639
|
+
onChange: (l) => r(l.target.checked)
|
|
1616
1640
|
}
|
|
1617
1641
|
),
|
|
1618
1642
|
label: o
|
|
@@ -1638,12 +1662,12 @@ function J({ children: e }) {
|
|
|
1638
1662
|
}
|
|
1639
1663
|
);
|
|
1640
1664
|
}
|
|
1641
|
-
function
|
|
1665
|
+
function Ee() {
|
|
1642
1666
|
const { t: e } = I();
|
|
1643
1667
|
return /* @__PURE__ */ t(k, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
1644
1668
|
}
|
|
1645
|
-
function
|
|
1646
|
-
const { t: o, locale:
|
|
1669
|
+
function me({ filterTip: e = !1, keywordTip: r = !1 }) {
|
|
1670
|
+
const { t: o, locale: i } = I(), l = () => i === "zh" ? "、" : " , ";
|
|
1647
1671
|
return /* @__PURE__ */ p(
|
|
1648
1672
|
g,
|
|
1649
1673
|
{
|
|
@@ -1654,13 +1678,13 @@ function pe({ filterTip: e = !1, keywordTip: r = !1 }) {
|
|
|
1654
1678
|
children: [
|
|
1655
1679
|
/* @__PURE__ */ t(k, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1656
1680
|
e && /* @__PURE__ */ t(k, { children: o("blocklet.filterTip") }),
|
|
1657
|
-
e && r &&
|
|
1681
|
+
e && r && l(),
|
|
1658
1682
|
r && /* @__PURE__ */ t(k, { children: o("blocklet.keywordTip") })
|
|
1659
1683
|
]
|
|
1660
1684
|
}
|
|
1661
1685
|
);
|
|
1662
1686
|
}
|
|
1663
|
-
function
|
|
1687
|
+
function fe({
|
|
1664
1688
|
primaryStart: e,
|
|
1665
1689
|
primaryEnd: r,
|
|
1666
1690
|
filter: o
|
|
@@ -1694,82 +1718,82 @@ function me({
|
|
|
1694
1718
|
);
|
|
1695
1719
|
}
|
|
1696
1720
|
function kr() {
|
|
1697
|
-
const { t: e, search: r, getCategoryLocale: o, selectedCategory:
|
|
1698
|
-
if (
|
|
1721
|
+
const { t: e, search: r, getCategoryLocale: o, selectedCategory: i } = I(), { filters: l } = r, a = !!i || !!l.price;
|
|
1722
|
+
if (l.keyword && a)
|
|
1699
1723
|
return /* @__PURE__ */ p(J, { children: [
|
|
1700
1724
|
/* @__PURE__ */ t(
|
|
1701
|
-
|
|
1725
|
+
fe,
|
|
1702
1726
|
{
|
|
1703
1727
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1704
1728
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1705
|
-
filter:
|
|
1729
|
+
filter: l.keyword
|
|
1706
1730
|
}
|
|
1707
1731
|
),
|
|
1708
|
-
/* @__PURE__ */ t(
|
|
1732
|
+
/* @__PURE__ */ t(me, { keywordTip: !0, filterTip: !0 })
|
|
1709
1733
|
] });
|
|
1710
|
-
if (
|
|
1734
|
+
if (l.keyword)
|
|
1711
1735
|
return /* @__PURE__ */ p(J, { children: [
|
|
1712
1736
|
/* @__PURE__ */ t(
|
|
1713
|
-
|
|
1737
|
+
fe,
|
|
1714
1738
|
{
|
|
1715
1739
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1716
1740
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1717
|
-
filter:
|
|
1741
|
+
filter: l.keyword
|
|
1718
1742
|
}
|
|
1719
1743
|
),
|
|
1720
|
-
/* @__PURE__ */ t(
|
|
1744
|
+
/* @__PURE__ */ t(me, { keywordTip: !0 })
|
|
1721
1745
|
] });
|
|
1722
1746
|
if (a) {
|
|
1723
|
-
const s = o(
|
|
1747
|
+
const s = o(i);
|
|
1724
1748
|
return /* @__PURE__ */ p(J, { children: [
|
|
1725
1749
|
s ? /* @__PURE__ */ t(
|
|
1726
|
-
|
|
1750
|
+
fe,
|
|
1727
1751
|
{
|
|
1728
1752
|
primaryStart: e("blocklet.noCategoryResults1"),
|
|
1729
1753
|
primaryEnd: e("blocklet.noCategoryResults2"),
|
|
1730
1754
|
filter: s
|
|
1731
1755
|
}
|
|
1732
|
-
) : /* @__PURE__ */ t(
|
|
1733
|
-
/* @__PURE__ */ t(
|
|
1756
|
+
) : /* @__PURE__ */ t(Ee, {}),
|
|
1757
|
+
/* @__PURE__ */ t(me, { filterTip: !0 })
|
|
1734
1758
|
] });
|
|
1735
1759
|
}
|
|
1736
|
-
return /* @__PURE__ */ t(J, { children: /* @__PURE__ */ t(
|
|
1760
|
+
return /* @__PURE__ */ t(J, { children: /* @__PURE__ */ t(Ee, {}) });
|
|
1737
1761
|
}
|
|
1738
|
-
const vr = (e, r, o,
|
|
1739
|
-
async (
|
|
1740
|
-
|
|
1741
|
-
const { currentPage: a, pageSize: s } = o,
|
|
1762
|
+
const vr = (e, r, o, i) => ht(
|
|
1763
|
+
async (l) => {
|
|
1764
|
+
l || (o.currentPage = o.defaultCurrentPage);
|
|
1765
|
+
const { currentPage: a, pageSize: s } = o, n = {
|
|
1742
1766
|
...r,
|
|
1743
1767
|
category: r.category === "All" ? "" : r.category,
|
|
1744
|
-
sortBy:
|
|
1768
|
+
sortBy: T[r.sortBy],
|
|
1745
1769
|
page: a,
|
|
1746
1770
|
pageSize: s
|
|
1747
1771
|
};
|
|
1748
|
-
|
|
1749
|
-
const { data: m = {} } = await e.get(
|
|
1772
|
+
i(null);
|
|
1773
|
+
const { data: m = {} } = await e.get(T.blockletsPath, { params: n });
|
|
1750
1774
|
return o.currentPage++, { page: a, pageSize: s, list: m?.dataList || [], total: m?.total || 0 };
|
|
1751
1775
|
},
|
|
1752
1776
|
{
|
|
1753
|
-
isNoMore: (
|
|
1777
|
+
isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
|
|
1754
1778
|
reloadDeps: [e, Wt(r)],
|
|
1755
|
-
onError:
|
|
1779
|
+
onError: i
|
|
1756
1780
|
}
|
|
1757
1781
|
);
|
|
1758
1782
|
function Cr() {
|
|
1759
|
-
const { storeApi: e, search: r, extraFilter: o, errors:
|
|
1760
|
-
currentPage:
|
|
1761
|
-
pageSize: Zt() ?
|
|
1762
|
-
defaultCurrentPage:
|
|
1763
|
-
}), [
|
|
1783
|
+
const { storeApi: e, search: r, extraFilter: o, errors: i, updateDeveloperName: l } = I(), { filters: a } = r, s = pt({
|
|
1784
|
+
currentPage: T.currentPage,
|
|
1785
|
+
pageSize: Zt() ? T.mobilePageSize : T.pageSize,
|
|
1786
|
+
defaultCurrentPage: T.defaultCurrentPage
|
|
1787
|
+
}), [n, m] = A(null), h = vr(e, a, s, m), f = H(
|
|
1764
1788
|
() => o ? o(h.data?.list || []) : h.data?.list || [],
|
|
1765
1789
|
[h.data, o]
|
|
1766
1790
|
);
|
|
1767
1791
|
return U(() => {
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
}, [a.owner, f,
|
|
1792
|
+
const c = f.find((w) => w.owner.did === a.owner);
|
|
1793
|
+
l(c?.owner.fullName || c?.author.name || "");
|
|
1794
|
+
}, [a.owner, f, l]), {
|
|
1771
1795
|
blocklets: f,
|
|
1772
|
-
fetchBlockletsError:
|
|
1796
|
+
fetchBlockletsError: n,
|
|
1773
1797
|
loadMore: h.loadMore,
|
|
1774
1798
|
hasNextPage: !h.noMore,
|
|
1775
1799
|
total: h.data?.total || 0,
|
|
@@ -1778,26 +1802,26 @@ function Cr() {
|
|
|
1778
1802
|
loadingMore: h.loadingMore
|
|
1779
1803
|
},
|
|
1780
1804
|
errors: {
|
|
1781
|
-
...
|
|
1782
|
-
fetchBlockletsError:
|
|
1805
|
+
...i,
|
|
1806
|
+
fetchBlockletsError: n
|
|
1783
1807
|
}
|
|
1784
1808
|
};
|
|
1785
1809
|
}
|
|
1786
1810
|
function Sr() {
|
|
1787
|
-
const { t: e, search: r, endpoint: o, blockletRender:
|
|
1811
|
+
const { t: e, search: r, endpoint: o, blockletRender: i, serverVersion: l, minItemWidth: a, layout: s, baseSearch: n, compact: m } = I(), { filters: h } = r, { blocklets: f, errors: c, loadMore: w, loadings: y, hasNextPage: S, total: u } = Cr(), [x] = At({
|
|
1788
1812
|
loading: y.fetchBlockletsLoading || y.loadingMore,
|
|
1789
1813
|
hasNextPage: S,
|
|
1790
1814
|
onLoadMore: w
|
|
1791
1815
|
});
|
|
1792
|
-
if (
|
|
1793
|
-
const
|
|
1794
|
-
return /* @__PURE__ */ t(
|
|
1816
|
+
if (c.fetchBlockletsError) {
|
|
1817
|
+
const C = new Error(`Failed to fetch blocklets from ${o}: ${Qt(c.fetchBlockletsError)}`);
|
|
1818
|
+
return /* @__PURE__ */ t(be, { error: C });
|
|
1795
1819
|
}
|
|
1796
|
-
const b =
|
|
1820
|
+
const b = n && s.showSearch || !h.keyword;
|
|
1797
1821
|
return /* @__PURE__ */ p(_, { children: [
|
|
1798
1822
|
b ? /* @__PURE__ */ t(br, {}) : /* @__PURE__ */ p(_, { children: [
|
|
1799
|
-
/* @__PURE__ */ t(
|
|
1800
|
-
|
|
1823
|
+
/* @__PURE__ */ t(Ce, { xs: /* @__PURE__ */ t(Ze, {}), md: null }),
|
|
1824
|
+
B()
|
|
1801
1825
|
] }),
|
|
1802
1826
|
v(),
|
|
1803
1827
|
!y.fetchBlockletsLoading && S && /* @__PURE__ */ t(
|
|
@@ -1831,10 +1855,10 @@ function Sr() {
|
|
|
1831
1855
|
rowGap: 2,
|
|
1832
1856
|
columnGap: m ? 0 : 2
|
|
1833
1857
|
},
|
|
1834
|
-
children: f.map((
|
|
1858
|
+
children: f.map((C) => /* @__PURE__ */ t(
|
|
1835
1859
|
g,
|
|
1836
1860
|
{
|
|
1837
|
-
"data-blocklet-did":
|
|
1861
|
+
"data-blocklet-did": C.did,
|
|
1838
1862
|
sx: {
|
|
1839
1863
|
minWidth: {
|
|
1840
1864
|
xs: "100%",
|
|
@@ -1842,16 +1866,16 @@ function Sr() {
|
|
|
1842
1866
|
},
|
|
1843
1867
|
maxWidth: "calc(100vw - 32px)"
|
|
1844
1868
|
},
|
|
1845
|
-
children:
|
|
1869
|
+
children: i({ blocklet: C, blocklets: f, serverVersion: l })
|
|
1846
1870
|
},
|
|
1847
|
-
|
|
1871
|
+
C.did
|
|
1848
1872
|
))
|
|
1849
1873
|
}
|
|
1850
1874
|
) : /* @__PURE__ */ t(kr, {});
|
|
1851
1875
|
}
|
|
1852
|
-
function
|
|
1876
|
+
function B() {
|
|
1853
1877
|
return /* @__PURE__ */ p(
|
|
1854
|
-
|
|
1878
|
+
O,
|
|
1855
1879
|
{
|
|
1856
1880
|
direction: "row",
|
|
1857
1881
|
className: "search-result-title",
|
|
@@ -1893,7 +1917,7 @@ function Sr() {
|
|
|
1893
1917
|
}
|
|
1894
1918
|
}
|
|
1895
1919
|
function Ir() {
|
|
1896
|
-
const { t: e, selectedCategory: r, getCategoryLocale: o, locale:
|
|
1920
|
+
const { t: e, selectedCategory: r, getCategoryLocale: o, locale: i, search: l } = I(), { toggleOpen: a } = ve(), n = jt().arcSphere, m = !!window.blocklet?.navigation?.some((h) => h.section === "bottomNavigation");
|
|
1897
1921
|
return /* @__PURE__ */ p(
|
|
1898
1922
|
ee,
|
|
1899
1923
|
{
|
|
@@ -1920,16 +1944,16 @@ function Ir() {
|
|
|
1920
1944
|
]
|
|
1921
1945
|
}
|
|
1922
1946
|
),
|
|
1923
|
-
|
|
1947
|
+
n && m && /* @__PURE__ */ t(
|
|
1924
1948
|
et,
|
|
1925
1949
|
{
|
|
1926
|
-
locale:
|
|
1950
|
+
locale: i,
|
|
1927
1951
|
endpoint: window.blocklet?.prefix || "/",
|
|
1928
1952
|
sx: { display: { md: "block", xs: "none" }, mr: 1, width: "350px" },
|
|
1929
1953
|
t: e,
|
|
1930
|
-
filters:
|
|
1931
|
-
handleKeyword:
|
|
1932
|
-
handleSearchSelect:
|
|
1954
|
+
filters: l.filters,
|
|
1955
|
+
handleKeyword: l.handleKeyword,
|
|
1956
|
+
handleSearchSelect: l.handleSearchSelect
|
|
1933
1957
|
}
|
|
1934
1958
|
)
|
|
1935
1959
|
]
|
|
@@ -1937,9 +1961,9 @@ function Ir() {
|
|
|
1937
1961
|
);
|
|
1938
1962
|
}
|
|
1939
1963
|
function Br({ menus: e = [], children: r = void 0 }) {
|
|
1940
|
-
const { search: o, layout:
|
|
1941
|
-
return /* @__PURE__ */ t(Ut, { children: /* @__PURE__ */ p(dt, { FallbackComponent:
|
|
1942
|
-
!
|
|
1964
|
+
const { search: o, layout: i, compact: l } = I(), { filters: a } = o, s = te(null), n = a.category || a.keyword || a.price, m = e.find((h) => h.key === a.menu)?.key;
|
|
1965
|
+
return /* @__PURE__ */ t(Ut, { children: /* @__PURE__ */ p(dt, { FallbackComponent: be, children: [
|
|
1966
|
+
!l && /* @__PURE__ */ t(Ir, {}),
|
|
1943
1967
|
/* @__PURE__ */ p(
|
|
1944
1968
|
g,
|
|
1945
1969
|
{
|
|
@@ -1948,12 +1972,12 @@ function Br({ menus: e = [], children: r = void 0 }) {
|
|
|
1948
1972
|
sx: {
|
|
1949
1973
|
display: "flex",
|
|
1950
1974
|
height: "100%",
|
|
1951
|
-
pt: { xs: 0, md:
|
|
1975
|
+
pt: { xs: 0, md: l ? 0 : 5 }
|
|
1952
1976
|
},
|
|
1953
1977
|
children: [
|
|
1954
1978
|
/* @__PURE__ */ t(sr, { menus: e }),
|
|
1955
1979
|
/* @__PURE__ */ p(
|
|
1956
|
-
|
|
1980
|
+
O,
|
|
1957
1981
|
{
|
|
1958
1982
|
sx: [
|
|
1959
1983
|
{
|
|
@@ -1961,7 +1985,7 @@ function Br({ menus: e = [], children: r = void 0 }) {
|
|
|
1961
1985
|
position: "relative",
|
|
1962
1986
|
flex: 1
|
|
1963
1987
|
},
|
|
1964
|
-
|
|
1988
|
+
l ? {
|
|
1965
1989
|
overflowY: "auto",
|
|
1966
1990
|
ml: -2,
|
|
1967
1991
|
pr: 1,
|
|
@@ -1970,7 +1994,7 @@ function Br({ menus: e = [], children: r = void 0 }) {
|
|
|
1970
1994
|
],
|
|
1971
1995
|
children: [
|
|
1972
1996
|
m && r?.(m),
|
|
1973
|
-
!m && (
|
|
1997
|
+
!m && (i.showExplore && !n ? /* @__PURE__ */ t(fr, {}) : /* @__PURE__ */ t(Sr, {}))
|
|
1974
1998
|
]
|
|
1975
1999
|
}
|
|
1976
2000
|
)
|
|
@@ -2001,17 +2025,17 @@ function Mo(e) {
|
|
|
2001
2025
|
flex: 1
|
|
2002
2026
|
},
|
|
2003
2027
|
children: [
|
|
2004
|
-
/* @__PURE__ */ t(
|
|
2005
|
-
/* @__PURE__ */ t(
|
|
2028
|
+
/* @__PURE__ */ t(E, { variant: "rounded", width: 48, height: 48 }),
|
|
2029
|
+
/* @__PURE__ */ t(E, { variant: "text", width: 60, height: 28 })
|
|
2006
2030
|
]
|
|
2007
2031
|
}
|
|
2008
2032
|
),
|
|
2009
|
-
/* @__PURE__ */ t(
|
|
2033
|
+
/* @__PURE__ */ t(E, { variant: "text", width: 70, height: 40 })
|
|
2010
2034
|
]
|
|
2011
2035
|
}
|
|
2012
2036
|
),
|
|
2013
|
-
/* @__PURE__ */ t(
|
|
2014
|
-
/* @__PURE__ */ t(
|
|
2037
|
+
/* @__PURE__ */ t(E, { variant: "text", width: "100%", height: 24 }),
|
|
2038
|
+
/* @__PURE__ */ t(E, { variant: "text", width: "90%", height: 24 }),
|
|
2015
2039
|
/* @__PURE__ */ p(
|
|
2016
2040
|
ee,
|
|
2017
2041
|
{
|
|
@@ -2022,10 +2046,10 @@ function Mo(e) {
|
|
|
2022
2046
|
pt: 1.5
|
|
2023
2047
|
},
|
|
2024
2048
|
children: [
|
|
2025
|
-
/* @__PURE__ */ t(
|
|
2026
|
-
/* @__PURE__ */ t(
|
|
2027
|
-
/* @__PURE__ */ t(
|
|
2028
|
-
/* @__PURE__ */ t(
|
|
2049
|
+
/* @__PURE__ */ t(E, { variant: "rounded", width: 24, height: 24 }),
|
|
2050
|
+
/* @__PURE__ */ t(E, { variant: "text", width: "15%", height: 20 }),
|
|
2051
|
+
/* @__PURE__ */ t(E, { variant: "rounded", width: 24, height: 24, sx: { ml: 1 } }),
|
|
2052
|
+
/* @__PURE__ */ t(E, { variant: "text", width: "15%", height: 20 })
|
|
2029
2053
|
]
|
|
2030
2054
|
}
|
|
2031
2055
|
)
|
|
@@ -2035,8 +2059,8 @@ function zo({ showSkeleton: e = !1, ...r }) {
|
|
|
2035
2059
|
return e ? /* @__PURE__ */ t(L, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(Ht, { ...r });
|
|
2036
2060
|
}
|
|
2037
2061
|
function _o(e) {
|
|
2038
|
-
const { menus: r, children: o, ...
|
|
2039
|
-
st({},
|
|
2062
|
+
const { menus: r, children: o, ...i } = e, l = we(), a = ot(
|
|
2063
|
+
st({}, l, {
|
|
2040
2064
|
typography: {
|
|
2041
2065
|
h1: {
|
|
2042
2066
|
fontSize: 32,
|
|
@@ -2063,7 +2087,7 @@ function _o(e) {
|
|
|
2063
2087
|
}
|
|
2064
2088
|
})
|
|
2065
2089
|
);
|
|
2066
|
-
return /* @__PURE__ */ t(nt, { theme: a, children: /* @__PURE__ */ t(or, { ...
|
|
2090
|
+
return /* @__PURE__ */ t(nt, { theme: a, children: /* @__PURE__ */ t(or, { ...i, children: /* @__PURE__ */ t(Br, { menus: r, children: o }) }) });
|
|
2067
2091
|
}
|
|
2068
2092
|
export {
|
|
2069
2093
|
et as Autocomplete,
|