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