@nutui/taro-biz 0.0.1-alpha.16 → 0.0.1-alpha.18
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/es/index/index.js +1 -1
- package/dist/es/jdmaterialview/index.js +1 -1
- package/dist/es/{jdmaterialview.taro-Di3QqSHi.mjs → jdmaterialview.taro-C86oW55a.mjs} +11 -9
- package/package.json +6 -10
- package/dist/cjs/index/index.d.ts +0 -2
- package/dist/cjs/index/index.js +0 -1
- package/dist/cjs/jdmaterialsblurtarget/index.d.ts +0 -2
- package/dist/cjs/jdmaterialsblurtarget/index.js +0 -1
- package/dist/cjs/jdmaterialsblurtarget.taro-BbcxTuKJ.js +0 -1
- package/dist/cjs/jdmaterialview/index.d.ts +0 -2
- package/dist/cjs/jdmaterialview/index.js +0 -1
- package/dist/cjs/jdmaterialview.taro-D8shGQ46.js +0 -1
- package/dist/cjs/typings-DP_XKs5o.js +0 -1
- package/dist/types/packages/jdmaterialsblurtarget/index.d.ts +0 -3
- package/dist/types/packages/jdmaterialsblurtarget/jdmaterialsblurtarget.d.ts +0 -3
- package/dist/types/packages/jdmaterialview/index.d.ts +0 -4
- package/dist/types/packages/jdmaterialview/jdmaterialview.d.ts +0 -3
package/dist/es/index/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as R } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
2
|
+
import { useMemo as M, useState as O, useCallback as B, useEffect as N } from "react";
|
|
3
|
+
import D from "classnames";
|
|
4
4
|
import h, { getEnv as P } from "@tarojs/taro";
|
|
5
|
-
import { View as
|
|
5
|
+
import { View as w } from "@tarojs/components";
|
|
6
6
|
import { JDIOSMaterialView as j } from "@jdtaro/ui";
|
|
7
7
|
import { C as V } from "./typings-CdeuPEKG.mjs";
|
|
8
8
|
const F = 26;
|
|
@@ -14,6 +14,7 @@ function T(e, r, o) {
|
|
|
14
14
|
liquidGlass: {
|
|
15
15
|
style: "regular",
|
|
16
16
|
interactive: !0,
|
|
17
|
+
darkMode: r,
|
|
17
18
|
...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
18
19
|
}
|
|
19
20
|
} : { fallbackStyle: { backgroundColor: r ? "#2A2F36" : "#FFFFFF" } };
|
|
@@ -22,6 +23,7 @@ function T(e, r, o) {
|
|
|
22
23
|
liquidGlass: {
|
|
23
24
|
style: "regular",
|
|
24
25
|
interactive: !0,
|
|
26
|
+
darkMode: r,
|
|
25
27
|
...r ? {} : { tintColor: "rgba(255, 255, 255, 0.45)" }
|
|
26
28
|
}
|
|
27
29
|
} : {};
|
|
@@ -41,7 +43,7 @@ function T(e, r, o) {
|
|
|
41
43
|
return t ? {
|
|
42
44
|
liquidGlass: {
|
|
43
45
|
style: "regular",
|
|
44
|
-
|
|
46
|
+
darkMode: !0,
|
|
45
47
|
interactive: !0,
|
|
46
48
|
tintColor: "rgba(0, 0, 0, 0.75)"
|
|
47
49
|
}
|
|
@@ -195,13 +197,13 @@ function z(e) {
|
|
|
195
197
|
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
198
|
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
199
|
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(
|
|
200
|
+
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(w, { className: i, style: l, ...s, ...g, children: b });
|
|
199
201
|
}
|
|
200
202
|
function W(e) {
|
|
201
203
|
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
204
|
s && s.blurRadius > 0 && (l.backdropFilter = `blur(${s.blurRadius}px)`), s && l.borderRadius === void 0 && (l.borderRadius = `${s.borderRadius}px`);
|
|
203
205
|
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(
|
|
206
|
+
return t && (d.targetId = t), r && (d.scene = r), m && (d.overlayColor = m), /* @__PURE__ */ R(w, { className: u, style: l, ...d, ...a, children: g });
|
|
205
207
|
}
|
|
206
208
|
const X = (e) => {
|
|
207
209
|
const {
|
|
@@ -215,14 +217,14 @@ const X = (e) => {
|
|
|
215
217
|
gradientBlur: a,
|
|
216
218
|
overlayColor: s,
|
|
217
219
|
...l
|
|
218
|
-
} = { ...Y, ...e }, d =
|
|
220
|
+
} = { ...Y, ...e }, d = D("nut-jdmaterialview", r), { isIOS: $, iosMajor: S } = M(() => Q(), []), [f, x] = O(() => U()), v = B(
|
|
219
221
|
(c) => {
|
|
220
222
|
const p = typeof c == "string" ? c : String((c == null ? void 0 : c.theme) || "");
|
|
221
223
|
x(p.toLowerCase() === "dark");
|
|
222
224
|
},
|
|
223
225
|
[]
|
|
224
226
|
);
|
|
225
|
-
|
|
227
|
+
N(() => {
|
|
226
228
|
var c, p;
|
|
227
229
|
try {
|
|
228
230
|
(p = (c = h).onThemeChange) == null || p.call(c, v);
|
|
@@ -236,7 +238,7 @@ const X = (e) => {
|
|
|
236
238
|
}
|
|
237
239
|
};
|
|
238
240
|
}, [v]);
|
|
239
|
-
const n =
|
|
241
|
+
const n = M(
|
|
240
242
|
() => i ? T(i, f, S) : void 0,
|
|
241
243
|
[i, f, S]
|
|
242
244
|
), q = b ?? (n == null ? void 0 : n.liquidGlass), L = g ?? (n == null ? void 0 : n.frostedGlass), A = a ?? (n == null ? void 0 : n.gradientBlur);
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutui/taro-biz",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
4
|
-
"main": "dist/
|
|
3
|
+
"version": "0.0.1-alpha.18",
|
|
4
|
+
"main": "dist/es/index/index.js",
|
|
5
5
|
"module": "dist/es/index/index.js",
|
|
6
6
|
"types": "dist/es/index/index.d.ts",
|
|
7
7
|
"sideEffects": [
|
|
8
8
|
"*.scss",
|
|
9
|
-
"dist/es/**/style/*"
|
|
10
|
-
"dist/cjs/**/style/*"
|
|
9
|
+
"dist/es/**/style/*"
|
|
11
10
|
],
|
|
12
11
|
"description": "京东主站设计内部组件库",
|
|
13
12
|
"keywords": [
|
|
@@ -82,18 +81,15 @@
|
|
|
82
81
|
"exports": {
|
|
83
82
|
".": {
|
|
84
83
|
"types": "./dist/es/index/index.d.ts",
|
|
85
|
-
"import": "./dist/es/index/index.js"
|
|
86
|
-
"require": "./dist/cjs/index/index.js"
|
|
84
|
+
"import": "./dist/es/index/index.js"
|
|
87
85
|
},
|
|
88
86
|
"./JDMaterialView": {
|
|
89
87
|
"types": "./dist/es/jdmaterialview/index.d.ts",
|
|
90
|
-
"import": "./dist/es/jdmaterialview/index.js"
|
|
91
|
-
"require": "./dist/cjs/jdmaterialview/index.js"
|
|
88
|
+
"import": "./dist/es/jdmaterialview/index.js"
|
|
92
89
|
},
|
|
93
90
|
"./JDMaterialsBlurTarget": {
|
|
94
91
|
"types": "./dist/es/jdmaterialsblurtarget/index.d.ts",
|
|
95
|
-
"import": "./dist/es/jdmaterialsblurtarget/index.js"
|
|
96
|
-
"require": "./dist/cjs/jdmaterialsblurtarget/index.js"
|
|
92
|
+
"import": "./dist/es/jdmaterialsblurtarget/index.js"
|
|
97
93
|
}
|
|
98
94
|
}
|
|
99
95
|
}
|
package/dist/cjs/index/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("../jdmaterialsblurtarget.taro-BbcxTuKJ.js");module.exports=r.JDMaterialsBlurTarget;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("classnames"),u=require("@tarojs/taro"),m=require("@tarojs/components"),d=require("./typings-DP_XKs5o.js"),f={...d.ComponentDefaults};function g(){var r;try{return String(((r=u.getSystemInfoSync())==null?void 0:r.platform)||"").toLowerCase()==="android"}catch{return!1}}const s=r=>{const{className:a,style:n,children:t,blurId:c,...i}={...f,...r};if(!g())return e.jsx(e.Fragment,{children:t});const o=l("nut-jdmaterialsblurtarget",a);return e.jsx(m.View,{className:o,style:n,blurId:c,...i,children:t})};s.displayName="NutJDMaterialsBlurTarget";exports.JDMaterialsBlurTarget=s;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("../jdmaterialview.taro-D8shGQ46.js");module.exports=e.JDMaterialView;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s={className:"",style:{}};exports.ComponentDefaults=s;
|
|
@@ -1,3 +0,0 @@
|
|
|
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>>;
|
|
@@ -1,4 +0,0 @@
|
|
|
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;
|