@nutui/taro-biz 0.0.1-alpha.31 → 0.0.1-alpha.33

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-BgCA8gS_.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-CTKkSFVC.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-BgCA8gS_.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-CTKkSFVC.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
@@ -0,0 +1 @@
1
+ "use strict";const _=require("react/jsx-runtime"),f=require("react"),or=require("classnames"),g=require("@tarojs/taro"),L=require("@jdtaro/ui"),er=require("./typings-DP_XKs5o.js"),W=26,D="0 4px 2px 0 rgba(0, 0, 0, 0.05)",E="0 4px 8px 0 rgba(0, 0, 0, 0.05)",ar="0 -8px 4px 0 rgba(0, 0, 0, 0.12)",sr="0 -8px 4px 0 rgba(31, 34, 38, 0.5)";function K(t,r,o){const e=o>=W;switch(t){case"top-solid":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:D}:{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:D}:{};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:E}:{}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:"ultra-thin-light",alpha:1},...e?{boxShadow:E}:{}};case"immersive":return e?{liquidGlass:{style:"regular",darkMode:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.05)"},boxShadow:D}:{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?sr:ar};default:return{}}}function Y(t,r){const o=r>=W;switch(t){case"top-bar":case"bottom-bar":return 0;case"top-plain":return o?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return o?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 I="255, 255, 255",B="31, 34, 38";function U(t,r){const o=Q(t);switch(t){case"top-solid":return{blurRadius:40,borderRadius:o,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:o};case"top-bar":return{blurRadius:40,borderRadius:o,tintColor:r?`rgba(${B}, 0.9)`:`rgba(${I}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:o,tintColor:`rgba(${I}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:o,tintColor:`rgba(${I}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:o,tintColor:`rgba(${B}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:o,tintColor:r?`rgba(${B}, 0.8)`:`rgba(${I}, 0.8)`};default:return{blurRadius:40,borderRadius:o}}}function nr(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 ir(t,r){const o=r?"dark":"light",e=Q(t);switch(t){case"top-solid":return{blurScale:1,borderRadius:e,colorMode:o,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:e,colorMode:o};case"top-bar":return{blurScale:.9,borderRadius:e,colorMode:o,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:o,backgroundGradient:nr(r),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:e,colorMode:o}}}function lr(t,r){const o=/^#?([0-9a-fA-F]{6})$/.exec(t.trim());if(!o)return t;const e=parseInt(o[1],16),i=e>>16&255,a=e>>8&255,b=e&255,m=Math.max(0,Math.min(1,r));return`rgba(${i}, ${a}, ${b}, ${m})`}const cr={...er.ComponentDefaults};function ur(){try{const t=g.getSystemInfoSync(),r=String((t==null?void 0:t.platform)||"").toLowerCase(),o=String((t==null?void 0:t.system)||""),e=r==="ios",i=r==="harmony",a=o.match(/(\d+)(?:\.(\d+))?/),b=e?parseInt((a==null?void 0:a[1])||"0",10):0,m=e?parseInt((a==null?void 0:a[2])||"0",10):0,s=String((t==null?void 0:t.theme)||"").toLowerCase()==="dark";return{isIOS:e,isHarmony:i,iosMajor:b,iosMinor:m,dark:s}}catch{return{isIOS:!1,isHarmony:!1,iosMajor:0,iosMinor:0,dark:!1}}}function dr(){try{const t=g.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function br(t){const{scene:r,dark:o,overlayColor:e,cls:i,style:a,children:b,rest:m}=t,s=r?ir(r,o):void 0,c={};s?(c.blurScale=s.blurScale,c.colorMode=s.colorMode):c.colorMode=o?"dark":"light";const u={...a};(a==null?void 0:a.borderRadius)===void 0&&s&&(u.borderRadius=`${s.borderRadius}px`);const h=e??(s==null?void 0:s.overlayColor);return h&&u.backgroundColor===void 0&&(u.backgroundColor=h),s!=null&&s.backgroundGradient&&u.background===void 0&&(u.background=s.backgroundGradient),s!=null&&s.boxShadow&&u.boxShadow===void 0&&(u.boxShadow=s.boxShadow),_.jsx(L.View,{className:i,style:u,...c,...m,children:b})}function gr(t){const{scene:r,dark:o,targetId:e,overlayColor:i,cls:a,style:b,children:m,rest:s}=t,c=r?U(r,o):void 0,u={...b};c&&c.blurRadius>0&&(u.backdropFilter=`blur(${c.blurRadius}px)`),c&&u.borderRadius===void 0&&(u.borderRadius=`${c.borderRadius}px`);const h=i??(c==null?void 0:c.tintColor),S={};return e&&(S.targetId=e),r&&(S.scene=r),h&&(S.overlayColor=h),_.jsx(L.View,{className:a,style:u,...S,...s,children:m})}const z=t=>{const{className:r,style:o,children:e,scene:i,targetId:a,theme:b="auto",extractTint:m,clipSystemShadow:s=!1,liquidGlass:c,frostedGlass:u,gradientBlur:h,overlayColor:S,id:mr,...T}={...cr,...t},$=or("nut-jdmaterialview",r),{isIOS:C,isHarmony:X,iosMajor:x,iosMinor:P}=f.useMemo(()=>ur(),[]),A=b==="auto",[Z,rr]=f.useState(()=>dr()),O=f.useCallback(n=>{const d=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");rr(d.toLowerCase()==="dark")},[]);f.useEffect(()=>{var n;if(A){try{(n=g.onThemeChange)==null||n.call(g,O)}catch{}return()=>{var d;try{(d=g.offThemeChange)==null||d.call(g,O)}catch{}}}},[A,O]);const v=A?Z:b==="dark",l=f.useMemo(()=>i?K(i,v,x):void 0,[i,v,x]),k=c??(l==null?void 0:l.liquidGlass),M=!!m&&(i==="promotion-fair"||i==="promotion-deep"),R=a?`taro_material_${a}`:void 0,[H,tr]=f.useState(void 0),N=f.useCallback(()=>{var p;if(!C||!M||!R||!a)return;const n=g;if(typeof n.getTagById!="function"||!((p=n.JDTheme)!=null&&p.getGlassTintConfig))return;const d=n.getTagById(R),w=n.getTagById(a);d==null||w==null||d<0||w<0||n.JDTheme.getGlassTintConfig({materialTag:d,blurTag:w}).then(G=>{const y=(G==null?void 0:G.data)??G,J=y==null?void 0:y.tintColor,F=y==null?void 0:y.tintAlpha;!J||!F||F<=0||tr(lr(J,F))}).catch(()=>{})},[C,M,i,R,a]);f.useEffect(()=>{!C||!M||g.nextTick(()=>N())},[C,M,v,N,i,a]);const q=k&&H?{...k,tintColor:H}:k,j=u??(l==null?void 0:l.frostedGlass),V=h??(l==null?void 0:l.gradientBlur);if(C){const n={...l==null?void 0:l.fallbackStyle,...o};i&&n.borderRadius===void 0&&(n.borderRadius=`${Y(i,x)}px`);const d=!!q&&s&&x===26&&P>=3&&P<=5;!d&&(l!=null&&l.boxShadow)&&n.boxShadow===void 0&&(n.boxShadow=l.boxShadow);const w=x>=26;let p;return w&&q?(p={liquidGlass:{...q,useCustomShadow:d}},d&&(n.overflow="hidden")):j?p={frostedGlass:j}:V&&(p={gradientBlur:V}),_.jsx(L.JDIOSMaterialView,{id:R,className:$,style:n,targetId:a,materialConfig:p,...T,children:e})}return X?br({scene:i,dark:v,overlayColor:S,cls:$,style:o,children:e,rest:T}):gr({scene:i,dark:v,targetId:a,overlayColor:S,cls:$,style:o,children:e,rest:T})};z.displayName="NutJDMaterialView";exports.JDMaterialView=z;exports.getCornerRadius=Y;exports.getFrostedPreset=U;exports.getPreset=K;
@@ -1,4 +1,4 @@
1
- import { J as e } from "../jdmaterialview.taro-B75tS41o.mjs";
1
+ import { J as e } from "../jdmaterialview.taro-jg4ylH3W.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-B75tS41o.mjs";
2
- import { g as s, a as o, b as g } from "../jdmaterialview.taro-B75tS41o.mjs";
1
+ import { J as r } from "../jdmaterialview.taro-jg4ylH3W.mjs";
2
+ import { g as s, a as o, b as g } from "../jdmaterialview.taro-jg4ylH3W.mjs";
3
3
  export {
4
4
  r as default,
5
5
  s as getCornerRadius,
@@ -0,0 +1,322 @@
1
+ import { jsx as _ } from "react/jsx-runtime";
2
+ import { useMemo as V, useState as j, useCallback as E, useEffect as W } from "react";
3
+ import ro from "classnames";
4
+ import y from "@tarojs/taro";
5
+ import { JDIOSMaterialView as to, View as Y } from "@jdtaro/ui";
6
+ import { C as eo } from "./typings-CdeuPEKG.mjs";
7
+ const Q = 26, D = "0 4px 2px 0 rgba(0, 0, 0, 0.05)", K = "0 4px 8px 0 rgba(0, 0, 0, 0.05)", ao = "0 -8px 4px 0 rgba(0, 0, 0, 0.12)", so = "0 -8px 4px 0 rgba(31, 34, 38, 0.5)";
8
+ function no(r, o, t) {
9
+ const e = t >= Q;
10
+ switch (r) {
11
+ case "top-solid":
12
+ return e ? {
13
+ liquidGlass: {
14
+ style: "regular",
15
+ interactive: !0,
16
+ darkMode: o,
17
+ ...o ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
18
+ },
19
+ boxShadow: D
20
+ } : { fallbackStyle: { backgroundColor: o ? "#2A2F36" : "#FFFFFF" } };
21
+ case "top-plain":
22
+ return e ? {
23
+ liquidGlass: {
24
+ style: "regular",
25
+ interactive: !0,
26
+ darkMode: o,
27
+ ...o ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
28
+ },
29
+ boxShadow: D
30
+ } : {};
31
+ case "top-bar":
32
+ return {
33
+ frostedGlass: {
34
+ style: o ? "regular-dark" : "ultra-thin-light",
35
+ tintColor: o ? "rgba(0, 0, 0, 0.6)" : "rgba(255, 255, 255, 0.75)"
36
+ }
37
+ };
38
+ case "promotion-fair":
39
+ return {
40
+ liquidGlass: { style: "clear", interactive: !0 },
41
+ frostedGlass: {
42
+ style: o ? "regular-dark" : "ultra-thin-light",
43
+ tintColor: o ? "rgba(0, 0, 0, 0.6)" : "rgba(255, 255, 255, 0.85)"
44
+ },
45
+ // 阴影仅玻璃态显示(对齐 ObjC shadowAlpha=0.05 / fallbackShadowAlpha=0)
46
+ ...e ? { boxShadow: K } : {}
47
+ };
48
+ case "promotion-deep":
49
+ return {
50
+ liquidGlass: { style: "clear", interactive: !0 },
51
+ frostedGlass: { style: "ultra-thin-light", alpha: 1 },
52
+ ...e ? { boxShadow: K } : {}
53
+ };
54
+ case "immersive":
55
+ return e ? {
56
+ liquidGlass: {
57
+ style: "regular",
58
+ darkMode: !0,
59
+ interactive: !0,
60
+ tintColor: "rgba(0, 0, 0, 0.05)"
61
+ },
62
+ boxShadow: D
63
+ } : { frostedGlass: { style: "regular-dark", alpha: 1 } };
64
+ case "bottom-bar":
65
+ return {
66
+ gradientBlur: {
67
+ minBlur: 0.5,
68
+ maxBlur: 0.8,
69
+ overlayAlpha: 0.9,
70
+ overlayColor: o ? "rgba(0, 0, 0, 1)" : "rgba(255, 255, 255, 1)"
71
+ },
72
+ // 底导背板阴影向上(对齐 ObjC off(0,-8) radius4):亮色黑 α0.12 / 暗色深灰 α0.5
73
+ boxShadow: o ? so : ao
74
+ };
75
+ default:
76
+ return {};
77
+ }
78
+ }
79
+ function io(r, o) {
80
+ const t = o >= Q;
81
+ switch (r) {
82
+ case "top-bar":
83
+ case "bottom-bar":
84
+ return 0;
85
+ case "top-plain":
86
+ return t ? 12 : 0;
87
+ case "top-solid":
88
+ case "promotion-fair":
89
+ case "promotion-deep":
90
+ case "immersive":
91
+ return t ? 12 : 8;
92
+ default:
93
+ return 0;
94
+ }
95
+ }
96
+ function U(r) {
97
+ switch (r) {
98
+ case "top-bar":
99
+ case "bottom-bar":
100
+ return 0;
101
+ case "top-solid":
102
+ case "top-plain":
103
+ case "promotion-fair":
104
+ case "promotion-deep":
105
+ case "immersive":
106
+ return 8;
107
+ default:
108
+ return 0;
109
+ }
110
+ }
111
+ const R = "255, 255, 255", B = "31, 34, 38";
112
+ function lo(r, o) {
113
+ const t = U(r);
114
+ switch (r) {
115
+ case "top-solid":
116
+ return {
117
+ blurRadius: 40,
118
+ borderRadius: t,
119
+ tintColor: o ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
120
+ };
121
+ case "top-plain":
122
+ return { blurRadius: 0, borderRadius: t };
123
+ case "top-bar":
124
+ return {
125
+ blurRadius: 40,
126
+ borderRadius: t,
127
+ tintColor: o ? `rgba(${B}, 0.9)` : `rgba(${R}, 0.9)`
128
+ };
129
+ case "promotion-fair":
130
+ return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${R}, 0.85)` };
131
+ case "promotion-deep":
132
+ return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${R}, 0.2)` };
133
+ case "immersive":
134
+ return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${B}, 0.4)` };
135
+ case "bottom-bar":
136
+ return {
137
+ blurRadius: 50,
138
+ borderRadius: t,
139
+ tintColor: o ? `rgba(${B}, 0.8)` : `rgba(${R}, 0.8)`
140
+ };
141
+ default:
142
+ return { blurRadius: 40, borderRadius: t };
143
+ }
144
+ }
145
+ function co(r) {
146
+ const o = r ? "0, 0, 0" : "255, 255, 255";
147
+ return `linear-gradient(to bottom, rgba(${o}, 0.8) 0%, rgba(${o}, 0.8) 56%, rgba(${o}, 0.78) 66%, rgba(${o}, 0.72) 76%, rgba(${o}, 0.62) 86%, rgba(${o}, 0.49) 94%, rgba(${o}, 0.3) 100%)`;
148
+ }
149
+ function uo(r, o) {
150
+ const t = o ? "dark" : "light", e = U(r);
151
+ switch (r) {
152
+ case "top-solid":
153
+ return {
154
+ blurScale: 1,
155
+ borderRadius: e,
156
+ colorMode: t,
157
+ overlayColor: o ? "#2A2F36" : "#FFFFFF"
158
+ };
159
+ case "top-plain":
160
+ return { blurScale: 0, borderRadius: e, colorMode: t };
161
+ case "top-bar":
162
+ return {
163
+ blurScale: 0.9,
164
+ borderRadius: e,
165
+ colorMode: t,
166
+ overlayColor: o ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.62)"
167
+ };
168
+ case "promotion-fair":
169
+ return { blurScale: 0.85, borderRadius: e, colorMode: "light" };
170
+ case "promotion-deep":
171
+ return { blurScale: 0.2, borderRadius: e, colorMode: "light" };
172
+ case "immersive":
173
+ return { blurScale: 0.4, borderRadius: e, colorMode: "dark" };
174
+ case "bottom-bar":
175
+ return {
176
+ blurScale: 0.2,
177
+ borderRadius: e,
178
+ colorMode: t,
179
+ backgroundGradient: co(o),
180
+ boxShadow: "0 8px 40px rgba(0, 0, 0, 0.12)"
181
+ };
182
+ default:
183
+ return { blurScale: 0, borderRadius: e, colorMode: t };
184
+ }
185
+ }
186
+ function bo(r, o) {
187
+ const t = /^#?([0-9a-fA-F]{6})$/.exec(r.trim());
188
+ if (!t) return r;
189
+ const e = parseInt(t[1], 16), i = e >> 16 & 255, a = e >> 8 & 255, b = e & 255, m = Math.max(0, Math.min(1, o));
190
+ return `rgba(${i}, ${a}, ${b}, ${m})`;
191
+ }
192
+ const go = {
193
+ ...eo
194
+ };
195
+ function mo() {
196
+ try {
197
+ const r = y.getSystemInfoSync(), o = String((r == null ? void 0 : r.platform) || "").toLowerCase(), t = String((r == null ? void 0 : r.system) || ""), e = o === "ios", i = o === "harmony", a = t.match(/(\d+)(?:\.(\d+))?/), b = e ? parseInt((a == null ? void 0 : a[1]) || "0", 10) : 0, m = e ? parseInt((a == null ? void 0 : a[2]) || "0", 10) : 0, s = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
198
+ return { isIOS: e, isHarmony: i, iosMajor: b, iosMinor: m, dark: s };
199
+ } catch {
200
+ return { isIOS: !1, isHarmony: !1, iosMajor: 0, iosMinor: 0, dark: !1 };
201
+ }
202
+ }
203
+ function fo() {
204
+ try {
205
+ const r = y.getSystemInfoSync();
206
+ return String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
207
+ } catch {
208
+ return !1;
209
+ }
210
+ }
211
+ function ho(r) {
212
+ const { scene: o, dark: t, overlayColor: e, cls: i, style: a, children: b, rest: m } = r, s = o ? uo(o, t) : void 0, c = {};
213
+ s ? (c.blurScale = s.blurScale, c.colorMode = s.colorMode) : c.colorMode = t ? "dark" : "light";
214
+ const u = { ...a };
215
+ (a == null ? void 0 : a.borderRadius) === void 0 && s && (u.borderRadius = `${s.borderRadius}px`);
216
+ const h = e ?? (s == null ? void 0 : s.overlayColor);
217
+ return h && u.backgroundColor === void 0 && (u.backgroundColor = h), s != null && s.backgroundGradient && u.background === void 0 && (u.background = s.backgroundGradient), s != null && s.boxShadow && u.boxShadow === void 0 && (u.boxShadow = s.boxShadow), /* @__PURE__ */ _(Y, { className: i, style: u, ...c, ...m, children: b });
218
+ }
219
+ function po(r) {
220
+ const { scene: o, dark: t, targetId: e, overlayColor: i, cls: a, style: b, children: m, rest: s } = r, c = o ? lo(o, t) : void 0, u = { ...b };
221
+ c && c.blurRadius > 0 && (u.backdropFilter = `blur(${c.blurRadius}px)`), c && u.borderRadius === void 0 && (u.borderRadius = `${c.borderRadius}px`);
222
+ const h = i ?? (c == null ? void 0 : c.tintColor), p = {};
223
+ return e && (p.targetId = e), o && (p.scene = o), h && (p.overlayColor = h), /* @__PURE__ */ _(Y, { className: a, style: u, ...p, ...s, children: m });
224
+ }
225
+ const So = (r) => {
226
+ const {
227
+ className: o,
228
+ style: t,
229
+ children: e,
230
+ scene: i,
231
+ targetId: a,
232
+ theme: b = "auto",
233
+ extractTint: m,
234
+ clipSystemShadow: s = !1,
235
+ liquidGlass: c,
236
+ frostedGlass: u,
237
+ gradientBlur: h,
238
+ overlayColor: p,
239
+ id: yo,
240
+ ...T
241
+ } = { ...go, ...r }, I = ro("nut-jdmaterialview", o), { isIOS: C, isHarmony: z, iosMajor: v, iosMinor: q } = V(() => mo(), []), $ = b === "auto", [X, Z] = j(() => fo()), A = E(
242
+ (n) => {
243
+ const d = typeof n == "string" ? n : String((n == null ? void 0 : n.theme) || "");
244
+ Z(d.toLowerCase() === "dark");
245
+ },
246
+ []
247
+ );
248
+ W(() => {
249
+ var n, d;
250
+ if ($) {
251
+ try {
252
+ (d = (n = y).onThemeChange) == null || d.call(n, A);
253
+ } catch {
254
+ }
255
+ return () => {
256
+ var f, g;
257
+ try {
258
+ (g = (f = y).offThemeChange) == null || g.call(f, A);
259
+ } catch {
260
+ }
261
+ };
262
+ }
263
+ }, [$, A]);
264
+ const x = $ ? X : b === "dark", l = V(
265
+ () => i ? no(i, x, v) : void 0,
266
+ [i, x, v]
267
+ ), O = c ?? (l == null ? void 0 : l.liquidGlass), w = !!m && (i === "promotion-fair" || i === "promotion-deep"), G = a ? `taro_material_${a}` : void 0, [L, oo] = j(void 0), H = E(() => {
268
+ var g;
269
+ if (!C || !w || !G || !a) return;
270
+ const n = y;
271
+ if (typeof n.getTagById != "function" || !((g = n.JDTheme) != null && g.getGlassTintConfig)) return;
272
+ const d = n.getTagById(G), f = n.getTagById(a);
273
+ d == null || f == null || d < 0 || f < 0 || n.JDTheme.getGlassTintConfig({ materialTag: d, blurTag: f }).then((M) => {
274
+ const S = (M == null ? void 0 : M.data) ?? M, J = S == null ? void 0 : S.tintColor, F = S == null ? void 0 : S.tintAlpha;
275
+ !J || !F || F <= 0 || oo(bo(J, F));
276
+ }).catch(() => {
277
+ });
278
+ }, [C, w, i, G, a]);
279
+ W(() => {
280
+ !C || !w || y.nextTick(() => H());
281
+ }, [C, w, x, H, i, a]);
282
+ const k = O && L ? { ...O, tintColor: L } : O, N = u ?? (l == null ? void 0 : l.frostedGlass), P = h ?? (l == null ? void 0 : l.gradientBlur);
283
+ if (C) {
284
+ const n = { ...l == null ? void 0 : l.fallbackStyle, ...t };
285
+ i && n.borderRadius === void 0 && (n.borderRadius = `${io(i, v)}px`);
286
+ const d = !!k && s && v === 26 && q >= 3 && q <= 5;
287
+ !d && (l != null && l.boxShadow) && n.boxShadow === void 0 && (n.boxShadow = l.boxShadow);
288
+ const f = v >= 26;
289
+ let g;
290
+ return f && k ? (g = {
291
+ liquidGlass: { ...k, useCustomShadow: d }
292
+ }, d && (n.overflow = "hidden")) : N ? g = { frostedGlass: N } : P && (g = { gradientBlur: P }), /* @__PURE__ */ _(
293
+ to,
294
+ {
295
+ id: G,
296
+ className: I,
297
+ style: n,
298
+ targetId: a,
299
+ materialConfig: g,
300
+ ...T,
301
+ children: e
302
+ }
303
+ );
304
+ }
305
+ return z ? ho({ scene: i, dark: x, overlayColor: p, cls: I, style: t, children: e, rest: T }) : po({
306
+ scene: i,
307
+ dark: x,
308
+ targetId: a,
309
+ overlayColor: p,
310
+ cls: I,
311
+ style: t,
312
+ children: e,
313
+ rest: T
314
+ });
315
+ };
316
+ So.displayName = "NutJDMaterialView";
317
+ export {
318
+ So as J,
319
+ lo as a,
320
+ no as b,
321
+ io as g
322
+ };
@@ -31,4 +31,12 @@ export interface JDMaterialViewProps extends BasicComponent {
31
31
  * 故应由业务在背景图就绪后再置 true。默认 false(不提取)。
32
32
  */
33
33
  extractTint?: boolean;
34
+ /**
35
+ * 仅 iOS 26.3~26.5(含补丁版本)生效,其他 iOS 版本及其他端不受影响。
36
+ * 默认 false;开启且使用液态玻璃时,将 overflow 设为 hidden,
37
+ * 裁掉系统外阴影并由原生外层绘制固定小投影。会覆盖 style.overflow,
38
+ * 同时裁剪内部越界内容和交互高光;子节点的 overflow: visible 无法绕过。
39
+ * 未开启时保留业务 overflow 和原有材质行为。
40
+ */
41
+ clipSystemShadow?: boolean;
34
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/taro-biz",
3
- "version": "0.0.1-alpha.31",
3
+ "version": "0.0.1-alpha.33",
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",
@@ -1 +0,0 @@
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:!1},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:!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: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=!!f&&(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:m,cls:T,style:t,children:e,rest:I}):br({scene:a,dark:C,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;
@@ -1,318 +0,0 @@
1
- import { jsx as B } from "react/jsx-runtime";
2
- import { useMemo as J, useState as V, useCallback as j, useEffect as E } from "react";
3
- import rr from "classnames";
4
- import p from "@tarojs/taro";
5
- import { JDIOSMaterialView as or, View as K } from "@jdtaro/ui";
6
- import { C as tr } from "./typings-CdeuPEKG.mjs";
7
- const Y = 26, F = "0 4px 2px 0 rgba(0, 0, 0, 0.05)", W = "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)";
8
- function sr(t, r, o) {
9
- const e = o >= Y;
10
- switch (t) {
11
- case "top-solid":
12
- return e ? {
13
- liquidGlass: {
14
- style: "regular",
15
- interactive: !0,
16
- darkMode: r,
17
- ...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
18
- },
19
- boxShadow: F
20
- } : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
21
- case "top-plain":
22
- return e ? {
23
- liquidGlass: {
24
- style: "regular",
25
- interactive: !0,
26
- darkMode: r,
27
- ...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
28
- },
29
- boxShadow: F
30
- } : {};
31
- case "top-bar":
32
- return {
33
- frostedGlass: {
34
- style: r ? "regular-dark" : "ultra-thin-light",
35
- tintColor: r ? "rgba(0, 0, 0, 0.6)" : "rgba(255, 255, 255, 0.75)"
36
- }
37
- };
38
- case "promotion-fair":
39
- return {
40
- liquidGlass: { style: "clear", interactive: !1 },
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
- },
45
- // 阴影仅玻璃态显示(对齐 ObjC shadowAlpha=0.05 / fallbackShadowAlpha=0)
46
- ...e ? { boxShadow: W } : {}
47
- };
48
- case "promotion-deep":
49
- return {
50
- liquidGlass: { style: "clear", interactive: !1 },
51
- frostedGlass: { style: "ultra-thin-light", alpha: 1 },
52
- ...e ? { boxShadow: W } : {}
53
- };
54
- case "immersive":
55
- return e ? {
56
- liquidGlass: {
57
- style: "regular",
58
- darkMode: !0,
59
- interactive: !0,
60
- tintColor: "rgba(0, 0, 0, 0.05)"
61
- },
62
- boxShadow: F
63
- } : { frostedGlass: { style: "regular-dark", alpha: 1 } };
64
- case "bottom-bar":
65
- return {
66
- gradientBlur: {
67
- minBlur: 0.5,
68
- maxBlur: 0.8,
69
- overlayAlpha: 0.9,
70
- overlayColor: r ? "rgba(0, 0, 0, 1)" : "rgba(255, 255, 255, 1)"
71
- },
72
- // 底导背板阴影向上(对齐 ObjC off(0,-8) radius4):亮色黑 α0.12 / 暗色深灰 α0.5
73
- boxShadow: r ? ar : er
74
- };
75
- default:
76
- return {};
77
- }
78
- }
79
- function nr(t, r) {
80
- const o = r >= Y;
81
- switch (t) {
82
- case "top-bar":
83
- case "bottom-bar":
84
- return 0;
85
- case "top-plain":
86
- return o ? 12 : 0;
87
- case "top-solid":
88
- case "promotion-fair":
89
- case "promotion-deep":
90
- case "immersive":
91
- return o ? 12 : 8;
92
- default:
93
- return 0;
94
- }
95
- }
96
- function Q(t) {
97
- switch (t) {
98
- case "top-bar":
99
- case "bottom-bar":
100
- return 0;
101
- case "top-solid":
102
- case "top-plain":
103
- case "promotion-fair":
104
- case "promotion-deep":
105
- case "immersive":
106
- return 8;
107
- default:
108
- return 0;
109
- }
110
- }
111
- const T = "255, 255, 255", D = "31, 34, 38";
112
- function ir(t, r) {
113
- const o = Q(t);
114
- switch (t) {
115
- case "top-solid":
116
- return {
117
- blurRadius: 40,
118
- borderRadius: o,
119
- tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
120
- };
121
- case "top-plain":
122
- return { blurRadius: 0, borderRadius: o };
123
- case "top-bar":
124
- return {
125
- blurRadius: 40,
126
- borderRadius: o,
127
- tintColor: r ? `rgba(${D}, 0.9)` : `rgba(${T}, 0.9)`
128
- };
129
- case "promotion-fair":
130
- return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${T}, 0.85)` };
131
- case "promotion-deep":
132
- return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${T}, 0.2)` };
133
- case "immersive":
134
- return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${D}, 0.4)` };
135
- case "bottom-bar":
136
- return {
137
- blurRadius: 50,
138
- borderRadius: o,
139
- tintColor: r ? `rgba(${D}, 0.8)` : `rgba(${T}, 0.8)`
140
- };
141
- default:
142
- return { blurRadius: 40, borderRadius: o };
143
- }
144
- }
145
- function lr(t) {
146
- const r = t ? "0, 0, 0" : "255, 255, 255";
147
- 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%)`;
148
- }
149
- function cr(t, r) {
150
- const o = r ? "dark" : "light", e = Q(t);
151
- switch (t) {
152
- case "top-solid":
153
- return {
154
- blurScale: 1,
155
- borderRadius: e,
156
- colorMode: o,
157
- overlayColor: r ? "#2A2F36" : "#FFFFFF"
158
- };
159
- case "top-plain":
160
- return { blurScale: 0, borderRadius: e, colorMode: o };
161
- case "top-bar":
162
- return {
163
- blurScale: 0.9,
164
- borderRadius: e,
165
- colorMode: o,
166
- overlayColor: r ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.62)"
167
- };
168
- case "promotion-fair":
169
- return { blurScale: 0.85, borderRadius: e, colorMode: "light" };
170
- case "promotion-deep":
171
- return { blurScale: 0.2, borderRadius: e, colorMode: "light" };
172
- case "immersive":
173
- return { blurScale: 0.4, borderRadius: e, colorMode: "dark" };
174
- case "bottom-bar":
175
- return {
176
- blurScale: 0.2,
177
- borderRadius: e,
178
- colorMode: o,
179
- backgroundGradient: lr(r),
180
- boxShadow: "0 8px 40px rgba(0, 0, 0, 0.12)"
181
- };
182
- default:
183
- return { blurScale: 0, borderRadius: e, colorMode: o };
184
- }
185
- }
186
- function ur(t, r) {
187
- const o = /^#?([0-9a-fA-F]{6})$/.exec(t.trim());
188
- if (!o) return t;
189
- const e = parseInt(o[1], 16), a = e >> 16 & 255, i = e >> 8 & 255, b = e & 255, m = Math.max(0, Math.min(1, r));
190
- return `rgba(${a}, ${i}, ${b}, ${m})`;
191
- }
192
- const dr = {
193
- ...tr
194
- };
195
- function br() {
196
- var t;
197
- try {
198
- const r = p.getSystemInfoSync(), o = String((r == null ? void 0 : r.platform) || "").toLowerCase(), e = String((r == null ? void 0 : r.system) || ""), a = o === "ios", i = o === "harmony", b = a ? parseInt(((t = e.match(/\d+/)) == null ? void 0 : t[0]) || "0", 10) : 0, m = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
199
- return { isIOS: a, isHarmony: i, iosMajor: b, dark: m };
200
- } catch {
201
- return { isIOS: !1, isHarmony: !1, iosMajor: 0, dark: !1 };
202
- }
203
- }
204
- function gr() {
205
- try {
206
- const t = p.getSystemInfoSync();
207
- return String((t == null ? void 0 : t.theme) || "").toLowerCase() === "dark";
208
- } catch {
209
- return !1;
210
- }
211
- }
212
- function mr(t) {
213
- const { scene: r, dark: o, overlayColor: e, cls: a, style: i, children: b, rest: m } = t, s = r ? cr(r, o) : void 0, c = {};
214
- s ? (c.blurScale = s.blurScale, c.colorMode = s.colorMode) : c.colorMode = o ? "dark" : "light";
215
- const u = { ...i };
216
- (i == null ? void 0 : i.borderRadius) === void 0 && s && (u.borderRadius = `${s.borderRadius}px`);
217
- const f = e ?? (s == null ? void 0 : s.overlayColor);
218
- 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), /* @__PURE__ */ B(K, { className: a, style: u, ...c, ...m, children: b });
219
- }
220
- function fr(t) {
221
- const { scene: r, dark: o, targetId: e, overlayColor: a, cls: i, style: b, children: m, rest: s } = t, c = r ? ir(r, o) : void 0, u = { ...b };
222
- c && c.blurRadius > 0 && (u.backdropFilter = `blur(${c.blurRadius}px)`), c && u.borderRadius === void 0 && (u.borderRadius = `${c.borderRadius}px`);
223
- const f = a ?? (c == null ? void 0 : c.tintColor), y = {};
224
- return e && (y.targetId = e), r && (y.scene = r), f && (y.overlayColor = f), /* @__PURE__ */ B(K, { className: i, style: u, ...y, ...s, children: m });
225
- }
226
- const hr = (t) => {
227
- const {
228
- className: r,
229
- style: o,
230
- children: e,
231
- scene: a,
232
- targetId: i,
233
- theme: b = "auto",
234
- extractTint: m,
235
- liquidGlass: s,
236
- frostedGlass: c,
237
- gradientBlur: u,
238
- overlayColor: f,
239
- id: y,
240
- ...M
241
- } = { ...dr, ...t }, I = rr("nut-jdmaterialview", r), { isIOS: S, isHarmony: U, iosMajor: x } = J(() => br(), []), $ = b === "auto", [z, X] = V(() => gr()), A = j(
242
- (n) => {
243
- const g = typeof n == "string" ? n : String((n == null ? void 0 : n.theme) || "");
244
- X(g.toLowerCase() === "dark");
245
- },
246
- []
247
- );
248
- E(() => {
249
- var n, g;
250
- if ($) {
251
- try {
252
- (g = (n = p).onThemeChange) == null || g.call(n, A);
253
- } catch {
254
- }
255
- return () => {
256
- var d, C;
257
- try {
258
- (C = (d = p).offThemeChange) == null || C.call(d, A);
259
- } catch {
260
- }
261
- };
262
- }
263
- }, [$, A]);
264
- const v = $ ? z : b === "dark", l = J(
265
- () => a ? sr(a, v, x) : void 0,
266
- [a, v, x]
267
- ), O = s ?? (l == null ? void 0 : l.liquidGlass), w = !!m && (a === "promotion-fair" || a === "promotion-deep"), G = i ? `taro_material_${i}` : void 0, [_, Z] = V(void 0), q = j(() => {
268
- var C;
269
- if (!S || !w || !G || !i) return;
270
- const n = p;
271
- if (typeof n.getTagById != "function" || !((C = n.JDTheme) != null && C.getGlassTintConfig)) return;
272
- const g = n.getTagById(G), d = n.getTagById(i);
273
- g == null || d == null || g < 0 || d < 0 || n.JDTheme.getGlassTintConfig({ materialTag: g, blurTag: d }).then((R) => {
274
- const h = (R == null ? void 0 : R.data) ?? R, P = h == null ? void 0 : h.tintColor, k = h == null ? void 0 : h.tintAlpha;
275
- !P || !k || k <= 0 || Z(ur(P, k));
276
- }).catch(() => {
277
- });
278
- }, [S, w, a, G, i]);
279
- E(() => {
280
- !S || !w || p.nextTick(() => q());
281
- }, [S, w, v, q, a, i]);
282
- const L = O && _ ? { ...O, tintColor: _ } : O, H = c ?? (l == null ? void 0 : l.frostedGlass), N = u ?? (l == null ? void 0 : l.gradientBlur);
283
- if (S) {
284
- const n = { ...l == null ? void 0 : l.fallbackStyle, ...o };
285
- a && n.borderRadius === void 0 && (n.borderRadius = `${nr(a, x)}px`), l != null && l.boxShadow && n.boxShadow === void 0 && (n.boxShadow = l.boxShadow);
286
- const g = x >= 26;
287
- let d;
288
- return g && L ? d = { liquidGlass: L } : H ? d = { frostedGlass: H } : N && (d = { gradientBlur: N }), /* @__PURE__ */ B(
289
- or,
290
- {
291
- id: G,
292
- className: I,
293
- style: n,
294
- targetId: i,
295
- materialConfig: d,
296
- ...M,
297
- children: e
298
- }
299
- );
300
- }
301
- return U ? mr({ scene: a, dark: v, overlayColor: f, cls: I, style: o, children: e, rest: M }) : fr({
302
- scene: a,
303
- dark: v,
304
- targetId: i,
305
- overlayColor: f,
306
- cls: I,
307
- style: o,
308
- children: e,
309
- rest: M
310
- });
311
- };
312
- hr.displayName = "NutJDMaterialView";
313
- export {
314
- hr as J,
315
- ir as a,
316
- sr as b,
317
- nr as g
318
- };