@zero-bits/taro-components 1.0.5 → 1.1.0
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/es/components/Permission/PermissionProvider.js +35 -1
- package/es/components/Permission/index.js +2 -1
- package/es/components/Permission/store.js +158 -1
- package/es/components/Text/index.js +136 -1
- package/es/components/View/index.d.ts +10 -0
- package/es/components/View/index.js +220 -1
- package/es/components/index.js +3 -1
- package/es/context/index.js +6 -1
- package/es/hooks/index.js +2 -1
- package/es/hooks/usePermission.js +18 -1
- package/es/hooks/useWeappUpdate.js +33 -1
- package/es/index.js +3 -1
- package/es/styles/index.css +1 -63
- package/es/types/index.js +1 -1
- package/lib/components/Permission/PermissionProvider.js +41 -1
- package/lib/components/Permission/index.js +20 -1
- package/lib/components/Permission/store.js +164 -1
- package/lib/components/Text/index.js +145 -1
- package/lib/components/View/index.d.ts +10 -0
- package/lib/components/View/index.js +227 -1
- package/lib/components/index.js +36 -1
- package/lib/context/index.js +12 -1
- package/lib/hooks/index.js +19 -1
- package/lib/hooks/usePermission.js +24 -1
- package/lib/hooks/useWeappUpdate.js +38 -1
- package/lib/index.js +63 -1
- package/lib/styles/index.css +1 -63
- package/lib/types/index.js +5 -1
- package/package.json +27 -4
|
@@ -1 +1,220 @@
|
|
|
1
|
-
var _0x442417=_0x1f9c;(function(_0x21f6cc,_0x4a0cf7){var _0xffa42b=_0x1f9c,_0x55c994=_0x21f6cc();while(!![]){try{var _0x5c04b8=-parseInt(_0xffa42b(0x12d))/0x1+-parseInt(_0xffa42b(0x124))/0x2*(parseInt(_0xffa42b(0x128))/0x3)+-parseInt(_0xffa42b(0x14c))/0x4*(parseInt(_0xffa42b(0x113))/0x5)+parseInt(_0xffa42b(0x10f))/0x6+-parseInt(_0xffa42b(0x12a))/0x7*(-parseInt(_0xffa42b(0x155))/0x8)+-parseInt(_0xffa42b(0x134))/0x9+parseInt(_0xffa42b(0x135))/0xa;if(_0x5c04b8===_0x4a0cf7)break;else _0x55c994['push'](_0x55c994['shift']());}catch(_0x5a53f5){_0x55c994['push'](_0x55c994['shift']());}}}(_0x55a0,0xbfbbe));function _0x1f9c(_0x195897,_0x58d3cf){_0x195897=_0x195897-0x10b;var _0x55a008=_0x55a0();var _0x1f9c9c=_0x55a008[_0x195897];return _0x1f9c9c;}var _excluded=[_0x442417(0x157),'row','column',_0x442417(0x154),_0x442417(0x131),_0x442417(0x168),'between',_0x442417(0x116),_0x442417(0x138),_0x442417(0x11d),_0x442417(0x136),'gap',_0x442417(0x133),_0x442417(0x129),'flexShrink','flexGrow',_0x442417(0x160),'opacity',_0x442417(0x150),_0x442417(0x120),_0x442417(0x127),_0x442417(0x16c),_0x442417(0x122),_0x442417(0x13d),_0x442417(0x11b),'mTop',_0x442417(0x16a),_0x442417(0x166),_0x442417(0x16b),_0x442417(0x15a),_0x442417(0x14a),_0x442417(0x163),_0x442417(0x167),_0x442417(0x152),_0x442417(0x137),_0x442417(0x110),_0x442417(0x117),_0x442417(0x123),'safeArea','hover',_0x442417(0x115),_0x442417(0x159),_0x442417(0x15b),_0x442417(0x11f),'right',_0x442417(0x162),_0x442417(0x145),_0x442417(0x114),_0x442417(0x13a),_0x442417(0x143),_0x442417(0x164),_0x442417(0x15c),_0x442417(0x15f)];function _typeof(_0x5c3bfa){'@babel/helpers - typeof';var _0x3c155c=_0x442417;return _typeof=_0x3c155c(0x15d)==typeof Symbol&&_0x3c155c(0x112)==typeof Symbol[_0x3c155c(0x161)]?function(_0x35ff7){return typeof _0x35ff7;}:function(_0x5e471b){var _0x378d27=_0x3c155c;return _0x5e471b&&_0x378d27(0x15d)==typeof Symbol&&_0x5e471b[_0x378d27(0x11c)]===Symbol&&_0x5e471b!==Symbol[_0x378d27(0x14f)]?_0x378d27(0x112):typeof _0x5e471b;},_typeof(_0x5c3bfa);}function ownKeys(_0x4099b4,_0x4e35db){var _0x412543=_0x442417,_0x42ae90=Object[_0x412543(0x121)](_0x4099b4);if(Object[_0x412543(0x13c)]){var _0x2f4206=Object[_0x412543(0x13c)](_0x4099b4);_0x4e35db&&(_0x2f4206=_0x2f4206[_0x412543(0x10e)](function(_0x12ced1){var _0x1be7cb=_0x412543;return Object[_0x1be7cb(0x146)](_0x4099b4,_0x12ced1)[_0x1be7cb(0x147)];})),_0x42ae90[_0x412543(0x125)][_0x412543(0x16e)](_0x42ae90,_0x2f4206);}return _0x42ae90;}function _objectSpread(_0x227ffb){var _0xf3e54e=_0x442417;for(var _0x3d5617=0x1;_0x3d5617<arguments[_0xf3e54e(0x148)];_0x3d5617++){var _0x907cbe=null!=arguments[_0x3d5617]?arguments[_0x3d5617]:{};_0x3d5617%0x2?ownKeys(Object(_0x907cbe),!0x0)[_0xf3e54e(0x169)](function(_0x2003d7){_defineProperty(_0x227ffb,_0x2003d7,_0x907cbe[_0x2003d7]);}):Object[_0xf3e54e(0x10d)]?Object[_0xf3e54e(0x13f)](_0x227ffb,Object[_0xf3e54e(0x10d)](_0x907cbe)):ownKeys(Object(_0x907cbe))[_0xf3e54e(0x169)](function(_0x4d70ea){var _0x3bd047=_0xf3e54e;Object[_0x3bd047(0x111)](_0x227ffb,_0x4d70ea,Object[_0x3bd047(0x146)](_0x907cbe,_0x4d70ea));});}return _0x227ffb;}function _defineProperty(_0x51d3f4,_0x4f3bb8,_0x1342f5){var _0x96202=_0x442417;return _0x4f3bb8=_toPropertyKey(_0x4f3bb8),_0x4f3bb8 in _0x51d3f4?Object[_0x96202(0x111)](_0x51d3f4,_0x4f3bb8,{'value':_0x1342f5,'enumerable':!![],'configurable':!![],'writable':!![]}):_0x51d3f4[_0x4f3bb8]=_0x1342f5,_0x51d3f4;}function _toPropertyKey(_0xdc9f40){var _0x2633ef=_0x442417,_0x101470=_toPrimitive(_0xdc9f40,_0x2633ef(0x144));return _0x2633ef(0x112)==_typeof(_0x101470)?_0x101470:String(_0x101470);}function _toPrimitive(_0x4639ee,_0x516e6d){var _0x9e1423=_0x442417;if(_0x9e1423(0x142)!=_typeof(_0x4639ee)||!_0x4639ee)return _0x4639ee;var _0x11105b=_0x4639ee[Symbol[_0x9e1423(0x12c)]];if(void 0x0!==_0x11105b){var _0x4b8fdc=_0x11105b[_0x9e1423(0x141)](_0x4639ee,_0x516e6d||_0x9e1423(0x11e));if(_0x9e1423(0x142)!=_typeof(_0x4b8fdc))return _0x4b8fdc;throw new TypeError(_0x9e1423(0x119));}return(_0x9e1423(0x144)===_0x516e6d?String:Number)(_0x4639ee);}function _objectWithoutProperties(_0x2e8210,_0x221623){var _0x329e0d=_0x442417;if(_0x2e8210==null)return{};var _0x572a15=_objectWithoutPropertiesLoose(_0x2e8210,_0x221623),_0x2e71c3,_0x33991f;if(Object[_0x329e0d(0x13c)]){var _0x509bde=Object[_0x329e0d(0x13c)](_0x2e8210);for(_0x33991f=0x0;_0x33991f<_0x509bde[_0x329e0d(0x148)];_0x33991f++){_0x2e71c3=_0x509bde[_0x33991f];if(_0x221623[_0x329e0d(0x153)](_0x2e71c3)>=0x0)continue;if(!Object['prototype'][_0x329e0d(0x139)][_0x329e0d(0x141)](_0x2e8210,_0x2e71c3))continue;_0x572a15[_0x2e71c3]=_0x2e8210[_0x2e71c3];}}return _0x572a15;}function _objectWithoutPropertiesLoose(_0x10f444,_0x28cabc){var _0x1a99a0=_0x442417;if(_0x10f444==null)return{};var _0x81ea73={},_0x2fd4a3=Object[_0x1a99a0(0x121)](_0x10f444),_0x56c6cf,_0x3bc133;for(_0x3bc133=0x0;_0x3bc133<_0x2fd4a3[_0x1a99a0(0x148)];_0x3bc133++){_0x56c6cf=_0x2fd4a3[_0x3bc133];if(_0x28cabc[_0x1a99a0(0x153)](_0x56c6cf)>=0x0)continue;_0x81ea73[_0x56c6cf]=_0x10f444[_0x56c6cf];}return _0x81ea73;}import{forwardRef}from'react';import{View as _0x5c5deb}from'@tarojs/components';import _0x311d98 from'classnames';import'../../styles/index.css';import{jsx as _0x1d0484}from'react/jsx-runtime';var px=function px(_0x455d09){var _0x23bbb3=_0x442417;if(_0x455d09===undefined||_0x455d09===null||_0x455d09==='')return undefined;return typeof _0x455d09===_0x23bbb3(0x15e)||!isNaN(Number(_0x455d09))?''[_0x23bbb3(0x11a)](_0x455d09,'px'):String(_0x455d09);},View=forwardRef(function(_0x5d87c6,_0x223894){var _0x5cd84d=_0x442417,_0x1cacb9=_0x5d87c6[_0x5cd84d(0x157)],_0x5c8fea=_0x5d87c6[_0x5cd84d(0x165)],_0x5f4d5a=_0x5d87c6[_0x5cd84d(0x10b)],_0x11ecf5=_0x5d87c6[_0x5cd84d(0x154)],_0x1a3e5b=_0x5d87c6[_0x5cd84d(0x131)],_0x1d59c9=_0x5d87c6[_0x5cd84d(0x168)],_0x319b40=_0x5d87c6[_0x5cd84d(0x126)],_0x4a0340=_0x5d87c6[_0x5cd84d(0x116)],_0x191122=_0x5d87c6['justifyItems'],_0x265a38=_0x5d87c6['alignItems'],_0x522d67=_0x5d87c6[_0x5cd84d(0x136)],_0x2a085b=_0x5d87c6[_0x5cd84d(0x14d)],_0xfe58dd=_0x5d87c6['rowGap'],_0xb72004=_0x5d87c6['columnGap'],_0x10d4e0=_0x5d87c6[_0x5cd84d(0x151)],_0x49658f=_0x5d87c6['flexGrow'],_0x5bdbf3=_0x5d87c6[_0x5cd84d(0x160)],_0x4220db=_0x5d87c6[_0x5cd84d(0x130)],_0xe7966e=_0x5d87c6['hidden'],_0x56b2af=_0x5d87c6[_0x5cd84d(0x120)],_0x16c633=_0x5d87c6[_0x5cd84d(0x127)],_0x53273b=_0x5d87c6['bgColor'],_0xf62c55=_0x5d87c6['style'],_0x5159a1=_0xf62c55===void 0x0?{}:_0xf62c55,_0x45baf6=_0x5d87c6[_0x5cd84d(0x13d)],_0x38b50c=_0x5d87c6[_0x5cd84d(0x11b)],_0x21ea08=_0x5d87c6[_0x5cd84d(0x156)],_0x5a46a9=_0x5d87c6[_0x5cd84d(0x16a)],_0x2bb856=_0x5d87c6[_0x5cd84d(0x166)],_0x2ba813=_0x5d87c6['mRight'],_0x14a0c7=_0x5d87c6[_0x5cd84d(0x15a)],_0x210b7f=_0x5d87c6[_0x5cd84d(0x14a)],_0x3f935d=_0x5d87c6[_0x5cd84d(0x163)],_0x26d581=_0x5d87c6[_0x5cd84d(0x167)],_0x59cc9d=_0x5d87c6[_0x5cd84d(0x152)],_0x2218a6=_0x5d87c6[_0x5cd84d(0x137)],_0x3d3604=_0x5d87c6[_0x5cd84d(0x110)],_0x404975=_0x5d87c6['pHorizontal'],_0x436c43=_0x5d87c6[_0x5cd84d(0x123)],_0x51f350=_0x5d87c6[_0x5cd84d(0x12b)],_0x2c11d1=_0x5d87c6[_0x5cd84d(0x14b)],_0x36b66f=_0x5d87c6[_0x5cd84d(0x115)],_0x1085dc=_0x5d87c6['position'],_0xd120fd=_0x5d87c6[_0x5cd84d(0x15b)],_0x4c99e2=_0x5d87c6[_0x5cd84d(0x11f)],_0x2a7d2c=_0x5d87c6['right'],_0x136da9=_0x5d87c6[_0x5cd84d(0x162)],_0x3fc489=_0x5d87c6['bottom'],_0x32314f=_0x5d87c6['overflow'],_0x4daf92=_0x5d87c6['radius'],_0x5eb8b8=_0x5d87c6[_0x5cd84d(0x143)],_0x11d847=_0x5d87c6[_0x5cd84d(0x164)],_0x15355f=_0x5d87c6[_0x5cd84d(0x15c)],_0x1de704=_0x5d87c6['borderStyle'],_0x1a3daf=_objectWithoutProperties(_0x5d87c6,_excluded),_0x327a35=_0x311d98(_0x4a0340,{'zero-flex':!![],'zero-flex-1':_0x1a3e5b,'zero-flex-col':_0x5f4d5a,'zero-flex-row':_0x5c8fea,'zero-flex-wrap':_0x11ecf5,'zero-items-start':_0x265a38===_0x5cd84d(0x12f),'zero-items-end':_0x265a38==='flex-end','zero-items-center':_0x265a38===_0x5cd84d(0x13e),'zero-justify-start':_0x191122===_0x5cd84d(0x12f),'zero-justify-end':_0x191122==='flex-end','zero-justify-center':_0x191122===_0x5cd84d(0x13e),'zero-place-content-around':_0x1d59c9===_0x5cd84d(0x14e),'zero-justify-around':_0x1d59c9==='justify-around','zero-justify-between':_0x319b40,'zero-hidden':_0xe7966e,'zero-animate-pulse\x20zero-bg-gray-200':_0x36b66f}),_0x5a2f0d=function _0x17daf3(_0x1c5080,_0x1badc1,_0x715fa5){var _0x3e23dd=_0x5cd84d,_0x273d54=_0x1badc1===_0x1c5080||_0x1badc1==='both';if(!_0x273d54)return px(_0x715fa5);return _0x715fa5?_0x3e23dd(0x140)[_0x3e23dd(0x11a)](_0x1c5080,_0x3e23dd(0x158))[_0x3e23dd(0x11a)](px(_0x715fa5),')'):'env(safe-area-inset-'[_0x3e23dd(0x11a)](_0x1c5080,')');},_0x37b11f=_0x5eb8b8||_0x11d847!==undefined||_0x15355f!==undefined,_0x3d044b=_objectSpread({'width':px(_0x1cacb9?_0x5cd84d(0x16d):_0x56b2af),'height':px(_0x1cacb9?_0x5cd84d(0x16d):_0x16c633),'backgroundColor':_0x53273b,'margin':px(_0x38b50c),'marginTop':px(_0x21ea08!==null&&_0x21ea08!==void 0x0?_0x21ea08:_0x210b7f),'marginBottom':px(_0x5a46a9!==null&&_0x5a46a9!==void 0x0?_0x5a46a9:_0x210b7f),'marginLeft':px(_0x2bb856!==null&&_0x2bb856!==void 0x0?_0x2bb856:_0x14a0c7),'marginRight':px(_0x2ba813!==null&&_0x2ba813!==void 0x0?_0x2ba813:_0x14a0c7),'padding':px(_0x3f935d),'paddingTop':_0x5a2f0d(_0x5cd84d(0x162),_0x51f350,_0x26d581!==null&&_0x26d581!==void 0x0?_0x26d581:_0x436c43),'paddingBottom':_0x5a2f0d(_0x5cd84d(0x145),_0x51f350,_0x59cc9d!==null&&_0x59cc9d!==void 0x0?_0x59cc9d:_0x436c43),'paddingLeft':px(_0x2218a6!==null&&_0x2218a6!==void 0x0?_0x2218a6:_0x404975),'paddingRight':px(_0x3d3604!==null&&_0x3d3604!==void 0x0?_0x3d3604:_0x404975),'position':_0x1085dc,'zIndex':_0xd120fd,'left':px(_0x4c99e2),'right':px(_0x2a7d2c),'top':px(_0x136da9),'bottom':px(_0x3fc489),'overflow':_0x32314f,'borderRadius':px(_0x4daf92),'borderWidth':_0x37b11f?px(_0x15355f!==null&&_0x15355f!==void 0x0?_0x15355f:0x1):undefined,'borderStyle':_0x37b11f?_0x1de704!==null&&_0x1de704!==void 0x0?_0x1de704:_0x5cd84d(0x12e):undefined,'borderColor':_0x11d847,'gap':px(_0x2a085b),'rowGap':px(_0xfe58dd),'columnGap':px(_0xb72004),'alignSelf':_0x522d67,'flexShrink':_0x10d4e0,'flexGrow':_0x49658f,'flexBasis':px(_0x5bdbf3),'opacity':_0x4220db,'display':_0xe7966e?_0x5cd84d(0x13b):undefined,'color':_0x36b66f?_0x5cd84d(0x149):undefined},_typeof(_0x5159a1)===_0x5cd84d(0x142)?_0x5159a1:{}),_0x4b2a3d={};for(var _0x5f2ee1 in _0x3d044b){_0x3d044b[_0x5f2ee1]!==undefined&&_0x3d044b[_0x5f2ee1]!==null&&(_0x4b2a3d[_0x5f2ee1]=_0x3d044b[_0x5f2ee1]);}return _0x1d0484(_0x5c5deb,_objectSpread(_objectSpread({'ref':_0x223894,'className':_0x327a35,'style':_0x4b2a3d,'hoverClass':_0x2c11d1?_0x5cd84d(0x10c):_0x5cd84d(0x13b),'hoverStayTime':0xc8},_0x1a3daf),{},{'children':_0x45baf6}));});View[_0x442417(0x118)]=_0x442417(0x132);function _0x55a0(){var _0x72e730=['margin','constructor','alignItems','default','left','width','keys','style','pVertical','12468HSvYRN','push','between','height','615XkkXNr','columnGap','959wfcAQM','safeArea','toPrimitive','1110554ZYJwUg','solid','flex-start','opacity','flex','View','rowGap','8531586gJrBUJ','33651440IqRoso','alignSelf','pLeft','justifyItems','propertyIsEnumerable','radius','none','getOwnPropertySymbols','children','center','defineProperties','calc(env(safe-area-inset-','call','object','border','string','bottom','getOwnPropertyDescriptor','enumerable','length','transparent','mVertical','hover','450520RFUCtM','gap','content-around','prototype','hidden','flexShrink','pBottom','indexOf','wrap','42520VazAOj','mTop','full',')\x20+\x20','position','mHorizontal','zIndex','borderWidth','function','number','borderStyle','flexBasis','iterator','top','padding','borderColor','row','mLeft','pTop','around','forEach','mBottom','mRight','bgColor','100%','apply','column','zero:opacity-70','getOwnPropertyDescriptors','filter','4901586frYcIy','pRight','defineProperty','symbol','35Kvyznh','overflow','skeleton','className','pHorizontal','displayName','@@toPrimitive\x20must\x20return\x20a\x20primitive\x20value.','concat'];_0x55a0=function(){return _0x72e730;};return _0x55a0();}export default View;
|
|
1
|
+
var _excluded = ["full", "row", "column", "wrap", "flex", "around", "between", "className", "justifyItems", "alignItems", "alignSelf", "gap", "rowGap", "columnGap", "flexShrink", "flexGrow", "flexBasis", "opacity", "hidden", "width", "height", "bgColor", "background", "style", "children", "margin", "mTop", "mBottom", "mLeft", "mRight", "mHorizontal", "mVertical", "padding", "pTop", "pBottom", "pLeft", "pRight", "pHorizontal", "pVertical", "safeArea", "hover", "skeleton", "position", "zIndex", "left", "right", "top", "bottom", "overflow", "radius", "border", "borderColor", "borderWidth", "borderStyle"];
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { forwardRef } from 'react';
|
|
11
|
+
import { View as OrigView } from '@tarojs/components';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import "../../styles/index.css";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
/**
|
|
16
|
+
* 处理 px 转换
|
|
17
|
+
* @param val px|string|undefined
|
|
18
|
+
* @returns px|string|undefined
|
|
19
|
+
*/
|
|
20
|
+
var px = function px(val) {
|
|
21
|
+
if (val === undefined || val === null || val === '') return undefined;
|
|
22
|
+
return typeof val === 'number' || !isNaN(Number(val)) ? "".concat(val, "px") : String(val);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* taro weapp View Component (Tailwind 版)
|
|
27
|
+
* - full: 100% 100% 宽度、高度100%
|
|
28
|
+
* - flex: flex: 1 自动适应
|
|
29
|
+
* - row: flex-direction: row 主轴水平
|
|
30
|
+
* - column: flex-direction: column 主轴垂直
|
|
31
|
+
* - wrap: flex-wrap: wrap 换行
|
|
32
|
+
* - around: flex-direction: row justify-content: space-around 主轴平均分布
|
|
33
|
+
* - between: flex-direction: row justify-content: space-between 主轴两端对齐
|
|
34
|
+
* - justifyItems: justify-content 主轴对齐方式
|
|
35
|
+
* - alignItems: align-items 交叉轴对齐方式
|
|
36
|
+
* - alignSelf: align-self 自身对齐方式
|
|
37
|
+
* - gap: gap 间距
|
|
38
|
+
* - rowGap: row-gap 行间距
|
|
39
|
+
* - columnGap: column-gap 列间距
|
|
40
|
+
* - flexShrink: flex-shrink 剩余空间不足时
|
|
41
|
+
* - flexGrow: flex-grow 剩余空间
|
|
42
|
+
* - flexBasis: flex-basis 初始大小
|
|
43
|
+
* - opacity: opacity 透明度
|
|
44
|
+
* - hidden: hidden 隐藏
|
|
45
|
+
* - width: width 宽度
|
|
46
|
+
* - height: height 高度
|
|
47
|
+
* - bgColor: background-color 背景颜色
|
|
48
|
+
* - background: background 背景图片等复杂背景
|
|
49
|
+
* - safeArea: safe-area-inset 安全区域
|
|
50
|
+
* - hover: hover 悬停状态
|
|
51
|
+
* - skeleton: skeleton 骨架屏
|
|
52
|
+
* - position: position 定位
|
|
53
|
+
* - zIndex: z-index 层级
|
|
54
|
+
* - left: left 定位左侧
|
|
55
|
+
* - right: right 定位右侧
|
|
56
|
+
* - top: top 定位上侧
|
|
57
|
+
* - bottom: bottom 定位下侧
|
|
58
|
+
* - overflow: overflow 显示
|
|
59
|
+
* - overflowX: overflow-x 显示
|
|
60
|
+
* - overflowY: overflow-y 显示
|
|
61
|
+
* - radius: border-radius 圆角
|
|
62
|
+
* - border: boolean 边框
|
|
63
|
+
* - borderColor: border-color 边框颜色
|
|
64
|
+
* - borderWidth: border-width 边框宽度
|
|
65
|
+
* - borderStyle: border-style 边框样式
|
|
66
|
+
* - style: style 自定义样式
|
|
67
|
+
* - children: children 子元素
|
|
68
|
+
* - margin: margin 外边距
|
|
69
|
+
* - mTop: margin-top 上外边距
|
|
70
|
+
* - mBottom: margin-bottom 下外边距
|
|
71
|
+
* - mLeft: margin-left 左外边距
|
|
72
|
+
* - mRight: margin-right 右外边距
|
|
73
|
+
* - mHorizontal: margin-horizontal 水平外边距
|
|
74
|
+
* - mVertical: margin-vertical 垂直外边距
|
|
75
|
+
* - padding: padding 内边距
|
|
76
|
+
* - pTop: padding-top 上内边距
|
|
77
|
+
* - pBottom: padding-bottom 下内边距
|
|
78
|
+
* - pLeft: padding-left 左内边距
|
|
79
|
+
* - pRight: padding-right 右内边距
|
|
80
|
+
* - pHorizontal: padding-horizontal 水平内边距
|
|
81
|
+
* - pVertical: padding-vertical 垂直内边距
|
|
82
|
+
* - rest: View组件其他属性
|
|
83
|
+
*/
|
|
84
|
+
var View = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
85
|
+
var full = props.full,
|
|
86
|
+
row = props.row,
|
|
87
|
+
column = props.column,
|
|
88
|
+
wrap = props.wrap,
|
|
89
|
+
flex = props.flex,
|
|
90
|
+
around = props.around,
|
|
91
|
+
between = props.between,
|
|
92
|
+
className = props.className,
|
|
93
|
+
justifyItems = props.justifyItems,
|
|
94
|
+
alignItems = props.alignItems,
|
|
95
|
+
alignSelf = props.alignSelf,
|
|
96
|
+
gap = props.gap,
|
|
97
|
+
rowGap = props.rowGap,
|
|
98
|
+
columnGap = props.columnGap,
|
|
99
|
+
flexShrink = props.flexShrink,
|
|
100
|
+
flexGrow = props.flexGrow,
|
|
101
|
+
flexBasis = props.flexBasis,
|
|
102
|
+
opacity = props.opacity,
|
|
103
|
+
hidden = props.hidden,
|
|
104
|
+
width = props.width,
|
|
105
|
+
height = props.height,
|
|
106
|
+
bgColor = props.bgColor,
|
|
107
|
+
background = props.background,
|
|
108
|
+
_props$style = props.style,
|
|
109
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
110
|
+
children = props.children,
|
|
111
|
+
margin = props.margin,
|
|
112
|
+
mTop = props.mTop,
|
|
113
|
+
mBottom = props.mBottom,
|
|
114
|
+
mLeft = props.mLeft,
|
|
115
|
+
mRight = props.mRight,
|
|
116
|
+
mHorizontal = props.mHorizontal,
|
|
117
|
+
mVertical = props.mVertical,
|
|
118
|
+
padding = props.padding,
|
|
119
|
+
pTop = props.pTop,
|
|
120
|
+
pBottom = props.pBottom,
|
|
121
|
+
pLeft = props.pLeft,
|
|
122
|
+
pRight = props.pRight,
|
|
123
|
+
pHorizontal = props.pHorizontal,
|
|
124
|
+
pVertical = props.pVertical,
|
|
125
|
+
safeArea = props.safeArea,
|
|
126
|
+
hover = props.hover,
|
|
127
|
+
skeleton = props.skeleton,
|
|
128
|
+
position = props.position,
|
|
129
|
+
zIndex = props.zIndex,
|
|
130
|
+
left = props.left,
|
|
131
|
+
right = props.right,
|
|
132
|
+
top = props.top,
|
|
133
|
+
bottom = props.bottom,
|
|
134
|
+
overflow = props.overflow,
|
|
135
|
+
radius = props.radius,
|
|
136
|
+
border = props.border,
|
|
137
|
+
borderColor = props.borderColor,
|
|
138
|
+
borderWidth = props.borderWidth,
|
|
139
|
+
borderStyle = props.borderStyle,
|
|
140
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
141
|
+
var viewClass = classNames(className, {
|
|
142
|
+
'zero-flex': true,
|
|
143
|
+
'zero-flex-1': flex,
|
|
144
|
+
'zero-flex-col': column,
|
|
145
|
+
'zero-flex-row': row,
|
|
146
|
+
'zero-flex-wrap': wrap,
|
|
147
|
+
'zero-items-start': alignItems === 'flex-start',
|
|
148
|
+
'zero-items-end': alignItems === 'flex-end',
|
|
149
|
+
'zero-items-center': alignItems === 'center',
|
|
150
|
+
'zero-justify-start': justifyItems === 'flex-start',
|
|
151
|
+
'zero-justify-end': justifyItems === 'flex-end',
|
|
152
|
+
'zero-justify-center': justifyItems === 'center',
|
|
153
|
+
'zero-place-content-around': around === 'content-around',
|
|
154
|
+
'zero-justify-around': around === 'justify-around',
|
|
155
|
+
'zero-justify-between': between,
|
|
156
|
+
'zero-hidden': hidden,
|
|
157
|
+
'zero-animate-pulse zero-bg-gray-200': skeleton
|
|
158
|
+
});
|
|
159
|
+
var getSafeAreaPadding = function getSafeAreaPadding(type, safeAreaVal, userPadding) {
|
|
160
|
+
var isSafe = safeAreaVal === type || safeAreaVal === 'both';
|
|
161
|
+
if (!isSafe) return px(userPadding);
|
|
162
|
+
return userPadding ? "calc(env(safe-area-inset-".concat(type, ") + ").concat(px(userPadding), ")") : "env(safe-area-inset-".concat(type, ")");
|
|
163
|
+
};
|
|
164
|
+
var hasBorder = border || borderColor !== undefined || borderWidth !== undefined;
|
|
165
|
+
var customStyle = _objectSpread({
|
|
166
|
+
width: px(full ? '100%' : width),
|
|
167
|
+
height: px(full ? '100%' : height),
|
|
168
|
+
backgroundColor: bgColor,
|
|
169
|
+
background: background,
|
|
170
|
+
margin: px(margin),
|
|
171
|
+
marginTop: px(mTop !== null && mTop !== void 0 ? mTop : mVertical),
|
|
172
|
+
marginBottom: px(mBottom !== null && mBottom !== void 0 ? mBottom : mVertical),
|
|
173
|
+
marginLeft: px(mLeft !== null && mLeft !== void 0 ? mLeft : mHorizontal),
|
|
174
|
+
marginRight: px(mRight !== null && mRight !== void 0 ? mRight : mHorizontal),
|
|
175
|
+
padding: px(padding),
|
|
176
|
+
paddingTop: getSafeAreaPadding('top', safeArea, pTop !== null && pTop !== void 0 ? pTop : pVertical),
|
|
177
|
+
paddingBottom: getSafeAreaPadding('bottom', safeArea, pBottom !== null && pBottom !== void 0 ? pBottom : pVertical),
|
|
178
|
+
paddingLeft: px(pLeft !== null && pLeft !== void 0 ? pLeft : pHorizontal),
|
|
179
|
+
paddingRight: px(pRight !== null && pRight !== void 0 ? pRight : pHorizontal),
|
|
180
|
+
position: position,
|
|
181
|
+
zIndex: zIndex,
|
|
182
|
+
left: px(left),
|
|
183
|
+
right: px(right),
|
|
184
|
+
top: px(top),
|
|
185
|
+
bottom: px(bottom),
|
|
186
|
+
overflow: overflow,
|
|
187
|
+
borderRadius: px(radius),
|
|
188
|
+
borderWidth: hasBorder ? px(borderWidth !== null && borderWidth !== void 0 ? borderWidth : 1) : undefined,
|
|
189
|
+
borderStyle: hasBorder ? borderStyle !== null && borderStyle !== void 0 ? borderStyle : 'solid' : undefined,
|
|
190
|
+
borderColor: borderColor,
|
|
191
|
+
gap: px(gap),
|
|
192
|
+
rowGap: px(rowGap),
|
|
193
|
+
columnGap: px(columnGap),
|
|
194
|
+
alignSelf: alignSelf,
|
|
195
|
+
flexShrink: flexShrink,
|
|
196
|
+
flexGrow: flexGrow,
|
|
197
|
+
flexBasis: px(flexBasis),
|
|
198
|
+
opacity: opacity,
|
|
199
|
+
display: hidden ? 'none' : undefined,
|
|
200
|
+
color: skeleton ? 'transparent' : undefined
|
|
201
|
+
}, _typeof(style) === 'object' ? style : {});
|
|
202
|
+
var cleanStyle = {};
|
|
203
|
+
for (var key in customStyle) {
|
|
204
|
+
if (customStyle[key] !== undefined && customStyle[key] !== null) {
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
cleanStyle[key] = customStyle[key];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return /*#__PURE__*/_jsx(OrigView, _objectSpread(_objectSpread({
|
|
210
|
+
ref: ref,
|
|
211
|
+
className: viewClass,
|
|
212
|
+
style: cleanStyle,
|
|
213
|
+
hoverClass: hover ? 'zero:opacity-70' : 'none',
|
|
214
|
+
hoverStayTime: 200
|
|
215
|
+
}, rest), {}, {
|
|
216
|
+
children: children
|
|
217
|
+
}));
|
|
218
|
+
});
|
|
219
|
+
View.displayName = 'View';
|
|
220
|
+
export default View;
|
package/es/components/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export * from "./Permission";
|
|
2
|
+
export { default as View } from "./View";
|
|
3
|
+
export { default as Text } from "./Text";
|
package/es/context/index.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* PermissionContext 使用 object 作为基础泛型约束
|
|
4
|
+
* 消费侧通过 usePermission<P, U>() 收窄为具体的业务类型
|
|
5
|
+
*/
|
|
6
|
+
export var PermissionContext = /*#__PURE__*/createContext({});
|
package/es/hooks/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { usePermission } from "./usePermission";
|
|
2
|
+
export { useWeappUpdate } from "./useWeappUpdate";
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { PermissionContext } from "../context";
|
|
3
|
+
/**
|
|
4
|
+
* 在任意子孙组件中获取权限状态与操作方法
|
|
5
|
+
* 必须在 PermissionProvider 内部使用
|
|
6
|
+
*
|
|
7
|
+
* @template P - 权限对象类型
|
|
8
|
+
* @template U - 用户对象类型
|
|
9
|
+
* @returns {PermissionContextValue<P, U>} 权限上下文值
|
|
10
|
+
* @throws {Error} 未包裹 PermissionProvider 时抛出异常
|
|
11
|
+
*/
|
|
12
|
+
export function usePermission() {
|
|
13
|
+
var ctx = useContext(PermissionContext);
|
|
14
|
+
if (typeof ctx.granted !== 'function') {
|
|
15
|
+
throw new Error('[zero-bits/taro] usePermission must be used within a <PermissionProvider>.\n' + '请确保在 App 根节点包裹了 <PermissionProvider store={...}>');
|
|
16
|
+
}
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
import { getUpdateManager, showModal } from '@tarojs/taro';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 微信小程序自动更新钩子
|
|
6
|
+
*/
|
|
7
|
+
export var useWeappUpdate = function useWeappUpdate() {
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
if (process.env.TARO_ENV !== 'weapp') return;
|
|
10
|
+
var updateManager = getUpdateManager();
|
|
11
|
+
updateManager.onCheckForUpdate(function (res) {
|
|
12
|
+
if (res.hasUpdate) {
|
|
13
|
+
updateManager.onUpdateReady(function () {
|
|
14
|
+
showModal({
|
|
15
|
+
title: '更新提示',
|
|
16
|
+
content: '新版本已经准备好,是否重启应用?',
|
|
17
|
+
showCancel: false,
|
|
18
|
+
success: function success(result) {
|
|
19
|
+
if (result.confirm) updateManager.applyUpdate();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
updateManager.onUpdateFailed(function () {
|
|
26
|
+
showModal({
|
|
27
|
+
title: '更新提示',
|
|
28
|
+
content: '新版本下载失败,请删除当前小程序,重新搜索打开',
|
|
29
|
+
showCancel: false
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
};
|
package/es/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { View, Text, PermissionProvider, createPermissionStore } from "./components";
|
|
2
|
+
export { usePermission, useWeappUpdate } from "./hooks";
|
|
3
|
+
export * from "./types";
|
package/es/styles/index.css
CHANGED
|
@@ -1,63 +1 @@
|
|
|
1
|
-
|
|
2
|
-
@layer properties;
|
|
3
|
-
.visible {
|
|
4
|
-
visibility: visible;
|
|
5
|
-
}
|
|
6
|
-
.absolute {
|
|
7
|
-
position: absolute;
|
|
8
|
-
}
|
|
9
|
-
.fixed {
|
|
10
|
-
position: fixed;
|
|
11
|
-
}
|
|
12
|
-
.relative {
|
|
13
|
-
position: relative;
|
|
14
|
-
}
|
|
15
|
-
.static {
|
|
16
|
-
position: static;
|
|
17
|
-
}
|
|
18
|
-
.sticky {
|
|
19
|
-
position: sticky;
|
|
20
|
-
}
|
|
21
|
-
.flex {
|
|
22
|
-
display: flex;
|
|
23
|
-
}
|
|
24
|
-
.hidden {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
.flex-shrink {
|
|
28
|
-
flex-shrink: 1;
|
|
29
|
-
}
|
|
30
|
-
.flex-grow {
|
|
31
|
-
flex-grow: 1;
|
|
32
|
-
}
|
|
33
|
-
.flex-wrap {
|
|
34
|
-
flex-wrap: wrap;
|
|
35
|
-
}
|
|
36
|
-
.content-around {
|
|
37
|
-
align-content: space-around;
|
|
38
|
-
}
|
|
39
|
-
.justify-around {
|
|
40
|
-
justify-content: space-around;
|
|
41
|
-
}
|
|
42
|
-
.border {
|
|
43
|
-
border-style: var(--tw-border-style);
|
|
44
|
-
border-width: 1px;
|
|
45
|
-
}
|
|
46
|
-
.line-through {
|
|
47
|
-
text-decoration-line: line-through;
|
|
48
|
-
}
|
|
49
|
-
.underline {
|
|
50
|
-
text-decoration-line: underline;
|
|
51
|
-
}
|
|
52
|
-
@property --tw-border-style {
|
|
53
|
-
syntax: "*";
|
|
54
|
-
inherits: false;
|
|
55
|
-
initial-value: solid;
|
|
56
|
-
}
|
|
57
|
-
@layer properties {
|
|
58
|
-
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
59
|
-
*, ::before, ::after, ::backdrop {
|
|
60
|
-
--tw-border-style: solid;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
@tailwind utilities;
|
package/es/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export {};
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _context = require("../../context");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* 权限组件 Provider 的属性
|
|
12
|
+
*
|
|
13
|
+
* @template P - 权限对象类型
|
|
14
|
+
* @template U - 用户对象类型
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 权限组件的入口 Provider,通常包裹在 App 根节点
|
|
19
|
+
*
|
|
20
|
+
* @template P - 权限对象类型
|
|
21
|
+
* @template U - 用户对象类型
|
|
22
|
+
* @param {PermissionProviderProps<P, U>} props - 组件属性
|
|
23
|
+
* @returns {JSX.Element}
|
|
24
|
+
*/
|
|
25
|
+
function PermissionProvider(_ref) {
|
|
26
|
+
var children = _ref.children,
|
|
27
|
+
store = _ref.store,
|
|
28
|
+
onDenied = _ref.onDenied;
|
|
29
|
+
var state = (0, _react.useSyncExternalStore)(store.subscribe, store.getSnapshot);
|
|
30
|
+
var prevGrantedRef = (0, _react.useRef)(state.isGranted);
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
32
|
+
if (prevGrantedRef.current && !state.isGranted) onDenied === null || onDenied === void 0 || onDenied();
|
|
33
|
+
prevGrantedRef.current = state.isGranted;
|
|
34
|
+
}, [state.isGranted, onDenied]);
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.PermissionContext.Provider, {
|
|
36
|
+
value: state,
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
PermissionProvider.displayName = 'PermissionProvider';
|
|
41
|
+
var _default = exports.default = PermissionProvider;
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "PermissionProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _PermissionProvider.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createPermissionStore", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _store.createPermissionStore;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _PermissionProvider = _interopRequireDefault(require("./PermissionProvider"));
|
|
19
|
+
var _store = require("./store");
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|