@nutui/taro-biz 0.0.1-alpha.17 → 0.0.1-alpha.19
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 +1 -1
- package/dist/es/jdmaterialview/index.js +6 -2
- package/dist/es/{jdmaterialview.taro-Di3QqSHi.mjs → jdmaterialview.taro-BOujNGjv.mjs} +86 -78
- package/dist/types/packages/jdmaterialview/index.taro.d.ts +1 -0
- package/dist/types/packages/jdmaterialview/scene-presets.taro.d.ts +46 -0
- package/dist/types/packages/jdmaterialview/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/es/index/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { J as
|
|
1
|
+
import { J as r } from "../jdmaterialview.taro-BOujNGjv.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-BOujNGjv.mjs";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
+
r as default,
|
|
5
|
+
s as getCornerRadius,
|
|
6
|
+
o as getFrostedPreset,
|
|
7
|
+
g as getPreset
|
|
4
8
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
4
|
-
import h, { getEnv as
|
|
5
|
-
import { View as
|
|
6
|
-
import { JDIOSMaterialView as
|
|
7
|
-
import { C as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const t = o >=
|
|
1
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F, useState as N, useCallback as P, useEffect as j } from "react";
|
|
3
|
+
import V from "classnames";
|
|
4
|
+
import h, { getEnv as T } from "@tarojs/taro";
|
|
5
|
+
import { View as I } from "@tarojs/components";
|
|
6
|
+
import { JDIOSMaterialView as _ } from "@jdtaro/ui";
|
|
7
|
+
import { C as E } from "./typings-CdeuPEKG.mjs";
|
|
8
|
+
const $ = 26;
|
|
9
|
+
function H(e, r, o) {
|
|
10
|
+
const t = o >= $;
|
|
11
11
|
switch (e) {
|
|
12
12
|
case "top-solid":
|
|
13
13
|
return t ? {
|
|
14
14
|
liquidGlass: {
|
|
15
15
|
style: "regular",
|
|
16
16
|
interactive: !0,
|
|
17
|
+
darkMode: r,
|
|
17
18
|
...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
18
19
|
}
|
|
19
20
|
} : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
|
|
@@ -22,6 +23,7 @@ function T(e, r, o) {
|
|
|
22
23
|
liquidGlass: {
|
|
23
24
|
style: "regular",
|
|
24
25
|
interactive: !0,
|
|
26
|
+
darkMode: r,
|
|
25
27
|
...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
26
28
|
}
|
|
27
29
|
} : {};
|
|
@@ -41,7 +43,7 @@ function T(e, r, o) {
|
|
|
41
43
|
return t ? {
|
|
42
44
|
liquidGlass: {
|
|
43
45
|
style: "regular",
|
|
44
|
-
|
|
46
|
+
darkMode: !0,
|
|
45
47
|
interactive: !0,
|
|
46
48
|
tintColor: "rgba(0, 0, 0, 0.75)"
|
|
47
49
|
}
|
|
@@ -59,8 +61,8 @@ function T(e, r, o) {
|
|
|
59
61
|
return {};
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
function
|
|
63
|
-
const o = r >=
|
|
64
|
+
function J(e, r) {
|
|
65
|
+
const o = r >= $;
|
|
64
66
|
switch (e) {
|
|
65
67
|
case "top-bar":
|
|
66
68
|
case "bottom-bar":
|
|
@@ -76,7 +78,7 @@ function _(e, r) {
|
|
|
76
78
|
return 0;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
function
|
|
81
|
+
function x(e) {
|
|
80
82
|
switch (e) {
|
|
81
83
|
case "top-bar":
|
|
82
84
|
case "bottom-bar":
|
|
@@ -91,9 +93,9 @@ function I(e) {
|
|
|
91
93
|
return 0;
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
const
|
|
95
|
-
function
|
|
96
|
-
const o =
|
|
96
|
+
const p = "255, 255, 255", G = "31, 34, 38";
|
|
97
|
+
function Y(e, r) {
|
|
98
|
+
const o = x(e);
|
|
97
99
|
switch (e) {
|
|
98
100
|
case "top-solid":
|
|
99
101
|
return {
|
|
@@ -107,30 +109,30 @@ function E(e, r) {
|
|
|
107
109
|
return {
|
|
108
110
|
blurRadius: 40,
|
|
109
111
|
borderRadius: o,
|
|
110
|
-
tintColor: r ? `rgba(${
|
|
112
|
+
tintColor: r ? `rgba(${G}, 0.9)` : `rgba(${p}, 0.9)`
|
|
111
113
|
};
|
|
112
114
|
case "promotion-fair":
|
|
113
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
115
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${p}, 0.85)` };
|
|
114
116
|
case "promotion-deep":
|
|
115
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
117
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${p}, 0.2)` };
|
|
116
118
|
case "immersive":
|
|
117
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
119
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${G}, 0.4)` };
|
|
118
120
|
case "bottom-bar":
|
|
119
121
|
return {
|
|
120
122
|
blurRadius: 50,
|
|
121
123
|
borderRadius: o,
|
|
122
|
-
tintColor: r ? `rgba(${
|
|
124
|
+
tintColor: r ? `rgba(${G}, 0.8)` : `rgba(${p}, 0.8)`
|
|
123
125
|
};
|
|
124
126
|
default:
|
|
125
127
|
return { blurRadius: 40, borderRadius: o };
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
|
-
function
|
|
130
|
+
function K(e) {
|
|
129
131
|
const r = e ? "0, 0, 0" : "255, 255, 255";
|
|
130
132
|
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%)`;
|
|
131
133
|
}
|
|
132
|
-
function
|
|
133
|
-
const o = r ? "dark" : "light", t =
|
|
134
|
+
function Q(e, r) {
|
|
135
|
+
const o = r ? "dark" : "light", t = x(e);
|
|
134
136
|
switch (e) {
|
|
135
137
|
case "top-solid":
|
|
136
138
|
return {
|
|
@@ -159,22 +161,22 @@ function J(e, r) {
|
|
|
159
161
|
blurScale: 0.2,
|
|
160
162
|
borderRadius: t,
|
|
161
163
|
colorMode: o,
|
|
162
|
-
backgroundGradient:
|
|
164
|
+
backgroundGradient: K(r),
|
|
163
165
|
boxShadow: "0 8px 40px rgba(0, 0, 0, 0.12)"
|
|
164
166
|
};
|
|
165
167
|
default:
|
|
166
168
|
return { blurScale: 0, borderRadius: t, colorMode: o };
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
|
-
const
|
|
170
|
-
...
|
|
171
|
+
const U = {
|
|
172
|
+
...E
|
|
171
173
|
};
|
|
172
|
-
function
|
|
174
|
+
function z() {
|
|
173
175
|
return ["harmony", "harmonyhybrid", "jdharmony"].includes(
|
|
174
|
-
|
|
176
|
+
T().toLowerCase()
|
|
175
177
|
);
|
|
176
178
|
}
|
|
177
|
-
function
|
|
179
|
+
function W() {
|
|
178
180
|
var e;
|
|
179
181
|
try {
|
|
180
182
|
const r = h.getSystemInfoSync(), o = String((r == null ? void 0 : r.platform) || "").toLowerCase(), t = String((r == null ? void 0 : r.system) || ""), i = o === "ios", u = i ? parseInt(((e = t.match(/\d+/)) == null ? void 0 : e[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
|
|
@@ -183,7 +185,7 @@ function Q() {
|
|
|
183
185
|
return { isIOS: !1, iosMajor: 0, dark: !1 };
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
|
-
function
|
|
188
|
+
function X() {
|
|
187
189
|
try {
|
|
188
190
|
const e = h.getSystemInfoSync();
|
|
189
191
|
return String((e == null ? void 0 : e.theme) || "").toLowerCase() === "dark";
|
|
@@ -191,82 +193,88 @@ function U() {
|
|
|
191
193
|
return !1;
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
|
-
function
|
|
195
|
-
const { scene: r, dark: o, overlayColor: t, cls: i, style: u, children: b, rest:
|
|
196
|
+
function Z(e) {
|
|
197
|
+
const { scene: r, dark: o, overlayColor: t, cls: i, style: u, children: b, rest: m } = e, a = r ? Q(r, o) : void 0, s = {};
|
|
196
198
|
a ? (s.blurScale = a.blurScale, s.borderRadius = a.borderRadius, s.colorMode = a.colorMode) : s.colorMode = o ? "dark" : "light", (u == null ? void 0 : u.borderRadius) !== void 0 && (s.borderRadius = parseFloat(String(u.borderRadius)));
|
|
197
|
-
const l = { ...u },
|
|
198
|
-
return
|
|
199
|
+
const l = { ...u }, d = t ?? (a == null ? void 0 : a.overlayColor);
|
|
200
|
+
return d && l.backgroundColor === void 0 && (l.backgroundColor = d), a != null && a.backgroundGradient && l.background === void 0 && (l.background = a.backgroundGradient), a != null && a.boxShadow && l.boxShadow === void 0 && (l.boxShadow = a.boxShadow), /* @__PURE__ */ k(I, { className: i, style: l, ...s, ...m, children: b });
|
|
199
201
|
}
|
|
200
|
-
function
|
|
201
|
-
const { scene: r, dark: o, targetId: t, overlayColor: i, cls: u, style: b, children:
|
|
202
|
+
function rr(e) {
|
|
203
|
+
const { scene: r, dark: o, targetId: t, overlayColor: i, cls: u, style: b, children: m, rest: a } = e, s = r ? Y(r, o) : void 0, l = { ...b };
|
|
202
204
|
s && s.blurRadius > 0 && (l.backdropFilter = `blur(${s.blurRadius}px)`), s && l.borderRadius === void 0 && (l.borderRadius = `${s.borderRadius}px`);
|
|
203
|
-
const
|
|
204
|
-
return t && (
|
|
205
|
+
const d = i ?? (s == null ? void 0 : s.tintColor), g = {};
|
|
206
|
+
return t && (g.targetId = t), r && (g.scene = r), d && (g.overlayColor = d), /* @__PURE__ */ k(I, { className: u, style: l, ...g, ...a, children: m });
|
|
205
207
|
}
|
|
206
|
-
const
|
|
208
|
+
const or = (e) => {
|
|
207
209
|
const {
|
|
208
210
|
className: r,
|
|
209
211
|
style: o,
|
|
210
212
|
children: t,
|
|
211
213
|
scene: i,
|
|
212
214
|
targetId: u,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
theme: b = "auto",
|
|
216
|
+
liquidGlass: m,
|
|
217
|
+
frostedGlass: a,
|
|
218
|
+
gradientBlur: s,
|
|
219
|
+
overlayColor: l,
|
|
220
|
+
...d
|
|
221
|
+
} = { ...U, ...e }, S = V("nut-jdmaterialview", r), { isIOS: q, iosMajor: v } = F(() => W(), []), C = b === "auto", [L, A] = N(() => X()), R = P(
|
|
219
222
|
(c) => {
|
|
220
|
-
const
|
|
221
|
-
|
|
223
|
+
const y = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
|
|
224
|
+
A(y.toLowerCase() === "dark");
|
|
222
225
|
},
|
|
223
226
|
[]
|
|
224
227
|
);
|
|
225
|
-
|
|
226
|
-
var c,
|
|
227
|
-
|
|
228
|
-
(p = (c = h).onThemeChange) == null || p.call(c, v);
|
|
229
|
-
} catch {
|
|
230
|
-
}
|
|
231
|
-
return () => {
|
|
232
|
-
var G, k;
|
|
228
|
+
j(() => {
|
|
229
|
+
var c, y;
|
|
230
|
+
if (C) {
|
|
233
231
|
try {
|
|
234
|
-
(
|
|
232
|
+
(y = (c = h).onThemeChange) == null || y.call(c, R);
|
|
235
233
|
} catch {
|
|
236
234
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
235
|
+
return () => {
|
|
236
|
+
var w, M;
|
|
237
|
+
try {
|
|
238
|
+
(M = (w = h).offThemeChange) == null || M.call(w, R);
|
|
239
|
+
} catch {
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}, [C, R]);
|
|
244
|
+
const f = C ? L : b === "dark", n = F(
|
|
245
|
+
() => i ? H(i, f, v) : void 0,
|
|
246
|
+
[i, f, v]
|
|
247
|
+
), O = m ?? (n == null ? void 0 : n.liquidGlass), B = a ?? (n == null ? void 0 : n.frostedGlass), D = s ?? (n == null ? void 0 : n.gradientBlur);
|
|
248
|
+
if (q) {
|
|
244
249
|
const c = { ...n == null ? void 0 : n.fallbackStyle, ...o };
|
|
245
|
-
return i && c.borderRadius === void 0 && (c.borderRadius = `${
|
|
246
|
-
|
|
250
|
+
return i && c.borderRadius === void 0 && (c.borderRadius = `${J(i, v)}px`), /* @__PURE__ */ k(
|
|
251
|
+
_,
|
|
247
252
|
{
|
|
248
|
-
className:
|
|
253
|
+
className: S,
|
|
249
254
|
style: c,
|
|
250
|
-
liquidGlass:
|
|
251
|
-
frostedGlass:
|
|
252
|
-
gradientBlur:
|
|
253
|
-
...
|
|
255
|
+
liquidGlass: O,
|
|
256
|
+
frostedGlass: B,
|
|
257
|
+
gradientBlur: D,
|
|
258
|
+
...d,
|
|
254
259
|
children: t
|
|
255
260
|
}
|
|
256
261
|
);
|
|
257
262
|
}
|
|
258
|
-
return
|
|
263
|
+
return z() ? Z({ scene: i, dark: f, overlayColor: l, cls: S, style: o, children: t, rest: d }) : rr({
|
|
259
264
|
scene: i,
|
|
260
265
|
dark: f,
|
|
261
266
|
targetId: u,
|
|
262
|
-
overlayColor:
|
|
263
|
-
cls:
|
|
267
|
+
overlayColor: l,
|
|
268
|
+
cls: S,
|
|
264
269
|
style: o,
|
|
265
270
|
children: t,
|
|
266
|
-
rest:
|
|
271
|
+
rest: d
|
|
267
272
|
});
|
|
268
273
|
};
|
|
269
|
-
|
|
274
|
+
or.displayName = "NutJDMaterialView";
|
|
270
275
|
export {
|
|
271
|
-
|
|
276
|
+
or as J,
|
|
277
|
+
Y as a,
|
|
278
|
+
H as b,
|
|
279
|
+
J as g
|
|
272
280
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MaterialScene } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 解析场景材质预设。
|
|
4
|
+
* @param scene 材质场景
|
|
5
|
+
* @param dark 是否暗色(已由 theme 解析)
|
|
6
|
+
* @param iosMajor iOS 主版本号(非 iOS 或解析失败传 0;用于液态玻璃场景的 <26 回退)
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPreset(scene: MaterialScene, dark: boolean, iosMajor: number): MaterialPreset;
|
|
9
|
+
/**
|
|
10
|
+
* 解析场景默认圆角(业务未传 borderRadius 时使用)。
|
|
11
|
+
* 对齐 ObjC JDGlassContainerView 的 effectiveCornerRadius:
|
|
12
|
+
* - 背板(top-bar / bottom-bar)恒 0;
|
|
13
|
+
* - top 容器 iOS≥26 用玻璃时 12,<26 回退 8;
|
|
14
|
+
* - top-plain 透明回退时 <26 归 0(透明无背景,圆角无意义)。
|
|
15
|
+
* @param scene 材质场景
|
|
16
|
+
* @param iosMajor iOS 主版本号(<26 走回退圆角)
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCornerRadius(scene: MaterialScene, iosMajor: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* 非 iOS(安卓 / 鸿蒙)场景圆角。安卓与鸿蒙圆角完全一致,共用此函数(设计已对齐):
|
|
21
|
+
* - 悬浮容器(top-solid / top-plain / promotion-fair / promotion-deep / immersive):8
|
|
22
|
+
* - 背板(top-bar / bottom-bar):0
|
|
23
|
+
* 日夜一致、与平台/版本无关。iOS 圆角另走 getCornerRadius(按版本回退,规则不同)。
|
|
24
|
+
* @param scene 材质场景
|
|
25
|
+
*/
|
|
26
|
+
export declare function getNonIOSCornerRadius(scene: MaterialScene): number;
|
|
27
|
+
/**
|
|
28
|
+
* 解析非 iOS 场景毛玻璃预设。
|
|
29
|
+
* 对齐安卓 GlassStyle:blurRadius + borderRadius + 叠加色(tintColor = rgba(overlayRGB, alpha%))。
|
|
30
|
+
* 圆角为安卓专用:每场景定值、日夜一致、与 iOS 版本无关(bottom-bar 为 0,其余 12),
|
|
31
|
+
* 不复用 iOS 的 getCornerRadius(后者按版本回退且 top-bar 恒 0,规则不同)。
|
|
32
|
+
* @param scene 材质场景
|
|
33
|
+
* @param dark 是否暗色(已由 theme 解析)
|
|
34
|
+
*/
|
|
35
|
+
export declare function getFrostedPreset(scene: MaterialScene, dark: boolean): FrostedPreset;
|
|
36
|
+
/**
|
|
37
|
+
* 解析鸿蒙场景预设。blurScale / borderRadius / colorMode 透传鸿蒙原生 prop;
|
|
38
|
+
* overlayColor 落 CSS style.backgroundColor(非原生属性)。
|
|
39
|
+
* colorMode 由「场景」决定,而非简单跟随系统:
|
|
40
|
+
* - promotion-fair / promotion-deep 恒 light;immersive 恒 dark;
|
|
41
|
+
* - 其余场景(top-solid / top-plain / top-bar / bottom-bar)跟随系统明暗。
|
|
42
|
+
* overlayColor 仅 top-solid 有(随明暗),其余场景颜色靠 colorMode 控制。
|
|
43
|
+
* @param scene 材质场景
|
|
44
|
+
* @param dark 是否暗色(已由 theme 解析,用于跟随系统的场景)
|
|
45
|
+
*/
|
|
46
|
+
export declare function getHarmonyPreset(scene: MaterialScene, dark: boolean): HarmonyPreset;
|
|
@@ -17,4 +17,9 @@ export interface JDMaterialViewProps extends BasicComponent {
|
|
|
17
17
|
scene: MaterialScene;
|
|
18
18
|
/** 模糊源 targetId,与 JDMaterialsBlurTarget 的 blurId 对应 */
|
|
19
19
|
targetId: string;
|
|
20
|
+
/**
|
|
21
|
+
* 明暗主题。默认 auto 跟随系统主题;传 light / dark 则固定为对应明暗、
|
|
22
|
+
* 不再随系统主题变化。(immersive、promotion-* 等场景明暗由场景语义固定,不受影响)
|
|
23
|
+
*/
|
|
24
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
20
25
|
}
|