@nutui/taro-biz 0.0.1-alpha.8 → 0.0.1-alpha.9
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/cjs/index/index.js +1 -1
- package/dist/cjs/jdmaterialview/index.js +1 -1
- package/dist/cjs/jdmaterialview.taro-BocjWSVM.js +1 -0
- package/dist/es/index/index.js +1 -1
- package/dist/es/jdmaterialview/index.js +2 -2
- package/dist/es/{jdmaterialview.taro-DHsrFcZg.mjs → jdmaterialview.taro-B3s_ZzgX.mjs} +75 -72
- package/package.json +1 -1
- package/dist/cjs/jdmaterialview.taro-34Y0-ZOh.js +0 -1
package/dist/cjs/index/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-BocjWSVM.js"),r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-BocjWSVM.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const C=require("react/jsx-runtime"),f=require("react"),P=require("classnames"),d=require("@tarojs/taro"),M=require("@tarojs/components"),j=require("@jdtaro/ui"),x=require("./typings-DP_XKs5o.js"),w=26;function F(t,r,e){const s=e>=w;switch(t){case"top-solid":return s?{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 s?{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:.85}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:.35}};case"immersive":return s?{liquidGlass:{style:"regular",forceDark:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.75)"}}:{frostedGlass:{style:"regular-dark",alpha:.4}};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 $(t,r){const e=r>=w;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}}const R="255, 255, 255",S="31, 34, 38";function q(t,r){switch(t){case"top-solid":return{blurRadius:40,borderRadius:12,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:40,borderRadius:12};case"top-bar":return{blurRadius:40,borderRadius:12,tintColor:r?`rgba(${S}, 0.9)`:`rgba(${R}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:12,tintColor:`rgba(${R}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:12,tintColor:`rgba(${R}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:12,tintColor:`rgba(${S}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:0,tintColor:r?`rgba(${S}, 0.8)`:`rgba(${R}, 0.8)`};default:return{blurRadius:40,borderRadius:12}}}function N(t,r){const e=r?"dark":"light";switch(t){case"top-solid":return{blurScale:1,borderRadius:8,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:8,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:0,colorMode:e};case"promotion-fair":return{blurScale:.85,borderRadius:8,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:8,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:8,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:0,colorMode:e};default:return{blurScale:0,borderRadius:0,colorMode:e}}}const V={...x.ComponentDefaults};function B(){return["harmony","harmonyhybrid","jdharmony"].includes(d.getEnv().toLowerCase())}function _(){var t;try{const r=d.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),s=String((r==null?void 0:r.system)||""),a=e==="ios",i=a?parseInt(((t=s.match(/\d+/))==null?void 0:t[0])||"0",10):0,m=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,iosMajor:i,dark:m}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function E(){try{const t=d.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function H(t){const{scene:r,dark:e,overlayColor:s,cls:a,style:i,children:m,rest:g}=t,n=r?N(r,e):void 0,o={};n?(o.blurScale=n.blurScale,o.borderRadius=n.borderRadius,o.colorMode=n.colorMode):o.colorMode=e?"dark":"light",(i==null?void 0:i.borderRadius)!==void 0&&(o.borderRadius=parseFloat(String(i.borderRadius)));const u=s??(n==null?void 0:n.overlayColor);return u&&(o.overlayColor=u),C.jsx(M.View,{className:a,style:i,...o,...g,children:m})}function J(t){const{scene:r,dark:e,targetId:s,overlayColor:a,cls:i,style:m,children:g,rest:n}=t,o=r?q(r,e):void 0,u={...m};o&&o.blurRadius>0&&(u.backdropFilter=`blur(${o.blurRadius}px)`),o&&u.borderRadius===void 0&&(u.borderRadius=`${o.borderRadius}px`);const p=a??(o==null?void 0:o.tintColor),b={};return s&&(b.targetId=s),r&&(b.scene=r),p&&(b.overlayColor=p),C.jsx(M.View,{className:i,style:u,...b,...n,children:g})}const k=t=>{const{className:r,style:e,children:s,scene:a,targetId:i,liquidGlass:m,frostedGlass:g,gradientBlur:n,overlayColor:o,...u}={...V,...t},b=P("nut-jdmaterialview",r),{isIOS:I,iosMajor:G}=f.useMemo(()=>_(),[]),[y,L]=f.useState(()=>E()),v=f.useCallback(c=>{const h=typeof c=="string"?c:String((c==null?void 0:c.theme)||"");L(h.toLowerCase()==="dark")},[]);f.useEffect(()=>{var c;try{(c=d.onThemeChange)==null||c.call(d,v)}catch{}return()=>{var h;try{(h=d.offThemeChange)==null||h.call(d,v)}catch{}}},[v]);const l=f.useMemo(()=>a?F(a,y,G):void 0,[a,y,G]),O=m??(l==null?void 0:l.liquidGlass),A=g??(l==null?void 0:l.frostedGlass),D=n??(l==null?void 0:l.gradientBlur);if(I){const c={...l==null?void 0:l.fallbackStyle,...e};return C.jsx(j.JDIOSMaterialView,{className:b,style:c,liquidGlass:O,frostedGlass:A,gradientBlur:D,...u,children:s})}return B()?H({scene:a,dark:y,overlayColor:o,cls:b,style:e,children:s,rest:u}):J({scene:a,dark:y,targetId:i,overlayColor:o,cls:b,style:e,children:s,rest:u})};k.displayName="NutJDMaterialView";exports.JDMaterialView=k;exports.getCornerRadius=$;exports.getFrostedPreset=q;exports.getPreset=F;
|
package/dist/es/index/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as r } from "../jdmaterialview.taro-
|
|
2
|
-
import { g as s, a as o, b as g } from "../jdmaterialview.taro-
|
|
1
|
+
import { J as r } from "../jdmaterialview.taro-B3s_ZzgX.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-B3s_ZzgX.mjs";
|
|
3
3
|
export {
|
|
4
4
|
r as default,
|
|
5
5
|
s as getCornerRadius,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
4
|
-
import h, { getEnv as
|
|
5
|
-
import { View as
|
|
6
|
-
import { JDIOSMaterialView as
|
|
7
|
-
import { C as
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F, useState as D, useCallback as $, useEffect as N } from "react";
|
|
3
|
+
import P from "classnames";
|
|
4
|
+
import h, { getEnv as x } from "@tarojs/taro";
|
|
5
|
+
import { View as w } from "@tarojs/components";
|
|
6
|
+
import { JDIOSMaterialView as B } from "@jdtaro/ui";
|
|
7
|
+
import { C as T } from "./typings-CdeuPEKG.mjs";
|
|
8
8
|
const k = 26;
|
|
9
|
-
function
|
|
9
|
+
function j(o, r, e) {
|
|
10
10
|
const a = e >= k;
|
|
11
|
-
switch (
|
|
11
|
+
switch (o) {
|
|
12
12
|
case "top-solid":
|
|
13
13
|
return a ? {
|
|
14
14
|
liquidGlass: {
|
|
@@ -61,9 +61,9 @@ function x(t, r, e) {
|
|
|
61
61
|
return {};
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function tr(o, r) {
|
|
65
65
|
const e = r >= k;
|
|
66
|
-
switch (
|
|
66
|
+
switch (o) {
|
|
67
67
|
case "top-bar":
|
|
68
68
|
case "bottom-bar":
|
|
69
69
|
return 0;
|
|
@@ -78,39 +78,42 @@ function or(t, r) {
|
|
|
78
78
|
return 0;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const y = "255, 255, 255",
|
|
82
|
-
function V(
|
|
83
|
-
switch (
|
|
81
|
+
const y = "255, 255, 255", v = "31, 34, 38";
|
|
82
|
+
function V(o, r) {
|
|
83
|
+
switch (o) {
|
|
84
84
|
case "top-solid":
|
|
85
85
|
return {
|
|
86
86
|
blurRadius: 40,
|
|
87
|
+
borderRadius: 12,
|
|
87
88
|
tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
|
|
88
89
|
};
|
|
89
90
|
case "top-plain":
|
|
90
|
-
return { blurRadius: 40 };
|
|
91
|
+
return { blurRadius: 40, borderRadius: 12 };
|
|
91
92
|
case "top-bar":
|
|
92
93
|
return {
|
|
93
94
|
blurRadius: 40,
|
|
94
|
-
|
|
95
|
+
borderRadius: 12,
|
|
96
|
+
tintColor: r ? `rgba(${v}, 0.9)` : `rgba(${y}, 0.9)`
|
|
95
97
|
};
|
|
96
98
|
case "promotion-fair":
|
|
97
|
-
return { blurRadius: 40, tintColor: `rgba(${y}, 0.85)` };
|
|
99
|
+
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${y}, 0.85)` };
|
|
98
100
|
case "promotion-deep":
|
|
99
|
-
return { blurRadius: 40, tintColor: `rgba(${y}, 0.2)` };
|
|
101
|
+
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${y}, 0.2)` };
|
|
100
102
|
case "immersive":
|
|
101
|
-
return { blurRadius: 40, tintColor: `rgba(${
|
|
103
|
+
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${v}, 0.4)` };
|
|
102
104
|
case "bottom-bar":
|
|
103
105
|
return {
|
|
104
106
|
blurRadius: 50,
|
|
105
|
-
|
|
107
|
+
borderRadius: 0,
|
|
108
|
+
tintColor: r ? `rgba(${v}, 0.8)` : `rgba(${y}, 0.8)`
|
|
106
109
|
};
|
|
107
110
|
default:
|
|
108
|
-
return { blurRadius: 40 };
|
|
111
|
+
return { blurRadius: 40, borderRadius: 12 };
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
|
-
function _(
|
|
114
|
+
function _(o, r) {
|
|
112
115
|
const e = r ? "dark" : "light";
|
|
113
|
-
switch (
|
|
116
|
+
switch (o) {
|
|
114
117
|
case "top-solid":
|
|
115
118
|
return {
|
|
116
119
|
blurScale: 1,
|
|
@@ -135,109 +138,109 @@ function _(t, r) {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
const E = {
|
|
138
|
-
...
|
|
141
|
+
...T
|
|
139
142
|
};
|
|
140
143
|
function H() {
|
|
141
144
|
return ["harmony", "harmonyhybrid", "jdharmony"].includes(
|
|
142
|
-
|
|
145
|
+
x().toLowerCase()
|
|
143
146
|
);
|
|
144
147
|
}
|
|
145
148
|
function J() {
|
|
146
|
-
var
|
|
149
|
+
var o;
|
|
147
150
|
try {
|
|
148
|
-
const r = h.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), a = String((r == null ? void 0 : r.system) || ""), s = e === "ios",
|
|
149
|
-
return { isIOS: s, iosMajor:
|
|
151
|
+
const r = h.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), a = String((r == null ? void 0 : r.system) || ""), s = e === "ios", i = s ? parseInt(((o = a.match(/\d+/)) == null ? void 0 : o[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
|
|
152
|
+
return { isIOS: s, iosMajor: i, dark: b };
|
|
150
153
|
} catch {
|
|
151
154
|
return { isIOS: !1, iosMajor: 0, dark: !1 };
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
function Y() {
|
|
155
158
|
try {
|
|
156
|
-
const
|
|
157
|
-
return String((
|
|
159
|
+
const o = h.getSystemInfoSync();
|
|
160
|
+
return String((o == null ? void 0 : o.theme) || "").toLowerCase() === "dark";
|
|
158
161
|
} catch {
|
|
159
162
|
return !1;
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
|
-
function K(
|
|
163
|
-
const { scene: r, dark: e, overlayColor: a, cls: s, style:
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
return
|
|
165
|
+
function K(o) {
|
|
166
|
+
const { scene: r, dark: e, overlayColor: a, cls: s, style: i, children: b, rest: m } = o, n = r ? _(r, e) : void 0, t = {};
|
|
167
|
+
n ? (t.blurScale = n.blurScale, t.borderRadius = n.borderRadius, t.colorMode = n.colorMode) : t.colorMode = e ? "dark" : "light", (i == null ? void 0 : i.borderRadius) !== void 0 && (t.borderRadius = parseFloat(String(i.borderRadius)));
|
|
168
|
+
const u = a ?? (n == null ? void 0 : n.overlayColor);
|
|
169
|
+
return u && (t.overlayColor = u), /* @__PURE__ */ S(w, { className: s, style: i, ...t, ...m, children: b });
|
|
167
170
|
}
|
|
168
|
-
function Q(
|
|
169
|
-
const { scene: r, dark: e, targetId: a, overlayColor: s, cls:
|
|
170
|
-
|
|
171
|
-
const p = s ?? (
|
|
172
|
-
return a && (
|
|
171
|
+
function Q(o) {
|
|
172
|
+
const { scene: r, dark: e, targetId: a, overlayColor: s, cls: i, style: b, children: m, rest: n } = o, t = r ? V(r, e) : void 0, u = { ...b };
|
|
173
|
+
t && t.blurRadius > 0 && (u.backdropFilter = `blur(${t.blurRadius}px)`), t && u.borderRadius === void 0 && (u.borderRadius = `${t.borderRadius}px`);
|
|
174
|
+
const p = s ?? (t == null ? void 0 : t.tintColor), d = {};
|
|
175
|
+
return a && (d.targetId = a), r && (d.scene = r), p && (d.overlayColor = p), /* @__PURE__ */ S(w, { className: i, style: u, ...d, ...n, children: m });
|
|
173
176
|
}
|
|
174
|
-
const U = (
|
|
177
|
+
const U = (o) => {
|
|
175
178
|
const {
|
|
176
179
|
className: r,
|
|
177
180
|
style: e,
|
|
178
181
|
children: a,
|
|
179
182
|
scene: s,
|
|
180
|
-
targetId:
|
|
181
|
-
liquidGlass:
|
|
182
|
-
frostedGlass:
|
|
183
|
-
gradientBlur:
|
|
184
|
-
overlayColor:
|
|
185
|
-
...
|
|
186
|
-
} = { ...E, ...
|
|
187
|
-
(
|
|
188
|
-
const g = typeof
|
|
183
|
+
targetId: i,
|
|
184
|
+
liquidGlass: b,
|
|
185
|
+
frostedGlass: m,
|
|
186
|
+
gradientBlur: n,
|
|
187
|
+
overlayColor: t,
|
|
188
|
+
...u
|
|
189
|
+
} = { ...E, ...o }, d = P("nut-jdmaterialview", r), { isIOS: I, iosMajor: C } = F(() => J(), []), [f, q] = D(() => Y()), R = $(
|
|
190
|
+
(c) => {
|
|
191
|
+
const g = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
|
|
189
192
|
q(g.toLowerCase() === "dark");
|
|
190
193
|
},
|
|
191
194
|
[]
|
|
192
195
|
);
|
|
193
|
-
|
|
194
|
-
var
|
|
196
|
+
N(() => {
|
|
197
|
+
var c, g;
|
|
195
198
|
try {
|
|
196
|
-
(g = (
|
|
199
|
+
(g = (c = h).onThemeChange) == null || g.call(c, R);
|
|
197
200
|
} catch {
|
|
198
201
|
}
|
|
199
202
|
return () => {
|
|
200
203
|
var G, M;
|
|
201
204
|
try {
|
|
202
|
-
(M = (G = h).offThemeChange) == null || M.call(G,
|
|
205
|
+
(M = (G = h).offThemeChange) == null || M.call(G, R);
|
|
203
206
|
} catch {
|
|
204
207
|
}
|
|
205
208
|
};
|
|
206
|
-
}, [
|
|
207
|
-
const l =
|
|
208
|
-
() => s ?
|
|
209
|
-
[s, f,
|
|
210
|
-
), L =
|
|
209
|
+
}, [R]);
|
|
210
|
+
const l = F(
|
|
211
|
+
() => s ? j(s, f, C) : void 0,
|
|
212
|
+
[s, f, C]
|
|
213
|
+
), L = b ?? (l == null ? void 0 : l.liquidGlass), O = m ?? (l == null ? void 0 : l.frostedGlass), A = n ?? (l == null ? void 0 : l.gradientBlur);
|
|
211
214
|
if (I) {
|
|
212
|
-
const
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
|
|
215
|
+
const c = { ...l == null ? void 0 : l.fallbackStyle, ...e };
|
|
216
|
+
return /* @__PURE__ */ S(
|
|
217
|
+
B,
|
|
215
218
|
{
|
|
216
|
-
className:
|
|
217
|
-
style:
|
|
219
|
+
className: d,
|
|
220
|
+
style: c,
|
|
218
221
|
liquidGlass: L,
|
|
219
222
|
frostedGlass: O,
|
|
220
223
|
gradientBlur: A,
|
|
221
|
-
...
|
|
224
|
+
...u,
|
|
222
225
|
children: a
|
|
223
226
|
}
|
|
224
227
|
);
|
|
225
228
|
}
|
|
226
|
-
return H() ? K({ scene: s, dark: f, overlayColor:
|
|
229
|
+
return H() ? K({ scene: s, dark: f, overlayColor: t, cls: d, style: e, children: a, rest: u }) : Q({
|
|
227
230
|
scene: s,
|
|
228
231
|
dark: f,
|
|
229
|
-
targetId:
|
|
230
|
-
overlayColor:
|
|
231
|
-
cls:
|
|
232
|
+
targetId: i,
|
|
233
|
+
overlayColor: t,
|
|
234
|
+
cls: d,
|
|
232
235
|
style: e,
|
|
233
236
|
children: a,
|
|
234
|
-
rest:
|
|
237
|
+
rest: u
|
|
235
238
|
});
|
|
236
239
|
};
|
|
237
240
|
U.displayName = "NutJDMaterialView";
|
|
238
241
|
export {
|
|
239
242
|
U as J,
|
|
240
243
|
V as a,
|
|
241
|
-
|
|
242
|
-
|
|
244
|
+
j as b,
|
|
245
|
+
tr as g
|
|
243
246
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const R=require("react/jsx-runtime"),y=require("react"),P=require("classnames"),u=require("@tarojs/taro"),M=require("@tarojs/components"),j=require("@jdtaro/ui"),x=require("./typings-DP_XKs5o.js"),w=26;function q(t,r,e){const s=e>=w;switch(t){case"top-solid":return s?{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 s?{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:.85}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:.35}};case"immersive":return s?{liquidGlass:{style:"regular",forceDark:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.75)"}}:{frostedGlass:{style:"regular-dark",alpha:.4}};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 N(t,r){const e=r>=w;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}}const p="255, 255, 255",C="31, 34, 38";function F(t,r){switch(t){case"top-solid":return{blurRadius:40,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:40};case"top-bar":return{blurRadius:40,tintColor:r?`rgba(${C}, 0.9)`:`rgba(${p}, 0.9)`};case"promotion-fair":return{blurRadius:40,tintColor:`rgba(${p}, 0.85)`};case"promotion-deep":return{blurRadius:40,tintColor:`rgba(${p}, 0.2)`};case"immersive":return{blurRadius:40,tintColor:`rgba(${C}, 0.4)`};case"bottom-bar":return{blurRadius:50,tintColor:r?`rgba(${C}, 0.8)`:`rgba(${p}, 0.8)`};default:return{blurRadius:40}}}function V(t,r){const e=r?"dark":"light";switch(t){case"top-solid":return{blurScale:1,borderRadius:8,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:8,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:0,colorMode:e};case"promotion-fair":return{blurScale:.85,borderRadius:8,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:8,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:8,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:0,colorMode:e};default:return{blurScale:0,borderRadius:0,colorMode:e}}}const $={...x.ComponentDefaults};function B(){return["harmony","harmonyhybrid","jdharmony"].includes(u.getEnv().toLowerCase())}function _(){var t;try{const r=u.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),s=String((r==null?void 0:r.system)||""),a=e==="ios",b=a?parseInt(((t=s.match(/\d+/))==null?void 0:t[0])||"0",10):0,m=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,iosMajor:b,dark:m}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function E(){try{const t=u.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function H(t){const{scene:r,dark:e,overlayColor:s,cls:a,style:b,children:m,rest:g}=t,i=r?V(r,e):void 0,o={};i?(o.blurScale=i.blurScale,o.borderRadius=i.borderRadius,o.colorMode=i.colorMode):o.colorMode=e?"dark":"light";const c=s??(i==null?void 0:i.overlayColor);return c&&(o.overlayColor=c),R.jsx(M.View,{className:a,style:b,...o,...g,children:m})}function J(t){const{scene:r,dark:e,targetId:s,overlayColor:a,cls:b,style:m,children:g,rest:i}=t,o=r?F(r,e):void 0,c={...m};o&&o.blurRadius>0&&(c.backdropFilter=`blur(${o.blurRadius}px)`);const v=a??(o==null?void 0:o.tintColor),d={};return s&&(d.targetId=s),r&&(d.scene=r),v&&(d.overlayColor=v),R.jsx(M.View,{className:b,style:c,...d,...i,children:g})}const k=t=>{const{className:r,style:e,children:s,scene:a,targetId:b,liquidGlass:m,frostedGlass:g,gradientBlur:i,overlayColor:o,...c}={...$,...t},d=P("nut-jdmaterialview",r),{isIOS:I,iosMajor:G}=y.useMemo(()=>_(),[]),[f,L]=y.useState(()=>E()),S=y.useCallback(n=>{const h=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");L(h.toLowerCase()==="dark")},[]);y.useEffect(()=>{var n;try{(n=u.onThemeChange)==null||n.call(u,S)}catch{}return()=>{var h;try{(h=u.offThemeChange)==null||h.call(u,S)}catch{}}},[S]);const l=y.useMemo(()=>a?q(a,f,G):void 0,[a,f,G]),O=m??(l==null?void 0:l.liquidGlass),A=g??(l==null?void 0:l.frostedGlass),D=i??(l==null?void 0:l.gradientBlur);if(I){const n={...l==null?void 0:l.fallbackStyle,...e};return R.jsx(j.JDIOSMaterialView,{className:d,style:n,liquidGlass:O,frostedGlass:A,gradientBlur:D,...c,children:s})}return B()?H({scene:a,dark:f,overlayColor:o,cls:d,style:e,children:s,rest:c}):J({scene:a,dark:f,targetId:b,overlayColor:o,cls:d,style:e,children:s,rest:c})};k.displayName="NutJDMaterialView";exports.JDMaterialView=k;exports.getCornerRadius=N;exports.getFrostedPreset=F;exports.getPreset=q;
|