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