@nutui/taro-biz 0.0.1-alpha.20 → 0.0.1-alpha.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/dist/es/index/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as r } from "../jdmaterialview.taro-
|
|
2
|
-
import { g as s, a as o, b as g } from "../jdmaterialview.taro-
|
|
1
|
+
import { J as r } from "../jdmaterialview.taro-CJ45MtXg.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-CJ45MtXg.mjs";
|
|
3
3
|
export {
|
|
4
4
|
r as default,
|
|
5
5
|
s as getCornerRadius,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as $, useState as N, useCallback as P, useEffect as j } from "react";
|
|
3
3
|
import V from "classnames";
|
|
4
4
|
import h, { getEnv as T } from "@tarojs/taro";
|
|
5
|
-
import { JDIOSMaterialView as _, View as
|
|
5
|
+
import { JDIOSMaterialView as _, View as x } from "@jdtaro/ui";
|
|
6
6
|
import { C as E } from "./typings-CdeuPEKG.mjs";
|
|
7
|
-
const
|
|
7
|
+
const F = 26;
|
|
8
8
|
function H(e, r, o) {
|
|
9
|
-
const t = o >=
|
|
9
|
+
const t = o >= F;
|
|
10
10
|
switch (e) {
|
|
11
11
|
case "top-solid":
|
|
12
12
|
return t ? {
|
|
@@ -61,7 +61,7 @@ function H(e, r, o) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
function J(e, r) {
|
|
64
|
-
const o = r >=
|
|
64
|
+
const o = r >= F;
|
|
65
65
|
switch (e) {
|
|
66
66
|
case "top-bar":
|
|
67
67
|
case "bottom-bar":
|
|
@@ -77,7 +77,7 @@ function J(e, r) {
|
|
|
77
77
|
return 0;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function I(e) {
|
|
81
81
|
switch (e) {
|
|
82
82
|
case "top-bar":
|
|
83
83
|
case "bottom-bar":
|
|
@@ -92,9 +92,9 @@ function x(e) {
|
|
|
92
92
|
return 0;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
const p = "255, 255, 255",
|
|
95
|
+
const p = "255, 255, 255", R = "31, 34, 38";
|
|
96
96
|
function Y(e, r) {
|
|
97
|
-
const o =
|
|
97
|
+
const o = I(e);
|
|
98
98
|
switch (e) {
|
|
99
99
|
case "top-solid":
|
|
100
100
|
return {
|
|
@@ -108,19 +108,19 @@ function Y(e, r) {
|
|
|
108
108
|
return {
|
|
109
109
|
blurRadius: 40,
|
|
110
110
|
borderRadius: o,
|
|
111
|
-
tintColor: r ? `rgba(${
|
|
111
|
+
tintColor: r ? `rgba(${R}, 0.9)` : `rgba(${p}, 0.9)`
|
|
112
112
|
};
|
|
113
113
|
case "promotion-fair":
|
|
114
114
|
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${p}, 0.85)` };
|
|
115
115
|
case "promotion-deep":
|
|
116
116
|
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${p}, 0.2)` };
|
|
117
117
|
case "immersive":
|
|
118
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
118
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${R}, 0.4)` };
|
|
119
119
|
case "bottom-bar":
|
|
120
120
|
return {
|
|
121
121
|
blurRadius: 50,
|
|
122
122
|
borderRadius: o,
|
|
123
|
-
tintColor: r ? `rgba(${
|
|
123
|
+
tintColor: r ? `rgba(${R}, 0.8)` : `rgba(${p}, 0.8)`
|
|
124
124
|
};
|
|
125
125
|
default:
|
|
126
126
|
return { blurRadius: 40, borderRadius: o };
|
|
@@ -131,7 +131,7 @@ function K(e) {
|
|
|
131
131
|
return `linear-gradient(to bottom, rgba(${r}, 0.8) 0%, rgba(${r}, 0.8) 56%, rgba(${r}, 0.78) 66%, rgba(${r}, 0.72) 76%, rgba(${r}, 0.62) 86%, rgba(${r}, 0.49) 94%, rgba(${r}, 0.3) 100%)`;
|
|
132
132
|
}
|
|
133
133
|
function Q(e, r) {
|
|
134
|
-
const o = r ? "dark" : "light", t =
|
|
134
|
+
const o = r ? "dark" : "light", t = I(e);
|
|
135
135
|
switch (e) {
|
|
136
136
|
case "top-solid":
|
|
137
137
|
return {
|
|
@@ -147,7 +147,7 @@ function Q(e, r) {
|
|
|
147
147
|
blurScale: 0.9,
|
|
148
148
|
borderRadius: t,
|
|
149
149
|
colorMode: o,
|
|
150
|
-
overlayColor: r ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.
|
|
150
|
+
overlayColor: r ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.62)"
|
|
151
151
|
};
|
|
152
152
|
case "promotion-fair":
|
|
153
153
|
return { blurScale: 0.85, borderRadius: t, colorMode: "light" };
|
|
@@ -193,16 +193,18 @@ function X() {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
function Z(e) {
|
|
196
|
-
const { scene: r, dark: o, overlayColor: t, cls: i, style: u, children: b, rest: m } = e, a = r ? Q(r, o) : void 0,
|
|
197
|
-
a ? (
|
|
198
|
-
const
|
|
199
|
-
|
|
196
|
+
const { scene: r, dark: o, overlayColor: t, cls: i, style: u, children: b, rest: m } = e, a = r ? Q(r, o) : void 0, l = {};
|
|
197
|
+
a ? (l.blurScale = a.blurScale, l.colorMode = a.colorMode) : l.colorMode = o ? "dark" : "light";
|
|
198
|
+
const s = { ...u };
|
|
199
|
+
(u == null ? void 0 : u.borderRadius) === void 0 && a && (s.borderRadius = `${a.borderRadius}px`);
|
|
200
|
+
const d = t ?? (a == null ? void 0 : a.overlayColor);
|
|
201
|
+
return d && s.backgroundColor === void 0 && (s.backgroundColor = d), a != null && a.backgroundGradient && s.background === void 0 && (s.background = a.backgroundGradient), a != null && a.boxShadow && s.boxShadow === void 0 && (s.boxShadow = a.boxShadow), /* @__PURE__ */ k(x, { className: i, style: s, ...l, ...m, children: b });
|
|
200
202
|
}
|
|
201
203
|
function rr(e) {
|
|
202
|
-
const { scene: r, dark: o, targetId: t, overlayColor: i, cls: u, style: b, children: m, rest: a } = e,
|
|
203
|
-
|
|
204
|
-
const d = i ?? (
|
|
205
|
-
return t && (g.targetId = t), r && (g.scene = r), d && (g.overlayColor = d), /* @__PURE__ */ k(
|
|
204
|
+
const { scene: r, dark: o, targetId: t, overlayColor: i, cls: u, style: b, children: m, rest: a } = e, l = r ? Y(r, o) : void 0, s = { ...b };
|
|
205
|
+
l && l.blurRadius > 0 && (s.backdropFilter = `blur(${l.blurRadius}px)`), l && s.borderRadius === void 0 && (s.borderRadius = `${l.borderRadius}px`);
|
|
206
|
+
const d = i ?? (l == null ? void 0 : l.tintColor), g = {};
|
|
207
|
+
return t && (g.targetId = t), r && (g.scene = r), d && (g.overlayColor = d), /* @__PURE__ */ k(x, { className: u, style: s, ...g, ...a, children: m });
|
|
206
208
|
}
|
|
207
209
|
const or = (e) => {
|
|
208
210
|
const {
|
|
@@ -214,10 +216,10 @@ const or = (e) => {
|
|
|
214
216
|
theme: b = "auto",
|
|
215
217
|
liquidGlass: m,
|
|
216
218
|
frostedGlass: a,
|
|
217
|
-
gradientBlur:
|
|
218
|
-
overlayColor:
|
|
219
|
+
gradientBlur: l,
|
|
220
|
+
overlayColor: s,
|
|
219
221
|
...d
|
|
220
|
-
} = { ...U, ...e }, S = V("nut-jdmaterialview", r), { isIOS: q, iosMajor: v } =
|
|
222
|
+
} = { ...U, ...e }, S = V("nut-jdmaterialview", r), { isIOS: q, iosMajor: v } = $(() => W(), []), C = b === "auto", [L, A] = N(() => X()), G = P(
|
|
221
223
|
(c) => {
|
|
222
224
|
const y = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
|
|
223
225
|
A(y.toLowerCase() === "dark");
|
|
@@ -228,22 +230,22 @@ const or = (e) => {
|
|
|
228
230
|
var c, y;
|
|
229
231
|
if (C) {
|
|
230
232
|
try {
|
|
231
|
-
(y = (c = h).onThemeChange) == null || y.call(c,
|
|
233
|
+
(y = (c = h).onThemeChange) == null || y.call(c, G);
|
|
232
234
|
} catch {
|
|
233
235
|
}
|
|
234
236
|
return () => {
|
|
235
237
|
var w, M;
|
|
236
238
|
try {
|
|
237
|
-
(M = (w = h).offThemeChange) == null || M.call(w,
|
|
239
|
+
(M = (w = h).offThemeChange) == null || M.call(w, G);
|
|
238
240
|
} catch {
|
|
239
241
|
}
|
|
240
242
|
};
|
|
241
243
|
}
|
|
242
|
-
}, [C,
|
|
243
|
-
const f = C ? L : b === "dark", n =
|
|
244
|
+
}, [C, G]);
|
|
245
|
+
const f = C ? L : b === "dark", n = $(
|
|
244
246
|
() => i ? H(i, f, v) : void 0,
|
|
245
247
|
[i, f, v]
|
|
246
|
-
), O = m ?? (n == null ? void 0 : n.liquidGlass), B = a ?? (n == null ? void 0 : n.frostedGlass), D =
|
|
248
|
+
), O = m ?? (n == null ? void 0 : n.liquidGlass), B = a ?? (n == null ? void 0 : n.frostedGlass), D = l ?? (n == null ? void 0 : n.gradientBlur);
|
|
247
249
|
if (q) {
|
|
248
250
|
const c = { ...n == null ? void 0 : n.fallbackStyle, ...o };
|
|
249
251
|
return i && c.borderRadius === void 0 && (c.borderRadius = `${J(i, v)}px`), /* @__PURE__ */ k(
|
|
@@ -259,11 +261,11 @@ const or = (e) => {
|
|
|
259
261
|
}
|
|
260
262
|
);
|
|
261
263
|
}
|
|
262
|
-
return z() ? Z({ scene: i, dark: f, overlayColor:
|
|
264
|
+
return z() ? Z({ scene: i, dark: f, overlayColor: s, cls: S, style: o, children: t, rest: d }) : rr({
|
|
263
265
|
scene: i,
|
|
264
266
|
dark: f,
|
|
265
267
|
targetId: u,
|
|
266
|
-
overlayColor:
|
|
268
|
+
overlayColor: s,
|
|
267
269
|
cls: S,
|
|
268
270
|
style: o,
|
|
269
271
|
children: t,
|