@nutui/taro-biz 0.0.1-alpha.10 → 0.0.1-alpha.11
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-Bsnb_oHs.js → jdmaterialview.taro-RXD5T83X.js} +1 -1
- package/dist/es/index/index.js +1 -1
- package/dist/es/jdmaterialview/index.js +2 -2
- package/dist/es/{jdmaterialview.taro-BVqkdHrB.mjs → jdmaterialview.taro-Dw7B_RU9.mjs} +52 -52
- 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-RXD5T83X.js"),r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.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-RXD5T83X.js");exports.default=e.JDMaterialView;exports.getCornerRadius=e.getCornerRadius;exports.getFrostedPreset=e.getFrostedPreset;exports.getPreset=e.getPreset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const G=require("react/jsx-runtime"),y=require("react"),P=require("classnames"),d=require("@tarojs/taro"),M=require("@tarojs/components"),$=require("@jdtaro/ui"),j=require("./typings-DP_XKs5o.js"),w=26;function F(t,r,e){const s=e>=w;switch(t){case"top-solid":return s?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{fallbackStyle:{backgroundColor:r?"#2A2F36":"#FFFFFF"}};case"top-plain":return s?{liquidGlass:{style:"regular",interactive:!0,tintColor:r?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",showTintOverlay:r}}:{};case"top-bar":return{frostedGlass:{style:r?"thick-dark":"thick-light"}};case"promotion-fair":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:.85}};case"promotion-deep":return{liquidGlass:{style:"clear",interactive:!1},frostedGlass:{style:"thick-light",alpha:.35}};case"immersive":return s?{liquidGlass:{style:"regular",forceDark:!0,interactive:!0,tintColor:"rgba(0, 0, 0, 0.75)"}}:{frostedGlass:{style:"regular-dark",alpha:.4}};case"bottom-bar":return{gradientBlur:{minBlur:.5,maxBlur:.8,overlayAlpha:.9,overlayColor:r?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)"}};default:return{}}}function k(t,r){const e=r>=w;switch(t){case"top-bar":case"bottom-bar":return 0;case"top-plain":return e?12:0;case"top-solid":case"promotion-fair":case"promotion-deep":case"immersive":return e?12:8;default:return 0}}const p="255, 255, 255",C="31, 34, 38";function q(t,r){switch(t){case"top-solid":return{blurRadius:40,borderRadius:12,tintColor:r?"rgba(42, 47, 54, 1)":"rgba(255, 255, 255, 1)"};case"top-plain":return{blurRadius:40,borderRadius:12};case"top-bar":return{blurRadius:40,borderRadius:12,tintColor:r?`rgba(${C}, 0.9)`:`rgba(${p}, 0.9)`};case"promotion-fair":return{blurRadius:40,borderRadius:12,tintColor:`rgba(${p}, 0.85)`};case"promotion-deep":return{blurRadius:40,borderRadius:12,tintColor:`rgba(${p}, 0.2)`};case"immersive":return{blurRadius:40,borderRadius:12,tintColor:`rgba(${C}, 0.4)`};case"bottom-bar":return{blurRadius:50,borderRadius:0,tintColor:r?`rgba(${C}, 0.8)`:`rgba(${p}, 0.8)`};default:return{blurRadius:40,borderRadius:12}}}function N(t,r){const e=r?"dark":"light";switch(t){case"top-solid":return{blurScale:1,borderRadius:8,colorMode:e,overlayColor:r?"#2A2F36":"#FFFFFF"};case"top-plain":return{blurScale:0,borderRadius:8,colorMode:e};case"top-bar":return{blurScale:.9,borderRadius:0,colorMode:e};case"promotion-fair":return{blurScale:.85,borderRadius:8,colorMode:"light"};case"promotion-deep":return{blurScale:.2,borderRadius:8,colorMode:"light"};case"immersive":return{blurScale:.4,borderRadius:8,colorMode:"dark"};case"bottom-bar":return{blurScale:.2,borderRadius:0,colorMode:e};default:return{blurScale:0,borderRadius:0,colorMode:e}}}const V={...j.ComponentDefaults};function B(){return["harmony","harmonyhybrid","jdharmony"].includes(d.getEnv().toLowerCase())}function _(){var t;try{const r=d.getSystemInfoSync(),e=String((r==null?void 0:r.platform)||"").toLowerCase(),s=String((r==null?void 0:r.system)||""),a=e==="ios",u=a?parseInt(((t=s.match(/\d+/))==null?void 0:t[0])||"0",10):0,g=String((r==null?void 0:r.theme)||"").toLowerCase()==="dark";return{isIOS:a,iosMajor:u,dark:g}}catch{return{isIOS:!1,iosMajor:0,dark:!1}}}function E(){try{const t=d.getSystemInfoSync();return String((t==null?void 0:t.theme)||"").toLowerCase()==="dark"}catch{return!1}}function H(t){const{scene:r,dark:e,overlayColor:s,cls:a,style:u,children:g,rest:f}=t,c=r?N(r,e):void 0,o={};c?(o.blurScale=c.blurScale,o.borderRadius=c.borderRadius,o.colorMode=c.colorMode):o.colorMode=e?"dark":"light",(u==null?void 0:u.borderRadius)!==void 0&&(o.borderRadius=parseFloat(String(u.borderRadius)));const l={...u},m=s??(c==null?void 0:c.overlayColor);return m&&l.backgroundColor===void 0&&(l.backgroundColor=m),G.jsx(M.View,{className:a,style:l,...o,...f,children:g})}function J(t){const{scene:r,dark:e,targetId:s,overlayColor:a,cls:u,style:g,children:f,rest:c}=t,o=r?q(r,e):void 0,l={...g};o&&o.blurRadius>0&&(l.backdropFilter=`blur(${o.blurRadius}px)`),o&&l.borderRadius===void 0&&(l.borderRadius=`${o.borderRadius}px`);const m=a??(o==null?void 0:o.tintColor),b={};return s&&(b.targetId=s),r&&(b.scene=r),m&&(b.overlayColor=m),G.jsx(M.View,{className:u,style:l,...b,...c,children:f})}const I=t=>{const{className:r,style:e,children:s,scene:a,targetId:u,liquidGlass:g,frostedGlass:f,gradientBlur:c,overlayColor:o,...l}={...V,...t},b=P("nut-jdmaterialview",r),{isIOS:L,iosMajor:v}=y.useMemo(()=>_(),[]),[h,O]=y.useState(()=>E()),S=y.useCallback(n=>{const R=typeof n=="string"?n:String((n==null?void 0:n.theme)||"");O(R.toLowerCase()==="dark")},[]);y.useEffect(()=>{var n;try{(n=d.onThemeChange)==null||n.call(d,S)}catch{}return()=>{var R;try{(R=d.offThemeChange)==null||R.call(d,S)}catch{}}},[S]);const i=y.useMemo(()=>a?F(a,h,v):void 0,[a,h,v]),x=g??(i==null?void 0:i.liquidGlass),A=f??(i==null?void 0:i.frostedGlass),D=c??(i==null?void 0:i.gradientBlur);if(L){const n={...i==null?void 0:i.fallbackStyle,...e};return a&&n.borderRadius===void 0&&(n.borderRadius=`${k(a,v)}px`),G.jsx($.JDIOSMaterialView,{className:b,style:n,liquidGlass:x,frostedGlass:A,gradientBlur:D,...l,children:s})}return B()?H({scene:a,dark:h,overlayColor:o,cls:b,style:e,children:s,rest:l}):J({scene:a,dark:h,targetId:u,overlayColor:o,cls:b,style:e,children:s,rest:l})};I.displayName="NutJDMaterialView";exports.JDMaterialView=I;exports.getCornerRadius=k;exports.getFrostedPreset=q;exports.getPreset=F;
|
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-Dw7B_RU9.mjs";
|
|
2
|
+
import { g as s, a as o, b as g } from "../jdmaterialview.taro-Dw7B_RU9.mjs";
|
|
3
3
|
export {
|
|
4
4
|
r as default,
|
|
5
5
|
s as getCornerRadius,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as k, useState as
|
|
3
|
-
import
|
|
4
|
-
import h, { getEnv as
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as k, useState as $, useCallback as D, useEffect as x } from "react";
|
|
3
|
+
import N from "classnames";
|
|
4
|
+
import h, { getEnv as P } from "@tarojs/taro";
|
|
5
5
|
import { View as F } from "@tarojs/components";
|
|
6
6
|
import { JDIOSMaterialView as B } from "@jdtaro/ui";
|
|
7
7
|
import { C as T } from "./typings-CdeuPEKG.mjs";
|
|
@@ -61,7 +61,7 @@ function j(o, r, e) {
|
|
|
61
61
|
return {};
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function V(o, r) {
|
|
65
65
|
const e = r >= w;
|
|
66
66
|
switch (o) {
|
|
67
67
|
case "top-bar":
|
|
@@ -78,8 +78,8 @@ function tr(o, r) {
|
|
|
78
78
|
return 0;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const p = "255, 255, 255",
|
|
82
|
-
function
|
|
81
|
+
const p = "255, 255, 255", S = "31, 34, 38";
|
|
82
|
+
function _(o, r) {
|
|
83
83
|
switch (o) {
|
|
84
84
|
case "top-solid":
|
|
85
85
|
return {
|
|
@@ -93,25 +93,25 @@ function V(o, r) {
|
|
|
93
93
|
return {
|
|
94
94
|
blurRadius: 40,
|
|
95
95
|
borderRadius: 12,
|
|
96
|
-
tintColor: r ? `rgba(${
|
|
96
|
+
tintColor: r ? `rgba(${S}, 0.9)` : `rgba(${p}, 0.9)`
|
|
97
97
|
};
|
|
98
98
|
case "promotion-fair":
|
|
99
99
|
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${p}, 0.85)` };
|
|
100
100
|
case "promotion-deep":
|
|
101
101
|
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${p}, 0.2)` };
|
|
102
102
|
case "immersive":
|
|
103
|
-
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${
|
|
103
|
+
return { blurRadius: 40, borderRadius: 12, tintColor: `rgba(${S}, 0.4)` };
|
|
104
104
|
case "bottom-bar":
|
|
105
105
|
return {
|
|
106
106
|
blurRadius: 50,
|
|
107
107
|
borderRadius: 0,
|
|
108
|
-
tintColor: r ? `rgba(${
|
|
108
|
+
tintColor: r ? `rgba(${S}, 0.8)` : `rgba(${p}, 0.8)`
|
|
109
109
|
};
|
|
110
110
|
default:
|
|
111
111
|
return { blurRadius: 40, borderRadius: 12 };
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function E(o, r) {
|
|
115
115
|
const e = r ? "dark" : "light";
|
|
116
116
|
switch (o) {
|
|
117
117
|
case "top-solid":
|
|
@@ -137,24 +137,24 @@ function _(o, r) {
|
|
|
137
137
|
return { blurScale: 0, borderRadius: 0, colorMode: e };
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
const
|
|
140
|
+
const H = {
|
|
141
141
|
...T
|
|
142
142
|
};
|
|
143
|
-
function
|
|
143
|
+
function J() {
|
|
144
144
|
return ["harmony", "harmonyhybrid", "jdharmony"].includes(
|
|
145
|
-
|
|
145
|
+
P().toLowerCase()
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Y() {
|
|
149
149
|
var o;
|
|
150
150
|
try {
|
|
151
|
-
const r = h.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), a = String((r == null ? void 0 : r.system) || ""), s = e === "ios",
|
|
152
|
-
return { isIOS: s, iosMajor:
|
|
151
|
+
const r = h.getSystemInfoSync(), e = String((r == null ? void 0 : r.platform) || "").toLowerCase(), a = String((r == null ? void 0 : r.system) || ""), s = e === "ios", u = s ? parseInt(((o = a.match(/\d+/)) == null ? void 0 : o[0]) || "0", 10) : 0, b = String((r == null ? void 0 : r.theme) || "").toLowerCase() === "dark";
|
|
152
|
+
return { isIOS: s, iosMajor: u, dark: b };
|
|
153
153
|
} catch {
|
|
154
154
|
return { isIOS: !1, iosMajor: 0, dark: !1 };
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function K() {
|
|
158
158
|
try {
|
|
159
159
|
const o = h.getSystemInfoSync();
|
|
160
160
|
return String((o == null ? void 0 : o.theme) || "").toLowerCase() === "dark";
|
|
@@ -162,62 +162,62 @@ function Y() {
|
|
|
162
162
|
return !1;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function K(o) {
|
|
166
|
-
const { scene: r, dark: e, overlayColor: a, cls: s, style: n, children: b, rest: f } = o, u = r ? _(r, e) : void 0, t = {};
|
|
167
|
-
u ? (t.blurScale = u.blurScale, t.borderRadius = u.borderRadius, t.colorMode = u.colorMode) : t.colorMode = e ? "dark" : "light", (n == null ? void 0 : n.borderRadius) !== void 0 && (t.borderRadius = parseFloat(String(n.borderRadius)));
|
|
168
|
-
const l = { ...n }, m = a ?? (u == null ? void 0 : u.overlayColor);
|
|
169
|
-
return m && l.backgroundColor === void 0 && (l.backgroundColor = m), /* @__PURE__ */ S(F, { className: s, style: l, ...t, ...f, children: b });
|
|
170
|
-
}
|
|
171
165
|
function Q(o) {
|
|
172
|
-
const { scene: r, dark: e,
|
|
166
|
+
const { scene: r, dark: e, overlayColor: a, cls: s, style: u, children: b, rest: f } = o, d = r ? E(r, e) : void 0, t = {};
|
|
167
|
+
d ? (t.blurScale = d.blurScale, t.borderRadius = d.borderRadius, t.colorMode = d.colorMode) : t.colorMode = e ? "dark" : "light", (u == null ? void 0 : u.borderRadius) !== void 0 && (t.borderRadius = parseFloat(String(u.borderRadius)));
|
|
168
|
+
const l = { ...u }, m = a ?? (d == null ? void 0 : d.overlayColor);
|
|
169
|
+
return m && l.backgroundColor === void 0 && (l.backgroundColor = m), /* @__PURE__ */ C(F, { className: s, style: l, ...t, ...f, children: b });
|
|
170
|
+
}
|
|
171
|
+
function U(o) {
|
|
172
|
+
const { scene: r, dark: e, targetId: a, overlayColor: s, cls: u, style: b, children: f, rest: d } = o, t = r ? _(r, e) : void 0, l = { ...b };
|
|
173
173
|
t && t.blurRadius > 0 && (l.backdropFilter = `blur(${t.blurRadius}px)`), t && l.borderRadius === void 0 && (l.borderRadius = `${t.borderRadius}px`);
|
|
174
|
-
const m = s ?? (t == null ? void 0 : t.tintColor),
|
|
175
|
-
return a && (
|
|
174
|
+
const m = s ?? (t == null ? void 0 : t.tintColor), c = {};
|
|
175
|
+
return a && (c.targetId = a), r && (c.scene = r), m && (c.overlayColor = m), /* @__PURE__ */ C(F, { className: u, style: l, ...c, ...d, children: f });
|
|
176
176
|
}
|
|
177
|
-
const
|
|
177
|
+
const z = (o) => {
|
|
178
178
|
const {
|
|
179
179
|
className: r,
|
|
180
180
|
style: e,
|
|
181
181
|
children: a,
|
|
182
182
|
scene: s,
|
|
183
|
-
targetId:
|
|
183
|
+
targetId: u,
|
|
184
184
|
liquidGlass: b,
|
|
185
185
|
frostedGlass: f,
|
|
186
|
-
gradientBlur:
|
|
186
|
+
gradientBlur: d,
|
|
187
187
|
overlayColor: t,
|
|
188
188
|
...l
|
|
189
|
-
} = { ...
|
|
190
|
-
(
|
|
191
|
-
const y = typeof
|
|
189
|
+
} = { ...H, ...o }, c = N("nut-jdmaterialview", r), { isIOS: I, iosMajor: R } = k(() => Y(), []), [g, q] = $(() => K()), v = D(
|
|
190
|
+
(n) => {
|
|
191
|
+
const y = typeof n == "string" ? n : String((n == null ? void 0 : n.theme) || "");
|
|
192
192
|
q(y.toLowerCase() === "dark");
|
|
193
193
|
},
|
|
194
194
|
[]
|
|
195
195
|
);
|
|
196
|
-
|
|
197
|
-
var
|
|
196
|
+
x(() => {
|
|
197
|
+
var n, y;
|
|
198
198
|
try {
|
|
199
|
-
(y = (
|
|
199
|
+
(y = (n = h).onThemeChange) == null || y.call(n, v);
|
|
200
200
|
} catch {
|
|
201
201
|
}
|
|
202
202
|
return () => {
|
|
203
203
|
var G, M;
|
|
204
204
|
try {
|
|
205
|
-
(M = (G = h).offThemeChange) == null || M.call(G,
|
|
205
|
+
(M = (G = h).offThemeChange) == null || M.call(G, v);
|
|
206
206
|
} catch {
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
|
-
}, [
|
|
209
|
+
}, [v]);
|
|
210
210
|
const i = k(
|
|
211
|
-
() => s ? j(s, g,
|
|
212
|
-
[s, g,
|
|
213
|
-
), L = b ?? (i == null ? void 0 : i.liquidGlass), O = f ?? (i == null ? void 0 : i.frostedGlass), A =
|
|
211
|
+
() => s ? j(s, g, R) : void 0,
|
|
212
|
+
[s, g, R]
|
|
213
|
+
), L = b ?? (i == null ? void 0 : i.liquidGlass), O = f ?? (i == null ? void 0 : i.frostedGlass), A = d ?? (i == null ? void 0 : i.gradientBlur);
|
|
214
214
|
if (I) {
|
|
215
|
-
const
|
|
216
|
-
return /* @__PURE__ */
|
|
215
|
+
const n = { ...i == null ? void 0 : i.fallbackStyle, ...e };
|
|
216
|
+
return s && n.borderRadius === void 0 && (n.borderRadius = `${V(s, R)}px`), /* @__PURE__ */ C(
|
|
217
217
|
B,
|
|
218
218
|
{
|
|
219
|
-
className:
|
|
220
|
-
style:
|
|
219
|
+
className: c,
|
|
220
|
+
style: n,
|
|
221
221
|
liquidGlass: L,
|
|
222
222
|
frostedGlass: O,
|
|
223
223
|
gradientBlur: A,
|
|
@@ -226,21 +226,21 @@ const U = (o) => {
|
|
|
226
226
|
}
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
|
-
return
|
|
229
|
+
return J() ? Q({ scene: s, dark: g, overlayColor: t, cls: c, style: e, children: a, rest: l }) : U({
|
|
230
230
|
scene: s,
|
|
231
231
|
dark: g,
|
|
232
|
-
targetId:
|
|
232
|
+
targetId: u,
|
|
233
233
|
overlayColor: t,
|
|
234
|
-
cls:
|
|
234
|
+
cls: c,
|
|
235
235
|
style: e,
|
|
236
236
|
children: a,
|
|
237
237
|
rest: l
|
|
238
238
|
});
|
|
239
239
|
};
|
|
240
|
-
|
|
240
|
+
z.displayName = "NutJDMaterialView";
|
|
241
241
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
z as J,
|
|
243
|
+
_ as a,
|
|
244
244
|
j as b,
|
|
245
|
-
|
|
245
|
+
V as g
|
|
246
246
|
};
|