@wordpress/boot 0.25.0 → 0.26.0

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.
Files changed (71) hide show
  1. package/build-module/components/app/index.mjs +29 -53
  2. package/build-module/components/app/index.mjs.map +1 -7
  3. package/build-module/components/app/router.mjs +238 -214
  4. package/build-module/components/app/router.mjs.map +1 -7
  5. package/build-module/components/app/use-route-title.mjs +35 -42
  6. package/build-module/components/app/use-route-title.mjs.map +1 -7
  7. package/build-module/components/canvas/back-button.mjs +21 -20
  8. package/build-module/components/canvas/back-button.mjs.map +1 -7
  9. package/build-module/components/canvas/index.mjs +104 -130
  10. package/build-module/components/canvas/index.mjs.map +1 -7
  11. package/build-module/components/canvas/site-preview.mjs +36 -43
  12. package/build-module/components/canvas/site-preview.mjs.map +1 -7
  13. package/build-module/components/canvas/use-navigate-to-entity-record.mjs +109 -113
  14. package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +1 -7
  15. package/build-module/components/canvas/viewport.mjs +25 -13
  16. package/build-module/components/canvas/viewport.mjs.map +1 -7
  17. package/build-module/components/canvas-renderer/index.mjs +40 -32
  18. package/build-module/components/canvas-renderer/index.mjs.map +1 -7
  19. package/build-module/components/error-boundary/index.mjs +160 -108
  20. package/build-module/components/error-boundary/index.mjs.map +1 -7
  21. package/build-module/components/navigation/drilldown-item/index.mjs +124 -127
  22. package/build-module/components/navigation/drilldown-item/index.mjs.map +1 -7
  23. package/build-module/components/navigation/dropdown-item/index.mjs +156 -173
  24. package/build-module/components/navigation/dropdown-item/index.mjs.map +1 -7
  25. package/build-module/components/navigation/index.mjs +55 -90
  26. package/build-module/components/navigation/index.mjs.map +1 -7
  27. package/build-module/components/navigation/items.mjs +51 -53
  28. package/build-module/components/navigation/items.mjs.map +1 -7
  29. package/build-module/components/navigation/navigation-item/index.mjs +120 -114
  30. package/build-module/components/navigation/navigation-item/index.mjs.map +1 -7
  31. package/build-module/components/navigation/navigation-screen/index.mjs +192 -185
  32. package/build-module/components/navigation/navigation-screen/index.mjs.map +1 -7
  33. package/build-module/components/navigation/path-matching.mjs +74 -73
  34. package/build-module/components/navigation/path-matching.mjs.map +1 -7
  35. package/build-module/components/navigation/router-link-item.mjs +13 -11
  36. package/build-module/components/navigation/router-link-item.mjs.map +1 -7
  37. package/build-module/components/navigation/use-sidebar-parent.mjs +37 -48
  38. package/build-module/components/navigation/use-sidebar-parent.mjs.map +1 -7
  39. package/build-module/components/plugin-area/index.mjs +20 -24
  40. package/build-module/components/plugin-area/index.mjs.map +1 -7
  41. package/build-module/components/root/index.mjs +227 -242
  42. package/build-module/components/root/index.mjs.map +1 -7
  43. package/build-module/components/root/single-page.mjs +174 -148
  44. package/build-module/components/root/single-page.mjs.map +1 -7
  45. package/build-module/components/root/use-sync-body-background.mjs +28 -22
  46. package/build-module/components/root/use-sync-body-background.mjs.map +1 -7
  47. package/build-module/components/save-button/index.mjs +170 -214
  48. package/build-module/components/save-button/index.mjs.map +1 -7
  49. package/build-module/components/save-panel/index.mjs +110 -106
  50. package/build-module/components/save-panel/index.mjs.map +1 -7
  51. package/build-module/components/save-panel/use-save-shortcut.mjs +42 -51
  52. package/build-module/components/save-panel/use-save-shortcut.mjs.map +1 -7
  53. package/build-module/components/sidebar/index.mjs +126 -104
  54. package/build-module/components/sidebar/index.mjs.map +1 -7
  55. package/build-module/index.mjs +1 -7
  56. package/build-module/lock-unlock.mjs +5 -10
  57. package/build-module/lock-unlock.mjs.map +1 -7
  58. package/build-module/store/actions.mjs +34 -31
  59. package/build-module/store/actions.mjs.map +1 -7
  60. package/build-module/store/index.mjs +9 -11
  61. package/build-module/store/index.mjs.map +1 -7
  62. package/build-module/store/reducer.mjs +48 -55
  63. package/build-module/store/reducer.mjs.map +1 -7
  64. package/build-module/store/selectors.mjs +21 -16
  65. package/build-module/store/selectors.mjs.map +1 -7
  66. package/build-module/store/types.mjs +0 -1
  67. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  68. package/package.json +28 -28
  69. package/src/components/error-boundary/index.tsx +50 -4
  70. package/build-module/index.mjs.map +0 -7
  71. package/build-module/store/types.mjs.map +0 -7
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/app/router.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/root/style.module.scss"],
4
- "sourcesContent": ["import type { ComponentType } from 'react';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { Page } from '@wordpress/admin-ui';\nimport {\n\tprivateApis as routePrivateApis,\n\ttype AnyRoute,\n} from '@wordpress/route';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport Root from '../root';\nimport styles from '../root/style.module.scss';\nimport ErrorBoundary from '../error-boundary';\nimport type { Route, RouteConfig, RouteLoaderContext } from '../../store/types';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tcreateLazyRoute,\n\tcreateRouter,\n\tcreateRootRoute,\n\tcreateRoute,\n\tRouterProvider,\n\tcreateBrowserHistory,\n\tparseHref,\n\tuseLoaderData,\n} = unlock( routePrivateApis );\n\n// Not found component\nfunction NotFoundComponent() {\n\treturn (\n\t\t<div className={ styles.stage }>\n\t\t\t<Page title={ __( 'Route not found' ) } hasPadding>\n\t\t\t\t{ __( \"The page you're looking for does not exist\" ) }\n\t\t\t</Page>\n\t\t</div>\n\t);\n}\n\n/**\n * Creates a TanStack route from a Route definition.\n *\n * @param route Route configuration\n * @param parentRoute Parent route.\n * @return Tanstack Route.\n */\nfunction createRouteFromDefinition( route: Route, parentRoute: AnyRoute ) {\n\t// Create route without component initially\n\tlet tanstackRoute = createRoute( {\n\t\tgetParentRoute: () => parentRoute,\n\t\tpath: route.path,\n\t\tbeforeLoad: async ( opts: any ) => {\n\t\t\t// Import route module here (lazy)\n\t\t\tif ( route.route_module ) {\n\t\t\t\tconst module = await import( route.route_module );\n\t\t\t\tconst routeConfig = module.route || {};\n\n\t\t\t\tif ( routeConfig.beforeLoad ) {\n\t\t\t\t\treturn routeConfig.beforeLoad( {\n\t\t\t\t\t\tparams: opts.params || {},\n\t\t\t\t\t\tsearch: opts.search || {},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tloader: async ( opts: any ) => {\n\t\t\t// Import route module here (lazy)\n\t\t\tlet routeConfig: RouteConfig = {};\n\t\t\tif ( route.route_module ) {\n\t\t\t\tconst module = await import( route.route_module );\n\t\t\t\trouteConfig = module.route || {};\n\t\t\t}\n\n\t\t\tconst context: RouteLoaderContext = {\n\t\t\t\tparams: opts.params || {},\n\t\t\t\tsearch: opts.deps || {},\n\t\t\t};\n\n\t\t\tconst [ , loaderData, canvasData, titleData ] = await Promise.all( [\n\t\t\t\tresolveSelect( coreStore ).getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase'\n\t\t\t\t),\n\t\t\t\trouteConfig.loader\n\t\t\t\t\t? routeConfig.loader( context )\n\t\t\t\t\t: Promise.resolve( undefined ),\n\t\t\t\trouteConfig.canvas\n\t\t\t\t\t? routeConfig.canvas( context )\n\t\t\t\t\t: Promise.resolve( undefined ),\n\t\t\t\trouteConfig.title\n\t\t\t\t\t? routeConfig.title( context )\n\t\t\t\t\t: Promise.resolve( undefined ),\n\t\t\t] );\n\n\t\t\tlet inspector = true;\n\t\t\tif ( routeConfig.inspector ) {\n\t\t\t\tinspector = await routeConfig.inspector( context );\n\t\t\t}\n\n\t\t\tlet stage = true;\n\t\t\tif ( routeConfig.stage ) {\n\t\t\t\tstage = await routeConfig.stage( context );\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...( loaderData as any ),\n\t\t\t\tcanvas: canvasData,\n\t\t\t\tinspector,\n\t\t\t\tstage,\n\t\t\t\ttitle: titleData,\n\t\t\t\trouteContentModule: route.content_module,\n\t\t\t};\n\t\t},\n\t\tloaderDeps: ( opts: any ) => opts.search,\n\t} );\n\n\t// Chain .lazy() to preload content module on intent\n\ttanstackRoute = tanstackRoute.lazy( async () => {\n\t\tconst module = route.content_module\n\t\t\t? await import( route.content_module )\n\t\t\t: {};\n\n\t\tconst Stage = module.stage;\n\t\tconst Inspector = module.inspector;\n\n\t\treturn createLazyRoute( route.path )( {\n\t\t\tcomponent: function RouteComponent() {\n\t\t\t\tconst { inspector: showInspector, stage: showStage } =\n\t\t\t\t\tuseLoaderData( { from: route.path } ) ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ Stage && showStage && (\n\t\t\t\t\t\t\t<div className={ styles.stage }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t<Stage />\n\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Inspector && showInspector && (\n\t\t\t\t\t\t\t<div className={ styles.inspector }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t<Inspector />\n\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\t} );\n\n\treturn tanstackRoute;\n}\n\n/**\n * Creates a route tree from route definitions.\n *\n * @param routes Routes definition.\n * @param rootComponent Root component to use for the router.\n * @return Router tree.\n */\nfunction createRouteTree(\n\troutes: Route[],\n\trootComponent: ComponentType = Root\n) {\n\tconst rootRoute = createRootRoute( {\n\t\tcomponent: rootComponent as any,\n\t\tcontext: () => ( {} ),\n\t} );\n\n\t// Create routes from definitions (now synchronous)\n\tconst dynamicRoutes = routes.map( ( route ) =>\n\t\tcreateRouteFromDefinition( route, rootRoute )\n\t);\n\n\treturn rootRoute.addChildren( dynamicRoutes );\n}\n\n// Create custom history that parses ?p= query parameter\nfunction createPathHistory() {\n\treturn createBrowserHistory( {\n\t\tparseLocation: () => {\n\t\t\tconst url = new URL( window.location.href );\n\t\t\tconst path = url.searchParams.get( 'p' ) || '/';\n\t\t\tconst pathHref = `${ path }${ url.hash }`;\n\t\t\treturn parseHref( pathHref, window.history.state );\n\t\t},\n\t\tcreateHref: ( href: string ) => {\n\t\t\tconst searchParams = new URLSearchParams( window.location.search );\n\t\t\tsearchParams.set( 'p', href );\n\t\t\treturn `${ window.location.pathname }?${ searchParams }`;\n\t\t},\n\t} );\n}\n\ninterface RouterProps {\n\troutes: Route[];\n\trootComponent?: ComponentType;\n}\n\nexport default function Router( {\n\troutes,\n\trootComponent = Root,\n}: RouterProps ) {\n\tconst router = useMemo( () => {\n\t\tconst history = createPathHistory();\n\t\tconst routeTree = createRouteTree( routes, rootComponent );\n\n\t\treturn createRouter( {\n\t\t\thistory,\n\t\t\trouteTree,\n\t\t\tdefaultPreload: 'intent',\n\t\t\tdefaultNotFoundComponent: NotFoundComponent,\n\t\t\tdefaultViewTransition: {\n\t\t\t\ttypes: ( {\n\t\t\t\t\tfromLocation,\n\t\t\t\t}: {\n\t\t\t\t\tfromLocation?: unknown;\n\t\t\t\t\ttoLocation: unknown;\n\t\t\t\t\tpathChanged: boolean;\n\t\t\t\t\threfChanged: boolean;\n\t\t\t\t\thashChanged: boolean;\n\t\t\t\t} ) => {\n\t\t\t\t\t// Disable view transition on initial navigation (no previous location)\n\t\t\t\t\tif ( ! fromLocation ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Enable with navigation type for subsequent navigations\n\t\t\t\t\treturn [ 'navigate' ];\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}, [ routes, rootComponent ] );\n\n\treturn <RouterProvider router={ router } />;\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"b215aa5eaa\", \".c8317e9ebb034cfa__layout{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:row;height:100%;isolation:isolate;width:100%}@media (min-width:600px){.c8317e9ebb034cfa__layout{bottom:0;inset-inline-end:0;inset-inline-start:0;min-height:calc(100vh - 46px);position:absolute;top:0}}@media (min-width:782px){.c8317e9ebb034cfa__layout{min-height:calc(100vh - 32px)}body:has(.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas) .c8317e9ebb034cfa__layout{min-height:100vh}}:where(.c8317e9ebb034cfa__layout) img{height:auto;max-width:100%}.c8317e9ebb034cfa__layout .b8f8c6cf9ae266bf__notices-snackbar{bottom:var(--wpds-dimension-size-md,32px);box-sizing:border-box;display:flex;flex-direction:column;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}.c8317e9ebb034cfa__layout .b8f8c6cf9ae266bf__notices-snackbar ._94ac6b8f274ce2f6__components-snackbar,.c8317e9ebb034cfa__layout .b8f8c6cf9ae266bf__notices-snackbar .components-snackbar{margin-inline:auto}.bfc3fedf39b1cf71__sidebar-backdrop{background-color:rgba(0,0,0,.5);bottom:0;cursor:var(--wpds-cursor-control,pointer);inset-inline-end:0;inset-inline-start:0;position:fixed;top:0;z-index:100002}.bb4f70cd030be0a3__sidebar{flex-shrink:0;height:100%;overflow:hidden;position:relative;width:240px}.bb4f70cd030be0a3__sidebar._27e6d590dc5963c9__is-mobile{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.2);inset-inline-start:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}._0eb5d3a3e94d6273__mobile-sidebar-drawer{inset-inline-end:0;inset-inline-start:0;position:fixed;top:0}._26789cb167e9f578__layout-single-page ._0eb5d3a3e94d6273__mobile-sidebar-drawer{top:46px}._0eb5d3a3e94d6273__mobile-sidebar-drawer{align-items:center;background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-bottom:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);display:flex;justify-content:flex-start;padding:16px;z-index:3}.fb03501e629fd04e__canvas.fa94dab2ab1e36f3__has-mobile-drawer{padding-top:65px;position:relative}.a03baddce3ef2026__surfaces{display:flex;flex-grow:1;gap:8px;margin:0}@media (min-width:782px){.a03baddce3ef2026__surfaces{margin:8px}._26789cb167e9f578__layout-single-page .a03baddce3ef2026__surfaces{margin-top:0;margin-inline-start:0}}._7ffe3a3db6f69647__inspector,.d12c9efe707e6cb3__stage{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-radius:0;bottom:0;color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw}._26789cb167e9f578__layout-single-page ._7ffe3a3db6f69647__inspector,._26789cb167e9f578__layout-single-page .d12c9efe707e6cb3__stage{height:calc(100vh - 46px);top:46px}@media (min-width:782px){._7ffe3a3db6f69647__inspector,.d12c9efe707e6cb3__stage{border-radius:var(--wpds-border-radius-xl,12px);height:auto;margin:0;position:static;width:auto}._26789cb167e9f578__layout-single-page ._7ffe3a3db6f69647__inspector,._26789cb167e9f578__layout-single-page .d12c9efe707e6cb3__stage{height:auto}}.d12c9efe707e6cb3__stage{z-index:2}@media (min-width:782px){.d12c9efe707e6cb3__stage{z-index:auto}}._7ffe3a3db6f69647__inspector{z-index:3}@media (min-width:782px){._7ffe3a3db6f69647__inspector{z-index:auto}}.fb03501e629fd04e__canvas{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:0;bottom:0;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw;z-index:1}._26789cb167e9f578__layout-single-page .fb03501e629fd04e__canvas{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.fb03501e629fd04e__canvas{border-radius:var(--wpds-border-radius-xl,12px);height:auto;position:static;width:auto;z-index:auto}._26789cb167e9f578__layout-single-page .fb03501e629fd04e__canvas{height:auto}._7ffe3a3db6f69647__inspector,.c8317e9ebb034cfa__layout.f7fe42ef8c67e96f__has-canvas .d12c9efe707e6cb3__stage{max-width:400px}}.fb03501e629fd04e__canvas .interface-interface-skeleton{height:100%;inset-inline-start:0!important;position:relative;top:0!important}.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .a03baddce3ef2026__surfaces{gap:0;margin:0}.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas ._7ffe3a3db6f69647__inspector,.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .d12c9efe707e6cb3__stage{display:none}.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .fb03501e629fd04e__canvas{border:none;border-radius:0;bottom:0;box-shadow:none;inset-inline-end:0;inset-inline-start:0;margin:0;max-width:none;overflow:hidden;position:fixed;top:var(--wp-admin--admin-bar--height,0)}._26789cb167e9f578__layout-single-page .c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .fb03501e629fd04e__canvas{top:46px}@media (min-width:782px){._26789cb167e9f578__layout-single-page .c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .fb03501e629fd04e__canvas{top:32px}}@media (max-width:782px){._7ffe3a3db6f69647__inspector,.d12c9efe707e6cb3__stage,.fb03501e629fd04e__canvas:not(.fa94dab2ab1e36f3__has-mobile-drawer){height:calc(100vh - var(--wp-admin--admin-bar--height, 0px));top:var(--wp-admin--admin-bar--height,0)}._0eb5d3a3e94d6273__mobile-sidebar-drawer{top:var(--wp-admin--admin-bar--height,0)}}@media not (prefers-reduced-motion:reduce){.fb03501e629fd04e__canvas .interface-interface-skeleton__header{view-transition-name:boot--canvas-header}.fb03501e629fd04e__canvas .interface-interface-skeleton__sidebar{view-transition-name:boot--canvas-sidebar}.d12c9efe707e6cb3__stage{view-transition-name:boot--stage}._7ffe3a3db6f69647__inspector{view-transition-name:boot--inspector}.fb03501e629fd04e__canvas{view-transition-name:boot--canvas}@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.d12c9efe707e6cb3__stage{view-transition-name:boot-safari--stage}._7ffe3a3db6f69647__inspector{view-transition-name:boot-safari--inspector}.fb03501e629fd04e__canvas{view-transition-name:boot-safari--canvas}}}@media (max-width:782px){:root:has(.c8317e9ebb034cfa__layout) *{view-transition-name:none!important}}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(root),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(root){animation-duration:.25s}@media not (prefers-reduced-motion:reduce){:root:has(.c8317e9ebb034cfa__layout) .components-popover:first-of-type{view-transition-name:boot--components-popover}}:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot--canvas-header),:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot--canvas-sidebar),:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot-safari--canvas){z-index:1}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--stage),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--stage){width:auto}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--stage),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--stage){background:#fff;border-radius:var(--wpds-border-radius-xl,12px);height:100%;object-fit:none;object-position:left top;overflow:hidden;width:100%}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas){object-position:center top}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--stage):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--stage):only-child{animation-name:ef68027ea03aa34b__zoomOut;will-change:transform,opacity}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--stage):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--stage):only-child{animation-name:_0752ac81dff4c432__zoomIn;will-change:transform,opacity}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--canvas):only-child{animation-name:_3a2e4dc465681136__slideFromRight;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--canvas):only-child{animation-name:_86a367ac26a1b61e__slideToRight;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas-header):only-child{animation-name:_462399c0e9d64199__slideHeaderFromTop;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas-header):only-child{animation-name:_8b272f30d43c9f38__slideHeaderToTop;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas-sidebar):only-child{animation-name:_69ed6a71d53a2e0c__slideSidebarFromRight;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas-sidebar):only-child{animation-name:bf0697a36b00caad__slideSidebarToRight;will-change:transform}@keyframes ef68027ea03aa34b__zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes _0752ac81dff4c432__zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes _3a2e4dc465681136__slideFromRight{0%{transform:translateX(100vw)}to{transform:translateX(0)}}@keyframes _86a367ac26a1b61e__slideToRight{0%{transform:translateX(0)}to{transform:translateX(100vw)}}@keyframes _462399c0e9d64199__slideHeaderFromTop{0%{transform:translateY(-100%)}}@keyframes _8b272f30d43c9f38__slideHeaderToTop{to{transform:translateY(-100%)}}@keyframes _69ed6a71d53a2e0c__slideSidebarFromRight{0%{transform:translateX(100%)}}@keyframes bf0697a36b00caad__slideSidebarToRight{to{transform:translateX(100%)}}\");\n}\nexport default {\"layout\":\"c8317e9ebb034cfa__layout\",\"has-full-canvas\":\"e97bb2807a9c4687__has-full-canvas\",\"notices-snackbar\":\"b8f8c6cf9ae266bf__notices-snackbar\",\"components-snackbar\":\"_94ac6b8f274ce2f6__components-snackbar\",\"sidebar-backdrop\":\"bfc3fedf39b1cf71__sidebar-backdrop\",\"sidebar\":\"bb4f70cd030be0a3__sidebar\",\"is-mobile\":\"_27e6d590dc5963c9__is-mobile\",\"mobile-sidebar-drawer\":\"_0eb5d3a3e94d6273__mobile-sidebar-drawer\",\"layout-single-page\":\"_26789cb167e9f578__layout-single-page\",\"canvas\":\"fb03501e629fd04e__canvas\",\"has-mobile-drawer\":\"fa94dab2ab1e36f3__has-mobile-drawer\",\"surfaces\":\"a03baddce3ef2026__surfaces\",\"stage\":\"d12c9efe707e6cb3__stage\",\"inspector\":\"_7ffe3a3db6f69647__inspector\",\"has-canvas\":\"f7fe42ef8c67e96f__has-canvas\",\"zoomOut\":\"ef68027ea03aa34b__zoomOut\",\"zoomIn\":\"_0752ac81dff4c432__zoomIn\",\"slideFromRight\":\"_3a2e4dc465681136__slideFromRight\",\"slideToRight\":\"_86a367ac26a1b61e__slideToRight\",\"slideHeaderFromTop\":\"_462399c0e9d64199__slideHeaderFromTop\",\"slideHeaderToTop\":\"_8b272f30d43c9f38__slideHeaderToTop\",\"slideSidebarFromRight\":\"_69ed6a71d53a2e0c__slideSidebarFromRight\",\"slideSidebarToRight\":\"bf0697a36b00caad__slideSidebarToRight\"};\n"],
5
- "mappings": ";AACA,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB;AAAA,EACC,eAAe;AAAA,OAET;AACP,SAAS,qBAAqB;AAC9B,SAAS,SAAS,iBAAiB;AACnC,OAAO,UAAU;;;ACAjB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;AAC3E,MAAK,C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iB,QAAQ,aAAc;AAEzD,WAAO,aAAc;AAAA,MACpB;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB,0BAA0B;AAAA,MAC1B,uBAAuB;AAAA,QACtB,OAAO,CAAE;AAAA,UACR;AAAA,QACD,MAMO;AAEN,cAAK,CAAE,cAAe;AACrB,mBAAO;AAAA,UACR;AAGA,iBAAO,CAAE,UAAW;AAAA,QACrB;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,QAAQ,aAAc,CAAE;AAE7B,SAAO,oBAAC,kBAAe,QAAkB;AAC1C;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"router.mjs","names":["routePrivateApis","styles","coreStore"],"sources":["../../../../style-runtime/src/index.ts","../../../src/components/root/style.module.scss","../../../src/components/app/router.tsx"],"sourcesContent":["type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"fed1a7ec24\", \"._5c711a1cecefd5e8__layout{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:row;height:100%;isolation:isolate;width:100%}@media (min-width:600px){._5c711a1cecefd5e8__layout{bottom:0;inset-inline-end:0;inset-inline-start:0;min-height:calc(100vh - 46px);position:absolute;top:0}}@media (min-width:782px){._5c711a1cecefd5e8__layout{min-height:calc(100vh - 32px)}body:has(._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas) ._5c711a1cecefd5e8__layout{min-height:100vh}}:where(._5c711a1cecefd5e8__layout) img{height:auto;max-width:100%}._5c711a1cecefd5e8__layout .eeebb116829e2f94__notices-snackbar{bottom:var(--wpds-dimension-size-md,32px);box-sizing:border-box;display:flex;flex-direction:column;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}._5c711a1cecefd5e8__layout .eeebb116829e2f94__notices-snackbar .cb865dcda5233b3b__components-snackbar,._5c711a1cecefd5e8__layout .eeebb116829e2f94__notices-snackbar .components-snackbar{margin-inline:auto}._04b3b4e8346a2b7b__sidebar-backdrop{background-color:rgba(0,0,0,.5);bottom:0;cursor:var(--wpds-cursor-control,pointer);inset-inline-end:0;inset-inline-start:0;position:fixed;top:0;z-index:100002}._615b052cf60fcff2__sidebar{flex-shrink:0;height:100%;overflow:hidden;position:relative;width:240px}._615b052cf60fcff2__sidebar._6be5d95ddf25e57f__is-mobile{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.2);inset-inline-start:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}.fd8d6491146392ce__mobile-sidebar-drawer{inset-inline-end:0;inset-inline-start:0;position:fixed;top:0}.f37b94fd2c1f6020__layout-single-page .fd8d6491146392ce__mobile-sidebar-drawer{top:46px}.fd8d6491146392ce__mobile-sidebar-drawer{align-items:center;background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-bottom:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);display:flex;justify-content:flex-start;padding:16px;z-index:3}._6da399dd0a232c1f__canvas._5568e036ddaba310__has-mobile-drawer{padding-top:65px;position:relative}.ff37ba01b23d0bcb__surfaces{display:flex;flex-grow:1;gap:8px;margin:0}@media (min-width:782px){.ff37ba01b23d0bcb__surfaces{margin:8px}.f37b94fd2c1f6020__layout-single-page .ff37ba01b23d0bcb__surfaces{margin-top:0;margin-inline-start:0}}.b37b199f2111c5f8__inspector,.e323e272b8b8ed4f__stage{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-radius:0;bottom:0;color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw}.f37b94fd2c1f6020__layout-single-page .b37b199f2111c5f8__inspector,.f37b94fd2c1f6020__layout-single-page .e323e272b8b8ed4f__stage{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.b37b199f2111c5f8__inspector,.e323e272b8b8ed4f__stage{border-radius:var(--wpds-border-radius-xl,12px);height:auto;margin:0;position:static;width:auto}.f37b94fd2c1f6020__layout-single-page .b37b199f2111c5f8__inspector,.f37b94fd2c1f6020__layout-single-page .e323e272b8b8ed4f__stage{height:auto}}.e323e272b8b8ed4f__stage{z-index:2}@media (min-width:782px){.e323e272b8b8ed4f__stage{z-index:auto}}.b37b199f2111c5f8__inspector{z-index:3}@media (min-width:782px){.b37b199f2111c5f8__inspector{z-index:auto}}._6da399dd0a232c1f__canvas{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:0;bottom:0;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw;z-index:1}.f37b94fd2c1f6020__layout-single-page ._6da399dd0a232c1f__canvas{height:calc(100vh - 46px);top:46px}@media (min-width:782px){._6da399dd0a232c1f__canvas{border-radius:var(--wpds-border-radius-xl,12px);height:auto;position:static;width:auto;z-index:auto}.f37b94fd2c1f6020__layout-single-page ._6da399dd0a232c1f__canvas{height:auto}._5c711a1cecefd5e8__layout.bbaf96f69377ab55__has-canvas .e323e272b8b8ed4f__stage,.b37b199f2111c5f8__inspector{max-width:400px}}._6da399dd0a232c1f__canvas .interface-interface-skeleton{height:100%;inset-inline-start:0!important;position:relative;top:0!important}._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas .ff37ba01b23d0bcb__surfaces{gap:0;margin:0}._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas .b37b199f2111c5f8__inspector,._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas .e323e272b8b8ed4f__stage{display:none}._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas ._6da399dd0a232c1f__canvas{border:none;border-radius:0;bottom:0;box-shadow:none;inset-inline-end:0;inset-inline-start:0;margin:0;max-width:none;overflow:hidden;position:fixed;top:var(--wp-admin--admin-bar--height,0)}.f37b94fd2c1f6020__layout-single-page ._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas ._6da399dd0a232c1f__canvas{top:46px}@media (min-width:782px){.f37b94fd2c1f6020__layout-single-page ._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas ._6da399dd0a232c1f__canvas{top:32px}}@media (max-width:782px){._6da399dd0a232c1f__canvas:not(._5568e036ddaba310__has-mobile-drawer),.b37b199f2111c5f8__inspector,.e323e272b8b8ed4f__stage{height:calc(100vh - var(--wp-admin--admin-bar--height, 0px));top:var(--wp-admin--admin-bar--height,0)}.fd8d6491146392ce__mobile-sidebar-drawer{top:var(--wp-admin--admin-bar--height,0)}}@media not (prefers-reduced-motion:reduce){._6da399dd0a232c1f__canvas .interface-interface-skeleton__header{view-transition-name:boot--canvas-header}._6da399dd0a232c1f__canvas .interface-interface-skeleton__sidebar{view-transition-name:boot--canvas-sidebar}.e323e272b8b8ed4f__stage{view-transition-name:boot--stage}.b37b199f2111c5f8__inspector{view-transition-name:boot--inspector}._6da399dd0a232c1f__canvas{view-transition-name:boot--canvas}@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.e323e272b8b8ed4f__stage{view-transition-name:boot-safari--stage}.b37b199f2111c5f8__inspector{view-transition-name:boot-safari--inspector}._6da399dd0a232c1f__canvas{view-transition-name:boot-safari--canvas}}}@media (max-width:782px){:root:has(._5c711a1cecefd5e8__layout) *{view-transition-name:none!important}}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(root),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(root){animation-duration:.25s}@media not (prefers-reduced-motion:reduce){:root:has(._5c711a1cecefd5e8__layout) .components-popover:first-of-type{view-transition-name:boot--components-popover}}:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot--canvas-header),:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot--canvas-sidebar),:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot-safari--canvas){z-index:1}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--stage),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--stage){width:auto}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--stage),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--stage){background:#fff;border-radius:var(--wpds-border-radius-xl,12px);height:100%;object-fit:none;object-position:left top;overflow:hidden;width:100%}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas){object-position:center top}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--stage):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--stage):only-child{animation-name:_2e385023a338e4a9__zoomOut;will-change:transform,opacity}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--stage):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--stage):only-child{animation-name:e245c2f64b6256de__zoomIn;will-change:transform,opacity}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--canvas):only-child{animation-name:_9aa5832f67721dd4__slideFromRight;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--canvas):only-child{animation-name:_4d20ae2879ce77c4__slideToRight;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas-header):only-child{animation-name:e56b4b1bb9ff1176__slideHeaderFromTop;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas-header):only-child{animation-name:e54b49876d2b7dc3__slideHeaderToTop;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas-sidebar):only-child{animation-name:f74156de1cf32837__slideSidebarFromRight;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas-sidebar):only-child{animation-name:_157f548b8629f8b5__slideSidebarToRight;will-change:transform}@keyframes _2e385023a338e4a9__zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes e245c2f64b6256de__zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes _9aa5832f67721dd4__slideFromRight{0%{transform:translateX(100vw)}to{transform:translateX(0)}}@keyframes _4d20ae2879ce77c4__slideToRight{0%{transform:translateX(0)}to{transform:translateX(100vw)}}@keyframes e56b4b1bb9ff1176__slideHeaderFromTop{0%{transform:translateY(-100%)}}@keyframes e54b49876d2b7dc3__slideHeaderToTop{to{transform:translateY(-100%)}}@keyframes f74156de1cf32837__slideSidebarFromRight{0%{transform:translateX(100%)}}@keyframes _157f548b8629f8b5__slideSidebarToRight{to{transform:translateX(100%)}}\");\n}\nexport default {\"layout\":\"_5c711a1cecefd5e8__layout\",\"has-full-canvas\":\"_52e00bad88ace7ce__has-full-canvas\",\"notices-snackbar\":\"eeebb116829e2f94__notices-snackbar\",\"components-snackbar\":\"cb865dcda5233b3b__components-snackbar\",\"sidebar-backdrop\":\"_04b3b4e8346a2b7b__sidebar-backdrop\",\"sidebar\":\"_615b052cf60fcff2__sidebar\",\"is-mobile\":\"_6be5d95ddf25e57f__is-mobile\",\"mobile-sidebar-drawer\":\"fd8d6491146392ce__mobile-sidebar-drawer\",\"layout-single-page\":\"f37b94fd2c1f6020__layout-single-page\",\"canvas\":\"_6da399dd0a232c1f__canvas\",\"has-mobile-drawer\":\"_5568e036ddaba310__has-mobile-drawer\",\"surfaces\":\"ff37ba01b23d0bcb__surfaces\",\"stage\":\"e323e272b8b8ed4f__stage\",\"inspector\":\"b37b199f2111c5f8__inspector\",\"has-canvas\":\"bbaf96f69377ab55__has-canvas\",\"zoomOut\":\"_2e385023a338e4a9__zoomOut\",\"zoomIn\":\"e245c2f64b6256de__zoomIn\",\"slideFromRight\":\"_9aa5832f67721dd4__slideFromRight\",\"slideToRight\":\"_4d20ae2879ce77c4__slideToRight\",\"slideHeaderFromTop\":\"e56b4b1bb9ff1176__slideHeaderFromTop\",\"slideHeaderToTop\":\"e54b49876d2b7dc3__slideHeaderToTop\",\"slideSidebarFromRight\":\"f74156de1cf32837__slideSidebarFromRight\",\"slideSidebarToRight\":\"_157f548b8629f8b5__slideSidebarToRight\"};\n","import type { ComponentType } from 'react';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { Page } from '@wordpress/admin-ui';\nimport {\n\tprivateApis as routePrivateApis,\n\ttype AnyRoute,\n} from '@wordpress/route';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport Root from '../root';\nimport styles from '../root/style.module.scss';\nimport ErrorBoundary from '../error-boundary';\nimport type { Route, RouteConfig, RouteLoaderContext } from '../../store/types';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tcreateLazyRoute,\n\tcreateRouter,\n\tcreateRootRoute,\n\tcreateRoute,\n\tRouterProvider,\n\tcreateBrowserHistory,\n\tparseHref,\n\tuseLoaderData,\n} = unlock( routePrivateApis );\n\n// Not found component\nfunction NotFoundComponent() {\n\treturn (\n\t\t<div className={ styles.stage }>\n\t\t\t<Page title={ __( 'Route not found' ) } hasPadding>\n\t\t\t\t{ __( \"The page you're looking for does not exist\" ) }\n\t\t\t</Page>\n\t\t</div>\n\t);\n}\n\n/**\n * Creates a TanStack route from a Route definition.\n *\n * @param route Route configuration\n * @param parentRoute Parent route.\n * @return Tanstack Route.\n */\nfunction createRouteFromDefinition( route: Route, parentRoute: AnyRoute ) {\n\t// Create route without component initially\n\tlet tanstackRoute = createRoute( {\n\t\tgetParentRoute: () => parentRoute,\n\t\tpath: route.path,\n\t\tbeforeLoad: async ( opts: any ) => {\n\t\t\t// Import route module here (lazy)\n\t\t\tif ( route.route_module ) {\n\t\t\t\tconst module = await import( route.route_module );\n\t\t\t\tconst routeConfig = module.route || {};\n\n\t\t\t\tif ( routeConfig.beforeLoad ) {\n\t\t\t\t\treturn routeConfig.beforeLoad( {\n\t\t\t\t\t\tparams: opts.params || {},\n\t\t\t\t\t\tsearch: opts.search || {},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tloader: async ( opts: any ) => {\n\t\t\t// Import route module here (lazy)\n\t\t\tlet routeConfig: RouteConfig = {};\n\t\t\tif ( route.route_module ) {\n\t\t\t\tconst module = await import( route.route_module );\n\t\t\t\trouteConfig = module.route || {};\n\t\t\t}\n\n\t\t\tconst context: RouteLoaderContext = {\n\t\t\t\tparams: opts.params || {},\n\t\t\t\tsearch: opts.deps || {},\n\t\t\t};\n\n\t\t\tconst [ , loaderData, canvasData, titleData ] = await Promise.all( [\n\t\t\t\tresolveSelect( coreStore ).getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase'\n\t\t\t\t),\n\t\t\t\trouteConfig.loader\n\t\t\t\t\t? routeConfig.loader( context )\n\t\t\t\t\t: Promise.resolve( undefined ),\n\t\t\t\trouteConfig.canvas\n\t\t\t\t\t? routeConfig.canvas( context )\n\t\t\t\t\t: Promise.resolve( undefined ),\n\t\t\t\trouteConfig.title\n\t\t\t\t\t? routeConfig.title( context )\n\t\t\t\t\t: Promise.resolve( undefined ),\n\t\t\t] );\n\n\t\t\tlet inspector = true;\n\t\t\tif ( routeConfig.inspector ) {\n\t\t\t\tinspector = await routeConfig.inspector( context );\n\t\t\t}\n\n\t\t\tlet stage = true;\n\t\t\tif ( routeConfig.stage ) {\n\t\t\t\tstage = await routeConfig.stage( context );\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...( loaderData as any ),\n\t\t\t\tcanvas: canvasData,\n\t\t\t\tinspector,\n\t\t\t\tstage,\n\t\t\t\ttitle: titleData,\n\t\t\t\trouteContentModule: route.content_module,\n\t\t\t};\n\t\t},\n\t\tloaderDeps: ( opts: any ) => opts.search,\n\t} );\n\n\t// Chain .lazy() to preload content module on intent\n\ttanstackRoute = tanstackRoute.lazy( async () => {\n\t\tconst module = route.content_module\n\t\t\t? await import( route.content_module )\n\t\t\t: {};\n\n\t\tconst Stage = module.stage;\n\t\tconst Inspector = module.inspector;\n\n\t\treturn createLazyRoute( route.path )( {\n\t\t\tcomponent: function RouteComponent() {\n\t\t\t\tconst { inspector: showInspector, stage: showStage } =\n\t\t\t\t\tuseLoaderData( { from: route.path } ) ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ Stage && showStage && (\n\t\t\t\t\t\t\t<div className={ styles.stage }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t<Stage />\n\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Inspector && showInspector && (\n\t\t\t\t\t\t\t<div className={ styles.inspector }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t<Inspector />\n\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\t} );\n\n\treturn tanstackRoute;\n}\n\n/**\n * Creates a route tree from route definitions.\n *\n * @param routes Routes definition.\n * @param rootComponent Root component to use for the router.\n * @return Router tree.\n */\nfunction createRouteTree(\n\troutes: Route[],\n\trootComponent: ComponentType = Root\n) {\n\tconst rootRoute = createRootRoute( {\n\t\tcomponent: rootComponent as any,\n\t\tcontext: () => ( {} ),\n\t} );\n\n\t// Create routes from definitions (now synchronous)\n\tconst dynamicRoutes = routes.map( ( route ) =>\n\t\tcreateRouteFromDefinition( route, rootRoute )\n\t);\n\n\treturn rootRoute.addChildren( dynamicRoutes );\n}\n\n// Create custom history that parses ?p= query parameter\nfunction createPathHistory() {\n\treturn createBrowserHistory( {\n\t\tparseLocation: () => {\n\t\t\tconst url = new URL( window.location.href );\n\t\t\tconst path = url.searchParams.get( 'p' ) || '/';\n\t\t\tconst pathHref = `${ path }${ url.hash }`;\n\t\t\treturn parseHref( pathHref, window.history.state );\n\t\t},\n\t\tcreateHref: ( href: string ) => {\n\t\t\tconst searchParams = new URLSearchParams( window.location.search );\n\t\t\tsearchParams.set( 'p', href );\n\t\t\treturn `${ window.location.pathname }?${ searchParams }`;\n\t\t},\n\t} );\n}\n\ninterface RouterProps {\n\troutes: Route[];\n\trootComponent?: ComponentType;\n}\n\nexport default function Router( {\n\troutes,\n\trootComponent = Root,\n}: RouterProps ) {\n\tconst router = useMemo( () => {\n\t\tconst history = createPathHistory();\n\t\tconst routeTree = createRouteTree( routes, rootComponent );\n\n\t\treturn createRouter( {\n\t\t\thistory,\n\t\t\trouteTree,\n\t\t\tdefaultPreload: 'intent',\n\t\t\tdefaultNotFoundComponent: NotFoundComponent,\n\t\t\tdefaultViewTransition: {\n\t\t\t\ttypes: ( {\n\t\t\t\t\tfromLocation,\n\t\t\t\t}: {\n\t\t\t\t\tfromLocation?: unknown;\n\t\t\t\t\ttoLocation: unknown;\n\t\t\t\t\tpathChanged: boolean;\n\t\t\t\t\threfChanged: boolean;\n\t\t\t\t\thashChanged: boolean;\n\t\t\t\t} ) => {\n\t\t\t\t\t// Disable view transition on initial navigation (no previous location)\n\t\t\t\t\tif ( ! fromLocation ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Enable with navigation type for subsequent navigations\n\t\t\t\t\treturn [ 'navigate' ];\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}, [ routes, rootComponent ] );\n\n\treturn <RouterProvider router={ router } />;\n}\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,aAAa;CACrB,MAAM,cAAc;CAEpB,IAAK,YAAY,kBAChB,OAAO,YAAY;CAGpB,YAAY,mBAAmB;EAC9B,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,gCAAgB,IAAI,QAAQ;CAC7B;CAEA,IAAK,OAAO,aAAa,aACxB,iBAAkB,QAAS;CAG5B,OAAO,YAAY;AACpB;;;;;;;;;AAUA,SAAS,0BACR,gBACA,MACU;CACV,IAAK,CAAE,eAAe,MACrB,OAAO;CAGR,KAAM,MAAM,SAAS,eAAe,KAAK,iBACxC,SAAU,qBAAsB,EACjC,GACC,IAAK,MAAM,aAAc,oBAAqB,MAAM,MACnD,OAAO;CAIT,OAAO;AACR;;;;;;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CAEF,OAAO;AACR;;;;;;;;AASA,SAAS,gBACR,QACA,gBAA+B,MAC9B;CACD,MAAM,YAAY,gBAAiB;EAClC,WAAW;EACX,gBAAiB,CAAC;CACnB,CAAE;CAGF,MAAM,gBAAgB,OAAO,KAAO,UACnC,0BAA2B,OAAO,SAAU,CAC7C;CAEA,OAAO,UAAU,YAAa,aAAc;AAC7C;AAGA,SAAS,oBAAoB;CAC5B,OAAO,qBAAsB;EAC5B,qBAAqB;GACpB,MAAM,MAAM,IAAI,IAAK,OAAO,SAAS,IAAK;GAE1C,MAAM,WAAW,GADJ,IAAI,aAAa,IAAK,GAAI,KAAK,MACd,IAAI;GAClC,OAAO,UAAW,UAAU,OAAO,QAAQ,KAAM;EAClD;EACA,aAAc,SAAkB;GAC/B,MAAM,eAAe,IAAI,gBAAiB,OAAO,SAAS,MAAO;GACjE,aAAa,IAAK,KAAK,IAAK;GAC5B,OAAO,GAAI,OAAO,SAAS,SAAU,GAAI;EAC1C;CACD,CAAE;AACH;AAOA,SAAwB,OAAQ,EAC/B,QACA,gBAAgB,QACA;CAChB,MAAM,SAAS,cAAe;EAC7B,MAAM,UAAU,kBAAkB;EAClC,MAAM,YAAY,gBAAiB,QAAQ,aAAc;EAEzD,OAAO,aAAc;GACpB;GACA;GACA,gBAAgB;GAChB,0BAA0B;GAC1B,uBAAuB,EACtB,QAAS,EACR,mBAOM;IAEN,IAAK,CAAE,cACN,OAAO;IAIR,OAAO,CAAE,UAAW;GACrB,EACD;EACD,CAAE;CACH,GAAG,CAAE,QAAQ,aAAc,CAAE;CAE7B,OAAO,oBAAC,gBAAD,EAAyB,OAAU,CAAA;AAC3C"}
@@ -1,50 +1,43 @@
1
- // packages/boot/src/components/app/use-route-title.ts
2
1
  import { useEffect, useRef } from "@wordpress/element";
3
2
  import { useSelect } from "@wordpress/data";
4
- import { store as coreStore } from "@wordpress/core-data";
3
+ import { store } from "@wordpress/core-data";
5
4
  import { __, sprintf } from "@wordpress/i18n";
6
5
  import { speak } from "@wordpress/a11y";
7
6
  import { decodeEntities } from "@wordpress/html-entities";
8
- import { privateApis as routePrivateApis } from "@wordpress/route";
7
+ import { privateApis } from "@wordpress/route";
9
8
  import { unlock } from "../../lock-unlock.mjs";
10
- var { useLocation, useMatches } = unlock(routePrivateApis);
9
+ // packages/boot/src/components/app/use-route-title.ts
10
+ const { useLocation, useMatches } = unlock(privateApis);
11
+ /**
12
+ * Hook that manages document title updates based on route changes.
13
+ * Formats titles with WordPress conventions and announces them to screen readers.
14
+ *
15
+ * This hook should be called from the Root component to ensure it runs on every route.
16
+ */
11
17
  function useRouteTitle() {
12
- const location = useLocation();
13
- const matches = useMatches();
14
- const currentMatch = matches[matches.length - 1];
15
- const routeTitle = currentMatch?.loaderData?.title;
16
- const siteTitle = useSelect(
17
- (select) => select(coreStore).getEntityRecord(
18
- "root",
19
- "__unstableBase"
20
- )?.name,
21
- []
22
- );
23
- const isInitialLocationRef = useRef(true);
24
- useEffect(() => {
25
- isInitialLocationRef.current = false;
26
- }, [location]);
27
- useEffect(() => {
28
- if (isInitialLocationRef.current) {
29
- return;
30
- }
31
- if (routeTitle && typeof routeTitle === "string" && siteTitle && typeof siteTitle === "string") {
32
- const decodedRouteTitle = decodeEntities(routeTitle);
33
- const decodedSiteTitle = decodeEntities(siteTitle);
34
- const formattedTitle = sprintf(
35
- /* translators: Admin document title. 1: Admin screen name, 2: Site name. */
36
- __("%1$s ‹ %2$s — WordPress"),
37
- decodedRouteTitle,
38
- decodedSiteTitle
39
- );
40
- document.title = formattedTitle;
41
- if (decodedRouteTitle) {
42
- speak(decodedRouteTitle, "assertive");
43
- }
44
- }
45
- }, [routeTitle, siteTitle, location]);
18
+ const location = useLocation();
19
+ const matches = useMatches();
20
+ const routeTitle = (matches[matches.length - 1]?.loaderData)?.title;
21
+ const siteTitle = useSelect((select) => select(store).getEntityRecord("root", "__unstableBase")?.name, []);
22
+ const isInitialLocationRef = useRef(true);
23
+ useEffect(() => {
24
+ isInitialLocationRef.current = false;
25
+ }, [location]);
26
+ useEffect(() => {
27
+ if (isInitialLocationRef.current) return;
28
+ if (routeTitle && typeof routeTitle === "string" && siteTitle && typeof siteTitle === "string") {
29
+ const decodedRouteTitle = decodeEntities(routeTitle);
30
+ const decodedSiteTitle = decodeEntities(siteTitle);
31
+ const formattedTitle = sprintf(__("%1$s ‹ %2$s — WordPress"), decodedRouteTitle, decodedSiteTitle);
32
+ document.title = formattedTitle;
33
+ if (decodedRouteTitle) speak(decodedRouteTitle, "assertive");
34
+ }
35
+ }, [
36
+ routeTitle,
37
+ siteTitle,
38
+ location
39
+ ]);
46
40
  }
47
- export {
48
- useRouteTitle as default
49
- };
50
- //# sourceMappingURL=use-route-title.mjs.map
41
+ export { useRouteTitle as default };
42
+
43
+ //# sourceMappingURL=use-route-title.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/app/use-route-title.ts"],
4
- "sourcesContent": ["import { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, type UnstableBase } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routePrivateApis } from '@wordpress/route';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useMatches } = unlock( routePrivateApis );\n\n/**\n * Hook that manages document title updates based on route changes.\n * Formats titles with WordPress conventions and announces them to screen readers.\n *\n * This hook should be called from the Root component to ensure it runs on every route.\n */\nexport default function useRouteTitle() {\n\tconst location = useLocation();\n\tconst matches = useMatches();\n\tconst currentMatch = matches[ matches.length - 1 ];\n\tconst routeTitle = ( currentMatch?.loaderData as any )?.title as\n\t\tstring | undefined;\n\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord< UnstableBase >(\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase'\n\t\t\t)?.name,\n\t\t[]\n\t);\n\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\trouteTitle &&\n\t\t\ttypeof routeTitle === 'string' &&\n\t\t\tsiteTitle &&\n\t\t\ttypeof siteTitle === 'string'\n\t\t) {\n\t\t\t// Decode entities for display\n\t\t\tconst decodedRouteTitle = decodeEntities( routeTitle );\n\t\t\tconst decodedSiteTitle = decodeEntities( siteTitle );\n\n\t\t\t// Format title following WordPress admin conventions\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin document title. 1: Admin screen name, 2: Site name. */\n\t\t\t\t__( '%1$s ‹ %2$s — WordPress' ),\n\t\t\t\tdecodedRouteTitle,\n\t\t\t\tdecodedSiteTitle\n\t\t\t);\n\n\t\t\tdocument.title = formattedTitle;\n\n\t\t\t// Announce title on route change for screen readers.\n\t\t\tif ( decodedRouteTitle ) {\n\t\t\t\tspeak( decodedRouteTitle, 'assertive' );\n\t\t\t}\n\t\t}\n\t}, [ routeTitle, siteTitle, location ] );\n}\n"],
5
- "mappings": ";AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAoC;AACtD,SAAS,IAAI,eAAe;AAC5B,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,SAAS,eAAe,wBAAwB;AAChD,SAAS,cAAc;AAEvB,IAAM,EAAE,aAAa,WAAW,IAAI,OAAQ,gBAAiB;AAQ9C,SAAR,gBAAiC;AACvC,QAAM,WAAW,YAAY;AAC7B,QAAM,UAAU,WAAW;AAC3B,QAAM,eAAe,QAAS,QAAQ,SAAS,CAAE;AACjD,QAAM,aAAe,cAAc,YAAqB;AAGxD,QAAM,YAAY;AAAA,IACjB,CAAE,WACD,OAAQ,SAAU,EAAE;AAAA,MACnB;AAAA,MACA;AAAA,IACD,GAAG;AAAA,IACJ,CAAC;AAAA,EACF;AAEA,QAAM,uBAAuB,OAAQ,IAAK;AAE1C,YAAW,MAAM;AAChB,yBAAqB,UAAU;AAAA,EAChC,GAAG,CAAE,QAAS,CAAE;AAEhB,YAAW,MAAM;AAEhB,QAAK,qBAAqB,SAAU;AACnC;AAAA,IACD;AAEA,QACC,cACA,OAAO,eAAe,YACtB,aACA,OAAO,cAAc,UACpB;AAED,YAAM,oBAAoB,eAAgB,UAAW;AACrD,YAAM,mBAAmB,eAAgB,SAAU;AAGnD,YAAM,iBAAiB;AAAA;AAAA,QAEtB,GAAI,yBAA0B;AAAA,QAC9B;AAAA,QACA;AAAA,MACD;AAEA,eAAS,QAAQ;AAGjB,UAAK,mBAAoB;AACxB,cAAO,mBAAmB,WAAY;AAAA,MACvC;AAAA,IACD;AAAA,EACD,GAAG,CAAE,YAAY,WAAW,QAAS,CAAE;AACxC;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"use-route-title.mjs","names":["routePrivateApis","coreStore"],"sources":["../../../src/components/app/use-route-title.ts"],"sourcesContent":["import { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, type UnstableBase } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routePrivateApis } from '@wordpress/route';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useMatches } = unlock( routePrivateApis );\n\n/**\n * Hook that manages document title updates based on route changes.\n * Formats titles with WordPress conventions and announces them to screen readers.\n *\n * This hook should be called from the Root component to ensure it runs on every route.\n */\nexport default function useRouteTitle() {\n\tconst location = useLocation();\n\tconst matches = useMatches();\n\tconst currentMatch = matches[ matches.length - 1 ];\n\tconst routeTitle = ( currentMatch?.loaderData as any )?.title as\n\t\tstring | undefined;\n\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord< UnstableBase >(\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase'\n\t\t\t)?.name,\n\t\t[]\n\t);\n\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\trouteTitle &&\n\t\t\ttypeof routeTitle === 'string' &&\n\t\t\tsiteTitle &&\n\t\t\ttypeof siteTitle === 'string'\n\t\t) {\n\t\t\t// Decode entities for display\n\t\t\tconst decodedRouteTitle = decodeEntities( routeTitle );\n\t\t\tconst decodedSiteTitle = decodeEntities( siteTitle );\n\n\t\t\t// Format title following WordPress admin conventions\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin document title. 1: Admin screen name, 2: Site name. */\n\t\t\t\t__( '%1$s ‹ %2$s — WordPress' ),\n\t\t\t\tdecodedRouteTitle,\n\t\t\t\tdecodedSiteTitle\n\t\t\t);\n\n\t\t\tdocument.title = formattedTitle;\n\n\t\t\t// Announce title on route change for screen readers.\n\t\t\tif ( decodedRouteTitle ) {\n\t\t\t\tspeak( decodedRouteTitle, 'assertive' );\n\t\t\t}\n\t\t}\n\t}, [ routeTitle, siteTitle, location ] );\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,EAAE,aAAa,eAAe,OAAQA,WAAiB;;;;;;;AAQ7D,SAAwB,gBAAgB;CACvC,MAAM,WAAW,YAAY;CAC7B,MAAM,UAAU,WAAW;CAE3B,MAAM,cADe,QAAS,QAAQ,SAAS,EACd,EAAE,WAAA,EAAqB;CAGxD,MAAM,YAAY,WACf,WACD,OAAQC,KAAU,CAAC,CAAC,gBACnB,QACA,gBACD,CAAC,EAAE,MACJ,CAAC,CACF;CAEA,MAAM,uBAAuB,OAAQ,IAAK;CAE1C,gBAAiB;EAChB,qBAAqB,UAAU;CAChC,GAAG,CAAE,QAAS,CAAE;CAEhB,gBAAiB;EAEhB,IAAK,qBAAqB,SACzB;EAGD,IACC,cACA,OAAO,eAAe,YACtB,aACA,OAAO,cAAc,UACpB;GAED,MAAM,oBAAoB,eAAgB,UAAW;GACrD,MAAM,mBAAmB,eAAgB,SAAU;GAGnD,MAAM,iBAAiB,QAEtB,GAAI,yBAA0B,GAC9B,mBACA,gBACD;GAEA,SAAS,QAAQ;GAGjB,IAAK,mBACJ,MAAO,mBAAmB,WAAY;EAExC;CACD,GAAG;EAAE;EAAY;EAAW;CAAS,CAAE;AACxC"}
@@ -1,26 +1,27 @@
1
- // packages/boot/src/components/canvas/back-button.tsx
2
1
  import { Button } from "@wordpress/components";
3
2
  import { chevronLeft, chevronRight } from "@wordpress/icons";
4
3
  import { __, isRTL } from "@wordpress/i18n";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ // packages/boot/src/components/canvas/back-button.tsx
6
+ /**
7
+ * Back button component that appears in full-screen canvas mode.
8
+ *
9
+ * @param {Object} props Component props
10
+ * @param {number} props.length Number of BackButton fills (from Slot)
11
+ * @return Back button
12
+ */
6
13
  function BootBackButton({ length }) {
7
- const handleBack = () => {
8
- window.history.back();
9
- };
10
- if (length > 1) {
11
- return null;
12
- }
13
- return /* @__PURE__ */ jsx(
14
- Button,
15
- {
16
- size: "compact",
17
- onClick: handleBack,
18
- label: __("Back"),
19
- icon: isRTL() ? chevronRight : chevronLeft
20
- }
21
- );
14
+ const handleBack = () => {
15
+ window.history.back();
16
+ };
17
+ if (length > 1) return null;
18
+ return /* @__PURE__ */ jsx(Button, {
19
+ size: "compact",
20
+ onClick: handleBack,
21
+ label: __("Back"),
22
+ icon: isRTL() ? chevronRight : chevronLeft
23
+ });
22
24
  }
23
- export {
24
- BootBackButton as default
25
- };
26
- //# sourceMappingURL=back-button.mjs.map
25
+ export { BootBackButton as default };
26
+
27
+ //# sourceMappingURL=back-button.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/canvas/back-button.tsx"],
4
- "sourcesContent": ["import { Button } from '@wordpress/components';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { __, isRTL } from '@wordpress/i18n';\n\n/**\n * Back button component that appears in full-screen canvas mode.\n *\n * @param {Object} props Component props\n * @param {number} props.length Number of BackButton fills (from Slot)\n * @return Back button\n */\nexport default function BootBackButton( { length }: { length: number } ) {\n\tconst handleBack = () => {\n\t\twindow.history.back();\n\t};\n\n\t// Only render if this is the only back button\n\tif ( length > 1 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ handleBack }\n\t\t\tlabel={ __( 'Back' ) }\n\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t/>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,IAAI,aAAa;AAoBxB;AAXa,SAAR,eAAiC,EAAE,OAAO,GAAwB;AACxE,QAAM,aAAa,MAAM;AACxB,WAAO,QAAQ,KAAK;AAAA,EACrB;AAGA,MAAK,SAAS,GAAI;AACjB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,SAAU;AAAA,MACV,OAAQ,GAAI,MAAO;AAAA,MACnB,MAAO,MAAM,IAAI,eAAe;AAAA;AAAA,EACjC;AAEF;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"back-button.mjs","names":[],"sources":["../../../src/components/canvas/back-button.tsx"],"sourcesContent":["import { Button } from '@wordpress/components';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { __, isRTL } from '@wordpress/i18n';\n\n/**\n * Back button component that appears in full-screen canvas mode.\n *\n * @param {Object} props Component props\n * @param {number} props.length Number of BackButton fills (from Slot)\n * @return Back button\n */\nexport default function BootBackButton( { length }: { length: number } ) {\n\tconst handleBack = () => {\n\t\twindow.history.back();\n\t};\n\n\t// Only render if this is the only back button\n\tif ( length > 1 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ handleBack }\n\t\t\tlabel={ __( 'Back' ) }\n\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAwB,eAAgB,EAAE,UAA+B;CACxE,MAAM,mBAAmB;EACxB,OAAO,QAAQ,KAAK;CACrB;CAGA,IAAK,SAAS,GACb,OAAO;CAGR,OACC,oBAAC,QAAD;EACC,MAAK;EACL,SAAU;EACV,OAAQ,GAAI,MAAO;EACnB,MAAO,MAAM,IAAI,eAAe;CAChC,CAAA;AAEH"}
@@ -1,140 +1,114 @@
1
- // packages/boot/src/components/canvas/index.tsx
2
- import { useState, useEffect, useMemo } from "@wordpress/element";
3
- import { Spinner as WCSpinner } from "@wordpress/components";
1
+ import { useEffect, useMemo, useState } from "@wordpress/element";
2
+ import { Spinner } from "@wordpress/components";
4
3
  import { useNavigate, useSearch } from "@wordpress/route";
5
4
  import { __ } from "@wordpress/i18n";
6
5
  import { inertValue } from "@wordpress/react-inert-value";
7
6
  import { useSelect } from "@wordpress/data";
8
- import { store as coreStore } from "@wordpress/core-data";
9
- import { store as bootStore } from "../../store/index.mjs";
7
+ import { store } from "@wordpress/core-data";
8
+ import { store as store$1 } from "../../store/index.mjs";
10
9
  import BootBackButton from "./back-button.mjs";
11
10
  import SitePreview from "./site-preview.mjs";
12
- import useNavigateToEntityRecord, {
13
- useActionPerformed
14
- } from "./use-navigate-to-entity-record.mjs";
11
+ import useNavigateToEntityRecord, { useActionPerformed } from "./use-navigate-to-entity-record.mjs";
15
12
  import { getDeviceType } from "./viewport.mjs";
16
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
+ // packages/boot/src/components/canvas/index.tsx
15
+ /**
16
+ * Canvas component that dynamically loads and renders the lazy editor.
17
+ *
18
+ * @param {Object} props - Component props
19
+ * @param {Object} props.canvas - Canvas data containing postType and postId
20
+ * @return Canvas surface with editor
21
+ */
17
22
  function Canvas({ canvas }) {
18
- const [Editor, setEditor] = useState(null);
19
- const navigate = useNavigate();
20
- const { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord } = useNavigateToEntityRecord();
21
- const onActionPerformed = useActionPerformed(canvas.postType);
22
- const viewport = useSearch({
23
- strict: false,
24
- select: (search) => search.viewport
25
- });
26
- const hasEntity = !!(canvas.postType && canvas.postId);
27
- const isBlockTheme = useSelect(
28
- (select) => select(coreStore).getCurrentTheme()?.is_block_theme,
29
- []
30
- );
31
- const { editLink, isTrashed } = useSelect(
32
- (select) => {
33
- if (!canvas.postType || !canvas.postId) {
34
- return { editLink: void 0, isTrashed: false };
35
- }
36
- const record = select(coreStore).getEntityRecord(
37
- "postType",
38
- canvas.postType,
39
- canvas.postId
40
- );
41
- return {
42
- editLink: select(bootStore).getEntityLink(
43
- canvas.postType,
44
- canvas.postId
45
- ),
46
- isTrashed: record?.status === "trash"
47
- };
48
- },
49
- [canvas.postType, canvas.postId]
50
- );
51
- const settings = useMemo(
52
- () => ({
53
- isPreviewMode: canvas.isPreview,
54
- styles: canvas.isPreview ? [{ css: "body{min-height:100vh;}" }] : [],
55
- onNavigateToEntityRecord,
56
- onNavigateToPreviousEntityRecord
57
- }),
58
- [
59
- canvas.isPreview,
60
- onNavigateToEntityRecord,
61
- onNavigateToPreviousEntityRecord
62
- ]
63
- );
64
- useEffect(() => {
65
- import("@wordpress/lazy-editor").then((module) => {
66
- setEditor(() => module.Editor);
67
- }).catch((error) => {
68
- console.error("Failed to load lazy editor:", error);
69
- });
70
- }, []);
71
- if (!hasEntity && isBlockTheme === false) {
72
- return /* @__PURE__ */ jsx(SitePreview, {});
73
- }
74
- if (!Editor || !hasEntity && isBlockTheme === void 0) {
75
- return /* @__PURE__ */ jsx(
76
- "div",
77
- {
78
- style: {
79
- display: "flex",
80
- justifyContent: "center",
81
- alignItems: "center",
82
- height: "100%",
83
- padding: "2rem"
84
- },
85
- children: /* @__PURE__ */ jsx(WCSpinner, {})
86
- }
87
- );
88
- }
89
- const backButton = !canvas.isPreview ? ({ length }) => /* @__PURE__ */ jsx(BootBackButton, { length }) : void 0;
90
- return /* @__PURE__ */ jsxs("div", { style: { height: "100%", position: "relative" }, children: [
91
- /* @__PURE__ */ jsx(
92
- "div",
93
- {
94
- style: { height: "100%" },
95
- inert: inertValue(canvas.isPreview),
96
- children: /* @__PURE__ */ jsx(
97
- Editor,
98
- {
99
- postType: canvas.postType,
100
- postId: canvas.postId,
101
- renderingMode: canvas.renderingMode,
102
- settings,
103
- backButton,
104
- onActionPerformed,
105
- initialViewport: getDeviceType(viewport)
106
- }
107
- )
108
- }
109
- ),
110
- canvas.isPreview && editLink && /* @__PURE__ */ jsx(
111
- "div",
112
- {
113
- onClick: isTrashed ? void 0 : () => navigate({ to: editLink }),
114
- onKeyDown: (e) => {
115
- if (isTrashed) {
116
- return;
117
- }
118
- if (e.key === "Enter" || e.key === " ") {
119
- e.preventDefault();
120
- navigate({ to: editLink });
121
- }
122
- },
123
- style: {
124
- position: "absolute",
125
- inset: 0,
126
- cursor: isTrashed ? "default" : "pointer",
127
- zIndex: 1
128
- },
129
- role: "button",
130
- tabIndex: 0,
131
- "aria-disabled": isTrashed,
132
- "aria-label": __("Edit")
133
- }
134
- )
135
- ] });
23
+ const [Editor, setEditor] = useState(null);
24
+ const navigate = useNavigate();
25
+ const { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord } = useNavigateToEntityRecord();
26
+ const onActionPerformed = useActionPerformed(canvas.postType);
27
+ const viewport = useSearch({
28
+ strict: false,
29
+ select: (search) => search.viewport
30
+ });
31
+ const hasEntity = !!(canvas.postType && canvas.postId);
32
+ const isBlockTheme = useSelect((select) => select(store).getCurrentTheme()?.is_block_theme, []);
33
+ const { editLink, isTrashed } = useSelect((select) => {
34
+ if (!canvas.postType || !canvas.postId) return {
35
+ editLink: void 0,
36
+ isTrashed: false
37
+ };
38
+ const record = select(store).getEntityRecord("postType", canvas.postType, canvas.postId);
39
+ return {
40
+ editLink: select(store$1).getEntityLink(canvas.postType, canvas.postId),
41
+ isTrashed: record?.status === "trash"
42
+ };
43
+ }, [canvas.postType, canvas.postId]);
44
+ const settings = useMemo(() => ({
45
+ isPreviewMode: canvas.isPreview,
46
+ styles: canvas.isPreview ? [{ css: "body{min-height:100vh;}" }] : [],
47
+ onNavigateToEntityRecord,
48
+ onNavigateToPreviousEntityRecord
49
+ }), [
50
+ canvas.isPreview,
51
+ onNavigateToEntityRecord,
52
+ onNavigateToPreviousEntityRecord
53
+ ]);
54
+ useEffect(() => {
55
+ import("@wordpress/lazy-editor").then((module) => {
56
+ setEditor(() => module.Editor);
57
+ }).catch((error) => {
58
+ console.error("Failed to load lazy editor:", error);
59
+ });
60
+ }, []);
61
+ if (!hasEntity && isBlockTheme === false) return /* @__PURE__ */ jsx(SitePreview, {});
62
+ if (!Editor || !hasEntity && isBlockTheme === void 0) return /* @__PURE__ */ jsx("div", {
63
+ style: {
64
+ display: "flex",
65
+ justifyContent: "center",
66
+ alignItems: "center",
67
+ height: "100%",
68
+ padding: "2rem"
69
+ },
70
+ children: /* @__PURE__ */ jsx(Spinner, {})
71
+ });
72
+ const backButton = !canvas.isPreview ? ({ length }) => /* @__PURE__ */ jsx(BootBackButton, { length }) : void 0;
73
+ return /* @__PURE__ */ jsxs("div", {
74
+ style: {
75
+ height: "100%",
76
+ position: "relative"
77
+ },
78
+ children: [/* @__PURE__ */ jsx("div", {
79
+ style: { height: "100%" },
80
+ inert: inertValue(canvas.isPreview),
81
+ children: /* @__PURE__ */ jsx(Editor, {
82
+ postType: canvas.postType,
83
+ postId: canvas.postId,
84
+ renderingMode: canvas.renderingMode,
85
+ settings,
86
+ backButton,
87
+ onActionPerformed,
88
+ initialViewport: getDeviceType(viewport)
89
+ })
90
+ }), canvas.isPreview && editLink && /* @__PURE__ */ jsx("div", {
91
+ onClick: isTrashed ? void 0 : () => navigate({ to: editLink }),
92
+ onKeyDown: (e) => {
93
+ if (isTrashed) return;
94
+ if (e.key === "Enter" || e.key === " ") {
95
+ e.preventDefault();
96
+ navigate({ to: editLink });
97
+ }
98
+ },
99
+ style: {
100
+ position: "absolute",
101
+ inset: 0,
102
+ cursor: isTrashed ? "default" : "pointer",
103
+ zIndex: 1
104
+ },
105
+ role: "button",
106
+ tabIndex: 0,
107
+ "aria-disabled": isTrashed,
108
+ "aria-label": __("Edit")
109
+ })]
110
+ });
136
111
  }
137
- export {
138
- Canvas as default
139
- };
140
- //# sourceMappingURL=index.mjs.map
112
+ export { Canvas as default };
113
+
114
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/canvas/index.tsx"],
4
- "sourcesContent": ["import { useState, useEffect, useMemo } from '@wordpress/element';\nimport { Spinner as WCSpinner } from '@wordpress/components';\nimport { useNavigate, useSearch } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as bootStore } from '../../store';\nimport type { CanvasData } from '../../store/types';\nimport BootBackButton from './back-button';\nimport SitePreview from './site-preview';\nimport useNavigateToEntityRecord, {\n\tuseActionPerformed,\n} from './use-navigate-to-entity-record';\nimport { getDeviceType } from './viewport';\n\ninterface CanvasProps {\n\tcanvas: CanvasData;\n}\n\n/**\n * Canvas component that dynamically loads and renders the lazy editor.\n *\n * @param {Object} props - Component props\n * @param {Object} props.canvas - Canvas data containing postType and postId\n * @return Canvas surface with editor\n */\nexport default function Canvas( { canvas }: CanvasProps ) {\n\tconst [ Editor, setEditor ] = useState< any >( null );\n\tconst navigate = useNavigate();\n\tconst { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord } =\n\t\tuseNavigateToEntityRecord();\n\tconst onActionPerformed = useActionPerformed( canvas.postType );\n\n\t/*\n\t * An entity can be asked to be edited at a particular width — a navigation\n\t * overlay meant for mobile — and carries the width it was left at when\n\t * returned to. Anything else opens at the default.\n\t */\n\tconst viewport = useSearch( {\n\t\tstrict: false,\n\t\tselect: ( search ) => ( search as { viewport?: string } ).viewport,\n\t} ) as string | undefined;\n\n\t/*\n\t * Where clicking a previewed canvas goes, resolved the same way the editor\n\t * resolves anywhere else it sends you to edit an entity, and whether it\n\t * should go anywhere at all: a trashed entity has to be restored before it\n\t * can be edited.\n\t *\n\t * The record is the one the editor loads for this canvas, so reading it\n\t * here costs no request of its own.\n\t */\n\t/*\n\t * A route that names no entity leaves the editor to resolve one, which it\n\t * does from the block templates only a block theme has. `undefined` while\n\t * the theme is still being read.\n\t */\n\tconst hasEntity = !! ( canvas.postType && canvas.postId );\n\tconst isBlockTheme = useSelect(\n\t\t( select ) =>\n\t\t\t(\n\t\t\t\tselect( coreStore ).getCurrentTheme() as\n\t\t\t\t\t{ is_block_theme?: boolean } | undefined\n\t\t\t )?.is_block_theme,\n\t\t[]\n\t);\n\n\tconst { editLink, isTrashed } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! canvas.postType || ! canvas.postId ) {\n\t\t\t\treturn { editLink: undefined, isTrashed: false };\n\t\t\t}\n\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcanvas.postType,\n\t\t\t\tcanvas.postId\n\t\t\t) as { status?: string } | undefined;\n\n\t\t\treturn {\n\t\t\t\teditLink: select( bootStore ).getEntityLink(\n\t\t\t\t\tcanvas.postType,\n\t\t\t\t\tcanvas.postId\n\t\t\t\t),\n\t\t\t\tisTrashed: record?.status === 'trash',\n\t\t\t};\n\t\t},\n\t\t[ canvas.postType, canvas.postId ]\n\t);\n\n\t/*\n\t * Memoized because the editor provider pushes these settings into the store\n\t * whenever their identity changes, and the callbacks have to stay stable for\n\t * the block inspector to keep offering the same affordance.\n\t */\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tisPreviewMode: canvas.isPreview,\n\t\t\tstyles: canvas.isPreview\n\t\t\t\t? [ { css: 'body{min-height:100vh;}' } ]\n\t\t\t\t: [],\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t} ),\n\t\t[\n\t\t\tcanvas.isPreview,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseEffect( () => {\n\t\t// Dynamically import the lazy-editor module\n\t\timport( '@wordpress/lazy-editor' )\n\t\t\t.then( ( module ) => {\n\t\t\t\tsetEditor( () => module.Editor );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error( 'Failed to load lazy editor:', error );\n\t\t\t} );\n\t}, [] );\n\n\t// Nothing for the editor to open, so show the site the route configures.\n\tif ( ! hasEntity && isBlockTheme === false ) {\n\t\treturn <SitePreview />;\n\t}\n\n\t// Show spinner while loading the editor module, and until it is known which\n\t// of the two this canvas is, so the wrong one is never shown first.\n\tif ( ! Editor || ( ! hasEntity && isBlockTheme === undefined ) ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tpadding: '2rem',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WCSpinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Render back button in full-screen mode (when not preview)\n\t// Uses render prop pattern to receive fillProps from Slot\n\tconst backButton = ! canvas.isPreview\n\t\t? ( { length }: { length: number } ) => (\n\t\t\t\t<BootBackButton length={ length } />\n\t\t\t)\n\t\t: undefined;\n\n\t// Render the editor with canvas data\n\treturn (\n\t\t<div style={ { height: '100%', position: 'relative' } }>\n\t\t\t<div\n\t\t\t\tstyle={ { height: '100%' } }\n\t\t\t\tinert={ inertValue( canvas.isPreview ) }\n\t\t\t>\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ canvas.postType }\n\t\t\t\t\tpostId={ canvas.postId }\n\t\t\t\t\trenderingMode={ canvas.renderingMode }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tbackButton={ backButton }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\tinitialViewport={ getDeviceType( viewport ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ canvas.isPreview && editLink && (\n\t\t\t\t<div\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisTrashed\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: () => navigate( { to: editLink } )\n\t\t\t\t\t}\n\t\t\t\t\tonKeyDown={ ( e ) => {\n\t\t\t\t\t\tif ( isTrashed ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( e.key === 'Enter' || e.key === ' ' ) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tnavigate( { to: editLink } );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tcursor: isTrashed ? 'default' : 'pointer',\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\taria-disabled={ isTrashed }\n\t\t\t\t\taria-label={ __( 'Edit' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,UAAU,WAAW,eAAe;AAC7C,SAAS,WAAW,iBAAiB;AACrC,SAAS,aAAa,iBAAiB;AACvC,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACn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AK,WAAY;AAChB;AAAA,UACD;AACA,cAAK,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAM;AACzC,cAAE,eAAe;AACjB,qBAAU,EAAE,IAAI,SAAS,CAAE;AAAA,UAC5B;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,UACP,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ,YAAY,YAAY;AAAA,UAChC,QAAQ;AAAA,QACT;AAAA,QACA,MAAK;AAAA,QACL,UAAW;AAAA,QACX,iBAAgB;AAAA,QAChB,cAAa,GAAI,MAAO;AAAA;AAAA,IACzB;AAAA,KAEF;AAEF;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.mjs","names":["coreStore","bootStore","WCSpinner"],"sources":["../../../src/components/canvas/index.tsx"],"sourcesContent":["import { useState, useEffect, useMemo } from '@wordpress/element';\nimport { Spinner as WCSpinner } from '@wordpress/components';\nimport { useNavigate, useSearch } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as bootStore } from '../../store';\nimport type { CanvasData } from '../../store/types';\nimport BootBackButton from './back-button';\nimport SitePreview from './site-preview';\nimport useNavigateToEntityRecord, {\n\tuseActionPerformed,\n} from './use-navigate-to-entity-record';\nimport { getDeviceType } from './viewport';\n\ninterface CanvasProps {\n\tcanvas: CanvasData;\n}\n\n/**\n * Canvas component that dynamically loads and renders the lazy editor.\n *\n * @param {Object} props - Component props\n * @param {Object} props.canvas - Canvas data containing postType and postId\n * @return Canvas surface with editor\n */\nexport default function Canvas( { canvas }: CanvasProps ) {\n\tconst [ Editor, setEditor ] = useState< any >( null );\n\tconst navigate = useNavigate();\n\tconst { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord } =\n\t\tuseNavigateToEntityRecord();\n\tconst onActionPerformed = useActionPerformed( canvas.postType );\n\n\t/*\n\t * An entity can be asked to be edited at a particular width — a navigation\n\t * overlay meant for mobile — and carries the width it was left at when\n\t * returned to. Anything else opens at the default.\n\t */\n\tconst viewport = useSearch( {\n\t\tstrict: false,\n\t\tselect: ( search ) => ( search as { viewport?: string } ).viewport,\n\t} ) as string | undefined;\n\n\t/*\n\t * Where clicking a previewed canvas goes, resolved the same way the editor\n\t * resolves anywhere else it sends you to edit an entity, and whether it\n\t * should go anywhere at all: a trashed entity has to be restored before it\n\t * can be edited.\n\t *\n\t * The record is the one the editor loads for this canvas, so reading it\n\t * here costs no request of its own.\n\t */\n\t/*\n\t * A route that names no entity leaves the editor to resolve one, which it\n\t * does from the block templates only a block theme has. `undefined` while\n\t * the theme is still being read.\n\t */\n\tconst hasEntity = !! ( canvas.postType && canvas.postId );\n\tconst isBlockTheme = useSelect(\n\t\t( select ) =>\n\t\t\t(\n\t\t\t\tselect( coreStore ).getCurrentTheme() as\n\t\t\t\t\t{ is_block_theme?: boolean } | undefined\n\t\t\t )?.is_block_theme,\n\t\t[]\n\t);\n\n\tconst { editLink, isTrashed } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! canvas.postType || ! canvas.postId ) {\n\t\t\t\treturn { editLink: undefined, isTrashed: false };\n\t\t\t}\n\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcanvas.postType,\n\t\t\t\tcanvas.postId\n\t\t\t) as { status?: string } | undefined;\n\n\t\t\treturn {\n\t\t\t\teditLink: select( bootStore ).getEntityLink(\n\t\t\t\t\tcanvas.postType,\n\t\t\t\t\tcanvas.postId\n\t\t\t\t),\n\t\t\t\tisTrashed: record?.status === 'trash',\n\t\t\t};\n\t\t},\n\t\t[ canvas.postType, canvas.postId ]\n\t);\n\n\t/*\n\t * Memoized because the editor provider pushes these settings into the store\n\t * whenever their identity changes, and the callbacks have to stay stable for\n\t * the block inspector to keep offering the same affordance.\n\t */\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tisPreviewMode: canvas.isPreview,\n\t\t\tstyles: canvas.isPreview\n\t\t\t\t? [ { css: 'body{min-height:100vh;}' } ]\n\t\t\t\t: [],\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t} ),\n\t\t[\n\t\t\tcanvas.isPreview,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseEffect( () => {\n\t\t// Dynamically import the lazy-editor module\n\t\timport( '@wordpress/lazy-editor' )\n\t\t\t.then( ( module ) => {\n\t\t\t\tsetEditor( () => module.Editor );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error( 'Failed to load lazy editor:', error );\n\t\t\t} );\n\t}, [] );\n\n\t// Nothing for the editor to open, so show the site the route configures.\n\tif ( ! hasEntity && isBlockTheme === false ) {\n\t\treturn <SitePreview />;\n\t}\n\n\t// Show spinner while loading the editor module, and until it is known which\n\t// of the two this canvas is, so the wrong one is never shown first.\n\tif ( ! Editor || ( ! hasEntity && isBlockTheme === undefined ) ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tpadding: '2rem',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WCSpinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Render back button in full-screen mode (when not preview)\n\t// Uses render prop pattern to receive fillProps from Slot\n\tconst backButton = ! canvas.isPreview\n\t\t? ( { length }: { length: number } ) => (\n\t\t\t\t<BootBackButton length={ length } />\n\t\t\t)\n\t\t: undefined;\n\n\t// Render the editor with canvas data\n\treturn (\n\t\t<div style={ { height: '100%', position: 'relative' } }>\n\t\t\t<div\n\t\t\t\tstyle={ { height: '100%' } }\n\t\t\t\tinert={ inertValue( canvas.isPreview ) }\n\t\t\t>\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ canvas.postType }\n\t\t\t\t\tpostId={ canvas.postId }\n\t\t\t\t\trenderingMode={ canvas.renderingMode }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tbackButton={ backButton }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\tinitialViewport={ getDeviceType( viewport ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ canvas.isPreview && editLink && (\n\t\t\t\t<div\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisTrashed\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: () => navigate( { to: editLink } )\n\t\t\t\t\t}\n\t\t\t\t\tonKeyDown={ ( e ) => {\n\t\t\t\t\t\tif ( isTrashed ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( e.key === 'Enter' || e.key === ' ' ) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tnavigate( { to: editLink } );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tcursor: isTrashed ? 'default' : 'pointer',\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\taria-disabled={ isTrashed }\n\t\t\t\t\taria-label={ __( 'Edit' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,SAAwB,OAAQ,EAAE,UAAwB;CACzD,MAAM,CAAE,QAAQ,aAAc,SAAiB,IAAK;CACpD,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,0BAA0B,qCACjC,0BAA0B;CAC3B,MAAM,oBAAoB,mBAAoB,OAAO,QAAS;CAO9D,MAA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