@nutui/taro-biz 0.0.1-alpha.30 → 0.0.1-alpha.32

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-Cq9ornMk.js"),r=require("../jdmaterialsblurtarget.taro-Cqye9b32.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-B0iQp50v.js"),r=require("../jdmaterialsblurtarget.taro-Cqye9b32.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-Cq9ornMk.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-B0iQp50v.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
@@ -0,0 +1 @@
1
+ "use strict";const D=require("react/jsx-runtime"),y=require("react"),tr=require("classnames"),g=require("@tarojs/taro"),B=require("@jdtaro/ui"),or=require("./typings-DP_XKs5o.js"),E=26,q="0 4px 2px 0 rgba(0, 0, 0, 0.05)",J="0 4px 8px 0 rgba(0, 0, 0, 0.05)",er="0 -8px 4px 0 rgba(0, 0, 0, 0.12)",ar="0 -8px 4px 0 rgba(31, 34, 38, 0.5)";function W(o,r,t){const e=t>=E;switch(o){case"top-solid":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:q}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:q}:{};case"top-bar":return{frostedGlass:{style:r?"regular-dark":"ultra-thin-light",tintColor:r?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.75)"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:r?"regular-dark":"ultra-thin-light",tintColor:r?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.85)"},...e?{boxShadow:J}:{}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:"ultra-thin-light",alpha:1},...e?{boxShadow:J}:{}};case"immersive":return e?{liquidGlass:{style:"regular",darkMode:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.05)"},boxShadow:q}:{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)"},boxShadow:r?ar:er};default:return{}}}function K(o,r){const t=r>=E;switch(o){case"top-bar":case"bottom-bar":return 0;case"top-plain":return t?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return t?12:8;default:return 0}}function Y(o){switch(o){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 M="255, 255, 255",F="31, 34, 38";function Q(o,r){const t=Y(o);switch(o){case"top-solid":return{blurRadius:40,borderRadius:t,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:t};case"top-bar":return{blurRadius:40,borderRadius:t,tintColor:r?`rgba(${F}, 0.9)`:`rgba(${M}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${M}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${M}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${F}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:t,tintColor:r?`rgba(${F}, 0.8)`:`rgba(${M}, 0.8)`};default:return{blurRadius:40,borderRadius:t}}}function sr(o){const r=o?"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 nr(o,r){const t=r?"dark":"light",e=Y(o);switch(o){case"top-solid":return{blurScale:1,borderRadius:e,colorMode:t,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:e,colorMode:t};case"top-bar":return{blurScale:.9,borderRadius:e,colorMode:t,overlayColor:r?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.62)"};case"promotion-fair":return{blurScale:.85,borderRadius:e,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:e,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:e,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:e,colorMode:t,backgroundGradient:sr(r),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:e,colorMode:t}}}function ir(o,r){const t=/^#?([0-9a-fA-F]{6})$/.exec(o.trim());if(!t)return o;const e=parseInt(t[1],16),a=e>>16&255,i=e>>8&255,d=e&255,m=Math.max(0,Math.min(1,r));return`rgba(${a}, ${i}, ${d}, ${m})`}const lr={...or.ComponentDefaults};function cr(){var o;try{const r=g.getSystemInfoSync(),t=String((r==null?void 0:r.platform)||"").toLowerCase(),e=String((r==null?void 0:r.system)||""),a=t==="ios",i=t==="harmony",d=a?parseInt(((o=e.match(/\d+/))==null?void 0:o[0])||"0",10):0,m=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,isHarmony:i,iosMajor:d,dark:m}}catch{return{isIOS:!1,isHarmony:!1,iosMajor:0,dark:!1}}}function ur(){try{const o=g.getSystemInfoSync();return String((o==null?void 0:o.theme)||"").toLowerCase()==="dark"}catch{return!1}}function dr(o){const{scene:r,dark:t,overlayColor:e,cls:a,style:i,children:d,rest:m}=o,s=r?nr(r,t):void 0,c={};s?(c.blurScale=s.blurScale,c.colorMode=s.colorMode):c.colorMode=t?"dark":"light";const u={...i};(i==null?void 0:i.borderRadius)===void 0&&s&&(u.borderRadius=`${s.borderRadius}px`);const f=e??(s==null?void 0:s.overlayColor);return f&&u.backgroundColor===void 0&&(u.backgroundColor=f),s!=null&&s.backgroundGradient&&u.background===void 0&&(u.background=s.backgroundGradient),s!=null&&s.boxShadow&&u.boxShadow===void 0&&(u.boxShadow=s.boxShadow),D.jsx(B.View,{className:a,style:u,...c,...m,children:d})}function br(o){const{scene:r,dark:t,targetId:e,overlayColor:a,cls:i,style:d,children:m,rest:s}=o,c=r?Q(r,t):void 0,u={...d};c&&c.blurRadius>0&&(u.backdropFilter=`blur(${c.blurRadius}px)`),c&&u.borderRadius===void 0&&(u.borderRadius=`${c.borderRadius}px`);const f=a??(c==null?void 0:c.tintColor),S={};return e&&(S.targetId=e),r&&(S.scene=r),f&&(S.overlayColor=f),D.jsx(B.View,{className:i,style:u,...S,...s,children:m})}const U=o=>{const{className:r,style:t,children:e,scene:a,targetId:i,theme:d="auto",extractTint:m,liquidGlass:s,frostedGlass:c,gradientBlur:u,overlayColor:f,id:S,...I}={...lr,...o},T=tr("nut-jdmaterialview",r),{isIOS:v,isHarmony:z,iosMajor:x}=y.useMemo(()=>cr(),[]),$=d==="auto",[X,Z]=y.useState(()=>ur()),A=y.useCallback(n=>{const b=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");Z(b.toLowerCase()==="dark")},[]);y.useEffect(()=>{var n;if($){try{(n=g.onThemeChange)==null||n.call(g,A)}catch{}return()=>{var b;try{(b=g.offThemeChange)==null||b.call(g,A)}catch{}}}},[$,A]);const C=$?X:d==="dark",l=y.useMemo(()=>a?W(a,C,x):void 0,[a,C,x]),O=s??(l==null?void 0:l.liquidGlass),w=!!m&&(a==="promotion-fair"||a==="promotion-deep"),R=i?`taro_material_${i}`:void 0,[_,rr]=y.useState(void 0),L=y.useCallback(()=>{var j;if(!v||!w||!R||!i)return;const n=g;if(typeof n.getTagById!="function"||!((j=n.JDTheme)!=null&&j.getGlassTintConfig))return;const b=n.getTagById(R),h=n.getTagById(i);b==null||h==null||b<0||h<0||n.JDTheme.getGlassTintConfig({materialTag:b,blurTag:h}).then(G=>{const p=(G==null?void 0:G.data)??G,V=p==null?void 0:p.tintColor,k=p==null?void 0:p.tintAlpha;!V||!k||k<=0||rr(ir(V,k))}).catch(()=>{})},[v,w,a,R,i]);y.useEffect(()=>{!v||!w||g.nextTick(()=>L())},[v,w,C,L,a,i]);const P=O&&_?{...O,tintColor:_}:O,H=c??(l==null?void 0:l.frostedGlass),N=u??(l==null?void 0:l.gradientBlur);if(v){const n={...l==null?void 0:l.fallbackStyle,...t};a&&n.borderRadius===void 0&&(n.borderRadius=`${K(a,x)}px`),l!=null&&l.boxShadow&&n.boxShadow===void 0&&(n.boxShadow=l.boxShadow);const b=x>=26;let h;return b&&P?h={liquidGlass:P}:H?h={frostedGlass:H}:N&&(h={gradientBlur:N}),D.jsx(B.JDIOSMaterialView,{id:R,className:T,style:n,targetId:i,materialConfig:h,...I,children:e})}return z?dr({scene:a,dark:C,overlayColor:f,cls:T,style:t,children:e,rest:I}):br({scene:a,dark:C,targetId:i,overlayColor:f,cls:T,style:t,children:e,rest:I})};U.displayName="NutJDMaterialView";exports.JDMaterialView=U;exports.getCornerRadius=K;exports.getFrostedPreset=Q;exports.getPreset=W;
@@ -1,4 +1,4 @@
1
- import { J as e } from "../jdmaterialview.taro-CpCp2WMB.mjs";
1
+ import { J as e } from "../jdmaterialview.taro-BDeTr2uc.mjs";
2
2
  import { J as o } from "../jdmaterialsblurtarget.taro-Cy1DuuF4.mjs";
3
3
  export {
4
4
  e as JDMaterialView,
@@ -1,5 +1,5 @@
1
- import { J as r } from "../jdmaterialview.taro-CpCp2WMB.mjs";
2
- import { g as s, a as o, b as g } from "../jdmaterialview.taro-CpCp2WMB.mjs";
1
+ import { J as r } from "../jdmaterialview.taro-BDeTr2uc.mjs";
2
+ import { g as s, a as o, b as g } from "../jdmaterialview.taro-BDeTr2uc.mjs";
3
3
  export {
4
4
  r as default,
5
5
  s as getCornerRadius,
@@ -37,14 +37,17 @@ function sr(t, r, o) {
37
37
  };
38
38
  case "promotion-fair":
39
39
  return {
40
- liquidGlass: { style: "clear", interactive: !1 },
41
- frostedGlass: { style: "thick-light", alpha: 1 },
40
+ liquidGlass: { style: "clear", interactive: !0 },
41
+ frostedGlass: {
42
+ style: r ? "regular-dark" : "ultra-thin-light",
43
+ tintColor: r ? "rgba(0, 0, 0, 0.6)" : "rgba(255, 255, 255, 0.85)"
44
+ },
42
45
  // 阴影仅玻璃态显示(对齐 ObjC shadowAlpha=0.05 / fallbackShadowAlpha=0)
43
46
  ...e ? { boxShadow: W } : {}
44
47
  };
45
48
  case "promotion-deep":
46
49
  return {
47
- liquidGlass: { style: "clear", interactive: !1 },
50
+ liquidGlass: { style: "clear", interactive: !0 },
48
51
  frostedGlass: { style: "ultra-thin-light", alpha: 1 },
49
52
  ...e ? { boxShadow: W } : {}
50
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/taro-biz",
3
- "version": "0.0.1-alpha.30",
3
+ "version": "0.0.1-alpha.32",
4
4
  "main": "dist/es/index/index.js",
5
5
  "module": "dist/es/index/index.js",
6
6
  "types": "dist/es/index/index.d.ts",
package/readme.md CHANGED
@@ -13,6 +13,164 @@ Taro 端会发布为 @nutui/taro-biz; Web 端会发布为 @nutui/biz。
13
13
  - JDMaterialView
14
14
  - JDMaterialsBlurTarget
15
15
 
16
- #### Web 端
16
+ #### Web (H5) 端
17
+
18
+ - `JDMaterialView`:毛玻璃材质视图组件
19
+ - `JDMaterialsBlurTarget`:模糊源容器组件(H5 下透明透传,保持多端 API 兼容,H5 不必使用)
20
+
21
+ ---
22
+
23
+ ## 快速上手 (Web H5)
24
+
25
+ ### 1. 安装
26
+
27
+ ```bash
28
+ npm install @nutui/biz
29
+ ```
30
+
31
+ ### 2. 引入样式
32
+
33
+ 在项目入口文件(如 `main.tsx` 或 `App.tsx`)中引入组件样式:
34
+
35
+ ```tsx
36
+ import '@nutui/biz/dist/es/jdmaterialview.css'
37
+ ```
38
+
39
+ ### 3. 基础使用
40
+
41
+ #### 场景 1:独立悬浮胶囊导航 (`top-solid` / `top-plain`)
42
+
43
+ 用于顶部搜索栏、返回键、快捷功能胶囊(自带圆角与内发光高光):
44
+
45
+ ```tsx
46
+ import { JDMaterialView } from '@nutui/biz'
47
+
48
+ function HeaderCapsules() {
49
+ return (
50
+ <div style={{ display: 'flex', gap: 8, padding: 8 }}>
51
+ {/* 纯白常规底色胶囊 */}
52
+ <JDMaterialView
53
+ scene="top-solid"
54
+ style={{ width: 44, height: 44, borderRadius: 12, display: 'flex', alignItems: 'center', justifyContent: 'center' }}
55
+ >
56
+ <span>返回</span>
57
+ </JDMaterialView>
58
+
59
+ {/* 搜索框胶囊 */}
60
+ <JDMaterialView
61
+ scene="top-solid"
62
+ style={{ flex: 1, height: 44, borderRadius: 12, display: 'flex', alignItems: 'center', padding: '0 12px' }}
63
+ >
64
+ <span style={{ fontSize: 13, color: '#666' }}>搜搜感兴趣的商品吧</span>
65
+ </JDMaterialView>
66
+
67
+ {/* 高透晶莹胶囊 */}
68
+ <JDMaterialView
69
+ scene="top-plain"
70
+ style={{ width: 44, height: 44, borderRadius: 12, display: 'flex', alignItems: 'center', justifyContent: 'center' }}
71
+ >
72
+ <span>首页</span>
73
+ </JDMaterialView>
74
+ </div>
75
+ )
76
+ }
77
+ ```
78
+
79
+ #### 场景 2:通栏吸顶导航条 (`top-bar`)
80
+
81
+ 用于全宽吸顶的导航栏背板:
82
+
83
+ ```tsx
84
+ import { JDMaterialView } from '@nutui/biz'
85
+
86
+ function TopNavBar({ darkMode = false }) {
87
+ return (
88
+ <JDMaterialView
89
+ scene="top-bar"
90
+ darkMode={darkMode}
91
+ style={{
92
+ position: 'sticky',
93
+ top: 0,
94
+ zIndex: 100,
95
+ height: 44,
96
+ display: 'flex',
97
+ alignItems: 'center',
98
+ padding: '0 12px',
99
+ gap: 10,
100
+ }}
101
+ >
102
+ <div>返回</div>
103
+ <div style={{ flex: 1, height: 32, borderRadius: 16, background: 'rgba(0,0,0,0.05)', display: 'flex', alignItems: 'center', padding: '0 10px' }}>
104
+ <span style={{ fontSize: 12, color: '#999' }}>搜索商品</span>
105
+ </div>
106
+ <div>更多</div>
107
+ </JDMaterialView>
108
+ )
109
+ }
110
+ ```
111
+
112
+ #### 场景 3:一码多端兼容写法 (配合 JDMaterialsBlurTarget)
113
+
114
+ Android 端需要特定的模糊源节点,而 Web H5 侧则通过原生 CSS `backdrop-filter` 自动生效。使用相同的配对 ID 即可实现一套代码全端跑通:
115
+
116
+ ```tsx
117
+ import { JDMaterialView, JDMaterialsBlurTarget } from '@nutui/biz'
118
+
119
+ function DemoPage() {
120
+ return (
121
+ <div>
122
+ {/* 浮层 / 导航条 */}
123
+ <JDMaterialView scene="top-bar" targetId="main-blur-target">
124
+ <div>导航栏内容</div>
125
+ </JDMaterialView>
126
+
127
+ {/* 背景滚动容器 */}
128
+ <JDMaterialsBlurTarget blurId="main-blur-target">
129
+ <div className="scroll-content">
130
+ {/* 页面长列表内容 */}
131
+ </div>
132
+ </JDMaterialsBlurTarget>
133
+ </div>
134
+ )
135
+ }
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 场景(Scene)与材质说明
141
+
142
+ | scene 场景值 | 适用场景 | 亮色模式 | 暗黑模式 (`darkMode={true}`) | 内发光阴影 |
143
+ | :--- | :--- | :--- | :--- | :--- |
144
+ | `top-solid` | 搜索框、独立功能胶囊 | 白底半透 `rgba(255,255,255,0.65)` | 暗黑半透 `rgba(20,23,26,0.6)` | 4层 Inset 高光 |
145
+ | `top-plain` | 高透晶莹浮层/胶囊 | 高透水晶质感 | 高透水晶质感 | 无 |
146
+ | `top-bar` | 吸顶通栏导航条 | 通栏白底 `rgba(255,255,255,0.9)` | 通栏暗黑 `rgba(20,23,26,0.85)` | 无 |
147
+
148
+ ---
149
+
150
+ ## 组件属性 (Props)
151
+
152
+ ### JDMaterialView Props
153
+
154
+ | 属性 | 说明 | 类型 | 必填 | 默认值 |
155
+ | :--- | :--- | :--- | :--- | :--- |
156
+ | `scene` | 材质场景预设 | `'top-solid' \| 'top-plain' \| 'top-bar'` | **是** | — |
157
+ | `darkMode` | 明暗模式切换(`true`: 暗色,`false`: 亮色,不传则自动跟随系统) | `boolean` | 否 | 跟随系统 |
158
+ | `targetId` | 模糊源 ID(多端适配,与 `JDMaterialsBlurTarget` 的 `blurId` 配合) | `string` | 否 | — |
159
+ | `className` | 额外 CSS 类名 | `string` | 否 | — |
160
+ | `style` | 自定义内联样式(支持覆盖 `borderRadius`、`zIndex`、`height` 等) | `CSSProperties` | 否 | — |
161
+
162
+ ### JDMaterialsBlurTarget Props
163
+
164
+ | 属性 | 说明 | 类型 | 必填 |
165
+ | :--- | :--- | :--- | :--- |
166
+ | `blurId` | 模糊源标识(与 `JDMaterialView` 的 `targetId` 对应) | `string` | **是** |
167
+
168
+ ---
169
+
170
+ ## 本地体验 Demo
171
+
172
+ ```bash
173
+ # 启动 H5 演示工程
174
+ npm run dev:demo
175
+ ```
17
176
 
18
- todo
@@ -1 +0,0 @@
1
- "use strict";const D=require("react/jsx-runtime"),p=require("react"),tr=require("classnames"),g=require("@tarojs/taro"),B=require("@jdtaro/ui"),or=require("./typings-DP_XKs5o.js"),E=26,q="0 4px 2px 0 rgba(0, 0, 0, 0.05)",J="0 4px 8px 0 rgba(0, 0, 0, 0.05)",er="0 -8px 4px 0 rgba(0, 0, 0, 0.12)",ar="0 -8px 4px 0 rgba(31, 34, 38, 0.5)";function W(o,r,t){const e=t>=E;switch(o){case"top-solid":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:q}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:q}:{};case"top-bar":return{frostedGlass:{style:r?"regular-dark":"ultra-thin-light",tintColor:r?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.75)"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:1},...e?{boxShadow:J}:{}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"ultra-thin-light",alpha:1},...e?{boxShadow:J}:{}};case"immersive":return e?{liquidGlass:{style:"regular",darkMode:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.05)"},boxShadow:q}:{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)"},boxShadow:r?ar:er};default:return{}}}function K(o,r){const t=r>=E;switch(o){case"top-bar":case"bottom-bar":return 0;case"top-plain":return t?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return t?12:8;default:return 0}}function Y(o){switch(o){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 M="255, 255, 255",F="31, 34, 38";function Q(o,r){const t=Y(o);switch(o){case"top-solid":return{blurRadius:40,borderRadius:t,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:t};case"top-bar":return{blurRadius:40,borderRadius:t,tintColor:r?`rgba(${F}, 0.9)`:`rgba(${M}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${M}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${M}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${F}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:t,tintColor:r?`rgba(${F}, 0.8)`:`rgba(${M}, 0.8)`};default:return{blurRadius:40,borderRadius:t}}}function sr(o){const r=o?"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 nr(o,r){const t=r?"dark":"light",e=Y(o);switch(o){case"top-solid":return{blurScale:1,borderRadius:e,colorMode:t,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:e,colorMode:t};case"top-bar":return{blurScale:.9,borderRadius:e,colorMode:t,overlayColor:r?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.62)"};case"promotion-fair":return{blurScale:.85,borderRadius:e,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:e,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:e,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:e,colorMode:t,backgroundGradient:sr(r),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:e,colorMode:t}}}function ir(o,r){const t=/^#?([0-9a-fA-F]{6})$/.exec(o.trim());if(!t)return o;const e=parseInt(t[1],16),a=e>>16&255,i=e>>8&255,d=e&255,f=Math.max(0,Math.min(1,r));return`rgba(${a}, ${i}, ${d}, ${f})`}const lr={...or.ComponentDefaults};function cr(){var o;try{const r=g.getSystemInfoSync(),t=String((r==null?void 0:r.platform)||"").toLowerCase(),e=String((r==null?void 0:r.system)||""),a=t==="ios",i=t==="harmony",d=a?parseInt(((o=e.match(/\d+/))==null?void 0:o[0])||"0",10):0,f=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,isHarmony:i,iosMajor:d,dark:f}}catch{return{isIOS:!1,isHarmony:!1,iosMajor:0,dark:!1}}}function ur(){try{const o=g.getSystemInfoSync();return String((o==null?void 0:o.theme)||"").toLowerCase()==="dark"}catch{return!1}}function dr(o){const{scene:r,dark:t,overlayColor:e,cls:a,style:i,children:d,rest:f}=o,s=r?nr(r,t):void 0,c={};s?(c.blurScale=s.blurScale,c.colorMode=s.colorMode):c.colorMode=t?"dark":"light";const u={...i};(i==null?void 0:i.borderRadius)===void 0&&s&&(u.borderRadius=`${s.borderRadius}px`);const m=e??(s==null?void 0:s.overlayColor);return m&&u.backgroundColor===void 0&&(u.backgroundColor=m),s!=null&&s.backgroundGradient&&u.background===void 0&&(u.background=s.backgroundGradient),s!=null&&s.boxShadow&&u.boxShadow===void 0&&(u.boxShadow=s.boxShadow),D.jsx(B.View,{className:a,style:u,...c,...f,children:d})}function br(o){const{scene:r,dark:t,targetId:e,overlayColor:a,cls:i,style:d,children:f,rest:s}=o,c=r?Q(r,t):void 0,u={...d};c&&c.blurRadius>0&&(u.backdropFilter=`blur(${c.blurRadius}px)`),c&&u.borderRadius===void 0&&(u.borderRadius=`${c.borderRadius}px`);const m=a??(c==null?void 0:c.tintColor),S={};return e&&(S.targetId=e),r&&(S.scene=r),m&&(S.overlayColor=m),D.jsx(B.View,{className:i,style:u,...S,...s,children:f})}const U=o=>{const{className:r,style:t,children:e,scene:a,targetId:i,theme:d="auto",extractTint:f,liquidGlass:s,frostedGlass:c,gradientBlur:u,overlayColor:m,id:S,...I}={...lr,...o},T=tr("nut-jdmaterialview",r),{isIOS:v,isHarmony:z,iosMajor:C}=p.useMemo(()=>cr(),[]),$=d==="auto",[X,Z]=p.useState(()=>ur()),k=p.useCallback(n=>{const b=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");Z(b.toLowerCase()==="dark")},[]);p.useEffect(()=>{var n;if($){try{(n=g.onThemeChange)==null||n.call(g,k)}catch{}return()=>{var b;try{(b=g.offThemeChange)==null||b.call(g,k)}catch{}}}},[$,k]);const x=$?X:d==="dark",l=p.useMemo(()=>a?W(a,x,C):void 0,[a,x,C]),A=s??(l==null?void 0:l.liquidGlass),w=!!f&&(a==="promotion-fair"||a==="promotion-deep"),R=i?`taro_material_${i}`:void 0,[_,rr]=p.useState(void 0),L=p.useCallback(()=>{var j;if(!v||!w||!R||!i)return;const n=g;if(typeof n.getTagById!="function"||!((j=n.JDTheme)!=null&&j.getGlassTintConfig))return;const b=n.getTagById(R),h=n.getTagById(i);b==null||h==null||b<0||h<0||n.JDTheme.getGlassTintConfig({materialTag:b,blurTag:h}).then(G=>{const y=(G==null?void 0:G.data)??G,V=y==null?void 0:y.tintColor,O=y==null?void 0:y.tintAlpha;!V||!O||O<=0||rr(ir(V,O))}).catch(()=>{})},[v,w,a,R,i]);p.useEffect(()=>{!v||!w||g.nextTick(()=>L())},[v,w,x,L,a,i]);const P=A&&_?{...A,tintColor:_}:A,H=c??(l==null?void 0:l.frostedGlass),N=u??(l==null?void 0:l.gradientBlur);if(v){const n={...l==null?void 0:l.fallbackStyle,...t};a&&n.borderRadius===void 0&&(n.borderRadius=`${K(a,C)}px`),l!=null&&l.boxShadow&&n.boxShadow===void 0&&(n.boxShadow=l.boxShadow);const b=C>=26;let h;return b&&P?h={liquidGlass:P}:H?h={frostedGlass:H}:N&&(h={gradientBlur:N}),D.jsx(B.JDIOSMaterialView,{id:R,className:T,style:n,targetId:i,materialConfig:h,...I,children:e})}return z?dr({scene:a,dark:x,overlayColor:m,cls:T,style:t,children:e,rest:I}):br({scene:a,dark:x,targetId:i,overlayColor:m,cls:T,style:t,children:e,rest:I})};U.displayName="NutJDMaterialView";exports.JDMaterialView=U;exports.getCornerRadius=K;exports.getFrostedPreset=Q;exports.getPreset=W;