@nutui/taro-biz 0.0.1-alpha.18 → 0.0.1-alpha.20
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 +2 -2
- package/dist/es/jdmaterialsblurtarget/index.js +1 -1
- package/dist/es/{jdmaterialsblurtarget.taro-DCTEjmIC.mjs → jdmaterialsblurtarget.taro-CuU6ZagQ.mjs} +1 -1
- package/dist/es/jdmaterialview/index.js +6 -2
- package/dist/es/{jdmaterialview.taro-C86oW55a.mjs → jdmaterialview.taro-CfsBG1ft.mjs} +82 -77
- 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,5 +1,5 @@
|
|
|
1
|
-
import { J as e } from "../jdmaterialview.taro-
|
|
2
|
-
import { J as o } from "../jdmaterialsblurtarget.taro-
|
|
1
|
+
import { J as e } from "../jdmaterialview.taro-CfsBG1ft.mjs";
|
|
2
|
+
import { J as o } from "../jdmaterialsblurtarget.taro-CuU6ZagQ.mjs";
|
|
3
3
|
export {
|
|
4
4
|
e as JDMaterialView,
|
|
5
5
|
o as JDMaterialsBlurTarget
|
package/dist/es/{jdmaterialsblurtarget.taro-DCTEjmIC.mjs → jdmaterialsblurtarget.taro-CuU6ZagQ.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, Fragment as i } from "react/jsx-runtime";
|
|
2
2
|
import m from "classnames";
|
|
3
3
|
import c from "@tarojs/taro";
|
|
4
|
-
import { View as f } from "@
|
|
4
|
+
import { View as f } from "@jdtaro/ui";
|
|
5
5
|
import { C as u } from "./typings-CdeuPEKG.mjs";
|
|
6
6
|
const p = {
|
|
7
7
|
...u
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { J as
|
|
1
|
+
import { J as r } from "../jdmaterialview.taro-CfsBG1ft.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-CfsBG1ft.mjs";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
+
r as default,
|
|
5
|
+
s as getCornerRadius,
|
|
6
|
+
o as getFrostedPreset,
|
|
7
|
+
g as getPreset
|
|
4
8
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
4
|
-
import h, { getEnv as
|
|
5
|
-
import { View as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const t = o >= F;
|
|
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 { JDIOSMaterialView as _, View as I } from "@jdtaro/ui";
|
|
6
|
+
import { C as E } from "./typings-CdeuPEKG.mjs";
|
|
7
|
+
const $ = 26;
|
|
8
|
+
function H(e, r, o) {
|
|
9
|
+
const t = o >= $;
|
|
11
10
|
switch (e) {
|
|
12
11
|
case "top-solid":
|
|
13
12
|
return t ? {
|
|
@@ -61,8 +60,8 @@ function T(e, r, o) {
|
|
|
61
60
|
return {};
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
function
|
|
65
|
-
const o = r >=
|
|
63
|
+
function J(e, r) {
|
|
64
|
+
const o = r >= $;
|
|
66
65
|
switch (e) {
|
|
67
66
|
case "top-bar":
|
|
68
67
|
case "bottom-bar":
|
|
@@ -78,7 +77,7 @@ function _(e, r) {
|
|
|
78
77
|
return 0;
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
function
|
|
80
|
+
function x(e) {
|
|
82
81
|
switch (e) {
|
|
83
82
|
case "top-bar":
|
|
84
83
|
case "bottom-bar":
|
|
@@ -93,9 +92,9 @@ function I(e) {
|
|
|
93
92
|
return 0;
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
|
-
const
|
|
97
|
-
function
|
|
98
|
-
const o =
|
|
95
|
+
const p = "255, 255, 255", G = "31, 34, 38";
|
|
96
|
+
function Y(e, r) {
|
|
97
|
+
const o = x(e);
|
|
99
98
|
switch (e) {
|
|
100
99
|
case "top-solid":
|
|
101
100
|
return {
|
|
@@ -109,30 +108,30 @@ function E(e, r) {
|
|
|
109
108
|
return {
|
|
110
109
|
blurRadius: 40,
|
|
111
110
|
borderRadius: o,
|
|
112
|
-
tintColor: r ? `rgba(${
|
|
111
|
+
tintColor: r ? `rgba(${G}, 0.9)` : `rgba(${p}, 0.9)`
|
|
113
112
|
};
|
|
114
113
|
case "promotion-fair":
|
|
115
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
114
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${p}, 0.85)` };
|
|
116
115
|
case "promotion-deep":
|
|
117
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
116
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${p}, 0.2)` };
|
|
118
117
|
case "immersive":
|
|
119
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
118
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${G}, 0.4)` };
|
|
120
119
|
case "bottom-bar":
|
|
121
120
|
return {
|
|
122
121
|
blurRadius: 50,
|
|
123
122
|
borderRadius: o,
|
|
124
|
-
tintColor: r ? `rgba(${
|
|
123
|
+
tintColor: r ? `rgba(${G}, 0.8)` : `rgba(${p}, 0.8)`
|
|
125
124
|
};
|
|
126
125
|
default:
|
|
127
126
|
return { blurRadius: 40, borderRadius: o };
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
|
-
function
|
|
129
|
+
function K(e) {
|
|
131
130
|
const r = e ? "0, 0, 0" : "255, 255, 255";
|
|
132
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%)`;
|
|
133
132
|
}
|
|
134
|
-
function
|
|
135
|
-
const o = r ? "dark" : "light", t =
|
|
133
|
+
function Q(e, r) {
|
|
134
|
+
const o = r ? "dark" : "light", t = x(e);
|
|
136
135
|
switch (e) {
|
|
137
136
|
case "top-solid":
|
|
138
137
|
return {
|
|
@@ -161,22 +160,22 @@ function J(e, r) {
|
|
|
161
160
|
blurScale: 0.2,
|
|
162
161
|
borderRadius: t,
|
|
163
162
|
colorMode: o,
|
|
164
|
-
backgroundGradient:
|
|
163
|
+
backgroundGradient: K(r),
|
|
165
164
|
boxShadow: "0 8px 40px rgba(0, 0, 0, 0.12)"
|
|
166
165
|
};
|
|
167
166
|
default:
|
|
168
167
|
return { blurScale: 0, borderRadius: t, colorMode: o };
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
|
-
const
|
|
172
|
-
...
|
|
170
|
+
const U = {
|
|
171
|
+
...E
|
|
173
172
|
};
|
|
174
|
-
function
|
|
173
|
+
function z() {
|
|
175
174
|
return ["harmony", "harmonyhybrid", "jdharmony"].includes(
|
|
176
|
-
|
|
175
|
+
T().toLowerCase()
|
|
177
176
|
);
|
|
178
177
|
}
|
|
179
|
-
function
|
|
178
|
+
function W() {
|
|
180
179
|
var e;
|
|
181
180
|
try {
|
|
182
181
|
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";
|
|
@@ -185,7 +184,7 @@ function Q() {
|
|
|
185
184
|
return { isIOS: !1, iosMajor: 0, dark: !1 };
|
|
186
185
|
}
|
|
187
186
|
}
|
|
188
|
-
function
|
|
187
|
+
function X() {
|
|
189
188
|
try {
|
|
190
189
|
const e = h.getSystemInfoSync();
|
|
191
190
|
return String((e == null ? void 0 : e.theme) || "").toLowerCase() === "dark";
|
|
@@ -193,82 +192,88 @@ function U() {
|
|
|
193
192
|
return !1;
|
|
194
193
|
}
|
|
195
194
|
}
|
|
196
|
-
function
|
|
197
|
-
const { scene: r, dark: o, overlayColor: t, cls: i, style: u, children: b, rest:
|
|
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, s = {};
|
|
198
197
|
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)));
|
|
199
|
-
const l = { ...u },
|
|
200
|
-
return
|
|
198
|
+
const l = { ...u }, d = t ?? (a == null ? void 0 : a.overlayColor);
|
|
199
|
+
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 });
|
|
201
200
|
}
|
|
202
|
-
function
|
|
203
|
-
const { scene: r, dark: o, targetId: t, overlayColor: i, cls: u, style: b, children:
|
|
201
|
+
function rr(e) {
|
|
202
|
+
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 };
|
|
204
203
|
s && s.blurRadius > 0 && (l.backdropFilter = `blur(${s.blurRadius}px)`), s && l.borderRadius === void 0 && (l.borderRadius = `${s.borderRadius}px`);
|
|
205
|
-
const
|
|
206
|
-
return t && (
|
|
204
|
+
const d = i ?? (s == null ? void 0 : s.tintColor), g = {};
|
|
205
|
+
return t && (g.targetId = t), r && (g.scene = r), d && (g.overlayColor = d), /* @__PURE__ */ k(I, { className: u, style: l, ...g, ...a, children: m });
|
|
207
206
|
}
|
|
208
|
-
const
|
|
207
|
+
const or = (e) => {
|
|
209
208
|
const {
|
|
210
209
|
className: r,
|
|
211
210
|
style: o,
|
|
212
211
|
children: t,
|
|
213
212
|
scene: i,
|
|
214
213
|
targetId: u,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
theme: b = "auto",
|
|
215
|
+
liquidGlass: m,
|
|
216
|
+
frostedGlass: a,
|
|
217
|
+
gradientBlur: s,
|
|
218
|
+
overlayColor: l,
|
|
219
|
+
...d
|
|
220
|
+
} = { ...U, ...e }, S = V("nut-jdmaterialview", r), { isIOS: q, iosMajor: v } = F(() => W(), []), C = b === "auto", [L, A] = N(() => X()), R = P(
|
|
221
221
|
(c) => {
|
|
222
|
-
const
|
|
223
|
-
|
|
222
|
+
const y = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
|
|
223
|
+
A(y.toLowerCase() === "dark");
|
|
224
224
|
},
|
|
225
225
|
[]
|
|
226
226
|
);
|
|
227
|
-
|
|
228
|
-
var c,
|
|
229
|
-
|
|
230
|
-
(p = (c = h).onThemeChange) == null || p.call(c, v);
|
|
231
|
-
} catch {
|
|
232
|
-
}
|
|
233
|
-
return () => {
|
|
234
|
-
var G, k;
|
|
227
|
+
j(() => {
|
|
228
|
+
var c, y;
|
|
229
|
+
if (C) {
|
|
235
230
|
try {
|
|
236
|
-
(
|
|
231
|
+
(y = (c = h).onThemeChange) == null || y.call(c, R);
|
|
237
232
|
} catch {
|
|
238
233
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
234
|
+
return () => {
|
|
235
|
+
var w, M;
|
|
236
|
+
try {
|
|
237
|
+
(M = (w = h).offThemeChange) == null || M.call(w, R);
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}, [C, R]);
|
|
243
|
+
const f = C ? L : b === "dark", n = F(
|
|
244
|
+
() => i ? H(i, f, v) : void 0,
|
|
245
|
+
[i, f, v]
|
|
246
|
+
), O = m ?? (n == null ? void 0 : n.liquidGlass), B = a ?? (n == null ? void 0 : n.frostedGlass), D = s ?? (n == null ? void 0 : n.gradientBlur);
|
|
247
|
+
if (q) {
|
|
246
248
|
const c = { ...n == null ? void 0 : n.fallbackStyle, ...o };
|
|
247
|
-
return i && c.borderRadius === void 0 && (c.borderRadius = `${
|
|
248
|
-
|
|
249
|
+
return i && c.borderRadius === void 0 && (c.borderRadius = `${J(i, v)}px`), /* @__PURE__ */ k(
|
|
250
|
+
_,
|
|
249
251
|
{
|
|
250
|
-
className:
|
|
252
|
+
className: S,
|
|
251
253
|
style: c,
|
|
252
|
-
liquidGlass:
|
|
253
|
-
frostedGlass:
|
|
254
|
-
gradientBlur:
|
|
255
|
-
...
|
|
254
|
+
liquidGlass: O,
|
|
255
|
+
frostedGlass: B,
|
|
256
|
+
gradientBlur: D,
|
|
257
|
+
...d,
|
|
256
258
|
children: t
|
|
257
259
|
}
|
|
258
260
|
);
|
|
259
261
|
}
|
|
260
|
-
return
|
|
262
|
+
return z() ? Z({ scene: i, dark: f, overlayColor: l, cls: S, style: o, children: t, rest: d }) : rr({
|
|
261
263
|
scene: i,
|
|
262
264
|
dark: f,
|
|
263
265
|
targetId: u,
|
|
264
|
-
overlayColor:
|
|
265
|
-
cls:
|
|
266
|
+
overlayColor: l,
|
|
267
|
+
cls: S,
|
|
266
268
|
style: o,
|
|
267
269
|
children: t,
|
|
268
|
-
rest:
|
|
270
|
+
rest: d
|
|
269
271
|
});
|
|
270
272
|
};
|
|
271
|
-
|
|
273
|
+
or.displayName = "NutJDMaterialView";
|
|
272
274
|
export {
|
|
273
|
-
|
|
275
|
+
or as J,
|
|
276
|
+
Y as a,
|
|
277
|
+
H as b,
|
|
278
|
+
J as g
|
|
274
279
|
};
|
|
@@ -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
|
}
|