@cfdez11/vex 0.10.19 → 0.10.20
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/client/services/navigation/create-navigation.js +1 -1
- package/dist/client/services/navigation/link-interceptor.js +1 -1
- package/dist/client/services/navigation/navigate.js +1 -1
- package/dist/client/services/navigation/prefetch.js +1 -1
- package/dist/client/services/navigation/use-query-params.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setupLinkInterceptor as s}from"./link-interceptor.js";import{setupPrefetchObserver as f}from"./prefetch.js";import{navigateInternal as m}from"./navigate.js";import{findRouteWithParams as u}from"./router.js";import{createLayoutRenderer as p}from"./create-layouts.js";function
|
|
1
|
+
import{setupLinkInterceptor as s}from"./link-interceptor.js";import{setupPrefetchObserver as f}from"./prefetch.js";import{navigateInternal as m}from"./navigate.js";import{findRouteWithParams as u}from"./router.js";import{createLayoutRenderer as p}from"./create-layouts.js";function w(){let t=null;const n=p();function i(){t&&t.abort()}async function o(r,l=!0){i();const e=new AbortController;t=e;try{await m({path:r,addToHistory:l,controller:e,layoutRenderer:n,onFinish:()=>{t===e&&(t=null)}})}catch(a){a.name!=="AbortError"&&console.error("Navigation error:",a)}}function c(){window.addEventListener("popstate",()=>{o(`${location.pathname}${location.search}${location.hash}`,!1)}),s(o),f(),n.reset();const{route:r}=u(location.pathname);r?.meta?.ssr||o(location.pathname,!1)}return{navigate:o,initialize:c}}export{w as createNavigationRuntime};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a
|
|
1
|
+
function i(a){document.addEventListener("click",n=>{const e=n.target.closest("a");if(!e)return;const r=e.getAttribute("href");if(!r||r.startsWith("#"))return;const t=new URL(r,window.location.origin);if(!(t.origin!==window.location.origin||e.dataset.reload!==void 0||e.target==="_blank"||e.rel==="external")){if(t.pathname===window.location.pathname&&t.hash){n.preventDefault(),history.pushState({},"",`${t.pathname}${t.search}${t.hash}`),document.getElementById(t.hash.slice(1))?.scrollIntoView({behavior:"smooth"});return}n.preventDefault(),a(t.pathname+t.search+t.hash)}})}export{i as setupLinkInterceptor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{findRouteWithParams as
|
|
1
|
+
import{findRouteWithParams as m}from"./router.js";import{routes as f}from"../_routes.js";import{updateRouteParams as g}from"./use-route-params.js";import{renderPage as d}from"./render-page.js";import{renderSSRPage as h}from"./render-ssr.js";async function O({path:t,addToHistory:r,controller:i,layoutRenderer:n,onFinish:a}){g(t);const s=t.split("?")[0].split("#")[0],c=t.split("#")[0],u=`${location.pathname}${location.search}`===c,{route:l}=m(s),e=l??f.find(o=>o.isNotFound)??null;r&&history.pushState({},"",t);try{if(u)return;if(e?.meta?.ssr){n.reset(),await h(t,i.signal);return}if(e?.meta?.requiresAuth&&!app.Store?.loggedIn){location.href="/account/login";return}if(e?.meta?.guestOnly&&app.Store?.loggedIn){location.href="/account";return}await d({route:e,layoutRenderer:n})}finally{a();const o=t.includes("#")?t.slice(t.indexOf("#")+1):null;o&&document.getElementById(o)?.scrollIntoView()}}export{O as navigateInternal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{prefetchRouteComponent as f}from"../cache.js";import{findRouteWithParams as s}from"./router.js";function p(){const o=new IntersectionObserver(e=>{e.forEach(n=>{if(!n.isIntersecting)return;const t=n.target;if(!t.hasAttribute("data-prefetch"))return;const c=new URL(t.href,location.origin),{route:r}=s(c.pathname);r?.component&&(f(r.path,r.component),o.unobserve(t))})},{rootMargin:"200px"});document.querySelectorAll("a[data-prefetch]").forEach(e=>{e.__prefetchObserved||(e.__prefetchObserved=!0,o.observe(e))})}export{p as setupPrefetchObserver};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function p(r){const o={},s=new URLSearchParams(r);for(const[u,l]of s.entries())o[u]=l;return o}function S(r){const o=new URLSearchParams;for(const s in r)r[s]!=null&&o.set(s,String(r[s]));return o.toString()}function g(r={}){const{schema:o={},replace:s=!1,listen:u=!0}=r,l={};for(const e in o)l[e]=o[e](void 0);let i=p(window.location.search);function d(e){const n={};for(const t in o){const c=o[t];n[t]=c(e[t])}for(const t in e)t in n||(n[t]=e[t]);return n}function h(e){const n={};for(const t in e){const c=e[t];Array.isArray(c)?n[t]=c.join(","):c!=null&&(n[t]=String(c))}return n}function f(e){i=e;const n=S(i),t=window.location.pathname+(n?`?${n}`:"")+window.location.hash;history[s?"replaceState":"pushState"](null,"",t)}function w(e){const n=h(e);f({...i,...n})}function y(...e){const n={...i};e.forEach(t=>delete n[t]),f(n)}function m(){f({})}let a=null;return u&&(a=()=>{i=p(window.location.search)},window.addEventListener("popstate",a)),{get params(){return d(i)},get raw(){return{...i}},set:w,remove:y,reset:m,cleanup(){a&&window.removeEventListener("popstate",a)}}}export{g as useQueryParams};
|