@nutui/taro-biz 0.0.1-alpha.5 → 0.0.1-alpha.6
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-D-LTIRx9.js → jdmaterialview.taro-CLUi2aY4.js} +1 -1
- package/dist/es/index/index.js +1 -1
- package/dist/es/jdmaterialview/index.js +2 -2
- package/dist/es/{jdmaterialview.taro-DEhWyIau.mjs → jdmaterialview.taro-BWSx9nXx.mjs} +27 -26
- package/package.json +1 -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-CLUi2aY4.js"),r=require("../jdmaterialsblurtarget.taro-B8SyDQOM.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-CLUi2aY4.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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;
|
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-BWSx9nXx.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-BWSx9nXx.mjs";
|
|
3
3
|
export {
|
|
4
4
|
r as default,
|
|
5
5
|
s as getCornerRadius,
|
|
@@ -6,8 +6,8 @@ import { View as I } from "@tarojs/components";
|
|
|
6
6
|
import { JDIOSMaterialView as T } from "@jdtaro/ui";
|
|
7
7
|
import { C as J } from "./typings-CdeuPEKG.mjs";
|
|
8
8
|
const O = 26;
|
|
9
|
-
function V(t, r,
|
|
10
|
-
const i =
|
|
9
|
+
function V(t, r, s) {
|
|
10
|
+
const i = s >= O;
|
|
11
11
|
switch (t) {
|
|
12
12
|
case "top-solid":
|
|
13
13
|
return i ? {
|
|
@@ -62,18 +62,18 @@ function V(t, r, a) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
function or(t, r) {
|
|
65
|
-
const
|
|
65
|
+
const s = r >= O;
|
|
66
66
|
switch (t) {
|
|
67
67
|
case "top-bar":
|
|
68
68
|
case "bottom-bar":
|
|
69
69
|
return 0;
|
|
70
70
|
case "top-plain":
|
|
71
|
-
return
|
|
71
|
+
return s ? 12 : 0;
|
|
72
72
|
case "top-solid":
|
|
73
73
|
case "promotion-fair":
|
|
74
74
|
case "promotion-deep":
|
|
75
75
|
case "immersive":
|
|
76
|
-
return
|
|
76
|
+
return s ? 12 : 8;
|
|
77
77
|
default:
|
|
78
78
|
return 0;
|
|
79
79
|
}
|
|
@@ -140,14 +140,14 @@ function W(t) {
|
|
|
140
140
|
return t.style.startsWith("thin") ? 10 : t.style.startsWith("thick") ? 40 : 20;
|
|
141
141
|
}
|
|
142
142
|
function Y(t) {
|
|
143
|
-
const r = {},
|
|
144
|
-
return
|
|
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
145
|
}
|
|
146
146
|
function K() {
|
|
147
147
|
var t;
|
|
148
148
|
try {
|
|
149
|
-
const r = y.getSystemInfoSync(),
|
|
150
|
-
return { isIOS:
|
|
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
151
|
} catch {
|
|
152
152
|
return { isIOS: !1, iosMajor: 0, dark: !1 };
|
|
153
153
|
}
|
|
@@ -163,9 +163,9 @@ function Q() {
|
|
|
163
163
|
const U = (t) => {
|
|
164
164
|
const {
|
|
165
165
|
className: r,
|
|
166
|
-
style:
|
|
166
|
+
style: s,
|
|
167
167
|
children: i,
|
|
168
|
-
scene:
|
|
168
|
+
scene: o,
|
|
169
169
|
targetId: c,
|
|
170
170
|
liquidGlass: g,
|
|
171
171
|
frostedGlass: A,
|
|
@@ -174,14 +174,15 @@ const U = (t) => {
|
|
|
174
174
|
...p
|
|
175
175
|
} = { ...E, ...t }, h = P("nut-jdmaterialview", r), { isIOS: L, iosMajor: R } = w(() => K(), []), [m, B] = D(() => Q()), v = M(
|
|
176
176
|
(e) => {
|
|
177
|
-
|
|
177
|
+
const a = typeof e == "string" ? e : String((e == null ? void 0 : e.theme) || "");
|
|
178
|
+
B(a.toLowerCase() === "dark");
|
|
178
179
|
},
|
|
179
180
|
[]
|
|
180
181
|
);
|
|
181
182
|
$(() => {
|
|
182
|
-
var e,
|
|
183
|
+
var e, a;
|
|
183
184
|
try {
|
|
184
|
-
(
|
|
185
|
+
(a = (e = y).onThemeChange) == null || a.call(e, v);
|
|
185
186
|
} catch {
|
|
186
187
|
}
|
|
187
188
|
return () => {
|
|
@@ -192,12 +193,12 @@ const U = (t) => {
|
|
|
192
193
|
}
|
|
193
194
|
};
|
|
194
195
|
}, [v]);
|
|
195
|
-
const
|
|
196
|
-
() =>
|
|
197
|
-
[
|
|
198
|
-
), N = g ?? (
|
|
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);
|
|
199
200
|
if (L) {
|
|
200
|
-
const e = { ...
|
|
201
|
+
const e = { ...l == null ? void 0 : l.fallbackStyle, ...s };
|
|
201
202
|
return /* @__PURE__ */ S(
|
|
202
203
|
T,
|
|
203
204
|
{
|
|
@@ -212,20 +213,20 @@ const U = (t) => {
|
|
|
212
213
|
);
|
|
213
214
|
}
|
|
214
215
|
if (H()) {
|
|
215
|
-
const e =
|
|
216
|
-
e && (
|
|
216
|
+
const e = o ? _(o, m) : void 0, a = {};
|
|
217
|
+
e && (a.blurScale = e.blurScale, a.borderRadius = e.borderRadius), a.colorMode = m ? "dark" : "light";
|
|
217
218
|
const b = G ?? (e == null ? void 0 : e.overlayColor);
|
|
218
|
-
return b && (
|
|
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 });
|
|
219
220
|
}
|
|
220
221
|
const x = (() => {
|
|
221
|
-
const e = { ...
|
|
222
|
+
const e = { ...s };
|
|
222
223
|
if (n) {
|
|
223
|
-
const
|
|
224
|
-
e.backdropFilter = `blur(${
|
|
224
|
+
const a = W(n);
|
|
225
|
+
e.backdropFilter = `blur(${a}px)`, n.alpha !== void 0 && (e.opacity = n.alpha);
|
|
225
226
|
} else d && Object.assign(e, Y(d));
|
|
226
227
|
return e;
|
|
227
228
|
})(), F = G ?? (n ? n.style.endsWith("-dark") ? "rgba(0, 0, 0, 0.3)" : "rgba(255, 255, 255, 0.3)" : void 0), u = {};
|
|
228
|
-
return u.targetId = c,
|
|
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 });
|
|
229
230
|
};
|
|
230
231
|
U.displayName = "NutJDMaterialView";
|
|
231
232
|
export {
|