@nutui/taro-biz 0.0.1-alpha.33 → 0.0.1-alpha.35
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.
- package/dist/cjs/index/index.js +1 -1
- package/dist/cjs/jdmaterialview/index.js +1 -1
- package/dist/cjs/jdmaterialview.taro-DfvZeyCN.js +1 -0
- package/dist/es/index/index.js +1 -1
- package/dist/es/jdmaterialview/index.js +2 -2
- package/dist/es/{jdmaterialview.taro-jg4ylH3W.mjs → jdmaterialview.taro-Bq67PAmj.mjs} +73 -74
- package/dist/types/packages/jdmaterialview/types.d.ts +6 -3
- package/package.json +1 -1
- package/dist/cjs/jdmaterialview.taro-CTKkSFVC.js +0 -1
package/dist/cjs/index/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jdmaterialview.taro-DfvZeyCN.js"),r=require("../jdmaterialsblurtarget.taro-Cqye9b32.js");exports.JDMaterialView=e.JDMaterialView;exports.JDMaterialsBlurTarget=r.JDMaterialsBlurTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jdmaterialview.taro-DfvZeyCN.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const B=require("react/jsx-runtime"),h=require("react"),to=require("classnames"),g=require("@tarojs/taro"),L=require("@jdtaro/ui"),eo=require("./typings-DP_XKs5o.js"),W=26,F="0 4px 2px 0 rgba(0, 0, 0, 0.05)",J="0 4px 8px 0 rgba(0, 0, 0, 0.05)",ao="0 -8px 4px 0 rgba(0, 0, 0, 0.12)",so="0 -8px 4px 0 rgba(31, 34, 38, 0.5)";function K(r,o,t){const e=t>=W;switch(r){case"top-solid":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:o,...o?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:F}:{fallbackStyle:{backgroundColor:o?"#2A2F36":"#FFFFFF"}};case"top-plain":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:o,...o?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:F}:{};case"top-bar":return{frostedGlass:{style:o?"regular-dark":"ultra-thin-light",tintColor:o?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.75)"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:o?"regular-dark":"ultra-thin-light",tintColor:o?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.85)"},...e?{boxShadow:J}:{}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:"ultra-thin-light",alpha:1},...e?{boxShadow:J}:{}};case"immersive":return e?{liquidGlass:{style:"regular",darkMode:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.05)"},boxShadow:F}:{frostedGlass:{style:"regular-dark",alpha:1}};case"bottom-bar":return{gradientBlur:{minBlur:.5,maxBlur:.8,overlayAlpha:.9,overlayColor:o?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)"},boxShadow:o?so:ao};default:return{}}}function Y(r,o){const t=o>=W;switch(r){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}}function Q(r){switch(r){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 I="255, 255, 255",_="31, 34, 38";function U(r,o){const t=Q(r);switch(r){case"top-solid":return{blurRadius:40,borderRadius:t,tintColor:o?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:t};case"top-bar":return{blurRadius:40,borderRadius:t,tintColor:o?`rgba(${_}, 0.9)`:`rgba(${I}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${I}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${I}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:t,tintColor:`rgba(${_}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:t,tintColor:o?`rgba(${_}, 0.8)`:`rgba(${I}, 0.8)`};default:return{blurRadius:40,borderRadius:t}}}function no(r){const o=r?"0, 0, 0":"255, 255, 255";return`linear-gradient(to bottom, rgba(${o}, 0.8) 0%, rgba(${o}, 0.8) 56%, rgba(${o}, 0.78) 66%, rgba(${o}, 0.72) 76%, rgba(${o}, 0.62) 86%, rgba(${o}, 0.49) 94%, rgba(${o}, 0.3) 100%)`}function io(r,o){const t=o?"dark":"light",e=Q(r);switch(r){case"top-solid":return{blurScale:1,borderRadius:e,colorMode:t,overlayColor:o?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:e,colorMode:t};case"top-bar":return{blurScale:.9,borderRadius:e,colorMode:t,overlayColor:o?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.62)"};case"promotion-fair":return{blurScale:.85,borderRadius:e,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:e,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:e,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:e,colorMode:t,backgroundGradient:no(o),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:e,colorMode:t}}}function lo(r,o){const t=/^#?([0-9a-fA-F]{6})$/.exec(r.trim());if(!t)return r;const e=parseInt(t[1],16),i=e>>16&255,a=e>>8&255,b=e&255,f=Math.max(0,Math.min(1,o));return`rgba(${i}, ${a}, ${b}, ${f})`}const co="0px 1px 4px 0px rgba(0, 0, 0, 0.12)",uo={...eo.ComponentDefaults};function bo(){try{const r=g.getSystemInfoSync(),o=String((r==null?void 0:r.platform)||"").toLowerCase(),t=String((r==null?void 0:r.system)||""),e=o==="ios",i=o==="harmony",a=t.match(/(\d+)(?:\.(\d+))?/),b=e?parseInt((a==null?void 0:a[1])||"0",10):0,f=e?parseInt((a==null?void 0:a[2])||"0",10):0,n=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:e,isHarmony:i,iosMajor:b,iosMinor:f,dark:n}}catch{return{isIOS:!1,isHarmony:!1,iosMajor:0,iosMinor:0,dark:!1}}}function go(){try{const r=g.getSystemInfoSync();return String((r==null?void 0:r.theme)||"").toLowerCase()==="dark"}catch{return!1}}function fo(r){const{scene:o,dark:t,overlayColor:e,cls:i,style:a,children:b,rest:f}=r,n=o?io(o,t):void 0,c={};n?(c.blurScale=n.blurScale,c.colorMode=n.colorMode):c.colorMode=t?"dark":"light";const u={...a};(a==null?void 0:a.borderRadius)===void 0&&n&&(u.borderRadius=`${n.borderRadius}px`);const S=e??(n==null?void 0:n.overlayColor);return S&&u.backgroundColor===void 0&&(u.backgroundColor=S),n!=null&&n.backgroundGradient&&u.background===void 0&&(u.background=n.backgroundGradient),n!=null&&n.boxShadow&&u.boxShadow===void 0&&(u.boxShadow=n.boxShadow),B.jsx(L.View,{className:i,style:u,...c,...f,children:b})}function mo(r){const{scene:o,dark:t,targetId:e,overlayColor:i,cls:a,style:b,children:f,rest:n}=r,c=o?U(o,t):void 0,u={...b};c&&c.blurRadius>0&&(u.backdropFilter=`blur(${c.blurRadius}px)`),c&&u.borderRadius===void 0&&(u.borderRadius=`${c.borderRadius}px`);const S=i??(c==null?void 0:c.tintColor),p={};return e&&(p.targetId=e),o&&(p.scene=o),S&&(p.overlayColor=S),B.jsx(L.View,{className:a,style:u,...p,...n,children:f})}const X=r=>{const{className:o,style:t,children:e,scene:i,targetId:a,theme:b="auto",extractTint:f,clipSystemShadow:n=!1,liquidGlass:c,frostedGlass:u,gradientBlur:S,overlayColor:p,id:ho,...T}={...uo,...r},A=to("nut-jdmaterialview",o),{isIOS:v,isHarmony:z,iosMajor:w,iosMinor:P}=h.useMemo(()=>bo(),[]),O=b==="auto",[Z,oo]=h.useState(()=>go()),$=h.useCallback(s=>{const d=typeof s=="string"?s:String((s==null?void 0:s.theme)||"");oo(d.toLowerCase()==="dark")},[]);h.useEffect(()=>{var s;if(O){try{(s=g.onThemeChange)==null||s.call(g,$)}catch{}return()=>{var d;try{(d=g.offThemeChange)==null||d.call(g,$)}catch{}}}},[O,$]);const G=O?Z:b==="dark",l=h.useMemo(()=>i?K(i,G,w):void 0,[i,G,w]),k=c??(l==null?void 0:l.liquidGlass),M=!!f&&(i==="promotion-fair"||i==="promotion-deep"),R=a?`taro_material_${a}`:void 0,[H,ro]=h.useState(void 0),N=h.useCallback(()=>{var x;if(!v||!M||!R||!a)return;const s=g;if(typeof s.getTagById!="function"||!((x=s.JDTheme)!=null&&x.getGlassTintConfig))return;const d=s.getTagById(R),y=s.getTagById(a);d==null||y==null||d<0||y<0||s.JDTheme.getGlassTintConfig({materialTag:d,blurTag:y}).then(m=>{const C=(m==null?void 0:m.data)??m,E=C==null?void 0:C.tintColor,D=C==null?void 0:C.tintAlpha;!E||!D||D<=0||ro(lo(E,D))}).catch(()=>{})},[v,M,i,R,a]);h.useEffect(()=>{!v||!M||g.nextTick(()=>N())},[v,M,G,N,i,a]);const q=k&&H?{...k,tintColor:H}:k,j=u??(l==null?void 0:l.frostedGlass),V=S??(l==null?void 0:l.gradientBlur);if(v){const s={...l==null?void 0:l.fallbackStyle,...t};i&&s.borderRadius===void 0&&(s.borderRadius=`${Y(i,w)}px`);const d=w>=26,y=d&&!!q,x=y&&n&&w===26&&P>=3&&P<=5;y?x?s.boxShadow===void 0&&(s.boxShadow=co):delete s.boxShadow:l!=null&&l.boxShadow&&s.boxShadow===void 0&&(s.boxShadow=l.boxShadow);let m;return d&&q?(m={liquidGlass:{...q,useCustomShadow:x}},x&&(s.overflow="hidden")):j?m={frostedGlass:j}:V&&(m={gradientBlur:V}),B.jsx(L.JDIOSMaterialView,{id:R,className:A,style:s,targetId:a,materialConfig:m,...T,children:e})}return z?fo({scene:i,dark:G,overlayColor:p,cls:A,style:t,children:e,rest:T}):mo({scene:i,dark:G,targetId:a,overlayColor:p,cls:A,style:t,children:e,rest:T})};X.displayName="NutJDMaterialView";exports.JDMaterialView=X;exports.getCornerRadius=Y;exports.getFrostedPreset=U;exports.getPreset=K;
|
package/dist/es/index/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as r } from "../jdmaterialview.taro-
|
|
2
|
-
import { g as s, a as o, b as g } from "../jdmaterialview.taro-
|
|
1
|
+
import { J as r } from "../jdmaterialview.taro-Bq67PAmj.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-Bq67PAmj.mjs";
|
|
3
3
|
export {
|
|
4
4
|
r as default,
|
|
5
5
|
s as getCornerRadius,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as V, useState as j, useCallback as E, useEffect as W } from "react";
|
|
3
3
|
import ro from "classnames";
|
|
4
|
-
import
|
|
4
|
+
import x from "@tarojs/taro";
|
|
5
5
|
import { JDIOSMaterialView as to, View as Y } from "@jdtaro/ui";
|
|
6
6
|
import { C as eo } from "./typings-CdeuPEKG.mjs";
|
|
7
|
-
const Q = 26,
|
|
7
|
+
const Q = 26, _ = "0 4px 2px 0 rgba(0, 0, 0, 0.05)", K = "0 4px 8px 0 rgba(0, 0, 0, 0.05)", ao = "0 -8px 4px 0 rgba(0, 0, 0, 0.12)", so = "0 -8px 4px 0 rgba(31, 34, 38, 0.5)";
|
|
8
8
|
function no(r, o, t) {
|
|
9
9
|
const e = t >= Q;
|
|
10
10
|
switch (r) {
|
|
@@ -16,7 +16,7 @@ function no(r, o, t) {
|
|
|
16
16
|
darkMode: o,
|
|
17
17
|
...o ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
18
18
|
},
|
|
19
|
-
boxShadow:
|
|
19
|
+
boxShadow: _
|
|
20
20
|
} : { fallbackStyle: { backgroundColor: o ? "#2A2F36" : "#FFFFFF" } };
|
|
21
21
|
case "top-plain":
|
|
22
22
|
return e ? {
|
|
@@ -26,7 +26,7 @@ function no(r, o, t) {
|
|
|
26
26
|
darkMode: o,
|
|
27
27
|
...o ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
28
28
|
},
|
|
29
|
-
boxShadow:
|
|
29
|
+
boxShadow: _
|
|
30
30
|
} : {};
|
|
31
31
|
case "top-bar":
|
|
32
32
|
return {
|
|
@@ -59,7 +59,7 @@ function no(r, o, t) {
|
|
|
59
59
|
interactive: !0,
|
|
60
60
|
tintColor: "rgba(0, 0, 0, 0.05)"
|
|
61
61
|
},
|
|
62
|
-
boxShadow:
|
|
62
|
+
boxShadow: _
|
|
63
63
|
} : { frostedGlass: { style: "regular-dark", alpha: 1 } };
|
|
64
64
|
case "bottom-bar":
|
|
65
65
|
return {
|
|
@@ -108,7 +108,7 @@ function U(r) {
|
|
|
108
108
|
return 0;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
const R = "255, 255, 255",
|
|
111
|
+
const R = "255, 255, 255", F = "31, 34, 38";
|
|
112
112
|
function lo(r, o) {
|
|
113
113
|
const t = U(r);
|
|
114
114
|
switch (r) {
|
|
@@ -124,19 +124,19 @@ function lo(r, o) {
|
|
|
124
124
|
return {
|
|
125
125
|
blurRadius: 40,
|
|
126
126
|
borderRadius: t,
|
|
127
|
-
tintColor: o ? `rgba(${
|
|
127
|
+
tintColor: o ? `rgba(${F}, 0.9)` : `rgba(${R}, 0.9)`
|
|
128
128
|
};
|
|
129
129
|
case "promotion-fair":
|
|
130
130
|
return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${R}, 0.85)` };
|
|
131
131
|
case "promotion-deep":
|
|
132
132
|
return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${R}, 0.2)` };
|
|
133
133
|
case "immersive":
|
|
134
|
-
return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${
|
|
134
|
+
return { blurRadius: 40, borderRadius: t, tintColor: `rgba(${F}, 0.4)` };
|
|
135
135
|
case "bottom-bar":
|
|
136
136
|
return {
|
|
137
137
|
blurRadius: 50,
|
|
138
138
|
borderRadius: t,
|
|
139
|
-
tintColor: o ? `rgba(${
|
|
139
|
+
tintColor: o ? `rgba(${F}, 0.8)` : `rgba(${R}, 0.8)`
|
|
140
140
|
};
|
|
141
141
|
default:
|
|
142
142
|
return { blurRadius: 40, borderRadius: t };
|
|
@@ -186,43 +186,43 @@ function uo(r, o) {
|
|
|
186
186
|
function bo(r, o) {
|
|
187
187
|
const t = /^#?([0-9a-fA-F]{6})$/.exec(r.trim());
|
|
188
188
|
if (!t) return r;
|
|
189
|
-
const e = parseInt(t[1], 16), i = e >> 16 & 255, a = e >> 8 & 255, b = e & 255,
|
|
190
|
-
return `rgba(${i}, ${a}, ${b}, ${
|
|
189
|
+
const e = parseInt(t[1], 16), i = e >> 16 & 255, a = e >> 8 & 255, b = e & 255, g = Math.max(0, Math.min(1, o));
|
|
190
|
+
return `rgba(${i}, ${a}, ${b}, ${g})`;
|
|
191
191
|
}
|
|
192
|
-
const go = {
|
|
192
|
+
const go = "0px 1px 4px 0px rgba(0, 0, 0, 0.12)", mo = {
|
|
193
193
|
...eo
|
|
194
194
|
};
|
|
195
|
-
function
|
|
195
|
+
function fo() {
|
|
196
196
|
try {
|
|
197
|
-
const r =
|
|
198
|
-
return { isIOS: e, isHarmony: i, iosMajor: b, iosMinor:
|
|
197
|
+
const r = x.getSystemInfoSync(), o = String((r == null ? void 0 : r.platform) || "").toLowerCase(), t = String((r == null ? void 0 : r.system) || ""), e = o === "ios", i = o === "harmony", a = t.match(/(\d+)(?:\.(\d+))?/), b = e ? parseInt((a == null ? void 0 : a[1]) || "0", 10) : 0, g = e ? parseInt((a == null ? void 0 : a[2]) || "0", 10) : 0, n = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
|
|
198
|
+
return { isIOS: e, isHarmony: i, iosMajor: b, iosMinor: g, dark: n };
|
|
199
199
|
} catch {
|
|
200
200
|
return { isIOS: !1, isHarmony: !1, iosMajor: 0, iosMinor: 0, dark: !1 };
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function po() {
|
|
204
204
|
try {
|
|
205
|
-
const r =
|
|
205
|
+
const r = x.getSystemInfoSync();
|
|
206
206
|
return String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
|
|
207
207
|
} catch {
|
|
208
208
|
return !1;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
function ho(r) {
|
|
212
|
-
const { scene: o, dark: t, overlayColor: e, cls: i, style: a, children: b, rest:
|
|
213
|
-
|
|
212
|
+
const { scene: o, dark: t, overlayColor: e, cls: i, style: a, children: b, rest: g } = r, n = o ? uo(o, t) : void 0, c = {};
|
|
213
|
+
n ? (c.blurScale = n.blurScale, c.colorMode = n.colorMode) : c.colorMode = t ? "dark" : "light";
|
|
214
214
|
const u = { ...a };
|
|
215
|
-
(a == null ? void 0 : a.borderRadius) === void 0 &&
|
|
216
|
-
const h = e ?? (
|
|
217
|
-
return h && u.backgroundColor === void 0 && (u.backgroundColor = h),
|
|
215
|
+
(a == null ? void 0 : a.borderRadius) === void 0 && n && (u.borderRadius = `${n.borderRadius}px`);
|
|
216
|
+
const h = e ?? (n == null ? void 0 : n.overlayColor);
|
|
217
|
+
return h && u.backgroundColor === void 0 && (u.backgroundColor = h), n != null && n.backgroundGradient && u.background === void 0 && (u.background = n.backgroundGradient), n != null && n.boxShadow && u.boxShadow === void 0 && (u.boxShadow = n.boxShadow), /* @__PURE__ */ B(Y, { className: i, style: u, ...c, ...g, children: b });
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
const { scene: o, dark: t, targetId: e, overlayColor: i, cls: a, style: b, children:
|
|
219
|
+
function So(r) {
|
|
220
|
+
const { scene: o, dark: t, targetId: e, overlayColor: i, cls: a, style: b, children: g, rest: n } = r, c = o ? lo(o, t) : void 0, u = { ...b };
|
|
221
221
|
c && c.blurRadius > 0 && (u.backdropFilter = `blur(${c.blurRadius}px)`), c && u.borderRadius === void 0 && (u.borderRadius = `${c.borderRadius}px`);
|
|
222
|
-
const h = i ?? (c == null ? void 0 : c.tintColor),
|
|
223
|
-
return e && (
|
|
222
|
+
const h = i ?? (c == null ? void 0 : c.tintColor), S = {};
|
|
223
|
+
return e && (S.targetId = e), o && (S.scene = o), h && (S.overlayColor = h), /* @__PURE__ */ B(Y, { className: a, style: u, ...S, ...n, children: g });
|
|
224
224
|
}
|
|
225
|
-
const
|
|
225
|
+
const yo = (r) => {
|
|
226
226
|
const {
|
|
227
227
|
className: o,
|
|
228
228
|
style: t,
|
|
@@ -230,92 +230,91 @@ const So = (r) => {
|
|
|
230
230
|
scene: i,
|
|
231
231
|
targetId: a,
|
|
232
232
|
theme: b = "auto",
|
|
233
|
-
extractTint:
|
|
234
|
-
clipSystemShadow:
|
|
233
|
+
extractTint: g,
|
|
234
|
+
clipSystemShadow: n = !1,
|
|
235
235
|
liquidGlass: c,
|
|
236
236
|
frostedGlass: u,
|
|
237
237
|
gradientBlur: h,
|
|
238
|
-
overlayColor:
|
|
239
|
-
id:
|
|
238
|
+
overlayColor: S,
|
|
239
|
+
id: xo,
|
|
240
240
|
...T
|
|
241
|
-
} = { ...
|
|
242
|
-
(
|
|
243
|
-
const d = typeof
|
|
241
|
+
} = { ...mo, ...r }, I = ro("nut-jdmaterialview", o), { isIOS: C, isHarmony: X, iosMajor: v, iosMinor: L } = V(() => fo(), []), A = b === "auto", [z, Z] = j(() => po()), O = E(
|
|
242
|
+
(s) => {
|
|
243
|
+
const d = typeof s == "string" ? s : String((s == null ? void 0 : s.theme) || "");
|
|
244
244
|
Z(d.toLowerCase() === "dark");
|
|
245
245
|
},
|
|
246
246
|
[]
|
|
247
247
|
);
|
|
248
248
|
W(() => {
|
|
249
|
-
var
|
|
250
|
-
if (
|
|
249
|
+
var s, d;
|
|
250
|
+
if (A) {
|
|
251
251
|
try {
|
|
252
|
-
(d = (
|
|
252
|
+
(d = (s = x).onThemeChange) == null || d.call(s, O);
|
|
253
253
|
} catch {
|
|
254
254
|
}
|
|
255
255
|
return () => {
|
|
256
|
-
var
|
|
256
|
+
var m, f;
|
|
257
257
|
try {
|
|
258
|
-
(
|
|
258
|
+
(f = (m = x).offThemeChange) == null || f.call(m, O);
|
|
259
259
|
} catch {
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
}, [
|
|
264
|
-
const
|
|
265
|
-
() => i ? no(i,
|
|
266
|
-
[i,
|
|
267
|
-
),
|
|
268
|
-
var
|
|
269
|
-
if (!C || !
|
|
270
|
-
const
|
|
271
|
-
if (typeof
|
|
272
|
-
const d =
|
|
273
|
-
d == null ||
|
|
274
|
-
const
|
|
275
|
-
!J || !
|
|
263
|
+
}, [A, O]);
|
|
264
|
+
const w = A ? z : b === "dark", l = V(
|
|
265
|
+
() => i ? no(i, w, v) : void 0,
|
|
266
|
+
[i, w, v]
|
|
267
|
+
), $ = c ?? (l == null ? void 0 : l.liquidGlass), G = !!g && (i === "promotion-fair" || i === "promotion-deep"), M = a ? `taro_material_${a}` : void 0, [q, oo] = j(void 0), H = E(() => {
|
|
268
|
+
var f;
|
|
269
|
+
if (!C || !G || !M || !a) return;
|
|
270
|
+
const s = x;
|
|
271
|
+
if (typeof s.getTagById != "function" || !((f = s.JDTheme) != null && f.getGlassTintConfig)) return;
|
|
272
|
+
const d = s.getTagById(M), m = s.getTagById(a);
|
|
273
|
+
d == null || m == null || d < 0 || m < 0 || s.JDTheme.getGlassTintConfig({ materialTag: d, blurTag: m }).then((p) => {
|
|
274
|
+
const y = (p == null ? void 0 : p.data) ?? p, J = y == null ? void 0 : y.tintColor, D = y == null ? void 0 : y.tintAlpha;
|
|
275
|
+
!J || !D || D <= 0 || oo(bo(J, D));
|
|
276
276
|
}).catch(() => {
|
|
277
277
|
});
|
|
278
|
-
}, [C,
|
|
278
|
+
}, [C, G, i, M, a]);
|
|
279
279
|
W(() => {
|
|
280
|
-
!C || !
|
|
281
|
-
}, [C,
|
|
282
|
-
const k =
|
|
280
|
+
!C || !G || x.nextTick(() => H());
|
|
281
|
+
}, [C, G, w, H, i, a]);
|
|
282
|
+
const k = $ && q ? { ...$, tintColor: q } : $, P = u ?? (l == null ? void 0 : l.frostedGlass), N = h ?? (l == null ? void 0 : l.gradientBlur);
|
|
283
283
|
if (C) {
|
|
284
|
-
const
|
|
285
|
-
i &&
|
|
286
|
-
const d = !!k &&
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}, d && (n.overflow = "hidden")) : N ? g = { frostedGlass: N } : P && (g = { gradientBlur: P }), /* @__PURE__ */ _(
|
|
284
|
+
const s = { ...l == null ? void 0 : l.fallbackStyle, ...t };
|
|
285
|
+
i && s.borderRadius === void 0 && (s.borderRadius = `${io(i, v)}px`);
|
|
286
|
+
const d = v >= 26, m = d && !!k, f = m && n && v === 26 && L >= 3 && L <= 5;
|
|
287
|
+
m ? f ? s.boxShadow === void 0 && (s.boxShadow = go) : delete s.boxShadow : l != null && l.boxShadow && s.boxShadow === void 0 && (s.boxShadow = l.boxShadow);
|
|
288
|
+
let p;
|
|
289
|
+
return d && k ? (p = {
|
|
290
|
+
liquidGlass: { ...k, useCustomShadow: f }
|
|
291
|
+
}, f && (s.overflow = "hidden")) : P ? p = { frostedGlass: P } : N && (p = { gradientBlur: N }), /* @__PURE__ */ B(
|
|
293
292
|
to,
|
|
294
293
|
{
|
|
295
|
-
id:
|
|
294
|
+
id: M,
|
|
296
295
|
className: I,
|
|
297
|
-
style:
|
|
296
|
+
style: s,
|
|
298
297
|
targetId: a,
|
|
299
|
-
materialConfig:
|
|
298
|
+
materialConfig: p,
|
|
300
299
|
...T,
|
|
301
300
|
children: e
|
|
302
301
|
}
|
|
303
302
|
);
|
|
304
303
|
}
|
|
305
|
-
return
|
|
304
|
+
return X ? ho({ scene: i, dark: w, overlayColor: S, cls: I, style: t, children: e, rest: T }) : So({
|
|
306
305
|
scene: i,
|
|
307
|
-
dark:
|
|
306
|
+
dark: w,
|
|
308
307
|
targetId: a,
|
|
309
|
-
overlayColor:
|
|
308
|
+
overlayColor: S,
|
|
310
309
|
cls: I,
|
|
311
310
|
style: t,
|
|
312
311
|
children: e,
|
|
313
312
|
rest: T
|
|
314
313
|
});
|
|
315
314
|
};
|
|
316
|
-
|
|
315
|
+
yo.displayName = "NutJDMaterialView";
|
|
317
316
|
export {
|
|
318
|
-
|
|
317
|
+
yo as J,
|
|
319
318
|
lo as a,
|
|
320
319
|
no as b,
|
|
321
320
|
io as g
|
|
@@ -32,11 +32,14 @@ export interface JDMaterialViewProps extends BasicComponent {
|
|
|
32
32
|
*/
|
|
33
33
|
extractTint?: boolean;
|
|
34
34
|
/**
|
|
35
|
-
* 仅 iOS 26.3~26.5
|
|
35
|
+
* 仅 iOS 26.3~26.5(含补丁版本)可开启裁剪,其他端不受影响。
|
|
36
36
|
* 默认 false;开启且使用液态玻璃时,将 overflow 设为 hidden,
|
|
37
|
-
*
|
|
37
|
+
* 裁掉系统外阴影,并由玻璃容器消费 style.boxShadow,与普通绘制路径互斥。
|
|
38
|
+
* 未设置 boxShadow 时默认使用 0px 1px 4px 0px rgba(0, 0, 0, 0.12),业务显式设置优先(包括 none)。
|
|
39
|
+
* 会覆盖 style.overflow,
|
|
38
40
|
* 同时裁剪内部越界内容和交互高光;子节点的 overflow: visible 无法绕过。
|
|
39
|
-
*
|
|
41
|
+
* iOS 液态玻璃未开启或不满足版本条件时,忽略业务及场景 boxShadow,仅保留系统玻璃阴影。
|
|
42
|
+
* 业务 overflow 仍保留;非液态玻璃及其他端维持原有阴影逻辑。
|
|
40
43
|
*/
|
|
41
44
|
clipSystemShadow?: boolean;
|
|
42
45
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const _=require("react/jsx-runtime"),f=require("react"),or=require("classnames"),g=require("@tarojs/taro"),L=require("@jdtaro/ui"),er=require("./typings-DP_XKs5o.js"),W=26,D="0 4px 2px 0 rgba(0, 0, 0, 0.05)",E="0 4px 8px 0 rgba(0, 0, 0, 0.05)",ar="0 -8px 4px 0 rgba(0, 0, 0, 0.12)",sr="0 -8px 4px 0 rgba(31, 34, 38, 0.5)";function K(t,r,o){const e=o>=W;switch(t){case"top-solid":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:D}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return e?{liquidGlass:{style:"regular",interactive:!0,darkMode:r,...r?{}:{tintColor:"rgba(255, 255, 255, 0.45)"}},boxShadow:D}:{};case"top-bar":return{frostedGlass:{style:r?"regular-dark":"ultra-thin-light",tintColor:r?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.75)"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:r?"regular-dark":"ultra-thin-light",tintColor:r?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.85)"},...e?{boxShadow:E}:{}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!0},frostedGlass:{style:"ultra-thin-light",alpha:1},...e?{boxShadow:E}:{}};case"immersive":return e?{liquidGlass:{style:"regular",darkMode:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.05)"},boxShadow:D}:{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)"},boxShadow:r?sr:ar};default:return{}}}function Y(t,r){const o=r>=W;switch(t){case"top-bar":case"bottom-bar":return 0;case"top-plain":return o?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return o?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 I="255, 255, 255",B="31, 34, 38";function U(t,r){const o=Q(t);switch(t){case"top-solid":return{blurRadius:40,borderRadius:o,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:0,borderRadius:o};case"top-bar":return{blurRadius:40,borderRadius:o,tintColor:r?`rgba(${B}, 0.9)`:`rgba(${I}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:o,tintColor:`rgba(${I}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:o,tintColor:`rgba(${I}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:o,tintColor:`rgba(${B}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:o,tintColor:r?`rgba(${B}, 0.8)`:`rgba(${I}, 0.8)`};default:return{blurRadius:40,borderRadius:o}}}function nr(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 ir(t,r){const o=r?"dark":"light",e=Q(t);switch(t){case"top-solid":return{blurScale:1,borderRadius:e,colorMode:o,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:e,colorMode:o};case"top-bar":return{blurScale:.9,borderRadius:e,colorMode:o,overlayColor:r?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.62)"};case"promotion-fair":return{blurScale:.85,borderRadius:e,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:e,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:e,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:e,colorMode:o,backgroundGradient:nr(r),boxShadow:"0 8px 40px rgba(0, 0, 0, 0.12)"};default:return{blurScale:0,borderRadius:e,colorMode:o}}}function lr(t,r){const o=/^#?([0-9a-fA-F]{6})$/.exec(t.trim());if(!o)return t;const e=parseInt(o[1],16),i=e>>16&255,a=e>>8&255,b=e&255,m=Math.max(0,Math.min(1,r));return`rgba(${i}, ${a}, ${b}, ${m})`}const cr={...er.ComponentDefaults};function ur(){try{const t=g.getSystemInfoSync(),r=String((t==null?void 0:t.platform)||"").toLowerCase(),o=String((t==null?void 0:t.system)||""),e=r==="ios",i=r==="harmony",a=o.match(/(\d+)(?:\.(\d+))?/),b=e?parseInt((a==null?void 0:a[1])||"0",10):0,m=e?parseInt((a==null?void 0:a[2])||"0",10):0,s=String((t==null?void 0:t.theme)||"").toLowerCase()==="dark";return{isIOS:e,isHarmony:i,iosMajor:b,iosMinor:m,dark:s}}catch{return{isIOS:!1,isHarmony:!1,iosMajor:0,iosMinor:0,dark:!1}}}function dr(){try{const t=g.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function br(t){const{scene:r,dark:o,overlayColor:e,cls:i,style:a,children:b,rest:m}=t,s=r?ir(r,o):void 0,c={};s?(c.blurScale=s.blurScale,c.colorMode=s.colorMode):c.colorMode=o?"dark":"light";const u={...a};(a==null?void 0:a.borderRadius)===void 0&&s&&(u.borderRadius=`${s.borderRadius}px`);const h=e??(s==null?void 0:s.overlayColor);return h&&u.backgroundColor===void 0&&(u.backgroundColor=h),s!=null&&s.backgroundGradient&&u.background===void 0&&(u.background=s.backgroundGradient),s!=null&&s.boxShadow&&u.boxShadow===void 0&&(u.boxShadow=s.boxShadow),_.jsx(L.View,{className:i,style:u,...c,...m,children:b})}function gr(t){const{scene:r,dark:o,targetId:e,overlayColor:i,cls:a,style:b,children:m,rest:s}=t,c=r?U(r,o):void 0,u={...b};c&&c.blurRadius>0&&(u.backdropFilter=`blur(${c.blurRadius}px)`),c&&u.borderRadius===void 0&&(u.borderRadius=`${c.borderRadius}px`);const h=i??(c==null?void 0:c.tintColor),S={};return e&&(S.targetId=e),r&&(S.scene=r),h&&(S.overlayColor=h),_.jsx(L.View,{className:a,style:u,...S,...s,children:m})}const z=t=>{const{className:r,style:o,children:e,scene:i,targetId:a,theme:b="auto",extractTint:m,clipSystemShadow:s=!1,liquidGlass:c,frostedGlass:u,gradientBlur:h,overlayColor:S,id:mr,...T}={...cr,...t},$=or("nut-jdmaterialview",r),{isIOS:C,isHarmony:X,iosMajor:x,iosMinor:P}=f.useMemo(()=>ur(),[]),A=b==="auto",[Z,rr]=f.useState(()=>dr()),O=f.useCallback(n=>{const d=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");rr(d.toLowerCase()==="dark")},[]);f.useEffect(()=>{var n;if(A){try{(n=g.onThemeChange)==null||n.call(g,O)}catch{}return()=>{var d;try{(d=g.offThemeChange)==null||d.call(g,O)}catch{}}}},[A,O]);const v=A?Z:b==="dark",l=f.useMemo(()=>i?K(i,v,x):void 0,[i,v,x]),k=c??(l==null?void 0:l.liquidGlass),M=!!m&&(i==="promotion-fair"||i==="promotion-deep"),R=a?`taro_material_${a}`:void 0,[H,tr]=f.useState(void 0),N=f.useCallback(()=>{var p;if(!C||!M||!R||!a)return;const n=g;if(typeof n.getTagById!="function"||!((p=n.JDTheme)!=null&&p.getGlassTintConfig))return;const d=n.getTagById(R),w=n.getTagById(a);d==null||w==null||d<0||w<0||n.JDTheme.getGlassTintConfig({materialTag:d,blurTag:w}).then(G=>{const y=(G==null?void 0:G.data)??G,J=y==null?void 0:y.tintColor,F=y==null?void 0:y.tintAlpha;!J||!F||F<=0||tr(lr(J,F))}).catch(()=>{})},[C,M,i,R,a]);f.useEffect(()=>{!C||!M||g.nextTick(()=>N())},[C,M,v,N,i,a]);const q=k&&H?{...k,tintColor:H}:k,j=u??(l==null?void 0:l.frostedGlass),V=h??(l==null?void 0:l.gradientBlur);if(C){const n={...l==null?void 0:l.fallbackStyle,...o};i&&n.borderRadius===void 0&&(n.borderRadius=`${Y(i,x)}px`);const d=!!q&&s&&x===26&&P>=3&&P<=5;!d&&(l!=null&&l.boxShadow)&&n.boxShadow===void 0&&(n.boxShadow=l.boxShadow);const w=x>=26;let p;return w&&q?(p={liquidGlass:{...q,useCustomShadow:d}},d&&(n.overflow="hidden")):j?p={frostedGlass:j}:V&&(p={gradientBlur:V}),_.jsx(L.JDIOSMaterialView,{id:R,className:$,style:n,targetId:a,materialConfig:p,...T,children:e})}return X?br({scene:i,dark:v,overlayColor:S,cls:$,style:o,children:e,rest:T}):gr({scene:i,dark:v,targetId:a,overlayColor:S,cls:$,style:o,children:e,rest:T})};z.displayName="NutJDMaterialView";exports.JDMaterialView=z;exports.getCornerRadius=Y;exports.getFrostedPreset=U;exports.getPreset=K;
|