@blocklet/list 0.14.20 → 0.14.22
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 +201 -196
- package/package.json +4 -4
package/lib/index.es.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsx as t, jsxs as h, Fragment as M } from "react/jsx-runtime";
|
|
2
|
-
import { styled as K, useTheme as
|
|
2
|
+
import { styled as K, useTheme as xe } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import Je from "@mui/material/styles/createTheme";
|
|
4
4
|
import et from "@mui/material/styles/ThemeProvider";
|
|
5
5
|
import tt from "lodash/merge";
|
|
6
|
-
import { ErrorFallback as
|
|
6
|
+
import { ErrorFallback as ye } from "@arcblock/ux/lib/ErrorBoundary";
|
|
7
7
|
import y from "@mui/material/Box";
|
|
8
8
|
import A from "@mui/material/Stack";
|
|
9
9
|
import { ErrorBoundary as rt } from "react-error-boundary";
|
|
10
10
|
import ot from "@iconify-icons/tabler/compass";
|
|
11
|
-
import { Icon as
|
|
12
|
-
import
|
|
11
|
+
import { Icon as ee } from "@iconify/react";
|
|
12
|
+
import we from "@mui/icons-material/Close";
|
|
13
13
|
import w from "@mui/material/Typography";
|
|
14
|
-
import { createContext as Le, useState as P, useMemo as H, useContext as Oe, useCallback as
|
|
14
|
+
import { createContext as Le, useState as P, useMemo as H, useContext as Oe, useCallback as me, useEffect as U, forwardRef as nt, useRef as fe, memo as it } from "react";
|
|
15
15
|
import { createAxios as _e } from "@blocklet/js-sdk";
|
|
16
16
|
import lt from "lodash/orderBy";
|
|
17
|
-
import { useRequest as
|
|
18
|
-
import
|
|
17
|
+
import { useRequest as re, useDebounceFn as ze, useInfiniteScroll as at, useReactive as st } from "ahooks";
|
|
18
|
+
import le from "lodash/omitBy";
|
|
19
19
|
import "color";
|
|
20
20
|
import "lodash/cloneDeep";
|
|
21
|
-
import { parseURL as ct, parseQuery as dt, parseFilename as ut, stringifyParsedURL as ht, withQuery as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
21
|
+
import { parseURL as ct, parseQuery as dt, parseFilename as ut, stringifyParsedURL as ht, withQuery as be, joinURL as Se } from "ufo";
|
|
22
|
+
import Ie from "flat";
|
|
23
|
+
import oe from "@mui/material/Button";
|
|
24
24
|
import pt from "@mui/material/styles/useTheme";
|
|
25
25
|
import j from "@mui/material/useMediaQuery";
|
|
26
26
|
import mt from "@mui/material/Drawer";
|
|
@@ -36,7 +36,7 @@ import wt from "@mui/material/Paper";
|
|
|
36
36
|
import bt from "@mui/material/Popper";
|
|
37
37
|
import kt from "@mui/material/SvgIcon";
|
|
38
38
|
import vt from "lodash/isEmpty";
|
|
39
|
-
import
|
|
39
|
+
import ne from "@mui/material/CircularProgress";
|
|
40
40
|
import $e from "@arcblock/ux/lib/Avatar";
|
|
41
41
|
import Ct from "@iconify-icons/tabler/cloud-download";
|
|
42
42
|
import St from "@mui/icons-material/ChevronLeft";
|
|
@@ -44,33 +44,35 @@ import It from "@mui/icons-material/ChevronRight";
|
|
|
44
44
|
import _ from "@mui/material/Skeleton";
|
|
45
45
|
import Bt from "react-image-gallery";
|
|
46
46
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
47
|
-
import
|
|
47
|
+
import Be from "@mui/material/Grid";
|
|
48
48
|
import Rt from "react-infinite-scroll-hook";
|
|
49
|
-
import
|
|
49
|
+
import Tt from "@iconify-icons/tabler/square-check";
|
|
50
|
+
import Pt from "@iconify-icons/tabler/square-check-filled";
|
|
51
|
+
import Re from "@mui/material/Chip";
|
|
50
52
|
import J from "@mui/icons-material/Search";
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
+
import At from "@mui/material/Autocomplete";
|
|
54
|
+
import Et from "@mui/material/Dialog";
|
|
53
55
|
import je from "@mui/material/OutlinedInput";
|
|
54
|
-
import
|
|
55
|
-
import { useHotkeys as
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import { Card as
|
|
61
|
-
import
|
|
56
|
+
import Ft from "@mui/material/TextField";
|
|
57
|
+
import { useHotkeys as Lt } from "react-hotkeys-hook";
|
|
58
|
+
import Te from "@mui/material/InputAdornment";
|
|
59
|
+
import Ot from "@arcblock/ux/lib/Empty";
|
|
60
|
+
import _t from "json-stable-stringify";
|
|
61
|
+
import zt from "@mui/icons-material/Menu";
|
|
62
|
+
import { Card as Mt, Box as ae, Skeleton as O } from "@mui/material";
|
|
63
|
+
import Nt from "@arcblock/ux/lib/Img";
|
|
62
64
|
const He = Le({
|
|
63
65
|
open: !1,
|
|
64
66
|
toggleOpen: (e) => {
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
|
-
function
|
|
69
|
+
function Dt({ children: e }) {
|
|
68
70
|
const [r, o] = P(!1), n = (a) => {
|
|
69
71
|
o(a ?? !a);
|
|
70
72
|
}, l = H(() => ({ open: r, toggleOpen: n }), [r]);
|
|
71
73
|
return /* @__PURE__ */ t(He.Provider, { value: l, children: e });
|
|
72
74
|
}
|
|
73
|
-
function
|
|
75
|
+
function ke() {
|
|
74
76
|
return Oe(He);
|
|
75
77
|
}
|
|
76
78
|
const T = {
|
|
@@ -87,14 +89,14 @@ const T = {
|
|
|
87
89
|
explorePath: "/api/blocklets/explore",
|
|
88
90
|
exploreDidsPath: "/api/blocklets/dids",
|
|
89
91
|
cacheSize: 100
|
|
90
|
-
},
|
|
92
|
+
}, Wt = (e) => re(
|
|
91
93
|
async () => {
|
|
92
94
|
const { data: r } = await e.get(T.categoriesPath);
|
|
93
95
|
return Array.isArray(r) ? r : [];
|
|
94
96
|
},
|
|
95
97
|
{ manual: !0 }
|
|
96
98
|
);
|
|
97
|
-
function
|
|
99
|
+
function $t(e, r) {
|
|
98
100
|
const o = { sortBy: "popularity", sortDirection: "desc", ...e }, {
|
|
99
101
|
onFilterChange: n,
|
|
100
102
|
onSearchSelect: l = (i) => {
|
|
@@ -105,13 +107,13 @@ function Dt(e, r) {
|
|
|
105
107
|
!o.category && !a && (o.category = "All");
|
|
106
108
|
const c = (i) => {
|
|
107
109
|
const m = { ...o, ...i };
|
|
108
|
-
n(
|
|
110
|
+
n(le(m, (d) => d === "" || d === void 0));
|
|
109
111
|
};
|
|
110
112
|
return {
|
|
111
113
|
filters: e,
|
|
112
114
|
cleanFilter: (i) => {
|
|
113
|
-
const m = i ?
|
|
114
|
-
n(
|
|
115
|
+
const m = i ? le(o, (d, g) => i.includes(g)) : {};
|
|
116
|
+
n(le(m, (d) => d === "" || d === void 0));
|
|
115
117
|
},
|
|
116
118
|
handleSort: (i, m) => {
|
|
117
119
|
c({ sortBy: i, sortDirection: m || i === "nameAsc" ? "asc" : "desc" });
|
|
@@ -139,7 +141,7 @@ function Dt(e, r) {
|
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
143
|
}
|
|
142
|
-
const
|
|
144
|
+
const jt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
143
145
|
{
|
|
144
146
|
name: e("sort.popularity"),
|
|
145
147
|
value: "popularity"
|
|
@@ -160,17 +162,17 @@ const Wt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
160
162
|
if (l.imageFilter)
|
|
161
163
|
return e;
|
|
162
164
|
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: i, h: m } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
163
|
-
return
|
|
165
|
+
return be(e, {
|
|
164
166
|
...i || m ? { imageFilter: "resize", w: i, h: m } : {},
|
|
165
167
|
v: c
|
|
166
168
|
});
|
|
167
|
-
},
|
|
169
|
+
}, Ht = (e) => [
|
|
168
170
|
{ name: e("blocklet.free"), value: "free" },
|
|
169
171
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
170
|
-
],
|
|
172
|
+
], Ut = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Vt = (e, r) => (
|
|
171
173
|
// eslint-disable-next-line no-prototype-builtins
|
|
172
174
|
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
|
|
173
|
-
),
|
|
175
|
+
), Gt = () => window.innerWidth <= 600, qt = {
|
|
174
176
|
common: {
|
|
175
177
|
title: "Blocklet Store",
|
|
176
178
|
searchStore: "Search Blocklet",
|
|
@@ -221,7 +223,7 @@ const Wt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
221
223
|
autocomplete: {
|
|
222
224
|
expandResult: 'View all search results for "{name}"'
|
|
223
225
|
}
|
|
224
|
-
},
|
|
226
|
+
}, Kt = {
|
|
225
227
|
common: {
|
|
226
228
|
title: "Blocklet 商店",
|
|
227
229
|
searchStore: "搜索 Blocklet",
|
|
@@ -272,15 +274,15 @@ const Wt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
272
274
|
autocomplete: {
|
|
273
275
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
274
276
|
}
|
|
275
|
-
},
|
|
276
|
-
en:
|
|
277
|
-
zh:
|
|
277
|
+
}, se = {
|
|
278
|
+
en: Ie(qt),
|
|
279
|
+
zh: Ie(Kt)
|
|
278
280
|
}, Ge = (e, r) => {
|
|
279
281
|
const o = {};
|
|
280
282
|
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
281
|
-
},
|
|
282
|
-
const n =
|
|
283
|
-
return
|
|
283
|
+
}, Xt = (e) => (r, o) => {
|
|
284
|
+
const n = se[e] ? se[e][r] : se.en[r];
|
|
285
|
+
return Vt(n, o) || r;
|
|
284
286
|
}, qe = {
|
|
285
287
|
errors: {
|
|
286
288
|
fetchCategoriesError: null
|
|
@@ -333,8 +335,8 @@ const Wt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
333
335
|
handlePage: () => {
|
|
334
336
|
}
|
|
335
337
|
}
|
|
336
|
-
}, Ke = Le(qe), { Provider:
|
|
337
|
-
function
|
|
338
|
+
}, Ke = Le(qe), { Provider: Qt, Consumer: Fo } = Ke;
|
|
339
|
+
function Yt(e) {
|
|
338
340
|
const {
|
|
339
341
|
locale: r = "zh",
|
|
340
342
|
filters: o = {},
|
|
@@ -357,17 +359,17 @@ function Xt(e) {
|
|
|
357
359
|
},
|
|
358
360
|
endpoint: C,
|
|
359
361
|
blockletRender: x
|
|
360
|
-
} = e,
|
|
362
|
+
} = e, E = Ge(n, v), F = H(() => _e({ baseURL: C, headers: E }), [C]), L = $t(o, { onFilterChange: l, emptyCategory: !i.showExplore, onSearchSelect: u }), [N, V] = P(""), {
|
|
361
363
|
data: G = [],
|
|
362
|
-
error:
|
|
364
|
+
error: ie,
|
|
363
365
|
loading: X,
|
|
364
366
|
run: Q
|
|
365
|
-
} =
|
|
367
|
+
} = Wt(F), $ = H(() => {
|
|
366
368
|
const R = lt(G, [(W) => W.name], ["asc"]), z = R.findIndex((W) => W.name === "All" || W.locales.en === "All");
|
|
367
369
|
return z > -1 ? [{ ...R[z], _id: "All" }, ...R.slice(0, z), ...R.slice(z + 1)] : R;
|
|
368
|
-
}, [G]), q =
|
|
370
|
+
}, [G]), q = me(Xt(r), [r]), s = H(() => Ut($, r), [$, r]), b = Ht(q), D = {
|
|
369
371
|
search: L,
|
|
370
|
-
errors: { fetchCategoriesError:
|
|
372
|
+
errors: { fetchCategoriesError: ie },
|
|
371
373
|
loadings: {
|
|
372
374
|
fetchCategoriesLoading: X
|
|
373
375
|
},
|
|
@@ -391,7 +393,7 @@ function Xt(e) {
|
|
|
391
393
|
locale: r,
|
|
392
394
|
categoryOptions: s,
|
|
393
395
|
priceOptions: b,
|
|
394
|
-
storeApi:
|
|
396
|
+
storeApi: F,
|
|
395
397
|
baseSearch: g,
|
|
396
398
|
showResourcesSwitch: f,
|
|
397
399
|
showCategory: k,
|
|
@@ -409,7 +411,7 @@ function Xt(e) {
|
|
|
409
411
|
};
|
|
410
412
|
return U(() => {
|
|
411
413
|
setTimeout(Q, p || 0);
|
|
412
|
-
}, [C, Q, p]), /* @__PURE__ */ t(
|
|
414
|
+
}, [C, Q, p]), /* @__PURE__ */ t(Qt, { value: D, children: B });
|
|
413
415
|
}
|
|
414
416
|
function I() {
|
|
415
417
|
const e = Oe(Ke);
|
|
@@ -422,7 +424,7 @@ function Xe({
|
|
|
422
424
|
...n
|
|
423
425
|
}) {
|
|
424
426
|
return /* @__PURE__ */ t(
|
|
425
|
-
|
|
427
|
+
oe,
|
|
426
428
|
{
|
|
427
429
|
...n,
|
|
428
430
|
onClick: r,
|
|
@@ -448,7 +450,7 @@ function Xe({
|
|
|
448
450
|
function Y(e, r) {
|
|
449
451
|
return e === void 0 ? r : e;
|
|
450
452
|
}
|
|
451
|
-
function
|
|
453
|
+
function ve({
|
|
452
454
|
xs: e,
|
|
453
455
|
sm: r,
|
|
454
456
|
md: o,
|
|
@@ -462,36 +464,36 @@ function ke({
|
|
|
462
464
|
let p = e;
|
|
463
465
|
return i || (p = Y(r, p), m) || (p = Y(o, p), d) || (p = Y(n, p), g) ? p : Y(l, p);
|
|
464
466
|
}
|
|
465
|
-
function
|
|
466
|
-
const { open: r, toggleOpen: o } =
|
|
467
|
+
function Zt({ children: e }) {
|
|
468
|
+
const { open: r, toggleOpen: o } = ke();
|
|
467
469
|
return /* @__PURE__ */ t(
|
|
468
|
-
|
|
470
|
+
ve,
|
|
469
471
|
{
|
|
470
472
|
xs: /* @__PURE__ */ t(mt, { open: r, onClose: () => o(!1), children: e }),
|
|
471
473
|
md: /* @__PURE__ */ t(y, { children: e })
|
|
472
474
|
}
|
|
473
475
|
);
|
|
474
476
|
}
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
+
const Jt = nt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
478
|
+
oe,
|
|
477
479
|
{
|
|
478
480
|
ref: n,
|
|
479
481
|
disableElevation: !0,
|
|
480
482
|
disabled: r || e,
|
|
481
483
|
...o,
|
|
482
484
|
sx: [{ borderRadius: "4px" }, ...Array.isArray(o.sx) ? o.sx : [o.sx]],
|
|
483
|
-
startIcon: e && /* @__PURE__ */ t(
|
|
485
|
+
startIcon: e && /* @__PURE__ */ t(ne, { size: "1em" })
|
|
484
486
|
}
|
|
485
487
|
));
|
|
486
488
|
function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
487
489
|
var v;
|
|
488
|
-
const a =
|
|
490
|
+
const a = fe(null), c = xe(), [i, m] = P(!1), [d, g] = P(e !== null ? e : ""), p = j(c.breakpoints.down("sm"));
|
|
489
491
|
U(() => {
|
|
490
492
|
g(e !== null ? e : "");
|
|
491
493
|
}, [e]);
|
|
492
|
-
const f =
|
|
494
|
+
const f = me(() => {
|
|
493
495
|
m(!1);
|
|
494
|
-
}, []), k =
|
|
496
|
+
}, []), k = me(() => {
|
|
495
497
|
m(!0);
|
|
496
498
|
}, []);
|
|
497
499
|
function S(u) {
|
|
@@ -502,18 +504,18 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
502
504
|
}
|
|
503
505
|
return /* @__PURE__ */ h(M, { children: [
|
|
504
506
|
/* @__PURE__ */ h(
|
|
505
|
-
|
|
507
|
+
er,
|
|
506
508
|
{
|
|
507
509
|
ref: a,
|
|
508
510
|
onClick: k,
|
|
509
511
|
variant: "outlined",
|
|
510
|
-
size: "
|
|
512
|
+
size: "medium",
|
|
511
513
|
className: ["my-select__selector", vt(d) ? "" : "my-select__selector--active"].join(" "),
|
|
512
|
-
sx: { minWidth: "auto", color: "text.primary" },
|
|
514
|
+
sx: { minWidth: "auto", color: "text.primary", borderRadius: "8px" },
|
|
513
515
|
...l,
|
|
514
516
|
children: [
|
|
515
517
|
((v = r.find((u) => u.value === d)) == null ? void 0 : v.name) || n,
|
|
516
|
-
/* @__PURE__ */ t(kt, { className: "my-select__arrowdown", component: gt,
|
|
518
|
+
/* @__PURE__ */ t(kt, { className: "my-select__arrowdown", component: gt, sx: { width: 18, height: 18 } })
|
|
517
519
|
]
|
|
518
520
|
}
|
|
519
521
|
),
|
|
@@ -522,7 +524,7 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
522
524
|
{
|
|
523
525
|
...u,
|
|
524
526
|
style: { transformOrigin: C === "bottom" ? "center top" : "center bottom" },
|
|
525
|
-
children: /* @__PURE__ */ t(wt, { children: /* @__PURE__ */ t(xt, { onClickAway: f, children: /* @__PURE__ */ t(
|
|
527
|
+
children: /* @__PURE__ */ t(wt, { children: /* @__PURE__ */ t(xt, { onClickAway: f, children: /* @__PURE__ */ t(tr, { autoFocusItem: i, onMouseEnter: k, onMouseLeave: f, children: r.map((x) => /* @__PURE__ */ h(De, { onClick: () => S(x), sx: { fontSize: 14 }, children: [
|
|
526
528
|
/* @__PURE__ */ t(
|
|
527
529
|
ft,
|
|
528
530
|
{
|
|
@@ -535,7 +537,7 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
535
537
|
) })
|
|
536
538
|
] });
|
|
537
539
|
}
|
|
538
|
-
const
|
|
540
|
+
const er = K(Jt)`
|
|
539
541
|
border: 1px solid #f0f0f0;
|
|
540
542
|
padding: 6px 8px 6px 12px;
|
|
541
543
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -563,7 +565,7 @@ const Zt = K(Yt)`
|
|
|
563
565
|
margin-right: 3px;
|
|
564
566
|
}
|
|
565
567
|
}
|
|
566
|
-
`,
|
|
568
|
+
`, tr = K(We)`
|
|
567
569
|
.my-select__option__icon {
|
|
568
570
|
color: transparent;
|
|
569
571
|
font-size: 14px;
|
|
@@ -619,15 +621,15 @@ function Ye() {
|
|
|
619
621
|
}
|
|
620
622
|
);
|
|
621
623
|
}
|
|
622
|
-
function
|
|
623
|
-
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: l, layout: a, baseSearch: c } = I(), { filters: i, handleCategory: m, cleanFilter: d } = r, { toggleOpen: g } =
|
|
624
|
+
function rr() {
|
|
625
|
+
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: l, layout: a, baseSearch: c } = I(), { filters: i, handleCategory: m, cleanFilter: d } = r, { toggleOpen: g } = ke();
|
|
624
626
|
U(() => {
|
|
625
627
|
g(!1);
|
|
626
628
|
}, [Object.values(i).join("")]);
|
|
627
|
-
const p =
|
|
628
|
-
return a.showCategory ? /* @__PURE__ */ h(
|
|
629
|
+
const p = jt(c, a.showSearch, i.keyword);
|
|
630
|
+
return a.showCategory ? /* @__PURE__ */ h(Zt, { children: [
|
|
629
631
|
/* @__PURE__ */ t(
|
|
630
|
-
|
|
632
|
+
ve,
|
|
631
633
|
{
|
|
632
634
|
xs: /* @__PURE__ */ h(
|
|
633
635
|
A,
|
|
@@ -641,7 +643,7 @@ function er() {
|
|
|
641
643
|
borderBottom: 1,
|
|
642
644
|
borderColor: "divider",
|
|
643
645
|
children: [
|
|
644
|
-
/* @__PURE__ */ t(Xe, { onClick: () => g(!1), children: /* @__PURE__ */ t(
|
|
646
|
+
/* @__PURE__ */ t(Xe, { onClick: () => g(!1), children: /* @__PURE__ */ t(we, {}) }),
|
|
645
647
|
/* @__PURE__ */ t(w, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: o("common.category") })
|
|
646
648
|
]
|
|
647
649
|
}
|
|
@@ -659,7 +661,7 @@ function er() {
|
|
|
659
661
|
pr: { md: 6 },
|
|
660
662
|
children: p ? /* @__PURE__ */ h(M, { children: [
|
|
661
663
|
a.showExplore && /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
662
|
-
/* @__PURE__ */ t(
|
|
664
|
+
/* @__PURE__ */ t(ee, { icon: ot }),
|
|
663
665
|
/* @__PURE__ */ t(
|
|
664
666
|
w,
|
|
665
667
|
{
|
|
@@ -695,7 +697,7 @@ function er() {
|
|
|
695
697
|
)
|
|
696
698
|
] }) : null;
|
|
697
699
|
}
|
|
698
|
-
function
|
|
700
|
+
function Ce() {
|
|
699
701
|
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n = Ge(r, o), l = H(() => _e({
|
|
700
702
|
baseURL: e,
|
|
701
703
|
headers: n
|
|
@@ -712,9 +714,9 @@ function ve() {
|
|
|
712
714
|
};
|
|
713
715
|
}
|
|
714
716
|
const Ze = it(function(r) {
|
|
715
|
-
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(
|
|
717
|
+
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(ne, {}) });
|
|
716
718
|
});
|
|
717
|
-
function
|
|
719
|
+
function Pe({
|
|
718
720
|
icon: e,
|
|
719
721
|
children: r,
|
|
720
722
|
maxWidth: o = 100,
|
|
@@ -734,16 +736,16 @@ function Te({
|
|
|
734
736
|
)
|
|
735
737
|
] });
|
|
736
738
|
}
|
|
737
|
-
const
|
|
738
|
-
function
|
|
739
|
+
const or = 16 / 9, ce = 292, ge = 189, te = 336;
|
|
740
|
+
function nr() {
|
|
739
741
|
var B, v;
|
|
740
|
-
const { t: e, search: r } = I(), { get: o } =
|
|
742
|
+
const { t: e, search: r } = I(), { get: o } = Ce(), n = xe(), l = j(n.breakpoints.down("md")), a = ((v = (B = window.blocklet) == null ? void 0 : B.preferences) == null ? void 0 : v.homeBanner) || [], {
|
|
741
743
|
data: c = [],
|
|
742
744
|
error: i,
|
|
743
745
|
loading: m
|
|
744
|
-
} =
|
|
746
|
+
} = re(async () => {
|
|
745
747
|
const u = await o(
|
|
746
|
-
|
|
748
|
+
be(T.blockletsPath, { didList: a.map((C) => C.did).join(",") })
|
|
747
749
|
);
|
|
748
750
|
return u != null && u.dataList ? a.map((C) => u.dataList.find((x) => x.did === C.did)) : [];
|
|
749
751
|
});
|
|
@@ -761,15 +763,15 @@ function rr() {
|
|
|
761
763
|
/* @__PURE__ */ t(
|
|
762
764
|
y,
|
|
763
765
|
{
|
|
764
|
-
height: { xs: "auto", md:
|
|
765
|
-
minHeight:
|
|
766
|
+
height: { xs: "auto", md: ce },
|
|
767
|
+
minHeight: ce,
|
|
766
768
|
position: "relative",
|
|
767
769
|
border: 1,
|
|
768
770
|
borderColor: "divider",
|
|
769
771
|
borderRadius: 3,
|
|
770
772
|
overflow: "hidden",
|
|
771
773
|
children: m ? /* @__PURE__ */ h(y, { p: 5, display: { md: "flex" }, gap: 5, alignItems: "center", justifyContent: "center", children: [
|
|
772
|
-
/* @__PURE__ */ t(_, { variant: "rounded", height:
|
|
774
|
+
/* @__PURE__ */ t(_, { variant: "rounded", height: ge, width: te }),
|
|
773
775
|
/* @__PURE__ */ h(y, { flex: 1, height: "100%", children: [
|
|
774
776
|
/* @__PURE__ */ t(_, { variant: "text", height: 50, width: 100 }),
|
|
775
777
|
/* @__PURE__ */ t(_, { variant: "text", height: 40, width: "100%" }),
|
|
@@ -798,11 +800,11 @@ function rr() {
|
|
|
798
800
|
original: u.did,
|
|
799
801
|
renderItem: () => {
|
|
800
802
|
var L;
|
|
801
|
-
const x = c[C] || {},
|
|
803
|
+
const x = c[C] || {}, E = u.cover || lr(u.did, (L = x.screenshots) == null ? void 0 : L[0]), F = Ve(E, n.breakpoints.values.md * 2);
|
|
802
804
|
return /* @__PURE__ */ h(
|
|
803
805
|
A,
|
|
804
806
|
{
|
|
805
|
-
height: { xs: "auto", md:
|
|
807
|
+
height: { xs: "auto", md: ce },
|
|
806
808
|
sx: {
|
|
807
809
|
cursor: "pointer",
|
|
808
810
|
"&::before": {
|
|
@@ -812,7 +814,7 @@ function rr() {
|
|
|
812
814
|
left: 0,
|
|
813
815
|
right: 0,
|
|
814
816
|
bottom: 0,
|
|
815
|
-
backgroundImage: `url("${
|
|
817
|
+
backgroundImage: `url("${F}")`,
|
|
816
818
|
backgroundSize: "cover",
|
|
817
819
|
filter: "blur(50px)",
|
|
818
820
|
opacity: 0.15,
|
|
@@ -827,7 +829,7 @@ function rr() {
|
|
|
827
829
|
onClick: () => r.handleSearchSelect(x),
|
|
828
830
|
gap: { xs: 2, md: 5 },
|
|
829
831
|
children: [
|
|
830
|
-
g(
|
|
832
|
+
g(F),
|
|
831
833
|
/* @__PURE__ */ h(A, { flex: 1, height: "100%", gap: 3, children: [
|
|
832
834
|
/* @__PURE__ */ h(y, { flex: 1, children: [
|
|
833
835
|
p(u.name || x.title || u.name),
|
|
@@ -847,7 +849,7 @@ function rr() {
|
|
|
847
849
|
)
|
|
848
850
|
] }) : null;
|
|
849
851
|
function g(u) {
|
|
850
|
-
return /* @__PURE__ */ t(y, { borderRadius: 2, overflow: "hidden", position: "relative", width: { xs: "100%", md:
|
|
852
|
+
return /* @__PURE__ */ t(y, { borderRadius: 2, overflow: "hidden", position: "relative", width: { xs: "100%", md: te }, children: /* @__PURE__ */ t(ar, { url: u }) });
|
|
851
853
|
}
|
|
852
854
|
function p(u) {
|
|
853
855
|
return /* @__PURE__ */ t(w, { variant: "h2", width: "100%", children: u });
|
|
@@ -877,15 +879,15 @@ function rr() {
|
|
|
877
879
|
);
|
|
878
880
|
}
|
|
879
881
|
function k(u, C = 0) {
|
|
880
|
-
const { did: x, owner:
|
|
882
|
+
const { did: x, owner: E, stats: F } = u;
|
|
881
883
|
return /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
882
|
-
/* @__PURE__ */ t(
|
|
883
|
-
/* @__PURE__ */ t(
|
|
884
|
+
/* @__PURE__ */ t(Pe, { icon: /* @__PURE__ */ t($e, { src: E.avatar, did: x, size: 20, variant: "circle" }), children: E.fullName }),
|
|
885
|
+
/* @__PURE__ */ t(Pe, { icon: /* @__PURE__ */ t(ee, { icon: Ct }), title: `${F.downloads + C}`, children: ir(F.downloads + C) })
|
|
884
886
|
] });
|
|
885
887
|
}
|
|
886
888
|
function S(u) {
|
|
887
889
|
return /* @__PURE__ */ t(
|
|
888
|
-
|
|
890
|
+
oe,
|
|
889
891
|
{
|
|
890
892
|
variant: "outlined",
|
|
891
893
|
size: "small",
|
|
@@ -903,8 +905,8 @@ function rr() {
|
|
|
903
905
|
);
|
|
904
906
|
}
|
|
905
907
|
}
|
|
906
|
-
const
|
|
907
|
-
function
|
|
908
|
+
const ir = (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`, lr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
909
|
+
function ar({ url: e }) {
|
|
908
910
|
const [r, o] = P(!0);
|
|
909
911
|
return /* @__PURE__ */ h(M, { children: [
|
|
910
912
|
r && /* @__PURE__ */ t(
|
|
@@ -912,8 +914,8 @@ function ir({ url: e }) {
|
|
|
912
914
|
{
|
|
913
915
|
variant: "rectangular",
|
|
914
916
|
sx: {
|
|
915
|
-
width: { xs: "100%", md:
|
|
916
|
-
height: { xs: "auto", md:
|
|
917
|
+
width: { xs: "100%", md: te },
|
|
918
|
+
height: { xs: "auto", md: ge }
|
|
917
919
|
}
|
|
918
920
|
}
|
|
919
921
|
),
|
|
@@ -923,43 +925,43 @@ function ir({ url: e }) {
|
|
|
923
925
|
display: r ? "none" : "block",
|
|
924
926
|
component: "img",
|
|
925
927
|
src: e,
|
|
926
|
-
width: { xs: "100%", md:
|
|
927
|
-
height: { xs: "auto", md:
|
|
928
|
+
width: { xs: "100%", md: te },
|
|
929
|
+
height: { xs: "auto", md: ge },
|
|
928
930
|
borderRadius: 2,
|
|
929
931
|
border: 1,
|
|
930
932
|
borderColor: "divider",
|
|
931
|
-
sx: { objectFit: "container", cursor: "pointer", aspectRatio:
|
|
933
|
+
sx: { objectFit: "container", cursor: "pointer", aspectRatio: or },
|
|
932
934
|
onLoad: () => o(!1),
|
|
933
935
|
onError: () => o(!1)
|
|
934
936
|
}
|
|
935
937
|
)
|
|
936
938
|
] });
|
|
937
939
|
}
|
|
938
|
-
function
|
|
940
|
+
function sr({ title: e, blocklets: r }) {
|
|
939
941
|
const { blockletRender: o, serverVersion: n } = I();
|
|
940
942
|
return /* @__PURE__ */ h(y, { mt: 3, children: [
|
|
941
943
|
/* @__PURE__ */ t(w, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
942
|
-
/* @__PURE__ */ t(
|
|
944
|
+
/* @__PURE__ */ t(Be, { container: !0, spacing: 2, children: r.map((l) => /* @__PURE__ */ t(Be, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": l.did, children: /* @__PURE__ */ t(y, { padding: "1px", children: o({ blocklet: l, blocklets: r, serverVersion: n }) }) }, l.did)) })
|
|
943
945
|
] });
|
|
944
946
|
}
|
|
945
|
-
function
|
|
946
|
-
const { get: e } =
|
|
947
|
+
function cr() {
|
|
948
|
+
const { get: e } = Ce(), { t: r } = I(), {
|
|
947
949
|
data: o = [],
|
|
948
950
|
error: n,
|
|
949
951
|
loading: l
|
|
950
|
-
} =
|
|
952
|
+
} = re(async () => {
|
|
951
953
|
const a = await e(T.explorePath);
|
|
952
954
|
return Array.isArray(a) ? a : [];
|
|
953
955
|
});
|
|
954
|
-
return n ? /* @__PURE__ */ t(
|
|
955
|
-
/* @__PURE__ */ t(
|
|
956
|
+
return n ? /* @__PURE__ */ t(ye, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : l ? /* @__PURE__ */ t(Ze, { mt: 15 }) : /* @__PURE__ */ h(M, { children: [
|
|
957
|
+
/* @__PURE__ */ t(nr, {}),
|
|
956
958
|
o.map(
|
|
957
|
-
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(
|
|
959
|
+
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(sr, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
958
960
|
)
|
|
959
961
|
] });
|
|
960
962
|
}
|
|
961
|
-
const
|
|
962
|
-
function
|
|
963
|
+
const de = "__FREE_TEXT__", Ae = "__NO_RESULT__", ue = 40;
|
|
964
|
+
function dr({
|
|
963
965
|
endpoint: e,
|
|
964
966
|
t: r,
|
|
965
967
|
locale: o,
|
|
@@ -968,11 +970,11 @@ function sr({
|
|
|
968
970
|
handleSearchSelect: a,
|
|
969
971
|
...c
|
|
970
972
|
}) {
|
|
971
|
-
const i =
|
|
973
|
+
const i = fe(null), m = fe(!1), [d, g] = P(!1), [p, f] = P(""), [k, S] = P(!1), B = Ce(), [v, u] = P(!1), C = async (s) => {
|
|
972
974
|
u(!0);
|
|
973
|
-
const b = await B.get(
|
|
975
|
+
const b = await B.get(Se(e, be(T.blockletsPath, s)));
|
|
974
976
|
return u(!1), b.dataList || [];
|
|
975
|
-
}, { data: x, run:
|
|
977
|
+
}, { data: x, run: E } = re(
|
|
976
978
|
(s) => s ? C({
|
|
977
979
|
sortBy: T.nameDesc,
|
|
978
980
|
page: 1,
|
|
@@ -985,8 +987,8 @@ function sr({
|
|
|
985
987
|
}
|
|
986
988
|
);
|
|
987
989
|
U(() => {
|
|
988
|
-
u(!0),
|
|
989
|
-
}, [n.keyword,
|
|
990
|
+
u(!0), E(n.keyword), f(n.keyword || "");
|
|
991
|
+
}, [n.keyword, E]), Lt(
|
|
990
992
|
"ctrl + k, command + k",
|
|
991
993
|
(s) => {
|
|
992
994
|
var b, D;
|
|
@@ -994,10 +996,10 @@ function sr({
|
|
|
994
996
|
},
|
|
995
997
|
{ enableOnTags: ["INPUT"] }
|
|
996
998
|
);
|
|
997
|
-
const
|
|
999
|
+
const F = ze((s) => E(s), { wait: 300 }), L = { name: de, title: p, did: "" };
|
|
998
1000
|
let N = [];
|
|
999
|
-
return p && (v ? N = [L] : x != null && x.length ? N = [L, ...x] : N = [{ name:
|
|
1000
|
-
/* @__PURE__ */ h(
|
|
1001
|
+
return p && (v ? N = [L] : x != null && x.length ? N = [L, ...x] : N = [{ name: Ae, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ h(M, { children: [
|
|
1002
|
+
/* @__PURE__ */ h(Et, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
|
|
1001
1003
|
/* @__PURE__ */ h(y, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
|
|
1002
1004
|
/* @__PURE__ */ t(
|
|
1003
1005
|
je,
|
|
@@ -1027,7 +1029,7 @@ function sr({
|
|
|
1027
1029
|
}
|
|
1028
1030
|
),
|
|
1029
1031
|
/* @__PURE__ */ t(
|
|
1030
|
-
|
|
1032
|
+
oe,
|
|
1031
1033
|
{
|
|
1032
1034
|
variant: "outlined",
|
|
1033
1035
|
onClick: () => {
|
|
@@ -1047,7 +1049,7 @@ function sr({
|
|
|
1047
1049
|
}
|
|
1048
1050
|
),
|
|
1049
1051
|
/* @__PURE__ */ t(
|
|
1050
|
-
|
|
1052
|
+
At,
|
|
1051
1053
|
{
|
|
1052
1054
|
ref: i,
|
|
1053
1055
|
open: !!p && d,
|
|
@@ -1076,7 +1078,7 @@ function sr({
|
|
|
1076
1078
|
}
|
|
1077
1079
|
},
|
|
1078
1080
|
renderInput: (s) => /* @__PURE__ */ t(
|
|
1079
|
-
|
|
1081
|
+
Ft,
|
|
1080
1082
|
{
|
|
1081
1083
|
...s,
|
|
1082
1084
|
InputProps: {
|
|
@@ -1115,13 +1117,13 @@ function sr({
|
|
|
1115
1117
|
)
|
|
1116
1118
|
] });
|
|
1117
1119
|
function V(s) {
|
|
1118
|
-
u(!0), f(s), m.current = !1,
|
|
1120
|
+
u(!0), f(s), m.current = !1, F.run(s);
|
|
1119
1121
|
}
|
|
1120
1122
|
function G() {
|
|
1121
1123
|
S(!1), f(""), V(""), l("");
|
|
1122
1124
|
}
|
|
1123
|
-
function
|
|
1124
|
-
s != null && s.did ? (S(!1), m.current = !0, f(""), a(s)) : s.name ===
|
|
1125
|
+
function ie(s) {
|
|
1126
|
+
s != null && s.did ? (S(!1), m.current = !0, f(""), a(s)) : s.name === de && (S(!1), l(p));
|
|
1125
1127
|
}
|
|
1126
1128
|
function X(s) {
|
|
1127
1129
|
var b, D;
|
|
@@ -1129,7 +1131,7 @@ function sr({
|
|
|
1129
1131
|
De,
|
|
1130
1132
|
{
|
|
1131
1133
|
sx: { display: "flex", alignItems: "center", gap: 1, p: 1.5, borderRadius: "8px" },
|
|
1132
|
-
onClick: () =>
|
|
1134
|
+
onClick: () => ie(s),
|
|
1133
1135
|
children: [
|
|
1134
1136
|
Q(s),
|
|
1135
1137
|
/* @__PURE__ */ h(w, { variant: "body1", children: [
|
|
@@ -1142,11 +1144,11 @@ function sr({
|
|
|
1142
1144
|
);
|
|
1143
1145
|
}
|
|
1144
1146
|
function Q(s) {
|
|
1145
|
-
if ([
|
|
1147
|
+
if ([de, Ae].includes(s.name))
|
|
1146
1148
|
return /* @__PURE__ */ t(
|
|
1147
1149
|
y,
|
|
1148
1150
|
{
|
|
1149
|
-
width:
|
|
1151
|
+
width: ue,
|
|
1150
1152
|
p: "6px",
|
|
1151
1153
|
display: "flex",
|
|
1152
1154
|
justifyContent: "center",
|
|
@@ -1158,16 +1160,16 @@ function sr({
|
|
|
1158
1160
|
}
|
|
1159
1161
|
);
|
|
1160
1162
|
let b = "";
|
|
1161
|
-
return s.logo && (b =
|
|
1163
|
+
return s.logo && (b = Se(e, "assets", s.did, Ve(s.logo, ue, s.version))), /* @__PURE__ */ t($e, { src: b, size: ue, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1162
1164
|
}
|
|
1163
1165
|
function $(s = !0) {
|
|
1164
|
-
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s && p && v ? /* @__PURE__ */ t(
|
|
1166
|
+
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s && p && v ? /* @__PURE__ */ t(ne, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 16, cursor: "default" } }) });
|
|
1165
1167
|
}
|
|
1166
1168
|
function q() {
|
|
1167
|
-
return p ? /* @__PURE__ */ t(y, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(
|
|
1169
|
+
return p ? /* @__PURE__ */ t(y, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(we, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => G() }) }) : null;
|
|
1168
1170
|
}
|
|
1169
1171
|
}
|
|
1170
|
-
function
|
|
1172
|
+
function ur({ placeholder: e = "Type to search...", ...r }) {
|
|
1171
1173
|
const { search: o } = I(), { filters: n, handleKeyword: l } = o, [a, c] = P(n.keyword || ""), i = ze(l, { wait: 300 }), m = (g) => {
|
|
1172
1174
|
const { value: p } = g.target;
|
|
1173
1175
|
c(p), i.run(p);
|
|
@@ -1177,23 +1179,23 @@ function cr({ placeholder: e = "Type to search...", ...r }) {
|
|
|
1177
1179
|
return U(() => {
|
|
1178
1180
|
c(n.keyword || "");
|
|
1179
1181
|
}, [n.keyword]), /* @__PURE__ */ t(
|
|
1180
|
-
|
|
1182
|
+
hr,
|
|
1181
1183
|
{
|
|
1182
1184
|
inputProps: {
|
|
1183
1185
|
"data-cy": "search-blocklet"
|
|
1184
1186
|
},
|
|
1185
|
-
startAdornment: /* @__PURE__ */ t(
|
|
1187
|
+
startAdornment: /* @__PURE__ */ t(Te, { position: "start", children: /* @__PURE__ */ t(pr, {}) }),
|
|
1186
1188
|
onChange: m,
|
|
1187
1189
|
placeholder: e,
|
|
1188
1190
|
value: a,
|
|
1189
1191
|
title: e,
|
|
1190
1192
|
"data-cy": "search",
|
|
1191
|
-
endAdornment: a && /* @__PURE__ */ t(
|
|
1193
|
+
endAdornment: a && /* @__PURE__ */ t(Te, { position: "end", children: /* @__PURE__ */ t(mr, { "data-cy": "search-delete", onClick: d }) }),
|
|
1192
1194
|
...r
|
|
1193
1195
|
}
|
|
1194
1196
|
);
|
|
1195
1197
|
}
|
|
1196
|
-
const
|
|
1198
|
+
const hr = K(je)`
|
|
1197
1199
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1198
1200
|
font-size: 14px;
|
|
1199
1201
|
border-radius: 6px;
|
|
@@ -1210,18 +1212,18 @@ const dr = K(je)`
|
|
|
1210
1212
|
color: transparent;
|
|
1211
1213
|
}
|
|
1212
1214
|
}
|
|
1213
|
-
`,
|
|
1215
|
+
`, pr = K(J)`
|
|
1214
1216
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1215
1217
|
font-size: 28px;
|
|
1216
1218
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1217
1219
|
font-size: 24px;
|
|
1218
1220
|
}
|
|
1219
|
-
`,
|
|
1221
|
+
`, mr = K(we)`
|
|
1220
1222
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1221
1223
|
font-size: 16px;
|
|
1222
1224
|
cursor: pointer;
|
|
1223
1225
|
`;
|
|
1224
|
-
function
|
|
1226
|
+
function fr() {
|
|
1225
1227
|
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: l, developerName: a, showResourcesSwitch: c, layout: i, baseSearch: m } = I(), { filters: d, handleSort: g, handlePrice: p, handleDeveloper: f, handleSwitchShowResources: k, cleanFilter: S } = e, B = Ue(r);
|
|
1226
1228
|
return /* @__PURE__ */ h(
|
|
1227
1229
|
A,
|
|
@@ -1247,8 +1249,8 @@ function pr() {
|
|
|
1247
1249
|
justifyContent: { xs: "space-between", md: "flex-end" },
|
|
1248
1250
|
gap: 2,
|
|
1249
1251
|
children: [
|
|
1250
|
-
i.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: m ? /* @__PURE__ */ t(
|
|
1251
|
-
|
|
1252
|
+
i.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: m ? /* @__PURE__ */ t(ur, {}) : /* @__PURE__ */ t(
|
|
1253
|
+
dr,
|
|
1252
1254
|
{
|
|
1253
1255
|
locale: n,
|
|
1254
1256
|
endpoint: o,
|
|
@@ -1265,7 +1267,7 @@ function pr() {
|
|
|
1265
1267
|
}
|
|
1266
1268
|
) }) : null,
|
|
1267
1269
|
d.owner && a && /* @__PURE__ */ t(
|
|
1268
|
-
|
|
1270
|
+
Re,
|
|
1269
1271
|
{
|
|
1270
1272
|
label: r("blocklet.authorTag", { name: a }),
|
|
1271
1273
|
size: "small",
|
|
@@ -1273,7 +1275,7 @@ function pr() {
|
|
|
1273
1275
|
}
|
|
1274
1276
|
),
|
|
1275
1277
|
d.resourceDid && d.resourceBlocklet && /* @__PURE__ */ t(
|
|
1276
|
-
|
|
1278
|
+
Re,
|
|
1277
1279
|
{
|
|
1278
1280
|
label: r("blocklet.resourceTag", { name: d.resourceBlocklet }),
|
|
1279
1281
|
size: "small",
|
|
@@ -1281,7 +1283,7 @@ function pr() {
|
|
|
1281
1283
|
}
|
|
1282
1284
|
),
|
|
1283
1285
|
c ? /* @__PURE__ */ t(
|
|
1284
|
-
|
|
1286
|
+
Ee,
|
|
1285
1287
|
{
|
|
1286
1288
|
checked: d.showResources === "true",
|
|
1287
1289
|
onChange: (v) => k(v ? "true" : ""),
|
|
@@ -1289,7 +1291,7 @@ function pr() {
|
|
|
1289
1291
|
}
|
|
1290
1292
|
) : null,
|
|
1291
1293
|
/* @__PURE__ */ t(
|
|
1292
|
-
|
|
1294
|
+
Ee,
|
|
1293
1295
|
{
|
|
1294
1296
|
checked: d.price === "free",
|
|
1295
1297
|
onChange: (v) => p(v ? "free" : ""),
|
|
@@ -1312,7 +1314,7 @@ function pr() {
|
|
|
1312
1314
|
}
|
|
1313
1315
|
);
|
|
1314
1316
|
}
|
|
1315
|
-
function
|
|
1317
|
+
function Ee({
|
|
1316
1318
|
checked: e,
|
|
1317
1319
|
onChange: r,
|
|
1318
1320
|
label: o
|
|
@@ -1320,13 +1322,16 @@ function Ae({
|
|
|
1320
1322
|
return /* @__PURE__ */ t(
|
|
1321
1323
|
Ne,
|
|
1322
1324
|
{
|
|
1323
|
-
sx: { m: 0 },
|
|
1325
|
+
sx: { m: 0, p: 0 },
|
|
1326
|
+
className: "check-button",
|
|
1324
1327
|
control: /* @__PURE__ */ t(
|
|
1325
1328
|
Me,
|
|
1326
1329
|
{
|
|
1327
1330
|
checked: e,
|
|
1328
|
-
|
|
1329
|
-
|
|
1331
|
+
icon: /* @__PURE__ */ t(ee, { style: { padding: 0 }, icon: Tt }),
|
|
1332
|
+
checkedIcon: /* @__PURE__ */ t(ee, { style: { padding: 0, color: "#3478E2" }, icon: Pt }),
|
|
1333
|
+
size: "large",
|
|
1334
|
+
sx: { p: 0, mr: 1 },
|
|
1330
1335
|
onChange: (n) => r(n.target.checked)
|
|
1331
1336
|
}
|
|
1332
1337
|
),
|
|
@@ -1336,7 +1341,7 @@ function Ae({
|
|
|
1336
1341
|
}
|
|
1337
1342
|
function Z({ children: e }) {
|
|
1338
1343
|
return /* @__PURE__ */ h(y, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
|
|
1339
|
-
/* @__PURE__ */ t(
|
|
1344
|
+
/* @__PURE__ */ t(Ot, {}),
|
|
1340
1345
|
e
|
|
1341
1346
|
] });
|
|
1342
1347
|
}
|
|
@@ -1344,7 +1349,7 @@ function Fe() {
|
|
|
1344
1349
|
const { t: e } = I();
|
|
1345
1350
|
return /* @__PURE__ */ t(w, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
1346
1351
|
}
|
|
1347
|
-
function
|
|
1352
|
+
function he({ filterTip: e, keywordTip: r }) {
|
|
1348
1353
|
const { t: o, locale: n } = I(), l = () => n === "zh" ? "、" : " , ";
|
|
1349
1354
|
return /* @__PURE__ */ h(y, { mt: 1, display: "flex", children: [
|
|
1350
1355
|
/* @__PURE__ */ t(w, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
@@ -1353,7 +1358,7 @@ function ue({ filterTip: e, keywordTip: r }) {
|
|
|
1353
1358
|
r && /* @__PURE__ */ t(w, { children: o("blocklet.keywordTip") })
|
|
1354
1359
|
] });
|
|
1355
1360
|
}
|
|
1356
|
-
function
|
|
1361
|
+
function pe({
|
|
1357
1362
|
primaryStart: e,
|
|
1358
1363
|
primaryEnd: r,
|
|
1359
1364
|
filter: o
|
|
@@ -1367,49 +1372,49 @@ function he({
|
|
|
1367
1372
|
] })
|
|
1368
1373
|
] });
|
|
1369
1374
|
}
|
|
1370
|
-
function
|
|
1375
|
+
function gr() {
|
|
1371
1376
|
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: l } = r, a = !!n || !!l.price;
|
|
1372
1377
|
if (l.keyword && a)
|
|
1373
1378
|
return /* @__PURE__ */ h(Z, { children: [
|
|
1374
1379
|
/* @__PURE__ */ t(
|
|
1375
|
-
|
|
1380
|
+
pe,
|
|
1376
1381
|
{
|
|
1377
1382
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1378
1383
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1379
1384
|
filter: l.keyword
|
|
1380
1385
|
}
|
|
1381
1386
|
),
|
|
1382
|
-
/* @__PURE__ */ t(
|
|
1387
|
+
/* @__PURE__ */ t(he, { keywordTip: !0, filterTip: !0 })
|
|
1383
1388
|
] });
|
|
1384
1389
|
if (l.keyword)
|
|
1385
1390
|
return /* @__PURE__ */ h(Z, { children: [
|
|
1386
1391
|
/* @__PURE__ */ t(
|
|
1387
|
-
|
|
1392
|
+
pe,
|
|
1388
1393
|
{
|
|
1389
1394
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1390
1395
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1391
1396
|
filter: l.keyword
|
|
1392
1397
|
}
|
|
1393
1398
|
),
|
|
1394
|
-
/* @__PURE__ */ t(
|
|
1399
|
+
/* @__PURE__ */ t(he, { keywordTip: !0 })
|
|
1395
1400
|
] });
|
|
1396
1401
|
if (a) {
|
|
1397
1402
|
const c = o(n);
|
|
1398
1403
|
return /* @__PURE__ */ h(Z, { children: [
|
|
1399
1404
|
c ? /* @__PURE__ */ t(
|
|
1400
|
-
|
|
1405
|
+
pe,
|
|
1401
1406
|
{
|
|
1402
1407
|
primaryStart: e("blocklet.noCategoryResults1"),
|
|
1403
1408
|
primaryEnd: e("blocklet.noCategoryResults2"),
|
|
1404
1409
|
filter: c
|
|
1405
1410
|
}
|
|
1406
1411
|
) : /* @__PURE__ */ t(Fe, {}),
|
|
1407
|
-
/* @__PURE__ */ t(
|
|
1412
|
+
/* @__PURE__ */ t(he, { filterTip: !0 })
|
|
1408
1413
|
] });
|
|
1409
1414
|
}
|
|
1410
1415
|
return /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(Fe, {}) });
|
|
1411
1416
|
}
|
|
1412
|
-
const
|
|
1417
|
+
const xr = (e, r, o, n) => at(
|
|
1413
1418
|
async (l) => {
|
|
1414
1419
|
l || (o.currentPage = o.defaultCurrentPage);
|
|
1415
1420
|
const { currentPage: a, pageSize: c } = o, i = {
|
|
@@ -1425,17 +1430,17 @@ const fr = (e, r, o, n) => at(
|
|
|
1425
1430
|
},
|
|
1426
1431
|
{
|
|
1427
1432
|
isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
|
|
1428
|
-
reloadDeps: [e,
|
|
1433
|
+
reloadDeps: [e, _t(r)],
|
|
1429
1434
|
onError: n
|
|
1430
1435
|
}
|
|
1431
1436
|
);
|
|
1432
|
-
function
|
|
1437
|
+
function yr() {
|
|
1433
1438
|
var p;
|
|
1434
1439
|
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: l } = I(), { filters: a } = r, c = st({
|
|
1435
1440
|
currentPage: T.currentPage,
|
|
1436
|
-
pageSize:
|
|
1441
|
+
pageSize: Gt() ? T.mobilePageSize : T.pageSize,
|
|
1437
1442
|
defaultCurrentPage: T.defaultCurrentPage
|
|
1438
|
-
}), [i, m] = P(null), d =
|
|
1443
|
+
}), [i, m] = P(null), d = xr(e, a, c, m), g = H(
|
|
1439
1444
|
() => {
|
|
1440
1445
|
var f, k;
|
|
1441
1446
|
return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
|
|
@@ -1461,24 +1466,24 @@ function gr() {
|
|
|
1461
1466
|
}
|
|
1462
1467
|
};
|
|
1463
1468
|
}
|
|
1464
|
-
function
|
|
1465
|
-
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: l, minItemWidth: a, layout: c, baseSearch: i } = I(), { filters: m } = r, { blocklets: d, errors: g, loadMore: p, loadings: f, hasNextPage: k, total: S } =
|
|
1469
|
+
function wr() {
|
|
1470
|
+
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: l, minItemWidth: a, layout: c, baseSearch: i } = I(), { filters: m } = r, { blocklets: d, errors: g, loadMore: p, loadings: f, hasNextPage: k, total: S } = yr(), [B] = Rt({
|
|
1466
1471
|
loading: f.fetchBlockletsLoading || f.loadingMore,
|
|
1467
1472
|
hasNextPage: k,
|
|
1468
1473
|
onLoadMore: p
|
|
1469
1474
|
});
|
|
1470
1475
|
if (g.fetchBlockletsError) {
|
|
1471
1476
|
const x = new Error(`Failed to fetch blocklets from ${o}: ${g.fetchBlockletsError.message}`);
|
|
1472
|
-
return /* @__PURE__ */ t(
|
|
1477
|
+
return /* @__PURE__ */ t(ye, { error: x });
|
|
1473
1478
|
}
|
|
1474
1479
|
const v = i && c.showSearch || !m.keyword;
|
|
1475
1480
|
return /* @__PURE__ */ h(M, { children: [
|
|
1476
|
-
v ? /* @__PURE__ */ t(
|
|
1477
|
-
/* @__PURE__ */ t(
|
|
1481
|
+
v ? /* @__PURE__ */ t(fr, {}) : /* @__PURE__ */ h(M, { children: [
|
|
1482
|
+
/* @__PURE__ */ t(ve, { xs: /* @__PURE__ */ t(Ye, {}), md: null }),
|
|
1478
1483
|
C()
|
|
1479
1484
|
] }),
|
|
1480
1485
|
u(),
|
|
1481
|
-
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(y, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: B, children: /* @__PURE__ */ t(
|
|
1486
|
+
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(y, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: B, children: /* @__PURE__ */ t(ne, {}) })
|
|
1482
1487
|
] });
|
|
1483
1488
|
function u() {
|
|
1484
1489
|
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(Ze, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
|
|
@@ -1491,7 +1496,7 @@ function xr() {
|
|
|
1491
1496
|
gap: 2,
|
|
1492
1497
|
children: d.map((x) => /* @__PURE__ */ t(y, { "data-blocklet-did": x.did, sx: { minWidth: a }, children: n({ blocklet: x, blocklets: d, serverVersion: l }) }, x.did))
|
|
1493
1498
|
}
|
|
1494
|
-
) : /* @__PURE__ */ t(
|
|
1499
|
+
) : /* @__PURE__ */ t(gr, {});
|
|
1495
1500
|
}
|
|
1496
1501
|
function C() {
|
|
1497
1502
|
return /* @__PURE__ */ h(
|
|
@@ -1511,8 +1516,8 @@ function xr() {
|
|
|
1511
1516
|
);
|
|
1512
1517
|
}
|
|
1513
1518
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } =
|
|
1519
|
+
function br() {
|
|
1520
|
+
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = ke();
|
|
1516
1521
|
return /* @__PURE__ */ h(
|
|
1517
1522
|
w,
|
|
1518
1523
|
{
|
|
@@ -1523,26 +1528,26 @@ function yr() {
|
|
|
1523
1528
|
py: 2,
|
|
1524
1529
|
fontWeight: "fontWeightMedium",
|
|
1525
1530
|
children: [
|
|
1526
|
-
/* @__PURE__ */ t(Xe, { onClick: () => n(!0), children: /* @__PURE__ */ t(
|
|
1531
|
+
/* @__PURE__ */ t(Xe, { onClick: () => n(!0), children: /* @__PURE__ */ t(zt, {}) }),
|
|
1527
1532
|
o(r) || e("common.category")
|
|
1528
1533
|
]
|
|
1529
1534
|
}
|
|
1530
1535
|
);
|
|
1531
1536
|
}
|
|
1532
|
-
function
|
|
1537
|
+
function kr() {
|
|
1533
1538
|
const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
|
|
1534
|
-
return /* @__PURE__ */ t(
|
|
1535
|
-
/* @__PURE__ */ t(
|
|
1539
|
+
return /* @__PURE__ */ t(Dt, { children: /* @__PURE__ */ h(rt, { FallbackComponent: ye, children: [
|
|
1540
|
+
/* @__PURE__ */ t(br, {}),
|
|
1536
1541
|
/* @__PURE__ */ h(y, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1537
|
-
/* @__PURE__ */ t(
|
|
1538
|
-
/* @__PURE__ */ t(A, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(
|
|
1542
|
+
/* @__PURE__ */ t(rr, {}),
|
|
1543
|
+
/* @__PURE__ */ t(A, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(cr, {}) : /* @__PURE__ */ t(wr, {}) })
|
|
1539
1544
|
] })
|
|
1540
1545
|
] }) });
|
|
1541
1546
|
}
|
|
1542
|
-
function
|
|
1543
|
-
return /* @__PURE__ */ h(
|
|
1544
|
-
/* @__PURE__ */ h(
|
|
1545
|
-
/* @__PURE__ */ h(
|
|
1547
|
+
function Lo(e) {
|
|
1548
|
+
return /* @__PURE__ */ h(Mt, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
|
|
1549
|
+
/* @__PURE__ */ h(ae, { display: "flex", alignItems: "center", gap: 2, pb: 1, children: [
|
|
1550
|
+
/* @__PURE__ */ h(ae, { display: "flex", alignItems: "center", gap: 2, flex: 1, children: [
|
|
1546
1551
|
/* @__PURE__ */ t(O, { variant: "rounded", width: 48, height: 48 }),
|
|
1547
1552
|
/* @__PURE__ */ t(O, { variant: "text", width: 60, height: 28 })
|
|
1548
1553
|
] }),
|
|
@@ -1550,7 +1555,7 @@ function Po(e) {
|
|
|
1550
1555
|
] }),
|
|
1551
1556
|
/* @__PURE__ */ t(O, { variant: "text", width: "100%", height: 24 }),
|
|
1552
1557
|
/* @__PURE__ */ t(O, { variant: "text", width: "90%", height: 24 }),
|
|
1553
|
-
/* @__PURE__ */ h(
|
|
1558
|
+
/* @__PURE__ */ h(ae, { display: "flex", alignItems: "center", gap: 1, pt: 1.5, children: [
|
|
1554
1559
|
/* @__PURE__ */ t(O, { variant: "rounded", width: 24, height: 24 }),
|
|
1555
1560
|
/* @__PURE__ */ t(O, { variant: "text", width: "15%", height: 20 }),
|
|
1556
1561
|
/* @__PURE__ */ t(O, { variant: "rounded", width: 24, height: 24, sx: { ml: 1 } }),
|
|
@@ -1558,11 +1563,11 @@ function Po(e) {
|
|
|
1558
1563
|
] })
|
|
1559
1564
|
] });
|
|
1560
1565
|
}
|
|
1561
|
-
function
|
|
1562
|
-
return e ? /* @__PURE__ */ t(_, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(
|
|
1566
|
+
function Oo({ showSkeleton: e, ...r }) {
|
|
1567
|
+
return e ? /* @__PURE__ */ t(_, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(Nt, { ...r });
|
|
1563
1568
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const r =
|
|
1569
|
+
function _o(e) {
|
|
1570
|
+
const r = xe(), o = Je(
|
|
1566
1571
|
tt({
|
|
1567
1572
|
...r,
|
|
1568
1573
|
typography: {
|
|
@@ -1591,12 +1596,12 @@ function Fo(e) {
|
|
|
1591
1596
|
}
|
|
1592
1597
|
})
|
|
1593
1598
|
);
|
|
1594
|
-
return /* @__PURE__ */ t(et, { theme: o, children: /* @__PURE__ */ t(
|
|
1599
|
+
return /* @__PURE__ */ t(et, { theme: o, children: /* @__PURE__ */ t(Yt, { ...e, children: /* @__PURE__ */ t(kr, {}) }) });
|
|
1595
1600
|
}
|
|
1596
1601
|
export {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
+
dr as Autocomplete,
|
|
1603
|
+
Lo as CardSkeleton,
|
|
1604
|
+
Oo as Image,
|
|
1605
|
+
_o as default,
|
|
1606
|
+
$t as useSearch
|
|
1602
1607
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.22",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"react-dom": ">=18.2.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@blocklet/js-sdk": "1.16.33
|
|
56
|
-
"@blocklet/util": "0.14.
|
|
55
|
+
"@blocklet/js-sdk": "^1.16.33",
|
|
56
|
+
"@blocklet/util": "0.14.22",
|
|
57
57
|
"@emotion/react": "^11.10.0",
|
|
58
58
|
"@emotion/styled": "^11.10.0",
|
|
59
59
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"prettier": "^3.3.2",
|
|
91
91
|
"vite": "^5.4.10"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "bc4a74feeb544e6285347b0ea0c2be2349abd37c"
|
|
94
94
|
}
|