diff --git a/packages/craftcms-graphiql/src/graphiql-init.js b/packages/craftcms-graphiql/src/graphiql-init.js index 99899dc75f5..af03891d0a9 100644 --- a/packages/craftcms-graphiql/src/graphiql-init.js +++ b/packages/craftcms-graphiql/src/graphiql-init.js @@ -30,6 +30,10 @@ const CraftGraphiQL = ({endpoint, selectedSchema}) => { return React.createElement(GraphiQL, { fetcher: graphQLFetcher, + // The CP's own styling for GraphiQL is light-only, and GraphiQL otherwise + // follows the system preference. Forcing it also drops the theme picker + // from its settings dialog. + forcedTheme: 'light', }); }; diff --git a/packages/craftcms-ui/scripts/generate-color-palette.js b/packages/craftcms-ui/scripts/generate-color-palette.js index bc4d280e3bc..96302675660 100644 --- a/packages/craftcms-ui/scripts/generate-color-palette.js +++ b/packages/craftcms-ui/scripts/generate-color-palette.js @@ -45,7 +45,10 @@ function printStyles() { ); lines.push(comment()); - lines.push('\n:root,\n:host {'); + // `[data-theme='light']` alongside the root, so a light subtree inside a dark + // one re-declares the palette. Without it only dark themes a subtree, and a + // light marker keeps inheriting whatever it sits in. + lines.push("\n:root,\n:host,\n[data-theme='light'] {"); lines.push(lightColors); lines.push(` /* Static colors */\n`); lines.push(staticColors); diff --git a/packages/craftcms-ui/src/styles/shared/color-palette.css b/packages/craftcms-ui/src/styles/shared/color-palette.css index 00f6a78f08c..54dafa4da2a 100644 --- a/packages/craftcms-ui/src/styles/shared/color-palette.css +++ b/packages/craftcms-ui/src/styles/shared/color-palette.css @@ -1,7 +1,8 @@ /* Auto-generated by scripts/generate-color-palette.js — do not edit manually */ :root, -:host { +:host, +[data-theme='light'] { --color-gray-50: #eaecef; --color-gray-100: #d4d7dd; --color-gray-200: #c2c6ce; diff --git a/resources/js/common/components/CpSidebar.vue b/resources/js/common/components/CpSidebar.vue index b67b7603760..f827d02fcbd 100644 --- a/resources/js/common/components/CpSidebar.vue +++ b/resources/js/common/components/CpSidebar.vue @@ -110,6 +110,7 @@ .cp-sidebar[data-mode='docked'] { height: calc(100dvh - var(--cp-debug-bar-height, 0px)); + max-height: 100%; transform: none; position: sticky; inset-block-start: 0; diff --git a/resources/js/common/layouts/screens/PageScreen.vue b/resources/js/common/layouts/screens/PageScreen.vue index ffa7f091d9e..6f430273c8c 100644 --- a/resources/js/common/layouts/screens/PageScreen.vue +++ b/resources/js/common/layouts/screens/PageScreen.vue @@ -62,6 +62,7 @@ defaultFormActions: () => ['saveAndContinueEditing'], formAdditionalButtons: () => [], contentMaxWidth: false, + fillViewport: false, }); const slots = defineSlots(); @@ -199,7 +200,9 @@ :has-sidebar="hasSidebar" :additional-skip-links="additionalSkipLinks" /> -
+
@@ -421,6 +424,28 @@ Main App shell height: 100%; } + .page-screen { + background-color: var(--c-surface-header); + } + + /* The top bar keeps its height and the shell takes the rest. */ + .page-screen--fill-viewport { + display: flex; + flex-direction: column; + height: calc(100dvh - var(--cp-debug-bar-height, 0px)); + + .cp { + display: flex; + flex: 1; + min-height: 0; + } + + .cp__main { + flex: 1; + min-width: 0; + } + } + /** Page */ diff --git a/resources/js/common/layouts/screens/types.ts b/resources/js/common/layouts/screens/types.ts index ded5e95d06a..ce3099416bb 100644 --- a/resources/js/common/layouts/screens/types.ts +++ b/resources/js/common/layouts/screens/types.ts @@ -41,6 +41,12 @@ export interface ScreenProps { * slideout is narrow already. */ contentMaxWidth?: boolean | string; + /** + * Fits the shell to the viewport instead of letting the document scroll, + * so `page-main` gets a definite height to fill (e.g. a full-bleed editor). + * Full pages only; a slideout is bounded already. + */ + fillViewport?: boolean; } export interface ScreenEmits { diff --git a/resources/js/pages/graphql/Explore.vue b/resources/js/pages/graphql/Explore.vue index 2aa0d45a1d0..61924e0df24 100644 --- a/resources/js/pages/graphql/Explore.vue +++ b/resources/js/pages/graphql/Explore.vue @@ -40,9 +40,9 @@