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