@donotdev/ui 0.3.3 → 0.3.5
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/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +1 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts +8 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +1 -1
- package/dist/crud/components/useRecordBreadcrumb.d.ts +1 -1
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
- package/dist/dndev.css +733 -952
- package/dist/internal/common/DnDevErrorBoundary.d.ts +3 -1
- package/dist/internal/common/DnDevErrorBoundary.d.ts.map +1 -1
- package/dist/internal/common/DnDevErrorBoundary.js +1 -1
- package/dist/internal/devtools/DebugTools.d.ts.map +1 -1
- package/dist/internal/devtools/DebugTools.js +1 -1
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +1 -1
- package/dist/internal/layout/components/FontHead.d.ts +30 -0
- package/dist/internal/layout/components/FontHead.d.ts.map +1 -0
- package/dist/internal/layout/components/FontHead.js +1 -0
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.js +1 -1
- package/dist/internal/providers/UIProviders.d.ts.map +1 -1
- package/dist/internal/providers/UIProviders.js +1 -1
- package/dist/next.d.ts +2 -1
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +1 -1
- package/dist/routing/AuthGuard.d.ts +3 -0
- package/dist/routing/AuthGuard.d.ts.map +1 -1
- package/dist/routing/AuthGuard.js +1 -1
- package/dist/routing/hooks/hooks.next.d.ts +1 -1
- package/dist/routing/hooks/hooks.next.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/types.d.ts +10 -0
- package/dist/routing/hooks/types.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.d.ts +9 -3
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +1 -1
- package/dist/routing/hooks/useNavigate.vite.d.ts +9 -3
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +1 -1
- package/dist/routing/index.d.ts +1 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/routing/parentRoute.d.ts +7 -21
- package/dist/routing/parentRoute.d.ts.map +1 -1
- package/dist/routing/parentRoute.js +1 -1
- package/dist/styles/index.css +705 -121
- package/dist/symbol-index.json +1 -1
- package/guidelines/COMPONENTS.md +1 -1
- package/guidelines/LAYOUTS.md +2 -0
- package/guidelines/PAGES.md +3 -0
- package/guidelines/ROUTING.md +41 -0
- package/guidelines/SEO.md +5 -5
- package/package.json +6 -7
- package/dist/dndev-next.css +0 -13753
- package/dist/files/inter-cyrillic-300-normal.woff +0 -0
- package/dist/files/inter-cyrillic-300-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-400-normal.woff +0 -0
- package/dist/files/inter-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-600-normal.woff +0 -0
- package/dist/files/inter-cyrillic-600-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-700-normal.woff +0 -0
- package/dist/files/inter-cyrillic-700-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-300-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-300-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-400-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-600-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-700-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/files/inter-greek-300-normal.woff +0 -0
- package/dist/files/inter-greek-300-normal.woff2 +0 -0
- package/dist/files/inter-greek-400-normal.woff +0 -0
- package/dist/files/inter-greek-400-normal.woff2 +0 -0
- package/dist/files/inter-greek-600-normal.woff +0 -0
- package/dist/files/inter-greek-600-normal.woff2 +0 -0
- package/dist/files/inter-greek-700-normal.woff +0 -0
- package/dist/files/inter-greek-700-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-300-normal.woff +0 -0
- package/dist/files/inter-greek-ext-300-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-400-normal.woff +0 -0
- package/dist/files/inter-greek-ext-400-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-600-normal.woff +0 -0
- package/dist/files/inter-greek-ext-600-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-700-normal.woff +0 -0
- package/dist/files/inter-greek-ext-700-normal.woff2 +0 -0
- package/dist/files/inter-latin-300-normal.woff +0 -0
- package/dist/files/inter-latin-300-normal.woff2 +0 -0
- package/dist/files/inter-latin-400-normal.woff +0 -0
- package/dist/files/inter-latin-400-normal.woff2 +0 -0
- package/dist/files/inter-latin-600-normal.woff +0 -0
- package/dist/files/inter-latin-600-normal.woff2 +0 -0
- package/dist/files/inter-latin-700-normal.woff +0 -0
- package/dist/files/inter-latin-700-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-300-normal.woff +0 -0
- package/dist/files/inter-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-400-normal.woff +0 -0
- package/dist/files/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-600-normal.woff +0 -0
- package/dist/files/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-700-normal.woff +0 -0
- package/dist/files/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-300-normal.woff +0 -0
- package/dist/files/inter-vietnamese-300-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-400-normal.woff +0 -0
- package/dist/files/inter-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-600-normal.woff +0 -0
- package/dist/files/inter-vietnamese-600-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-700-normal.woff +0 -0
- package/dist/files/inter-vietnamese-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-400-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-500-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-600-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-700-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-400-normal.woff +0 -0
- package/dist/files/playfair-display-latin-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-500-normal.woff +0 -0
- package/dist/files/playfair-display-latin-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-600-normal.woff +0 -0
- package/dist/files/playfair-display-latin-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-700-normal.woff +0 -0
- package/dist/files/playfair-display-latin-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-400-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-500-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-600-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-700-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-400-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-500-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-600-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-700-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-700-normal.woff2 +0 -0
- package/dist/files/press-start-2p-cyrillic-400-normal.woff +0 -0
- package/dist/files/press-start-2p-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-cyrillic-ext-400-normal.woff +0 -0
- package/dist/files/press-start-2p-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-greek-400-normal.woff +0 -0
- package/dist/files/press-start-2p-greek-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-latin-400-normal.woff +0 -0
- package/dist/files/press-start-2p-latin-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-latin-ext-400-normal.woff +0 -0
- package/dist/files/press-start-2p-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-400-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-700-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-700-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-ext-400-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-ext-700-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/files/roboto-greek-400-normal.woff +0 -0
- package/dist/files/roboto-greek-400-normal.woff2 +0 -0
- package/dist/files/roboto-greek-700-normal.woff +0 -0
- package/dist/files/roboto-greek-700-normal.woff2 +0 -0
- package/dist/files/roboto-greek-ext-400-normal.woff +0 -0
- package/dist/files/roboto-greek-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-greek-ext-700-normal.woff +0 -0
- package/dist/files/roboto-greek-ext-700-normal.woff2 +0 -0
- package/dist/files/roboto-latin-400-normal.woff +0 -0
- package/dist/files/roboto-latin-400-normal.woff2 +0 -0
- package/dist/files/roboto-latin-700-normal.woff +0 -0
- package/dist/files/roboto-latin-700-normal.woff2 +0 -0
- package/dist/files/roboto-latin-ext-400-normal.woff +0 -0
- package/dist/files/roboto-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-latin-ext-700-normal.woff +0 -0
- package/dist/files/roboto-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/roboto-math-400-normal.woff +0 -0
- package/dist/files/roboto-math-400-normal.woff2 +0 -0
- package/dist/files/roboto-math-700-normal.woff +0 -0
- package/dist/files/roboto-math-700-normal.woff2 +0 -0
- package/dist/files/roboto-symbols-400-normal.woff +0 -0
- package/dist/files/roboto-symbols-400-normal.woff2 +0 -0
- package/dist/files/roboto-symbols-700-normal.woff +0 -0
- package/dist/files/roboto-symbols-700-normal.woff2 +0 -0
- package/dist/files/roboto-vietnamese-400-normal.woff +0 -0
- package/dist/files/roboto-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/roboto-vietnamese-700-normal.woff +0 -0
- package/dist/files/roboto-vietnamese-700-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-300-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-300-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-400-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-400-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-500-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-500-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-600-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-600-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-700-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-700-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-300-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-400-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-500-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-600-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-700-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-300-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-300-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-400-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-500-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-500-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-600-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-600-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-700-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-700-normal.woff2 +0 -0
- package/dist/internal/layout/components/FontPreloadLinks.d.ts +0 -19
- package/dist/internal/layout/components/FontPreloadLinks.d.ts.map +0 -1
- package/dist/internal/layout/components/FontPreloadLinks.js +0 -1
|
@@ -22,7 +22,9 @@ interface DnDevErrorBoundaryState {
|
|
|
22
22
|
error: unknown;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* React error boundary for catching and handling component errors
|
|
25
|
+
* React error boundary for catching and handling component errors.
|
|
26
|
+
* Next router control flow ({@link isNextRouterError}) passes through to Next's
|
|
27
|
+
* boundaries, so a page's `notFound()` shows the app's 404 page, not the error fallback.
|
|
26
28
|
*
|
|
27
29
|
* @version 0.1.0
|
|
28
30
|
* @since 0.0.1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDevErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/internal/common/DnDevErrorBoundary.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,KAAK,EAAE,OAAO,CAAC;QACf,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,KAAK,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC;CACvC;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"DnDevErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/internal/common/DnDevErrorBoundary.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,KAAK,EAAE,OAAO,CAAC;QACf,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,KAAK,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC;CACvC;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;AAkBD;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,SAAS,CAC/C,uBAAuB,EACvB,uBAAuB,CACxB;gBACa,KAAK,EAAE,uBAAuB;IAK1C,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,uBAAuB;IAMxE,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;IAatD,UAAU,aAER;IAEF,MAAM;CAYP;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";var a=Object.defineProperty;var l=(
|
|
1
|
+
"use client";var a=Object.defineProperty;var l=(e,t,r)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var n=(e,t,r)=>l(e,typeof t!="symbol"?t+"":t,r);import{Component as i}from"react";import{handleError as u}from"@donotdev/core";function c(e){if(typeof e!="object"||e===null||!("digest"in e))return!1;let{digest:t}=e;if(typeof t!="string")return!1;let r=t.split(";")[0];return r==="NEXT_HTTP_ERROR_FALLBACK"||r==="NEXT_REDIRECT"}var o=class extends i{constructor(r){super(r);n(this,"resetError",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){if(c(r))throw r;return{hasError:!0,error:r}}componentDidCatch(r,s){u(r,{userMessage:`A ${this.props.level||"component"} error occurred`,context:{errorInfo:s,component:"DnDevErrorBoundary",level:this.props.level||"component"},showNotification:!1})}render(){return this.state.hasError?this.props.fallback({error:this.state.error,resetError:this.resetError,componentStack:null,eventId:null}):this.props.children}},f=o;export{o as DnDevErrorBoundary,f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugTools.d.ts","sourceRoot":"","sources":["../../../src/internal/devtools/DebugTools.tsx"],"names":[],"mappings":"AA+BA,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,eAAe,eAAe,
|
|
1
|
+
{"version":3,"file":"DebugTools.d.ts","sourceRoot":"","sources":["../../../src/internal/devtools/DebugTools.tsx"],"names":[],"mappings":"AA+BA,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,eAAe,eAAe,gCA+NjD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Bug as
|
|
1
|
+
"use client";import{Bug as y,Trash2 as P,X as I}from"lucide-react";import{Cookie as F}from"lucide-react";import{useEffect as U,useRef as V,useState as c}from"react";import{Button as s,BUTTON_VARIANT as o,Card as _,Floating as H,Label as R,Portal as A,cn as E,Stack as h}from"@donotdev/components";import{useBreakpoint as p,useConsent as f}from"@donotdev/core";import{DebugDialog as X}from"./components/DebugDialog.js";import{Fragment as j,jsx as t,jsxs as v}from"react/jsx-runtime";var Y=({className:T})=>{let[x,w]=c(!1),[d,C]=c(!1),[i,k]=c(null),[u,D]=c(!1),m=V({x:0,y:0}),l=f("hasConsented"),B=f("showCookieBanner"),S=f("reset"),a=p("current"),L=p("width"),M=p("height");U(()=>{if(!u)return;let e=r=>{let g=Math.max(0,Math.min(r.clientX-m.current.x,window.innerWidth-300)),b=Math.max(0,Math.min(r.clientY-m.current.y,window.innerHeight-200));k({x:g,y:b})},n=()=>D(!1);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n)}},[u]);let N=e=>{if(e.target.closest(".drag-handle")){let r=e.currentTarget.getBoundingClientRect(),g=i?.x??r.left,b=i?.y??r.top;D(!0),m.current={x:e.clientX-g,y:e.clientY-b}}},O=()=>{let e=!d,n=e?"1":"0";document.documentElement.style.setProperty("--debug-enabled",n),e?document.documentElement.setAttribute("data-debug","true"):document.documentElement.removeAttribute("data-debug"),C(e)};return x?t(A,{children:t("div",{className:E("dndev-z-overlay drag-handle",T),style:{position:"fixed",insetInlineStart:i?.x??"calc(var(--sidebar-width) + var(--gap-lg))",top:i?.y??"calc(var(--header-height) + var(--gap-lg))",cursor:u?"grabbing":"grab",minWidth:"20rem"},onMouseDown:N,children:t(_,{title:v(h,{direction:"row",align:"center",justify:"between",children:[t(X,{}),t(s,{onClick:()=>w(!1),icon:I,variant:o.GHOST,title:"Hide Debug Tools"})]}),content:t(j,{children:v(h,{direction:"row",align:"center",justify:"center",gap:"tight",wrap:"wrap",children:[t(s,{onClick:O,variant:d?o.DEFAULT:o.OUTLINE,icon:y,title:`Display Lines (${d?"ON":"OFF"})`,children:"Display Lines"}),t(s,{onClick:async()=>{try{if(S(),localStorage.clear(),sessionStorage.clear(),"caches"in window){let e=await caches.keys();await Promise.all(e.map(n=>caches.delete(n)))}if("indexedDB"in window&&"databases"in indexedDB)try{let e=await indexedDB.databases();await Promise.all(e.map(n=>n.name&&indexedDB.deleteDatabase(n.name)))}catch{}typeof globalThis<"u"&&globalThis._DNDEV_STORES_&&(globalThis._DNDEV_STORES_={}),window.location.reload()}catch{}},variant:o.OUTLINE,icon:P,title:"Clear all Cache",children:"Clear Cache"}),t(s,{onClick:()=>{l&&B()},variant:l?o.OUTLINE:o.GHOST,icon:F,title:l?"Reset consent (show banner)":"Consent banner visible",children:l?"Show Cookie Banner":"Cookie Banner Visible"})]})}),footer:t(h,{align:"center",justify:"center",className:E("drag-handle",a==="mobile"&&"dndev-text-destructive",a==="tablet"&&"dndev-text-primary",a==="laptop"&&"dndev-text-secondary-foreground",a==="desktop"&&"dndev-text-muted-foreground"),style:{cursor:"grab"},children:v(R,{className:"dndev-font-mono dndev-text-lg",children:[a.toUpperCase()," : ",L," \xD7 ",M,"px"]})})})})}):t(H,{placement:"bottom-start",children:t(s,{onClick:()=>w(!0),icon:y,title:"Show Debug Tools"})})},K=Y;export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/AutoMetaTags.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/AutoMetaTags.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAuM3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,EAAE,aAsN1B,CAAC;AAEF;;;GAGG;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useMemo as
|
|
1
|
+
"use client";import{useMemo as v}from"react";import{breadcrumbNamespaces as x,buildBreadcrumbJsonLd as C,formatTrailingSlash as F,getLanguageRouting as I,isMultilingual as J,languageUrl as R,languageUrls as z,matchRoute as q,routeHeadTags as W,routeSeo as G,siteHeadTags as V,SITE_LOGO_PATH as Y,useTranslation as K}from"@donotdev/core";import{getDndevConfig as y}from"@donotdev/core";import{useSeoConfig as Q,useAppConfig as X,getPlatformEnvVar as Z}from"@donotdev/core";import{useRoutePath as ee,useUrlLanguage as te}from"@donotdev/ui/routing/hooks";import{useIsNotFoundDocument as ae}from"../../../routing/NotFoundDocument.js";import{headTagElement as _}from"./headTagElement.js";import{HeadTags as ne}from"./HeadTags.js";import{prerenderedHead as re}from"./prerenderedHead.js";import{appTrailingSlash as se}from"./trailingSlash.js";import{jsx as o,jsxs as pe}from"react/jsx-runtime";var oe=[],ie={meta:{},serverMetadata:!1,authOnly:!1,recordBreadcrumb:!1};function le(t){let n=y(),s=n?.routes?.mapping,l=n?.routes?.manifest?.serverMetadataPaths??[],a=n?.routes?.manifest?.recordBreadcrumbPaths??[],i=e=>({meta:e.meta,serverMetadata:l.includes(e.path),authOnly:!!e.auth,recordBreadcrumb:a.includes(e.path)});if(s&&Array.isArray(s)){let e=q(s,t);if(e)return i(e.route)}let r=t.split("/").filter(Boolean);return r.length>0?{meta:{namespace:r[0]},serverMetadata:!1,authOnly:!1,recordBreadcrumb:!1}:{meta:{},serverMetadata:!1,authOnly:!1,recordBreadcrumb:!1}}function ce(t,n,s){return{"@context":"https://schema.org","@type":"WebSite",name:n,url:t||"/",potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${t}${F("/search?q={search_term_string}",s)}`},"query-input":"required name=search_term_string"}}}function ue(t,n,s,l){let a=l?Object.values(l).filter(i=>!!i):[];return{"@context":"https://schema.org","@type":"Organization",name:n,url:t||"/",...s&&{description:s},...a.length>0&&{sameAs:a},logo:{"@type":"ImageObject",url:`${t}${Y}`}}}function me(){return{prerender:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/api/*"}},{not:{href_matches:"/admin/*"}},{not:{href_matches:"/login*"}},{not:{href_matches:"/signin*"}},{not:{href_matches:"/signup*"}},{not:{href_matches:"/logout*"}}]},eagerness:"moderate"}],prefetch:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/api/*"}}]},eagerness:"conservative"}]}}var de=()=>{let t=ee(),n=y()?.routes?.mapping??oe,s=v(()=>x(t,n),[t,n]),{t:l}=K(["dndev",...s]),a=Q(),i=X("app"),r=a&&a.siteName||i?.name||"",e=Z("APP_URL")||"",B=y()?.routes?.manifest?.hasBlogFeed===!0,c=ae(),{meta:p,serverMetadata:S,authOnly:M,recordBreadcrumb:N}=c?ie:le(t),E=S,m=I(),g=te(),d=se(),O=u=>R(u,g,e,m,d),f=c||S?null:re(O(t)),h=v(()=>{if(!a)return null;let{defaultNamespace:u="home",defaultImage:b}=a;return G({meta:p,ns:c?null:p.namespace||null,defaultNs:c?null:u,t:l,siteName:r,baseUrl:e,url:c?null:R(t,g,e,m,d),defaultImage:b,authOnly:M})},[c,t,g,d,p,M,r,e,a,l]);if(!a||!h)return null;let{twitterHandle:T,staticTags:w={}}=a,A=a.speculationRules===!0,P=a.hreflang!==!1,D=a.breadcrumbSchema!==!1,H=a.websiteSchema!==!1,L=a.organizationSchema!==!1,U=P&&!c&&J(m.languages),$=f?f.tags:E?[]:W(h,{siteName:r,baseUrl:e}),j=V({url:e?h.url:null,siteName:r,alternates:U?z(t,e,m,d):null,defaultLanguage:m.defaultLanguage}),k=N||f?.breadcrumb===!0;return pe(ne,{children:[j.map(_),$.map(_),T&&o("meta",{name:"twitter:site",content:`@${T}`}),o("meta",{name:"format-detection",content:"telephone=no"}),o("meta",{name:"mobile-web-app-capable",content:"yes"}),o("meta",{name:"apple-mobile-web-app-status-bar-style",content:"default"}),Object.entries(w).map(([u,b])=>o("meta",{name:u,content:b},u)),e&&B&&o("link",{rel:"alternate",type:"application/rss+xml",title:`${r} Blog`,href:`${e}/rss.xml`}),D&&!c&&!k&&t!=="/"&&o("script",{type:"application/ld+json",children:JSON.stringify(C({pathname:t,routes:n,siteName:r,t:l,defaultNs:a.defaultNamespace??"home",pageUrl:O}))}),H&&e&&o("script",{type:"application/ld+json",children:JSON.stringify(ce(e,r,d))}),L&&e&&t==="/"&&i?.links&&Object.values(i.links).some(Boolean)&&o("script",{type:"application/ld+json",children:JSON.stringify(ue(e,r,i.description,i.links))}),A&&o("script",{type:"speculationrules",children:JSON.stringify(me())})]})},Re=de;export{de as AutoMetaTags,Re as default};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The font plan as the document head needs it (`src/app/fonts.generated.ts`).
|
|
3
|
+
*
|
|
4
|
+
* @version 0.1.0
|
|
5
|
+
* @since 0.3.3
|
|
6
|
+
* @author AMBROISE PARK Consulting
|
|
7
|
+
*/
|
|
8
|
+
export interface FontHeadData {
|
|
9
|
+
/** Every `@font-face` of the app (web faces, then the size-matched fallback faces) */
|
|
10
|
+
readonly css: string;
|
|
11
|
+
/** Per app language: the first-paint font file URLs */
|
|
12
|
+
readonly preloads: Readonly<Record<string, readonly string[]>>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Font preloads of `lang` and the inline `@font-face` style.
|
|
16
|
+
*
|
|
17
|
+
* @param props.fonts - The generated font plan (`FONTS` of `fonts.generated.ts`)
|
|
18
|
+
* @param props.lang - The page language
|
|
19
|
+
* @returns The `<style>` element (null when the theme uses system fonts only)
|
|
20
|
+
* @throws {Error} When the plan has no entry for `lang` (the generated file is stale)
|
|
21
|
+
*
|
|
22
|
+
* @version 0.1.0
|
|
23
|
+
* @since 0.3.3
|
|
24
|
+
* @author AMBROISE PARK Consulting
|
|
25
|
+
*/
|
|
26
|
+
export declare function FontHead({ fonts, lang }: {
|
|
27
|
+
fonts: FontHeadData;
|
|
28
|
+
lang: string;
|
|
29
|
+
}): import("react").JSX.Element | null;
|
|
30
|
+
//# sourceMappingURL=FontHead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontHead.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/FontHead.tsx"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CAChE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,sCAgB9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{preload as s}from"react-dom";import{FONT_STYLE_ID as n}from"@donotdev/core";import{jsx as a}from"react/jsx-runtime";function l({fonts:e,lang:r}){let o=e.preloads[r];if(!o)throw new Error(`[dndev] FontHead: the font plan has no preloads for language '${r}' (src/app/fonts.generated.ts is stale: rebuild).`);for(let t of o)s(t,{as:"font",type:"font/woff2",crossOrigin:"anonymous"});return e.css?a("style",{href:n,precedence:n,children:e.css}):null}export{l as FontHead};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDevMergedBar.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/zones/DnDevMergedBar.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavC,MAAM,WAAW,mBAAmB;IAClC,mBAAmB;IACnB,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,4DAA4D;IAC5D,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,uBAAuB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,GAAG,EACH,OAAO,EACP,MAAM,GACP,EAAE,mBAAmB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"DnDevMergedBar.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/zones/DnDevMergedBar.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavC,MAAM,WAAW,mBAAmB;IAClC,mBAAmB;IACnB,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,4DAA4D;IAC5D,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,uBAAuB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,GAAG,EACH,OAAO,EACP,MAAM,GACP,EAAE,mBAAmB,GAAG,SAAS,CAiEjC;AAED,eAAO,MAAM,cAAc,qEAAgC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{ChevronUp as R,Menu as D}from"lucide-react";import{memo as S,useState as T,useEffect as b}from"react";import{Stack as
|
|
1
|
+
"use client";import{ChevronUp as R,Menu as D}from"lucide-react";import{memo as S,useState as T,useEffect as b}from"react";import{Stack as c,Button as B,Sheet as M,BUTTON_VARIANT as A,Separator as l,SEPARATOR_VARIANT as d}from"@donotdev/components";import{useTranslation as O}from"@donotdev/core";import{useRoutePath as C}from"@donotdev/ui/routing/hooks";import{Fragment as m,jsx as e,jsxs as o}from"react/jsx-runtime";function E({position:t,height:P,trigger:g,top:a,content:r,bottom:n}){let{t:s}=O("dndev"),p=t==="top"?D:R,u=t==="top"?"left":t,[h,i]=T(!1),f=C();b(()=>{i(!1)},[f]);let v=o(c,{direction:"column",className:"merged-bar-sheet-content",children:[a&&o(m,{children:[a,e(l,{variant:d.MUTED})]}),r&&e("div",{className:"merged-bar-sheet-scroll",children:r}),n&&o(m,{children:[e(l,{variant:d.MUTED}),n]})]}),N=e(B,{variant:A.GHOST,icon:p,"aria-label":"Open navigation"});return e("div",{className:"merged-bar","data-position":t,children:o(c,{direction:"row",align:"center",justify:"between",className:"merged-bar-trigger",children:[g,e(M,{trigger:N,side:u,open:h,onOpenChange:i,title:s("sheet.navigation",{defaultValue:"Navigation"}),closeLabel:s("sheet.close",{defaultValue:"Close sheet"}),children:v})]})})}var y=S(E);export{y as DnDevMergedBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIProviders.d.ts","sourceRoot":"","sources":["../../../src/internal/providers/UIProviders.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UIProviders.d.ts","sourceRoot":"","sources":["../../../src/internal/providers/UIProviders.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,OAAO,CAAC;AAwDrE,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,YAAY,CAiBxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as l,useRef as m,useState as c}from"react";import{Dialog as d,LinkRendererProvider as u,Toaster as s,TooltipProvider as v}from"@donotdev/components";import{getRoutes as f,useOverlayStore as a}from"@donotdev/core";import{useNavigate as P,useRoutePath as g}from"@donotdev/ui/routing/hooks";import{FormNavigationProvider as R,isCrudModuleAvailable as h}from"../../crud/crudImports.js";import{Link as k}from"../../routing/Link.js";import{getParentRoutePath as N}from"../../routing/parentRoute.js";import F from"../common/DnDevErrorBoundary.js";import b from"../common/GlobalErrorFallback.js";import{jsx as e,jsxs as B}from"react/jsx-runtime";function E({href:o,...t}){return e(k,{path:o,...t})}function y(o){return e(b,{...o})}function D({children:o}){let t=P(),n=g(),r=m({navigate:t,pathname:n});l(()=>{r.current={navigate:t,pathname:n}});let[i]=c(()=>({navigate:p=>{r.current.navigate(p)},currentPath:()=>r.current.pathname,parentPath:()=>N(r.current.pathname,f())}));return e(R,{value:i,children:o})}function q({children:o}){return e(F,{level:"app",fallback:y,children:e(u,{value:E,children:B(v,{children:[h?e(D,{children:o}):o,e(s,{}),e(L,{})]})})})}function L(){let o=a(r=>r.isOpen),t=a(r=>r.content),n=a(r=>r.closeModal);return e(d,{open:o,onOpenChange:r=>{r||n()},children:t})}export{q as UIProviders};
|
package/dist/next.d.ts
CHANGED
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
* @author AMBROISE PARK Consulting
|
|
8
8
|
*/
|
|
9
9
|
export { NextJsAppProviders } from './providers/NextJsAppProviders';
|
|
10
|
-
export {
|
|
10
|
+
export { FontHead } from './internal/layout/components/FontHead';
|
|
11
|
+
export type { FontHeadData } from './internal/layout/components/FontHead';
|
|
11
12
|
//# sourceMappingURL=next.d.ts.map
|
package/dist/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,YAAY,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC"}
|
package/dist/next.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NextJsAppProviders as
|
|
1
|
+
import{NextJsAppProviders as e}from"./providers/NextJsAppProviders.js";import{FontHead as a}from"./internal/layout/components/FontHead.js";export{a as FontHead,e as NextJsAppProviders};
|
|
@@ -18,6 +18,9 @@ interface AuthGuardProps {
|
|
|
18
18
|
* For SPA navigation, auth is intercepted in useNavigate (before page mount).
|
|
19
19
|
* This component handles the cold-load case: user pastes a protected URL directly.
|
|
20
20
|
* It redirects to authRoute, saves returnTo, and AuthReturnTo handles the redirect back.
|
|
21
|
+
* A user who signs out (or deletes the account) on the page is sent to authRoute
|
|
22
|
+
* without a returnTo or the guard toast: they left on purpose, and a saved returnTo
|
|
23
|
+
* would send the next sign-in (or the sign-in that ends a sign-up) back here.
|
|
21
24
|
*
|
|
22
25
|
* @version 0.1.0
|
|
23
26
|
* @since 0.0.1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/routing/AuthGuard.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EAEL,UAAU,EACV,kBAAkB,EAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAM/C;;GAEG;AACH,UAAU,cAAc;IACtB,wCAAwC;IACxC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/routing/AuthGuard.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EAEL,UAAU,EACV,kBAAkB,EAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAM/C;;GAEG;AACH,UAAU,cAAc;IACtB,wCAAwC;IACxC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,QAAQ,EAAE,QAAoC,GAC/C,EAAE,cAAc,+BA+ChB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAG9D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IACvB,OAAO,UAAU,CAAC,KAAK,GACvB,OAAO,UAAU,CAAC,IAAI,GACtB,OAAO,UAAU,CAAC,KAAK,CAS1B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EACA,OAAO,UAAU,CAAC,KAAK,GACvB,OAAO,UAAU,CAAC,IAAI,GACtB,OAAO,UAAU,CAAC,KAAK,GAC1B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY;;;;;;EAW3B;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE,QAAQ,GAAG,KAAK,WAEW,CAAC,iCAOnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B,iCAAiC;kBACrB,KAAK;IAEjB,oCAAoC;oBACtB,QAAQ;IAEtB,yCAAyC;gBAC/B,QAAQ;IAKlB,uDAAuD;iBAC5C,QAAQ;IAKnB,gCAAgC;iBAExB,CAAC,OAAO,kBAAkB,EAAE,MAAM,OAAO,kBAAkB,CAAC,KACjE,QAAQ;IAKX,eAAe;eACN,QAAQ;IAKjB,mBAAmB;mBACN,QAAQ;IAKrB,sCAAsC;oBACxB,QAAQ;IAMtB,wBAAwB;uBACL,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,KAAG,QAAQ;CAItE,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as A,useRef as m}from"react";import{Spinner as S}from"@donotdev/components";import{FEATURE_STATUS as g,USER_ROLES as a,SUBSCRIPTION_TIERS as p,isClient as U,safeSessionStorage as d}from"@donotdev/core";import{useRedirectGuard as I,useNavigate as P}from"@donotdev/ui/routing/hooks";import{useAuthSafe as r}from"../utils/useAuthSafe.js";import{Fragment as R,jsx as o}from"react/jsx-runtime";function l({auth:e,children:t,fallback:u=()=>o(S,{overlay:!0})}){let n=P(),s=r("user"),E=r("status"),{shouldRedirect:i,redirectTo:f,isChecking:h}=I({auth:e}),c=m(!1);return s&&(c.current=!0),A(()=>{i&&f&&(!s&&!c.current&&U()&&(d.setItem("dndev.auth.returnTo",window.location.pathname+window.location.search),d.setItem("dndev.auth.guardToast","1")),n(f,{replace:!0}))},[i,f,n,s]),e===!1?o(R,{children:t}):i||h?o(S,{overlay:!0}):E===g.INITIALIZING?o(u,{}):o(R,{children:t})}function C(e){return r("can")?.navigate(e)??!1}function L(){return r("user")?.role||a.GUEST}function G(e){return r("user")?.role===e}function b(){let e=r("user"),t=r("userSubscription"),u=r("loading");return{authenticated:!!e,role:e?.role,tier:t?.tier||"free",loading:u,userId:e?.id}}function q(e,t){return n=>o(l,{auth:t,children:o(e,{...n})})}var v={public:()=>!1,required:()=>({required:!0}),user:()=>({required:!0,role:a.USER}),admin:()=>({required:!0,role:a.ADMIN}),tier:e=>({required:!0,tier:e}),pro:()=>({required:!0,tier:p.PRO}),premium:()=>({required:!0,tier:p.PREMIUM}),adminPro:()=>({required:!0,role:a.ADMIN,tier:p.PRO}),custom:e=>({required:!0,validate:e})},x=l;export{l as AuthGuard,v as createAuthConfig,x as default,b as useAuthState,C as useCanNavigate,G as useHasRole,L as useUserRole,q as withAuth};
|
|
@@ -17,6 +17,6 @@ export { useMatch } from './useMatch.next';
|
|
|
17
17
|
export { useQueryParams } from './useQueryParams.next';
|
|
18
18
|
export { useRedirectGuard } from './useRedirectGuard.next';
|
|
19
19
|
export { useLocalizedPath, useUrlLanguage } from './useUrlLanguage.next';
|
|
20
|
-
export type { NavigateOptions } from './types';
|
|
20
|
+
export type { Navigate, NavigateFunction, NavigateOptions } from './types';
|
|
21
21
|
export type { RedirectGuardOptions, RedirectGuardResult, } from './useRedirectGuard.next';
|
|
22
22
|
//# sourceMappingURL=hooks.next.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/hooks.next.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/hooks.next.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useRouter as
|
|
1
|
+
"use client";import{useTransition as G}from"react";import{useRouter as g}from"next/navigation";import{isClient as $,useOverlayStore as U}from"@donotdev/core";import{usePathname as k}from"next/navigation";import{getLanguageRouting as v,localizePath as C,publicPathname as L,splitLanguagePath as I}from"@donotdev/core";function b(){return I(L(k()??"/"),v()).language}function h(){let e=b(),t=v();return r=>C(r,e,t)}function P(){let e=g(),t=U(o=>o.closeAll),r=h(),[u,n]=G(),c=(o,a)=>{if(t(),o==="back"){n(()=>e.back());return}let s=r(o);if(n(()=>{a?.replace?e.replace(s):e.push(s)}),a?.preserveScroll&&$()){let m=window.scrollY;requestAnimationFrame(()=>{window.scrollTo({top:m,behavior:"auto"})})}};return Object.assign(c,{navigate:c,pending:u})}function K(){let e=g();return()=>e.back()}function E(){let e=g();return()=>e.refresh()}function O(){let e=g(),t=h();return r=>e.prefetch(t(r))}import{useSearchParams as D}from"next/navigation";import{usePathname as F}from"next/navigation";import{getLanguageRouting as z,publicPathname as q,splitLanguagePath as Q,stripTrailingSlash as j}from"@donotdev/core";function p(){return Q(q(j(F()??"/")),z()).path}function R(){let e=p(),r=D().toString(),u=r?`?${r}`:void 0;return{pathname:e,search:u,hash:"",state:null}}import{useParams as M}from"next/navigation";function x(){let e=M();return e||{}}function _(e){let r=x()[e];if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r[0]}import{useSearchParams as B}from"next/navigation";function A(){return B()}function Y(e){let t=p(),r=e.replace(/:[^/]+/g,"([^/]+)").replace(/\*/g,".*"),u=new RegExp(`^${r}$`),n=t.match(u);if(!n)return null;let c=e.match(/:[^/]+/g)?.map(a=>a.slice(1))||[],o={};return c.forEach((a,s)=>{o[a]=n[s+1]||""}),{params:o,pathname:t,pattern:e}}import{useCallback as S}from"react";function H(){let e=A(),t=P(),r=R(),u=S((o,a)=>{let s=new URLSearchParams(e.toString());s.set(o,a);let m=s.toString(),i=`${r.pathname||"/"}${m?`?${m}`:""}`;t(i)},[e,t,r.pathname]),n=S(o=>{let a=new URLSearchParams(e.toString());a.delete(o);let s=a.toString(),l=`${r.pathname||"/"}${s?`?${s}`:""}`;t(l)},[e,t,r.pathname]),c=S(()=>{let o=r.pathname||"/";t(o)},[t,r.pathname]);return{query:e,setQuery:u,removeQuery:n,clearQueries:c}}import{useMemo as V}from"react";import{isClient as W,FEATURE_STATUS as X}from"@donotdev/core";import{useAppConfig as ee,useAuthConfig as te}from"@donotdev/core";import*as N from"@donotdev/auth";import{DEGRADED_AUTH_API as Z}from"@donotdev/core";var w=N?.useAuth;function J(e){return Z[e]}function d(e){return w?w(e):J(e)}var Ie=N?.PasswordResetCallback??(()=>null);function re(e={}){let{auth:t,redirectTo:r,condition:u}=e,n=te(),c=ee().auth===!1,o=d("user"),a=d("can"),s=d("status");return V(()=>{let l={shouldRedirect:!1,redirectTo:null,isChecking:!1};if(!W())return l;if(s===X.INITIALIZING)return{...l,isChecking:!0};if(u){let i=u(o,s);return{shouldRedirect:i,redirectTo:i&&r||null,isChecking:!1}}if(t!==!1&&t!==void 0){if(!a)return l;if(!a.navigate(t)){if(c&&!r)throw new Error("[dndev] This route declares auth requirements but AppConfig.auth is false, so there is no auth route to redirect to. Enable auth in AppConfig or remove the route's auth requirement.");let i=null;if(typeof t=="object"&&t.required&&!o){let f=window.location.search,T=f.includes("code=")||f.includes("state=")||f.includes("error="),y=n.authRoute;T?i=`${y}${f}`:i=y}else typeof t=="object"&&t.role?i=n.roleRoute:typeof t=="object"&&t.tier?i=n.tierRoute:i=n.roleRoute;return{shouldRedirect:!0,redirectTo:r||i,isChecking:!1}}}return l},[t,s,o,a,u,r,c,n.authRoute,n.roleRoute,n.tierRoute])}export{K as useBack,h as useLocalizedPath,R as useLocation,Y as useMatch,P as useNavigate,x as useParams,O as usePrefetch,H as useQueryParams,re as useRedirectGuard,E as useRefresh,_ as useRouteParam,p as useRoutePath,A as useSearchParams,b as useUrlLanguage};
|
|
@@ -17,6 +17,6 @@ export { useMatch } from './useMatch.vite';
|
|
|
17
17
|
export { useQueryParams } from './useQueryParams.vite';
|
|
18
18
|
export { useRedirectGuard } from './useRedirectGuard.vite';
|
|
19
19
|
export { useLocalizedPath, useUrlLanguage } from './useUrlLanguage.vite';
|
|
20
|
-
export type { NavigateOptions } from './types';
|
|
20
|
+
export type { Navigate, NavigateFunction, NavigateOptions } from './types';
|
|
21
21
|
export type { RedirectGuardOptions, RedirectGuardResult, } from './useRedirectGuard.vite';
|
|
22
22
|
//# sourceMappingURL=hooks.vite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/hooks.vite.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/hooks.vite.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useNavigate as
|
|
1
|
+
"use client";import{useTransition as k}from"react";import{useNavigate as y}from"react-router-dom";import{getLanguageRouting as I,isClient as G,splitLanguagePath as U,useOverlayStore as K}from"@donotdev/core";import{useHref as w}from"react-router-dom";import{getLanguageRouting as v,localizePath as N,splitLanguagePath as C}from"@donotdev/core";function p(){return C(w("/"),v()).language}function T(){let e=p(),t=v();return r=>N(r,e,t)}function d(){let e=y(),t=K(o=>o.closeAll),r=p(),[f,s]=k(),a=(o,u)=>{if(t(),o==="back"){s(()=>{e(-1)});return}let n=o.startsWith("/")?U(o,I()):null;if(n?.prefixed&&n.language!==r){window.location.assign(o);return}let i=n?.prefixed?n.path:o;s(()=>{e(i,u?.replace?{replace:!0}:void 0)})};return Object.assign(a,{navigate:a,pending:f})}function O(){let e=y();return()=>e(-1)}function $(){return()=>{G()&&window.location.reload()}}function E(){return e=>{}}import{useLocation as F}from"react-router-dom";function m(){return F()}import{useLocation as M}from"react-router-dom";function Q(){return M().pathname}import{useParams as j}from"react-router-dom";function R(){return j()}function q(e){let r=R()[e];if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r[0]}import{useSearchParams as D}from"react-router-dom";function P(){return D()[0]}import{useMatch as _}from"react-router-dom";function z(e){return _(e)}import{useCallback as A}from"react";function B(){let e=P(),t=d(),r=m(),f=A((o,u)=>{let n=new URLSearchParams(e.toString());n.set(o,u);let i=n.toString(),l=`${r.pathname||"/"}${i?`?${i}`:""}`;t(l)},[e,t,r.pathname]),s=A(o=>{let u=new URLSearchParams(e.toString());u.delete(o);let n=u.toString(),g=`${r.pathname||"/"}${n?`?${n}`:""}`;t(g)},[e,t,r.pathname]),a=A(()=>{let o=r.pathname||"/";t(o)},[t,r.pathname]);return{query:e,setQuery:f,removeQuery:s,clearQueries:a}}import{useMemo as Z}from"react";import{isClient as J,FEATURE_STATUS as V}from"@donotdev/core";import{useAppConfig as X,useAuthConfig as Y}from"@donotdev/core";import*as L from"@donotdev/auth";import{DEGRADED_AUTH_API as H}from"@donotdev/core";var S=L?.useAuth;function W(e){return H[e]}function h(e){return S?S(e):W(e)}var Ne=L?.PasswordResetCallback??(()=>null);function ee(e={}){let{auth:t,redirectTo:r,condition:f}=e,s=m(),a=Y(),o=X().auth===!1,u=h("user"),n=h("can"),i=h("status");return Z(()=>{let l={shouldRedirect:!1,redirectTo:null,isChecking:!1};if(!J())return l;if(i===V.INITIALIZING)return{...l,isChecking:!0};if(f){let c=f(u,i);return{shouldRedirect:c,redirectTo:c&&r||null,isChecking:!1}}if(t!==!1&&t!==void 0){if(!n)return l;if(!n.navigate(t)){if(o&&!r)throw new Error("[dndev] This route declares auth requirements but AppConfig.auth is false, so there is no auth route to redirect to. Enable auth in AppConfig or remove the route's auth requirement.");let c=null;if(typeof t=="object"&&t.required&&!u){let b=s.search.includes("code=")||s.search.includes("state=")||s.search.includes("error="),x=a.authRoute;b?c=`${x}${s.search}`:c=x}else typeof t=="object"&&t.role?c=a.roleRoute:typeof t=="object"&&t.tier?c=a.tierRoute:c=a.roleRoute;return{shouldRedirect:!0,redirectTo:r||c,isChecking:!1}}}return l},[t,i,u,n,f,r,s.search,o,a.authRoute,a.roleRoute,a.tierRoute])}export{O as useBack,T as useLocalizedPath,m as useLocation,z as useMatch,d as useNavigate,R as useParams,E as usePrefetch,B as useQueryParams,ee as useRedirectGuard,$ as useRefresh,q as useRouteParam,Q as useRoutePath,P as useSearchParams,p as useUrlLanguage};
|
|
@@ -14,4 +14,14 @@ export interface NavigateOptions {
|
|
|
14
14
|
/** Preserve scroll position (default: false, scrolls to top) */
|
|
15
15
|
preserveScroll?: boolean;
|
|
16
16
|
}
|
|
17
|
+
/** Navigates to an app path, or `'back'`. */
|
|
18
|
+
export type NavigateFunction = (path: string, options?: NavigateOptions) => void;
|
|
19
|
+
/**
|
|
20
|
+
* What `useNavigate()` returns: the navigate function, also carrying itself as
|
|
21
|
+
* `navigate` and the transition's `pending` (true until the new route has rendered).
|
|
22
|
+
*/
|
|
23
|
+
export type Navigate = NavigateFunction & {
|
|
24
|
+
navigate: NavigateFunction;
|
|
25
|
+
pending: boolean;
|
|
26
|
+
};
|
|
17
27
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG;IACxC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Navigate } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Navigation hook. Auth is handled by AuthGuard (cold-load redirect).
|
|
4
4
|
* Protected routes are hidden from unauthorized users via useAccessibleRoutes.
|
|
5
5
|
* App paths stay in the current URL's language (`/produits` → `/en/produits` on an
|
|
6
6
|
* English page); a path with an explicit language prefix keeps it.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Returns the navigate function itself, so `const navigate = useNavigate()` works as
|
|
9
|
+
* before. It also carries `navigate` and `pending`, for `const { navigate, pending } =
|
|
10
|
+
* useNavigate()`: the router call runs in a React transition and `pending` stays true
|
|
11
|
+
* until the App Router has rendered the new route. Use it for `loading` on the button
|
|
12
|
+
* that navigates. Overlays still close at the click (`closeAll`).
|
|
13
|
+
*
|
|
14
|
+
* @version 0.4.0
|
|
9
15
|
* @since 0.0.1
|
|
10
16
|
*/
|
|
11
|
-
export declare function useNavigate():
|
|
17
|
+
export declare function useNavigate(): Navigate;
|
|
12
18
|
export declare function useBack(): () => void;
|
|
13
19
|
export declare function useRefresh(): () => void;
|
|
14
20
|
export declare function usePrefetch(): (to: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigate.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavigate.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.next.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAqC,MAAM,SAAS,CAAC;AAG3E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CA6BtC;AAED,wBAAgB,OAAO,eAGtB;AAED,wBAAgB,UAAU,eAGzB;AAED,wBAAgB,WAAW,KAGjB,IAAI,MAAM,UACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useRouter as
|
|
1
|
+
"use client";import{useTransition as f}from"react";import{useRouter as o}from"next/navigation";import{isClient as m,useOverlayStore as g}from"@donotdev/core";import{useLocalizedPath as u}from"./useUrlLanguage.next.js";function x(){let e=o(),r=g(t=>t.closeAll),n=u(),[l,s]=f(),i=(t,c)=>{if(r(),t==="back"){s(()=>e.back());return}let a=n(t);if(s(()=>{c?.replace?e.replace(a):e.push(a)}),c?.preserveScroll&&m()){let p=window.scrollY;requestAnimationFrame(()=>{window.scrollTo({top:p,behavior:"auto"})})}};return Object.assign(i,{navigate:i,pending:l})}function d(){let e=o();return()=>e.back()}function k(){let e=o();return()=>e.refresh()}function w(){let e=o(),r=u();return n=>e.prefetch(r(n))}export{d as useBack,x as useNavigate,w as usePrefetch,k as useRefresh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Navigate } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Navigation hook. Auth is handled by AuthGuard (cold-load redirect).
|
|
4
4
|
* Protected routes are hidden from unauthorized users via useAccessibleRoutes.
|
|
@@ -6,10 +6,16 @@ import type { NavigateOptions } from './types';
|
|
|
6
6
|
* stay in the current language. A path prefixed with another language opens that
|
|
7
7
|
* language's URL (document navigation: the router restarts under its prefix).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Returns the navigate function itself, so `const navigate = useNavigate()` works as
|
|
10
|
+
* before. It also carries `navigate` and `pending`, for `const { navigate, pending } =
|
|
11
|
+
* useNavigate()`: the router call runs in a React transition and `pending` stays true
|
|
12
|
+
* while the new route suspends (lazy route chunk). Use it for `loading` on the button
|
|
13
|
+
* that navigates. Overlays still close at the click (`closeAll`).
|
|
14
|
+
*
|
|
15
|
+
* @version 0.4.0
|
|
10
16
|
* @since 0.0.1
|
|
11
17
|
*/
|
|
12
|
-
export declare function useNavigate():
|
|
18
|
+
export declare function useNavigate(): Navigate;
|
|
13
19
|
export declare function useBack(): () => void | Promise<void>;
|
|
14
20
|
export declare function useRefresh(): () => void;
|
|
15
21
|
export declare function usePrefetch(): (_to: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigate.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.vite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavigate.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.vite.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,QAAQ,EAAqC,MAAM,SAAS,CAAC;AAG3E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CA+BtC;AAED,wBAAgB,OAAO,+BAGtB;AAED,wBAAgB,UAAU,eAIzB;AAED,wBAAgB,WAAW,KACjB,KAAK,MAAM,UAGpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useNavigate as
|
|
1
|
+
"use client";import{useTransition as l}from"react";import{useNavigate as a}from"react-router-dom";import{getLanguageRouting as f,isClient as p,splitLanguagePath as v,useOverlayStore as d}from"@donotdev/core";import{useUrlLanguage as m}from"./useUrlLanguage.vite.js";function L(){let t=a(),r=d(e=>e.closeAll),s=m(),[u,i]=l(),o=(e,g)=>{if(r(),e==="back"){i(()=>{t(-1)});return}let n=e.startsWith("/")?v(e,f()):null;if(n?.prefixed&&n.language!==s){window.location.assign(e);return}let c=n?.prefixed?n.path:e;i(()=>{t(c,g?.replace?{replace:!0}:void 0)})};return Object.assign(o,{navigate:o,pending:u})}function O(){let t=a();return()=>t(-1)}function R(){return()=>{p()&&window.location.reload()}}function b(){return t=>{}}export{O as useBack,L as useNavigate,b as usePrefetch,R as useRefresh};
|
package/dist/routing/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export * from './DnDevNavigationMenu';
|
|
|
20
20
|
export { default as NotFoundPage } from './404';
|
|
21
21
|
export { NotFoundDocument, useIsNotFoundDocument } from './NotFoundDocument';
|
|
22
22
|
export { useNavigate, useBack, useRefresh, usePrefetch, useLocation, useRoutePath, useParams, useRouteParam, useSearchParams, useMatch, useQueryParams, useRedirectGuard, useLocalizedPath, useUrlLanguage, } from '@donotdev/ui/routing/hooks';
|
|
23
|
-
export type { NavigateOptions, RedirectGuardOptions, RedirectGuardResult, } from '@donotdev/ui/routing/hooks';
|
|
23
|
+
export type { Navigate, NavigateFunction, NavigateOptions, RedirectGuardOptions, RedirectGuardResult, } from '@donotdev/ui/routing/hooks';
|
|
24
24
|
export * from './useNavigation';
|
|
25
25
|
export * from './useGoTo';
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAGH,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAO7E,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,eAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAGH,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAO7E,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,eAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/dist/routing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./Link.js";export*from"./AuthGuard.js";export*from"./AuthGuardFallback.js";import{AuthReturnTo as a}from"./AuthReturnTo.js";import{SignedInRedirect as p}from"./SignedInRedirect.js";export*from"./GoTo.js";import{default as f}from"./GoToWrapper.js";import{default as i}from"./GoToInput.js";export*from"./DnDevNavigationMenu.js";import{default as
|
|
1
|
+
export*from"./Link.js";export*from"./AuthGuard.js";export*from"./AuthGuardFallback.js";import{AuthReturnTo as a}from"./AuthReturnTo.js";import{SignedInRedirect as p}from"./SignedInRedirect.js";export*from"./GoTo.js";import{default as f}from"./GoToWrapper.js";import{default as i}from"./GoToInput.js";export*from"./DnDevNavigationMenu.js";import{default as g}from"./404.js";import{NotFoundDocument as P,useIsNotFoundDocument as h}from"./NotFoundDocument.js";import{useNavigate as l,useBack as v,useRefresh as G,usePrefetch as I,useLocation as F,useRoutePath as S,useParams as y,useRouteParam as L,useSearchParams as T,useMatch as k,useQueryParams as D,useRedirectGuard as O,useLocalizedPath as z,useUrlLanguage as A}from"@donotdev/ui/routing/hooks";export*from"./useNavigation.js";export*from"./useGoTo.js";export{a as AuthReturnTo,i as GoToInput,f as GoToWrapper,P as NotFoundDocument,g as NotFoundPage,p as SignedInRedirect,v as useBack,h as useIsNotFoundDocument,z as useLocalizedPath,F as useLocation,k as useMatch,l as useNavigate,y as useParams,I as usePrefetch,D as useQueryParams,O as useRedirectGuard,G as useRefresh,L as useRouteParam,S as useRoutePath,T as useSearchParams,A as useUrlLanguage};
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
+
import type { AncestorRoute } from '@donotdev/core';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.2.5
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Cumulative prefixes of a pathname: `/a/b/c` → `['/a', '/a/b', '/a/b/c']`.
|
|
12
|
-
*
|
|
13
|
-
* @param pathname - App path (no language prefix)
|
|
14
|
-
* @returns One entry per segment, in order
|
|
15
|
-
*/
|
|
16
|
-
export declare function getPathPrefixes(pathname: string): string[];
|
|
17
|
-
/**
|
|
18
|
-
* Previous breadcrumb: the nearest parent prefix that is a known route, else home.
|
|
19
|
-
* `/routines/abc` → `/routines`; `/reglages` → `/`.
|
|
3
|
+
* Previous breadcrumb: the page's nearest ancestor (`routeAncestors`), else home.
|
|
4
|
+
* `/routines/abc` → `/routines`; `/reglages` → `/`; `/produits/serum` with PageMeta
|
|
5
|
+
* `parent: '/catalogue'` → `/catalogue`.
|
|
20
6
|
*
|
|
21
7
|
* @param pathname - App path (no language prefix)
|
|
22
|
-
* @param
|
|
23
|
-
* @param homePath - Path when
|
|
8
|
+
* @param routes - Known routes, with their PageMeta (what Breadcrumbs links)
|
|
9
|
+
* @param homePath - Path when the page has no ancestor
|
|
24
10
|
* @returns The path the previous breadcrumb links to
|
|
25
11
|
*/
|
|
26
|
-
export declare function getParentRoutePath(pathname: string,
|
|
12
|
+
export declare function getParentRoutePath(pathname: string, routes: readonly AncestorRoute[], homePath?: string): string;
|
|
27
13
|
//# sourceMappingURL=parentRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parentRoute.d.ts","sourceRoot":"","sources":["../../src/routing/parentRoute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parentRoute.d.ts","sourceRoot":"","sources":["../../src/routing/parentRoute.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,QAAQ,SAAM,GACb,MAAM,CAER"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{routeAncestors as e}from"@donotdev/core";function s(t,o,r="/"){return e(t,o).at(-1)?.path??r}export{s as getParentRoutePath};
|