@nutui/taro-biz 0.0.1-alpha.4 → 0.0.1-alpha.5

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-Cd1WSYbL.js"),r=require("../jdmaterialsblurtarget.taro-B8SyDQOM.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-D-LTIRx9.js"),r=require("../jdmaterialsblurtarget.taro-B8SyDQOM.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-Cd1WSYbL.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-D-LTIRx9.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
@@ -0,0 +1 @@
1
+ "use strict";const S=require("react/jsx-runtime"),y=require("react"),D=require("classnames"),u=require("@tarojs/taro"),w=require("@tarojs/components"),N=require("@jdtaro/ui"),P=require("./typings-DP_XKs5o.js"),k=26;function I(e,r,a){const i=a>=k;switch(e){case"top-solid":return i?{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 i?{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 i?{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 $(e,r){const a=r>=k;switch(e){case"top-bar":case"bottom-bar":return 0;case"top-plain":return a?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return a?12:8;default:return 0}}const g="255, 255, 255",C="31, 34, 38";function V(e,r){switch(e){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(${g}, 0.9)`};case"promotion-fair":return{blurRadius:40,tintColor:`rgba(${g}, 0.85)`};case"promotion-deep":return{blurRadius:40,tintColor:`rgba(${g}, 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(${g}, 0.8)`};default:return{blurRadius:40}}}function J(e,r){switch(e){case"top-solid":return{blurScale:1,borderRadius:8,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:8};case"top-bar":return{blurScale:.9,borderRadius:0};case"promotion-fair":return{blurScale:.85,borderRadius:8};case"promotion-deep":return{blurScale:.2,borderRadius:8};case"immersive":return{blurScale:.4,borderRadius:8};case"bottom-bar":return{blurScale:.2,borderRadius:0};default:return{blurScale:0,borderRadius:0}}}const _={...P.ComponentDefaults};function E(){return["harmony","harmonyhybrid","jdharmony"].includes(u.getEnv().toLowerCase())}function H(e){return e.style.startsWith("thin")?10:e.style.startsWith("thick")?40:20}function T(e){const r={},a=e.maxBlur??0;return a>0&&(r.backdropFilter=`blur(${a*50}px)`),e.overlayAlpha&&e.overlayAlpha>0&&(r.backgroundColor=e.overlayColor||"rgba(255,255,255,1)",r.opacity=e.overlayAlpha),r}function W(){var e;try{const r=u.getSystemInfoSync(),a=String((r==null?void 0:r.platform)||"").toLowerCase(),i=String((r==null?void 0:r.system)||""),s=a==="ios",d=s?parseInt(((e=i.match(/\d+/))==null?void 0:e[0])||"0",10):0,m=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:s,iosMajor:d,dark:m}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function Y(){try{const e=u.getSystemInfoSync();return String((e==null?void 0:e.theme)||"").toLowerCase()==="dark"}catch{return!1}}const O=e=>{const{className:r,style:a,children:i,scene:s,targetId:d,liquidGlass:m,frostedGlass:A,gradientBlur:x,overlayColor:R,...h}={..._,...e},p=D("nut-jdmaterialview",r),{isIOS:L,iosMajor:G}=y.useMemo(()=>W(),[]),[f,M]=y.useState(()=>Y()),v=y.useCallback(t=>{M(String((t==null?void 0:t.theme)||"").toLowerCase()==="dark")},[]);y.useEffect(()=>{var t;try{(t=u.onThemeChange)==null||t.call(u,v)}catch{}return()=>{var l;try{(l=u.offThemeChange)==null||l.call(u,v)}catch{}}},[v]);const o=y.useMemo(()=>s?I(s,f,G):void 0,[s,f,G]),j=m??(o==null?void 0:o.liquidGlass),n=A??(o==null?void 0:o.frostedGlass),b=x??(o==null?void 0:o.gradientBlur);if(L){const t={...o==null?void 0:o.fallbackStyle,...a};return S.jsx(N.JDIOSMaterialView,{className:p,style:t,liquidGlass:j,frostedGlass:n,gradientBlur:b,...h,children:i})}if(E()){const t=s?J(s,f):void 0,l={};t&&(l.blurScale=t.blurScale,l.borderRadius=t.borderRadius),l.colorMode=f?"dark":"light";const q=R??(t==null?void 0:t.overlayColor);return q&&(l.overlayColor=q),d&&(l.targetId=d),s&&(l.scene=s),S.jsx(w.View,{className:p,style:a,...l,...h,children:i})}const B=(()=>{const t={...a};if(n){const l=H(n);t.backdropFilter=`blur(${l}px)`,n.alpha!==void 0&&(t.opacity=n.alpha)}else b&&Object.assign(t,T(b));return t})(),F=R??(n?n.style.endsWith("-dark")?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)":void 0),c={};return c.targetId=d,s&&(c.scene=s),n&&(c.frostedGlass=JSON.stringify(n)),b&&(c.gradientBlur=JSON.stringify(b)),F&&(c.overlayColor=F),S.jsx(w.View,{className:p,style:B,...c,...h,children:i})};O.displayName="NutJDMaterialView";exports.JDMaterialView=O;exports.getCornerRadius=$;exports.getFrostedPreset=V;exports.getPreset=I;
@@ -1,4 +1,4 @@
1
- import { J as e } from "../jdmaterialview.taro-drVYyPsV.mjs";
1
+ import { J as e } from "../jdmaterialview.taro-DEhWyIau.mjs";
2
2
  import { J as o } from "../jdmaterialsblurtarget.taro-D9cwbzQi.mjs";
3
3
  export {
4
4
  e as JDMaterialView,
@@ -1,5 +1,5 @@
1
- import { J as r } from "../jdmaterialview.taro-drVYyPsV.mjs";
2
- import { g as s, a as o, b as g } from "../jdmaterialview.taro-drVYyPsV.mjs";
1
+ import { J as r } from "../jdmaterialview.taro-DEhWyIau.mjs";
2
+ import { g as s, a as o, b as g } from "../jdmaterialview.taro-DEhWyIau.mjs";
3
3
  export {
4
4
  r as default,
5
5
  s as getCornerRadius,
@@ -0,0 +1,236 @@
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { useMemo as w, useState as D, useCallback as M, useEffect as $ } from "react";
3
+ import P from "classnames";
4
+ import y, { getEnv as j } from "@tarojs/taro";
5
+ import { View as I } from "@tarojs/components";
6
+ import { JDIOSMaterialView as T } from "@jdtaro/ui";
7
+ import { C as J } from "./typings-CdeuPEKG.mjs";
8
+ const O = 26;
9
+ function V(t, r, a) {
10
+ const i = a >= O;
11
+ switch (t) {
12
+ case "top-solid":
13
+ return i ? {
14
+ liquidGlass: {
15
+ style: "regular",
16
+ interactive: !0,
17
+ tintColor: r ? "rgba(0, 0, 0, 0.75)" : "rgba(255, 255, 255, 0.45)",
18
+ showTintOverlay: r
19
+ }
20
+ } : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
21
+ case "top-plain":
22
+ return i ? {
23
+ liquidGlass: {
24
+ style: "regular",
25
+ interactive: !0,
26
+ tintColor: r ? "rgba(0, 0, 0, 0.75)" : "rgba(255, 255, 255, 0.45)",
27
+ showTintOverlay: r
28
+ }
29
+ } : {};
30
+ case "top-bar":
31
+ return { frostedGlass: { style: r ? "thick-dark" : "thick-light" } };
32
+ case "promotion-fair":
33
+ return {
34
+ liquidGlass: { style: "clear", interactive: !1 },
35
+ frostedGlass: { style: "thick-light", alpha: 0.85 }
36
+ };
37
+ case "promotion-deep":
38
+ return {
39
+ liquidGlass: { style: "clear", interactive: !1 },
40
+ frostedGlass: { style: "thick-light", alpha: 0.35 }
41
+ };
42
+ case "immersive":
43
+ return i ? {
44
+ liquidGlass: {
45
+ style: "regular",
46
+ forceDark: !0,
47
+ interactive: !0,
48
+ tintColor: "rgba(0, 0, 0, 0.75)"
49
+ }
50
+ } : { frostedGlass: { style: "regular-dark", alpha: 0.4 } };
51
+ case "bottom-bar":
52
+ return {
53
+ gradientBlur: {
54
+ minBlur: 0.5,
55
+ maxBlur: 0.8,
56
+ overlayAlpha: 0.9,
57
+ overlayColor: r ? "rgba(0, 0, 0, 1)" : "rgba(255, 255, 255, 1)"
58
+ }
59
+ };
60
+ default:
61
+ return {};
62
+ }
63
+ }
64
+ function or(t, r) {
65
+ const a = r >= O;
66
+ switch (t) {
67
+ case "top-bar":
68
+ case "bottom-bar":
69
+ return 0;
70
+ case "top-plain":
71
+ return a ? 12 : 0;
72
+ case "top-solid":
73
+ case "promotion-fair":
74
+ case "promotion-deep":
75
+ case "immersive":
76
+ return a ? 12 : 8;
77
+ default:
78
+ return 0;
79
+ }
80
+ }
81
+ const f = "255, 255, 255", C = "31, 34, 38";
82
+ function lr(t, r) {
83
+ switch (t) {
84
+ case "top-solid":
85
+ return {
86
+ blurRadius: 40,
87
+ tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
88
+ };
89
+ case "top-plain":
90
+ return { blurRadius: 40 };
91
+ case "top-bar":
92
+ return {
93
+ blurRadius: 40,
94
+ tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${f}, 0.9)`
95
+ };
96
+ case "promotion-fair":
97
+ return { blurRadius: 40, tintColor: `rgba(${f}, 0.85)` };
98
+ case "promotion-deep":
99
+ return { blurRadius: 40, tintColor: `rgba(${f}, 0.2)` };
100
+ case "immersive":
101
+ return { blurRadius: 40, tintColor: `rgba(${C}, 0.4)` };
102
+ case "bottom-bar":
103
+ return {
104
+ blurRadius: 50,
105
+ tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${f}, 0.8)`
106
+ };
107
+ default:
108
+ return { blurRadius: 40 };
109
+ }
110
+ }
111
+ function _(t, r) {
112
+ switch (t) {
113
+ case "top-solid":
114
+ return { blurScale: 1, borderRadius: 8, overlayColor: r ? "#2A2F36" : "#FFFFFF" };
115
+ case "top-plain":
116
+ return { blurScale: 0, borderRadius: 8 };
117
+ case "top-bar":
118
+ return { blurScale: 0.9, borderRadius: 0 };
119
+ case "promotion-fair":
120
+ return { blurScale: 0.85, borderRadius: 8 };
121
+ case "promotion-deep":
122
+ return { blurScale: 0.2, borderRadius: 8 };
123
+ case "immersive":
124
+ return { blurScale: 0.4, borderRadius: 8 };
125
+ case "bottom-bar":
126
+ return { blurScale: 0.2, borderRadius: 0 };
127
+ default:
128
+ return { blurScale: 0, borderRadius: 0 };
129
+ }
130
+ }
131
+ const E = {
132
+ ...J
133
+ };
134
+ function H() {
135
+ return ["harmony", "harmonyhybrid", "jdharmony"].includes(
136
+ j().toLowerCase()
137
+ );
138
+ }
139
+ function W(t) {
140
+ return t.style.startsWith("thin") ? 10 : t.style.startsWith("thick") ? 40 : 20;
141
+ }
142
+ function Y(t) {
143
+ const r = {}, a = t.maxBlur ?? 0;
144
+ return a > 0 && (r.backdropFilter = `blur(${a * 50}px)`), t.overlayAlpha && t.overlayAlpha > 0 && (r.backgroundColor = t.overlayColor || "rgba(255,255,255,1)", r.opacity = t.overlayAlpha), r;
145
+ }
146
+ function K() {
147
+ var t;
148
+ try {
149
+ const r = y.getSystemInfoSync(), a = String((r == null ? void 0 : r.platform) || "").toLowerCase(), i = String((r == null ? void 0 : r.system) || ""), s = a === "ios", c = s ? parseInt(((t = i.match(/\d+/)) == null ? void 0 : t[0]) || "0", 10) : 0, g = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
150
+ return { isIOS: s, iosMajor: c, dark: g };
151
+ } catch {
152
+ return { isIOS: !1, iosMajor: 0, dark: !1 };
153
+ }
154
+ }
155
+ function Q() {
156
+ try {
157
+ const t = y.getSystemInfoSync();
158
+ return String((t == null ? void 0 : t.theme) || "").toLowerCase() === "dark";
159
+ } catch {
160
+ return !1;
161
+ }
162
+ }
163
+ const U = (t) => {
164
+ const {
165
+ className: r,
166
+ style: a,
167
+ children: i,
168
+ scene: s,
169
+ targetId: c,
170
+ liquidGlass: g,
171
+ frostedGlass: A,
172
+ gradientBlur: q,
173
+ overlayColor: G,
174
+ ...p
175
+ } = { ...E, ...t }, h = P("nut-jdmaterialview", r), { isIOS: L, iosMajor: R } = w(() => K(), []), [m, B] = D(() => Q()), v = M(
176
+ (e) => {
177
+ B(String((e == null ? void 0 : e.theme) || "").toLowerCase() === "dark");
178
+ },
179
+ []
180
+ );
181
+ $(() => {
182
+ var e, l;
183
+ try {
184
+ (l = (e = y).onThemeChange) == null || l.call(e, v);
185
+ } catch {
186
+ }
187
+ return () => {
188
+ var b, k;
189
+ try {
190
+ (k = (b = y).offThemeChange) == null || k.call(b, v);
191
+ } catch {
192
+ }
193
+ };
194
+ }, [v]);
195
+ const o = w(
196
+ () => s ? V(s, m, R) : void 0,
197
+ [s, m, R]
198
+ ), N = g ?? (o == null ? void 0 : o.liquidGlass), n = A ?? (o == null ? void 0 : o.frostedGlass), d = q ?? (o == null ? void 0 : o.gradientBlur);
199
+ if (L) {
200
+ const e = { ...o == null ? void 0 : o.fallbackStyle, ...a };
201
+ return /* @__PURE__ */ S(
202
+ T,
203
+ {
204
+ className: h,
205
+ style: e,
206
+ liquidGlass: N,
207
+ frostedGlass: n,
208
+ gradientBlur: d,
209
+ ...p,
210
+ children: i
211
+ }
212
+ );
213
+ }
214
+ if (H()) {
215
+ const e = s ? _(s, m) : void 0, l = {};
216
+ e && (l.blurScale = e.blurScale, l.borderRadius = e.borderRadius), l.colorMode = m ? "dark" : "light";
217
+ const b = G ?? (e == null ? void 0 : e.overlayColor);
218
+ return b && (l.overlayColor = b), c && (l.targetId = c), s && (l.scene = s), /* @__PURE__ */ S(I, { className: h, style: a, ...l, ...p, children: i });
219
+ }
220
+ const x = (() => {
221
+ const e = { ...a };
222
+ if (n) {
223
+ const l = W(n);
224
+ e.backdropFilter = `blur(${l}px)`, n.alpha !== void 0 && (e.opacity = n.alpha);
225
+ } else d && Object.assign(e, Y(d));
226
+ return e;
227
+ })(), F = G ?? (n ? n.style.endsWith("-dark") ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.3)" : void 0), u = {};
228
+ return u.targetId = c, s && (u.scene = s), n && (u.frostedGlass = JSON.stringify(n)), d && (u.gradientBlur = JSON.stringify(d)), F && (u.overlayColor = F), /* @__PURE__ */ S(I, { className: h, style: x, ...u, ...p, children: i });
229
+ };
230
+ U.displayName = "NutJDMaterialView";
231
+ export {
232
+ U as J,
233
+ lr as a,
234
+ V as b,
235
+ or as g
236
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/taro-biz",
3
- "version": "0.0.1-alpha.4",
3
+ "version": "0.0.1-alpha.5",
4
4
  "main": "dist/cjs/index/index.js",
5
5
  "module": "dist/es/index/index.js",
6
6
  "sideEffects": [
@@ -1 +0,0 @@
1
- "use strict";const p=require("react/jsx-runtime"),G=require("react"),B=require("classnames"),q=require("@tarojs/taro"),F=require("@tarojs/components"),N=require("@jdtaro/ui"),P=require("./typings-DP_XKs5o.js"),w=26;function I(e,r,t){const l=t>=w;switch(e){case"top-solid":return l?{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 l?{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 l?{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 L(e,r){const t=r>=w;switch(e){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}}const y="255, 255, 255",v="31, 34, 38";function $(e,r){switch(e){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(${v}, 0.9)`:`rgba(${y}, 0.9)`};case"promotion-fair":return{blurRadius:40,tintColor:`rgba(${y}, 0.85)`};case"promotion-deep":return{blurRadius:40,tintColor:`rgba(${y}, 0.2)`};case"immersive":return{blurRadius:40,tintColor:`rgba(${v}, 0.4)`};case"bottom-bar":return{blurRadius:50,tintColor:r?`rgba(${v}, 0.8)`:`rgba(${y}, 0.8)`};default:return{blurRadius:40}}}function D(e,r){switch(e){case"top-solid":return{blurScale:1,borderRadius:8,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:8};case"top-bar":return{blurScale:.9,borderRadius:0};case"promotion-fair":return{blurScale:.85,borderRadius:8};case"promotion-deep":return{blurScale:.2,borderRadius:8};case"immersive":return{blurScale:.4,borderRadius:8};case"bottom-bar":return{blurScale:.2,borderRadius:0};default:return{blurScale:0,borderRadius:0}}}const V={...P.ComponentDefaults};function J(){return["harmony","harmonyhybrid","jdharmony"].includes(q.getEnv().toLowerCase())}function _(e){return e.style.startsWith("thin")?10:e.style.startsWith("thick")?40:20}function T(e){const r={},t=e.maxBlur??0;return t>0&&(r.backdropFilter=`blur(${t*50}px)`),e.overlayAlpha&&e.overlayAlpha>0&&(r.backgroundColor=e.overlayColor||"rgba(255,255,255,1)",r.opacity=e.overlayAlpha),r}function E(){var e;try{const r=q.getSystemInfoSync(),t=String((r==null?void 0:r.platform)||"").toLowerCase(),l=String((r==null?void 0:r.system)||""),a=t==="ios",c=a?parseInt(((e=l.match(/\d+/))==null?void 0:e[0])||"0",10):0,f=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,iosMajor:c,dark:f}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}const O=e=>{const{className:r,style:t,children:l,scene:a,targetId:c,liquidGlass:f,frostedGlass:k,gradientBlur:A,overlayColor:h,...g}={...V,...e},m=B("nut-jdmaterialview",r),{isIOS:x,iosMajor:S,dark:b}=G.useMemo(()=>E(),[]),o=G.useMemo(()=>a?I(a,b,S):void 0,[a,b,S]),M=f??(o==null?void 0:o.liquidGlass),i=k??(o==null?void 0:o.frostedGlass),d=A??(o==null?void 0:o.gradientBlur);if(x){const s={...o==null?void 0:o.fallbackStyle,...t};return p.jsx(N.JDIOSMaterialView,{className:m,style:s,liquidGlass:M,frostedGlass:i,gradientBlur:d,...g,children:l})}if(J()){const s=a?D(a,b):void 0,n={};s&&(n.blurScale=s.blurScale,n.borderRadius=s.borderRadius),n.colorMode=b?"dark":"light";const R=h??(s==null?void 0:s.overlayColor);return R&&(n.overlayColor=R),c&&(n.targetId=c),a&&(n.scene=a),p.jsx(F.View,{className:m,style:t,...n,...g,children:l})}const j=(()=>{const s={...t};if(i){const n=_(i);s.backdropFilter=`blur(${n}px)`,i.alpha!==void 0&&(s.opacity=i.alpha)}else d&&Object.assign(s,T(d));return s})(),C=h??(i?i.style.endsWith("-dark")?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)":void 0),u={};return u.targetId=c,a&&(u.scene=a),i&&(u.frostedGlass=JSON.stringify(i)),d&&(u.gradientBlur=JSON.stringify(d)),C&&(u.overlayColor=C),p.jsx(F.View,{className:m,style:j,...u,...g,children:l})};O.displayName="NutJDMaterialView";exports.JDMaterialView=O;exports.getCornerRadius=L;exports.getFrostedPreset=$;exports.getPreset=I;
@@ -1,208 +0,0 @@
1
- import { jsx as g } from "react/jsx-runtime";
2
- import { useMemo as R } from "react";
3
- import B from "classnames";
4
- import N, { getEnv as x } from "@tarojs/taro";
5
- import { View as F } from "@tarojs/components";
6
- import { JDIOSMaterialView as L } from "@jdtaro/ui";
7
- import { C as M } from "./typings-CdeuPEKG.mjs";
8
- const I = 26;
9
- function $(t, r, e) {
10
- const l = e >= I;
11
- switch (t) {
12
- case "top-solid":
13
- return l ? {
14
- liquidGlass: {
15
- style: "regular",
16
- interactive: !0,
17
- tintColor: r ? "rgba(0, 0, 0, 0.75)" : "rgba(255, 255, 255, 0.45)",
18
- showTintOverlay: r
19
- }
20
- } : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
21
- case "top-plain":
22
- return l ? {
23
- liquidGlass: {
24
- style: "regular",
25
- interactive: !0,
26
- tintColor: r ? "rgba(0, 0, 0, 0.75)" : "rgba(255, 255, 255, 0.45)",
27
- showTintOverlay: r
28
- }
29
- } : {};
30
- case "top-bar":
31
- return { frostedGlass: { style: r ? "thick-dark" : "thick-light" } };
32
- case "promotion-fair":
33
- return {
34
- liquidGlass: { style: "clear", interactive: !1 },
35
- frostedGlass: { style: "thick-light", alpha: 0.85 }
36
- };
37
- case "promotion-deep":
38
- return {
39
- liquidGlass: { style: "clear", interactive: !1 },
40
- frostedGlass: { style: "thick-light", alpha: 0.35 }
41
- };
42
- case "immersive":
43
- return l ? {
44
- liquidGlass: {
45
- style: "regular",
46
- forceDark: !0,
47
- interactive: !0,
48
- tintColor: "rgba(0, 0, 0, 0.75)"
49
- }
50
- } : { frostedGlass: { style: "regular-dark", alpha: 0.4 } };
51
- case "bottom-bar":
52
- return {
53
- gradientBlur: {
54
- minBlur: 0.5,
55
- maxBlur: 0.8,
56
- overlayAlpha: 0.9,
57
- overlayColor: r ? "rgba(0, 0, 0, 1)" : "rgba(255, 255, 255, 1)"
58
- }
59
- };
60
- default:
61
- return {};
62
- }
63
- }
64
- function X(t, r) {
65
- const e = r >= I;
66
- switch (t) {
67
- case "top-bar":
68
- case "bottom-bar":
69
- return 0;
70
- case "top-plain":
71
- return e ? 12 : 0;
72
- case "top-solid":
73
- case "promotion-fair":
74
- case "promotion-deep":
75
- case "immersive":
76
- return e ? 12 : 8;
77
- default:
78
- return 0;
79
- }
80
- }
81
- const m = "255, 255, 255", v = "31, 34, 38";
82
- function Z(t, r) {
83
- switch (t) {
84
- case "top-solid":
85
- return {
86
- blurRadius: 40,
87
- tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
88
- };
89
- case "top-plain":
90
- return { blurRadius: 40 };
91
- case "top-bar":
92
- return {
93
- blurRadius: 40,
94
- tintColor: r ? `rgba(${v}, 0.9)` : `rgba(${m}, 0.9)`
95
- };
96
- case "promotion-fair":
97
- return { blurRadius: 40, tintColor: `rgba(${m}, 0.85)` };
98
- case "promotion-deep":
99
- return { blurRadius: 40, tintColor: `rgba(${m}, 0.2)` };
100
- case "immersive":
101
- return { blurRadius: 40, tintColor: `rgba(${v}, 0.4)` };
102
- case "bottom-bar":
103
- return {
104
- blurRadius: 50,
105
- tintColor: r ? `rgba(${v}, 0.8)` : `rgba(${m}, 0.8)`
106
- };
107
- default:
108
- return { blurRadius: 40 };
109
- }
110
- }
111
- function P(t, r) {
112
- switch (t) {
113
- case "top-solid":
114
- return { blurScale: 1, borderRadius: 8, overlayColor: r ? "#2A2F36" : "#FFFFFF" };
115
- case "top-plain":
116
- return { blurScale: 0, borderRadius: 8 };
117
- case "top-bar":
118
- return { blurScale: 0.9, borderRadius: 0 };
119
- case "promotion-fair":
120
- return { blurScale: 0.85, borderRadius: 8 };
121
- case "promotion-deep":
122
- return { blurScale: 0.2, borderRadius: 8 };
123
- case "immersive":
124
- return { blurScale: 0.4, borderRadius: 8 };
125
- case "bottom-bar":
126
- return { blurScale: 0.2, borderRadius: 0 };
127
- default:
128
- return { blurScale: 0, borderRadius: 0 };
129
- }
130
- }
131
- const j = {
132
- ...M
133
- };
134
- function D() {
135
- return ["harmony", "harmonyhybrid", "jdharmony"].includes(
136
- x().toLowerCase()
137
- );
138
- }
139
- function J(t) {
140
- return t.style.startsWith("thin") ? 10 : t.style.startsWith("thick") ? 40 : 20;
141
- }
142
- function V(t) {
143
- const r = {}, e = t.maxBlur ?? 0;
144
- return e > 0 && (r.backdropFilter = `blur(${e * 50}px)`), t.overlayAlpha && t.overlayAlpha > 0 && (r.backgroundColor = t.overlayColor || "rgba(255,255,255,1)", r.opacity = t.overlayAlpha), r;
145
- }
146
- function _() {
147
- var t;
148
- try {
149
- const r = N.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), l = String((r == null ? void 0 : r.system) || ""), s = e === "ios", c = s ? parseInt(((t = l.match(/\d+/)) == null ? void 0 : t[0]) || "0", 10) : 0, f = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
150
- return { isIOS: s, iosMajor: c, dark: f };
151
- } catch {
152
- return { isIOS: !1, iosMajor: 0, dark: !1 };
153
- }
154
- }
155
- const T = (t) => {
156
- const {
157
- className: r,
158
- style: e,
159
- children: l,
160
- scene: s,
161
- targetId: c,
162
- liquidGlass: f,
163
- frostedGlass: w,
164
- gradientBlur: O,
165
- overlayColor: h,
166
- ...y
167
- } = { ...j, ...t }, p = B("nut-jdmaterialview", r), { isIOS: k, iosMajor: S, dark: b } = R(() => _(), []), o = R(
168
- () => s ? $(s, b, S) : void 0,
169
- [s, b, S]
170
- ), A = f ?? (o == null ? void 0 : o.liquidGlass), i = w ?? (o == null ? void 0 : o.frostedGlass), d = O ?? (o == null ? void 0 : o.gradientBlur);
171
- if (k) {
172
- const a = { ...o == null ? void 0 : o.fallbackStyle, ...e };
173
- return /* @__PURE__ */ g(
174
- L,
175
- {
176
- className: p,
177
- style: a,
178
- liquidGlass: A,
179
- frostedGlass: i,
180
- gradientBlur: d,
181
- ...y,
182
- children: l
183
- }
184
- );
185
- }
186
- if (D()) {
187
- const a = s ? P(s, b) : void 0, n = {};
188
- a && (n.blurScale = a.blurScale, n.borderRadius = a.borderRadius), n.colorMode = b ? "dark" : "light";
189
- const G = h ?? (a == null ? void 0 : a.overlayColor);
190
- return G && (n.overlayColor = G), c && (n.targetId = c), s && (n.scene = s), /* @__PURE__ */ g(F, { className: p, style: e, ...n, ...y, children: l });
191
- }
192
- const q = (() => {
193
- const a = { ...e };
194
- if (i) {
195
- const n = J(i);
196
- a.backdropFilter = `blur(${n}px)`, i.alpha !== void 0 && (a.opacity = i.alpha);
197
- } else d && Object.assign(a, V(d));
198
- return a;
199
- })(), C = h ?? (i ? i.style.endsWith("-dark") ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.3)" : void 0), u = {};
200
- return u.targetId = c, s && (u.scene = s), i && (u.frostedGlass = JSON.stringify(i)), d && (u.gradientBlur = JSON.stringify(d)), C && (u.overlayColor = C), /* @__PURE__ */ g(F, { className: p, style: q, ...u, ...y, children: l });
201
- };
202
- T.displayName = "NutJDMaterialView";
203
- export {
204
- T as J,
205
- Z as a,
206
- $ as b,
207
- X as g
208
- };