Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/craftcms-graphiql/src/graphiql-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
};

Expand Down
5 changes: 4 additions & 1 deletion packages/craftcms-ui/scripts/generate-color-palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion packages/craftcms-ui/src/styles/shared/color-palette.css
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 1 addition & 0 deletions resources/js/common/components/CpSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 26 additions & 1 deletion resources/js/common/layouts/screens/PageScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
defaultFormActions: () => ['saveAndContinueEditing'],
formAdditionalButtons: () => [],
contentMaxWidth: false,
fillViewport: false,
});

const slots = defineSlots<ScreenSlots>();
Expand Down Expand Up @@ -199,7 +200,9 @@
:has-sidebar="hasSidebar"
:additional-skip-links="additionalSkipLinks"
/>
<div class="bg-header">
<div
:class="{'page-screen': true, 'page-screen--fill-viewport': fillViewport}"
>
<CpTopBar :crumbs="crumbs" :has-context-menu="hasContextMenu" />
<div class="cp">
<div class="cp__sidebar">
Expand Down Expand Up @@ -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
*/
Expand Down
6 changes: 6 additions & 0 deletions resources/js/common/layouts/screens/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions resources/js/pages/graphql/Explore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
</script>

<template>
<AppLayout>
<AppLayout fill-viewport>
<template #page-main>
<main id="main" tabindex="-1" class="cp-graphiql">
<main id="main" tabindex="-1" class="cp-graphiql" data-theme="light">
<div class="cp-graphiql__header">
<h1>{{ t('Explore the GraphQL API') }}</h1>
<form method="get" :action="exploreUrl" class="schema-selector">
Expand Down Expand Up @@ -78,7 +78,7 @@
.cp-graphiql {
display: grid;
grid-template-rows: auto minmax(0, 1fr);
height: 100dvh;
height: 100%;
min-height: 0;
overflow: hidden;
}
Expand Down
43 changes: 24 additions & 19 deletions resources/js/pages/graphql/schemas/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import {useSettingsSave} from '@/modules/settings/composables/useSettingsSave';
import {store, update} from '@actions/Gql/SchemasController';
import {useForm} from '@inertiajs/vue3';
import CpContainer from '@/common/components/CpContainer.vue';

type TokenData = Pick<
CraftCms.Cms.Gql.Data.GqlToken,
Expand Down Expand Up @@ -65,7 +66,7 @@
</script>

<template>
<craft-pane appearance="raised">
<CpContainer>
<div class="grid gap-3">
<CraftInput
v-if="!schema.isPublic"
Expand Down Expand Up @@ -94,26 +95,30 @@
/>
</section>
</div>
</craft-pane>
</CpContainer>

<LayoutSlot v-if="schema.isPublic" name="content-details">
<CraftSwitch
:label="t('Enabled')"
id="enabled"
name="enabled"
v-model="form.enabled"
:disabled="readOnly"
:error="form.errors.enabled"
/>
<div class="p-lg">
<craft-field-group>
<CraftSwitch
:label="t('Enabled')"
id="enabled"
name="enabled"
v-model="form.enabled"
:disabled="readOnly"
:error="form.errors.enabled"
/>

<CraftInput
:label="t('Expiry Date')"
id="expiryDate"
name="expiryDate"
type="datetime-local"
v-model="form.expiryDate"
:disabled="readOnly"
:error="form.errors.expiryDate"
/>
<CraftInput
:label="t('Expiry Date')"
id="expiryDate"
name="expiryDate"
type="datetime-local"
v-model="form.expiryDate"
:disabled="readOnly"
:error="form.errors.expiryDate"
/>
</craft-field-group>
</div>
</LayoutSlot>
</template>
5 changes: 3 additions & 2 deletions resources/js/pages/graphql/schemas/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import DeleteButton from '@/modules/admin-table/components/DeleteButton.vue';
import {router} from '@inertiajs/vue3';
import LayoutSlot from '@/common/components/LayoutSlot.vue';
import CpContainer from '@/common/components/CpContainer.vue';

interface SchemaData {
id: number;
Expand Down Expand Up @@ -92,7 +93,7 @@
>{{ t('New schema') }}</CpLink
>
</LayoutSlot>
<craft-pane padding="0" appearance="raised">
<CpContainer>
<AdminTable :table="table" />
</craft-pane>
</CpContainer>
</template>
43 changes: 23 additions & 20 deletions resources/js/pages/graphql/tokens/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
} from '@actions/Gql/TokensController';
import {useForm, useHttp} from '@inertiajs/vue3';
import {elevatedSessionManager} from '@/modules/auth/elevated-session';
import CpContainer from '@/common/components/CpContainer.vue';

type TokenData = Pick<
CraftCms.Cms.Gql.Data.GqlToken,
Expand Down Expand Up @@ -90,7 +91,7 @@
</script>

<template>
<craft-pane appearance="raised">
<CpContainer>
<div class="grid gap-3">
<CraftInput
:label="t('Name')"
Expand Down Expand Up @@ -172,26 +173,28 @@
</craft-button>
</div>
</div>
</craft-pane>
</CpContainer>

<LayoutSlot name="content-details">
<CraftSwitch
:label="t('Enabled')"
id="enabled"
name="enabled"
v-model="form.enabled"
:disabled="readOnly"
:error="form.errors.enabled"
/>

<CraftInput
:label="t('Expiry Date')"
id="expiryDate"
name="expiryDate"
type="datetime-local"
v-model="form.expiryDate"
:disabled="readOnly"
:error="form.errors.expiryDate"
/>
<craft-field-group class="p-lg">
<CraftSwitch
:label="t('Enabled')"
id="enabled"
name="enabled"
v-model="form.enabled"
:disabled="readOnly"
:error="form.errors.enabled"
/>

<CraftInput
:label="t('Expiry Date')"
id="expiryDate"
name="expiryDate"
type="datetime-local"
v-model="form.expiryDate"
:disabled="readOnly"
:error="form.errors.expiryDate"
/>
</craft-field-group>
</LayoutSlot>
</template>
5 changes: 3 additions & 2 deletions resources/js/pages/graphql/tokens/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import {create, destroy, edit} from '@actions/Gql/TokensController';
import Empty from '@/common/components/Empty.vue';
import LayoutSlot from '@/common/components/LayoutSlot.vue';
import CpContainer from '@/common/components/CpContainer.vue';

export interface TokenData {
id: number;
Expand Down Expand Up @@ -99,7 +100,7 @@
>{{ t('New token') }}</CpLink
>
</LayoutSlot>
<craft-pane padding="0" appearance="raised">
<CpContainer>
<AdminTable :table="table">
<template #empty-row>
<Empty :label="t('No GraphQL tokens exist yet.')">
Expand All @@ -109,5 +110,5 @@
</Empty>
</template>
</AdminTable>
</craft-pane>
</CpContainer>
</template>
Loading