wevu 6.18.6 → 6.18.7

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.
@@ -1 +0,0 @@
1
- import{a as e,c as t,f as n,g as r,h as i,i as a,l as o,m as s,n as c,o as l,s as u,t as d,v as f}from"./base-BxKbbKVO.mjs";import{WEVU_APP_PROVIDES_KEY as p,WEVU_IS_APP_INSTANCE_KEY as ee,WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROVIDES_KEY as g,WEVU_RUNTIME_APP_KEY as te}from"@weapp-core/constants";function _(e,t,n){o(d(e),e,t,n)}function ne(e){_(`onLaunch`,e)}function re(e){_(`onPageNotFound`,e)}function ie(e){_(`onUnhandledRejection`,e)}function ae(e){_(`onThemeChange`,e)}function oe(e){_(`onMemoryWarning`,e)}function se(e){_(`onShow`,e)}function ce(e){_(`onLoad`,e)}function le(e){_(`onHide`,e)}function ue(e){_(`onUnload`,e)}function de(e){_(`onReady`,e)}function fe(e){_(`onPullDownRefresh`,e)}function pe(e){_(`onReachBottom`,e)}function me(e){let t=d(`onPageScroll`);o(t,`onPageScroll`,e),a(t,`onPageScroll`)}function he(e){_(`onRouteDone`,e)}function ge(e){_(`onTabItemTap`,e)}function _e(e){_(`onResize`,e)}function ve(e){_(`onMoved`,e)}function ye(e){_(`onAttached`,e)}function be(e){_(`onDetached`,e)}function xe(e){_(`onError`,e)}function Se(e){_(`onSaveExitState`,e,{single:!0})}function Ce(t){let n=d(`onShareAppMessage`);o(n,`onShareAppMessage`,t,{single:!0}),l(n,`onShareAppMessage`),e(n)}function we(t){let n=d(`onShareTimeline`);o(n,`onShareTimeline`,t,{single:!0}),l(n,`onShareTimeline`),e(n)}function Te(e){let t=d(`onAddToFavorites`);o(t,`onAddToFavorites`,e,{single:!0}),l(t,`onAddToFavorites`)}const v=new Map;function y(e,t){v.set(e,t)}function b(e){return v.has(e)}function x(e){return v.get(e)}function S(e){return!!(e&&typeof e==`object`&&e[ee]===!0)}function C(e){return Object.create(e==null?null:e)}function w(e){if(!e)return C();let t=e[p];if(t&&typeof t==`object`)return t;let n=C();try{Object.defineProperty(e,p,{value:n,configurable:!0,enumerable:!1,writable:!1})}catch(t){e[p]=n}return n}function T(e,t){try{Object.defineProperty(e,g,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(n){e[g]=t}}function E(e){var t,n;let r=e[g];if(r&&typeof r==`object`)return r;let i=e[te],a=(t=(n=e[h])==null?void 0:n[g])==null?w(i):t,o=S(e)?w(i):C(a);return T(e,o),o}function Ee(e){return w(e)}function De(e,t,n){w(e)[t]=n,y(t,n)}function Oe(e,t,n){var r;let i=w(t),a=(r=n==null?void 0:n[g])==null?i:r,o=S(e)?i:C(a);if(n)try{Object.defineProperty(e,h,{value:n,configurable:!0,enumerable:!1,writable:!0})}catch(t){e[h]=n}T(e,o)}function D(e,t){let n=Object.getPrototypeOf(e);for(;n;){if(n===t)return!0;n=Object.getPrototypeOf(n)}return!1}function ke(e,t){let n=E(e),r=E(t);if(!(n===r||D(n,r)||D(r,n))){Object.setPrototypeOf(r,n);try{Object.defineProperty(t,h,{value:e,configurable:!0,enumerable:!1,writable:!0})}catch(n){t[h]=e}}}let O=!1,k;function A(){return k}function Ae(e){k=e}function je(e){k===e&&(k=void 0)}function j(e,t){var n;e[m]=Number((n=e[m])==null?0:n)+1;try{return t()}finally{var r;let t=Number((r=e[m])==null?1:r)-1;t<=0?delete e[m]:e[m]=t}}function Me(e){let t=e.options;if(t&&typeof t==`object`)return t;let n=s(),r=n[n.length-1],i=r&&typeof r==`object`?r.options:void 0;return i&&typeof i==`object`?i:{}}function Ne(){if(O)return;O=!0;let e=r();if(!(!e||typeof e!=`object`)){if(f(`pullDownRefreshApi`)){let t=e.startPullDownRefresh;typeof t==`function`&&(e.startPullDownRefresh=function(...e){let n=t.apply(this,e);return k&&c(k,`onPullDownRefresh`,[]),n})}if(f(`pageScrollApi`)){let t=e.pageScrollTo;typeof t==`function`&&(e.pageScrollTo=function(e,...n){let r=t.apply(this,[e,...n]);if(k){let t=k;j(t,()=>{c(t,`onPageScroll`,[e==null?{}:e])})}return r})}}}function Pe(e){let{enableOnShareAppMessage:t,enableOnShareTimeline:n}=e;if(!t&&!n||!f(`pageShareMenu`))return;let a=r();if(!a||typeof a.showShareMenu!=`function`)return;let o=i().shareTimelineRequiresShareAppMessage?t||n:t;if(!o&&!n)return;let s=[];o&&s.push(`shareAppMessage`),n&&s.push(`shareTimeline`);let c=[{withShareTicket:!0,menus:s},{menus:s},n?{withShareTicket:!0}:void 0,n?{}:void 0,void 0];for(let e of c)try{e===void 0?a.showShareMenu():a.showShareMenu(e);break}catch(e){}}const Fe=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`],M=new Set,N=new WeakSet;function Ie(e){return M.add(e),()=>{M.delete(e)}}function P(e){for(let t of M)try{t(e)}catch(e){}}function Le(e,t){if(e!==`navigateBack`&&t&&typeof t==`object`){let e=t.url;if(typeof e==`string`)return{url:e}}}function Re(e){if(!e||typeof e!=`object`)return;let t=e;if(!N.has(t)){N.add(t);for(let e of Fe){let n=t[e];typeof n==`function`&&(t[e]=function(t,...r){let i=!1,a=()=>{i||(i=!0,P(Le(e,t)))},o=t&&typeof t==`object`?{...t,success:(...e)=>{a();let n=t.success;return typeof n==`function`?n(...e):void 0}}:t,s=n.call(this,o,...r);return s&&typeof s.then==`function`&&s.then(a,()=>{}),s})}}}function ze(){return!!u()}function Be(e,t){let n=u();n?(E(n)[e]=t,S(n)&&y(e,t)):y(e,t)}function Ve(e,t){var n;let r=u();if(r){let t=E(r);if(e in t)return t[e]}if(b(e))return x(e);if(arguments.length>=2)return t;let i=(n=globalThis.console)==null?void 0:n.warn;typeof i==`function`&&i(`wevu.inject:未找到对应 key 的值:${String(e)}`)}function He(e,t){y(e,t)}function Ue(e,t){if(b(e))return x(e);if(arguments.length>=2)return t;throw Error(`injectGlobal():未找到对应 key 的 provider:${String(e)}`)}function F(e){let t=[];for(let n of e.split(`/`))if(!(!n||n===`.`)){if(n===`..`){t.length>0&&t.pop();continue}t.push(n)}return t}function I(e,t){if(!e)return F(t).join(`/`);if(e.startsWith(`/`))return F(e).join(`/`);if(e.startsWith(`./`)||e.startsWith(`../`)){let n=F(t);n.length>0&&n.pop();for(let t of e.split(`/`))if(!(!t||t===`.`)){if(t===`..`){n.length>0&&n.pop();continue}n.push(t)}return n.join(`/`)}return F(e).join(`/`)}function L(e){return e?`/${e}`:`/`}const We=/(?:^|\/):/;function Ge(e){return We.test(e)}const Ke=/\+/g;function R(e){return decodeURIComponent(e.replace(Ke,` `))}function z(e){return encodeURIComponent(e)}function B(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n);return}e[t]=[r,n]}function V(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n);return}e[t]=[r,n]}function H(e){if(e!==void 0)return e===null?null:String(e)}function U(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(Array.isArray(r)){for(let e of r){let r=H(e);r!==void 0&&B(t,n,r)}continue}let i=H(r);i!==void 0&&B(t,n,i)}return t}function W(e){if(e!=null)return String(e)}function qe(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(Array.isArray(r)){for(let e of r){let r=W(e);r!==void 0&&V(t,n,r)}continue}let i=W(r);i!==void 0&&V(t,n,i)}return t}function G(e){return e?e.startsWith(`#`)?e:`#${e}`:``}function K(e){let t=e.startsWith(`?`)?e.slice(1):e,n={};if(!t)return n;for(let e of t.split(`&`)){if(!e)continue;let t=e.indexOf(`=`),r=t>=0?e.slice(0,t):e;r&&B(n,R(r),t>=0?R(e.slice(t+1)):null)}return n}function q(e={}){let t=U(e),n=[];for(let e of Object.keys(t)){let r=z(e),i=t[e];if(Array.isArray(i)){for(let e of i)e===null?n.push(r):n.push(`${r}=${z(e)}`);continue}if(i===null){n.push(r);continue}n.push(`${r}=${z(i)}`)}return n.join(`&`)}const Je={parseQuery:K,stringifyQuery:q};function J(e,t=Je){let n=e.indexOf(`#`),r=n>=0?e.slice(0,n):e,i=n>=0?G(e.slice(n+1)):``,a=r.indexOf(`?`);return a<0?{path:r,query:{},hash:i}:{path:r.slice(0,a),query:U(t.parseQuery(r.slice(a+1))),hash:i}}function Y(e,t,n=``,r,i={},a=q){let o=I(e,``),s=a(t),c=L(o),l=G(n),u=s?`${c}?${s}`:c,d={path:o,fullPath:l?`${u}${l}`:u,query:t,hash:l,params:i};return r!==void 0&&(d.name=r),d}function X(e){return typeof(e==null?void 0:e.route)==`string`&&e.route.length>0||typeof(e==null?void 0:e.__route__)==`string`&&e.__route__.length>0}function Ye(e){let t=s();if(Array.isArray(t)&&t.length>0){let e=t[t.length-1];if(X(e))return e}let n=A();return X(n)?n:e}function Xe(e,t){var n;return e?Y(typeof e.route==`string`?e.route:typeof e.__route__==`string`?e.__route__:``,U(t==null?(n=e.options)==null?{}:n:t),``,void 0,{}):Y(``,{})}function Ze(e,t){return Xe(Ye(t),e)}const Qe=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`],$e=new WeakMap;function Z(e){return!e||typeof e!=`object`?!1:Qe.every(t=>typeof e[t]==`function`)}function et(){return n()}function tt(e){if(!(typeof e!=`string`||!e))return I(e,``)||void 0}function nt(e,t){let n=t===`pageRouter`?[e.route,e.__route__,e.is]:[e.is,e.route,e.__route__];for(let e of n){let t=tt(e);if(t)return t}}function rt(e,t){if(!t||!e.startsWith(`./`)&&!e.startsWith(`../`))return e;let{path:n,query:r,hash:i}=J(e),a=L(I(n,t)),o=q(r);return`${a}${o?`?${o}`:``}${i}`}function Q(e,t){let n=t==null?``:t,r=$e.get(e),i=r==null?void 0:r.get(n);if(i)return i;let a=Object.create(null);for(let n of Qe)a[n]=r=>{let i=e[n];if(n===`navigateBack`||!r||typeof r!=`object`)return i.call(e,r);let a=typeof r.url==`string`?rt(r.url,t):r.url,o=r.success,s={...r,url:a,success:(...e)=>(typeof a==`string`&&P({url:a}),typeof o==`function`?o(...e):void 0)};return i.call(e,s)};let o=r==null?new Map:r;return o.set(n,a),$e.set(e,o),a}function $(e,n,r){let i=t();if(!(i!=null&&i.instance))throw Error(`${r}() 必须在 setup() 的同步阶段调用`);let a=i.instance,o=nt(a,e),s=a[e];if(Z(s))return Q(s,o);let c=a[n];if(Z(c))return Q(c,o);let l=et();if(l)return Q(l,o);throw Error(`当前运行环境不支持 Router,请升级宿主基础库或检查平台路由能力`)}function it(){return $(`router`,`pageRouter`,`useNativeRouter`)}function at(){return $(`pageRouter`,`router`,`useNativePageRouter`)}export{we as $,ke as A,ne as B,Ae as C,je as D,A as E,Te as F,me as G,oe as H,ye as I,de as J,fe as K,be as L,Ee as M,De as N,Me as O,y as P,Ce as Q,xe as R,Ie as S,Pe as T,ve as U,ce as V,re as W,he as X,_e as Y,Se as Z,Ue as _,Ze as a,Re as b,U as c,q as d,se as et,L as f,Ve as g,ze as h,J as i,ue as it,Oe as j,j as k,qe as l,I as m,it as n,ae as nt,Xe as o,Ge as p,pe as q,Y as r,ie as rt,G as s,at as t,ge as tt,K as u,Be as v,Ne as w,P as x,He as y,le as z};