@payloadcms/tanstack-start 4.0.0-internal.688c4d0 → 4.0.0-internal.7b031c8
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/LICENSE.md +1 -1
- package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
- package/dist/elements/RouterAdapter/index.js +18 -2
- package/dist/elements/RouterAdapter/index.js.map +1 -1
- package/dist/exports/client.d.ts +4 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +4 -1
- 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 +4 -2
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +4 -2
- package/dist/exports/server.js.map +1 -1
- package/dist/exports/shared.d.ts +2 -0
- package/dist/exports/shared.d.ts.map +1 -0
- package/dist/exports/shared.js +3 -0
- package/dist/exports/shared.js.map +1 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
- package/dist/layouts/Root/getLayoutData.js +1 -1
- package/dist/layouts/Root/getLayoutData.js.map +1 -1
- package/dist/layouts/Root/index.d.ts +2 -2
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +4 -2
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts +8 -32
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.js +34 -35
- package/dist/layouts/Root/withPayloadRoot.js.map +1 -1
- package/dist/node/cssLoader.d.mts +24 -2
- package/dist/node/cssLoader.d.mts.map +1 -1
- package/dist/routes/adminRoutes.d.ts +111 -0
- package/dist/routes/adminRoutes.d.ts.map +1 -0
- package/dist/routes/adminRoutes.js +108 -0
- package/dist/routes/adminRoutes.js.map +1 -0
- package/dist/routes/apiRoute.d.ts +34 -0
- package/dist/routes/apiRoute.d.ts.map +1 -0
- package/dist/routes/apiRoute.js +43 -0
- package/dist/routes/apiRoute.js.map +1 -0
- package/dist/routes/layoutRoute.d.ts +26 -0
- package/dist/routes/layoutRoute.d.ts.map +1 -0
- package/dist/routes/layoutRoute.js +57 -0
- package/dist/routes/layoutRoute.js.map +1 -0
- package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
- package/dist/utilities/handleAPIRoute.server.d.ts +11 -0
- package/dist/utilities/handleAPIRoute.server.d.ts.map +1 -0
- package/dist/utilities/handleAPIRoute.server.js +17 -0
- package/dist/utilities/handleAPIRoute.server.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 +239 -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/meta.d.ts +1 -0
- package/dist/utilities/meta.d.ts.map +1 -1
- package/dist/utilities/meta.js +2 -1
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/routerSearch.d.ts +40 -0
- package/dist/utilities/routerSearch.d.ts.map +1 -0
- package/dist/utilities/routerSearch.js +45 -0
- package/dist/utilities/routerSearch.js.map +1 -0
- package/dist/utilities/serverAdapter.server.d.ts.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/withPayload/config/external.d.ts +36 -0
- package/dist/withPayload/config/external.d.ts.map +1 -0
- package/dist/withPayload/config/external.js +82 -0
- package/dist/withPayload/config/external.js.map +1 -0
- package/dist/withPayload/config/optimizeDeps.d.ts +25 -0
- package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
- package/dist/{vite/constants.js → withPayload/config/optimizeDeps.js} +23 -57
- package/dist/withPayload/config/optimizeDeps.js.map +1 -0
- package/dist/withPayload/config/scss.d.ts +14 -0
- package/dist/withPayload/config/scss.d.ts.map +1 -0
- package/dist/withPayload/config/scss.js +28 -0
- package/dist/withPayload/config/scss.js.map +1 -0
- package/dist/withPayload/importProtection.d.ts.map +1 -0
- package/dist/withPayload/importProtection.js.map +1 -0
- package/dist/withPayload/index.d.ts +99 -0
- package/dist/withPayload/index.d.ts.map +1 -0
- package/dist/withPayload/index.js +277 -0
- package/dist/withPayload/index.js.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
- package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.js +5 -0
- package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
- package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
- package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
- package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.js +37 -4
- package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.d.ts +13 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.js +32 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
- package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
- package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
- package/package.json +17 -12
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- 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
- package/dist/exports/vite.d.ts +0 -3
- package/dist/exports/vite.d.ts.map +0 -1
- package/dist/exports/vite.js +0 -3
- package/dist/exports/vite.js.map +0 -1
- package/dist/utilities/getRequestTheme.d.ts +0 -10
- package/dist/utilities/getRequestTheme.d.ts.map +0 -1
- package/dist/utilities/getRequestTheme.js +0 -25
- package/dist/utilities/getRequestTheme.js.map +0 -1
- package/dist/vite/constants.d.ts +0 -37
- package/dist/vite/constants.d.ts.map +0 -1
- package/dist/vite/constants.js.map +0 -1
- package/dist/vite/importProtection.d.ts.map +0 -1
- package/dist/vite/importProtection.js.map +0 -1
- package/dist/vite/plugin.d.ts +0 -38
- package/dist/vite/plugin.d.ts.map +0 -1
- package/dist/vite/plugin.js +0 -183
- package/dist/vite/plugin.js.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.d.ts.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.js.map +0 -1
- package/dist/vite/plugins/devTransforms.d.ts.map +0 -1
- package/dist/vite/plugins/devTransforms.js.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.js.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.d.ts.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.js.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.d.ts.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.js.map +0 -1
- /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
- /package/dist/{vite → withPayload}/importProtection.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.js +0 -0
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
3
|
+
Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -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;AAuDvE,eAAO,MAAM,qBAAqB,EAAE,
|
|
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,sBAyGnC,CAAA"}
|
|
@@ -102,16 +102,32 @@ export const TanStackRouterAdapter = ({ children })=>{
|
|
|
102
102
|
router,
|
|
103
103
|
toNavOptions
|
|
104
104
|
]);
|
|
105
|
+
// Mirror Next.js' router behavior to allow syncing client state to the URL without triggering a second server load.
|
|
106
|
+
// TanStack's browser history monkeypatches `window.history.replaceState` and notifies `router.load` on every call.
|
|
107
|
+
// Use `_ignoreSubscribers` to suppresses that notification — the same flag TanStack uses internally when flushing history.
|
|
108
|
+
const replaceState = useCallback((url)=>{
|
|
109
|
+
const { history } = router;
|
|
110
|
+
history._ignoreSubscribers = true;
|
|
111
|
+
try {
|
|
112
|
+
window.history.replaceState(null, '', url);
|
|
113
|
+
} finally{
|
|
114
|
+
history._ignoreSubscribers = false;
|
|
115
|
+
}
|
|
116
|
+
}, [
|
|
117
|
+
router
|
|
118
|
+
]);
|
|
105
119
|
const adaptedRouter = useMemo(()=>({
|
|
106
120
|
back,
|
|
107
121
|
push,
|
|
108
122
|
refresh,
|
|
109
|
-
replace
|
|
123
|
+
replace,
|
|
124
|
+
replaceState
|
|
110
125
|
}), [
|
|
111
126
|
back,
|
|
112
127
|
push,
|
|
113
128
|
refresh,
|
|
114
|
-
replace
|
|
129
|
+
replace,
|
|
130
|
+
replaceState
|
|
115
131
|
]);
|
|
116
132
|
// `location.searchStr` is the serialized query string; `location.search` is
|
|
117
133
|
// the parsed object (a nested structure once the router uses `qs` for search
|
|
@@ -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 * 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;
|
|
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\n if ('_splat' in params && typeof params._splat === 'string') {\n adapted.segments = params._splat.split('/').filter(Boolean)\n }\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\n const queryIndex = relativePath.indexOf('?')\n\n if (queryIndex === -1) {\n return { to: relativePath }\n }\n\n const searchObject = qs.parse(relativePath.slice(queryIndex + 1), {\n depth: 10,\n ignoreQueryPrefix: true,\n })\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\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\n const refresh = useCallback(() => {\n void router.invalidate()\n }, [router])\n\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 // Mirror Next.js' router behavior to allow syncing client state to the URL without triggering a second server load.\n // TanStack's browser history monkeypatches `window.history.replaceState` and notifies `router.load` on every call.\n // Use `_ignoreSubscribers` to suppresses that notification — the same flag TanStack uses internally when flushing history.\n const replaceState = useCallback(\n (url: string) => {\n const { history } = router\n history._ignoreSubscribers = true\n\n try {\n window.history.replaceState(null, '', url)\n } finally {\n history._ignoreSubscribers = false\n }\n },\n [router],\n )\n\n const adaptedRouter = useMemo(\n () => ({ back, push, refresh, replace, replaceState }),\n [back, push, refresh, replace, replaceState],\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","replaceState","_ignoreSubscribers","adaptedRouter","searchParams","URLSearchParams","searchStr","value"],"mappings":"AAAA;;AAKA,SAASA,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,QAAQC,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AAO,EAAE,GAAGtB;QACpBsB,QAAQO,kBAAkB,GAAG;QAE7B,IAAI;YACFhB,OAAOS,OAAO,CAACM,YAAY,CAAC,MAAM,IAAI3C;QACxC,SAAU;YACRqC,QAAQO,kBAAkB,GAAG;QAC/B;IACF,GACA;QAAC7B;KAAO;IAGV,MAAM8B,gBAAgBnD,QACpB,IAAO,CAAA;YAAE0C;YAAME;YAAMG;YAASjC;YAASmC;QAAa,CAAA,GACpD;QAACP;QAAME;QAAMG;QAASjC;QAASmC;KAAa;IAG9C,4EAA4E;IAC5E,6EAA6E;IAC7E,yEAAyE;IACzE,0EAA0E;IAC1E,MAAMG,eAAepD,QAAQ,IAAM,IAAIqD,gBAAgB/B,SAASgC,SAAS,GAAG;QAAChC,SAASgC,SAAS;KAAC;IAEhG,MAAMC,QAAmCvD,QACvC,IAAO,CAAA;YACLR,MAAMiB;YACNc,QAAQE;YACRtB,UAAUmB,SAASnB,QAAQ;YAC3BkB,QAAQ8B;YACRC;QACF,CAAA,GACA;QAAC3B;QAAeH,SAASnB,QAAQ;QAAEgD;QAAeC;KAAa;IAGjE,qBAAO,KAAC7D;QAAqBgE,OAAOA;kBAAQ7C;;AAC9C,EAAC"}
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { TanStackComponentRenderer } from '../elements/RenderComponent/index.js';
|
|
2
2
|
export { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js';
|
|
3
|
-
export {
|
|
3
|
+
export { PayloadAdminShell, type PayloadAdminShellProps, 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';
|
|
4
6
|
export { viteDevReloadStrategy } from '../utilities/devReloadStrategy.js';
|
|
7
|
+
export { createServerFunctionClient, stripUnserializable, } from '../utilities/serverFunctionClient.js';
|
|
5
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,EACL,
|
|
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,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,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,7 +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 {
|
|
4
|
+
export { PayloadAdminShell, withPayloadRoot } from '../layouts/Root/withPayloadRoot.js';
|
|
5
|
+
export { payloadAdminIndexRoute, payloadAdminSplatRoute } from '../routes/adminRoutes.js';
|
|
6
|
+
export { payloadLayoutRoute } from '../routes/layoutRoute.js';
|
|
5
7
|
export { viteDevReloadStrategy } from '../utilities/devReloadStrategy.js';
|
|
8
|
+
export { createServerFunctionClient, stripUnserializable } from '../utilities/serverFunctionClient.js';
|
|
6
9
|
|
|
7
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 {\n
|
|
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 PayloadAdminShell,\n type PayloadAdminShellProps,\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","PayloadAdminShell","withPayloadRoot","payloadAdminIndexRoute","payloadAdminSplatRoute","payloadLayoutRoute","viteDevReloadStrategy","createServerFunctionClient","stripUnserializable"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,uCAAsC;AAChF,SAASC,qBAAqB,QAAQ,qCAAoC;AAC1E,SACEC,iBAAiB,EAEjBC,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,16 +1,18 @@
|
|
|
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 {
|
|
4
|
+
export { payloadApiHandlers } from '../routes/apiRoute.js';
|
|
5
5
|
export { getRequestI18n } from '../utilities/getRequestI18n.server.js';
|
|
6
6
|
export { getRequestLocale } from '../utilities/getRequestLocale.js';
|
|
7
|
-
export { getRequestTheme } from '../utilities/getRequestTheme.js';
|
|
8
7
|
export { handleGraphQL } from '../utilities/graphqlHandler.server.js';
|
|
8
|
+
export { handleAPIRoute } from '../utilities/handleAPIRoute.server.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';
|
|
15
16
|
export { toSerializable } from '../utilities/toSerializable.js';
|
|
17
|
+
export { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme';
|
|
16
18
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -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,
|
|
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,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,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;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA"}
|
package/dist/exports/server.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
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 {
|
|
4
|
+
export { payloadApiHandlers } from '../routes/apiRoute.js';
|
|
5
5
|
export { getRequestI18n } from '../utilities/getRequestI18n.server.js';
|
|
6
6
|
export { getRequestLocale } from '../utilities/getRequestLocale.js';
|
|
7
|
-
export { getRequestTheme } from '../utilities/getRequestTheme.js';
|
|
8
7
|
export { handleGraphQL } from '../utilities/graphqlHandler.server.js';
|
|
8
|
+
export { handleAPIRoute } from '../utilities/handleAPIRoute.server.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';
|
|
15
16
|
export { toSerializable } from '../utilities/toSerializable.js';
|
|
17
|
+
export { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme';
|
|
16
18
|
|
|
17
19
|
//# sourceMappingURL=server.js.map
|
|
@@ -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 { payloadApiHandlers } from '../routes/apiRoute.js'\nexport { getRequestI18n } from '../utilities/getRequestI18n.server.js'\nexport { getRequestLocale } from '../utilities/getRequestLocale.js'\nexport { handleGraphQL } from '../utilities/graphqlHandler.server.js'\nexport { handleAPIRoute } from '../utilities/handleAPIRoute.server.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'\nexport { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme'\n"],"names":["login","logout","refresh","payloadApiHandlers","getRequestI18n","getRequestLocale","handleGraphQL","handleAPIRoute","handleServerFunctions","getImportMapOutputPath","initReq","loadAdminPage","getAdminMeta","serializeForRsc","createPageRenderServerAdapter","tanstackServerAdapter","toSerializable","getRequestTheme"],"mappings":"AAAA,SAASA,KAAK,QAAQ,mBAAkB;AACxC,SAASC,MAAM,QAAQ,oBAAmB;AAC1C,SAASC,OAAO,QAAQ,qBAAoB;AAC5C,SAASC,kBAAkB,QAAQ,wBAAuB;AAC1D,SAASC,cAAc,QAAQ,wCAAuC;AACtE,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,aAAa,QAAQ,wCAAuC;AACrE,SAASC,cAAc,QAAQ,wCAAuC;AACtE,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;AAC/D,SAASC,eAAe,QAAQ,2CAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/exports/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export { payloadParseSearch, payloadStringifySearch } from '../utilities/routerSearch.js'\n"],"names":["payloadParseSearch","payloadStringifySearch"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,sBAAsB,QAAQ,+BAA8B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { TanStackRouterAdapter } from './elements/RouterAdapter/index.js';
|
|
3
|
-
export { viteDevReloadStrategy } from './utilities/devReloadStrategy.js';
|
|
4
|
-
export { type AdminPageMetadata, getAdminMeta } from './utilities/meta.js';
|
|
1
|
+
export { withPayload } from './withPayload/index.js';
|
|
5
2
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { TanStackRouterAdapter } from './elements/RouterAdapter/index.js';
|
|
3
|
-
export { viteDevReloadStrategy } from './utilities/devReloadStrategy.js';
|
|
4
|
-
export { getAdminMeta } from './utilities/meta.js';
|
|
1
|
+
export { withPayload } from './withPayload/index.js';
|
|
5
2
|
|
|
6
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { withPayload } from './withPayload/index.js'\n"],"names":["withPayload"],"mappings":"AAAA,SAASA,WAAW,QAAQ,yBAAwB"}
|
|
@@ -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,EAAe,MAAM,SAAS,CAAA;
|
|
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;AAUvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAIhD,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,10 +1,10 @@
|
|
|
1
1
|
import { getNavPrefs } from '@payloadcms/ui/elements/Nav/getNavPrefs';
|
|
2
2
|
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
3
3
|
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
4
|
+
import { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme';
|
|
4
5
|
import { Outlet } from '@tanstack/react-router';
|
|
5
6
|
import { applyLocaleFiltering } from 'payload/shared';
|
|
6
7
|
import { createElement } from 'react';
|
|
7
|
-
import { getRequestTheme } from '../../utilities/getRequestTheme.js';
|
|
8
8
|
import { initReq } from '../../utilities/initReq.server.js';
|
|
9
9
|
/**
|
|
10
10
|
* Fetches all data needed by the root admin layout.
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme'\nimport { Outlet } from '@tanstack/react-router'\nimport { applyLocaleFiltering } from 'payload/shared'\nimport { createElement } from 'react'\n\nimport type { RootLayoutData } from './index.js'\n\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","getRequestTheme","Outlet","applyLocaleFiltering","createElement","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,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,MAAM,QAAQ,yBAAwB;AAC/C,SAASC,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,aAAa,QAAQ,QAAO;AAIrC,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,EACH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W,CACnC,CAACC,UAAUC,WACTpD,sBAAsB;gBACpBqD,aAAa;oBAAEF;gBAAS;gBACxBG,WAAWF;gBACX3C;gBACAqC;YACF,IACFzC,cAAcF;IAElB;IAEA,OAAO;QACLiC;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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { I18nClient } from '@payloadcms/translations';
|
|
2
2
|
import type { Theme } from '@payloadcms/ui';
|
|
3
|
-
import type { ClientConfig, LanguageOptions, SanitizedPermissions, ServerFunctionClient,
|
|
3
|
+
import type { ClientConfig, LanguageOptions, SanitizedPermissions, ServerFunctionClient, User } from 'payload';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import '@payloadcms/ui/scss/app.scss';
|
|
6
6
|
export type RootLayoutData = {
|
|
@@ -21,7 +21,7 @@ export type RootLayoutData = {
|
|
|
21
21
|
providers?: React.ReactNode;
|
|
22
22
|
theme: Theme;
|
|
23
23
|
translations: I18nClient['translations'];
|
|
24
|
-
user: null |
|
|
24
|
+
user: null | User;
|
|
25
25
|
};
|
|
26
26
|
export type RootLayoutProps = {
|
|
27
27
|
readonly children: React.ReactNode;
|
|
@@ -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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sx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { rtlLanguages } from '@payloadcms/translations';
|
|
3
2
|
import { ProgressBar, RootProvider } from '@payloadcms/ui';
|
|
3
|
+
import { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import '@payloadcms/ui/scss/app.scss';
|
|
6
6
|
import { TanStackRouterAdapter } from '../../elements/RouterAdapter/index.js';
|
|
7
7
|
export function RootLayout({ children, data, serverFunction }) {
|
|
8
|
-
const dir =
|
|
8
|
+
const dir = getLanguageDir({
|
|
9
|
+
languageCode: data.languageCode
|
|
10
|
+
});
|
|
9
11
|
return /*#__PURE__*/ _jsxs("html", {
|
|
10
12
|
"data-theme": data.theme,
|
|
11
13
|
dir: dir,
|
|
@@ -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
|
|
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 User,\n} from 'payload'\n\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir'\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 | User\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 = getLanguageDir({ languageCode: data.languageCode })\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":["ProgressBar","RootProvider","getLanguageDir","React","TanStackRouterAdapter","RootLayout","children","data","serverFunction","dir","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,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,SAASC,cAAc,QAAQ,0CAAyC;AACxE,OAAOC,WAAW,QAAO;AACzB,OAAO,+BAA8B;AAErC,SAASC,qBAAqB,QAAQ,wCAAuC;AA6B7E,OAAO,SAASC,WAAW,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,EAAmB;IAC5E,MAAMC,MAAMP,eAAe;QAAEQ,cAAcH,KAAKG,YAAY;IAAC;IAE7D,qBACE,MAACC;QAAKC,cAAYL,KAAKM,KAAK;QAAEJ,KAAKA;QAAKK,MAAMP,KAAKG,YAAY;QAAEK,wBAAwB;;0BACvF,KAACC;0BACC,cAAA,KAACC;8BAAO,CAAC,gCAAgC,CAAC;;;0BAE5C,MAACC;;kCACC,MAACjB;wBACCkB,QAAQZ,KAAKa,YAAY;wBACzBC,YAAYd,KAAKc,UAAU;wBAC3BC,cAAcf,KAAKe,YAAY;wBAC/BC,kBAAkB;wBAClBC,WAAWjB,KAAKiB,SAAS;wBACzBd,cAAcH,KAAKG,YAAY;wBAC/Be,iBAAiBlB,KAAKkB,eAAe;wBACrCC,QAAQnB,KAAKmB,MAAM;wBACnBC,aAAcpB,KAAKqB,IAAI,GAAGrB,KAAKoB,WAAW,GAAG;wBAC7CE,eAAezB;wBACfI,gBAAgBA;wBAChBK,OAAON,KAAKM,KAAK;wBACjBiB,cAAcvB,KAAKuB,YAAY;wBAC/BF,MAAMrB,KAAKqB,IAAI;;0CAEf,KAAC5B;4BACAM;;;kCAEH,KAACyB;wBAAIC,IAAG;;;;;;AAIhB"}
|
|
@@ -1,36 +1,17 @@
|
|
|
1
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
2
|
export type PayloadAdminShellProps = {
|
|
19
3
|
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
4
|
};
|
|
26
5
|
/**
|
|
27
6
|
* The `<html>` document shell for Payload admin routes — the TanStack Start
|
|
28
|
-
* equivalent of `@payloadcms/next`'s root layout `<html>`.
|
|
29
|
-
* theme
|
|
30
|
-
*
|
|
31
|
-
* the
|
|
7
|
+
* equivalent of `@payloadcms/next`'s root layout `<html>`. Sets
|
|
8
|
+
* `data-theme`/`lang`/`dir` on `<html>` from the server-computed layout data
|
|
9
|
+
* (`getLayoutData`, exposed on the `/_payload` route loader), so the admin
|
|
10
|
+
* panel renders themed with the correct text direction on the first paint with no
|
|
11
|
+
* client bootstrap script — the same server-side path Next's `RootLayout`
|
|
12
|
+
* uses, sharing `getRequestTheme`/`getLanguageDir` from `@payloadcms/ui`.
|
|
32
13
|
*/
|
|
33
|
-
export declare function PayloadAdminShell({ children
|
|
14
|
+
export declare function PayloadAdminShell({ children }: PayloadAdminShellProps): React.JSX.Element;
|
|
34
15
|
export type WithPayloadRootOptions = {
|
|
35
16
|
/**
|
|
36
17
|
* Path prefix that mounts the Payload admin panel (`config.routes.admin`).
|
|
@@ -38,11 +19,6 @@ export type WithPayloadRootOptions = {
|
|
|
38
19
|
* renders your own shell. Defaults to `'/admin'`.
|
|
39
20
|
*/
|
|
40
21
|
adminRoute?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The `config.cookiePrefix` used by the no-flash theme bootstrap script.
|
|
43
|
-
* Defaults to `'payload'`.
|
|
44
|
-
*/
|
|
45
|
-
cookiePrefix?: string;
|
|
46
22
|
};
|
|
47
23
|
/**
|
|
48
24
|
* Wraps your application's root document shell so Payload owns its own
|
|
@@ -53,7 +29,7 @@ export type WithPayloadRootOptions = {
|
|
|
53
29
|
*
|
|
54
30
|
* ```tsx
|
|
55
31
|
* export const Route = createRootRoute({
|
|
56
|
-
* shellComponent: withPayloadRoot(
|
|
32
|
+
* shellComponent: withPayloadRoot(MarketingRoot),
|
|
57
33
|
* })
|
|
58
34
|
* ```
|
|
59
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayloadRoot.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/withPayloadRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withPayloadRoot.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/withPayloadRoot.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,qBAmCrE;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,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,kBAIW;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,uBAc7E"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir';
|
|
4
4
|
import { HeadContent, Scripts, useRouterState } from '@tanstack/react-router';
|
|
5
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
6
|
/**
|
|
24
7
|
* The `<html>` document shell for Payload admin routes — the TanStack Start
|
|
25
|
-
* equivalent of `@payloadcms/next`'s root layout `<html>`.
|
|
26
|
-
* theme
|
|
27
|
-
*
|
|
28
|
-
* the
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
8
|
+
* equivalent of `@payloadcms/next`'s root layout `<html>`. Sets
|
|
9
|
+
* `data-theme`/`lang`/`dir` on `<html>` from the server-computed layout data
|
|
10
|
+
* (`getLayoutData`, exposed on the `/_payload` route loader), so the admin
|
|
11
|
+
* panel renders themed with the correct text direction on the first paint with no
|
|
12
|
+
* client bootstrap script — the same server-side path Next's `RootLayout`
|
|
13
|
+
* uses, sharing `getRequestTheme`/`getLanguageDir` from `@payloadcms/ui`.
|
|
14
|
+
*/ export function PayloadAdminShell({ children }) {
|
|
15
|
+
const htmlProps = useRouterState({
|
|
16
|
+
select: (state)=>{
|
|
17
|
+
for (const match of state.matches){
|
|
18
|
+
const data = match.loaderData;
|
|
19
|
+
if (data?.theme && data?.languageCode) {
|
|
20
|
+
return {
|
|
21
|
+
'data-theme': data.theme,
|
|
22
|
+
dir: getLanguageDir({
|
|
23
|
+
languageCode: data.languageCode
|
|
24
|
+
}),
|
|
25
|
+
lang: data.languageCode
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// No layout data yet (fresh session before the loader resolves): default
|
|
30
|
+
// to `ltr` so the `[dir='ltr']`-scoped admin layout rules (e.g. the
|
|
31
|
+
// document sidebar divider) still match, matching Next's `ltr` default.
|
|
32
|
+
return {
|
|
33
|
+
dir: 'ltr'
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return(// eslint-disable-next-line jsx-a11y/html-has-lang -- `lang` is set from server-computed layout data when available
|
|
34
38
|
/*#__PURE__*/ _jsxs("html", {
|
|
39
|
+
...htmlProps,
|
|
35
40
|
suppressHydrationWarning: true,
|
|
36
41
|
children: [
|
|
37
42
|
/*#__PURE__*/ _jsxs("head", {
|
|
38
43
|
children: [
|
|
39
|
-
/*#__PURE__*/ _jsx("script", {
|
|
40
|
-
dangerouslySetInnerHTML: {
|
|
41
|
-
__html: themeInitScript
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
44
|
/*#__PURE__*/ _jsx("style", {
|
|
45
45
|
children: `@layer payload-default, payload;`
|
|
46
46
|
}),
|
|
@@ -65,11 +65,11 @@ import React from 'react';
|
|
|
65
65
|
*
|
|
66
66
|
* ```tsx
|
|
67
67
|
* export const Route = createRootRoute({
|
|
68
|
-
* shellComponent: withPayloadRoot(
|
|
68
|
+
* shellComponent: withPayloadRoot(MarketingRoot),
|
|
69
69
|
* })
|
|
70
70
|
* ```
|
|
71
71
|
*/ export function withPayloadRoot(RootShell, options = {}) {
|
|
72
|
-
const { adminRoute = '/admin'
|
|
72
|
+
const { adminRoute = '/admin' } = options;
|
|
73
73
|
return function PayloadRootShell({ children }) {
|
|
74
74
|
const isAdminRoute = useRouterState({
|
|
75
75
|
select: (s)=>{
|
|
@@ -79,7 +79,6 @@ import React from 'react';
|
|
|
79
79
|
});
|
|
80
80
|
if (isAdminRoute) {
|
|
81
81
|
return /*#__PURE__*/ _jsx(PayloadAdminShell, {
|
|
82
|
-
cookiePrefix: cookiePrefix,
|
|
83
82
|
children: children
|
|
84
83
|
});
|
|
85
84
|
}
|