@blocklet/list 0.14.3 → 0.14.5
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 +626 -602
- package/package.json +5 -4
package/lib/index.es.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { styled as
|
|
1
|
+
import { jsx as t, jsxs as p, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { styled as E, useTheme as xe } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import { Global as we, css as ke } from "@emotion/react";
|
|
4
|
-
import { ErrorFallback as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ErrorBoundary as
|
|
7
|
-
import
|
|
8
|
-
import { Icon as
|
|
9
|
-
import
|
|
10
|
-
import { createContext as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
4
|
+
import { ErrorFallback as ee } from "@arcblock/ux/lib/ErrorBoundary";
|
|
5
|
+
import { Button as te, useTheme as ve, useMediaQuery as D, Drawer as Je, Box as C, CircularProgress as re, MenuList as Ke, SvgIcon as Ze, Popper as et, Grow as tt, Paper as rt, ClickAwayListener as ot, MenuItem as nt, Stack as I, FormControlLabel as Ce, Checkbox as Se, Typography as L, Link as lt, Grid as he, Chip as at, OutlinedInput as it, InputAdornment as me } from "@mui/material";
|
|
6
|
+
import { ErrorBoundary as st } from "react-error-boundary";
|
|
7
|
+
import ct from "@iconify-icons/tabler/compass";
|
|
8
|
+
import { Icon as Be } from "@iconify/react";
|
|
9
|
+
import Re from "@mui/icons-material/Close";
|
|
10
|
+
import { createContext as Pe, useState as q, useMemo as M, useContext as Te, useCallback as Z, useEffect as W, forwardRef as dt, useRef as G, memo as ut, createElement as pt, Fragment as ht } from "react";
|
|
11
|
+
import { createAxios as Ie } from "@blocklet/js-sdk";
|
|
12
|
+
import mt from "lodash/orderBy";
|
|
13
|
+
import { useInfiniteScroll as ft, useRequest as oe, useReactive as gt, useDebounceFn as yt } from "ahooks";
|
|
14
|
+
import bt from "lodash/omitBy";
|
|
15
|
+
import xt from "json-stable-stringify";
|
|
16
|
+
import wt from "color";
|
|
17
17
|
import "lodash/cloneDeep";
|
|
18
|
-
import
|
|
18
|
+
import { parseURL as kt, parseQuery as vt, parseFilename as Ct, stringifyParsedURL as St, withQuery as Le, joinURL as Bt } from "ufo";
|
|
19
19
|
import fe from "flat";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
20
|
+
import w from "prop-types";
|
|
21
|
+
import Rt from "@mui/icons-material/KeyboardArrowDown";
|
|
22
|
+
import Pt from "lodash/isEmpty";
|
|
23
|
+
import Fe from "@mui/material/Box";
|
|
24
|
+
import Tt from "@arcblock/ux/lib/Avatar";
|
|
25
|
+
import It from "@arcblock/ux/lib/Img";
|
|
26
|
+
import Lt from "@iconify-icons/tabler/cloud-download";
|
|
27
|
+
import Ft from "@mui/icons-material/ChevronLeft";
|
|
28
|
+
import $t from "@mui/icons-material/ChevronRight";
|
|
29
|
+
import _t from "react-image-gallery";
|
|
29
30
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { createRoot as
|
|
35
|
-
import { autocomplete as
|
|
36
|
-
import { useHotkeys as
|
|
37
|
-
import
|
|
38
|
-
import At from "@mui/icons-material/Search";
|
|
31
|
+
import zt from "@arcblock/ux/lib/Empty";
|
|
32
|
+
import At from "react-infinite-scroll-hook";
|
|
33
|
+
import $e from "@mui/material/Typography";
|
|
34
|
+
import Et from "@mui/icons-material/Menu";
|
|
35
|
+
import { createRoot as Nt } from "react-dom/client";
|
|
36
|
+
import { autocomplete as Dt } from "@algolia/autocomplete-js";
|
|
37
|
+
import { useHotkeys as Mt } from "react-hotkeys-hook";
|
|
38
|
+
import Ot from "@mui/icons-material/Search";
|
|
39
39
|
import "@algolia/autocomplete-theme-classic/dist/theme.css";
|
|
40
|
-
const
|
|
40
|
+
const _e = Pe({
|
|
41
41
|
open: !1,
|
|
42
42
|
toggleOpen: (e) => {
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
function
|
|
46
|
-
const [
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
return /* @__PURE__ */ t(
|
|
45
|
+
function jt({ children: e }) {
|
|
46
|
+
const [r, o] = q(!1), l = (a) => {
|
|
47
|
+
o(a ?? !a);
|
|
48
|
+
}, n = M(() => ({ open: r, toggleOpen: l }), [r]);
|
|
49
|
+
return /* @__PURE__ */ t(_e.Provider, { value: n, children: e });
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function ne() {
|
|
52
|
+
return Te(_e);
|
|
53
53
|
}
|
|
54
54
|
const T = {
|
|
55
55
|
nameAsc: "title",
|
|
@@ -65,72 +65,32 @@ const T = {
|
|
|
65
65
|
explorePath: "/api/blocklets/explore",
|
|
66
66
|
exploreDidsPath: "/api/blocklets/dids",
|
|
67
67
|
cacheSize: 100
|
|
68
|
-
},
|
|
69
|
-
async (
|
|
70
|
-
|
|
71
|
-
const { currentPage:
|
|
72
|
-
...
|
|
73
|
-
category:
|
|
74
|
-
sortBy: T[
|
|
75
|
-
page:
|
|
68
|
+
}, qt = (e, r, o, l) => ft(
|
|
69
|
+
async (n) => {
|
|
70
|
+
n || (o.currentPage = o.defaultCurrentPage);
|
|
71
|
+
const { currentPage: a, pageSize: d } = o, c = {
|
|
72
|
+
...r,
|
|
73
|
+
category: r.category === "All" ? "" : r.category,
|
|
74
|
+
sortBy: T[r.sortBy],
|
|
75
|
+
page: a,
|
|
76
76
|
pageSize: d
|
|
77
77
|
};
|
|
78
|
-
|
|
79
|
-
const { data: s = {} } = await e.get(T.blockletsPath, { params:
|
|
80
|
-
return
|
|
78
|
+
l(null);
|
|
79
|
+
const { data: s = {} } = await e.get(T.blockletsPath, { params: c });
|
|
80
|
+
return o.currentPage++, { page: a, pageSize: d, list: (s == null ? void 0 : s.dataList) || [], total: (s == null ? void 0 : s.total) || 0 };
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
isNoMore: (
|
|
84
|
-
reloadDeps: [e,
|
|
85
|
-
onError:
|
|
83
|
+
isNoMore: (n) => n ? n.page * n.pageSize >= n.total : !1,
|
|
84
|
+
reloadDeps: [e, xt(r)],
|
|
85
|
+
onError: l
|
|
86
86
|
}
|
|
87
|
-
),
|
|
87
|
+
), Wt = (e) => oe(
|
|
88
88
|
async () => {
|
|
89
|
-
const { data:
|
|
90
|
-
return Array.isArray(
|
|
89
|
+
const { data: r } = await e.get(T.categoriesPath);
|
|
90
|
+
return Array.isArray(r) ? r : [];
|
|
91
91
|
},
|
|
92
92
|
{ manual: !0 }
|
|
93
|
-
), ze =
|
|
94
|
-
filters: i.shape({
|
|
95
|
-
keyword: i.string,
|
|
96
|
-
sortBy: i.string,
|
|
97
|
-
sortDirection: i.string,
|
|
98
|
-
price: i.string,
|
|
99
|
-
category: i.string,
|
|
100
|
-
developer: i.string,
|
|
101
|
-
resourceType: i.string
|
|
102
|
-
}),
|
|
103
|
-
wrapChildren: i.func,
|
|
104
|
-
extraFilter: i.func,
|
|
105
|
-
serverVersion: i.string,
|
|
106
|
-
endpoint: i.string.isRequired,
|
|
107
|
-
blockletRender: i.func.isRequired,
|
|
108
|
-
onFilterChange: i.func,
|
|
109
|
-
onSearchSelect: i.func,
|
|
110
|
-
locale: i.oneOf(["zh", "en"]),
|
|
111
|
-
baseSearch: i.bool,
|
|
112
|
-
// sometimes blocklet list can be rendered only before the category is fetched
|
|
113
|
-
fetchCategoryDelay: i.number,
|
|
114
|
-
showResourcesSwitch: i.bool,
|
|
115
|
-
showCategory: i.bool,
|
|
116
|
-
tagFilters: i.array
|
|
117
|
-
}, _e = {
|
|
118
|
-
locale: "zh",
|
|
119
|
-
filters: {},
|
|
120
|
-
serverVersion: "",
|
|
121
|
-
onFilterChange: () => {
|
|
122
|
-
},
|
|
123
|
-
onSearchSelect: ({ detailUrl: e }) => {
|
|
124
|
-
window.location.href = e;
|
|
125
|
-
},
|
|
126
|
-
wrapChildren: (e) => e,
|
|
127
|
-
extraFilter: (e) => e,
|
|
128
|
-
baseSearch: !1,
|
|
129
|
-
fetchCategoryDelay: 0,
|
|
130
|
-
showResourcesSwitch: !1,
|
|
131
|
-
showCategory: !0,
|
|
132
|
-
tagFilters: []
|
|
133
|
-
}, Ae = (e) => [
|
|
93
|
+
), ze = (e) => [
|
|
134
94
|
{
|
|
135
95
|
name: e("sort.popularity"),
|
|
136
96
|
value: "popularity"
|
|
@@ -143,22 +103,34 @@ const T = {
|
|
|
143
103
|
// name: t('sort.rating'),
|
|
144
104
|
// value: 'rating',
|
|
145
105
|
// },
|
|
146
|
-
],
|
|
106
|
+
], Vt = (e, r, o) => {
|
|
107
|
+
var f, m;
|
|
108
|
+
const l = kt(e), n = vt(l.search);
|
|
109
|
+
if ((f = Ct(e, { strict: !0 })) == null ? void 0 : f.endsWith(".gif"))
|
|
110
|
+
return n.imageFilter ? St({ ...l, search: "" }) : e;
|
|
111
|
+
if (n.imageFilter)
|
|
112
|
+
return e;
|
|
113
|
+
const d = (m = window.blocklet) == null ? void 0 : m.version, { w: c, h: s } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
114
|
+
return Le(e, {
|
|
115
|
+
...c || s ? { imageFilter: "resize", w: c, h: s } : {},
|
|
116
|
+
v: d
|
|
117
|
+
});
|
|
118
|
+
}, Ut = (e) => [
|
|
147
119
|
{ name: e("blocklet.free"), value: "free" },
|
|
148
120
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
149
|
-
],
|
|
121
|
+
], Gt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Ht = (e, r) => (
|
|
150
122
|
// eslint-disable-next-line no-prototype-builtins
|
|
151
|
-
e == null ? void 0 : e.replace(/{(\w*)}/g, (
|
|
152
|
-
),
|
|
153
|
-
function
|
|
154
|
-
let
|
|
155
|
-
return function(...
|
|
156
|
-
return
|
|
157
|
-
|
|
123
|
+
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, l) => r.hasOwnProperty(l) ? r[l] : "")
|
|
124
|
+
), Qt = () => window.innerWidth <= 600, Xt = (e) => wt(e).rgb().object();
|
|
125
|
+
function Yt(e, r) {
|
|
126
|
+
let o;
|
|
127
|
+
return function(...n) {
|
|
128
|
+
return o && clearTimeout(o), new Promise((a) => {
|
|
129
|
+
o = setTimeout(() => a(e(...n)), r);
|
|
158
130
|
});
|
|
159
131
|
};
|
|
160
132
|
}
|
|
161
|
-
const
|
|
133
|
+
const Jt = Yt((e) => Promise.resolve(e), 300), Kt = {
|
|
162
134
|
common: {
|
|
163
135
|
title: "Blocklet Store",
|
|
164
136
|
searchStore: "Search Blocklet",
|
|
@@ -206,7 +178,7 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
206
178
|
autocomplete: {
|
|
207
179
|
expandResult: 'View all search results for "{name}"'
|
|
208
180
|
}
|
|
209
|
-
},
|
|
181
|
+
}, Zt = {
|
|
210
182
|
common: {
|
|
211
183
|
title: "Blocklet 商店",
|
|
212
184
|
searchStore: "搜索 Blocklet",
|
|
@@ -254,16 +226,16 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
254
226
|
autocomplete: {
|
|
255
227
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
256
228
|
}
|
|
257
|
-
},
|
|
258
|
-
en: fe(
|
|
259
|
-
zh: fe(
|
|
260
|
-
},
|
|
261
|
-
const
|
|
262
|
-
return e && (
|
|
263
|
-
},
|
|
264
|
-
const
|
|
265
|
-
return
|
|
266
|
-
},
|
|
229
|
+
}, K = {
|
|
230
|
+
en: fe(Kt),
|
|
231
|
+
zh: fe(Zt)
|
|
232
|
+
}, Ae = (e, r) => {
|
|
233
|
+
const o = {};
|
|
234
|
+
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
235
|
+
}, er = (e) => (r, o) => {
|
|
236
|
+
const l = K[e] ? K[e][r] : K.en[r];
|
|
237
|
+
return Ht(l, o) || r;
|
|
238
|
+
}, Ee = {
|
|
267
239
|
errors: {
|
|
268
240
|
fetchBlockletsError: null,
|
|
269
241
|
fetchCategoriesError: null
|
|
@@ -278,8 +250,10 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
278
250
|
wrapChildren: () => null,
|
|
279
251
|
t: (e) => e,
|
|
280
252
|
storeVersion: "",
|
|
253
|
+
minItemWidth: 400,
|
|
281
254
|
serverVersion: "",
|
|
282
255
|
filters: {},
|
|
256
|
+
layout: {},
|
|
283
257
|
selectedCategory: void 0,
|
|
284
258
|
categoryList: [],
|
|
285
259
|
total: 0,
|
|
@@ -317,143 +291,158 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
317
291
|
developerName: "",
|
|
318
292
|
handleSearchSelect: () => {
|
|
319
293
|
}
|
|
320
|
-
},
|
|
321
|
-
function
|
|
322
|
-
filters: e,
|
|
323
|
-
children: o,
|
|
324
|
-
endpoint: r,
|
|
325
|
-
locale: n,
|
|
326
|
-
blockletRender: a,
|
|
327
|
-
onFilterChange: l,
|
|
328
|
-
onSearchSelect: d,
|
|
329
|
-
extraFilter: u,
|
|
330
|
-
wrapChildren: s,
|
|
331
|
-
baseSearch: v,
|
|
332
|
-
serverVersion: f,
|
|
333
|
-
storeVersion: y,
|
|
334
|
-
fetchCategoryDelay: c,
|
|
335
|
-
showResourcesSwitch: w,
|
|
336
|
-
showCategory: k,
|
|
337
|
-
tagFilters: x
|
|
338
|
-
}) {
|
|
294
|
+
}, Ne = Pe(Ee), { Provider: tr, Consumer: no } = Ne;
|
|
295
|
+
function rr(e) {
|
|
339
296
|
var ue;
|
|
340
|
-
const
|
|
297
|
+
const {
|
|
298
|
+
locale: r = "zh",
|
|
299
|
+
filters: o = {},
|
|
300
|
+
serverVersion: l = "",
|
|
301
|
+
onFilterChange: n = () => {
|
|
302
|
+
},
|
|
303
|
+
onSearchSelect: a = ({ detailUrl: i }) => {
|
|
304
|
+
window.location.href = i;
|
|
305
|
+
},
|
|
306
|
+
minItemWidth: d = 400,
|
|
307
|
+
queryFilter: c = !0,
|
|
308
|
+
layout: s = {},
|
|
309
|
+
wrapChildren: f = (i) => i,
|
|
310
|
+
extraFilter: m = (i) => i,
|
|
311
|
+
baseSearch: k = !1,
|
|
312
|
+
fetchCategoryDelay: F = 0,
|
|
313
|
+
showResourcesSwitch: R = !1,
|
|
314
|
+
showCategory: S = !0,
|
|
315
|
+
tagFilters: u = [],
|
|
316
|
+
children: x,
|
|
317
|
+
storeVersion: h,
|
|
318
|
+
endpoint: g,
|
|
319
|
+
blockletRender: v
|
|
320
|
+
} = e, _ = Ae(l, h), $ = M(() => Ie({ baseURL: g, headers: _ }), [g]), y = { sortBy: "popularity", sortDirection: "desc", ...o };
|
|
321
|
+
!y.category && !s.showExplore && (y.category = "All");
|
|
322
|
+
const N = y.category, We = gt({
|
|
341
323
|
currentPage: T.currentPage,
|
|
342
|
-
pageSize:
|
|
324
|
+
pageSize: Qt() ? T.mobilePageSize : T.pageSize,
|
|
343
325
|
defaultCurrentPage: T.defaultCurrentPage
|
|
344
|
-
}), [
|
|
345
|
-
data:
|
|
346
|
-
error:
|
|
347
|
-
loading:
|
|
326
|
+
}), [Ve, Ue] = q(null), A = qt($, y, We, Ue), {
|
|
327
|
+
data: Y = [],
|
|
328
|
+
error: Ge,
|
|
329
|
+
loading: He,
|
|
348
330
|
run: se
|
|
349
|
-
} =
|
|
350
|
-
const
|
|
351
|
-
return
|
|
352
|
-
}, [
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
331
|
+
} = Wt($), J = M(() => {
|
|
332
|
+
const i = mt(Y, [(P) => P.name], ["asc"]), b = i.findIndex((P) => P.name === "All" || P.locales.en === "All");
|
|
333
|
+
return b > -1 ? [{ ...i[b], _id: "All" }, ...i.slice(0, b), ...i.slice(b + 1)] : i;
|
|
334
|
+
}, [Y]), ce = M(
|
|
335
|
+
() => {
|
|
336
|
+
var i;
|
|
337
|
+
return m(((i = A.data) == null ? void 0 : i.list) || []) || [];
|
|
338
|
+
},
|
|
339
|
+
[A.data, m]
|
|
340
|
+
), de = Z(er(r), [r]), Qe = M(() => Gt(J, r), [J, r]), Xe = Ut(de), Ye = {
|
|
341
|
+
errors: { fetchBlockletsError: Ve, fetchCategoriesError: Ge },
|
|
357
342
|
loadings: {
|
|
358
|
-
fetchBlockletsLoading:
|
|
359
|
-
fetchCategoriesLoading:
|
|
360
|
-
loadingMore:
|
|
343
|
+
fetchBlockletsLoading: A.loading,
|
|
344
|
+
fetchCategoriesLoading: He,
|
|
345
|
+
loadingMore: A.loadingMore
|
|
346
|
+
},
|
|
347
|
+
endpoint: g,
|
|
348
|
+
queryFilter: c,
|
|
349
|
+
layout: {
|
|
350
|
+
showExplore: s.showExplore ?? !1,
|
|
351
|
+
showCategory: s.showCategory ?? !0,
|
|
352
|
+
showTitle: s.showTitle ?? !0,
|
|
353
|
+
showSearch: s.showSearch ?? !0
|
|
361
354
|
},
|
|
362
|
-
|
|
355
|
+
minItemWidth: d,
|
|
363
356
|
blockletList: ce,
|
|
364
|
-
total: ((ue =
|
|
365
|
-
wrapChildren:
|
|
357
|
+
total: ((ue = A.data) == null ? void 0 : ue.total) || 0,
|
|
358
|
+
wrapChildren: f,
|
|
366
359
|
t: de,
|
|
367
|
-
storeVersion:
|
|
368
|
-
serverVersion:
|
|
369
|
-
filters:
|
|
370
|
-
selectedCategory:
|
|
371
|
-
categoryList:
|
|
372
|
-
blockletRender:
|
|
373
|
-
locale:
|
|
374
|
-
categoryOptions:
|
|
375
|
-
priceOptions:
|
|
376
|
-
storeApi:
|
|
377
|
-
baseSearch:
|
|
378
|
-
showResourcesSwitch:
|
|
379
|
-
showCategory:
|
|
380
|
-
tagFilters:
|
|
381
|
-
hasNextPage: !
|
|
382
|
-
onFilterChange:
|
|
383
|
-
cleanFilter: (
|
|
384
|
-
const
|
|
385
|
-
|
|
360
|
+
storeVersion: h,
|
|
361
|
+
serverVersion: l,
|
|
362
|
+
filters: y,
|
|
363
|
+
selectedCategory: N,
|
|
364
|
+
categoryList: J,
|
|
365
|
+
blockletRender: v,
|
|
366
|
+
locale: r,
|
|
367
|
+
categoryOptions: Qe,
|
|
368
|
+
priceOptions: Xe,
|
|
369
|
+
storeApi: $,
|
|
370
|
+
baseSearch: k,
|
|
371
|
+
showResourcesSwitch: R,
|
|
372
|
+
showCategory: S,
|
|
373
|
+
tagFilters: u,
|
|
374
|
+
hasNextPage: !A.noMore,
|
|
375
|
+
onFilterChange: n,
|
|
376
|
+
cleanFilter: (i) => {
|
|
377
|
+
const b = i ? bt(y, (P, O) => i == null ? void 0 : i.includes(O)) : {};
|
|
378
|
+
n(b);
|
|
386
379
|
},
|
|
387
|
-
handleSort: (
|
|
388
|
-
const
|
|
389
|
-
|
|
380
|
+
handleSort: (i) => {
|
|
381
|
+
const b = { ...y, sortBy: i, sortDirection: i === "nameAsc" ? "asc" : "desc" };
|
|
382
|
+
n(b);
|
|
390
383
|
},
|
|
391
|
-
handleKeyword: (
|
|
392
|
-
const
|
|
393
|
-
|
|
384
|
+
handleKeyword: (i) => {
|
|
385
|
+
const b = { ...y, category: void 0, keyword: i || void 0 };
|
|
386
|
+
n(b);
|
|
394
387
|
},
|
|
395
|
-
handlePrice: (
|
|
396
|
-
const
|
|
397
|
-
|
|
388
|
+
handlePrice: (i) => {
|
|
389
|
+
const b = { ...y, price: i === y.price ? void 0 : i };
|
|
390
|
+
n(b);
|
|
398
391
|
},
|
|
399
|
-
handleCategory: (
|
|
400
|
-
const
|
|
401
|
-
|
|
392
|
+
handleCategory: (i) => {
|
|
393
|
+
const b = i === "all" || i === y.category ? "" : i, P = { ...y, category: b };
|
|
394
|
+
n(P);
|
|
402
395
|
},
|
|
403
|
-
handleDeveloper: (
|
|
404
|
-
const
|
|
405
|
-
|
|
396
|
+
handleDeveloper: (i) => {
|
|
397
|
+
const b = { ...y, owner: i || void 0 };
|
|
398
|
+
n(b);
|
|
406
399
|
},
|
|
407
|
-
handlePage: (
|
|
408
|
-
const
|
|
409
|
-
|
|
400
|
+
handlePage: (i) => {
|
|
401
|
+
const b = { ...y, currentPage: i };
|
|
402
|
+
n(b);
|
|
410
403
|
},
|
|
411
404
|
handleSwitchShowResources: () => {
|
|
412
|
-
const
|
|
413
|
-
|
|
405
|
+
const i = { ...y };
|
|
406
|
+
n(i);
|
|
414
407
|
},
|
|
415
|
-
loadMore:
|
|
416
|
-
getCategoryLocale: (
|
|
417
|
-
if (!
|
|
408
|
+
loadMore: A.loadMore,
|
|
409
|
+
getCategoryLocale: (i) => {
|
|
410
|
+
if (!i)
|
|
418
411
|
return null;
|
|
419
|
-
const
|
|
420
|
-
return
|
|
412
|
+
const b = Y.find((P) => P._id === i);
|
|
413
|
+
return b ? b.locales[r] || b.locales.en : null;
|
|
421
414
|
},
|
|
422
415
|
get developerName() {
|
|
423
|
-
var
|
|
424
|
-
|
|
416
|
+
var b, P;
|
|
417
|
+
const i = ce.find((O) => {
|
|
425
418
|
var pe;
|
|
426
|
-
return ((pe =
|
|
427
|
-
})
|
|
419
|
+
return ((pe = O == null ? void 0 : O.owner) == null ? void 0 : pe.did) === y.owner;
|
|
420
|
+
});
|
|
421
|
+
return ((b = i == null ? void 0 : i.owner) == null ? void 0 : b.fullName) || ((P = i == null ? void 0 : i.author) == null ? void 0 : P.name) || "";
|
|
428
422
|
},
|
|
429
|
-
handleSearchSelect:
|
|
423
|
+
handleSearchSelect: a
|
|
430
424
|
};
|
|
431
|
-
return
|
|
432
|
-
setTimeout(se,
|
|
433
|
-
}, [
|
|
425
|
+
return W(() => {
|
|
426
|
+
setTimeout(se, F || 0);
|
|
427
|
+
}, [g, se, F]), /* @__PURE__ */ t(tr, { value: Ye, children: x });
|
|
434
428
|
}
|
|
435
|
-
ne.propTypes = {
|
|
436
|
-
...ze,
|
|
437
|
-
children: i.any.isRequired
|
|
438
|
-
};
|
|
439
|
-
ne.defaultProps = _e;
|
|
440
429
|
function B() {
|
|
441
|
-
const e =
|
|
442
|
-
return e ||
|
|
430
|
+
const e = Te(Ne);
|
|
431
|
+
return e || Ee;
|
|
443
432
|
}
|
|
444
|
-
function
|
|
433
|
+
function De({
|
|
445
434
|
children: e,
|
|
446
|
-
onClick:
|
|
447
|
-
size:
|
|
435
|
+
onClick: r,
|
|
436
|
+
size: o = 32
|
|
448
437
|
}) {
|
|
449
438
|
return /* @__PURE__ */ t(
|
|
450
|
-
|
|
439
|
+
te,
|
|
451
440
|
{
|
|
452
|
-
onClick:
|
|
441
|
+
onClick: r,
|
|
453
442
|
variant: "outlined",
|
|
454
443
|
sx: {
|
|
455
|
-
minWidth:
|
|
456
|
-
height:
|
|
444
|
+
minWidth: o,
|
|
445
|
+
height: o,
|
|
457
446
|
p: 0,
|
|
458
447
|
borderColor: "divider",
|
|
459
448
|
"&:hover": {
|
|
@@ -466,51 +455,51 @@ function Me({
|
|
|
466
455
|
}
|
|
467
456
|
);
|
|
468
457
|
}
|
|
469
|
-
function V(e,
|
|
470
|
-
return e === void 0 ?
|
|
458
|
+
function V(e, r) {
|
|
459
|
+
return e === void 0 ? r : e;
|
|
471
460
|
}
|
|
472
|
-
function
|
|
461
|
+
function Q({
|
|
473
462
|
xs: e,
|
|
474
|
-
sm:
|
|
475
|
-
md:
|
|
476
|
-
lg:
|
|
477
|
-
xl:
|
|
478
|
-
exact:
|
|
463
|
+
sm: r,
|
|
464
|
+
md: o,
|
|
465
|
+
lg: l,
|
|
466
|
+
xl: n,
|
|
467
|
+
exact: a
|
|
479
468
|
}) {
|
|
480
|
-
const d =
|
|
481
|
-
if (
|
|
482
|
-
return
|
|
483
|
-
let
|
|
484
|
-
return
|
|
469
|
+
const d = ve(), c = D(d.breakpoints.down("sm")), s = D(d.breakpoints.between("sm", "md")), f = D(d.breakpoints.between("md", "lg")), m = D(d.breakpoints.between("lg", "xl"));
|
|
470
|
+
if (a)
|
|
471
|
+
return c ? e || null : s ? r || null : f ? o || null : m ? l || null : n || null;
|
|
472
|
+
let k = e;
|
|
473
|
+
return c || (k = V(r, k), s) || (k = V(o, k), f) || (k = V(l, k), m) ? k : V(n, k);
|
|
485
474
|
}
|
|
486
|
-
function
|
|
487
|
-
const { open:
|
|
475
|
+
function or({ children: e }) {
|
|
476
|
+
const { open: r, toggleOpen: o } = ne();
|
|
488
477
|
return /* @__PURE__ */ t(
|
|
489
|
-
|
|
478
|
+
Q,
|
|
490
479
|
{
|
|
491
|
-
xs: /* @__PURE__ */ t(
|
|
492
|
-
md: /* @__PURE__ */ t(
|
|
480
|
+
xs: /* @__PURE__ */ t(Je, { open: r, onClose: () => o(!1), children: e }),
|
|
481
|
+
md: /* @__PURE__ */ t(C, { children: e })
|
|
493
482
|
}
|
|
494
483
|
);
|
|
495
484
|
}
|
|
496
|
-
const
|
|
485
|
+
const nr = E(te)`
|
|
497
486
|
border-radius: 4px;
|
|
498
|
-
`, le =
|
|
499
|
-
|
|
487
|
+
`, le = dt(({ children: e, rounded: r, loading: o, disabled: l, ...n }, a) => /* @__PURE__ */ t(
|
|
488
|
+
nr,
|
|
500
489
|
{
|
|
501
|
-
ref:
|
|
490
|
+
ref: a,
|
|
502
491
|
disableElevation: !0,
|
|
503
|
-
disabled:
|
|
504
|
-
...
|
|
505
|
-
startIcon:
|
|
492
|
+
disabled: l || o,
|
|
493
|
+
...n,
|
|
494
|
+
startIcon: o && /* @__PURE__ */ t(re, { size: "1em" }),
|
|
506
495
|
children: e
|
|
507
496
|
}
|
|
508
497
|
));
|
|
509
498
|
le.propTypes = {
|
|
510
|
-
children:
|
|
511
|
-
rounded:
|
|
512
|
-
loading:
|
|
513
|
-
disabled:
|
|
499
|
+
children: w.any,
|
|
500
|
+
rounded: w.bool,
|
|
501
|
+
loading: w.bool,
|
|
502
|
+
disabled: w.bool
|
|
514
503
|
};
|
|
515
504
|
le.defaultProps = {
|
|
516
505
|
children: null,
|
|
@@ -518,67 +507,67 @@ le.defaultProps = {
|
|
|
518
507
|
loading: !1,
|
|
519
508
|
disabled: !1
|
|
520
509
|
};
|
|
521
|
-
function
|
|
522
|
-
const s =
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}, [
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
}, []),
|
|
529
|
-
|
|
510
|
+
function X({ title: e, value: r, icon: o, prepend: l, options: n, onChange: a, itemRender: d, ...c }) {
|
|
511
|
+
const s = G(null), f = xe(), [m, k] = q(!1), [F, R] = q(r !== null ? r : ""), S = D(f.breakpoints.down("sm"));
|
|
512
|
+
W(() => {
|
|
513
|
+
R(r !== null ? r : "");
|
|
514
|
+
}, [r]);
|
|
515
|
+
const u = Z(() => {
|
|
516
|
+
k(!1);
|
|
517
|
+
}, []), x = Z(() => {
|
|
518
|
+
k(!0);
|
|
530
519
|
}, []);
|
|
531
|
-
function
|
|
532
|
-
|
|
520
|
+
function h(v) {
|
|
521
|
+
R(v.value), a(v.value), S && u();
|
|
533
522
|
}
|
|
534
|
-
function
|
|
535
|
-
return
|
|
523
|
+
function g(v) {
|
|
524
|
+
return v === F;
|
|
536
525
|
}
|
|
537
|
-
return /* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
|
|
526
|
+
return /* @__PURE__ */ p(z, { children: [
|
|
527
|
+
/* @__PURE__ */ p(
|
|
528
|
+
lr,
|
|
540
529
|
{
|
|
541
530
|
ref: s,
|
|
542
|
-
onClick:
|
|
531
|
+
onClick: x,
|
|
543
532
|
variant: "outlined",
|
|
544
533
|
size: "small",
|
|
545
|
-
className: ["my-select__selector",
|
|
534
|
+
className: ["my-select__selector", Pt(F) ? "" : "my-select__selector--active"].join(" "),
|
|
546
535
|
sx: { minWidth: "auto" },
|
|
547
|
-
...
|
|
536
|
+
...c,
|
|
548
537
|
children: [
|
|
549
|
-
/* @__PURE__ */ t("div", { className: "my-select__icon", children:
|
|
538
|
+
/* @__PURE__ */ t("div", { className: "my-select__icon", children: o }),
|
|
550
539
|
e,
|
|
551
|
-
/* @__PURE__ */ t(
|
|
540
|
+
/* @__PURE__ */ t(Ze, { className: "my-select__arrowdown", component: Rt, fontSize: "small" })
|
|
552
541
|
]
|
|
553
542
|
}
|
|
554
543
|
),
|
|
555
|
-
/* @__PURE__ */ t(
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
544
|
+
/* @__PURE__ */ t(et, { open: m, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: v, placement: _ }) => /* @__PURE__ */ t(tt, { ...v, sx: { transformOrigin: _ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t(ot, { onClickAway: u, children: /* @__PURE__ */ p(ar, { autoFocusItem: m, onMouseEnter: x, onMouseLeave: u, children: [
|
|
545
|
+
l,
|
|
546
|
+
n.map(($) => d ? d($) : /* @__PURE__ */ t(
|
|
547
|
+
nt,
|
|
559
548
|
{
|
|
560
|
-
onClick: () =>
|
|
549
|
+
onClick: () => h($),
|
|
561
550
|
className: [
|
|
562
551
|
"my-select__option",
|
|
563
|
-
|
|
552
|
+
g($.value) ? "my-select__option--active" : ""
|
|
564
553
|
].join(" "),
|
|
565
|
-
children:
|
|
554
|
+
children: $.name
|
|
566
555
|
},
|
|
567
|
-
|
|
556
|
+
$.value
|
|
568
557
|
))
|
|
569
558
|
] }) }) }) }) })
|
|
570
559
|
] });
|
|
571
560
|
}
|
|
572
|
-
|
|
573
|
-
options:
|
|
574
|
-
value:
|
|
575
|
-
onChange:
|
|
576
|
-
itemRender:
|
|
577
|
-
title:
|
|
578
|
-
icon:
|
|
579
|
-
prepend:
|
|
561
|
+
X.propTypes = {
|
|
562
|
+
options: w.array.isRequired,
|
|
563
|
+
value: w.oneOfType([w.string, w.number, w.array]),
|
|
564
|
+
onChange: w.func,
|
|
565
|
+
itemRender: w.func,
|
|
566
|
+
title: w.string.isRequired,
|
|
567
|
+
icon: w.any,
|
|
568
|
+
prepend: w.any
|
|
580
569
|
};
|
|
581
|
-
|
|
570
|
+
X.defaultProps = {
|
|
582
571
|
value: null,
|
|
583
572
|
icon: null,
|
|
584
573
|
prepend: null,
|
|
@@ -586,7 +575,7 @@ Q.defaultProps = {
|
|
|
586
575
|
onChange: () => {
|
|
587
576
|
}
|
|
588
577
|
};
|
|
589
|
-
const
|
|
578
|
+
const lr = E(le)`
|
|
590
579
|
border: 1px solid #f0f0f0;
|
|
591
580
|
padding: 6px 8px 6px 12px;
|
|
592
581
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -617,7 +606,7 @@ const Jt = D(le)`
|
|
|
617
606
|
margin-right: 3px;
|
|
618
607
|
}
|
|
619
608
|
}
|
|
620
|
-
`,
|
|
609
|
+
`, ar = E(Ke)`
|
|
621
610
|
.my-select__option__icon {
|
|
622
611
|
color: transparent;
|
|
623
612
|
font-size: 14px;
|
|
@@ -634,10 +623,10 @@ const Jt = D(le)`
|
|
|
634
623
|
}
|
|
635
624
|
}
|
|
636
625
|
`;
|
|
637
|
-
function
|
|
626
|
+
function Me() {
|
|
638
627
|
var d;
|
|
639
|
-
const { filters: e, handleSort:
|
|
640
|
-
return /* @__PURE__ */
|
|
628
|
+
const { filters: e, handleSort: r, handlePrice: o, t: l } = B(), n = ze(l), a = ((d = n.find((c) => c.value === e.sortBy)) == null ? void 0 : d.name) || l("sort.sort");
|
|
629
|
+
return /* @__PURE__ */ p(
|
|
641
630
|
I,
|
|
642
631
|
{
|
|
643
632
|
direction: { xs: "row", md: "column" },
|
|
@@ -647,27 +636,27 @@ function Ne() {
|
|
|
647
636
|
justifyContent: "space-between",
|
|
648
637
|
children: [
|
|
649
638
|
/* @__PURE__ */ t(
|
|
650
|
-
|
|
639
|
+
Ce,
|
|
651
640
|
{
|
|
652
641
|
control: /* @__PURE__ */ t(
|
|
653
|
-
|
|
642
|
+
Se,
|
|
654
643
|
{
|
|
655
644
|
checked: e.price === "free",
|
|
656
645
|
size: "small",
|
|
657
646
|
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
658
|
-
onChange: (
|
|
647
|
+
onChange: (c) => o(c.target.checked ? "free" : "")
|
|
659
648
|
}
|
|
660
649
|
),
|
|
661
|
-
label:
|
|
650
|
+
label: l("blocklet.free")
|
|
662
651
|
}
|
|
663
652
|
),
|
|
664
653
|
/* @__PURE__ */ t(
|
|
665
|
-
|
|
654
|
+
X,
|
|
666
655
|
{
|
|
667
656
|
value: e.sortBy,
|
|
668
|
-
options:
|
|
669
|
-
title:
|
|
670
|
-
onChange:
|
|
657
|
+
options: n,
|
|
658
|
+
title: a,
|
|
659
|
+
onChange: r,
|
|
671
660
|
icon: null,
|
|
672
661
|
prepend: null,
|
|
673
662
|
itemRender: null
|
|
@@ -677,13 +666,13 @@ function Ne() {
|
|
|
677
666
|
}
|
|
678
667
|
);
|
|
679
668
|
}
|
|
680
|
-
function
|
|
681
|
-
const { selectedCategory: e, handleCategory:
|
|
682
|
-
return /* @__PURE__ */
|
|
669
|
+
function ir() {
|
|
670
|
+
const { selectedCategory: e, handleCategory: r, t: o, categoryOptions: l, filters: n, cleanFilter: a, loadings: d, layout: c } = B(), { toggleOpen: s } = ne();
|
|
671
|
+
return c.showCategory ? /* @__PURE__ */ p(or, { children: [
|
|
683
672
|
/* @__PURE__ */ t(
|
|
684
|
-
|
|
673
|
+
Q,
|
|
685
674
|
{
|
|
686
|
-
xs: /* @__PURE__ */
|
|
675
|
+
xs: /* @__PURE__ */ p(
|
|
687
676
|
I,
|
|
688
677
|
{
|
|
689
678
|
direction: "row",
|
|
@@ -695,7 +684,7 @@ function Zt() {
|
|
|
695
684
|
borderBottom: 1,
|
|
696
685
|
borderColor: "divider",
|
|
697
686
|
children: [
|
|
698
|
-
/* @__PURE__ */ t(
|
|
687
|
+
/* @__PURE__ */ t(De, { onClick: () => s(!1), children: /* @__PURE__ */ t(Re, {}) }),
|
|
699
688
|
/* @__PURE__ */ t(L, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
|
|
700
689
|
]
|
|
701
690
|
}
|
|
@@ -711,9 +700,9 @@ function Zt() {
|
|
|
711
700
|
boxSizing: "content-box",
|
|
712
701
|
p: { xs: 2, md: 0 },
|
|
713
702
|
pr: { md: 6 },
|
|
714
|
-
children:
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */ t(
|
|
703
|
+
children: n.keyword ? /* @__PURE__ */ t(Me, {}) : /* @__PURE__ */ p(z, { children: [
|
|
704
|
+
c.showExplore && /* @__PURE__ */ p(C, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
705
|
+
/* @__PURE__ */ t(Be, { icon: ct }),
|
|
717
706
|
/* @__PURE__ */ t(
|
|
718
707
|
L,
|
|
719
708
|
{
|
|
@@ -722,59 +711,59 @@ function Zt() {
|
|
|
722
711
|
fontWeight: e ? void 0 : "fontWeightMedium",
|
|
723
712
|
sx: { cursor: "pointer" },
|
|
724
713
|
onClick: () => {
|
|
725
|
-
|
|
714
|
+
s(!1), a();
|
|
726
715
|
},
|
|
727
|
-
children:
|
|
716
|
+
children: o("explore.title")
|
|
728
717
|
}
|
|
729
718
|
)
|
|
730
719
|
] }),
|
|
731
|
-
!!
|
|
720
|
+
!!l.length && /* @__PURE__ */ t(I, { gap: 2, children: l.map((f) => /* @__PURE__ */ t(
|
|
732
721
|
L,
|
|
733
722
|
{
|
|
734
723
|
variant: "body1",
|
|
735
|
-
title:
|
|
724
|
+
title: f.name,
|
|
736
725
|
sx: { cursor: "pointer" },
|
|
737
726
|
"data-cy": "filter",
|
|
738
|
-
color: e ===
|
|
727
|
+
color: e === f.value ? "text.primary" : "text.lighter",
|
|
739
728
|
textTransform: "capitalize",
|
|
740
729
|
onClick: () => {
|
|
741
|
-
e ===
|
|
730
|
+
e === f.value ? a() : r(f.value), s(!1);
|
|
742
731
|
},
|
|
743
|
-
children:
|
|
732
|
+
children: f.name
|
|
744
733
|
},
|
|
745
|
-
|
|
734
|
+
f.value
|
|
746
735
|
)) })
|
|
747
736
|
] })
|
|
748
737
|
}
|
|
749
738
|
)
|
|
750
|
-
] });
|
|
739
|
+
] }) : null;
|
|
751
740
|
}
|
|
752
741
|
function Oe() {
|
|
753
|
-
const { endpoint: e, serverVersion:
|
|
742
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = B(), l = Ae(r, o), n = M(() => Ie({
|
|
754
743
|
baseURL: e,
|
|
755
|
-
headers:
|
|
744
|
+
headers: l
|
|
756
745
|
}), [e]);
|
|
757
746
|
return {
|
|
758
|
-
get: async (
|
|
759
|
-
const { data: d } = await
|
|
747
|
+
get: async (a) => {
|
|
748
|
+
const { data: d } = await n.get(a);
|
|
760
749
|
return d;
|
|
761
750
|
},
|
|
762
|
-
post: async (
|
|
763
|
-
const { data:
|
|
764
|
-
return
|
|
751
|
+
post: async (a, d) => {
|
|
752
|
+
const { data: c } = await n.post(a, d);
|
|
753
|
+
return c;
|
|
765
754
|
}
|
|
766
755
|
};
|
|
767
756
|
}
|
|
768
|
-
const
|
|
769
|
-
return /* @__PURE__ */ t(
|
|
757
|
+
const je = ut(function(r) {
|
|
758
|
+
return /* @__PURE__ */ t(Fe, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(re, {}) });
|
|
770
759
|
});
|
|
771
760
|
function ge({
|
|
772
761
|
icon: e,
|
|
773
|
-
children:
|
|
774
|
-
maxWidth:
|
|
775
|
-
title:
|
|
762
|
+
children: r,
|
|
763
|
+
maxWidth: o = 100,
|
|
764
|
+
title: l
|
|
776
765
|
}) {
|
|
777
|
-
return (
|
|
766
|
+
return (r === 0 || r) && /* @__PURE__ */ p(I, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
|
|
778
767
|
e,
|
|
779
768
|
/* @__PURE__ */ t(
|
|
780
769
|
L,
|
|
@@ -782,19 +771,23 @@ function ge({
|
|
|
782
771
|
flex: 1,
|
|
783
772
|
variant: "body2",
|
|
784
773
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
785
|
-
title:
|
|
786
|
-
children:
|
|
774
|
+
title: l || (typeof r == "string" ? r : void 0),
|
|
775
|
+
children: r
|
|
787
776
|
}
|
|
788
777
|
)
|
|
789
778
|
] });
|
|
790
779
|
}
|
|
791
780
|
const ye = 292;
|
|
792
|
-
function
|
|
793
|
-
var
|
|
794
|
-
const { t: e } = B(), {
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
|
|
781
|
+
function sr() {
|
|
782
|
+
var R, S;
|
|
783
|
+
const { t: e } = B(), { get: r } = Oe(), o = ve(), l = D(o.breakpoints.down("md")), n = ((S = (R = window.blocklet) == null ? void 0 : R.preferences) == null ? void 0 : S.homeBanner) || [], { data: a = [], error: d } = oe(async () => {
|
|
784
|
+
const u = await r(
|
|
785
|
+
Le(T.blockletsPath, { didList: n.map((x) => x.did).join(",") })
|
|
786
|
+
);
|
|
787
|
+
return u != null && u.dataList ? n.map((x) => u.dataList.find((h) => h.did === x.did)) : [];
|
|
788
|
+
});
|
|
789
|
+
d && console.error("Get Banner Blocklets error:", d);
|
|
790
|
+
const c = {
|
|
798
791
|
position: "absolute",
|
|
799
792
|
top: "50%",
|
|
800
793
|
transform: "translateY(-50%)",
|
|
@@ -802,10 +795,10 @@ function er() {
|
|
|
802
795
|
cursor: "pointer",
|
|
803
796
|
color: "text.lighter"
|
|
804
797
|
};
|
|
805
|
-
return
|
|
798
|
+
return !d && n.length > 0 ? /* @__PURE__ */ p(z, { children: [
|
|
806
799
|
/* @__PURE__ */ t(L, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
807
|
-
/* @__PURE__ */ t(
|
|
808
|
-
|
|
800
|
+
/* @__PURE__ */ t(C, { height: { xs: "auto", md: ye }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
|
|
801
|
+
_t,
|
|
809
802
|
{
|
|
810
803
|
showNav: !0,
|
|
811
804
|
autoPlay: !0,
|
|
@@ -816,14 +809,14 @@ function er() {
|
|
|
816
809
|
showBullets: !1,
|
|
817
810
|
showThumbnails: !1,
|
|
818
811
|
showFullscreenButton: !1,
|
|
819
|
-
renderLeftNav: (
|
|
820
|
-
renderRightNav: (
|
|
821
|
-
items:
|
|
822
|
-
original:
|
|
812
|
+
renderLeftNav: (u) => /* @__PURE__ */ t(C, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Ft, { sx: { ...c, left: 5 } }) }),
|
|
813
|
+
renderRightNav: (u) => /* @__PURE__ */ t(C, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t($t, { sx: { ...c, right: 5 } }) }),
|
|
814
|
+
items: n.map((u, x) => ({
|
|
815
|
+
original: u.did,
|
|
823
816
|
renderItem: () => {
|
|
824
|
-
var
|
|
825
|
-
const
|
|
826
|
-
return /* @__PURE__ */
|
|
817
|
+
var g;
|
|
818
|
+
const h = a[x] || {};
|
|
819
|
+
return /* @__PURE__ */ p(
|
|
827
820
|
I,
|
|
828
821
|
{
|
|
829
822
|
height: { xs: "auto", md: ye },
|
|
@@ -834,14 +827,14 @@ function er() {
|
|
|
834
827
|
p: { xs: 2, md: 5 },
|
|
835
828
|
gap: { xs: 2, md: 5 },
|
|
836
829
|
children: [
|
|
837
|
-
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
|
|
841
|
-
u
|
|
830
|
+
s(u.cover || dr(u.did, (g = h.screenshots) == null ? void 0 : g[0])),
|
|
831
|
+
/* @__PURE__ */ p(I, { flex: 1, height: "100%", gap: 3, children: [
|
|
832
|
+
/* @__PURE__ */ p(C, { flex: 1, children: [
|
|
833
|
+
f(u.name || h.title || u.name),
|
|
834
|
+
m(u.desc || h.description)
|
|
842
835
|
] }),
|
|
843
|
-
|
|
844
|
-
|
|
836
|
+
h.did && k(h, u.baseNum),
|
|
837
|
+
F(u.link, u.did)
|
|
845
838
|
] })
|
|
846
839
|
]
|
|
847
840
|
}
|
|
@@ -851,13 +844,22 @@ function er() {
|
|
|
851
844
|
}
|
|
852
845
|
) })
|
|
853
846
|
] }) : null;
|
|
854
|
-
function
|
|
855
|
-
return /* @__PURE__ */ t(
|
|
847
|
+
function s(u) {
|
|
848
|
+
return /* @__PURE__ */ t(C, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
|
|
849
|
+
It,
|
|
850
|
+
{
|
|
851
|
+
src: Vt(u, { h: 400, w: 700 }),
|
|
852
|
+
alt: "",
|
|
853
|
+
width: l ? void 0 : 338,
|
|
854
|
+
height: 210,
|
|
855
|
+
style: { objectFit: "cover" }
|
|
856
|
+
}
|
|
857
|
+
) });
|
|
856
858
|
}
|
|
857
|
-
function
|
|
858
|
-
return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children:
|
|
859
|
+
function f(u) {
|
|
860
|
+
return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children: u });
|
|
859
861
|
}
|
|
860
|
-
function u
|
|
862
|
+
function m(u) {
|
|
861
863
|
return /* @__PURE__ */ t(
|
|
862
864
|
L,
|
|
863
865
|
{
|
|
@@ -875,20 +877,20 @@ function er() {
|
|
|
875
877
|
overflow: "hidden",
|
|
876
878
|
WebkitBoxOrient: "vertical"
|
|
877
879
|
},
|
|
878
|
-
children:
|
|
880
|
+
children: u
|
|
879
881
|
}
|
|
880
882
|
);
|
|
881
883
|
}
|
|
882
|
-
function
|
|
883
|
-
const { did:
|
|
884
|
-
return /* @__PURE__ */
|
|
885
|
-
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(
|
|
886
|
-
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(
|
|
884
|
+
function k(u, x = 0) {
|
|
885
|
+
const { did: h, owner: g, stats: v } = u;
|
|
886
|
+
return /* @__PURE__ */ p(C, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
887
|
+
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Tt, { src: g.avatar, did: h, size: 20, variant: "circle" }), children: g.fullName }),
|
|
888
|
+
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Be, { icon: Lt }), title: `${v.downloads + x}`, children: cr(v.downloads + x) })
|
|
887
889
|
] });
|
|
888
890
|
}
|
|
889
|
-
function
|
|
890
|
-
return /* @__PURE__ */ t(
|
|
891
|
-
|
|
891
|
+
function F(u, x) {
|
|
892
|
+
return /* @__PURE__ */ t(lt, { href: u || `/blocklets/${x}`, align: "left", width: 100, children: /* @__PURE__ */ t(
|
|
893
|
+
te,
|
|
892
894
|
{
|
|
893
895
|
variant: "outlined",
|
|
894
896
|
size: "small",
|
|
@@ -903,34 +905,34 @@ function er() {
|
|
|
903
905
|
) });
|
|
904
906
|
}
|
|
905
907
|
}
|
|
906
|
-
const
|
|
907
|
-
function
|
|
908
|
-
const { blockletRender:
|
|
909
|
-
return /* @__PURE__ */
|
|
908
|
+
const cr = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`, dr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
909
|
+
function ur({ title: e, blocklets: r }) {
|
|
910
|
+
const { blockletRender: o, serverVersion: l } = B();
|
|
911
|
+
return /* @__PURE__ */ p(C, { mt: 3, children: [
|
|
910
912
|
/* @__PURE__ */ t(L, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
911
|
-
/* @__PURE__ */ t(
|
|
913
|
+
/* @__PURE__ */ t(he, { container: !0, spacing: 2, children: r.map((n) => /* @__PURE__ */ t(he, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": n.did, children: /* @__PURE__ */ t(C, { padding: "1px", children: o({ blocklet: n, blocklets: r, serverVersion: l }) }) }, n.did)) })
|
|
912
914
|
] });
|
|
913
915
|
}
|
|
914
|
-
function
|
|
915
|
-
const { get: e } = Oe(), { t:
|
|
916
|
-
data:
|
|
917
|
-
error:
|
|
918
|
-
loading:
|
|
919
|
-
} =
|
|
920
|
-
const
|
|
921
|
-
return Array.isArray(
|
|
916
|
+
function pr() {
|
|
917
|
+
const { get: e } = Oe(), { t: r } = B(), {
|
|
918
|
+
data: o = [],
|
|
919
|
+
error: l,
|
|
920
|
+
loading: n
|
|
921
|
+
} = oe(async () => {
|
|
922
|
+
const a = await e(T.explorePath);
|
|
923
|
+
return Array.isArray(a) ? a : [];
|
|
922
924
|
});
|
|
923
|
-
return
|
|
924
|
-
/* @__PURE__ */ t(
|
|
925
|
-
|
|
926
|
-
(
|
|
925
|
+
return l ? /* @__PURE__ */ t(ee, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : n ? /* @__PURE__ */ t(je, { mt: 15 }) : /* @__PURE__ */ p(z, { children: [
|
|
926
|
+
/* @__PURE__ */ t(sr, {}),
|
|
927
|
+
o.map(
|
|
928
|
+
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(ur, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
927
929
|
)
|
|
928
930
|
] });
|
|
929
931
|
}
|
|
930
|
-
function
|
|
931
|
-
var
|
|
932
|
-
const { filters: e, handleSort:
|
|
933
|
-
return /* @__PURE__ */
|
|
932
|
+
function hr() {
|
|
933
|
+
var f;
|
|
934
|
+
const { filters: e, handleSort: r, handlePrice: o, t: l, getCategoryLocale: n, developerName: a, handleDeveloper: d } = B(), c = ze(l), s = ((f = c.find((m) => m.value === e.sortBy)) == null ? void 0 : f.name) || l("sort.sort");
|
|
935
|
+
return /* @__PURE__ */ p(
|
|
934
936
|
I,
|
|
935
937
|
{
|
|
936
938
|
direction: { xs: "column", md: "row" },
|
|
@@ -941,134 +943,147 @@ function lr() {
|
|
|
941
943
|
px: 0,
|
|
942
944
|
pb: 3,
|
|
943
945
|
children: [
|
|
944
|
-
/* @__PURE__ */ t(L, { variant: "h2", textTransform: "capitalize", children:
|
|
945
|
-
/* @__PURE__ */
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
946
|
+
/* @__PURE__ */ t(L, { variant: "h2", textTransform: "capitalize", children: n(e.category) }),
|
|
947
|
+
/* @__PURE__ */ p(
|
|
948
|
+
I,
|
|
949
|
+
{
|
|
950
|
+
direction: "row",
|
|
951
|
+
alignItems: "center",
|
|
952
|
+
width: { xs: "100%", md: "auto" },
|
|
953
|
+
justifyContent: "space-between",
|
|
954
|
+
gap: 2,
|
|
955
|
+
children: [
|
|
956
|
+
e.owner && /* @__PURE__ */ t(at, { label: a, size: "small", onDelete: () => d("") }),
|
|
957
|
+
/* @__PURE__ */ t(
|
|
950
958
|
Ce,
|
|
951
959
|
{
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
960
|
+
sx: { m: 0 },
|
|
961
|
+
control: /* @__PURE__ */ t(
|
|
962
|
+
Se,
|
|
963
|
+
{
|
|
964
|
+
checked: e.price === "free",
|
|
965
|
+
size: "small",
|
|
966
|
+
sx: { p: 0, pr: 1, "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
967
|
+
onChange: (m) => o(m.target.checked ? "free" : "")
|
|
968
|
+
}
|
|
969
|
+
),
|
|
970
|
+
label: l("blocklet.free")
|
|
956
971
|
}
|
|
957
972
|
),
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
] })
|
|
973
|
+
/* @__PURE__ */ t(
|
|
974
|
+
X,
|
|
975
|
+
{
|
|
976
|
+
value: e.sortBy,
|
|
977
|
+
options: c,
|
|
978
|
+
title: s,
|
|
979
|
+
onChange: r,
|
|
980
|
+
icon: null,
|
|
981
|
+
prepend: null,
|
|
982
|
+
itemRender: null
|
|
983
|
+
}
|
|
984
|
+
)
|
|
985
|
+
]
|
|
986
|
+
}
|
|
987
|
+
)
|
|
974
988
|
]
|
|
975
989
|
}
|
|
976
990
|
);
|
|
977
991
|
}
|
|
978
992
|
function be() {
|
|
979
993
|
const { t: e } = B();
|
|
980
|
-
return /* @__PURE__ */ t(
|
|
994
|
+
return /* @__PURE__ */ t($e, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
981
995
|
}
|
|
982
|
-
function
|
|
983
|
-
const { t:
|
|
984
|
-
return /* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children:
|
|
986
|
-
e && /* @__PURE__ */ t("span", { children:
|
|
987
|
-
e &&
|
|
988
|
-
|
|
996
|
+
function j({ filterTip: e, keywordTip: r }) {
|
|
997
|
+
const { t: o, locale: l } = B(), n = () => l === "zh" ? "、" : " , ";
|
|
998
|
+
return /* @__PURE__ */ p(Fe, { className: "tips", children: [
|
|
999
|
+
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1000
|
+
e && /* @__PURE__ */ t("span", { children: o("blocklet.filterTip") }),
|
|
1001
|
+
e && r && n(),
|
|
1002
|
+
r && /* @__PURE__ */ t("span", { children: o("blocklet.keywordTip") })
|
|
989
1003
|
] });
|
|
990
1004
|
}
|
|
991
|
-
|
|
992
|
-
filterTip:
|
|
993
|
-
keywordTip:
|
|
1005
|
+
j.propTypes = {
|
|
1006
|
+
filterTip: w.bool,
|
|
1007
|
+
keywordTip: w.bool
|
|
994
1008
|
};
|
|
995
|
-
|
|
1009
|
+
j.defaultProps = {
|
|
996
1010
|
filterTip: !1,
|
|
997
1011
|
keywordTip: !1
|
|
998
1012
|
};
|
|
999
|
-
function H({ primaryStart: e, primaryEnd:
|
|
1000
|
-
return /* @__PURE__ */
|
|
1013
|
+
function H({ primaryStart: e, primaryEnd: r, filter: o }) {
|
|
1014
|
+
return /* @__PURE__ */ p($e, { variant: "subtitle2", children: [
|
|
1001
1015
|
/* @__PURE__ */ t("span", { children: e }),
|
|
1002
|
-
/* @__PURE__ */
|
|
1016
|
+
/* @__PURE__ */ p("span", { className: "primary", children: [
|
|
1003
1017
|
" ",
|
|
1004
|
-
|
|
1018
|
+
o,
|
|
1005
1019
|
" "
|
|
1006
1020
|
] }),
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
|
|
1021
|
+
/* @__PURE__ */ p("span", { children: [
|
|
1022
|
+
r,
|
|
1009
1023
|
" "
|
|
1010
1024
|
] })
|
|
1011
1025
|
] });
|
|
1012
1026
|
}
|
|
1013
1027
|
H.propTypes = {
|
|
1014
|
-
primaryStart:
|
|
1015
|
-
primaryEnd:
|
|
1016
|
-
filter:
|
|
1028
|
+
primaryStart: w.string.isRequired,
|
|
1029
|
+
primaryEnd: w.string.isRequired,
|
|
1030
|
+
filter: w.string.isRequired
|
|
1017
1031
|
};
|
|
1018
|
-
function
|
|
1032
|
+
function qe({ blocklets: e, ...r }) {
|
|
1019
1033
|
const {
|
|
1020
|
-
blockletRender:
|
|
1021
|
-
errors:
|
|
1022
|
-
loadings:
|
|
1023
|
-
selectedCategory:
|
|
1034
|
+
blockletRender: o,
|
|
1035
|
+
errors: l,
|
|
1036
|
+
loadings: n,
|
|
1037
|
+
selectedCategory: a,
|
|
1024
1038
|
getCategoryLocale: d,
|
|
1025
|
-
filters:
|
|
1039
|
+
filters: c,
|
|
1026
1040
|
t: s,
|
|
1027
|
-
serverVersion:
|
|
1028
|
-
hasNextPage:
|
|
1029
|
-
loadMore:
|
|
1030
|
-
endpoint:
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1041
|
+
serverVersion: f,
|
|
1042
|
+
hasNextPage: m,
|
|
1043
|
+
loadMore: k,
|
|
1044
|
+
endpoint: F,
|
|
1045
|
+
minItemWidth: R
|
|
1046
|
+
} = B(), S = !!a || !!c.price, [u] = At({
|
|
1047
|
+
loading: n.fetchBlockletsLoading || n.loadingMore,
|
|
1048
|
+
hasNextPage: m,
|
|
1049
|
+
onLoadMore: k
|
|
1035
1050
|
});
|
|
1036
|
-
if (
|
|
1051
|
+
if (l.fetchBlockletsError)
|
|
1037
1052
|
return /* @__PURE__ */ t(
|
|
1038
|
-
|
|
1053
|
+
ee,
|
|
1039
1054
|
{
|
|
1040
|
-
error: new Error(`Failed to fetch blocklets from ${
|
|
1055
|
+
error: new Error(`Failed to fetch blocklets from ${F}: ${l.fetchBlockletsError.message}`)
|
|
1041
1056
|
}
|
|
1042
1057
|
);
|
|
1043
|
-
if (
|
|
1044
|
-
return /* @__PURE__ */ t(
|
|
1045
|
-
if (
|
|
1046
|
-
return /* @__PURE__ */
|
|
1058
|
+
if (n.fetchBlockletsLoading)
|
|
1059
|
+
return /* @__PURE__ */ t(je, { mt: 15 });
|
|
1060
|
+
if (c.keyword && S && e.length === 0)
|
|
1061
|
+
return /* @__PURE__ */ p(U, { children: [
|
|
1047
1062
|
/* @__PURE__ */ t(
|
|
1048
1063
|
H,
|
|
1049
1064
|
{
|
|
1050
1065
|
primaryStart: s("blocklet.noBlockletPart1"),
|
|
1051
1066
|
primaryEnd: s("blocklet.noBlockletPart2"),
|
|
1052
|
-
filter:
|
|
1067
|
+
filter: c.keyword
|
|
1053
1068
|
}
|
|
1054
1069
|
),
|
|
1055
|
-
/* @__PURE__ */ t(
|
|
1070
|
+
/* @__PURE__ */ t(j, { keywordTip: !0, filterTip: !0 })
|
|
1056
1071
|
] });
|
|
1057
|
-
if (
|
|
1058
|
-
return /* @__PURE__ */
|
|
1072
|
+
if (c.keyword && e.length === 0)
|
|
1073
|
+
return /* @__PURE__ */ p(U, { children: [
|
|
1059
1074
|
/* @__PURE__ */ t(
|
|
1060
1075
|
H,
|
|
1061
1076
|
{
|
|
1062
1077
|
primaryStart: s("blocklet.noBlockletPart1"),
|
|
1063
1078
|
primaryEnd: s("blocklet.noBlockletPart2"),
|
|
1064
|
-
filter:
|
|
1079
|
+
filter: c.keyword
|
|
1065
1080
|
}
|
|
1066
1081
|
),
|
|
1067
|
-
/* @__PURE__ */ t(
|
|
1082
|
+
/* @__PURE__ */ t(j, { keywordTip: !0 })
|
|
1068
1083
|
] });
|
|
1069
|
-
if (
|
|
1070
|
-
const x = d(
|
|
1071
|
-
return /* @__PURE__ */
|
|
1084
|
+
if (S && e.length === 0) {
|
|
1085
|
+
const x = d(a);
|
|
1086
|
+
return /* @__PURE__ */ p(U, { children: [
|
|
1072
1087
|
x ? /* @__PURE__ */ t(
|
|
1073
1088
|
H,
|
|
1074
1089
|
{
|
|
@@ -1077,18 +1092,28 @@ function je({ blocklets: e, ...o }) {
|
|
|
1077
1092
|
filter: x
|
|
1078
1093
|
}
|
|
1079
1094
|
) : /* @__PURE__ */ t(be, {}),
|
|
1080
|
-
/* @__PURE__ */ t(
|
|
1095
|
+
/* @__PURE__ */ t(j, { filterTip: !0 })
|
|
1081
1096
|
] });
|
|
1082
1097
|
}
|
|
1083
|
-
return e.length === 0 ? /* @__PURE__ */ t(
|
|
1084
|
-
/* @__PURE__ */ t(
|
|
1085
|
-
|
|
1098
|
+
return e.length === 0 ? /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */ p(z, { children: [
|
|
1099
|
+
/* @__PURE__ */ t(
|
|
1100
|
+
C,
|
|
1101
|
+
{
|
|
1102
|
+
display: "grid",
|
|
1103
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${R}px, 1fr))`,
|
|
1104
|
+
p: "2px",
|
|
1105
|
+
...r,
|
|
1106
|
+
gap: 2,
|
|
1107
|
+
children: e.map((x) => /* @__PURE__ */ t(C, { "data-blocklet-did": x.did, sx: { minWidth: R }, children: o({ blocklet: x, blocklets: e, serverVersion: f }) }, x.did))
|
|
1108
|
+
}
|
|
1109
|
+
),
|
|
1110
|
+
m && /* @__PURE__ */ t(C, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: u, children: /* @__PURE__ */ t(re, {}) })
|
|
1086
1111
|
] });
|
|
1087
1112
|
}
|
|
1088
|
-
|
|
1089
|
-
blocklets:
|
|
1113
|
+
qe.propTypes = {
|
|
1114
|
+
blocklets: w.array.isRequired
|
|
1090
1115
|
};
|
|
1091
|
-
const
|
|
1116
|
+
const U = E(zt)`
|
|
1092
1117
|
text-align: center;
|
|
1093
1118
|
margin-top: 100px;
|
|
1094
1119
|
.primary {
|
|
@@ -1098,38 +1123,38 @@ const W = D(Pt)`
|
|
|
1098
1123
|
margin-top: ${(e) => e.theme.spacing(1)};
|
|
1099
1124
|
}
|
|
1100
1125
|
`;
|
|
1101
|
-
function ae({ onSelect: e, wrapChildren:
|
|
1102
|
-
const
|
|
1103
|
-
const { data:
|
|
1104
|
-
return
|
|
1105
|
-
},
|
|
1106
|
-
|
|
1107
|
-
},
|
|
1108
|
-
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1126
|
+
function ae({ onSelect: e, wrapChildren: r }) {
|
|
1127
|
+
const o = G(null), l = G(null), n = G(null), { storeApi: a, blockletRender: d, filters: c, endpoint: s, handleKeyword: f, t: m, serverVersion: k } = B(), F = async (h) => {
|
|
1128
|
+
const { data: g } = await a.get(T.blockletsPath, { params: h }), v = g.dataList || [];
|
|
1129
|
+
return v.length > 0 && v.unshift({ type: "more-result", total: g.total || 0 }), v;
|
|
1130
|
+
}, R = (h) => {
|
|
1131
|
+
f(h.state.query), h.setIsOpen(!1);
|
|
1132
|
+
}, S = () => {
|
|
1133
|
+
o.current && setTimeout(() => {
|
|
1134
|
+
const h = o.current.querySelector("input.bl-autocomplete-input");
|
|
1135
|
+
h && h.focus();
|
|
1111
1136
|
});
|
|
1112
|
-
},
|
|
1113
|
-
|
|
1114
|
-
},
|
|
1115
|
-
|
|
1137
|
+
}, u = (h) => {
|
|
1138
|
+
h.setIsOpen(!1), S();
|
|
1139
|
+
}, x = ({ prevState: h, state: g }) => {
|
|
1140
|
+
h.query !== g.query && (g.query || (f(), S()));
|
|
1116
1141
|
};
|
|
1117
|
-
return
|
|
1142
|
+
return Mt(
|
|
1118
1143
|
"ctrl + k, command + k",
|
|
1119
|
-
(
|
|
1144
|
+
(h) => (h.stopPropagation(), h.preventDefault(), S(), !1),
|
|
1120
1145
|
{ enableOnTags: ["INPUT"] }
|
|
1121
|
-
),
|
|
1122
|
-
|
|
1123
|
-
}, [s]),
|
|
1124
|
-
if (!
|
|
1146
|
+
), W(() => {
|
|
1147
|
+
S();
|
|
1148
|
+
}, [s]), W(() => {
|
|
1149
|
+
if (!o.current)
|
|
1125
1150
|
return;
|
|
1126
|
-
const
|
|
1127
|
-
container:
|
|
1128
|
-
renderer: { createElement:
|
|
1151
|
+
const h = Dt({
|
|
1152
|
+
container: o.current,
|
|
1153
|
+
renderer: { createElement: pt, Fragment: ht, render: () => {
|
|
1129
1154
|
} },
|
|
1130
|
-
render({ children:
|
|
1155
|
+
render({ children: g }, v) {
|
|
1131
1156
|
var _;
|
|
1132
|
-
(!
|
|
1157
|
+
(!l.current || n.current !== v) && (n.current = v, (_ = l.current) == null || _.unmount(), l.current = Nt(v)), l.current.render(r(g));
|
|
1133
1158
|
},
|
|
1134
1159
|
autoFocus: !0,
|
|
1135
1160
|
openOnFocus: !1,
|
|
@@ -1143,53 +1168,53 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1143
1168
|
detachedContainer: "bl-autocomplete-detached-container"
|
|
1144
1169
|
},
|
|
1145
1170
|
translations: {
|
|
1146
|
-
clearButtonTitle:
|
|
1147
|
-
detachedCancelButtonText:
|
|
1148
|
-
submitButtonTitle:
|
|
1149
|
-
detachedSearchButtonTitle:
|
|
1171
|
+
clearButtonTitle: m("common.clear"),
|
|
1172
|
+
detachedCancelButtonText: m("common.cancel"),
|
|
1173
|
+
submitButtonTitle: m("common.search"),
|
|
1174
|
+
detachedSearchButtonTitle: m("common.search")
|
|
1150
1175
|
},
|
|
1151
|
-
placeholder:
|
|
1176
|
+
placeholder: m("common.searchStore"),
|
|
1152
1177
|
initialState: {
|
|
1153
|
-
query:
|
|
1178
|
+
query: c.keyword
|
|
1154
1179
|
},
|
|
1155
|
-
onStateChange(
|
|
1156
|
-
|
|
1180
|
+
onStateChange(g) {
|
|
1181
|
+
x(g);
|
|
1157
1182
|
},
|
|
1158
|
-
onSubmit:
|
|
1159
|
-
onReset(
|
|
1160
|
-
|
|
1183
|
+
onSubmit: R,
|
|
1184
|
+
onReset(g) {
|
|
1185
|
+
u(g);
|
|
1161
1186
|
},
|
|
1162
|
-
getSources({ query:
|
|
1163
|
-
const
|
|
1187
|
+
getSources({ query: g, state: v, ..._ }) {
|
|
1188
|
+
const $ = {
|
|
1164
1189
|
sortBy: T.nameDesc,
|
|
1165
1190
|
page: 1,
|
|
1166
1191
|
pageSize: 10,
|
|
1167
|
-
keyword:
|
|
1192
|
+
keyword: g
|
|
1168
1193
|
};
|
|
1169
|
-
return
|
|
1194
|
+
return Jt([
|
|
1170
1195
|
{
|
|
1171
1196
|
sourceId: "blocklets",
|
|
1172
1197
|
getItems() {
|
|
1173
|
-
return
|
|
1198
|
+
return F($);
|
|
1174
1199
|
},
|
|
1175
1200
|
// 选中后填充 搜索框中值
|
|
1176
|
-
getItemInputValue({ item:
|
|
1177
|
-
return
|
|
1201
|
+
getItemInputValue({ item: y }) {
|
|
1202
|
+
return y.type === "more-result" ? g : y.title;
|
|
1178
1203
|
},
|
|
1179
1204
|
// 选中或者点击自动完成列表中的 item 时触发
|
|
1180
|
-
onSelect({ event:
|
|
1181
|
-
return
|
|
1182
|
-
blocklet:
|
|
1183
|
-
detailUrl:
|
|
1205
|
+
onSelect({ event: y, item: N }) {
|
|
1206
|
+
return N.type === "more-result" ? (_.setIsOpen(!1), f(g)) : y.type === "keydown" ? f(N.title) : e({
|
|
1207
|
+
blocklet: N,
|
|
1208
|
+
detailUrl: Bt(s, "/blocklets", N.did),
|
|
1184
1209
|
storeUrl: s
|
|
1185
1210
|
});
|
|
1186
1211
|
},
|
|
1187
1212
|
templates: {
|
|
1188
|
-
item({ item:
|
|
1189
|
-
return
|
|
1213
|
+
item({ item: y }) {
|
|
1214
|
+
return y.type === "more-result" ? /* @__PURE__ */ t("div", { children: m("autocomplete.expandResult", { name: g, number: y.total.toLocaleString() }) }) : d({ blocklet: y, autocompleteSetters: _, serverVersion: k });
|
|
1190
1215
|
},
|
|
1191
1216
|
noResults() {
|
|
1192
|
-
return
|
|
1217
|
+
return m("blocklet.noResults");
|
|
1193
1218
|
}
|
|
1194
1219
|
}
|
|
1195
1220
|
}
|
|
@@ -1197,20 +1222,20 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1197
1222
|
}
|
|
1198
1223
|
});
|
|
1199
1224
|
return () => {
|
|
1200
|
-
|
|
1225
|
+
h.destroy();
|
|
1201
1226
|
};
|
|
1202
|
-
}, [
|
|
1227
|
+
}, [c, d]), /* @__PURE__ */ p(z, { children: [
|
|
1203
1228
|
/* @__PURE__ */ t(
|
|
1204
1229
|
we,
|
|
1205
1230
|
{
|
|
1206
|
-
styles: (
|
|
1231
|
+
styles: (h) => ke`
|
|
1207
1232
|
.bl-autocomplete-detached-container {
|
|
1208
1233
|
.bl-autocomplete-detached-cancel {
|
|
1209
1234
|
white-space: nowrap;
|
|
1210
1235
|
}
|
|
1211
1236
|
}
|
|
1212
1237
|
.bl-autocomplete-panel {
|
|
1213
|
-
@media (min-width: ${
|
|
1238
|
+
@media (min-width: ${h.breakpoints.values.md}px) {
|
|
1214
1239
|
min-width: 450px;
|
|
1215
1240
|
left: unset !important;
|
|
1216
1241
|
}
|
|
@@ -1218,49 +1243,49 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1218
1243
|
`
|
|
1219
1244
|
}
|
|
1220
1245
|
),
|
|
1221
|
-
/* @__PURE__ */ t("div", { className: "bl-search-container", ref:
|
|
1246
|
+
/* @__PURE__ */ t("div", { className: "bl-search-container", ref: o })
|
|
1222
1247
|
] });
|
|
1223
1248
|
}
|
|
1224
1249
|
ae.propTypes = {
|
|
1225
|
-
onSelect:
|
|
1226
|
-
wrapChildren:
|
|
1250
|
+
onSelect: w.func.isRequired,
|
|
1251
|
+
wrapChildren: w.func
|
|
1227
1252
|
};
|
|
1228
1253
|
ae.defaultProps = {
|
|
1229
1254
|
wrapChildren: (e) => e
|
|
1230
1255
|
};
|
|
1231
|
-
function ie({ placeholder: e, ...
|
|
1232
|
-
const { filters:
|
|
1233
|
-
const { value:
|
|
1234
|
-
|
|
1256
|
+
function ie({ placeholder: e, ...r }) {
|
|
1257
|
+
const { filters: o, handleKeyword: l } = B(), [n, a] = q(o.keyword || ""), d = yt(l, { wait: 300 }), c = (f) => {
|
|
1258
|
+
const { value: m } = f.target;
|
|
1259
|
+
a(m), d.run(m);
|
|
1235
1260
|
}, s = () => {
|
|
1236
|
-
|
|
1261
|
+
a(""), l();
|
|
1237
1262
|
};
|
|
1238
|
-
return
|
|
1239
|
-
|
|
1240
|
-
}, [
|
|
1241
|
-
|
|
1263
|
+
return W(() => {
|
|
1264
|
+
a(o.keyword || "");
|
|
1265
|
+
}, [o.keyword]), /* @__PURE__ */ t(
|
|
1266
|
+
mr,
|
|
1242
1267
|
{
|
|
1243
1268
|
inputProps: {
|
|
1244
1269
|
"data-cy": "search-blocklet"
|
|
1245
1270
|
},
|
|
1246
|
-
startAdornment: /* @__PURE__ */ t(
|
|
1247
|
-
onChange:
|
|
1271
|
+
startAdornment: /* @__PURE__ */ t(me, { position: "start", children: /* @__PURE__ */ t(fr, {}) }),
|
|
1272
|
+
onChange: c,
|
|
1248
1273
|
placeholder: e,
|
|
1249
|
-
value:
|
|
1274
|
+
value: n,
|
|
1250
1275
|
title: e,
|
|
1251
1276
|
"data-cy": "search",
|
|
1252
|
-
endAdornment:
|
|
1253
|
-
...
|
|
1277
|
+
endAdornment: n && /* @__PURE__ */ t(me, { position: "end", children: /* @__PURE__ */ t(gr, { "data-cy": "search-delete", onClick: s }) }),
|
|
1278
|
+
...r
|
|
1254
1279
|
}
|
|
1255
1280
|
);
|
|
1256
1281
|
}
|
|
1257
1282
|
ie.propTypes = {
|
|
1258
|
-
placeholder:
|
|
1283
|
+
placeholder: w.string
|
|
1259
1284
|
};
|
|
1260
1285
|
ie.defaultProps = {
|
|
1261
1286
|
placeholder: "Type to search..."
|
|
1262
1287
|
};
|
|
1263
|
-
const
|
|
1288
|
+
const mr = E(it)`
|
|
1264
1289
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1265
1290
|
font-size: 14px;
|
|
1266
1291
|
border-radius: 6px;
|
|
@@ -1277,22 +1302,23 @@ const ar = D(lt)`
|
|
|
1277
1302
|
color: transparent;
|
|
1278
1303
|
}
|
|
1279
1304
|
}
|
|
1280
|
-
`,
|
|
1305
|
+
`, fr = E(Ot)`
|
|
1281
1306
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1282
1307
|
font-size: 28px;
|
|
1283
1308
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1284
1309
|
font-size: 24px;
|
|
1285
1310
|
}
|
|
1286
|
-
`,
|
|
1311
|
+
`, gr = E(Re)`
|
|
1287
1312
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1288
1313
|
font-size: 16px;
|
|
1289
1314
|
cursor: pointer;
|
|
1290
1315
|
`;
|
|
1291
|
-
function
|
|
1292
|
-
const { filters: e, handleSearchSelect:
|
|
1293
|
-
return /* @__PURE__ */
|
|
1316
|
+
function yr() {
|
|
1317
|
+
const { filters: e, handleSearchSelect: r, t: o, wrapChildren: l, baseSearch: n, layout: a } = B(), { toggleOpen: d } = ne(), c = !!e.keyword;
|
|
1318
|
+
return a.showTitle || a.showSearch ? /* @__PURE__ */ p(
|
|
1294
1319
|
I,
|
|
1295
1320
|
{
|
|
1321
|
+
className: "title-bar",
|
|
1296
1322
|
direction: "row",
|
|
1297
1323
|
alignItems: "center",
|
|
1298
1324
|
justifyContent: "space-between",
|
|
@@ -1303,68 +1329,68 @@ function cr() {
|
|
|
1303
1329
|
mb: { xs: 0, md: 3 },
|
|
1304
1330
|
children: [
|
|
1305
1331
|
/* @__PURE__ */ t(
|
|
1306
|
-
|
|
1332
|
+
Q,
|
|
1307
1333
|
{
|
|
1308
|
-
xs: !
|
|
1309
|
-
md: /* @__PURE__ */ t(L, { variant: "h1", children:
|
|
1334
|
+
xs: !c && /* @__PURE__ */ t(De, { onClick: () => d(!0), children: /* @__PURE__ */ t(Et, {}) }),
|
|
1335
|
+
md: a.showTitle ? /* @__PURE__ */ t(L, { variant: "h1", children: o("common.title") }) : /* @__PURE__ */ t(C, {})
|
|
1310
1336
|
}
|
|
1311
1337
|
),
|
|
1312
|
-
/* @__PURE__ */ t(
|
|
1313
|
-
|
|
1338
|
+
a.showSearch ? /* @__PURE__ */ t(
|
|
1339
|
+
C,
|
|
1314
1340
|
{
|
|
1315
|
-
width: { xs:
|
|
1341
|
+
width: { xs: c ? "100%" : 300, md: 300 },
|
|
1316
1342
|
className: "filter-bar",
|
|
1317
1343
|
sx: {
|
|
1318
1344
|
"& .bl-autocomplete-form": { borderRadius: 2 },
|
|
1319
1345
|
"& .aa-SubmitButton, & .aa-LoadingIndicator": { width: "auto", pl: 1.5, pr: 1 },
|
|
1320
1346
|
"& .aa-SubmitIcon, & .aa-LoadingIcon": { height: 16, width: 16 }
|
|
1321
1347
|
},
|
|
1322
|
-
children:
|
|
1348
|
+
children: n ? /* @__PURE__ */ t(ie, { className: "bl-search-container", placeholder: o("common.searchStore"), sx: { pl: 1.5 } }) : /* @__PURE__ */ t(ae, { onSelect: r, wrapChildren: l })
|
|
1323
1349
|
}
|
|
1324
|
-
)
|
|
1350
|
+
) : null
|
|
1325
1351
|
]
|
|
1326
1352
|
}
|
|
1327
|
-
);
|
|
1353
|
+
) : null;
|
|
1328
1354
|
}
|
|
1329
|
-
function
|
|
1330
|
-
const { blockletList: e, total:
|
|
1331
|
-
return /* @__PURE__ */ t(
|
|
1332
|
-
/* @__PURE__ */ t(
|
|
1333
|
-
/* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */ t(
|
|
1335
|
-
/* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children:
|
|
1336
|
-
|
|
1337
|
-
/* @__PURE__ */ t(
|
|
1338
|
-
|
|
1339
|
-
] }) : /* @__PURE__ */ t(
|
|
1340
|
-
/* @__PURE__ */ t(
|
|
1341
|
-
] }) : /* @__PURE__ */ t(
|
|
1355
|
+
function br() {
|
|
1356
|
+
const { blockletList: e, total: r, filters: o, t: l } = B(), n = o.category || o.keyword || o.price;
|
|
1357
|
+
return /* @__PURE__ */ t(jt, { children: /* @__PURE__ */ p(st, { FallbackComponent: ee, children: [
|
|
1358
|
+
/* @__PURE__ */ t(yr, {}),
|
|
1359
|
+
/* @__PURE__ */ p(C, { display: "flex", height: "100%", children: [
|
|
1360
|
+
/* @__PURE__ */ t(ir, {}),
|
|
1361
|
+
/* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: n ? /* @__PURE__ */ p(z, { children: [
|
|
1362
|
+
o.keyword ? /* @__PURE__ */ p(z, { children: [
|
|
1363
|
+
/* @__PURE__ */ t(Q, { xs: /* @__PURE__ */ t(Me, {}), md: null }),
|
|
1364
|
+
a()
|
|
1365
|
+
] }) : /* @__PURE__ */ t(hr, {}),
|
|
1366
|
+
/* @__PURE__ */ t(qe, { blocklets: e, height: "100%" })
|
|
1367
|
+
] }) : /* @__PURE__ */ t(pr, {}) })
|
|
1342
1368
|
] })
|
|
1343
1369
|
] }) });
|
|
1344
|
-
function
|
|
1345
|
-
return /* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */ t(L, { variant: "h3", children:
|
|
1347
|
-
/* @__PURE__ */ t(L, { variant: "body1", color: "text.lighter", fontSize: 13, children:
|
|
1370
|
+
function a() {
|
|
1371
|
+
return /* @__PURE__ */ p(I, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
|
|
1372
|
+
/* @__PURE__ */ t(L, { variant: "h3", children: l("blocklet.search", { keyword: o.keyword }) }),
|
|
1373
|
+
/* @__PURE__ */ t(L, { variant: "body1", color: "text.lighter", fontSize: 13, children: l("blocklet.resultCount", { count: r }) })
|
|
1348
1374
|
] });
|
|
1349
1375
|
}
|
|
1350
1376
|
}
|
|
1351
|
-
function
|
|
1352
|
-
const
|
|
1377
|
+
function lo(e) {
|
|
1378
|
+
const r = xe(), o = Xt(r.palette.primary.main), l = {
|
|
1353
1379
|
autocomplete: ke`
|
|
1354
1380
|
:root {
|
|
1355
|
-
--aa-detached-media-query: (max-width: ${
|
|
1356
|
-
--aa-detached-modal-media-query: (min-width: ${
|
|
1357
|
-
--aa-detached-modal-max-width: ${
|
|
1358
|
-
--aa-selected-color-rgb: ${
|
|
1359
|
-
--aa-primary-color-rgb: ${
|
|
1381
|
+
--aa-detached-media-query: (max-width: ${r.breakpoints.values.md}px) !important;
|
|
1382
|
+
--aa-detached-modal-media-query: (min-width: ${r.breakpoints.values.md}px) !important;
|
|
1383
|
+
--aa-detached-modal-max-width: ${r.breakpoints.values.md}px !important;
|
|
1384
|
+
--aa-selected-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
|
|
1385
|
+
--aa-primary-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
|
|
1360
1386
|
--aa-input-background-color-rgb: 250, 250, 250 !important;
|
|
1361
1387
|
}
|
|
1362
1388
|
.bl-autocomplete-panel {
|
|
1363
|
-
z-index: ${
|
|
1389
|
+
z-index: ${r.zIndex.modal};
|
|
1364
1390
|
}
|
|
1365
1391
|
.bl-autocomplete-label {
|
|
1366
1392
|
.aa-SubmitIcon {
|
|
1367
|
-
color: ${
|
|
1393
|
+
color: ${r.palette.grey[500]} !important;
|
|
1368
1394
|
}
|
|
1369
1395
|
}
|
|
1370
1396
|
.bl-autocomplete-form {
|
|
@@ -1380,21 +1406,19 @@ function Ve(e) {
|
|
|
1380
1406
|
box-shadow: none !important;
|
|
1381
1407
|
}
|
|
1382
1408
|
.aa-SubmitIcon {
|
|
1383
|
-
color: ${
|
|
1409
|
+
color: ${r.palette.grey[500]} !important;
|
|
1384
1410
|
}
|
|
1385
1411
|
}
|
|
1386
1412
|
.aa-Panel .arcblock-blocklet button {
|
|
1387
|
-
border: 1px solid rgba(${
|
|
1413
|
+
border: 1px solid rgba(${o.r}, ${o.g}, ${o.b}, 0.5);
|
|
1388
1414
|
}
|
|
1389
1415
|
`
|
|
1390
1416
|
};
|
|
1391
|
-
return /* @__PURE__ */
|
|
1392
|
-
/* @__PURE__ */ t(we, { styles:
|
|
1393
|
-
/* @__PURE__ */ t(
|
|
1417
|
+
return /* @__PURE__ */ p(rr, { ...e, children: [
|
|
1418
|
+
/* @__PURE__ */ t(we, { styles: l.autocomplete }),
|
|
1419
|
+
/* @__PURE__ */ t(br, {})
|
|
1394
1420
|
] });
|
|
1395
1421
|
}
|
|
1396
|
-
Ve.propTypes = ze;
|
|
1397
|
-
Ve.defaultProps = _e;
|
|
1398
1422
|
export {
|
|
1399
|
-
|
|
1423
|
+
lo as default
|
|
1400
1424
|
};
|