@nutui/taro-biz 0.0.1-alpha.15 → 0.0.1-alpha.17
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.d.ts +2 -0
- package/dist/es/index/index.js +1 -1
- package/dist/es/jdmaterialsblurtarget/index.d.ts +2 -0
- package/dist/es/jdmaterialview/index.d.ts +2 -0
- package/dist/es/jdmaterialview/index.js +2 -6
- package/dist/es/{jdmaterialview.taro-BjknHTmz.mjs → jdmaterialview.taro-Di3QqSHi.mjs} +30 -35
- package/dist/types/index.taro.d.ts +4 -0
- package/dist/types/packages/jdmaterialsblurtarget/index.taro.d.ts +3 -0
- package/dist/types/packages/jdmaterialsblurtarget/jdmaterialsblurtarget.taro.d.ts +3 -0
- package/dist/types/packages/jdmaterialsblurtarget/types.d.ts +5 -0
- package/dist/types/packages/jdmaterialview/index.taro.d.ts +3 -0
- package/dist/types/packages/jdmaterialview/jdmaterialview.taro.d.ts +3 -0
- package/dist/types/packages/jdmaterialview/scene-presets.d.ts +46 -0
- package/dist/types/packages/jdmaterialview/types.d.ts +20 -0
- package/dist/types/utils/typings.d.ts +11 -0
- package/package.json +10 -10
- package/dist/cjs/index/index.js +0 -1
- package/dist/cjs/jdmaterialsblurtarget/index.js +0 -1
- package/dist/cjs/jdmaterialsblurtarget.taro-BbcxTuKJ.js +0 -1
- package/dist/cjs/jdmaterialview/index.js +0 -1
- package/dist/cjs/jdmaterialview.taro-CDNHFSRA.js +0 -1
- package/dist/cjs/typings-DP_XKs5o.js +0 -1
package/dist/es/index/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { J as
|
|
2
|
-
import { g as s, a as o, b as g } from "../jdmaterialview.taro-BjknHTmz.mjs";
|
|
1
|
+
import { J as e } from "../jdmaterialview.taro-Di3QqSHi.mjs";
|
|
3
2
|
export {
|
|
4
|
-
|
|
5
|
-
s as getCornerRadius,
|
|
6
|
-
o as getFrostedPreset,
|
|
7
|
-
g as getPreset
|
|
3
|
+
e as default
|
|
8
4
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as R } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as w, useState as O, useCallback as B, useEffect as D } from "react";
|
|
3
3
|
import N from "classnames";
|
|
4
4
|
import h, { getEnv as P } from "@tarojs/taro";
|
|
5
5
|
import { View as M } from "@tarojs/components";
|
|
6
|
-
import { JDIOSMaterialView as
|
|
7
|
-
import { C as
|
|
6
|
+
import { JDIOSMaterialView as j } from "@jdtaro/ui";
|
|
7
|
+
import { C as V } from "./typings-CdeuPEKG.mjs";
|
|
8
8
|
const F = 26;
|
|
9
|
-
function
|
|
9
|
+
function T(e, r, o) {
|
|
10
10
|
const t = o >= F;
|
|
11
11
|
switch (e) {
|
|
12
12
|
case "top-solid":
|
|
@@ -14,8 +14,7 @@ function V(e, r, o) {
|
|
|
14
14
|
liquidGlass: {
|
|
15
15
|
style: "regular",
|
|
16
16
|
interactive: !0,
|
|
17
|
-
|
|
18
|
-
showTintOverlay: r
|
|
17
|
+
...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
19
18
|
}
|
|
20
19
|
} : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
|
|
21
20
|
case "top-plain":
|
|
@@ -23,8 +22,7 @@ function V(e, r, o) {
|
|
|
23
22
|
liquidGlass: {
|
|
24
23
|
style: "regular",
|
|
25
24
|
interactive: !0,
|
|
26
|
-
|
|
27
|
-
showTintOverlay: r
|
|
25
|
+
...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
28
26
|
}
|
|
29
27
|
} : {};
|
|
30
28
|
case "top-bar":
|
|
@@ -93,7 +91,7 @@ function I(e) {
|
|
|
93
91
|
return 0;
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
|
-
const
|
|
94
|
+
const y = "255, 255, 255", C = "31, 34, 38";
|
|
97
95
|
function E(e, r) {
|
|
98
96
|
const o = I(e);
|
|
99
97
|
switch (e) {
|
|
@@ -109,19 +107,19 @@ function E(e, r) {
|
|
|
109
107
|
return {
|
|
110
108
|
blurRadius: 40,
|
|
111
109
|
borderRadius: o,
|
|
112
|
-
tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${
|
|
110
|
+
tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${y}, 0.9)`
|
|
113
111
|
};
|
|
114
112
|
case "promotion-fair":
|
|
115
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
113
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${y}, 0.85)` };
|
|
116
114
|
case "promotion-deep":
|
|
117
|
-
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${
|
|
115
|
+
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${y}, 0.2)` };
|
|
118
116
|
case "immersive":
|
|
119
117
|
return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${C}, 0.4)` };
|
|
120
118
|
case "bottom-bar":
|
|
121
119
|
return {
|
|
122
120
|
blurRadius: 50,
|
|
123
121
|
borderRadius: o,
|
|
124
|
-
tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${
|
|
122
|
+
tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${y}, 0.8)`
|
|
125
123
|
};
|
|
126
124
|
default:
|
|
127
125
|
return { blurRadius: 40, borderRadius: o };
|
|
@@ -169,7 +167,7 @@ function J(e, r) {
|
|
|
169
167
|
}
|
|
170
168
|
}
|
|
171
169
|
const Y = {
|
|
172
|
-
...
|
|
170
|
+
...V
|
|
173
171
|
};
|
|
174
172
|
function K() {
|
|
175
173
|
return ["harmony", "harmonyhybrid", "jdharmony"].includes(
|
|
@@ -217,41 +215,41 @@ const X = (e) => {
|
|
|
217
215
|
gradientBlur: a,
|
|
218
216
|
overlayColor: s,
|
|
219
217
|
...l
|
|
220
|
-
} = { ...Y, ...e }, d = N("nut-jdmaterialview", r), { isIOS: $, iosMajor:
|
|
218
|
+
} = { ...Y, ...e }, d = N("nut-jdmaterialview", r), { isIOS: $, iosMajor: S } = w(() => Q(), []), [f, x] = O(() => U()), v = B(
|
|
221
219
|
(c) => {
|
|
222
|
-
const
|
|
223
|
-
x(
|
|
220
|
+
const p = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
|
|
221
|
+
x(p.toLowerCase() === "dark");
|
|
224
222
|
},
|
|
225
223
|
[]
|
|
226
224
|
);
|
|
227
225
|
D(() => {
|
|
228
|
-
var c,
|
|
226
|
+
var c, p;
|
|
229
227
|
try {
|
|
230
|
-
(
|
|
228
|
+
(p = (c = h).onThemeChange) == null || p.call(c, v);
|
|
231
229
|
} catch {
|
|
232
230
|
}
|
|
233
231
|
return () => {
|
|
234
|
-
var G,
|
|
232
|
+
var G, k;
|
|
235
233
|
try {
|
|
236
|
-
(
|
|
234
|
+
(k = (G = h).offThemeChange) == null || k.call(G, v);
|
|
237
235
|
} catch {
|
|
238
236
|
}
|
|
239
237
|
};
|
|
240
|
-
}, [
|
|
241
|
-
const n =
|
|
242
|
-
() => i ?
|
|
243
|
-
[i, f,
|
|
244
|
-
),
|
|
238
|
+
}, [v]);
|
|
239
|
+
const n = w(
|
|
240
|
+
() => i ? T(i, f, S) : void 0,
|
|
241
|
+
[i, f, S]
|
|
242
|
+
), q = b ?? (n == null ? void 0 : n.liquidGlass), L = g ?? (n == null ? void 0 : n.frostedGlass), A = a ?? (n == null ? void 0 : n.gradientBlur);
|
|
245
243
|
if ($) {
|
|
246
244
|
const c = { ...n == null ? void 0 : n.fallbackStyle, ...o };
|
|
247
|
-
return i && c.borderRadius === void 0 && (c.borderRadius = `${_(i,
|
|
248
|
-
|
|
245
|
+
return i && c.borderRadius === void 0 && (c.borderRadius = `${_(i, S)}px`), /* @__PURE__ */ R(
|
|
246
|
+
j,
|
|
249
247
|
{
|
|
250
248
|
className: d,
|
|
251
249
|
style: c,
|
|
252
|
-
liquidGlass:
|
|
253
|
-
frostedGlass:
|
|
254
|
-
gradientBlur:
|
|
250
|
+
liquidGlass: q,
|
|
251
|
+
frostedGlass: L,
|
|
252
|
+
gradientBlur: A,
|
|
255
253
|
...l,
|
|
256
254
|
children: t
|
|
257
255
|
}
|
|
@@ -270,8 +268,5 @@ const X = (e) => {
|
|
|
270
268
|
};
|
|
271
269
|
X.displayName = "NutJDMaterialView";
|
|
272
270
|
export {
|
|
273
|
-
X as J
|
|
274
|
-
E as a,
|
|
275
|
-
V as b,
|
|
276
|
-
_ as g
|
|
271
|
+
X as J
|
|
277
272
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as JDMaterialView } from './packages/jdmaterialview/index.taro';
|
|
2
|
+
export { default as JDMaterialsBlurTarget } from './packages/jdmaterialsblurtarget/index.taro';
|
|
3
|
+
export type { JDMaterialViewProps, MaterialScene } from './packages/jdmaterialview/index.taro';
|
|
4
|
+
export type { JDMaterialsBlurTargetProps } from './packages/jdmaterialsblurtarget/index.taro';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { JDMaterialsBlurTargetProps } from './types';
|
|
3
|
+
export declare const JDMaterialsBlurTarget: FunctionComponent<Partial<JDMaterialsBlurTargetProps> & Pick<JDMaterialsBlurTargetProps, 'blurId'> & React.HTMLAttributes<HTMLDivElement>>;
|
|
@@ -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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BasicComponent } from '@/utils/typings';
|
|
2
|
+
/** 材质场景(7 种,业务按场景选用):
|
|
3
|
+
* - top-solid 浅色背景悬浮容器
|
|
4
|
+
* - top-plain 白色背景悬浮容器
|
|
5
|
+
* - top-bar 吸顶背板
|
|
6
|
+
* - promotion-fair 浅色换肤悬浮容器
|
|
7
|
+
* - promotion-deep 深色换肤悬浮容器
|
|
8
|
+
* - immersive 沉浸式悬浮容器
|
|
9
|
+
* - bottom-bar 底部导航背板
|
|
10
|
+
*/
|
|
11
|
+
export type MaterialScene = 'top-solid' | 'top-plain' | 'top-bar' | 'promotion-fair' | 'promotion-deep' | 'immersive' | 'bottom-bar';
|
|
12
|
+
/**
|
|
13
|
+
* JDMaterialView 属性
|
|
14
|
+
*/
|
|
15
|
+
export interface JDMaterialViewProps extends BasicComponent {
|
|
16
|
+
/** 材质场景,7 种见 MaterialScene */
|
|
17
|
+
scene: MaterialScene;
|
|
18
|
+
/** 模糊源 targetId,与 JDMaterialsBlurTarget 的 blurId 对应 */
|
|
19
|
+
targetId: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export interface BasicComponent {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ComponentDefaults: {
|
|
9
|
+
className: string;
|
|
10
|
+
style: {};
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutui/taro-biz",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
4
|
-
"main": "dist/
|
|
3
|
+
"version": "0.0.1-alpha.17",
|
|
4
|
+
"main": "dist/es/index/index.js",
|
|
5
5
|
"module": "dist/es/index/index.js",
|
|
6
|
+
"types": "dist/es/index/index.d.ts",
|
|
6
7
|
"sideEffects": [
|
|
7
8
|
"*.scss",
|
|
8
|
-
"dist/es/**/style/*"
|
|
9
|
-
"dist/cjs/**/style/*"
|
|
9
|
+
"dist/es/**/style/*"
|
|
10
10
|
],
|
|
11
11
|
"description": "京东主站设计内部组件库",
|
|
12
12
|
"keywords": [
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
},
|
|
81
81
|
"exports": {
|
|
82
82
|
".": {
|
|
83
|
-
"
|
|
84
|
-
"
|
|
83
|
+
"types": "./dist/es/index/index.d.ts",
|
|
84
|
+
"import": "./dist/es/index/index.js"
|
|
85
85
|
},
|
|
86
86
|
"./JDMaterialView": {
|
|
87
|
-
"
|
|
88
|
-
"
|
|
87
|
+
"types": "./dist/es/jdmaterialview/index.d.ts",
|
|
88
|
+
"import": "./dist/es/jdmaterialview/index.js"
|
|
89
89
|
},
|
|
90
90
|
"./JDMaterialsBlurTarget": {
|
|
91
|
-
"
|
|
92
|
-
"
|
|
91
|
+
"types": "./dist/es/jdmaterialsblurtarget/index.d.ts",
|
|
92
|
+
"import": "./dist/es/jdmaterialsblurtarget/index.js"
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
package/dist/cjs/index/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-CDNHFSRA.js"),r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");module.exports=r.JDMaterialsBlurTarget;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("classnames"),u=require("@tarojs/taro"),m=require("@tarojs/components"),d=require("./typings-DP_XKs5o.js"),f={...d.ComponentDefaults};function g(){var r;try{return String(((r=u.getSystemInfoSync())==null?void 0:r.platform)||"").toLowerCase()==="android"}catch{return!1}}const s=r=>{const{className:a,style:n,children:t,blurId:c,...i}={...f,...r};if(!g())return e.jsx(e.Fragment,{children:t});const o=l("nut-jdmaterialsblurtarget",a);return e.jsx(m.View,{className:o,style:n,blurId:c,...i,children:t})};s.displayName="NutJDMaterialsBlurTarget";exports.JDMaterialsBlurTarget=s;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-CDNHFSRA.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const G=require("react/jsx-runtime"),y=require("react"),P=require("classnames"),d=require("@tarojs/taro"),w=require("@tarojs/components"),j=require("@jdtaro/ui"),B=require("./typings-DP_XKs5o.js"),M=26;function k(t,r,e){const o=e>=M;switch(t){case"top-solid":return o?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return o?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{};case"top-bar":return{frostedGlass:{style:r?"thick-dark":"thick-light"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:1}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"ultra-thin-light",alpha:1}};case"immersive":return o?{liquidGlass:{style:"regular",forceDark:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.75)"}}:{frostedGlass:{style:"regular-dark",alpha:1}};case"bottom-bar":return{gradientBlur:{minBlur:.5,maxBlur:.8,overlayAlpha:.9,overlayColor:r?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)"}};default:return{}}}function F(t,r){const e=r>=M;switch(t){case"top-bar":case"bottom-bar":return 0;case"top-plain":return e?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return e?12:8;default:return 0}}function q(t){switch(t){case"top-bar":case"bottom-bar":return 0;case"top-solid":case"top-plain":case"promotion-fair":case"promotion-deep":case"immersive":return 8;default:return 0}}const v="255, 255, 255",R="31, 34, 38";function x(t,r){const e=q(t);switch(t){case"top-solid":return{blurRadius:40,borderRadius:e,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:e};case"top-bar":return{blurRadius:40,borderRadius:e,tintColor:r?`rgba(${R}, 0.9)`:`rgba(${v}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${v}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${v}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${R}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:e,tintColor:r?`rgba(${R}, 0.8)`:`rgba(${v}, 0.8)`};default:return{blurRadius:40,borderRadius:e}}}function N(t){const r=t?"0, 0, 0":"255, 255, 255";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%)`}function V(t,r){const e=r?"dark":"light",o=q(t);switch(t){case"top-solid":return{blurScale:1,borderRadius:o,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:o,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:o,colorMode:e,overlayColor:r?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.8)"};case"promotion-fair":return{blurScale:.85,borderRadius:o,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:o,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:o,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:o,colorMode:e,backgroundGradient:N(r),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:o,colorMode:e}}}const _={...B.ComponentDefaults};function E(){return["harmony","harmonyhybrid","jdharmony"].includes(d.getEnv().toLowerCase())}function H(){var t;try{const r=d.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),o=String((r==null?void 0:r.system)||""),i=e==="ios",u=i?parseInt(((t=o.match(/\d+/))==null?void 0:t[0])||"0",10):0,g=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:i,iosMajor:u,dark:g}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function J(){try{const t=d.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function T(t){const{scene:r,dark:e,overlayColor:o,cls:i,style:u,children:g,rest:f}=t,a=r?V(r,e):void 0,s={};a?(s.blurScale=a.blurScale,s.borderRadius=a.borderRadius,s.colorMode=a.colorMode):s.colorMode=e?"dark":"light",(u==null?void 0:u.borderRadius)!==void 0&&(s.borderRadius=parseFloat(String(u.borderRadius)));const l={...u},m=o??(a==null?void 0:a.overlayColor);return m&&l.backgroundColor===void 0&&(l.backgroundColor=m),a!=null&&a.backgroundGradient&&l.background===void 0&&(l.background=a.backgroundGradient),a!=null&&a.boxShadow&&l.boxShadow===void 0&&(l.boxShadow=a.boxShadow),G.jsx(w.View,{className:i,style:l,...s,...f,children:g})}function Y(t){const{scene:r,dark:e,targetId:o,overlayColor:i,cls:u,style:g,children:f,rest:a}=t,s=r?x(r,e):void 0,l={...g};s&&s.blurRadius>0&&(l.backdropFilter=`blur(${s.blurRadius}px)`),s&&l.borderRadius===void 0&&(l.borderRadius=`${s.borderRadius}px`);const m=i??(s==null?void 0:s.tintColor),b={};return o&&(b.targetId=o),r&&(b.scene=r),m&&(b.overlayColor=m),G.jsx(w.View,{className:u,style:l,...b,...a,children:f})}const I=t=>{const{className:r,style:e,children:o,scene:i,targetId:u,liquidGlass:g,frostedGlass:f,gradientBlur:a,overlayColor:s,...l}={..._,...t},b=P("nut-jdmaterialview",r),{isIOS:$,iosMajor:S}=y.useMemo(()=>H(),[]),[h,O]=y.useState(()=>J()),C=y.useCallback(c=>{const p=typeof c=="string"?c:String((c==null?void 0:c.theme)||"");O(p.toLowerCase()==="dark")},[]);y.useEffect(()=>{var c;try{(c=d.onThemeChange)==null||c.call(d,C)}catch{}return()=>{var p;try{(p=d.offThemeChange)==null||p.call(d,C)}catch{}}},[C]);const n=y.useMemo(()=>i?k(i,h,S):void 0,[i,h,S]),L=g??(n==null?void 0:n.liquidGlass),A=f??(n==null?void 0:n.frostedGlass),D=a??(n==null?void 0:n.gradientBlur);if($){const c={...n==null?void 0:n.fallbackStyle,...e};return i&&c.borderRadius===void 0&&(c.borderRadius=`${F(i,S)}px`),G.jsx(j.JDIOSMaterialView,{className:b,style:c,liquidGlass:L,frostedGlass:A,gradientBlur:D,...l,children:o})}return E()?T({scene:i,dark:h,overlayColor:s,cls:b,style:e,children:o,rest:l}):Y({scene:i,dark:h,targetId:u,overlayColor:s,cls:b,style:e,children:o,rest:l})};I.displayName="NutJDMaterialView";exports.JDMaterialView=I;exports.getCornerRadius=F;exports.getFrostedPreset=x;exports.getPreset=k;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s={className:"",style:{}};exports.ComponentDefaults=s;
|