@payloadcms/tanstack-start 4.0.0-internal.a0ef1b8 → 4.0.0-internal.bc5cf8c
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/elements/RouterAdapter/index.d.ts.map +1 -1
- package/dist/elements/RouterAdapter/index.js +38 -15
- package/dist/elements/RouterAdapter/index.js.map +1 -1
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +1 -0
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -0
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/server.d.ts +2 -1
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +2 -1
- package/dist/exports/server.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
- package/dist/layouts/Root/getLayoutData.js +36 -0
- package/dist/layouts/Root/getLayoutData.js.map +1 -1
- package/dist/layouts/Root/index.d.ts +7 -0
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts +65 -0
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -0
- package/dist/layouts/Root/withPayloadRoot.js +92 -0
- package/dist/layouts/Root/withPayloadRoot.js.map +1 -0
- package/dist/routes/adminRoutes.d.ts +105 -0
- package/dist/routes/adminRoutes.d.ts.map +1 -0
- package/dist/routes/adminRoutes.js +97 -0
- package/dist/routes/adminRoutes.js.map +1 -0
- package/dist/routes/apiRoute.d.ts +29 -0
- package/dist/routes/apiRoute.d.ts.map +1 -0
- package/dist/routes/apiRoute.js +38 -0
- package/dist/routes/apiRoute.js.map +1 -0
- package/dist/routes/layoutRoute.d.ts +23 -0
- package/dist/routes/layoutRoute.d.ts.map +1 -0
- package/dist/routes/layoutRoute.js +51 -0
- package/dist/routes/layoutRoute.js.map +1 -0
- package/dist/utilities/handleAPIRoute.d.ts +11 -0
- package/dist/utilities/handleAPIRoute.d.ts.map +1 -0
- package/dist/utilities/handleAPIRoute.js +17 -0
- package/dist/utilities/handleAPIRoute.js.map +1 -0
- package/dist/utilities/importMap.server.d.ts +4 -5
- package/dist/utilities/importMap.server.d.ts.map +1 -1
- package/dist/utilities/importMap.server.js +5 -6
- package/dist/utilities/importMap.server.js.map +1 -1
- package/dist/utilities/loadAdminPage.d.ts +54 -0
- package/dist/utilities/loadAdminPage.d.ts.map +1 -0
- package/dist/utilities/loadAdminPage.js +217 -0
- package/dist/utilities/loadAdminPage.js.map +1 -0
- package/dist/utilities/loadLayoutData.d.ts +15 -0
- package/dist/utilities/loadLayoutData.d.ts.map +1 -0
- package/dist/utilities/loadLayoutData.js +23 -0
- package/dist/utilities/loadLayoutData.js.map +1 -0
- package/dist/utilities/serializeForRsc.d.ts.map +1 -1
- package/dist/utilities/serializeForRsc.js +17 -0
- package/dist/utilities/serializeForRsc.js.map +1 -1
- package/dist/utilities/serverFunctionClient.d.ts +29 -0
- package/dist/utilities/serverFunctionClient.d.ts.map +1 -0
- package/dist/utilities/serverFunctionClient.js +109 -0
- package/dist/utilities/serverFunctionClient.js.map +1 -0
- package/dist/vite/constants.d.ts +7 -2
- package/dist/vite/constants.d.ts.map +1 -1
- package/dist/vite/constants.js +53 -5
- package/dist/vite/constants.js.map +1 -1
- package/dist/vite/plugin.js +10 -13
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/plugins/devTransforms.d.ts +11 -0
- package/dist/vite/plugins/devTransforms.d.ts.map +1 -1
- package/dist/vite/plugins/devTransforms.js +13 -2
- package/dist/vite/plugins/devTransforms.js.map +1 -1
- package/dist/vite/plugins/stripDistStyleImports.d.ts.map +1 -1
- package/dist/vite/plugins/stripDistStyleImports.js +54 -3
- package/dist/vite/plugins/stripDistStyleImports.js.map +1 -1
- package/package.json +7 -7
- package/dist/auth/switchLanguage.d.ts +0 -6
- package/dist/auth/switchLanguage.d.ts.map +0 -1
- package/dist/auth/switchLanguage.js +0 -11
- package/dist/auth/switchLanguage.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/RouterAdapter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/RouterAdapter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAuDvE,eAAO,MAAM,qBAAqB,EAAE,sBA+EnC,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { RouterAdapterContext } from '@payloadcms/ui';
|
|
4
4
|
import { Link as TanStackLink, useLocation, useParams, useRouter } from '@tanstack/react-router';
|
|
5
|
+
import * as qs from 'qs-esm';
|
|
5
6
|
import React, { useCallback, useMemo } from 'react';
|
|
6
7
|
const normalizeNavigationTarget = ({ path, pathname, search })=>{
|
|
7
8
|
if (path.startsWith('http')) {
|
|
@@ -44,21 +45,47 @@ export const TanStackRouterAdapter = ({ children })=>{
|
|
|
44
45
|
}, [
|
|
45
46
|
params
|
|
46
47
|
]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// Split a target into `to` (pathname) + a parsed `search` object, so the
|
|
49
|
+
// router serializes the query via its `stringifySearch` (qs, bracket-encoded)
|
|
50
|
+
// rather than embedding the raw string in `to`. Navigating with a string `to`
|
|
51
|
+
// leaves the search *unencoded* in `window.location.search`
|
|
52
|
+
// (e.g. `where[or][0]…`), which then never matches Payload's `qs.stringify`
|
|
53
|
+
// output (`where%5Bor%5D…`) — breaking the list-view `syncPropsToURL` guard,
|
|
54
|
+
// which compares the two and would otherwise clobber optimistic query state
|
|
55
|
+
// (e.g. an in-progress filter condition) on every navigation.
|
|
56
|
+
const toNavOptions = useCallback((path)=>{
|
|
51
57
|
const relativePath = normalizeNavigationTarget({
|
|
52
58
|
path,
|
|
53
59
|
pathname: window.location.pathname,
|
|
54
60
|
search: window.location.search
|
|
55
61
|
});
|
|
62
|
+
const queryIndex = relativePath.indexOf('?');
|
|
63
|
+
if (queryIndex === -1) {
|
|
64
|
+
return {
|
|
65
|
+
to: relativePath
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const searchObject = qs.parse(relativePath.slice(queryIndex + 1), {
|
|
69
|
+
depth: 10,
|
|
70
|
+
ignoreQueryPrefix: true
|
|
71
|
+
});
|
|
72
|
+
// Function form replaces the search entirely (no merge with current search).
|
|
73
|
+
return {
|
|
74
|
+
search: ()=>searchObject,
|
|
75
|
+
to: relativePath.slice(0, queryIndex)
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
78
|
+
const back = useCallback(()=>router.history.back(), [
|
|
79
|
+
router
|
|
80
|
+
]);
|
|
81
|
+
const push = useCallback((path, options)=>{
|
|
56
82
|
void router.navigate({
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
...toNavOptions(path),
|
|
84
|
+
resetScroll: options?.scroll
|
|
59
85
|
});
|
|
60
86
|
}, [
|
|
61
|
-
router
|
|
87
|
+
router,
|
|
88
|
+
toNavOptions
|
|
62
89
|
]);
|
|
63
90
|
const refresh = useCallback(()=>{
|
|
64
91
|
void router.invalidate();
|
|
@@ -66,18 +93,14 @@ export const TanStackRouterAdapter = ({ children })=>{
|
|
|
66
93
|
router
|
|
67
94
|
]);
|
|
68
95
|
const replace = useCallback((path, options)=>{
|
|
69
|
-
const relativePath = normalizeNavigationTarget({
|
|
70
|
-
path,
|
|
71
|
-
pathname: window.location.pathname,
|
|
72
|
-
search: window.location.search
|
|
73
|
-
});
|
|
74
96
|
void router.navigate({
|
|
97
|
+
...toNavOptions(path),
|
|
75
98
|
replace: true,
|
|
76
|
-
resetScroll: options?.scroll
|
|
77
|
-
to: relativePath
|
|
99
|
+
resetScroll: options?.scroll
|
|
78
100
|
});
|
|
79
101
|
}, [
|
|
80
|
-
router
|
|
102
|
+
router,
|
|
103
|
+
toNavOptions
|
|
81
104
|
]);
|
|
82
105
|
const adaptedRouter = useMemo(()=>({
|
|
83
106
|
back,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/RouterAdapter/index.tsx"],"sourcesContent":["'use client'\n\nimport type { RouterAdapterContextValue } from '@payloadcms/ui'\nimport type { LinkAdapterProps, RouterAdapterComponent } from 'payload'\n\nimport { RouterAdapterContext } from '@payloadcms/ui'\nimport { Link as TanStackLink, useLocation, useParams, useRouter } from '@tanstack/react-router'\nimport React, { useCallback, useMemo } from 'react'\n\nconst normalizeNavigationTarget = ({\n path,\n pathname,\n search,\n}: {\n path: string\n pathname: string\n search: string\n}) => {\n if (path.startsWith('http')) {\n const url = new URL(path)\n return `${url.pathname}${url.search}${url.hash}`\n }\n\n if (path.startsWith('?')) {\n return `${pathname}${path}`\n }\n\n if (path.startsWith('#')) {\n return `${pathname}${search}${path}`\n }\n\n return path\n}\n\nconst TanStackLinkAdapter: React.FC<LinkAdapterProps> = ({\n children,\n href,\n prefetch,\n ref,\n replace,\n scroll,\n ...rest\n}) => {\n return (\n <TanStackLink\n preload={prefetch === false ? false : 'intent'}\n ref={ref}\n replace={replace}\n resetScroll={scroll}\n to={href}\n {...rest}\n >\n {children}\n </TanStackLink>\n )\n}\n\nexport const TanStackRouterAdapter: RouterAdapterComponent = ({ children }) => {\n const router = useRouter()\n const location = useLocation()\n const params = useParams({ strict: false })\n\n const adaptedParams = useMemo(() => {\n const adapted: Record<string, string | string[]> = { ...params }\n if ('_splat' in params && typeof params._splat === 'string') {\n adapted.segments = params._splat.split('/').filter(Boolean)\n }\n return adapted\n }, [params])\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/RouterAdapter/index.tsx"],"sourcesContent":["'use client'\n\nimport type { RouterAdapterContextValue } from '@payloadcms/ui'\nimport type { LinkAdapterProps, RouterAdapterComponent } from 'payload'\n\nimport { RouterAdapterContext } from '@payloadcms/ui'\nimport { Link as TanStackLink, useLocation, useParams, useRouter } from '@tanstack/react-router'\nimport * as qs from 'qs-esm'\nimport React, { useCallback, useMemo } from 'react'\n\nconst normalizeNavigationTarget = ({\n path,\n pathname,\n search,\n}: {\n path: string\n pathname: string\n search: string\n}) => {\n if (path.startsWith('http')) {\n const url = new URL(path)\n return `${url.pathname}${url.search}${url.hash}`\n }\n\n if (path.startsWith('?')) {\n return `${pathname}${path}`\n }\n\n if (path.startsWith('#')) {\n return `${pathname}${search}${path}`\n }\n\n return path\n}\n\nconst TanStackLinkAdapter: React.FC<LinkAdapterProps> = ({\n children,\n href,\n prefetch,\n ref,\n replace,\n scroll,\n ...rest\n}) => {\n return (\n <TanStackLink\n preload={prefetch === false ? false : 'intent'}\n ref={ref}\n replace={replace}\n resetScroll={scroll}\n to={href}\n {...rest}\n >\n {children}\n </TanStackLink>\n )\n}\n\nexport const TanStackRouterAdapter: RouterAdapterComponent = ({ children }) => {\n const router = useRouter()\n const location = useLocation()\n const params = useParams({ strict: false })\n\n const adaptedParams = useMemo(() => {\n const adapted: Record<string, string | string[]> = { ...params }\n if ('_splat' in params && typeof params._splat === 'string') {\n adapted.segments = params._splat.split('/').filter(Boolean)\n }\n return adapted\n }, [params])\n\n // Split a target into `to` (pathname) + a parsed `search` object, so the\n // router serializes the query via its `stringifySearch` (qs, bracket-encoded)\n // rather than embedding the raw string in `to`. Navigating with a string `to`\n // leaves the search *unencoded* in `window.location.search`\n // (e.g. `where[or][0]…`), which then never matches Payload's `qs.stringify`\n // output (`where%5Bor%5D…`) — breaking the list-view `syncPropsToURL` guard,\n // which compares the two and would otherwise clobber optimistic query state\n // (e.g. an in-progress filter condition) on every navigation.\n const toNavOptions = useCallback((path: string) => {\n const relativePath = normalizeNavigationTarget({\n path,\n pathname: window.location.pathname,\n search: window.location.search,\n })\n const queryIndex = relativePath.indexOf('?')\n if (queryIndex === -1) {\n return { to: relativePath }\n }\n const searchObject = qs.parse(relativePath.slice(queryIndex + 1), {\n depth: 10,\n ignoreQueryPrefix: true,\n })\n // Function form replaces the search entirely (no merge with current search).\n return { search: () => searchObject, to: relativePath.slice(0, queryIndex) }\n }, [])\n\n const back = useCallback(() => router.history.back(), [router])\n const push = useCallback(\n (path: string, options?: { scroll?: boolean }) => {\n void router.navigate({ ...toNavOptions(path), resetScroll: options?.scroll })\n },\n [router, toNavOptions],\n )\n const refresh = useCallback(() => {\n void router.invalidate()\n }, [router])\n const replace = useCallback(\n (path: string, options?: { scroll?: boolean }) => {\n void router.navigate({ ...toNavOptions(path), replace: true, resetScroll: options?.scroll })\n },\n [router, toNavOptions],\n )\n\n const adaptedRouter = useMemo(\n () => ({ back, push, refresh, replace }),\n [back, push, refresh, replace],\n )\n\n // `location.searchStr` is the serialized query string; `location.search` is\n // the parsed object (a nested structure once the router uses `qs` for search\n // serialization), which `URLSearchParams` cannot consume. Build from the\n // string so Payload's `parseSearchParams` re-parses the bracket notation.\n const searchParams = useMemo(() => new URLSearchParams(location.searchStr), [location.searchStr])\n\n const value: RouterAdapterContextValue = useMemo(\n () => ({\n Link: TanStackLinkAdapter,\n params: adaptedParams,\n pathname: location.pathname,\n router: adaptedRouter,\n searchParams,\n }),\n [adaptedParams, location.pathname, adaptedRouter, searchParams],\n )\n\n return <RouterAdapterContext value={value}>{children}</RouterAdapterContext>\n}\n"],"names":["RouterAdapterContext","Link","TanStackLink","useLocation","useParams","useRouter","qs","React","useCallback","useMemo","normalizeNavigationTarget","path","pathname","search","startsWith","url","URL","hash","TanStackLinkAdapter","children","href","prefetch","ref","replace","scroll","rest","preload","resetScroll","to","TanStackRouterAdapter","router","location","params","strict","adaptedParams","adapted","_splat","segments","split","filter","Boolean","toNavOptions","relativePath","window","queryIndex","indexOf","searchObject","parse","slice","depth","ignoreQueryPrefix","back","history","push","options","navigate","refresh","invalidate","adaptedRouter","searchParams","URLSearchParams","searchStr","value"],"mappings":"AAAA;;AAKA,SAASA,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,QAAQC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,SAAS,QAAQ,yBAAwB;AAChG,YAAYC,QAAQ,SAAQ;AAC5B,OAAOC,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAO;AAEnD,MAAMC,4BAA4B,CAAC,EACjCC,IAAI,EACJC,QAAQ,EACRC,MAAM,EAKP;IACC,IAAIF,KAAKG,UAAU,CAAC,SAAS;QAC3B,MAAMC,MAAM,IAAIC,IAAIL;QACpB,OAAO,GAAGI,IAAIH,QAAQ,GAAGG,IAAIF,MAAM,GAAGE,IAAIE,IAAI,EAAE;IAClD;IAEA,IAAIN,KAAKG,UAAU,CAAC,MAAM;QACxB,OAAO,GAAGF,WAAWD,MAAM;IAC7B;IAEA,IAAIA,KAAKG,UAAU,CAAC,MAAM;QACxB,OAAO,GAAGF,WAAWC,SAASF,MAAM;IACtC;IAEA,OAAOA;AACT;AAEA,MAAMO,sBAAkD,CAAC,EACvDC,QAAQ,EACRC,IAAI,EACJC,QAAQ,EACRC,GAAG,EACHC,OAAO,EACPC,MAAM,EACN,GAAGC,MACJ;IACC,qBACE,KAACvB;QACCwB,SAASL,aAAa,QAAQ,QAAQ;QACtCC,KAAKA;QACLC,SAASA;QACTI,aAAaH;QACbI,IAAIR;QACH,GAAGK,IAAI;kBAEPN;;AAGP;AAEA,OAAO,MAAMU,wBAAgD,CAAC,EAAEV,QAAQ,EAAE;IACxE,MAAMW,SAASzB;IACf,MAAM0B,WAAW5B;IACjB,MAAM6B,SAAS5B,UAAU;QAAE6B,QAAQ;IAAM;IAEzC,MAAMC,gBAAgBzB,QAAQ;QAC5B,MAAM0B,UAA6C;YAAE,GAAGH,MAAM;QAAC;QAC/D,IAAI,YAAYA,UAAU,OAAOA,OAAOI,MAAM,KAAK,UAAU;YAC3DD,QAAQE,QAAQ,GAAGL,OAAOI,MAAM,CAACE,KAAK,CAAC,KAAKC,MAAM,CAACC;QACrD;QACA,OAAOL;IACT,GAAG;QAACH;KAAO;IAEX,yEAAyE;IACzE,8EAA8E;IAC9E,8EAA8E;IAC9E,4DAA4D;IAC5D,4EAA4E;IAC5E,6EAA6E;IAC7E,4EAA4E;IAC5E,8DAA8D;IAC9D,MAAMS,eAAejC,YAAY,CAACG;QAChC,MAAM+B,eAAehC,0BAA0B;YAC7CC;YACAC,UAAU+B,OAAOZ,QAAQ,CAACnB,QAAQ;YAClCC,QAAQ8B,OAAOZ,QAAQ,CAAClB,MAAM;QAChC;QACA,MAAM+B,aAAaF,aAAaG,OAAO,CAAC;QACxC,IAAID,eAAe,CAAC,GAAG;YACrB,OAAO;gBAAEhB,IAAIc;YAAa;QAC5B;QACA,MAAMI,eAAexC,GAAGyC,KAAK,CAACL,aAAaM,KAAK,CAACJ,aAAa,IAAI;YAChEK,OAAO;YACPC,mBAAmB;QACrB;QACA,6EAA6E;QAC7E,OAAO;YAAErC,QAAQ,IAAMiC;YAAclB,IAAIc,aAAaM,KAAK,CAAC,GAAGJ;QAAY;IAC7E,GAAG,EAAE;IAEL,MAAMO,OAAO3C,YAAY,IAAMsB,OAAOsB,OAAO,CAACD,IAAI,IAAI;QAACrB;KAAO;IAC9D,MAAMuB,OAAO7C,YACX,CAACG,MAAc2C;QACb,KAAKxB,OAAOyB,QAAQ,CAAC;YAAE,GAAGd,aAAa9B,KAAK;YAAEgB,aAAa2B,SAAS9B;QAAO;IAC7E,GACA;QAACM;QAAQW;KAAa;IAExB,MAAMe,UAAUhD,YAAY;QAC1B,KAAKsB,OAAO2B,UAAU;IACxB,GAAG;QAAC3B;KAAO;IACX,MAAMP,UAAUf,YACd,CAACG,MAAc2C;QACb,KAAKxB,OAAOyB,QAAQ,CAAC;YAAE,GAAGd,aAAa9B,KAAK;YAAEY,SAAS;YAAMI,aAAa2B,SAAS9B;QAAO;IAC5F,GACA;QAACM;QAAQW;KAAa;IAGxB,MAAMiB,gBAAgBjD,QACpB,IAAO,CAAA;YAAE0C;YAAME;YAAMG;YAASjC;QAAQ,CAAA,GACtC;QAAC4B;QAAME;QAAMG;QAASjC;KAAQ;IAGhC,4EAA4E;IAC5E,6EAA6E;IAC7E,yEAAyE;IACzE,0EAA0E;IAC1E,MAAMoC,eAAelD,QAAQ,IAAM,IAAImD,gBAAgB7B,SAAS8B,SAAS,GAAG;QAAC9B,SAAS8B,SAAS;KAAC;IAEhG,MAAMC,QAAmCrD,QACvC,IAAO,CAAA;YACLR,MAAMiB;YACNc,QAAQE;YACRtB,UAAUmB,SAASnB,QAAQ;YAC3BkB,QAAQ4B;YACRC;QACF,CAAA,GACA;QAACzB;QAAeH,SAASnB,QAAQ;QAAE8C;QAAeC;KAAa;IAGjE,qBAAO,KAAC3D;QAAqB8D,OAAOA;kBAAQ3C;;AAC9C,EAAC"}
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { TanStackComponentRenderer } from '../elements/RenderComponent/index.js';
|
|
2
2
|
export { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js';
|
|
3
|
+
export { buildThemeInitScript, PayloadAdminShell, type PayloadAdminShellProps, THEME_INIT_SCRIPT, withPayloadRoot, type WithPayloadRootOptions, } from '../layouts/Root/withPayloadRoot.js';
|
|
4
|
+
export { type AdminLoad, payloadAdminIndexRoute, payloadAdminSplatRoute, } from '../routes/adminRoutes.js';
|
|
5
|
+
export { type LayoutLoad, payloadLayoutRoute } from '../routes/layoutRoute.js';
|
|
3
6
|
export { viteDevReloadStrategy } from '../utilities/devReloadStrategy.js';
|
|
7
|
+
export { createServerFunctionClient, stripUnserializable, } from '../utilities/serverFunctionClient.js';
|
|
4
8
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA"}
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,KAAK,SAAS,EACd,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,sCAAsC,CAAA"}
|
package/dist/exports/client.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
export { TanStackComponentRenderer } from '../elements/RenderComponent/index.js';
|
|
3
3
|
export { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js';
|
|
4
|
+
export { buildThemeInitScript, PayloadAdminShell, THEME_INIT_SCRIPT, withPayloadRoot } from '../layouts/Root/withPayloadRoot.js';
|
|
5
|
+
export { payloadAdminIndexRoute, payloadAdminSplatRoute } from '../routes/adminRoutes.js';
|
|
6
|
+
export { payloadLayoutRoute } from '../routes/layoutRoute.js';
|
|
4
7
|
export { viteDevReloadStrategy } from '../utilities/devReloadStrategy.js';
|
|
8
|
+
export { createServerFunctionClient, stripUnserializable } from '../utilities/serverFunctionClient.js';
|
|
5
9
|
|
|
6
10
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\n\nexport { TanStackComponentRenderer } from '../elements/RenderComponent/index.js'\nexport { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js'\nexport { viteDevReloadStrategy } from '../utilities/devReloadStrategy.js'\n"],"names":["TanStackComponentRenderer","TanStackRouterAdapter","viteDevReloadStrategy"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,uCAAsC;AAChF,SAASC,qBAAqB,QAAQ,qCAAoC;AAC1E,SAASC,qBAAqB,QAAQ,oCAAmC"}
|
|
1
|
+
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\n\nexport { TanStackComponentRenderer } from '../elements/RenderComponent/index.js'\nexport { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js'\nexport {\n buildThemeInitScript,\n PayloadAdminShell,\n type PayloadAdminShellProps,\n THEME_INIT_SCRIPT,\n withPayloadRoot,\n type WithPayloadRootOptions,\n} from '../layouts/Root/withPayloadRoot.js'\nexport {\n type AdminLoad,\n payloadAdminIndexRoute,\n payloadAdminSplatRoute,\n} from '../routes/adminRoutes.js'\nexport { type LayoutLoad, payloadLayoutRoute } from '../routes/layoutRoute.js'\nexport { viteDevReloadStrategy } from '../utilities/devReloadStrategy.js'\nexport {\n createServerFunctionClient,\n stripUnserializable,\n} from '../utilities/serverFunctionClient.js'\n"],"names":["TanStackComponentRenderer","TanStackRouterAdapter","buildThemeInitScript","PayloadAdminShell","THEME_INIT_SCRIPT","withPayloadRoot","payloadAdminIndexRoute","payloadAdminSplatRoute","payloadLayoutRoute","viteDevReloadStrategy","createServerFunctionClient","stripUnserializable"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,uCAAsC;AAChF,SAASC,qBAAqB,QAAQ,qCAAoC;AAC1E,SACEC,oBAAoB,EACpBC,iBAAiB,EAEjBC,iBAAiB,EACjBC,eAAe,QAEV,qCAAoC;AAC3C,SAEEC,sBAAsB,EACtBC,sBAAsB,QACjB,2BAA0B;AACjC,SAA0BC,kBAAkB,QAAQ,2BAA0B;AAC9E,SAASC,qBAAqB,QAAQ,oCAAmC;AACzE,SACEC,0BAA0B,EAC1BC,mBAAmB,QACd,uCAAsC"}
|
|
@@ -2,4 +2,5 @@ export { getLayoutData } from '../layouts/Root/getLayoutData.js';
|
|
|
2
2
|
export type { GetLayoutDataArgs } from '../layouts/Root/getLayoutData.js';
|
|
3
3
|
export { RootLayout } from '../layouts/Root/index.js';
|
|
4
4
|
export type { RootLayoutData, RootLayoutProps } from '../layouts/Root/index.js';
|
|
5
|
+
export { loadLayoutData } from '../utilities/loadLayoutData.js';
|
|
5
6
|
//# sourceMappingURL=layouts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/exports/layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/exports/layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA"}
|
package/dist/exports/layouts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/layouts.ts"],"sourcesContent":["export { getLayoutData } from '../layouts/Root/getLayoutData.js'\nexport type { GetLayoutDataArgs } from '../layouts/Root/getLayoutData.js'\nexport { RootLayout } from '../layouts/Root/index.js'\nexport type { RootLayoutData, RootLayoutProps } from '../layouts/Root/index.js'\n"],"names":["getLayoutData","RootLayout"],"mappings":"AAAA,SAASA,aAAa,QAAQ,mCAAkC;AAEhE,SAASC,UAAU,QAAQ,2BAA0B"}
|
|
1
|
+
{"version":3,"sources":["../../src/exports/layouts.ts"],"sourcesContent":["export { getLayoutData } from '../layouts/Root/getLayoutData.js'\nexport type { GetLayoutDataArgs } from '../layouts/Root/getLayoutData.js'\nexport { RootLayout } from '../layouts/Root/index.js'\nexport type { RootLayoutData, RootLayoutProps } from '../layouts/Root/index.js'\nexport { loadLayoutData } from '../utilities/loadLayoutData.js'\n"],"names":["getLayoutData","RootLayout","loadLayoutData"],"mappings":"AAAA,SAASA,aAAa,QAAQ,mCAAkC;AAEhE,SAASC,UAAU,QAAQ,2BAA0B;AAErD,SAASC,cAAc,QAAQ,iCAAgC"}
|
package/dist/exports/server.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export { login } from '../auth/login.js';
|
|
2
2
|
export { logout } from '../auth/logout.js';
|
|
3
3
|
export { refresh } from '../auth/refresh.js';
|
|
4
|
-
export { switchLanguage } from '../auth/switchLanguage.js';
|
|
5
4
|
export { getRequestI18n } from '../utilities/getRequestI18n.server.js';
|
|
6
5
|
export { getRequestLocale } from '../utilities/getRequestLocale.js';
|
|
7
6
|
export { getRequestTheme } from '../utilities/getRequestTheme.js';
|
|
8
7
|
export { handleGraphQL } from '../utilities/graphqlHandler.server.js';
|
|
8
|
+
export { handleAPIRoute } from '../utilities/handleAPIRoute.js';
|
|
9
9
|
export { handleServerFunctions } from '../utilities/handleServerFunctions.js';
|
|
10
10
|
export { getImportMapOutputPath } from '../utilities/importMap.server.js';
|
|
11
11
|
export { initReq } from '../utilities/initReq.server.js';
|
|
12
|
+
export { loadAdminPage, type LoadAdminPageArgs, type LoadAdminPageResult, } from '../utilities/loadAdminPage.js';
|
|
12
13
|
export { type AdminPageMetadata, getAdminMeta } from '../utilities/meta.js';
|
|
13
14
|
export { serializeForRsc } from '../utilities/serializeForRsc.js';
|
|
14
15
|
export { createPageRenderServerAdapter, type PageNavIntent, tanstackServerAdapter, } from '../utilities/serverAdapter.server.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/exports/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/exports/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACxD,OAAO,EACL,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,KAAK,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EACL,6BAA6B,EAC7B,KAAK,aAAa,EAClB,qBAAqB,GACtB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA"}
|
package/dist/exports/server.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export { login } from '../auth/login.js';
|
|
2
2
|
export { logout } from '../auth/logout.js';
|
|
3
3
|
export { refresh } from '../auth/refresh.js';
|
|
4
|
-
export { switchLanguage } from '../auth/switchLanguage.js';
|
|
5
4
|
export { getRequestI18n } from '../utilities/getRequestI18n.server.js';
|
|
6
5
|
export { getRequestLocale } from '../utilities/getRequestLocale.js';
|
|
7
6
|
export { getRequestTheme } from '../utilities/getRequestTheme.js';
|
|
8
7
|
export { handleGraphQL } from '../utilities/graphqlHandler.server.js';
|
|
8
|
+
export { handleAPIRoute } from '../utilities/handleAPIRoute.js';
|
|
9
9
|
export { handleServerFunctions } from '../utilities/handleServerFunctions.js';
|
|
10
10
|
export { getImportMapOutputPath } from '../utilities/importMap.server.js';
|
|
11
11
|
export { initReq } from '../utilities/initReq.server.js';
|
|
12
|
+
export { loadAdminPage } from '../utilities/loadAdminPage.js';
|
|
12
13
|
export { getAdminMeta } from '../utilities/meta.js';
|
|
13
14
|
export { serializeForRsc } from '../utilities/serializeForRsc.js';
|
|
14
15
|
export { createPageRenderServerAdapter, tanstackServerAdapter } from '../utilities/serverAdapter.server.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["export { login } from '../auth/login.js'\nexport { logout } from '../auth/logout.js'\nexport { refresh } from '../auth/refresh.js'\nexport {
|
|
1
|
+
{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["export { login } from '../auth/login.js'\nexport { logout } from '../auth/logout.js'\nexport { refresh } from '../auth/refresh.js'\nexport { getRequestI18n } from '../utilities/getRequestI18n.server.js'\nexport { getRequestLocale } from '../utilities/getRequestLocale.js'\nexport { getRequestTheme } from '../utilities/getRequestTheme.js'\nexport { handleGraphQL } from '../utilities/graphqlHandler.server.js'\nexport { handleAPIRoute } from '../utilities/handleAPIRoute.js'\nexport { handleServerFunctions } from '../utilities/handleServerFunctions.js'\nexport { getImportMapOutputPath } from '../utilities/importMap.server.js'\nexport { initReq } from '../utilities/initReq.server.js'\nexport {\n loadAdminPage,\n type LoadAdminPageArgs,\n type LoadAdminPageResult,\n} from '../utilities/loadAdminPage.js'\nexport { type AdminPageMetadata, getAdminMeta } from '../utilities/meta.js'\nexport { serializeForRsc } from '../utilities/serializeForRsc.js'\nexport {\n createPageRenderServerAdapter,\n type PageNavIntent,\n tanstackServerAdapter,\n} from '../utilities/serverAdapter.server.js'\nexport { toSerializable } from '../utilities/toSerializable.js'\n"],"names":["login","logout","refresh","getRequestI18n","getRequestLocale","getRequestTheme","handleGraphQL","handleAPIRoute","handleServerFunctions","getImportMapOutputPath","initReq","loadAdminPage","getAdminMeta","serializeForRsc","createPageRenderServerAdapter","tanstackServerAdapter","toSerializable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,mBAAkB;AACxC,SAASC,MAAM,QAAQ,oBAAmB;AAC1C,SAASC,OAAO,QAAQ,qBAAoB;AAC5C,SAASC,cAAc,QAAQ,wCAAuC;AACtE,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,eAAe,QAAQ,kCAAiC;AACjE,SAASC,aAAa,QAAQ,wCAAuC;AACrE,SAASC,cAAc,QAAQ,iCAAgC;AAC/D,SAASC,qBAAqB,QAAQ,wCAAuC;AAC7E,SAASC,sBAAsB,QAAQ,mCAAkC;AACzE,SAASC,OAAO,QAAQ,iCAAgC;AACxD,SACEC,aAAa,QAGR,gCAA+B;AACtC,SAAiCC,YAAY,QAAQ,uBAAsB;AAC3E,SAASC,eAAe,QAAQ,kCAAiC;AACjE,SACEC,6BAA6B,EAE7BC,qBAAqB,QAChB,uCAAsC;AAC7C,SAASC,cAAc,QAAQ,iCAAgC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { TanStackComponentRenderer } from './elements/RenderComponent/index.js';
|
|
2
2
|
export { TanStackRouterAdapter } from './elements/RouterAdapter/index.js';
|
|
3
|
+
export { payloadApiHandlers } from './routes/apiRoute.js';
|
|
3
4
|
export { viteDevReloadStrategy } from './utilities/devReloadStrategy.js';
|
|
4
5
|
export { type AdminPageMetadata, getAdminMeta } from './utilities/meta.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,KAAK,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,KAAK,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { TanStackComponentRenderer } from './elements/RenderComponent/index.js';
|
|
2
2
|
export { TanStackRouterAdapter } from './elements/RouterAdapter/index.js';
|
|
3
|
+
export { payloadApiHandlers } from './routes/apiRoute.js';
|
|
3
4
|
export { viteDevReloadStrategy } from './utilities/devReloadStrategy.js';
|
|
4
5
|
export { getAdminMeta } from './utilities/meta.js';
|
|
5
6
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { TanStackComponentRenderer } from './elements/RenderComponent/index.js'\nexport { TanStackRouterAdapter } from './elements/RouterAdapter/index.js'\nexport { viteDevReloadStrategy } from './utilities/devReloadStrategy.js'\nexport { type AdminPageMetadata, getAdminMeta } from './utilities/meta.js'\n"],"names":["TanStackComponentRenderer","TanStackRouterAdapter","viteDevReloadStrategy","getAdminMeta"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,sCAAqC;AAC/E,SAASC,qBAAqB,QAAQ,oCAAmC;AACzE,SAASC,qBAAqB,QAAQ,mCAAkC;AACxE,SAAiCC,YAAY,QAAQ,sBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { TanStackComponentRenderer } from './elements/RenderComponent/index.js'\nexport { TanStackRouterAdapter } from './elements/RouterAdapter/index.js'\nexport { payloadApiHandlers } from './routes/apiRoute.js'\nexport { viteDevReloadStrategy } from './utilities/devReloadStrategy.js'\nexport { type AdminPageMetadata, getAdminMeta } from './utilities/meta.js'\n"],"names":["TanStackComponentRenderer","TanStackRouterAdapter","payloadApiHandlers","viteDevReloadStrategy","getAdminMeta"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,sCAAqC;AAC/E,SAASC,qBAAqB,QAAQ,oCAAmC;AACzE,SAASC,kBAAkB,QAAQ,uBAAsB;AACzD,SAASC,qBAAqB,QAAQ,mCAAkC;AACxE,SAAiCC,YAAY,QAAQ,sBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayoutData.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/getLayoutData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAmB,eAAe,
|
|
1
|
+
{"version":3,"file":"getLayoutData.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/getLayoutData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAmB,eAAe,EAAe,MAAM,SAAS,CAAA;AASvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,EAClC,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAsF7C"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { getNavPrefs } from '@payloadcms/ui/elements/Nav/getNavPrefs';
|
|
2
|
+
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
2
3
|
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
4
|
+
import { Outlet } from '@tanstack/react-router';
|
|
3
5
|
import { applyLocaleFiltering } from 'payload/shared';
|
|
6
|
+
import { createElement } from 'react';
|
|
4
7
|
import { getRequestTheme } from '../../utilities/getRequestTheme.js';
|
|
5
8
|
import { initReq } from '../../utilities/initReq.server.js';
|
|
6
9
|
/**
|
|
@@ -37,6 +40,38 @@ import { initReq } from '../../utilities/initReq.server.js';
|
|
|
37
40
|
config,
|
|
38
41
|
req
|
|
39
42
|
});
|
|
43
|
+
// Build the custom admin provider tree (`config.admin.components.providers`)
|
|
44
|
+
// nested around the router `<Outlet />`, mirroring the Next adapter's
|
|
45
|
+
// `NestProviders`. Returned as an unrendered element; the caller's server
|
|
46
|
+
// function renders it to an RSC payload (so server-component providers run
|
|
47
|
+
// server-side and client providers wrap the live Outlet). `undefined` when
|
|
48
|
+
// no custom providers are configured — the caller falls back to `<Outlet />`.
|
|
49
|
+
const providerPaths = config.admin?.components?.providers;
|
|
50
|
+
let providers = undefined;
|
|
51
|
+
if (Array.isArray(providerPaths) && providerPaths.length > 0) {
|
|
52
|
+
const serverProps = {
|
|
53
|
+
i18n: req.i18n,
|
|
54
|
+
params: {},
|
|
55
|
+
payload: req.payload,
|
|
56
|
+
permissions,
|
|
57
|
+
searchParams: {},
|
|
58
|
+
server: req.server,
|
|
59
|
+
user: req.user ?? undefined
|
|
60
|
+
};
|
|
61
|
+
// Mirror the Next adapter's `NestProviders`: render each configured provider
|
|
62
|
+
// via `RenderServerComponent` so the entry's own `clientProps`/`serverProps`
|
|
63
|
+
// (e.g. plugin-multi-tenant's `userHasAccessToAllTenants`) are merged in, and
|
|
64
|
+
// server components receive `serverProps` while client components get only
|
|
65
|
+
// `clientProps`. Nested around the router `<Outlet />` instead of `children`.
|
|
66
|
+
providers = providerPaths.reduceRight((children, provider)=>RenderServerComponent({
|
|
67
|
+
clientProps: {
|
|
68
|
+
children
|
|
69
|
+
},
|
|
70
|
+
Component: provider,
|
|
71
|
+
importMap,
|
|
72
|
+
serverProps
|
|
73
|
+
}), createElement(Outlet));
|
|
74
|
+
}
|
|
40
75
|
return {
|
|
41
76
|
clientConfig,
|
|
42
77
|
dateFNSKey: req.i18n.dateFNSKey,
|
|
@@ -46,6 +81,7 @@ import { initReq } from '../../utilities/initReq.server.js';
|
|
|
46
81
|
languageOptions,
|
|
47
82
|
locale: req.locale ?? undefined,
|
|
48
83
|
permissions,
|
|
84
|
+
providers,
|
|
49
85
|
theme,
|
|
50
86
|
translations: req.i18n.translations,
|
|
51
87
|
user: req.user
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/layouts/Root/getLayoutData.ts"],"sourcesContent":["import type { AcceptedLanguages } from '@payloadcms/translations'\nimport type { ImportMap, LanguageOptions, SanitizedConfig } from 'payload'\n\nimport { getNavPrefs } from '@payloadcms/ui/elements/Nav/getNavPrefs'\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { applyLocaleFiltering } from 'payload/shared'\n\nimport type { RootLayoutData } from './index.js'\n\nimport { getRequestTheme } from '../../utilities/getRequestTheme.js'\nimport { initReq } from '../../utilities/initReq.server.js'\n\nexport type GetLayoutDataArgs = {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n}\n\n/**\n * Fetches all data needed by the root admin layout.\n * Call this in your TanStack Start root route loader.\n */\nexport async function getLayoutData({\n configPromise,\n importMap,\n}: GetLayoutDataArgs): Promise<RootLayoutData> {\n const {\n cookies,\n headers,\n languageCode,\n permissions,\n req,\n req: {\n payload: { config },\n },\n } = await initReq({ configPromise, importMap })\n\n const theme = getRequestTheme({ config, cookies, headers })\n\n const languageOptions: LanguageOptions = Object.entries(\n config.i18n.supportedLanguages || {},\n ).reduce((acc, [language, languageConfig]) => {\n if (Object.keys(config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language as AcceptedLanguages,\n })\n }\n return acc\n }, [] as LanguageOptions)\n\n const navPrefs = await getNavPrefs(req)\n\n const clientConfig = getClientConfig({\n config,\n i18n: req.i18n,\n importMap,\n user: req.user ?? true,\n })\n\n await applyLocaleFiltering({ clientConfig, config, req })\n\n return {\n clientConfig,\n dateFNSKey: req.i18n.dateFNSKey,\n fallbackLang: config.i18n.fallbackLanguage,\n isNavOpen: navPrefs?.open ?? true,\n languageCode,\n languageOptions,\n locale: req.locale ?? undefined,\n permissions,\n theme,\n translations: req.i18n.translations,\n user: req.user,\n }\n}\n"],"names":["getNavPrefs","getClientConfig","applyLocaleFiltering","getRequestTheme","initReq","getLayoutData","configPromise","importMap","cookies","headers","languageCode","permissions","req","payload","config","theme","languageOptions","Object","entries","i18n","supportedLanguages","reduce","acc","language","languageConfig","keys","includes","push","label","translations","general","thisLanguage","value","navPrefs","clientConfig","user","dateFNSKey","fallbackLang","fallbackLanguage","isNavOpen","open","locale"
|
|
1
|
+
{"version":3,"sources":["../../../src/layouts/Root/getLayoutData.ts"],"sourcesContent":["import type { AcceptedLanguages } from '@payloadcms/translations'\nimport type { ImportMap, LanguageOptions, SanitizedConfig, ServerProps } from 'payload'\n\nimport { getNavPrefs } from '@payloadcms/ui/elements/Nav/getNavPrefs'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { Outlet } from '@tanstack/react-router'\nimport { applyLocaleFiltering } from 'payload/shared'\nimport { createElement } from 'react'\n\nimport type { RootLayoutData } from './index.js'\n\nimport { getRequestTheme } from '../../utilities/getRequestTheme.js'\nimport { initReq } from '../../utilities/initReq.server.js'\n\nexport type GetLayoutDataArgs = {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n}\n\n/**\n * Fetches all data needed by the root admin layout.\n * Call this in your TanStack Start root route loader.\n */\nexport async function getLayoutData({\n configPromise,\n importMap,\n}: GetLayoutDataArgs): Promise<RootLayoutData> {\n const {\n cookies,\n headers,\n languageCode,\n permissions,\n req,\n req: {\n payload: { config },\n },\n } = await initReq({ configPromise, importMap })\n\n const theme = getRequestTheme({ config, cookies, headers })\n\n const languageOptions: LanguageOptions = Object.entries(\n config.i18n.supportedLanguages || {},\n ).reduce((acc, [language, languageConfig]) => {\n if (Object.keys(config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language as AcceptedLanguages,\n })\n }\n return acc\n }, [] as LanguageOptions)\n\n const navPrefs = await getNavPrefs(req)\n\n const clientConfig = getClientConfig({\n config,\n i18n: req.i18n,\n importMap,\n user: req.user ?? true,\n })\n\n await applyLocaleFiltering({ clientConfig, config, req })\n\n // Build the custom admin provider tree (`config.admin.components.providers`)\n // nested around the router `<Outlet />`, mirroring the Next adapter's\n // `NestProviders`. Returned as an unrendered element; the caller's server\n // function renders it to an RSC payload (so server-component providers run\n // server-side and client providers wrap the live Outlet). `undefined` when\n // no custom providers are configured — the caller falls back to `<Outlet />`.\n const providerPaths = config.admin?.components?.providers\n let providers: React.ReactNode = undefined\n if (Array.isArray(providerPaths) && providerPaths.length > 0) {\n const serverProps: ServerProps = {\n i18n: req.i18n,\n params: {},\n payload: req.payload,\n permissions,\n searchParams: {},\n server: req.server,\n user: req.user ?? undefined,\n }\n // Mirror the Next adapter's `NestProviders`: render each configured provider\n // via `RenderServerComponent` so the entry's own `clientProps`/`serverProps`\n // (e.g. plugin-multi-tenant's `userHasAccessToAllTenants`) are merged in, and\n // server components receive `serverProps` while client components get only\n // `clientProps`. Nested around the router `<Outlet />` instead of `children`.\n providers = providerPaths.reduceRight<React.ReactNode>(\n (children, provider) =>\n RenderServerComponent({\n clientProps: { children },\n Component: provider,\n importMap,\n serverProps,\n }),\n createElement(Outlet),\n )\n }\n\n return {\n clientConfig,\n dateFNSKey: req.i18n.dateFNSKey,\n fallbackLang: config.i18n.fallbackLanguage,\n isNavOpen: navPrefs?.open ?? true,\n languageCode,\n languageOptions,\n locale: req.locale ?? undefined,\n permissions,\n providers,\n theme,\n translations: req.i18n.translations,\n user: req.user,\n }\n}\n"],"names":["getNavPrefs","RenderServerComponent","getClientConfig","Outlet","applyLocaleFiltering","createElement","getRequestTheme","initReq","getLayoutData","configPromise","importMap","cookies","headers","languageCode","permissions","req","payload","config","theme","languageOptions","Object","entries","i18n","supportedLanguages","reduce","acc","language","languageConfig","keys","includes","push","label","translations","general","thisLanguage","value","navPrefs","clientConfig","user","providerPaths","admin","components","providers","undefined","Array","isArray","length","serverProps","params","searchParams","server","reduceRight","children","provider","clientProps","Component","dateFNSKey","fallbackLang","fallbackLanguage","isNavOpen","open","locale"],"mappings":"AAGA,SAASA,WAAW,QAAQ,0CAAyC;AACrE,SAASC,qBAAqB,QAAQ,gDAA+C;AACrF,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,MAAM,QAAQ,yBAAwB;AAC/C,SAASC,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,aAAa,QAAQ,QAAO;AAIrC,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,OAAO,QAAQ,oCAAmC;AAO3D;;;CAGC,GACD,OAAO,eAAeC,cAAc,EAClCC,aAAa,EACbC,SAAS,EACS;IAClB,MAAM,EACJC,OAAO,EACPC,OAAO,EACPC,YAAY,EACZC,WAAW,EACXC,GAAG,EACHA,KAAK,EACHC,SAAS,EAAEC,MAAM,EAAE,EACpB,EACF,GAAG,MAAMV,QAAQ;QAAEE;QAAeC;IAAU;IAE7C,MAAMQ,QAAQZ,gBAAgB;QAAEW;QAAQN;QAASC;IAAQ;IAEzD,MAAMO,kBAAmCC,OAAOC,OAAO,CACrDJ,OAAOK,IAAI,CAACC,kBAAkB,IAAI,CAAC,GACnCC,MAAM,CAAC,CAACC,KAAK,CAACC,UAAUC,eAAe;QACvC,IAAIP,OAAOQ,IAAI,CAACX,OAAOK,IAAI,CAACC,kBAAkB,EAAEM,QAAQ,CAACH,WAAW;YAClED,IAAIK,IAAI,CAAC;gBACPC,OAAOJ,eAAeK,YAAY,CAACC,OAAO,CAACC,YAAY;gBACvDC,OAAOT;YACT;QACF;QACA,OAAOD;IACT,GAAG,EAAE;IAEL,MAAMW,WAAW,MAAMpC,YAAYe;IAEnC,MAAMsB,eAAenC,gBAAgB;QACnCe;QACAK,MAAMP,IAAIO,IAAI;QACdZ;QACA4B,MAAMvB,IAAIuB,IAAI,IAAI;IACpB;IAEA,MAAMlC,qBAAqB;QAAEiC;QAAcpB;QAAQF;IAAI;IAEvD,6EAA6E;IAC7E,sEAAsE;IACtE,0EAA0E;IAC1E,2EAA2E;IAC3E,2EAA2E;IAC3E,8EAA8E;IAC9E,MAAMwB,gBAAgBtB,OAAOuB,KAAK,EAAEC,YAAYC;IAChD,IAAIA,YAA6BC;IACjC,IAAIC,MAAMC,OAAO,CAACN,kBAAkBA,cAAcO,MAAM,GAAG,GAAG;QAC5D,MAAMC,cAA2B;YAC/BzB,MAAMP,IAAIO,IAAI;YACd0B,QAAQ,CAAC;YACThC,SAASD,IAAIC,OAAO;YACpBF;YACAmC,cAAc,CAAC;YACfC,QAAQnC,IAAImC,MAAM;YAClBZ,MAAMvB,IAAIuB,IAAI,IAAIK;QACpB;QACA,6EAA6E;QAC7E,6EAA6E;QAC7E,8EAA8E;QAC9E,2EAA2E;QAC3E,8EAA8E;QAC9ED,YAAYH,cAAcY,WAAW,CACnC,CAACC,UAAUC,WACTpD,sBAAsB;gBACpBqD,aAAa;oBAAEF;gBAAS;gBACxBG,WAAWF;gBACX3C;gBACAqC;YACF,IACF1C,cAAcF;IAElB;IAEA,OAAO;QACLkC;QACAmB,YAAYzC,IAAIO,IAAI,CAACkC,UAAU;QAC/BC,cAAcxC,OAAOK,IAAI,CAACoC,gBAAgB;QAC1CC,WAAWvB,UAAUwB,QAAQ;QAC7B/C;QACAM;QACA0C,QAAQ9C,IAAI8C,MAAM,IAAIlB;QACtB7B;QACA4B;QACAxB;QACAc,cAAcjB,IAAIO,IAAI,CAACU,YAAY;QACnCM,MAAMvB,IAAIuB,IAAI;IAChB;AACF"}
|
|
@@ -12,6 +12,13 @@ export type RootLayoutData = {
|
|
|
12
12
|
languageOptions: LanguageOptions;
|
|
13
13
|
locale?: string;
|
|
14
14
|
permissions: SanitizedPermissions;
|
|
15
|
+
/**
|
|
16
|
+
* Custom admin provider tree (`config.admin.components.providers`) nested
|
|
17
|
+
* around the router `<Outlet />`. Built unrendered by `getLayoutData`; the
|
|
18
|
+
* layout server function renders it to an RSC payload before it reaches the
|
|
19
|
+
* client. `undefined` when no custom providers are configured.
|
|
20
|
+
*/
|
|
21
|
+
providers?: React.ReactNode;
|
|
15
22
|
theme: Theme;
|
|
16
23
|
translations: I18nClient['translations'];
|
|
17
24
|
user: null | TypedUser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACV,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,8BAA8B,CAAA;AAIrC,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,eAAe,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,oBAAoB,CAAA;IACjC,KAAK,EAAE,KAAK,CAAA;IACZ,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACxC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAA;CAC9C,CAAA;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,eAAe,qBAgC7E"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACV,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,8BAA8B,CAAA;AAIrC,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,eAAe,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,oBAAoB,CAAA;IACjC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,EAAE,KAAK,CAAA;IACZ,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACxC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAA;CAC9C,CAAA;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,eAAe,qBAgC7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/layouts/Root/index.tsx"],"sourcesContent":["import type { AcceptedLanguages, I18nClient } from '@payloadcms/translations'\nimport type { Theme } from '@payloadcms/ui'\nimport type {\n ClientConfig,\n LanguageOptions,\n SanitizedPermissions,\n ServerFunctionClient,\n TypedUser,\n} from 'payload'\n\nimport { rtlLanguages } from '@payloadcms/translations'\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport React from 'react'\nimport '@payloadcms/ui/scss/app.scss'\n\nimport { TanStackRouterAdapter } from '../../elements/RouterAdapter/index.js'\n\nexport type RootLayoutData = {\n clientConfig: ClientConfig\n dateFNSKey: I18nClient['dateFNSKey']\n fallbackLang: string\n isNavOpen: boolean\n languageCode: string\n languageOptions: LanguageOptions\n locale?: string\n permissions: SanitizedPermissions\n theme: Theme\n translations: I18nClient['translations']\n user: null | TypedUser\n}\n\nexport type RootLayoutProps = {\n readonly children: React.ReactNode\n readonly data: RootLayoutData\n readonly serverFunction: ServerFunctionClient\n}\n\nexport function RootLayout({ children, data, serverFunction }: RootLayoutProps) {\n const dir = (rtlLanguages as unknown as string[]).includes(data.languageCode) ? 'RTL' : 'LTR'\n\n return (\n <html data-theme={data.theme} dir={dir} lang={data.languageCode} suppressHydrationWarning>\n <head>\n <style>{`@layer payload-default, payload;`}</style>\n </head>\n <body>\n <RootProvider\n config={data.clientConfig}\n dateFNSKey={data.dateFNSKey}\n fallbackLang={data.fallbackLang as AcceptedLanguages}\n highContrastMode={false}\n isNavOpen={data.isNavOpen}\n languageCode={data.languageCode}\n languageOptions={data.languageOptions}\n locale={data.locale}\n permissions={(data.user ? data.permissions : null) as unknown as SanitizedPermissions}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n theme={data.theme}\n translations={data.translations}\n user={data.user}\n >\n <ProgressBar />\n {children}\n </RootProvider>\n <div id=\"portal\" />\n </body>\n </html>\n )\n}\n"],"names":["rtlLanguages","ProgressBar","RootProvider","React","TanStackRouterAdapter","RootLayout","children","data","serverFunction","dir","includes","languageCode","html","data-theme","theme","lang","suppressHydrationWarning","head","style","body","config","clientConfig","dateFNSKey","fallbackLang","highContrastMode","isNavOpen","languageOptions","locale","permissions","user","RouterAdapter","translations","div","id"],"mappings":";AAUA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,OAAOC,WAAW,QAAO;AACzB,OAAO,+BAA8B;AAErC,SAASC,qBAAqB,QAAQ,wCAAuC;
|
|
1
|
+
{"version":3,"sources":["../../../src/layouts/Root/index.tsx"],"sourcesContent":["import type { AcceptedLanguages, I18nClient } from '@payloadcms/translations'\nimport type { Theme } from '@payloadcms/ui'\nimport type {\n ClientConfig,\n LanguageOptions,\n SanitizedPermissions,\n ServerFunctionClient,\n TypedUser,\n} from 'payload'\n\nimport { rtlLanguages } from '@payloadcms/translations'\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport React from 'react'\nimport '@payloadcms/ui/scss/app.scss'\n\nimport { TanStackRouterAdapter } from '../../elements/RouterAdapter/index.js'\n\nexport type RootLayoutData = {\n clientConfig: ClientConfig\n dateFNSKey: I18nClient['dateFNSKey']\n fallbackLang: string\n isNavOpen: boolean\n languageCode: string\n languageOptions: LanguageOptions\n locale?: string\n permissions: SanitizedPermissions\n /**\n * Custom admin provider tree (`config.admin.components.providers`) nested\n * around the router `<Outlet />`. Built unrendered by `getLayoutData`; the\n * layout server function renders it to an RSC payload before it reaches the\n * client. `undefined` when no custom providers are configured.\n */\n providers?: React.ReactNode\n theme: Theme\n translations: I18nClient['translations']\n user: null | TypedUser\n}\n\nexport type RootLayoutProps = {\n readonly children: React.ReactNode\n readonly data: RootLayoutData\n readonly serverFunction: ServerFunctionClient\n}\n\nexport function RootLayout({ children, data, serverFunction }: RootLayoutProps) {\n const dir = (rtlLanguages as unknown as string[]).includes(data.languageCode) ? 'RTL' : 'LTR'\n\n return (\n <html data-theme={data.theme} dir={dir} lang={data.languageCode} suppressHydrationWarning>\n <head>\n <style>{`@layer payload-default, payload;`}</style>\n </head>\n <body>\n <RootProvider\n config={data.clientConfig}\n dateFNSKey={data.dateFNSKey}\n fallbackLang={data.fallbackLang as AcceptedLanguages}\n highContrastMode={false}\n isNavOpen={data.isNavOpen}\n languageCode={data.languageCode}\n languageOptions={data.languageOptions}\n locale={data.locale}\n permissions={(data.user ? data.permissions : null) as unknown as SanitizedPermissions}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n theme={data.theme}\n translations={data.translations}\n user={data.user}\n >\n <ProgressBar />\n {children}\n </RootProvider>\n <div id=\"portal\" />\n </body>\n </html>\n )\n}\n"],"names":["rtlLanguages","ProgressBar","RootProvider","React","TanStackRouterAdapter","RootLayout","children","data","serverFunction","dir","includes","languageCode","html","data-theme","theme","lang","suppressHydrationWarning","head","style","body","config","clientConfig","dateFNSKey","fallbackLang","highContrastMode","isNavOpen","languageOptions","locale","permissions","user","RouterAdapter","translations","div","id"],"mappings":";AAUA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,OAAOC,WAAW,QAAO;AACzB,OAAO,+BAA8B;AAErC,SAASC,qBAAqB,QAAQ,wCAAuC;AA6B7E,OAAO,SAASC,WAAW,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,EAAmB;IAC5E,MAAMC,MAAM,AAACT,aAAqCU,QAAQ,CAACH,KAAKI,YAAY,IAAI,QAAQ;IAExF,qBACE,MAACC;QAAKC,cAAYN,KAAKO,KAAK;QAAEL,KAAKA;QAAKM,MAAMR,KAAKI,YAAY;QAAEK,wBAAwB;;0BACvF,KAACC;0BACC,cAAA,KAACC;8BAAO,CAAC,gCAAgC,CAAC;;;0BAE5C,MAACC;;kCACC,MAACjB;wBACCkB,QAAQb,KAAKc,YAAY;wBACzBC,YAAYf,KAAKe,UAAU;wBAC3BC,cAAchB,KAAKgB,YAAY;wBAC/BC,kBAAkB;wBAClBC,WAAWlB,KAAKkB,SAAS;wBACzBd,cAAcJ,KAAKI,YAAY;wBAC/Be,iBAAiBnB,KAAKmB,eAAe;wBACrCC,QAAQpB,KAAKoB,MAAM;wBACnBC,aAAcrB,KAAKsB,IAAI,GAAGtB,KAAKqB,WAAW,GAAG;wBAC7CE,eAAe1B;wBACfI,gBAAgBA;wBAChBM,OAAOP,KAAKO,KAAK;wBACjBiB,cAAcxB,KAAKwB,YAAY;wBAC/BF,MAAMtB,KAAKsB,IAAI;;0CAEf,KAAC5B;4BACAK;;;kCAEH,KAAC0B;wBAAIC,IAAG;;;;;;AAIhB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the blocking inline script that sets `data-theme`, `lang`, and `dir`
|
|
4
|
+
* on `<html>` synchronously, before first paint, from Payload's theme and
|
|
5
|
+
* language cookies. This is the no-flash equivalent of what `RootProvider`'s
|
|
6
|
+
* `ThemeProvider` does in a post-hydration effect, hoisted into the SSR'd
|
|
7
|
+
* document head so the admin panel never flashes light mode (or LTR for RTL
|
|
8
|
+
* locales) on the first render. Mirrors `detectTheme` in
|
|
9
|
+
* `@payloadcms/ui`'s `ThemeProvider`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildThemeInitScript(cookiePrefix?: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* The no-flash theme bootstrap script for the default (`payload`) cookie
|
|
14
|
+
* prefix. Inline this in a `<script dangerouslySetInnerHTML>` inside the
|
|
15
|
+
* document `<head>` to set `data-theme`/`lang`/`dir` before first paint.
|
|
16
|
+
*/
|
|
17
|
+
export declare const THEME_INIT_SCRIPT: string;
|
|
18
|
+
export type PayloadAdminShellProps = {
|
|
19
|
+
readonly children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* The `config.cookiePrefix` used to read the theme/language cookies in the
|
|
22
|
+
* no-flash bootstrap script. Defaults to `'payload'`.
|
|
23
|
+
*/
|
|
24
|
+
readonly cookiePrefix?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The `<html>` document shell for Payload admin routes — the TanStack Start
|
|
28
|
+
* equivalent of `@payloadcms/next`'s root layout `<html>`. Owns the no-flash
|
|
29
|
+
* theme script, the `@layer` ordering style, `@payloadcms/ui` styles,
|
|
30
|
+
* `<HeadContent />`, and `<Scripts />`. Render `RootProvider` (and the rest of
|
|
31
|
+
* the admin tree) as `children`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function PayloadAdminShell({ children, cookiePrefix }: PayloadAdminShellProps): React.JSX.Element;
|
|
34
|
+
export type WithPayloadRootOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* Path prefix that mounts the Payload admin panel (`config.routes.admin`).
|
|
37
|
+
* Routes under it render the Payload admin document shell; everything else
|
|
38
|
+
* renders your own shell. Defaults to `'/admin'`.
|
|
39
|
+
*/
|
|
40
|
+
adminRoute?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The `config.cookiePrefix` used by the no-flash theme bootstrap script.
|
|
43
|
+
* Defaults to `'payload'`.
|
|
44
|
+
*/
|
|
45
|
+
cookiePrefix?: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Wraps your application's root document shell so Payload owns its own
|
|
49
|
+
* `<html>` chrome on admin routes while your shell renders everywhere else.
|
|
50
|
+
*
|
|
51
|
+
* Attach the result to the root route's `shellComponent`; it is the single
|
|
52
|
+
* integration touch point — no root loader and no manual data threading:
|
|
53
|
+
*
|
|
54
|
+
* ```tsx
|
|
55
|
+
* export const Route = createRootRoute({
|
|
56
|
+
* shellComponent: withPayloadRoot(MarketingRoot),
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function withPayloadRoot(RootShell: React.ComponentType<{
|
|
61
|
+
children: React.ReactNode;
|
|
62
|
+
}>, options?: WithPayloadRootOptions): ({ children }: {
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
}) => React.JSX.Element;
|
|
65
|
+
//# sourceMappingURL=withPayloadRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withPayloadRoot.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/withPayloadRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,GAAE,MAAkB,GAAG,MAAM,CAG7E;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAA+B,CAAA;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,sBAAsB,qBAmBnF;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,EAC7D,OAAO,GAAE,sBAA2B,IAIH,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,uBAc7E"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { rtlLanguages } from '@payloadcms/translations';
|
|
4
|
+
import { HeadContent, Scripts, useRouterState } from '@tanstack/react-router';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Builds the blocking inline script that sets `data-theme`, `lang`, and `dir`
|
|
8
|
+
* on `<html>` synchronously, before first paint, from Payload's theme and
|
|
9
|
+
* language cookies. This is the no-flash equivalent of what `RootProvider`'s
|
|
10
|
+
* `ThemeProvider` does in a post-hydration effect, hoisted into the SSR'd
|
|
11
|
+
* document head so the admin panel never flashes light mode (or LTR for RTL
|
|
12
|
+
* locales) on the first render. Mirrors `detectTheme` in
|
|
13
|
+
* `@payloadcms/ui`'s `ThemeProvider`.
|
|
14
|
+
*/ export function buildThemeInitScript(cookiePrefix = 'payload') {
|
|
15
|
+
const rtl = JSON.stringify(rtlLanguages);
|
|
16
|
+
return `(function(){try{var d=document.documentElement;var c=document.cookie.split('; ');function r(n){var row=c.find(function(x){return x.indexOf(n+'=')===0});return row?row.split('=')[1]:null}var t=r('${cookiePrefix}-theme');if(t!=='light'&&t!=='dark'){t=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}d.setAttribute('data-theme',t);var l=r('${cookiePrefix}-lng');if(l){d.setAttribute('lang',l);d.setAttribute('dir',${rtl}.indexOf(l)!==-1?'rtl':'ltr')}}catch(e){}})()`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The no-flash theme bootstrap script for the default (`payload`) cookie
|
|
20
|
+
* prefix. Inline this in a `<script dangerouslySetInnerHTML>` inside the
|
|
21
|
+
* document `<head>` to set `data-theme`/`lang`/`dir` before first paint.
|
|
22
|
+
*/ export const THEME_INIT_SCRIPT = buildThemeInitScript();
|
|
23
|
+
/**
|
|
24
|
+
* The `<html>` document shell for Payload admin routes — the TanStack Start
|
|
25
|
+
* equivalent of `@payloadcms/next`'s root layout `<html>`. Owns the no-flash
|
|
26
|
+
* theme script, the `@layer` ordering style, `@payloadcms/ui` styles,
|
|
27
|
+
* `<HeadContent />`, and `<Scripts />`. Render `RootProvider` (and the rest of
|
|
28
|
+
* the admin tree) as `children`.
|
|
29
|
+
*/ export function PayloadAdminShell({ children, cookiePrefix }) {
|
|
30
|
+
const themeInitScript = cookiePrefix ? buildThemeInitScript(cookiePrefix) : THEME_INIT_SCRIPT;
|
|
31
|
+
return(// `lang`/`dir` are set on `<html>` by `themeInitScript` before first paint
|
|
32
|
+
// from the `*-lng` cookie, so a static `lang` here would be incorrect.
|
|
33
|
+
// eslint-disable-next-line jsx-a11y/html-has-lang -- set dynamically by the inline bootstrap script
|
|
34
|
+
/*#__PURE__*/ _jsxs("html", {
|
|
35
|
+
suppressHydrationWarning: true,
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ _jsxs("head", {
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ _jsx("script", {
|
|
40
|
+
dangerouslySetInnerHTML: {
|
|
41
|
+
__html: themeInitScript
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ _jsx("style", {
|
|
45
|
+
children: `@layer payload-default, payload;`
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ _jsx(HeadContent, {})
|
|
48
|
+
]
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ _jsxs("body", {
|
|
51
|
+
children: [
|
|
52
|
+
children,
|
|
53
|
+
/*#__PURE__*/ _jsx(Scripts, {})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Wraps your application's root document shell so Payload owns its own
|
|
61
|
+
* `<html>` chrome on admin routes while your shell renders everywhere else.
|
|
62
|
+
*
|
|
63
|
+
* Attach the result to the root route's `shellComponent`; it is the single
|
|
64
|
+
* integration touch point — no root loader and no manual data threading:
|
|
65
|
+
*
|
|
66
|
+
* ```tsx
|
|
67
|
+
* export const Route = createRootRoute({
|
|
68
|
+
* shellComponent: withPayloadRoot(MarketingRoot),
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*/ export function withPayloadRoot(RootShell, options = {}) {
|
|
72
|
+
const { adminRoute = '/admin', cookiePrefix } = options;
|
|
73
|
+
return function PayloadRootShell({ children }) {
|
|
74
|
+
const isAdminRoute = useRouterState({
|
|
75
|
+
select: (s)=>{
|
|
76
|
+
const { pathname } = s.location;
|
|
77
|
+
return pathname === adminRoute || pathname.startsWith(`${adminRoute}/`);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (isAdminRoute) {
|
|
81
|
+
return /*#__PURE__*/ _jsx(PayloadAdminShell, {
|
|
82
|
+
cookiePrefix: cookiePrefix,
|
|
83
|
+
children: children
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return /*#__PURE__*/ _jsx(RootShell, {
|
|
87
|
+
children: children
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=withPayloadRoot.js.map
|