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

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-0ZhXkmW9.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-0ZhXkmW9.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"),m=require("react"),B=require("classnames"),u=require("@tarojs/taro"),F=require("@tarojs/components"),L=require("@jdtaro/ui"),j=require("./typings-DP_XKs5o.js"),q=26;function I(e,r,t){const a=t>=q;switch(e){case"top-solid":return a?{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 a?{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 a?{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 D(e,r){const t=r>=q;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 h="255, 255, 255",G="31, 34, 38";function P(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(${G}, 0.9)`:`rgba(${h}, 0.9)`};case"promotion-fair":return{blurRadius:40,tintColor:`rgba(${h}, 0.85)`};case"promotion-deep":return{blurRadius:40,tintColor:`rgba(${h}, 0.2)`};case"immersive":return{blurRadius:40,tintColor:`rgba(${G}, 0.4)`};case"bottom-bar":return{blurRadius:50,tintColor:r?`rgba(${G}, 0.8)`:`rgba(${h}, 0.8)`};default:return{blurRadius:40}}}function $(e,r){const t=r?"dark":"light";switch(e){case"top-solid":return{blurScale:1,borderRadius:8,colorMode:t,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:8,colorMode:t};case"top-bar":return{blurScale:.9,borderRadius:0,colorMode:t};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:t};default:return{blurScale:0,borderRadius:0,colorMode:t}}}const N={...j.ComponentDefaults};function V(){return["harmony","harmonyhybrid","jdharmony"].includes(u.getEnv().toLowerCase())}function _(e){return e.style.startsWith("thin")?10:e.style.startsWith("thick")?40:20}function E(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 H(){var e;try{const r=u.getSystemInfoSync(),t=String((r==null?void 0:r.platform)||"").toLowerCase(),a=String((r==null?void 0:r.system)||""),o=t==="ios",d=o?parseInt(((e=a.match(/\d+/))==null?void 0:e[0])||"0",10):0,y=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:o,iosMajor:d,dark:y}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function J(){try{const e=u.getSystemInfoSync();return String((e==null?void 0:e.theme)||"").toLowerCase()==="dark"}catch{return!1}}function T(e){const{scene:r,dark:t,overlayColor:a,cls:o,style:d,children:y,rest:g}=e,l=r?$(r,t):void 0,i={};l?(i.blurScale=l.blurScale,i.borderRadius=l.borderRadius,i.colorMode=l.colorMode):i.colorMode=t?"dark":"light";const n=a??(l==null?void 0:l.overlayColor);return n&&(i.overlayColor=n),R.jsx(F.View,{className:o,style:d,...i,...g,children:y})}function W(e){const{scene:r,targetId:t,overlayColor:a,frostedGlass:o,gradientBlur:d,cls:y,style:g,children:l,rest:i}=e,n={...g};if(o){const v=_(o);n.backdropFilter=`blur(${v}px)`,o.alpha!==void 0&&(n.opacity=o.alpha)}else d&&Object.assign(n,E(d));const p=a??(o?o.style.endsWith("-dark")?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)":void 0),b={};return t&&(b.targetId=t),r&&(b.scene=r),p&&(b.overlayColor=p),R.jsx(F.View,{className:y,style:n,...b,...i,children:l})}const A=e=>{const{className:r,style:t,children:a,scene:o,targetId:d,liquidGlass:y,frostedGlass:g,gradientBlur:l,overlayColor:i,...n}={...N,...e},b=B("nut-jdmaterialview",r),{isIOS:v,iosMajor:M}=m.useMemo(()=>H(),[]),[S,O]=m.useState(()=>J()),C=m.useCallback(c=>{const f=typeof c=="string"?c:String((c==null?void 0:c.theme)||"");O(f.toLowerCase()==="dark")},[]);m.useEffect(()=>{var c;try{(c=u.onThemeChange)==null||c.call(u,C)}catch{}return()=>{var f;try{(f=u.offThemeChange)==null||f.call(u,C)}catch{}}},[C]);const s=m.useMemo(()=>o?I(o,S,M):void 0,[o,S,M]),x=y??(s==null?void 0:s.liquidGlass),k=g??(s==null?void 0:s.frostedGlass),w=l??(s==null?void 0:s.gradientBlur);if(v){const c={...s==null?void 0:s.fallbackStyle,...t};return R.jsx(L.JDIOSMaterialView,{className:b,style:c,liquidGlass:x,frostedGlass:k,gradientBlur:w,...n,children:a})}return V()?T({scene:o,dark:S,overlayColor:i,cls:b,style:t,children:a,rest:n}):W({scene:o,targetId:d,overlayColor:i,frostedGlass:k,gradientBlur:w,cls:b,style:t,children:a,rest:n})};A.displayName="NutJDMaterialView";exports.JDMaterialView=A;exports.getCornerRadius=D;exports.getFrostedPreset=P;exports.getPreset=I;
@@ -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-Ch_ytSl9.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-Ch_ytSl9.mjs";
2
+ import { g as s, a as o, b as g } from "../jdmaterialview.taro-Ch_ytSl9.mjs";
3
3
  export {
4
4
  r as default,
5
5
  s as getCornerRadius,
@@ -0,0 +1,254 @@
1
+ import { jsx as G } from "react/jsx-runtime";
2
+ import { useMemo as I, useState as L, useCallback as x, useEffect as D } from "react";
3
+ import $ from "classnames";
4
+ import g, { getEnv as N } from "@tarojs/taro";
5
+ import { View as A } from "@tarojs/components";
6
+ import { JDIOSMaterialView as P } from "@jdtaro/ui";
7
+ import { C as j } from "./typings-CdeuPEKG.mjs";
8
+ const O = 26;
9
+ function T(e, r, t) {
10
+ const a = t >= O;
11
+ switch (e) {
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 ar(e, r) {
65
+ const t = r >= O;
66
+ switch (e) {
67
+ case "top-bar":
68
+ case "bottom-bar":
69
+ return 0;
70
+ case "top-plain":
71
+ return t ? 12 : 0;
72
+ case "top-solid":
73
+ case "promotion-fair":
74
+ case "promotion-deep":
75
+ case "immersive":
76
+ return t ? 12 : 8;
77
+ default:
78
+ return 0;
79
+ }
80
+ }
81
+ const y = "255, 255, 255", C = "31, 34, 38";
82
+ function sr(e, r) {
83
+ switch (e) {
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(${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(${C}, 0.4)` };
102
+ case "bottom-bar":
103
+ return {
104
+ blurRadius: 50,
105
+ tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${y}, 0.8)`
106
+ };
107
+ default:
108
+ return { blurRadius: 40 };
109
+ }
110
+ }
111
+ function V(e, r) {
112
+ const t = r ? "dark" : "light";
113
+ switch (e) {
114
+ case "top-solid":
115
+ return {
116
+ blurScale: 1,
117
+ borderRadius: 8,
118
+ colorMode: t,
119
+ overlayColor: r ? "#2A2F36" : "#FFFFFF"
120
+ };
121
+ case "top-plain":
122
+ return { blurScale: 0, borderRadius: 8, colorMode: t };
123
+ case "top-bar":
124
+ return { blurScale: 0.9, borderRadius: 0, colorMode: t };
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: t };
133
+ default:
134
+ return { blurScale: 0, borderRadius: 0, colorMode: t };
135
+ }
136
+ }
137
+ const _ = {
138
+ ...j
139
+ };
140
+ function E() {
141
+ return ["harmony", "harmonyhybrid", "jdharmony"].includes(
142
+ N().toLowerCase()
143
+ );
144
+ }
145
+ function H(e) {
146
+ return e.style.startsWith("thin") ? 10 : e.style.startsWith("thick") ? 40 : 20;
147
+ }
148
+ function J(e) {
149
+ const r = {}, t = e.maxBlur ?? 0;
150
+ 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;
151
+ }
152
+ function W() {
153
+ var e;
154
+ try {
155
+ const r = g.getSystemInfoSync(), t = String((r == null ? void 0 : r.platform) || "").toLowerCase(), a = String((r == null ? void 0 : r.system) || ""), o = t === "ios", u = o ? parseInt(((e = a.match(/\d+/)) == null ? void 0 : e[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
156
+ return { isIOS: o, iosMajor: u, dark: b };
157
+ } catch {
158
+ return { isIOS: !1, iosMajor: 0, dark: !1 };
159
+ }
160
+ }
161
+ function Y() {
162
+ try {
163
+ const e = g.getSystemInfoSync();
164
+ return String((e == null ? void 0 : e.theme) || "").toLowerCase() === "dark";
165
+ } catch {
166
+ return !1;
167
+ }
168
+ }
169
+ function K(e) {
170
+ const { scene: r, dark: t, overlayColor: a, cls: o, style: u, children: b, rest: m } = e, l = r ? V(r, t) : void 0, i = {};
171
+ l ? (i.blurScale = l.blurScale, i.borderRadius = l.borderRadius, i.colorMode = l.colorMode) : i.colorMode = t ? "dark" : "light";
172
+ const n = a ?? (l == null ? void 0 : l.overlayColor);
173
+ return n && (i.overlayColor = n), /* @__PURE__ */ G(A, { className: o, style: u, ...i, ...m, children: b });
174
+ }
175
+ function Q(e) {
176
+ const { scene: r, targetId: t, overlayColor: a, frostedGlass: o, gradientBlur: u, cls: b, style: m, children: l, rest: i } = e, n = { ...m };
177
+ if (o) {
178
+ const p = H(o);
179
+ n.backdropFilter = `blur(${p}px)`, o.alpha !== void 0 && (n.opacity = o.alpha);
180
+ } else u && Object.assign(n, J(u));
181
+ const h = a ?? (o ? o.style.endsWith("-dark") ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.3)" : void 0), d = {};
182
+ return t && (d.targetId = t), r && (d.scene = r), h && (d.overlayColor = h), /* @__PURE__ */ G(A, { className: b, style: n, ...d, ...i, children: l });
183
+ }
184
+ const U = (e) => {
185
+ const {
186
+ className: r,
187
+ style: t,
188
+ children: a,
189
+ scene: o,
190
+ targetId: u,
191
+ liquidGlass: b,
192
+ frostedGlass: m,
193
+ gradientBlur: l,
194
+ overlayColor: i,
195
+ ...n
196
+ } = { ..._, ...e }, d = $("nut-jdmaterialview", r), { isIOS: p, iosMajor: R } = I(() => W(), []), [v, q] = L(() => Y()), S = x(
197
+ (c) => {
198
+ const f = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
199
+ q(f.toLowerCase() === "dark");
200
+ },
201
+ []
202
+ );
203
+ D(() => {
204
+ var c, f;
205
+ try {
206
+ (f = (c = g).onThemeChange) == null || f.call(c, S);
207
+ } catch {
208
+ }
209
+ return () => {
210
+ var F, w;
211
+ try {
212
+ (w = (F = g).offThemeChange) == null || w.call(F, S);
213
+ } catch {
214
+ }
215
+ };
216
+ }, [S]);
217
+ const s = I(
218
+ () => o ? T(o, v, R) : void 0,
219
+ [o, v, R]
220
+ ), B = b ?? (s == null ? void 0 : s.liquidGlass), k = m ?? (s == null ? void 0 : s.frostedGlass), M = l ?? (s == null ? void 0 : s.gradientBlur);
221
+ if (p) {
222
+ const c = { ...s == null ? void 0 : s.fallbackStyle, ...t };
223
+ return /* @__PURE__ */ G(
224
+ P,
225
+ {
226
+ className: d,
227
+ style: c,
228
+ liquidGlass: B,
229
+ frostedGlass: k,
230
+ gradientBlur: M,
231
+ ...n,
232
+ children: a
233
+ }
234
+ );
235
+ }
236
+ return E() ? K({ scene: o, dark: v, overlayColor: i, cls: d, style: t, children: a, rest: n }) : Q({
237
+ scene: o,
238
+ targetId: u,
239
+ overlayColor: i,
240
+ frostedGlass: k,
241
+ gradientBlur: M,
242
+ cls: d,
243
+ style: t,
244
+ children: a,
245
+ rest: n
246
+ });
247
+ };
248
+ U.displayName = "NutJDMaterialView";
249
+ export {
250
+ U as J,
251
+ sr as a,
252
+ T as b,
253
+ ar as g
254
+ };
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.7",
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
- };