@nutui/taro-biz 0.0.1-alpha.13 → 0.0.1-alpha.14

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-BDLjvCA9.js"),r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-CF5tEG5Z.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-BDLjvCA9.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-CF5tEG5Z.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
@@ -0,0 +1 @@
1
+ "use strict";const G=require("react/jsx-runtime"),y=require("react"),P=require("classnames"),d=require("@tarojs/taro"),M=require("@tarojs/components"),j=require("@jdtaro/ui"),B=require("./typings-DP_XKs5o.js"),k=26;function w(t,r,e){const o=e>=k;switch(t){case"top-solid":return o?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return o?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{};case"top-bar":return{frostedGlass:{style:r?"thick-dark":"thick-light"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:1}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"ultra-thin-light",alpha:1}};case"immersive":return o?{liquidGlass:{style:"regular",forceDark:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.75)"}}:{frostedGlass:{style:"regular-dark",alpha:1}};case"bottom-bar":return{gradientBlur:{minBlur:.5,maxBlur:.8,overlayAlpha:.9,overlayColor:r?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)"}};default:return{}}}function F(t,r){const e=r>=k;switch(t){case"top-bar":case"bottom-bar":return 0;case"top-plain":return e?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return e?12:8;default:return 0}}function q(t){switch(t){case"top-bar":case"bottom-bar":return 0;case"top-solid":case"top-plain":case"promotion-fair":case"promotion-deep":case"immersive":return 8;default:return 0}}const v="255, 255, 255",R="31, 34, 38";function I(t,r){const e=q(t);switch(t){case"top-solid":return{blurRadius:40,borderRadius:e,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:e};case"top-bar":return{blurRadius:40,borderRadius:e,tintColor:r?`rgba(${R}, 0.9)`:`rgba(${v}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${v}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${v}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${R}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:e,tintColor:r?`rgba(${R}, 0.8)`:`rgba(${v}, 0.8)`};default:return{blurRadius:40,borderRadius:e}}}function N(t){const r=t?"0, 0, 0":"255, 255, 255";return`linear-gradient(to bottom, rgba(${r}, 0.8) 0%, rgba(${r}, 0.8) 56%, rgba(${r}, 0.78) 66%, rgba(${r}, 0.72) 76%, rgba(${r}, 0.62) 86%, rgba(${r}, 0.49) 94%, rgba(${r}, 0.3) 100%)`}function V(t,r){const e=r?"dark":"light",o=q(t);switch(t){case"top-solid":return{blurScale:1,borderRadius:o,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:o,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:o,colorMode:e,overlayColor:r?"rgba(0, 0, 0, 0.8)":"rgba(255, 255, 255, 0.8)"};case"promotion-fair":return{blurScale:.85,borderRadius:o,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:o,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:o,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:o,colorMode:e,backgroundGradient:N(r)};default:return{blurScale:0,borderRadius:o,colorMode:e}}}const _={...B.ComponentDefaults};function E(){return["harmony","harmonyhybrid","jdharmony"].includes(d.getEnv().toLowerCase())}function H(){var t;try{const r=d.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),o=String((r==null?void 0:r.system)||""),l=e==="ios",u=l?parseInt(((t=o.match(/\d+/))==null?void 0:t[0])||"0",10):0,g=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:l,iosMajor:u,dark:g}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function J(){try{const t=d.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function T(t){const{scene:r,dark:e,overlayColor:o,cls:l,style:u,children:g,rest:f}=t,s=r?V(r,e):void 0,a={};s?(a.blurScale=s.blurScale,a.borderRadius=s.borderRadius,a.colorMode=s.colorMode):a.colorMode=e?"dark":"light",(u==null?void 0:u.borderRadius)!==void 0&&(a.borderRadius=parseFloat(String(u.borderRadius)));const i={...u},m=o??(s==null?void 0:s.overlayColor);return m&&i.backgroundColor===void 0&&(i.backgroundColor=m),s!=null&&s.backgroundGradient&&i.background===void 0&&(i.background=s.backgroundGradient),G.jsx(M.View,{className:l,style:i,...a,...f,children:g})}function Y(t){const{scene:r,dark:e,targetId:o,overlayColor:l,cls:u,style:g,children:f,rest:s}=t,a=r?I(r,e):void 0,i={...g};a&&a.blurRadius>0&&(i.backdropFilter=`blur(${a.blurRadius}px)`),a&&i.borderRadius===void 0&&(i.borderRadius=`${a.borderRadius}px`);const m=l??(a==null?void 0:a.tintColor),b={};return o&&(b.targetId=o),r&&(b.scene=r),m&&(b.overlayColor=m),G.jsx(M.View,{className:u,style:i,...b,...s,children:f})}const $=t=>{const{className:r,style:e,children:o,scene:l,targetId:u,liquidGlass:g,frostedGlass:f,gradientBlur:s,overlayColor:a,...i}={..._,...t},b=P("nut-jdmaterialview",r),{isIOS:O,iosMajor:S}=y.useMemo(()=>H(),[]),[h,L]=y.useState(()=>J()),C=y.useCallback(c=>{const p=typeof c=="string"?c:String((c==null?void 0:c.theme)||"");L(p.toLowerCase()==="dark")},[]);y.useEffect(()=>{var c;try{(c=d.onThemeChange)==null||c.call(d,C)}catch{}return()=>{var p;try{(p=d.offThemeChange)==null||p.call(d,C)}catch{}}},[C]);const n=y.useMemo(()=>l?w(l,h,S):void 0,[l,h,S]),x=g??(n==null?void 0:n.liquidGlass),A=f??(n==null?void 0:n.frostedGlass),D=s??(n==null?void 0:n.gradientBlur);if(O){const c={...n==null?void 0:n.fallbackStyle,...e};return l&&c.borderRadius===void 0&&(c.borderRadius=`${F(l,S)}px`),G.jsx(j.JDIOSMaterialView,{className:b,style:c,liquidGlass:x,frostedGlass:A,gradientBlur:D,...i,children:o})}return E()?T({scene:l,dark:h,overlayColor:a,cls:b,style:e,children:o,rest:i}):Y({scene:l,dark:h,targetId:u,overlayColor:a,cls:b,style:e,children:o,rest:i})};$.displayName="NutJDMaterialView";exports.JDMaterialView=$;exports.getCornerRadius=F;exports.getFrostedPreset=I;exports.getPreset=w;
@@ -1,4 +1,4 @@
1
- import { J as e } from "../jdmaterialview.taro-RzMZXnR2.mjs";
1
+ import { J as e } from "../jdmaterialview.taro-Be0_ro5-.mjs";
2
2
  import { J as o } from "../jdmaterialsblurtarget.taro-DCTEjmIC.mjs";
3
3
  export {
4
4
  e as JDMaterialView,
@@ -1,5 +1,5 @@
1
- import { J as r } from "../jdmaterialview.taro-RzMZXnR2.mjs";
2
- import { g as s, a as o, b as g } from "../jdmaterialview.taro-RzMZXnR2.mjs";
1
+ import { J as r } from "../jdmaterialview.taro-Be0_ro5-.mjs";
2
+ import { g as s, a as o, b as g } from "../jdmaterialview.taro-Be0_ro5-.mjs";
3
3
  export {
4
4
  r as default,
5
5
  s as getCornerRadius,
@@ -0,0 +1,276 @@
1
+ import { jsx as R } from "react/jsx-runtime";
2
+ import { useMemo as M, useState as B, useCallback as D, useEffect as N } from "react";
3
+ import x from "classnames";
4
+ import h, { getEnv as P } from "@tarojs/taro";
5
+ import { View as w } from "@tarojs/components";
6
+ import { JDIOSMaterialView as T } from "@jdtaro/ui";
7
+ import { C as j } from "./typings-CdeuPEKG.mjs";
8
+ const F = 26;
9
+ function V(o, r, e) {
10
+ const t = e >= F;
11
+ switch (o) {
12
+ case "top-solid":
13
+ return t ? {
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 t ? {
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: 1 }
36
+ };
37
+ case "promotion-deep":
38
+ return {
39
+ liquidGlass: { style: "clear", interactive: !1 },
40
+ frostedGlass: { style: "ultra-thin-light", alpha: 1 }
41
+ };
42
+ case "immersive":
43
+ return t ? {
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: 1 } };
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 _(o, r) {
65
+ const e = r >= F;
66
+ switch (o) {
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
+ function I(o) {
82
+ switch (o) {
83
+ case "top-bar":
84
+ case "bottom-bar":
85
+ return 0;
86
+ case "top-solid":
87
+ case "top-plain":
88
+ case "promotion-fair":
89
+ case "promotion-deep":
90
+ case "immersive":
91
+ return 8;
92
+ default:
93
+ return 0;
94
+ }
95
+ }
96
+ const p = "255, 255, 255", C = "31, 34, 38";
97
+ function E(o, r) {
98
+ const e = I(o);
99
+ switch (o) {
100
+ case "top-solid":
101
+ return {
102
+ blurRadius: 40,
103
+ borderRadius: e,
104
+ tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
105
+ };
106
+ case "top-plain":
107
+ return { blurRadius: 0, borderRadius: e };
108
+ case "top-bar":
109
+ return {
110
+ blurRadius: 40,
111
+ borderRadius: e,
112
+ tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${p}, 0.9)`
113
+ };
114
+ case "promotion-fair":
115
+ return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${p}, 0.85)` };
116
+ case "promotion-deep":
117
+ return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${p}, 0.2)` };
118
+ case "immersive":
119
+ return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${C}, 0.4)` };
120
+ case "bottom-bar":
121
+ return {
122
+ blurRadius: 50,
123
+ borderRadius: e,
124
+ tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${p}, 0.8)`
125
+ };
126
+ default:
127
+ return { blurRadius: 40, borderRadius: e };
128
+ }
129
+ }
130
+ function H(o) {
131
+ const r = o ? "0, 0, 0" : "255, 255, 255";
132
+ 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%)`;
133
+ }
134
+ function J(o, r) {
135
+ const e = r ? "dark" : "light", t = I(o);
136
+ switch (o) {
137
+ case "top-solid":
138
+ return {
139
+ blurScale: 1,
140
+ borderRadius: t,
141
+ colorMode: e,
142
+ overlayColor: r ? "#2A2F36" : "#FFFFFF"
143
+ };
144
+ case "top-plain":
145
+ return { blurScale: 0, borderRadius: t, colorMode: e };
146
+ case "top-bar":
147
+ return {
148
+ blurScale: 0.9,
149
+ borderRadius: t,
150
+ colorMode: e,
151
+ overlayColor: r ? "rgba(0, 0, 0, 0.8)" : "rgba(255, 255, 255, 0.8)"
152
+ };
153
+ case "promotion-fair":
154
+ return { blurScale: 0.85, borderRadius: t, colorMode: "light" };
155
+ case "promotion-deep":
156
+ return { blurScale: 0.2, borderRadius: t, colorMode: "light" };
157
+ case "immersive":
158
+ return { blurScale: 0.4, borderRadius: t, colorMode: "dark" };
159
+ case "bottom-bar":
160
+ return {
161
+ blurScale: 0.2,
162
+ borderRadius: t,
163
+ colorMode: e,
164
+ backgroundGradient: H(r)
165
+ };
166
+ default:
167
+ return { blurScale: 0, borderRadius: t, colorMode: e };
168
+ }
169
+ }
170
+ const Y = {
171
+ ...j
172
+ };
173
+ function K() {
174
+ return ["harmony", "harmonyhybrid", "jdharmony"].includes(
175
+ P().toLowerCase()
176
+ );
177
+ }
178
+ function Q() {
179
+ var o;
180
+ try {
181
+ const r = h.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), t = String((r == null ? void 0 : r.system) || ""), l = e === "ios", u = l ? parseInt(((o = t.match(/\d+/)) == null ? void 0 : o[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
182
+ return { isIOS: l, iosMajor: u, dark: b };
183
+ } catch {
184
+ return { isIOS: !1, iosMajor: 0, dark: !1 };
185
+ }
186
+ }
187
+ function U() {
188
+ try {
189
+ const o = h.getSystemInfoSync();
190
+ return String((o == null ? void 0 : o.theme) || "").toLowerCase() === "dark";
191
+ } catch {
192
+ return !1;
193
+ }
194
+ }
195
+ function z(o) {
196
+ const { scene: r, dark: e, overlayColor: t, cls: l, style: u, children: b, rest: g } = o, s = r ? J(r, e) : void 0, a = {};
197
+ s ? (a.blurScale = s.blurScale, a.borderRadius = s.borderRadius, a.colorMode = s.colorMode) : a.colorMode = e ? "dark" : "light", (u == null ? void 0 : u.borderRadius) !== void 0 && (a.borderRadius = parseFloat(String(u.borderRadius)));
198
+ const i = { ...u }, m = t ?? (s == null ? void 0 : s.overlayColor);
199
+ return m && i.backgroundColor === void 0 && (i.backgroundColor = m), s != null && s.backgroundGradient && i.background === void 0 && (i.background = s.backgroundGradient), /* @__PURE__ */ R(w, { className: l, style: i, ...a, ...g, children: b });
200
+ }
201
+ function W(o) {
202
+ const { scene: r, dark: e, targetId: t, overlayColor: l, cls: u, style: b, children: g, rest: s } = o, a = r ? E(r, e) : void 0, i = { ...b };
203
+ a && a.blurRadius > 0 && (i.backdropFilter = `blur(${a.blurRadius}px)`), a && i.borderRadius === void 0 && (i.borderRadius = `${a.borderRadius}px`);
204
+ const m = l ?? (a == null ? void 0 : a.tintColor), d = {};
205
+ return t && (d.targetId = t), r && (d.scene = r), m && (d.overlayColor = m), /* @__PURE__ */ R(w, { className: u, style: i, ...d, ...s, children: g });
206
+ }
207
+ const X = (o) => {
208
+ const {
209
+ className: r,
210
+ style: e,
211
+ children: t,
212
+ scene: l,
213
+ targetId: u,
214
+ liquidGlass: b,
215
+ frostedGlass: g,
216
+ gradientBlur: s,
217
+ overlayColor: a,
218
+ ...i
219
+ } = { ...Y, ...o }, d = x("nut-jdmaterialview", r), { isIOS: $, iosMajor: v } = M(() => Q(), []), [f, O] = B(() => U()), S = D(
220
+ (c) => {
221
+ const y = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
222
+ O(y.toLowerCase() === "dark");
223
+ },
224
+ []
225
+ );
226
+ N(() => {
227
+ var c, y;
228
+ try {
229
+ (y = (c = h).onThemeChange) == null || y.call(c, S);
230
+ } catch {
231
+ }
232
+ return () => {
233
+ var G, k;
234
+ try {
235
+ (k = (G = h).offThemeChange) == null || k.call(G, S);
236
+ } catch {
237
+ }
238
+ };
239
+ }, [S]);
240
+ const n = M(
241
+ () => l ? V(l, f, v) : void 0,
242
+ [l, f, v]
243
+ ), q = b ?? (n == null ? void 0 : n.liquidGlass), L = g ?? (n == null ? void 0 : n.frostedGlass), A = s ?? (n == null ? void 0 : n.gradientBlur);
244
+ if ($) {
245
+ const c = { ...n == null ? void 0 : n.fallbackStyle, ...e };
246
+ return l && c.borderRadius === void 0 && (c.borderRadius = `${_(l, v)}px`), /* @__PURE__ */ R(
247
+ T,
248
+ {
249
+ className: d,
250
+ style: c,
251
+ liquidGlass: q,
252
+ frostedGlass: L,
253
+ gradientBlur: A,
254
+ ...i,
255
+ children: t
256
+ }
257
+ );
258
+ }
259
+ return K() ? z({ scene: l, dark: f, overlayColor: a, cls: d, style: e, children: t, rest: i }) : W({
260
+ scene: l,
261
+ dark: f,
262
+ targetId: u,
263
+ overlayColor: a,
264
+ cls: d,
265
+ style: e,
266
+ children: t,
267
+ rest: i
268
+ });
269
+ };
270
+ X.displayName = "NutJDMaterialView";
271
+ export {
272
+ X as J,
273
+ E as a,
274
+ V as b,
275
+ _ as g
276
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/taro-biz",
3
- "version": "0.0.1-alpha.13",
3
+ "version": "0.0.1-alpha.14",
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 G=require("react/jsx-runtime"),y=require("react"),$=require("classnames"),d=require("@tarojs/taro"),M=require("@tarojs/components"),j=require("@jdtaro/ui"),N=require("./typings-DP_XKs5o.js"),w=26;function F(t,r,e){const o=e>=w;switch(t){case"top-solid":return o?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return o?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{};case"top-bar":return{frostedGlass:{style:r?"thick-dark":"thick-light"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:1}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"ultra-thin-light",alpha:1}};case"immersive":return o?{liquidGlass:{style:"regular",forceDark:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.75)"}}:{frostedGlass:{style:"regular-dark",alpha:1}};case"bottom-bar":return{gradientBlur:{minBlur:.5,maxBlur:.8,overlayAlpha:.9,overlayColor:r?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)"}};default:return{}}}function q(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}}function k(t){switch(t){case"top-bar":case"bottom-bar":return 0;case"top-solid":case"top-plain":case"promotion-fair":case"promotion-deep":case"immersive":return 8;default:return 0}}const v="255, 255, 255",R="31, 34, 38";function I(t,r){const e=k(t);switch(t){case"top-solid":return{blurRadius:40,borderRadius:e,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:e};case"top-bar":return{blurRadius:40,borderRadius:e,tintColor:r?`rgba(${R}, 0.9)`:`rgba(${v}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${v}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${v}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${R}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:e,tintColor:r?`rgba(${R}, 0.8)`:`rgba(${v}, 0.8)`};default:return{blurRadius:40,borderRadius:e}}}function V(t,r){const e=r?"dark":"light",o=k(t);switch(t){case"top-solid":return{blurScale:1,borderRadius:o,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:o,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:o,colorMode:e};case"promotion-fair":return{blurScale:.85,borderRadius:o,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:o,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:o,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:o,colorMode:e};default:return{blurScale:0,borderRadius:o,colorMode:e}}}const B={...N.ComponentDefaults};function _(){return["harmony","harmonyhybrid","jdharmony"].includes(d.getEnv().toLowerCase())}function E(){var t;try{const r=d.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),o=String((r==null?void 0:r.system)||""),a=e==="ios",c=a?parseInt(((t=o.match(/\d+/))==null?void 0:t[0])||"0",10):0,m=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,iosMajor:c,dark:m}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function H(){try{const t=d.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function J(t){const{scene:r,dark:e,overlayColor:o,cls:a,style:c,children:m,rest:f}=t,u=r?V(r,e):void 0,s={};u?(s.blurScale=u.blurScale,s.borderRadius=u.borderRadius,s.colorMode=u.colorMode):s.colorMode=e?"dark":"light",(c==null?void 0:c.borderRadius)!==void 0&&(s.borderRadius=parseFloat(String(c.borderRadius)));const l={...c},g=o??(u==null?void 0:u.overlayColor);return g&&l.backgroundColor===void 0&&(l.backgroundColor=g),G.jsx(M.View,{className:a,style:l,...s,...f,children:m})}function T(t){const{scene:r,dark:e,targetId:o,overlayColor:a,cls:c,style:m,children:f,rest:u}=t,s=r?I(r,e):void 0,l={...m};s&&s.blurRadius>0&&(l.backdropFilter=`blur(${s.blurRadius}px)`),s&&l.borderRadius===void 0&&(l.borderRadius=`${s.borderRadius}px`);const g=a??(s==null?void 0:s.tintColor),b={};return o&&(b.targetId=o),r&&(b.scene=r),g&&(b.overlayColor=g),G.jsx(M.View,{className:c,style:l,...b,...u,children:f})}const O=t=>{const{className:r,style:e,children:o,scene:a,targetId:c,liquidGlass:m,frostedGlass:f,gradientBlur:u,overlayColor:s,...l}={...B,...t},b=$("nut-jdmaterialview",r),{isIOS:L,iosMajor:S}=y.useMemo(()=>E(),[]),[p,x]=y.useState(()=>H()),C=y.useCallback(n=>{const h=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");x(h.toLowerCase()==="dark")},[]);y.useEffect(()=>{var n;try{(n=d.onThemeChange)==null||n.call(d,C)}catch{}return()=>{var h;try{(h=d.offThemeChange)==null||h.call(d,C)}catch{}}},[C]);const i=y.useMemo(()=>a?F(a,p,S):void 0,[a,p,S]),A=m??(i==null?void 0:i.liquidGlass),D=f??(i==null?void 0:i.frostedGlass),P=u??(i==null?void 0:i.gradientBlur);if(L){const n={...i==null?void 0:i.fallbackStyle,...e};return a&&n.borderRadius===void 0&&(n.borderRadius=`${q(a,S)}px`),G.jsx(j.JDIOSMaterialView,{className:b,style:n,liquidGlass:A,frostedGlass:D,gradientBlur:P,...l,children:o})}return _()?J({scene:a,dark:p,overlayColor:s,cls:b,style:e,children:o,rest:l}):T({scene:a,dark:p,targetId:c,overlayColor:s,cls:b,style:e,children:o,rest:l})};O.displayName="NutJDMaterialView";exports.JDMaterialView=O;exports.getCornerRadius=q;exports.getFrostedPreset=I;exports.getPreset=F;
@@ -1,262 +0,0 @@
1
- import { jsx as R } from "react/jsx-runtime";
2
- import { useMemo as w, useState as D, useCallback as N, useEffect as x } from "react";
3
- import P from "classnames";
4
- import h, { getEnv as B } from "@tarojs/taro";
5
- import { View as F } from "@tarojs/components";
6
- import { JDIOSMaterialView as T } from "@jdtaro/ui";
7
- import { C as j } from "./typings-CdeuPEKG.mjs";
8
- const k = 26;
9
- function V(t, r, e) {
10
- const o = e >= k;
11
- switch (t) {
12
- case "top-solid":
13
- return o ? {
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 o ? {
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: 1 }
36
- };
37
- case "promotion-deep":
38
- return {
39
- liquidGlass: { style: "clear", interactive: !1 },
40
- frostedGlass: { style: "ultra-thin-light", alpha: 1 }
41
- };
42
- case "immersive":
43
- return o ? {
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: 1 } };
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 _(t, r) {
65
- const e = r >= k;
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
- function I(t) {
82
- switch (t) {
83
- case "top-bar":
84
- case "bottom-bar":
85
- return 0;
86
- case "top-solid":
87
- case "top-plain":
88
- case "promotion-fair":
89
- case "promotion-deep":
90
- case "immersive":
91
- return 8;
92
- default:
93
- return 0;
94
- }
95
- }
96
- const y = "255, 255, 255", C = "31, 34, 38";
97
- function E(t, r) {
98
- const e = I(t);
99
- switch (t) {
100
- case "top-solid":
101
- return {
102
- blurRadius: 40,
103
- borderRadius: e,
104
- tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
105
- };
106
- case "top-plain":
107
- return { blurRadius: 0, borderRadius: e };
108
- case "top-bar":
109
- return {
110
- blurRadius: 40,
111
- borderRadius: e,
112
- tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${y}, 0.9)`
113
- };
114
- case "promotion-fair":
115
- return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${y}, 0.85)` };
116
- case "promotion-deep":
117
- return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${y}, 0.2)` };
118
- case "immersive":
119
- return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${C}, 0.4)` };
120
- case "bottom-bar":
121
- return {
122
- blurRadius: 50,
123
- borderRadius: e,
124
- tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${y}, 0.8)`
125
- };
126
- default:
127
- return { blurRadius: 40, borderRadius: e };
128
- }
129
- }
130
- function H(t, r) {
131
- const e = r ? "dark" : "light", o = I(t);
132
- switch (t) {
133
- case "top-solid":
134
- return {
135
- blurScale: 1,
136
- borderRadius: o,
137
- colorMode: e,
138
- overlayColor: r ? "#2A2F36" : "#FFFFFF"
139
- };
140
- case "top-plain":
141
- return { blurScale: 0, borderRadius: o, colorMode: e };
142
- case "top-bar":
143
- return { blurScale: 0.9, borderRadius: o, colorMode: e };
144
- case "promotion-fair":
145
- return { blurScale: 0.85, borderRadius: o, colorMode: "light" };
146
- case "promotion-deep":
147
- return { blurScale: 0.2, borderRadius: o, colorMode: "light" };
148
- case "immersive":
149
- return { blurScale: 0.4, borderRadius: o, colorMode: "dark" };
150
- case "bottom-bar":
151
- return { blurScale: 0.2, borderRadius: o, colorMode: e };
152
- default:
153
- return { blurScale: 0, borderRadius: o, colorMode: e };
154
- }
155
- }
156
- const J = {
157
- ...j
158
- };
159
- function Y() {
160
- return ["harmony", "harmonyhybrid", "jdharmony"].includes(
161
- B().toLowerCase()
162
- );
163
- }
164
- function K() {
165
- var t;
166
- try {
167
- const r = h.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), o = String((r == null ? void 0 : r.system) || ""), s = e === "ios", c = s ? parseInt(((t = o.match(/\d+/)) == null ? void 0 : t[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
168
- return { isIOS: s, iosMajor: c, dark: b };
169
- } catch {
170
- return { isIOS: !1, iosMajor: 0, dark: !1 };
171
- }
172
- }
173
- function Q() {
174
- try {
175
- const t = h.getSystemInfoSync();
176
- return String((t == null ? void 0 : t.theme) || "").toLowerCase() === "dark";
177
- } catch {
178
- return !1;
179
- }
180
- }
181
- function U(t) {
182
- const { scene: r, dark: e, overlayColor: o, cls: s, style: c, children: b, rest: f } = t, u = r ? H(r, e) : void 0, a = {};
183
- u ? (a.blurScale = u.blurScale, a.borderRadius = u.borderRadius, a.colorMode = u.colorMode) : a.colorMode = e ? "dark" : "light", (c == null ? void 0 : c.borderRadius) !== void 0 && (a.borderRadius = parseFloat(String(c.borderRadius)));
184
- const l = { ...c }, m = o ?? (u == null ? void 0 : u.overlayColor);
185
- return m && l.backgroundColor === void 0 && (l.backgroundColor = m), /* @__PURE__ */ R(F, { className: s, style: l, ...a, ...f, children: b });
186
- }
187
- function z(t) {
188
- const { scene: r, dark: e, targetId: o, overlayColor: s, cls: c, style: b, children: f, rest: u } = t, a = r ? E(r, e) : void 0, l = { ...b };
189
- a && a.blurRadius > 0 && (l.backdropFilter = `blur(${a.blurRadius}px)`), a && l.borderRadius === void 0 && (l.borderRadius = `${a.borderRadius}px`);
190
- const m = s ?? (a == null ? void 0 : a.tintColor), d = {};
191
- return o && (d.targetId = o), r && (d.scene = r), m && (d.overlayColor = m), /* @__PURE__ */ R(F, { className: c, style: l, ...d, ...u, children: f });
192
- }
193
- const W = (t) => {
194
- const {
195
- className: r,
196
- style: e,
197
- children: o,
198
- scene: s,
199
- targetId: c,
200
- liquidGlass: b,
201
- frostedGlass: f,
202
- gradientBlur: u,
203
- overlayColor: a,
204
- ...l
205
- } = { ...J, ...t }, d = P("nut-jdmaterialview", r), { isIOS: O, iosMajor: v } = w(() => K(), []), [g, q] = D(() => Q()), S = N(
206
- (n) => {
207
- const p = typeof n == "string" ? n : String((n == null ? void 0 : n.theme) || "");
208
- q(p.toLowerCase() === "dark");
209
- },
210
- []
211
- );
212
- x(() => {
213
- var n, p;
214
- try {
215
- (p = (n = h).onThemeChange) == null || p.call(n, S);
216
- } catch {
217
- }
218
- return () => {
219
- var G, M;
220
- try {
221
- (M = (G = h).offThemeChange) == null || M.call(G, S);
222
- } catch {
223
- }
224
- };
225
- }, [S]);
226
- const i = w(
227
- () => s ? V(s, g, v) : void 0,
228
- [s, g, v]
229
- ), L = b ?? (i == null ? void 0 : i.liquidGlass), A = f ?? (i == null ? void 0 : i.frostedGlass), $ = u ?? (i == null ? void 0 : i.gradientBlur);
230
- if (O) {
231
- const n = { ...i == null ? void 0 : i.fallbackStyle, ...e };
232
- return s && n.borderRadius === void 0 && (n.borderRadius = `${_(s, v)}px`), /* @__PURE__ */ R(
233
- T,
234
- {
235
- className: d,
236
- style: n,
237
- liquidGlass: L,
238
- frostedGlass: A,
239
- gradientBlur: $,
240
- ...l,
241
- children: o
242
- }
243
- );
244
- }
245
- return Y() ? U({ scene: s, dark: g, overlayColor: a, cls: d, style: e, children: o, rest: l }) : z({
246
- scene: s,
247
- dark: g,
248
- targetId: c,
249
- overlayColor: a,
250
- cls: d,
251
- style: e,
252
- children: o,
253
- rest: l
254
- });
255
- };
256
- W.displayName = "NutJDMaterialView";
257
- export {
258
- W as J,
259
- E as a,
260
- V as b,
261
- _ as g
262
- };