@nutui/taro-biz 0.0.1-alpha.6 → 0.0.1-alpha.8

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-CLUi2aY4.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-34Y0-ZOh.js"),r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
@@ -1 +1 @@
1
- "use strict";const r=require("../jdmaterialsblurtarget.taro-B8SyDQOM.js");module.exports=r.JDMaterialsBlurTarget;
1
+ "use strict";const r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");module.exports=r.JDMaterialsBlurTarget;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("classnames"),u=require("@tarojs/taro"),m=require("@tarojs/components"),d=require("./typings-DP_XKs5o.js"),f={...d.ComponentDefaults};function g(){var r;try{return String(((r=u.getSystemInfoSync())==null?void 0:r.platform)||"").toLowerCase()==="android"}catch{return!1}}const s=r=>{const{className:a,style:n,children:t,blurId:c,...i}={...f,...r};if(!g())return e.jsx(e.Fragment,{children:t});const o=l("nut-jdmaterialsblurtarget",a);return e.jsx(m.View,{className:o,style:n,blurId:c,...i,children:t})};s.displayName="NutJDMaterialsBlurTarget";exports.JDMaterialsBlurTarget=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-CLUi2aY4.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-34Y0-ZOh.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
@@ -0,0 +1 @@
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;
@@ -1,5 +1,5 @@
1
- import { J as e } from "../jdmaterialview.taro-BWSx9nXx.mjs";
2
- import { J as o } from "../jdmaterialsblurtarget.taro-D9cwbzQi.mjs";
1
+ import { J as e } from "../jdmaterialview.taro-DHsrFcZg.mjs";
2
+ import { J as o } from "../jdmaterialsblurtarget.taro-DCTEjmIC.mjs";
3
3
  export {
4
4
  e as JDMaterialView,
5
5
  o as JDMaterialsBlurTarget
@@ -1,4 +1,4 @@
1
- import { J as r } from "../jdmaterialsblurtarget.taro-D9cwbzQi.mjs";
1
+ import { J as r } from "../jdmaterialsblurtarget.taro-DCTEjmIC.mjs";
2
2
  export {
3
3
  r as default
4
4
  };
@@ -0,0 +1,30 @@
1
+ import { jsx as s, Fragment as i } from "react/jsx-runtime";
2
+ import m from "classnames";
3
+ import c from "@tarojs/taro";
4
+ import { View as f } from "@tarojs/components";
5
+ import { C as u } from "./typings-CdeuPEKG.mjs";
6
+ const p = {
7
+ ...u
8
+ };
9
+ function d() {
10
+ var r;
11
+ try {
12
+ return String(((r = c.getSystemInfoSync()) == null ? void 0 : r.platform) || "").toLowerCase() === "android";
13
+ } catch {
14
+ return !1;
15
+ }
16
+ }
17
+ const g = (r) => {
18
+ const { className: a, style: e, children: t, blurId: o, ...n } = {
19
+ ...p,
20
+ ...r
21
+ };
22
+ if (!d())
23
+ return /* @__PURE__ */ s(i, { children: t });
24
+ const l = m("nut-jdmaterialsblurtarget", a);
25
+ return /* @__PURE__ */ s(f, { className: l, style: e, blurId: o, ...n, children: t });
26
+ };
27
+ g.displayName = "NutJDMaterialsBlurTarget";
28
+ export {
29
+ g as J
30
+ };
@@ -1,5 +1,5 @@
1
- import { J as r } from "../jdmaterialview.taro-BWSx9nXx.mjs";
2
- import { g as s, a as o, b as g } from "../jdmaterialview.taro-BWSx9nXx.mjs";
1
+ import { J as r } from "../jdmaterialview.taro-DHsrFcZg.mjs";
2
+ import { g as s, a as o, b as g } from "../jdmaterialview.taro-DHsrFcZg.mjs";
3
3
  export {
4
4
  r as default,
5
5
  s as getCornerRadius,
@@ -0,0 +1,243 @@
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import { useMemo as w, useState as D, useCallback as N, useEffect as P } from "react";
3
+ import $ 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 x(t, r, e) {
10
+ const a = e >= k;
11
+ switch (t) {
12
+ case "top-solid":
13
+ return a ? {
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 a ? {
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 a ? {
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 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
+ const y = "255, 255, 255", S = "31, 34, 38";
82
+ function V(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(${S}, 0.9)` : `rgba(${y}, 0.9)`
95
+ };
96
+ case "promotion-fair":
97
+ return { blurRadius: 40, tintColor: `rgba(${y}, 0.85)` };
98
+ case "promotion-deep":
99
+ return { blurRadius: 40, tintColor: `rgba(${y}, 0.2)` };
100
+ case "immersive":
101
+ return { blurRadius: 40, tintColor: `rgba(${S}, 0.4)` };
102
+ case "bottom-bar":
103
+ return {
104
+ blurRadius: 50,
105
+ tintColor: r ? `rgba(${S}, 0.8)` : `rgba(${y}, 0.8)`
106
+ };
107
+ default:
108
+ return { blurRadius: 40 };
109
+ }
110
+ }
111
+ function _(t, r) {
112
+ const e = r ? "dark" : "light";
113
+ switch (t) {
114
+ case "top-solid":
115
+ return {
116
+ blurScale: 1,
117
+ borderRadius: 8,
118
+ colorMode: e,
119
+ overlayColor: r ? "#2A2F36" : "#FFFFFF"
120
+ };
121
+ case "top-plain":
122
+ return { blurScale: 0, borderRadius: 8, colorMode: e };
123
+ case "top-bar":
124
+ return { blurScale: 0.9, borderRadius: 0, colorMode: e };
125
+ case "promotion-fair":
126
+ return { blurScale: 0.85, borderRadius: 8, colorMode: "light" };
127
+ case "promotion-deep":
128
+ return { blurScale: 0.2, borderRadius: 8, colorMode: "light" };
129
+ case "immersive":
130
+ return { blurScale: 0.4, borderRadius: 8, colorMode: "dark" };
131
+ case "bottom-bar":
132
+ return { blurScale: 0.2, borderRadius: 0, colorMode: e };
133
+ default:
134
+ return { blurScale: 0, borderRadius: 0, colorMode: e };
135
+ }
136
+ }
137
+ const E = {
138
+ ...j
139
+ };
140
+ function H() {
141
+ return ["harmony", "harmonyhybrid", "jdharmony"].includes(
142
+ B().toLowerCase()
143
+ );
144
+ }
145
+ function J() {
146
+ var t;
147
+ 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", d = s ? parseInt(((t = a.match(/\d+/)) == null ? void 0 : t[0]) || "0", 10) : 0, m = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
149
+ return { isIOS: s, iosMajor: d, dark: m };
150
+ } catch {
151
+ return { isIOS: !1, iosMajor: 0, dark: !1 };
152
+ }
153
+ }
154
+ function Y() {
155
+ try {
156
+ const t = h.getSystemInfoSync();
157
+ return String((t == null ? void 0 : t.theme) || "").toLowerCase() === "dark";
158
+ } catch {
159
+ return !1;
160
+ }
161
+ }
162
+ function K(t) {
163
+ const { scene: r, dark: e, overlayColor: a, cls: s, style: d, children: m, rest: b } = t, i = r ? _(r, e) : void 0, o = {};
164
+ i ? (o.blurScale = i.blurScale, o.borderRadius = i.borderRadius, o.colorMode = i.colorMode) : o.colorMode = e ? "dark" : "light";
165
+ const c = a ?? (i == null ? void 0 : i.overlayColor);
166
+ return c && (o.overlayColor = c), /* @__PURE__ */ C(F, { className: s, style: d, ...o, ...b, children: m });
167
+ }
168
+ function Q(t) {
169
+ const { scene: r, dark: e, targetId: a, overlayColor: s, cls: d, style: m, children: b, rest: i } = t, o = r ? V(r, e) : void 0, c = { ...m };
170
+ o && o.blurRadius > 0 && (c.backdropFilter = `blur(${o.blurRadius}px)`);
171
+ const p = s ?? (o == null ? void 0 : o.tintColor), u = {};
172
+ return a && (u.targetId = a), r && (u.scene = r), p && (u.overlayColor = p), /* @__PURE__ */ C(F, { className: d, style: c, ...u, ...i, children: b });
173
+ }
174
+ const U = (t) => {
175
+ const {
176
+ className: r,
177
+ style: e,
178
+ children: a,
179
+ scene: s,
180
+ targetId: d,
181
+ liquidGlass: m,
182
+ frostedGlass: b,
183
+ gradientBlur: i,
184
+ overlayColor: o,
185
+ ...c
186
+ } = { ...E, ...t }, u = $("nut-jdmaterialview", r), { isIOS: I, iosMajor: R } = w(() => J(), []), [f, q] = D(() => Y()), v = N(
187
+ (n) => {
188
+ const g = typeof n == "string" ? n : String((n == null ? void 0 : n.theme) || "");
189
+ q(g.toLowerCase() === "dark");
190
+ },
191
+ []
192
+ );
193
+ P(() => {
194
+ var n, g;
195
+ try {
196
+ (g = (n = h).onThemeChange) == null || g.call(n, v);
197
+ } catch {
198
+ }
199
+ return () => {
200
+ var G, M;
201
+ try {
202
+ (M = (G = h).offThemeChange) == null || M.call(G, v);
203
+ } catch {
204
+ }
205
+ };
206
+ }, [v]);
207
+ const l = w(
208
+ () => s ? x(s, f, R) : void 0,
209
+ [s, f, R]
210
+ ), L = m ?? (l == null ? void 0 : l.liquidGlass), O = b ?? (l == null ? void 0 : l.frostedGlass), A = i ?? (l == null ? void 0 : l.gradientBlur);
211
+ if (I) {
212
+ const n = { ...l == null ? void 0 : l.fallbackStyle, ...e };
213
+ return /* @__PURE__ */ C(
214
+ T,
215
+ {
216
+ className: u,
217
+ style: n,
218
+ liquidGlass: L,
219
+ frostedGlass: O,
220
+ gradientBlur: A,
221
+ ...c,
222
+ children: a
223
+ }
224
+ );
225
+ }
226
+ return H() ? K({ scene: s, dark: f, overlayColor: o, cls: u, style: e, children: a, rest: c }) : Q({
227
+ scene: s,
228
+ dark: f,
229
+ targetId: d,
230
+ overlayColor: o,
231
+ cls: u,
232
+ style: e,
233
+ children: a,
234
+ rest: c
235
+ });
236
+ };
237
+ U.displayName = "NutJDMaterialView";
238
+ export {
239
+ U as J,
240
+ V as a,
241
+ x as b,
242
+ or as g
243
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/taro-biz",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.8",
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 u=require("react/jsx-runtime"),o=require("classnames"),m=require("@tarojs/components"),d=require("./typings-DP_XKs5o.js"),p={...d.ComponentDefaults},e=t=>{const{className:r,style:a,children:l,blurId:n,...c}={...p,...t},i=o("nut-jdmaterialsblurtarget",r),s={};return s.blurId=n,u.jsx(m.View,{className:i,style:a,...s,...c,children:l})};e.displayName="NutJDMaterialsBlurTarget";exports.JDMaterialsBlurTarget=e;
@@ -1 +0,0 @@
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,s){const i=s>=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 s=r>=k;switch(e){case"top-bar":case"bottom-bar":return 0;case"top-plain":return s?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return s?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={},s=e.maxBlur??0;return s>0&&(r.backdropFilter=`blur(${s*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(),s=String((r==null?void 0:r.platform)||"").toLowerCase(),i=String((r==null?void 0:r.system)||""),o=s==="ios",d=o?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:o,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:s,children:i,scene:o,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=>{const a=typeof t=="string"?t:String((t==null?void 0:t.theme)||"");M(a.toLowerCase()==="dark")},[]);y.useEffect(()=>{var t;try{(t=u.onThemeChange)==null||t.call(u,v)}catch{}return()=>{var a;try{(a=u.offThemeChange)==null||a.call(u,v)}catch{}}},[v]);const l=y.useMemo(()=>o?I(o,f,G):void 0,[o,f,G]),j=m??(l==null?void 0:l.liquidGlass),n=A??(l==null?void 0:l.frostedGlass),b=x??(l==null?void 0:l.gradientBlur);if(L){const t={...l==null?void 0:l.fallbackStyle,...s};return S.jsx(N.JDIOSMaterialView,{className:p,style:t,liquidGlass:j,frostedGlass:n,gradientBlur:b,...h,children:i})}if(E()){const t=o?J(o,f):void 0,a={};t&&(a.blurScale=t.blurScale,a.borderRadius=t.borderRadius),a.colorMode=f?"dark":"light";const q=R??(t==null?void 0:t.overlayColor);return q&&(a.overlayColor=q),d&&(a.targetId=d),o&&(a.scene=o),S.jsx(w.View,{className:p,style:s,...a,...h,children:i})}const B=(()=>{const t={...s};if(n){const a=H(n);t.backdropFilter=`blur(${a}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,o&&(c.scene=o),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,17 +0,0 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import i from "classnames";
3
- import { View as n } from "@tarojs/components";
4
- import { C as u } from "./typings-CdeuPEKG.mjs";
5
- const p = {
6
- ...u
7
- }, f = (r) => {
8
- const { className: t, style: a, children: e, blurId: l, ...o } = {
9
- ...p,
10
- ...r
11
- }, m = i("nut-jdmaterialsblurtarget", t), s = {};
12
- return s.blurId = l, /* @__PURE__ */ c(n, { className: m, style: a, ...s, ...o, children: e });
13
- };
14
- f.displayName = "NutJDMaterialsBlurTarget";
15
- export {
16
- f as J
17
- };
@@ -1,237 +0,0 @@
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, s) {
10
- const i = s >= 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 s = r >= O;
66
- switch (t) {
67
- case "top-bar":
68
- case "bottom-bar":
69
- return 0;
70
- case "top-plain":
71
- return s ? 12 : 0;
72
- case "top-solid":
73
- case "promotion-fair":
74
- case "promotion-deep":
75
- case "immersive":
76
- return s ? 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 = {}, s = t.maxBlur ?? 0;
144
- return s > 0 && (r.backdropFilter = `blur(${s * 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(), s = String((r == null ? void 0 : r.platform) || "").toLowerCase(), i = String((r == null ? void 0 : r.system) || ""), o = s === "ios", c = o ? 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: o, 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: s,
167
- children: i,
168
- scene: o,
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
- const a = typeof e == "string" ? e : String((e == null ? void 0 : e.theme) || "");
178
- B(a.toLowerCase() === "dark");
179
- },
180
- []
181
- );
182
- $(() => {
183
- var e, a;
184
- try {
185
- (a = (e = y).onThemeChange) == null || a.call(e, v);
186
- } catch {
187
- }
188
- return () => {
189
- var b, k;
190
- try {
191
- (k = (b = y).offThemeChange) == null || k.call(b, v);
192
- } catch {
193
- }
194
- };
195
- }, [v]);
196
- const l = w(
197
- () => o ? V(o, m, R) : void 0,
198
- [o, m, R]
199
- ), N = g ?? (l == null ? void 0 : l.liquidGlass), n = A ?? (l == null ? void 0 : l.frostedGlass), d = q ?? (l == null ? void 0 : l.gradientBlur);
200
- if (L) {
201
- const e = { ...l == null ? void 0 : l.fallbackStyle, ...s };
202
- return /* @__PURE__ */ S(
203
- T,
204
- {
205
- className: h,
206
- style: e,
207
- liquidGlass: N,
208
- frostedGlass: n,
209
- gradientBlur: d,
210
- ...p,
211
- children: i
212
- }
213
- );
214
- }
215
- if (H()) {
216
- const e = o ? _(o, m) : void 0, a = {};
217
- e && (a.blurScale = e.blurScale, a.borderRadius = e.borderRadius), a.colorMode = m ? "dark" : "light";
218
- const b = G ?? (e == null ? void 0 : e.overlayColor);
219
- return b && (a.overlayColor = b), c && (a.targetId = c), o && (a.scene = o), /* @__PURE__ */ S(I, { className: h, style: s, ...a, ...p, children: i });
220
- }
221
- const x = (() => {
222
- const e = { ...s };
223
- if (n) {
224
- const a = W(n);
225
- e.backdropFilter = `blur(${a}px)`, n.alpha !== void 0 && (e.opacity = n.alpha);
226
- } else d && Object.assign(e, Y(d));
227
- return e;
228
- })(), F = G ?? (n ? n.style.endsWith("-dark") ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.3)" : void 0), u = {};
229
- return u.targetId = c, o && (u.scene = o), 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 });
230
- };
231
- U.displayName = "NutJDMaterialView";
232
- export {
233
- U as J,
234
- lr as a,
235
- V as b,
236
- or as g
237
- };