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

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.
Files changed (27) hide show
  1. package/dist/cjs/index/index.d.ts +2 -0
  2. package/dist/cjs/index/index.js +1 -1
  3. package/dist/cjs/jdmaterialsblurtarget/index.d.ts +2 -0
  4. package/dist/cjs/jdmaterialview/index.d.ts +2 -0
  5. package/dist/cjs/jdmaterialview/index.js +1 -1
  6. package/dist/cjs/jdmaterialview.taro-D8shGQ46.js +1 -0
  7. package/dist/es/index/index.d.ts +2 -0
  8. package/dist/es/index/index.js +1 -1
  9. package/dist/es/jdmaterialsblurtarget/index.d.ts +2 -0
  10. package/dist/es/jdmaterialview/index.d.ts +2 -0
  11. package/dist/es/jdmaterialview/index.js +2 -6
  12. package/dist/es/{jdmaterialview.taro-Be0_ro5-.mjs → jdmaterialview.taro-Di3QqSHi.mjs} +88 -92
  13. package/dist/types/index.taro.d.ts +4 -0
  14. package/dist/types/packages/jdmaterialsblurtarget/index.d.ts +3 -0
  15. package/dist/types/packages/jdmaterialsblurtarget/index.taro.d.ts +3 -0
  16. package/dist/types/packages/jdmaterialsblurtarget/jdmaterialsblurtarget.d.ts +3 -0
  17. package/dist/types/packages/jdmaterialsblurtarget/jdmaterialsblurtarget.taro.d.ts +3 -0
  18. package/dist/types/packages/jdmaterialsblurtarget/types.d.ts +5 -0
  19. package/dist/types/packages/jdmaterialview/index.d.ts +4 -0
  20. package/dist/types/packages/jdmaterialview/index.taro.d.ts +3 -0
  21. package/dist/types/packages/jdmaterialview/jdmaterialview.d.ts +3 -0
  22. package/dist/types/packages/jdmaterialview/jdmaterialview.taro.d.ts +3 -0
  23. package/dist/types/packages/jdmaterialview/scene-presets.d.ts +46 -0
  24. package/dist/types/packages/jdmaterialview/types.d.ts +20 -0
  25. package/dist/types/utils/typings.d.ts +11 -0
  26. package/package.json +5 -1
  27. package/dist/cjs/jdmaterialview.taro-CF5tEG5Z.js +0 -1
@@ -0,0 +1,2 @@
1
+ export * from '../../types/index.taro'
2
+ export { default } from '../../types/index.taro'
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-D8shGQ46.js"),r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
@@ -0,0 +1,2 @@
1
+ export * from '../../types/packages/jdmaterialsblurtarget/index.taro'
2
+ export { default } from '../../types/packages/jdmaterialsblurtarget/index.taro'
@@ -0,0 +1,2 @@
1
+ export * from '../../types/packages/jdmaterialview/index.taro'
2
+ export { default } from '../../types/packages/jdmaterialview/index.taro'
@@ -1 +1 @@
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;
1
+ "use strict";const e=require("../jdmaterialview.taro-D8shGQ46.js");module.exports=e.JDMaterialView;
@@ -0,0 +1 @@
1
+ "use strict";const G=require("react/jsx-runtime"),y=require("react"),A=require("classnames"),d=require("@tarojs/taro"),w=require("@tarojs/components"),D=require("@jdtaro/ui"),O=require("./typings-DP_XKs5o.js"),k=26;function j(o,r,e){const t=e>=k;switch(o){case"top-solid":return t?{liquidGlass:{style:"regular",interactive:!0,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}}}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return t?{liquidGlass:{style:"regular",interactive:!0,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}}}:{};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 t?{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 B(o,r){const e=r>=k;switch(o){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 M(o){switch(o){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 S="255, 255, 255",R="31, 34, 38";function N(o,r){const e=M(o);switch(o){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(${S}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${S}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:e,tintColor:`rgba(${S}, 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(${S}, 0.8)`};default:return{blurRadius:40,borderRadius:e}}}function P(o){const r=o?"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(o,r){const e=r?"dark":"light",t=M(o);switch(o){case"top-solid":return{blurScale:1,borderRadius:t,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:t,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:t,colorMode:e,overlayColor:r?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.8)"};case"promotion-fair":return{blurScale:.85,borderRadius:t,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:t,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:t,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:t,colorMode:e,backgroundGradient:P(r),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:t,colorMode:e}}}const _={...O.ComponentDefaults};function E(){return["harmony","harmonyhybrid","jdharmony"].includes(d.getEnv().toLowerCase())}function H(){var o;try{const r=d.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),t=String((r==null?void 0:r.system)||""),i=e==="ios",u=i?parseInt(((o=t.match(/\d+/))==null?void 0:o[0])||"0",10):0,g=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:i,iosMajor:u,dark:g}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function J(){try{const o=d.getSystemInfoSync();return String((o==null?void 0:o.theme)||"").toLowerCase()==="dark"}catch{return!1}}function Y(o){const{scene:r,dark:e,overlayColor:t,cls:i,style:u,children:g,rest:f}=o,a=r?V(r,e):void 0,s={};a?(s.blurScale=a.blurScale,s.borderRadius=a.borderRadius,s.colorMode=a.colorMode):s.colorMode=e?"dark":"light",(u==null?void 0:u.borderRadius)!==void 0&&(s.borderRadius=parseFloat(String(u.borderRadius)));const l={...u},m=t??(a==null?void 0:a.overlayColor);return m&&l.backgroundColor===void 0&&(l.backgroundColor=m),a!=null&&a.backgroundGradient&&l.background===void 0&&(l.background=a.backgroundGradient),a!=null&&a.boxShadow&&l.boxShadow===void 0&&(l.boxShadow=a.boxShadow),G.jsx(w.View,{className:i,style:l,...s,...f,children:g})}function K(o){const{scene:r,dark:e,targetId:t,overlayColor:i,cls:u,style:g,children:f,rest:a}=o,s=r?N(r,e):void 0,l={...g};s&&s.blurRadius>0&&(l.backdropFilter=`blur(${s.blurRadius}px)`),s&&l.borderRadius===void 0&&(l.borderRadius=`${s.borderRadius}px`);const m=i??(s==null?void 0:s.tintColor),b={};return t&&(b.targetId=t),r&&(b.scene=r),m&&(b.overlayColor=m),G.jsx(w.View,{className:u,style:l,...b,...a,children:f})}const q=o=>{const{className:r,style:e,children:t,scene:i,targetId:u,liquidGlass:g,frostedGlass:f,gradientBlur:a,overlayColor:s,...l}={..._,...o},b=A("nut-jdmaterialview",r),{isIOS:F,iosMajor:v}=y.useMemo(()=>H(),[]),[h,x]=y.useState(()=>J()),C=y.useCallback(c=>{const p=typeof c=="string"?c:String((c==null?void 0:c.theme)||"");x(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(()=>i?j(i,h,v):void 0,[i,h,v]),I=g??(n==null?void 0:n.liquidGlass),$=f??(n==null?void 0:n.frostedGlass),L=a??(n==null?void 0:n.gradientBlur);if(F){const c={...n==null?void 0:n.fallbackStyle,...e};return i&&c.borderRadius===void 0&&(c.borderRadius=`${B(i,v)}px`),G.jsx(D.JDIOSMaterialView,{className:b,style:c,liquidGlass:I,frostedGlass:$,gradientBlur:L,...l,children:t})}return E()?Y({scene:i,dark:h,overlayColor:s,cls:b,style:e,children:t,rest:l}):K({scene:i,dark:h,targetId:u,overlayColor:s,cls:b,style:e,children:t,rest:l})};q.displayName="NutJDMaterialView";exports.JDMaterialView=q;
@@ -0,0 +1,2 @@
1
+ export * from '../../types/index.taro'
2
+ export { default } from '../../types/index.taro'
@@ -1,4 +1,4 @@
1
- import { J as e } from "../jdmaterialview.taro-Be0_ro5-.mjs";
1
+ import { J as e } from "../jdmaterialview.taro-Di3QqSHi.mjs";
2
2
  import { J as o } from "../jdmaterialsblurtarget.taro-DCTEjmIC.mjs";
3
3
  export {
4
4
  e as JDMaterialView,
@@ -0,0 +1,2 @@
1
+ export * from '../../types/packages/jdmaterialsblurtarget/index.taro'
2
+ export { default } from '../../types/packages/jdmaterialsblurtarget/index.taro'
@@ -0,0 +1,2 @@
1
+ export * from '../../types/packages/jdmaterialview/index.taro'
2
+ export { default } from '../../types/packages/jdmaterialview/index.taro'
@@ -1,8 +1,4 @@
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";
1
+ import { J as e } from "../jdmaterialview.taro-Di3QqSHi.mjs";
3
2
  export {
4
- r as default,
5
- s as getCornerRadius,
6
- o as getFrostedPreset,
7
- g as getPreset
3
+ e as default
8
4
  };
@@ -1,21 +1,20 @@
1
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";
2
+ import { useMemo as w, useState as O, useCallback as B, useEffect as D } from "react";
3
+ import N from "classnames";
4
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";
5
+ import { View as M } from "@tarojs/components";
6
+ import { JDIOSMaterialView as j } from "@jdtaro/ui";
7
+ import { C as V } from "./typings-CdeuPEKG.mjs";
8
8
  const F = 26;
9
- function V(o, r, e) {
10
- const t = e >= F;
11
- switch (o) {
9
+ function T(e, r, o) {
10
+ const t = o >= F;
11
+ switch (e) {
12
12
  case "top-solid":
13
13
  return t ? {
14
14
  liquidGlass: {
15
15
  style: "regular",
16
16
  interactive: !0,
17
- tintColor: r ? "rgba(0, 0, 0, 0.75)" : "rgba(255, 255, 255, 0.45)",
18
- showTintOverlay: r
17
+ ...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
19
18
  }
20
19
  } : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
21
20
  case "top-plain":
@@ -23,8 +22,7 @@ function V(o, r, e) {
23
22
  liquidGlass: {
24
23
  style: "regular",
25
24
  interactive: !0,
26
- tintColor: r ? "rgba(0, 0, 0, 0.75)" : "rgba(255, 255, 255, 0.45)",
27
- showTintOverlay: r
25
+ ...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
28
26
  }
29
27
  } : {};
30
28
  case "top-bar":
@@ -61,25 +59,25 @@ function V(o, r, e) {
61
59
  return {};
62
60
  }
63
61
  }
64
- function _(o, r) {
65
- const e = r >= F;
66
- switch (o) {
62
+ function _(e, r) {
63
+ const o = r >= F;
64
+ switch (e) {
67
65
  case "top-bar":
68
66
  case "bottom-bar":
69
67
  return 0;
70
68
  case "top-plain":
71
- return e ? 12 : 0;
69
+ return o ? 12 : 0;
72
70
  case "top-solid":
73
71
  case "promotion-fair":
74
72
  case "promotion-deep":
75
73
  case "immersive":
76
- return e ? 12 : 8;
74
+ return o ? 12 : 8;
77
75
  default:
78
76
  return 0;
79
77
  }
80
78
  }
81
- function I(o) {
82
- switch (o) {
79
+ function I(e) {
80
+ switch (e) {
83
81
  case "top-bar":
84
82
  case "bottom-bar":
85
83
  return 0;
@@ -93,62 +91,62 @@ function I(o) {
93
91
  return 0;
94
92
  }
95
93
  }
96
- const p = "255, 255, 255", C = "31, 34, 38";
97
- function E(o, r) {
98
- const e = I(o);
99
- switch (o) {
94
+ const y = "255, 255, 255", C = "31, 34, 38";
95
+ function E(e, r) {
96
+ const o = I(e);
97
+ switch (e) {
100
98
  case "top-solid":
101
99
  return {
102
100
  blurRadius: 40,
103
- borderRadius: e,
101
+ borderRadius: o,
104
102
  tintColor: r ? "rgba(42, 47, 54, 1)" : "rgba(255, 255, 255, 1)"
105
103
  };
106
104
  case "top-plain":
107
- return { blurRadius: 0, borderRadius: e };
105
+ return { blurRadius: 0, borderRadius: o };
108
106
  case "top-bar":
109
107
  return {
110
108
  blurRadius: 40,
111
- borderRadius: e,
112
- tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${p}, 0.9)`
109
+ borderRadius: o,
110
+ tintColor: r ? `rgba(${C}, 0.9)` : `rgba(${y}, 0.9)`
113
111
  };
114
112
  case "promotion-fair":
115
- return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${p}, 0.85)` };
113
+ return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${y}, 0.85)` };
116
114
  case "promotion-deep":
117
- return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${p}, 0.2)` };
115
+ return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${y}, 0.2)` };
118
116
  case "immersive":
119
- return { blurRadius: 40, borderRadius: e, tintColor: `rgba(${C}, 0.4)` };
117
+ return { blurRadius: 40, borderRadius: o, tintColor: `rgba(${C}, 0.4)` };
120
118
  case "bottom-bar":
121
119
  return {
122
120
  blurRadius: 50,
123
- borderRadius: e,
124
- tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${p}, 0.8)`
121
+ borderRadius: o,
122
+ tintColor: r ? `rgba(${C}, 0.8)` : `rgba(${y}, 0.8)`
125
123
  };
126
124
  default:
127
- return { blurRadius: 40, borderRadius: e };
125
+ return { blurRadius: 40, borderRadius: o };
128
126
  }
129
127
  }
130
- function H(o) {
131
- const r = o ? "0, 0, 0" : "255, 255, 255";
128
+ function H(e) {
129
+ const r = e ? "0, 0, 0" : "255, 255, 255";
132
130
  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
131
  }
134
- function J(o, r) {
135
- const e = r ? "dark" : "light", t = I(o);
136
- switch (o) {
132
+ function J(e, r) {
133
+ const o = r ? "dark" : "light", t = I(e);
134
+ switch (e) {
137
135
  case "top-solid":
138
136
  return {
139
137
  blurScale: 1,
140
138
  borderRadius: t,
141
- colorMode: e,
139
+ colorMode: o,
142
140
  overlayColor: r ? "#2A2F36" : "#FFFFFF"
143
141
  };
144
142
  case "top-plain":
145
- return { blurScale: 0, borderRadius: t, colorMode: e };
143
+ return { blurScale: 0, borderRadius: t, colorMode: o };
146
144
  case "top-bar":
147
145
  return {
148
146
  blurScale: 0.9,
149
147
  borderRadius: t,
150
- colorMode: e,
151
- overlayColor: r ? "rgba(0, 0, 0, 0.8)" : "rgba(255, 255, 255, 0.8)"
148
+ colorMode: o,
149
+ overlayColor: r ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.8)"
152
150
  };
153
151
  case "promotion-fair":
154
152
  return { blurScale: 0.85, borderRadius: t, colorMode: "light" };
@@ -160,15 +158,16 @@ function J(o, r) {
160
158
  return {
161
159
  blurScale: 0.2,
162
160
  borderRadius: t,
163
- colorMode: e,
164
- backgroundGradient: H(r)
161
+ colorMode: o,
162
+ backgroundGradient: H(r),
163
+ boxShadow: "0 8px 40px rgba(0, 0, 0, 0.12)"
165
164
  };
166
165
  default:
167
- return { blurScale: 0, borderRadius: t, colorMode: e };
166
+ return { blurScale: 0, borderRadius: t, colorMode: o };
168
167
  }
169
168
  }
170
169
  const Y = {
171
- ...j
170
+ ...V
172
171
  };
173
172
  function K() {
174
173
  return ["harmony", "harmonyhybrid", "jdharmony"].includes(
@@ -176,101 +175,98 @@ function K() {
176
175
  );
177
176
  }
178
177
  function Q() {
179
- var o;
178
+ var e;
180
179
  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 };
180
+ const r = h.getSystemInfoSync(), o = String((r == null ? void 0 : r.platform) || "").toLowerCase(), t = String((r == null ? void 0 : r.system) || ""), i = o === "ios", u = i ? parseInt(((e = t.match(/\d+/)) == null ? void 0 : e[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
181
+ return { isIOS: i, iosMajor: u, dark: b };
183
182
  } catch {
184
183
  return { isIOS: !1, iosMajor: 0, dark: !1 };
185
184
  }
186
185
  }
187
186
  function U() {
188
187
  try {
189
- const o = h.getSystemInfoSync();
190
- return String((o == null ? void 0 : o.theme) || "").toLowerCase() === "dark";
188
+ const e = h.getSystemInfoSync();
189
+ return String((e == null ? void 0 : e.theme) || "").toLowerCase() === "dark";
191
190
  } catch {
192
191
  return !1;
193
192
  }
194
193
  }
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 });
194
+ function z(e) {
195
+ const { scene: r, dark: o, overlayColor: t, cls: i, style: u, children: b, rest: g } = e, a = r ? J(r, o) : void 0, s = {};
196
+ a ? (s.blurScale = a.blurScale, s.borderRadius = a.borderRadius, s.colorMode = a.colorMode) : s.colorMode = o ? "dark" : "light", (u == null ? void 0 : u.borderRadius) !== void 0 && (s.borderRadius = parseFloat(String(u.borderRadius)));
197
+ const l = { ...u }, m = t ?? (a == null ? void 0 : a.overlayColor);
198
+ return m && l.backgroundColor === void 0 && (l.backgroundColor = m), a != null && a.backgroundGradient && l.background === void 0 && (l.background = a.backgroundGradient), a != null && a.boxShadow && l.boxShadow === void 0 && (l.boxShadow = a.boxShadow), /* @__PURE__ */ R(M, { className: i, style: l, ...s, ...g, children: b });
200
199
  }
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 });
200
+ function W(e) {
201
+ const { scene: r, dark: o, targetId: t, overlayColor: i, cls: u, style: b, children: g, rest: a } = e, s = r ? E(r, o) : void 0, l = { ...b };
202
+ s && s.blurRadius > 0 && (l.backdropFilter = `blur(${s.blurRadius}px)`), s && l.borderRadius === void 0 && (l.borderRadius = `${s.borderRadius}px`);
203
+ const m = i ?? (s == null ? void 0 : s.tintColor), d = {};
204
+ return t && (d.targetId = t), r && (d.scene = r), m && (d.overlayColor = m), /* @__PURE__ */ R(M, { className: u, style: l, ...d, ...a, children: g });
206
205
  }
207
- const X = (o) => {
206
+ const X = (e) => {
208
207
  const {
209
208
  className: r,
210
- style: e,
209
+ style: o,
211
210
  children: t,
212
- scene: l,
211
+ scene: i,
213
212
  targetId: u,
214
213
  liquidGlass: b,
215
214
  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(
215
+ gradientBlur: a,
216
+ overlayColor: s,
217
+ ...l
218
+ } = { ...Y, ...e }, d = N("nut-jdmaterialview", r), { isIOS: $, iosMajor: S } = w(() => Q(), []), [f, x] = O(() => U()), v = B(
220
219
  (c) => {
221
- const y = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
222
- O(y.toLowerCase() === "dark");
220
+ const p = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
221
+ x(p.toLowerCase() === "dark");
223
222
  },
224
223
  []
225
224
  );
226
- N(() => {
227
- var c, y;
225
+ D(() => {
226
+ var c, p;
228
227
  try {
229
- (y = (c = h).onThemeChange) == null || y.call(c, S);
228
+ (p = (c = h).onThemeChange) == null || p.call(c, v);
230
229
  } catch {
231
230
  }
232
231
  return () => {
233
232
  var G, k;
234
233
  try {
235
- (k = (G = h).offThemeChange) == null || k.call(G, S);
234
+ (k = (G = h).offThemeChange) == null || k.call(G, v);
236
235
  } catch {
237
236
  }
238
237
  };
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);
238
+ }, [v]);
239
+ const n = w(
240
+ () => i ? T(i, f, S) : void 0,
241
+ [i, f, S]
242
+ ), q = b ?? (n == null ? void 0 : n.liquidGlass), L = g ?? (n == null ? void 0 : n.frostedGlass), A = a ?? (n == null ? void 0 : n.gradientBlur);
244
243
  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,
244
+ const c = { ...n == null ? void 0 : n.fallbackStyle, ...o };
245
+ return i && c.borderRadius === void 0 && (c.borderRadius = `${_(i, S)}px`), /* @__PURE__ */ R(
246
+ j,
248
247
  {
249
248
  className: d,
250
249
  style: c,
251
250
  liquidGlass: q,
252
251
  frostedGlass: L,
253
252
  gradientBlur: A,
254
- ...i,
253
+ ...l,
255
254
  children: t
256
255
  }
257
256
  );
258
257
  }
259
- return K() ? z({ scene: l, dark: f, overlayColor: a, cls: d, style: e, children: t, rest: i }) : W({
260
- scene: l,
258
+ return K() ? z({ scene: i, dark: f, overlayColor: s, cls: d, style: o, children: t, rest: l }) : W({
259
+ scene: i,
261
260
  dark: f,
262
261
  targetId: u,
263
- overlayColor: a,
262
+ overlayColor: s,
264
263
  cls: d,
265
- style: e,
264
+ style: o,
266
265
  children: t,
267
- rest: i
266
+ rest: l
268
267
  });
269
268
  };
270
269
  X.displayName = "NutJDMaterialView";
271
270
  export {
272
- X as J,
273
- E as a,
274
- V as b,
275
- _ as g
271
+ X as J
276
272
  };
@@ -0,0 +1,4 @@
1
+ export { default as JDMaterialView } from './packages/jdmaterialview/index.taro';
2
+ export { default as JDMaterialsBlurTarget } from './packages/jdmaterialsblurtarget/index.taro';
3
+ export type { JDMaterialViewProps, MaterialScene } from './packages/jdmaterialview/index.taro';
4
+ export type { JDMaterialsBlurTargetProps } from './packages/jdmaterialsblurtarget/index.taro';
@@ -0,0 +1,3 @@
1
+ import { JDMaterialsBlurTarget } from './jdmaterialsblurtarget';
2
+ export type { JDMaterialsBlurTargetProps } from './types';
3
+ export default JDMaterialsBlurTarget;
@@ -0,0 +1,3 @@
1
+ import { JDMaterialsBlurTarget } from './jdmaterialsblurtarget.taro';
2
+ export type { JDMaterialsBlurTargetProps } from './types';
3
+ export default JDMaterialsBlurTarget;
@@ -0,0 +1,3 @@
1
+ import React, { FunctionComponent } from 'react';
2
+ import { JDMaterialsBlurTargetProps } from './types';
3
+ export declare const JDMaterialsBlurTarget: FunctionComponent<Partial<JDMaterialsBlurTargetProps> & Pick<JDMaterialsBlurTargetProps, 'blurId'> & React.HTMLAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import React, { FunctionComponent } from 'react';
2
+ import { JDMaterialsBlurTargetProps } from './types';
3
+ export declare const JDMaterialsBlurTarget: FunctionComponent<Partial<JDMaterialsBlurTargetProps> & Pick<JDMaterialsBlurTargetProps, 'blurId'> & React.HTMLAttributes<HTMLDivElement>>;
@@ -0,0 +1,5 @@
1
+ import { BasicComponent } from '@/utils/typings';
2
+ export interface JDMaterialsBlurTargetProps extends BasicComponent {
3
+ /** 模糊源 ID,与 JDMaterialView 的 targetId 一一对应 */
4
+ blurId: string;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { JDMaterialView } from './jdmaterialview';
2
+ export type { JDMaterialViewProps, MaterialScene, LiquidGlassConfig, FrostedGlassConfig, GradientBlurConfig, } from './types';
3
+ export { getPreset, getCornerRadius, getFrostedPreset } from './scene-presets';
4
+ export default JDMaterialView;
@@ -0,0 +1,3 @@
1
+ import { JDMaterialView } from './jdmaterialview.taro';
2
+ export type { JDMaterialViewProps, MaterialScene } from './types';
3
+ export default JDMaterialView;
@@ -0,0 +1,3 @@
1
+ import React, { FunctionComponent } from "react";
2
+ import { JDMaterialViewProps } from "./types";
3
+ export declare const JDMaterialView: FunctionComponent<Partial<JDMaterialViewProps> & Pick<JDMaterialViewProps, 'targetId'> & React.HTMLAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import React, { FunctionComponent } from "react";
2
+ import { JDMaterialViewProps } from "./types";
3
+ export declare const JDMaterialView: FunctionComponent<JDMaterialViewProps & React.HTMLAttributes<HTMLDivElement>>;
@@ -0,0 +1,46 @@
1
+ import type { MaterialScene } from './types';
2
+ /**
3
+ * 解析场景材质预设。
4
+ * @param scene 材质场景
5
+ * @param dark 是否暗色(已由 theme 解析)
6
+ * @param iosMajor iOS 主版本号(非 iOS 或解析失败传 0;用于液态玻璃场景的 <26 回退)
7
+ */
8
+ export declare function getPreset(scene: MaterialScene, dark: boolean, iosMajor: number): MaterialPreset;
9
+ /**
10
+ * 解析场景默认圆角(业务未传 borderRadius 时使用)。
11
+ * 对齐 ObjC JDGlassContainerView 的 effectiveCornerRadius:
12
+ * - 背板(top-bar / bottom-bar)恒 0;
13
+ * - top 容器 iOS≥26 用玻璃时 12,<26 回退 8;
14
+ * - top-plain 透明回退时 <26 归 0(透明无背景,圆角无意义)。
15
+ * @param scene 材质场景
16
+ * @param iosMajor iOS 主版本号(<26 走回退圆角)
17
+ */
18
+ export declare function getCornerRadius(scene: MaterialScene, iosMajor: number): number;
19
+ /**
20
+ * 非 iOS(安卓 / 鸿蒙)场景圆角。安卓与鸿蒙圆角完全一致,共用此函数(设计已对齐):
21
+ * - 悬浮容器(top-solid / top-plain / promotion-fair / promotion-deep / immersive):8
22
+ * - 背板(top-bar / bottom-bar):0
23
+ * 日夜一致、与平台/版本无关。iOS 圆角另走 getCornerRadius(按版本回退,规则不同)。
24
+ * @param scene 材质场景
25
+ */
26
+ export declare function getNonIOSCornerRadius(scene: MaterialScene): number;
27
+ /**
28
+ * 解析非 iOS 场景毛玻璃预设。
29
+ * 对齐安卓 GlassStyle:blurRadius + borderRadius + 叠加色(tintColor = rgba(overlayRGB, alpha%))。
30
+ * 圆角为安卓专用:每场景定值、日夜一致、与 iOS 版本无关(bottom-bar 为 0,其余 12),
31
+ * 不复用 iOS 的 getCornerRadius(后者按版本回退且 top-bar 恒 0,规则不同)。
32
+ * @param scene 材质场景
33
+ * @param dark 是否暗色(已由 theme 解析)
34
+ */
35
+ export declare function getFrostedPreset(scene: MaterialScene, dark: boolean): FrostedPreset;
36
+ /**
37
+ * 解析鸿蒙场景预设。blurScale / borderRadius / colorMode 透传鸿蒙原生 prop;
38
+ * overlayColor 落 CSS style.backgroundColor(非原生属性)。
39
+ * colorMode 由「场景」决定,而非简单跟随系统:
40
+ * - promotion-fair / promotion-deep 恒 light;immersive 恒 dark;
41
+ * - 其余场景(top-solid / top-plain / top-bar / bottom-bar)跟随系统明暗。
42
+ * overlayColor 仅 top-solid 有(随明暗),其余场景颜色靠 colorMode 控制。
43
+ * @param scene 材质场景
44
+ * @param dark 是否暗色(已由 theme 解析,用于跟随系统的场景)
45
+ */
46
+ export declare function getHarmonyPreset(scene: MaterialScene, dark: boolean): HarmonyPreset;
@@ -0,0 +1,20 @@
1
+ import { BasicComponent } from '@/utils/typings';
2
+ /** 材质场景(7 种,业务按场景选用):
3
+ * - top-solid 浅色背景悬浮容器
4
+ * - top-plain 白色背景悬浮容器
5
+ * - top-bar 吸顶背板
6
+ * - promotion-fair 浅色换肤悬浮容器
7
+ * - promotion-deep 深色换肤悬浮容器
8
+ * - immersive 沉浸式悬浮容器
9
+ * - bottom-bar 底部导航背板
10
+ */
11
+ export type MaterialScene = 'top-solid' | 'top-plain' | 'top-bar' | 'promotion-fair' | 'promotion-deep' | 'immersive' | 'bottom-bar';
12
+ /**
13
+ * JDMaterialView 属性
14
+ */
15
+ export interface JDMaterialViewProps extends BasicComponent {
16
+ /** 材质场景,7 种见 MaterialScene */
17
+ scene: MaterialScene;
18
+ /** 模糊源 targetId,与 JDMaterialsBlurTarget 的 blurId 对应 */
19
+ targetId: string;
20
+ }
@@ -0,0 +1,11 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ export interface BasicComponent {
3
+ className?: string;
4
+ style?: CSSProperties;
5
+ children?: ReactNode;
6
+ id?: string;
7
+ }
8
+ export declare const ComponentDefaults: {
9
+ className: string;
10
+ style: {};
11
+ };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@nutui/taro-biz",
3
- "version": "0.0.1-alpha.14",
3
+ "version": "0.0.1-alpha.16",
4
4
  "main": "dist/cjs/index/index.js",
5
5
  "module": "dist/es/index/index.js",
6
+ "types": "dist/es/index/index.d.ts",
6
7
  "sideEffects": [
7
8
  "*.scss",
8
9
  "dist/es/**/style/*",
@@ -80,14 +81,17 @@
80
81
  },
81
82
  "exports": {
82
83
  ".": {
84
+ "types": "./dist/es/index/index.d.ts",
83
85
  "import": "./dist/es/index/index.js",
84
86
  "require": "./dist/cjs/index/index.js"
85
87
  },
86
88
  "./JDMaterialView": {
89
+ "types": "./dist/es/jdmaterialview/index.d.ts",
87
90
  "import": "./dist/es/jdmaterialview/index.js",
88
91
  "require": "./dist/cjs/jdmaterialview/index.js"
89
92
  },
90
93
  "./JDMaterialsBlurTarget": {
94
+ "types": "./dist/es/jdmaterialsblurtarget/index.d.ts",
91
95
  "import": "./dist/es/jdmaterialsblurtarget/index.js",
92
96
  "require": "./dist/cjs/jdmaterialsblurtarget/index.js"
93
97
  }
@@ -1 +0,0 @@
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;