diff --git a/.npmrc b/.npmrc index 6c9c2832d1..4edea00b15 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,5 @@ # Expose Astro dependencies for `pnpm` users shamefully-hoist=true -package-manager-strict=false \ No newline at end of file +package-manager-strict=false +# Octopus packages are published to Octopus's public Artifactory, not npmjs.org +@octopusdeploy:registry=https://packages.octopushq.com/artifactory/api/npm/octopusdeploy-npm-ga-public/ diff --git a/astro.config.mjs b/astro.config.mjs index 3baf67563c..fe1478b162 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -33,7 +33,7 @@ export default defineConfig({ markdown: { shikiConfig: { // Every token carries both sets. main.css picks the dark one up - // under html[data-theme='dark'] + // under html[data-theme='slateDark'] themes: { light: 'light-plus', dark: 'dark-plus' diff --git a/package.json b/package.json index 75b682802b..4102cb05c5 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "dependencies": { "@astrojs/markdown-satteri": "^0.4.6", "@astrojs/mdx": "^8.1.2", - "@octopusdeploy/design-system-tokens": "^2026.3.9109", + "@octopusdeploy/design-system-tokens": "^2027.1.1253", "astro": "^7.4.5", "astro-accelerator-utils": "^0.3.116", "glob": "^14.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7fb0a0b3ba..bc2e6f68ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,8 +25,8 @@ importers: specifier: ^8.1.2 version: 8.1.2(@astrojs/markdown-satteri@0.4.6)(astro@7.4.5(@types/node@24.10.1)(esbuild@0.28.2)(yaml@2.9.1)) '@octopusdeploy/design-system-tokens': - specifier: ^2026.3.9109 - version: 2026.3.9109 + specifier: ^2027.1.1253 + version: 2027.1.1253 astro: specifier: ^7.4.5 version: 7.4.5(@types/node@24.10.1)(esbuild@0.28.2)(yaml@2.9.1) @@ -834,8 +834,8 @@ packages: '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 - '@octopusdeploy/design-system-tokens@2026.3.9109': - resolution: {integrity: sha512-d5iwzww6Y/FV1188Db9Yz/9VDFKx4+evKbGNhv153iPIFU25PFz44bBIlZrR0yjZc9zXVmiZPcXnGYvcZiqMyw==} + '@octopusdeploy/design-system-tokens@2027.1.1253': + resolution: {integrity: sha512-Z/v7zYEr1Zu1Lp6t4Nx6t6EjX7BZ/BoPLYetpQVDO6a+UooOnY7elmB4GomPqMXfHHrp3S4DVADrL3tOGM1fpA==, tarball: https://packages.octopushq.com/artifactory/api/npm/octopusdeploy-npm-ga-public/@octopusdeploy/design-system-tokens/-/@octopusdeploy/design-system-tokens-2027.1.1253.tgz} '@oslojs/encoding@1.1.0': resolution: {integrity: sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==} @@ -3474,7 +3474,7 @@ snapshots: '@tybys/wasm-util': 0.10.3 optional: true - '@octopusdeploy/design-system-tokens@2026.3.9109': {} + '@octopusdeploy/design-system-tokens@2027.1.1253': {} '@oslojs/encoding@1.1.0': {} diff --git a/src/assets/octopus-logo-v2.svg b/src/assets/octopus-logo-v2.svg deleted file mode 100644 index bffd0a9517..0000000000 --- a/src/assets/octopus-logo-v2.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/assets/octopus-logo-v3.svg b/src/assets/octopus-logo-v3.svg new file mode 100644 index 0000000000..09a61dd832 --- /dev/null +++ b/src/assets/octopus-logo-v3.svg @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/components/DocsSearch.astro b/src/components/DocsSearch.astro index d79df37527..796a337431 100644 --- a/src/components/DocsSearch.astro +++ b/src/components/DocsSearch.astro @@ -239,7 +239,7 @@ const listboxId = `${name}-search-listbox`; } .docs-search::backdrop { - background: var(--search-overlay); + background: var(--colorOverlayPrimary); } /* The UA rule for `[hidden]` loses to a class selector, and the regions below @@ -379,7 +379,7 @@ const listboxId = `${name}-search-listbox`; /* The default scrollbar keeps its light chrome in dark mode. Same treatment as the other scroll containers in main.css. */ scrollbar-width: thin; - scrollbar-color: var(--scrollbar-color) transparent; + scrollbar-color: var(--colorScrollbarHandle) transparent; } .docs-search__results { @@ -401,13 +401,13 @@ const listboxId = `${name}-search-listbox`; } .docs-search__row:hover { - background: var(--colorMenuListBackgroundHover); + background: var(--colorSearchBackgroundResultHover); } /* Focus never leaves the input, so the active row is the only thing telling you where Enter will take you. It has to be the loudest state here. */ .docs-search__row[data-active] { - background: var(--colorMenuListBackgroundActive); + background: var(--colorSearchBackgroundResultPressed); } .docs-search__row-icon { @@ -495,7 +495,7 @@ const listboxId = `${name}-search-listbox`; } .docs-search__section[data-active] { - background: var(--colorMenuListBackgroundActive); + background: var(--colorSearchBackgroundResultPressed); } .docs-search__section-mark { diff --git a/src/components/TopNav.astro b/src/components/TopNav.astro index be93d595a7..130e0e71aa 100644 --- a/src/components/TopNav.astro +++ b/src/components/TopNav.astro @@ -1,5 +1,5 @@ --- -import Logo from '../assets/octopus-logo-v2.svg'; +import Logo from '../assets/octopus-logo-v3.svg'; import Button from './Button.astro'; import Menu, { type MenuItem } from './Menu.astro'; import ProfileMenu from './ProfileMenu.astro'; @@ -206,7 +206,8 @@ const sectionItems: MenuItem[] = links.map(({ label, href }) => ({ .top-nav__logo-mark { display: block; - height: 2rem; + /* The logo's native size (130x30), matching octopus.com */ + height: 1.875rem; width: auto; color: var(--colorTextPrimary); transition: color var(--theme-transition-duration) ease-in-out; diff --git a/src/layouts/Api.astro b/src/layouts/Api.astro index 54552b1bbf..fc2aab5050 100644 --- a/src/layouts/Api.astro +++ b/src/layouts/Api.astro @@ -74,7 +74,7 @@ const searchIndex = searchIndexAttributes(Astro.url.pathname, frontmatter); dir={textDirection} lang={lang} class="initial" - data-theme="light" + data-theme="slateLight" data-signed-in="false" > is always exactly 'light' or 'dark' - never absent, - * never 'system'. The design token stylesheets key off [data-theme='light'] and - * [data-theme='dark'] and define nothing at :root, so the attribute has to be - * there unconditionally: layouts/Default.astro renders 'light' as the server - * default, and ThemeScript.astro resolves the real value before first paint. + * `data-theme` on is always exactly 'slateLight' or 'slateDark' - never + * absent, never 'system'. Those are the selectors the slate design token + * stylesheets key off, and they define nothing at :root, so the attribute has + * to be there unconditionally: layouts/Default.astro renders 'slateLight' as + * the server default, and ThemeScript.astro resolves the real value before first paint. * With scripting disabled the default stands and the tokens still resolve. * * This holds for anything rendered through layouts/Default.astro; the * src/pages/report/*.astro pages build their own and sit outside it. * + * Everything else - the stored preference, `data-theme-preference`, the + * change event and the Theme type - uses the plain 'light' / 'dark' names. + * Only the attribute carries the token theme's name; see THEME_ATTRIBUTE_VALUES. + * * `data-theme-preference` records what the user actually chose, including * 'system'. Nothing styles off it today; it exists so a future three-state * control can render the right position. @@ -59,3 +63,14 @@ export type ThemePreference = Theme | 'system'; export function isTheme(value: unknown): value is Theme { return value === 'light' || value === 'dark'; } + +/** The `data-theme` value for each theme: the design token theme's selector. */ +export const THEME_ATTRIBUTE_VALUES = { + light: 'slateLight', + dark: 'slateDark', +} as const satisfies Record; + +/** Reads a `data-theme` value back to a Theme. Any other value reads as light. */ +export function themeFromAttribute(value: string | null): Theme { + return value === THEME_ATTRIBUTE_VALUES.dark ? 'dark' : 'light'; +} diff --git a/src/scripts/theme-switcher.ts b/src/scripts/theme-switcher.ts index 0de5a74521..e560f9c951 100644 --- a/src/scripts/theme-switcher.ts +++ b/src/scripts/theme-switcher.ts @@ -2,6 +2,8 @@ import { COLOR_SCHEME_QUERY, isTheme, THEME_ATTRIBUTE, + THEME_ATTRIBUTE_VALUES, + themeFromAttribute, THEME_CHANGE_EVENT, THEME_PREFERENCE_ATTRIBUTE, THEME_STORAGE_KEY, @@ -53,7 +55,7 @@ function resolve(preference: ThemePreference): Theme { } function currentTheme(): Theme { - return root.getAttribute(THEME_ATTRIBUTE) === 'dark' ? 'dark' : 'light'; + return themeFromAttribute(root.getAttribute(THEME_ATTRIBUTE)); } let transitionTimer: ReturnType | undefined; @@ -83,7 +85,7 @@ function syncImageVariants(preference: ThemePreference) { function apply(preference: ThemePreference) { const theme = resolve(preference); if (theme !== currentTheme()) markTransition(); - root.setAttribute(THEME_ATTRIBUTE, theme); + root.setAttribute(THEME_ATTRIBUTE, THEME_ATTRIBUTE_VALUES[theme]); root.setAttribute(THEME_PREFERENCE_ATTRIBUTE, preference); syncImageVariants(preference); root.dispatchEvent( diff --git a/src/styles/api.css b/src/styles/api.css index 45c78b71f7..00f0c7dfd7 100644 --- a/src/styles/api.css +++ b/src/styles/api.css @@ -146,7 +146,7 @@ section so its examples can sit beside it. */ /* A deprecated endpoint keeps its badge and its row, and reads as secondary until the reader opens it. The page itself carries the warning in full. */ .site-nav__link--deprecated .site-nav__label { - color: var(--color-text-tertiary); + color: var(--colorTextTertiary); text-decoration: line-through; } @@ -170,7 +170,7 @@ section so its examples can sit beside it. */ border: var(--borderWidth1) solid; border-radius: var(--borderRadiusSmall); max-width: fit-content; - font-family: var(--fontFamilySystem-ui-monospace); + font-family: var(--fontFamilyCode); font-size: var(--fontSizeXSmall); font-weight: 400; line-height: var(--lineHeightXSmall); diff --git a/src/styles/main.css b/src/styles/main.css index 465e582b57..01b13928c6 100644 --- a/src/styles/main.css +++ b/src/styles/main.css @@ -29,8 +29,8 @@ html { body { font: var(--textBodyRegularLarge); - color: var(--color-text); - background-color: var(--color-base-primary); + color: var(--colorTextPrimary); + background-color: var(--colorBackgroundPrimaryDefault); transition-property: background-color, color; transition-duration: var(--duration-default); transition-timing-function: ease-in-out; @@ -49,7 +49,7 @@ summary, summary > * { text-decoration: underline; cursor: pointer; - color: var(--body-link-alt); + color: var(--colorTextPrimary); } a:hover, @@ -57,26 +57,26 @@ a:focus, summary:hover, summary:focus, dt[data-destination]:hover { - color: var(--body-link-color); + color: var(--colorTextLinkDefault); } button[data-share] { background-color: unset; cursor: pointer; - color: var(--body-link-alt); - stroke: var(--body-link-alt); + color: var(--colorTextPrimary); + stroke: var(--colorTextPrimary); } hr { - border-bottom: 1px solid var(--header-separator-color); + border-bottom: 1px solid var(--colorBorderPrimary); } .page-content :where(a) { - color: var(--octo-blue); + color: var(--colorTextLinkDefault); } .page-content :where(a:hover, a:focus) { - color: var(--body-link-color); + color: var(--colorTextLinkHover); } /* The tinted card is the callout's shape. Almost every `>` in the docs holds @@ -110,7 +110,7 @@ pre { white-space: break-spaces; background: transparent !important; font: var(--textCodeRegularMedium); - color: var(--color-text); + color: var(--colorTextPrimary); } pre code { @@ -134,11 +134,11 @@ div.problem code:not(pre code), div.question code:not(pre code), div.hint code:not(pre code) { background-color: var(--colorBackgroundSecondaryDefault); - color: var(--color-text); + color: var(--colorTextPrimary); } /* Shiki writes the light set inline and the dark set to --shiki-dark-*. */ -html[data-theme='dark'] { +html[data-theme='slateDark'] { .astro-code, .astro-code span { color: var(--shiki-dark) !important; @@ -154,7 +154,7 @@ em { h1 { font: var(--textHeadingXLarge); - color: var(--color-heading); + color: var(--colorTextPrimary); } h2:not(:where([data-shared-fragment] *)), @@ -162,7 +162,7 @@ h3:not(:where([data-shared-fragment] *)), h4:not(:where([data-shared-fragment] *)), h5:not(:where([data-shared-fragment] *)), h6:not(:where([data-shared-fragment] *)) { - color: var(--color-heading); + color: var(--colorTextPrimary); margin-block-end: var(--space12); transition: color var(--duration-default) ease-in-out; @@ -210,7 +210,7 @@ h6:not(:where([data-shared-fragment] *)) { img { max-width: 100%; height: auto; - background-color: var(--color-base-primary); + background-color: var(--colorBackgroundPrimaryDefault); } /* Content screenshots and diagrams are captured against a light UI and exported @@ -252,7 +252,7 @@ figure picture { } .image__caption { - color: var(--color-heading); + color: var(--colorTextPrimary); font-size: var(--fontSizeBase); font-weight: var(--fontWeight400); text-align: start; @@ -263,7 +263,7 @@ figure picture { position: fixed; inset: 0; z-index: 100; - background: var(--color-base-primary); + background: var(--colorBackgroundPrimaryDefault); animation: zoom-fade 200ms ease-out; } @@ -290,7 +290,7 @@ figure picture { height: 2.75rem; border-radius: 50%; background: none; - color: var(--color-heading); + color: var(--colorTextPrimary); font-size: 1.75rem; line-height: 1; cursor: pointer; @@ -298,7 +298,7 @@ figure picture { .zoom-close:hover, .zoom-close:focus-visible { - background: var(--bg-color-menu); + background: var(--colorBackgroundPrimaryHover); } .zoom-lightbox img { @@ -328,7 +328,7 @@ mark { strong { font-weight: var(--fontWeight700); - font-family: var(--fontFamilySystem-ui); + font-family: var(--fontFamilyDefault); } /* Headings are excluded because they set a tighter 12px block-end themselves, @@ -433,7 +433,7 @@ strong { margin-block: var(--space24); padding: var(--space16); border-radius: var(--borderRadiusMedium); - color: var(--color-callout-body); + color: var(--colorCalloutTextBody); font: var(--textBodyRegularMedium); } @@ -473,57 +473,57 @@ strong { } .hint { - --callout-title-color: var(--color-hint); - background-color: var(--bg-color-hint); + --callout-title-color: var(--colorCalloutTextInfo); + background-color: var(--colorCalloutBackgroundInfoDefault); } .hint::before { - background-color: var(--icon-color-hint); + background-color: var(--colorCalloutIconInfo); mask-image: url('../assets/icons/info-circle.svg'); } .info { - --callout-title-color: var(--color-info); - background-color: var(--bg-color-info); + --callout-title-color: var(--colorCalloutTextInfo); + background-color: var(--colorCalloutBackgroundInfoDefault); } .info::before { - background-color: var(--icon-color-info); + background-color: var(--colorCalloutIconInfo); mask-image: url('../assets/icons/info-circle.svg'); } .success { - --callout-title-color: var(--color-success); - background-color: var(--bg-color-success); + --callout-title-color: var(--colorCalloutTextSuccess); + background-color: var(--colorCalloutBackgroundSuccessDefault); } .success::before { - background-color: var(--icon-color-success); + background-color: var(--colorCalloutIconSuccess); mask-image: url('../assets/icons/check-circle.svg'); } .warning { - --callout-title-color: var(--color-warning); - background-color: var(--bg-color-warning); + --callout-title-color: var(--colorCalloutTextWarning); + background-color: var(--colorCalloutBackgroundWarningDefault); } .warning::before { - background-color: var(--icon-color-warning); + background-color: var(--colorCalloutIconWarning); mask-image: url('../assets/icons/exclamation-triangle.svg'); } .problem { - --callout-title-color: var(--color-problem); - background-color: var(--bg-color-problem); + --callout-title-color: var(--colorCalloutTextDanger); + background-color: var(--colorCalloutBackgroundDangerDefault); } .problem::before { - background-color: var(--icon-color-problem); + background-color: var(--colorCalloutIconDanger); mask-image: url('../assets/icons/exclamation-circle.svg'); } .question { - background: var(--bg-color-hint); + background: var(--colorCalloutBackgroundInfoDefault); border-radius: var(--standard-radius); margin: var(--space24) 0; padding: 1.5rem; @@ -690,7 +690,7 @@ nav.skip-links { } nav.skip-links a { - background-color: var(--color-base-primary); + background-color: var(--colorBackgroundPrimaryDefault); clip: rect(0 0 0 0); min-width: 20vw; overflow: hidden; @@ -716,11 +716,11 @@ nav.skip-links a:focus { background-color: var(--colorIconPrimary); } -html[data-theme='light'] .top-nav__theme-icon { +html[data-theme='slateLight'] .top-nav__theme-icon { mask: url('../assets/icons/moon.svg') center / contain no-repeat; } -html[data-theme='dark'] .top-nav__theme-icon { +html[data-theme='slateDark'] .top-nav__theme-icon { mask: url('../assets/icons/sun.svg') center / contain no-repeat; } @@ -739,7 +739,7 @@ html[data-signed-in='false'] [data-signed-in-only] { .separator { width: 100%; height: 0.0625rem; - background-color: var(--separator-color); + background-color: var(--colorBorderPrimary); margin: 3rem 0 3.75rem; transition: background-color var(--duration-default) ease-in-out; @@ -754,7 +754,7 @@ html[data-signed-in='false'] [data-signed-in-only] { gap: 1rem; text-decoration: none; color: var(--colorTextLinkDefault); - font-family: var(--fontFamilySystem-ui); + font-family: var(--fontFamilyDefault); font-size: var(--fontSizeLarge); line-height: var(--lineHeightMedium); font-weight: var(--fontWeight500); @@ -993,7 +993,7 @@ img.card__icon { /* Default-color icons keep whatever color is baked into the source file, so on a dark background a dark icon (e.g. a brand logo drawn for a light background) can disappear. Force the light theme's card background behind it so it stays visible. */ -html[data-theme='dark'] img.card__icon { +html[data-theme='slateDark'] img.card__icon { background-color: var(--white); border-radius: var(--borderRadiusSmall); } @@ -1049,7 +1049,7 @@ html[data-theme='dark'] img.card__icon { padding-block: var(--space16) 0; padding-inline: var(--space16) 0; background-color: var(--colorBackgroundPrimaryDefault); - border-inline-end: 1px solid var(--border-default-color); + border-inline-end: 1px solid var(--colorBorderPrimary); transition-property: background-color, border-color; transition-duration: var(--duration-default); transition-timing-function: ease-in-out; @@ -1080,7 +1080,7 @@ html[data-theme='dark'] img.card__icon { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; - scrollbar-color: var(--scrollbar-color) transparent; + scrollbar-color: var(--colorScrollbarHandle) transparent; } .site-nav__list .site-nav__list { @@ -1194,7 +1194,7 @@ html[data-theme='dark'] img.card__icon { padding-block-end: var(--space48); overflow-y: auto; scrollbar-width: thin; - scrollbar-color: var(--scrollbar-color) transparent; + scrollbar-color: var(--colorScrollbarHandle) transparent; } @media (max-width: 1130px) { @@ -1272,7 +1272,7 @@ html[data-theme='dark'] img.card__icon { } .header__title { - color: var(--color-text); + color: var(--colorTextPrimary); transition: color var(--duration-default) ease-in-out; @media (prefers-reduced-motion: reduce) { @@ -1281,7 +1281,7 @@ html[data-theme='dark'] img.card__icon { } .header__subtitle { - color: var(--color-subtitle); + color: var(--colorTextSecondary); font-size: var(--fontSizeLarge); line-height: var(--lineHeightMedium); transition: color var(--duration-default) ease-in-out; @@ -1391,7 +1391,7 @@ html[data-theme='dark'] img.card__icon { .page-toc li a.highlight { font-weight: var(--fontWeight700); - color: var(--color-menu-link-alt); + color: var(--colorTextLinkDefault); } .page-toc .toc-lev-3 { @@ -1442,7 +1442,7 @@ html[data-theme='dark'] img.card__icon { .author-list time { font-size: var(--fontSizeBase); - color: var(--grey); + color: var(--colorTextSecondary); } @media (max-width: 860px) { @@ -1456,49 +1456,6 @@ html[data-theme='dark'] img.card__icon { } } -/* Search dialog */ - -.search-dialog { - margin: auto; - padding: 2rem 3rem; - border-radius: var(--standard-radius); - box-shadow: var(--box-shadow); - height: calc(90vh - 4em); - width: calc(80vw - 6em); - max-width: 860px; -} - -.search-dialog::backdrop { - background-color: #000; - opacity: 0.5; -} - -.search-dialog form { - margin-top: 2rem; -} - -#site-search-close { - float: right; - position: relative; - top: -1rem; - left: 2.5rem; - background: none; - cursor: pointer; - font-size: var(--fontSize2xLarge); - stroke: var(--color-menu-link); -} - -@media (max-width: 860px) { - .search-dialog { - /* Fallback */ - height: calc(100vh - 4rem); - width: calc(100vw - 6rem); - /* Ideal units */ - height: calc(100dvh - 4rem); - width: calc(100dvw - 6rem); - } -} - /* Taxonomy Links */ .post-taxonomy div { @@ -1581,15 +1538,9 @@ html[data-theme='dark'] img.card__icon { background-size: cover; border-radius: var(--standard-radius); box-shadow: var(--octo-shadow-standard-box); - color: var(--fore-link); font-size: 5em; } -.yt-video:hover .title, -.yt-video:focus .title { - background-color: var(--funk); -} - .yt-iframe { max-width: 100%; margin: 0 auto; @@ -1681,20 +1632,6 @@ a[data-youtube] { } } -/* Overlay (Mobile Navigation, Search) */ - -.overlay { - position: fixed; - top: 0; - background-color: var(--content-bg); - width: calc(100% - 1em - 1em); - height: calc(100% - 5rem - 2rem); - padding: 110px 1em 2rem 1em; - max-height: 100vh; - overflow-y: auto; - z-index: 1; -} - /* Site Search */ .site-search__wrapper { @@ -1737,7 +1674,7 @@ a[data-youtube] { height: var(--search-height); border-radius: var(--search-border-radius); border: var(--search-border); - background-color: var(--color-base-primary); + background-color: var(--colorBackgroundPrimaryDefault); position: relative; z-index: 1; transition: background-color var(--duration-default) ease-in-out; @@ -1747,53 +1684,10 @@ a[data-youtube] { } } -.site-search-results { - background-color: var(--color-base-primary); - position: absolute; - top: var(--search-height); - width: 100%; - padding: 0; - border-radius: var(--search-border-radius); - border-radius: 0.9375rem; - list-style-type: none; - overflow-y: scroll; - transition-property: opacity, padding, transform, visibility; - transition-duration: var(--search-dropdown-duration); - transition-timing-function: ease-in-out; - visibility: hidden; - transform: translateY(0) scaleY(0); - z-index: 1; - max-height: var(--search-dropdown-height); - transform-origin: top; - will-change: transform; - opacity: 0; -} - -.site-search.is-active + .site-search-results { - opacity: 1; - padding: 1rem 0; - transform: translateY(1.37rem) scaleY(1); - visibility: visible; -} - -.site-search-results ul { - list-style-type: none; - margin-inline-start: 0; -} - -.site-search-results .show-more { - border-radius: 4.0625rem; - background: #00ffa3; - padding: 0.5rem 0.75rem; - display: block; - margin: 1rem auto 0; - cursor: pointer; -} - .site-search__overlay { opacity: 0; visibility: hidden; - background: var(--search-overlay); + background: var(--colorOverlayPrimary); position: fixed; top: 0; left: 0; @@ -1812,10 +1706,10 @@ a[data-youtube] { that strip showing the undimmed page color once the scrollbar goes. Painting the same wash onto the canvas carries the dimming across it. */ html:has(.site-search__wrapper.is-active) { - background-color: var(--color-base-primary); + background-color: var(--colorBackgroundPrimaryDefault); background-image: linear-gradient( - var(--search-overlay), - var(--search-overlay) + var(--colorOverlayPrimary), + var(--colorOverlayPrimary) ); } @@ -1829,116 +1723,13 @@ html:has(.site-search__wrapper.is-active) { height: 100%; padding: 0 1rem; width: calc(100% - 2rem); - color: var(--color-text); + color: var(--colorTextPrimary); } .site-search-query::placeholder { color: var(--colorTextFieldTextSecondary); } -.search-results__heading { - visibility: hidden; - padding: 1.5rem 3.6rem 1.75rem; -} - -.site-search.is-active + .site-search-results > .search-results__heading { - visibility: visible; -} - -.site-search-results__item { - background-color: transparent; - transition-property: background-color, border-color; - transition-duration: var(--search-dropdown-duration); - transition-timing-function: ease-in-out; - border-bottom: 0.0625rem solid; - border-color: var(--colorBorderPrimary); - position: relative; - cursor: pointer; -} - -.site-search-results__item:hover { - --hover-color: rgba(13, 128, 216, 0.07); - background-color: var(--hover-color); - border-color: var(--hover-color); -} - -.site-search-results__item::after { - content: ''; - display: inline-block; - width: 0.75rem; - height: 1.25rem; - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='20' viewBox='0 0 12 20' fill='none'%3E%3Cpath d='M2 18L10 10L2 2' stroke='%230D80D8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); - background-size: 0.75rem 1.25rem; - background-repeat: no-repeat; - position: absolute; - right: 2rem; - top: 50%; - transform: translateY(-50%) translateX(-1rem); - opacity: 0; - transition-property: opacity, transform; - transition-duration: var(--search-dropdown-duration); - transition-timing-function: ease-in-out; -} - -.site-search-results__item:hover::after { - opacity: 1; - transform: translateY(-50%) translateX(0); -} - -@media (max-width: 930px) { - .site-search-results__item { - padding: 1rem; - } -} - -.result-wrapper { - display: flex; - padding: 1.5rem 3.6rem 1.75rem; - text-decoration: none; - flex-direction: column; - gap: 0.56rem; -} - -@media (max-width: 930px) { - .result-wrapper { - padding: 1rem; - } -} - -.site-search-results__item:hover .result-wrapper { - color: initial; -} - -.result-wrapper mark { - color: var(--octo-blue); -} - -.result-path { - color: var(--colorTextTertiary); - font-size: var(--fontSizeMedium); - font-weight: var(--fontWeight400); - display: flex; - gap: 0.5rem; - flex-wrap: wrap; -} - -.result-path__segment:last-child { - color: var(--color-menu-link-active); -} - -.result-title { - color: var(--color-text); - font-size: var(--fontSizeLarge); - line-height: var(--lineHeightMedium); - font-weight: var(--fontWeight700); -} - -.result-description { - color: var(--color-heading); - font-size: var(--fontSizeBase); - font-weight: var(--fontWeight400); -} - .site-search > fieldset { height: 100%; display: flex; @@ -1971,49 +1762,6 @@ html:has(.site-search__wrapper.is-active) { display: none; } -.site-search .show-more { - display: inline-block; - font-size: var(--fontSizeMedium); - border-radius: 100px; - text-decoration: none; - text-align: center; - padding: 0.2em 0.6em 0.3em 0.6em; - color: var(--button-primary-text); - background-color: var(--bg-color-hint); -} - -.result-headings li { - display: none; -} - -.result-headings li:nth-child(-n + 3) { - display: block; -} - -.result-headings:has(li:nth-child(n + 4))::after { - content: 'See more >'; - color: var(--octo-blue); - text-decoration: underline; -} - -.result-headings:focus-within li { - display: block; -} - -.result-headings:focus-within::after { - display: none; -} - -.show-more { - display: inline-block; - border-radius: 100px; - text-decoration: none; - text-align: center; - padding: 0.2em 1.6em 0.3em 1.6em; - color: var(--button-primary-text); - background-color: var(--bg-color-hint); -} - @media (max-width: 860px) { .site-search div { grid-template-columns: repeat(1, auto); @@ -2404,7 +2152,8 @@ ol.col-3 { } } -/* Buttons */ +/* Buttons written directly in page content (``). These use + the same colors as the loud `Button` component (see button.css). */ a.button { text-decoration: none; @@ -2412,46 +2161,39 @@ a.button { padding: 0.75rem 1.875rem; justify-content: center; align-items: center; - font-family: var(--fontFamilySystem-ui); + font-family: var(--fontFamilyDefault); font-size: var(--fontSizeBase); font-weight: var(--fontWeight700); line-height: 1.38rem; border-radius: 0.5rem; - border-width: 0.0625rem; - color: var(--button-primary-text); - background: var(--button-primary); + border: var(--borderWidth1) solid transparent; + color: var(--colorButtonTextLoud); + background: var(--colorButtonBackgroundLoudDefault); max-width: fit-content; - transition-duration: 250ms; - transition-property: background, border-color, box-shadow, color; + transition-property: background-color, color; + transition-duration: var(--theme-transition-duration); transition-timing-function: ease-in-out; } -a.button, -a.button.button--primary { - color: var(--button-primary-text); - background: var(--button-primary); - border-color: var(--button-primary); +a.button:hover, +a.button:focus-visible { + background: var(--colorButtonBackgroundLoudHover); } -a.button:focus, -a.button.button--primary:focus { - background: var(--button-primary-focus); - border-color: var(--button-ring-color); - outline: 0.1875rem solid var(--button-ring-color); - box-shadow: none; +a.button:focus-visible { + outline: var(--borderWidth2) solid var(--colorBorderSelected); + outline-offset: var(--borderWidth1); } -a.button:hover, -a.button.button--primary:hover { - background: var(--button-primary-focus); - border-color: var(--button-primary-focus); +a.button:active { + background: var(--colorButtonBackgroundLoudPressed); } -a.button:active, -a.button.button--primary:active { - background: var(--button-primary); - border-color: var(--button-primary-focus); - box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.35) inset; +/* MDX renders a button on a line of its own as a bare inline at the + top level of the page. Block-end margins don't apply to inline elements, so + without this the button sits flush against the paragraph that follows. */ +.page-content > span:has(> a.button) { + display: block; } /* Tooltip. Put the label in data-tooltip; the host positions the bubble above @@ -2628,7 +2370,7 @@ a.button.button--primary:active { overflow-x: auto; overscroll-behavior: contain; scrollbar-width: thin; - scrollbar-color: var(--scrollbar-color) transparent; + scrollbar-color: var(--colorScrollbarHandle) transparent; gap: var(--space0); background-color: var(--colorBackgroundSecondaryDefault); } diff --git a/src/styles/vars.css b/src/styles/vars.css index 59ddc4917c..2709682e70 100644 --- a/src/styles/vars.css +++ b/src/styles/vars.css @@ -24,171 +24,44 @@ } :root { - --page-inline-margin: 2rem; - /* Theme colors The palette entries below map 1:1 onto the design system's color scales from @octopusdeploy/design-system-tokens. Scales are theme-invariant, so - these values are the same in light and dark; the semantic variables - further down are what differ between themes. */ - --black: var(--colorScalesBlack); + these values are the same in light and dark. */ --white: var(--colorScalesWhite); - --navy-700: var(--colorScalesNavy700); - --navy-400: var(--colorScalesNavy400); - --navy-300: var(--colorScalesNavy300); - --navy-200: var(--colorScalesNavy200); - --navy-100: var(--colorScalesNavy100); - /* TODO: remove green-400 as it's being used in one place only */ --green-400: var(--colorScalesGreen400); --green-500: var(--colorScalesGreen500); - /* Brand greens, no scale equivalent */ - --green: #00e693ff; - --light-green: #00ffa3ff; --red-500: var(--colorScalesRed500); --orange-400: var(--colorScalesOrange400); --orange-500: var(--colorScalesOrange500); - --blue-midnight-dark: #070e14ff; - --blue-midnight-darker: #0a202fff; - --blue-midnight-lighter: #22425cff; - - --blue-grey-dark: #152b3dff; - --blue-gray-darker: #1f2f3cff; - --blue-grey-medium: var(--brandGrey); - - --grey: #555555ff; /* #777777 is low contrast (WCAG) */ --grey-500: var(--colorScalesGrey500); - /* #777777 is low contrast (WCAG) */ - --grey-light: #eef0f2ff; - --grey-lighter: var(--navy-100); - - --color-base-primary: var(--colorBackgroundPrimaryDefault); - - --color-text: var(--colorTextPrimary); - --color-heading: var(--colorTextPrimary); - --color-text-secondary: var(--colorTextSecondary); - --color-text-tertiary: var(--colorTextTertiary); - - --color-subtitle: var(--colorTextSecondary); - - --border-color-header: var(--colorBorderPrimary); - --color-menu-link: var(--colorTextSecondary); - --color-menu-link-active: var(--colorTextPrimary); - --color-menu-link-alt: var(--colorTextLinkDefault); - --color-menu-marker: var(--navy-300); - --bg-color-menu: var(--colorBackgroundSecondaryDefault); - --border-color-menu-open: var(--colorBorderPrimary); --gap-menu: 0.6em; --navigation-width: 20rem; - --bg-color-tab: var(--colorBackgroundTertiary); - --border-color-tab: var(--colorBorderPrimary); - --border-color-tab-active: var(--colorBorderSelected); - - --color-callout-body: var(--colorCalloutTextBody); - - --color-hint: var(--colorCalloutTextInfo); - --bg-color-hint: var(--colorCalloutBackgroundInfoDefault); - --icon-color-hint: var(--colorCalloutIconInfo); - - --color-info: var(--colorCalloutTextInfo); - --bg-color-info: var(--colorCalloutBackgroundInfoDefault); - --icon-color-info: var(--colorCalloutIconInfo); - - --color-success: var(--colorCalloutTextSuccess); - --bg-color-success: var(--colorCalloutBackgroundSuccessDefault); - --icon-color-success: var(--colorCalloutIconSuccess); - - --color-warning: var(--colorCalloutTextWarning); - --bg-color-warning: var(--colorCalloutBackgroundWarningDefault); - --icon-color-warning: var(--colorCalloutIconWarning); - - --color-problem: var(--colorCalloutTextDanger); - --bg-color-problem: var(--colorCalloutBackgroundDangerDefault); - --icon-color-problem: var(--colorCalloutIconDanger); - --duration-default: 300ms; --theme-transition-duration: 0s; - /* Backgrounds */ - --background-light: var(--colorBackgroundSecondaryDefault); - --background-default: var(--colorBackgroundPrimaryDefault); - - /* Borders */ - --border-default-color: var(--colorBorderPrimary); - - /* Separator */ - --separator-color: var(--colorBorderPrimary); - - /* Scrollbar */ - --scrollbar-color: var(--colorScrollbarHandle); - - /* Icon Tile */ - --icon-tile-border: var(--border-default-color); - --icon-tile-border-hover: var(--colorBorderSelected); - --icon-tile-background: var(--background-light); - --icon-tile-background-hover: var(--background-default); - - /* Article header */ - --header-separator-color: var(--colorBorderPrimary); - - /* Button */ - --button-primary: var(--green); - --button-primary-focus: var(--light-green); - --button-primary-text: var(--blue-grey-medium); - --button-ring-color: rgba(0, 255, 163, 0.5); - /* Search variables */ --search-height: 3rem; --search-border-radius: calc(var(--search-height) / 2); - --search-results-padding: 1rem; --search-border: 0.0625rem solid var(--colorTextFieldBorderDefault); - --search-dropdown-height: 60vh; --search-dropdown-duration: var(--duration-default); - --search-overlay: var(--colorOverlayPrimary); - - --hamburger-lines-color: var(--colorIconPrimary); - - /* Card */ - --card-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.15); - --card-related-topics-shadow: 0px 10px 35px 0px rgba(133, 152, 165, 0.1); - --card-related-topics-hover-shadow: 0px 10px 35px 0px - rgba(133, 152, 165, 0.25); - - /* To be checked and cleaned */ - - --octo-blue: var(--colorTextLinkDefault); - - --header-link-color: var(--octo-blue); - - --content-bg: var(--white); - - --body-link-color: var(--octo-blue); - --body-link-alt: var(--colorTextPrimary); - - --icon-stroke: var(--white); - --icon-fill: var(--colorIconSecondary); - - --octopus-logo-text-color: #0f2535; --block-gap: 2rem; - --header-pin: 0; --header-height: 68px; --scroll-pad: 140px; - --box-shadow: 4px 0px 8px rgba(0, 0, 0, 0.25); --octo-shadow-standard-box: 0 2px 6px 0 rgba(0, 0, 0, 0.2); - --octo-shadow-standard-box-hover: 0 2px 6px 0 rgba(0, 0, 0, 0.4); - --content-width: 78vw; --content-width-article: 800px; --content-width-mobile: calc(100vw - 4rem); --toc-width: 250px; @@ -212,8 +85,6 @@ var(--api-content-min-width) + var(--api-columns-gap) + var(--api-examples-min-width) ); - --grid-max-width: 1250px; - --grid-gap: 1rem; --grid-gap-main: 1rem; --standard-radius: 0.5rem; @@ -255,21 +126,7 @@ } } -@media (max-width: 860px) { - :root { - --page-inline-margin: 1rem; - } -} - -html[data-theme='dark'] { - /* The navigation matches the page in dark, unlike light */ - --bg-color-menu: var(--colorBackgroundPrimaryDefault); - --grey-lighter: var(--blue-grey-dark); - --grey-light: var(--navy-700); - --octopus-logo-text-color: var(--white); - /* Tiles sit one step above the page so hover has somewhere lighter to go */ - --icon-tile-background-hover: var(--colorBackgroundTertiary); - +html[data-theme='slateDark'] { --colorApiBadgeBackgroundGet: var(--colorScalesGreen900); --colorApiBadgeBorderGet: var(--colorScalesGreen700); --colorApiBadgeIconGet: var(--colorScalesGreen300); diff --git a/src/themes/octopus/components/Breadcrumbs.astro b/src/themes/octopus/components/Breadcrumbs.astro index f2a790c3f6..11eed5a650 100644 --- a/src/themes/octopus/components/Breadcrumbs.astro +++ b/src/themes/octopus/components/Breadcrumbs.astro @@ -59,13 +59,13 @@ stats.stop(); li + li::before { content: '/'; margin-inline-end: var(--space8); - color: var(--color-text-tertiary); + color: var(--colorTextTertiary); font: var(--textBodyRegularSmall); } a, span { - color: var(--color-menu-link); + color: var(--colorTextSecondary); font: var(--textBodyRegularMedium); text-decoration: none; transition: color var(--duration-default) ease-in-out; @@ -77,6 +77,6 @@ stats.stop(); a:hover, a:focus { - color: var(--color-menu-link-alt); + color: var(--colorTextLinkDefault); } diff --git a/src/themes/octopus/components/HtmlHead.astro b/src/themes/octopus/components/HtmlHead.astro index 6360231e25..8ed80355c1 100644 --- a/src/themes/octopus/components/HtmlHead.astro +++ b/src/themes/octopus/components/HtmlHead.astro @@ -9,13 +9,13 @@ import ThemeScript from '@components/ThemeScript.astro'; import SignedInScript from '@components/SignedInScript.astro'; // Design tokens as CSS custom properties. globals and textTheme apply at :root; -// lightTheme and darkTheme are selected by the data-theme attribute on - -// rendered as a default by layouts/Default.astro, then resolved before first -// paint by . See src/lib/theme.ts. +// slateLightTheme and slateDarkTheme are selected by the data-theme attribute on +// - rendered as a default by layouts/Default.astro, then resolved before +// first paint by . See src/lib/theme.ts. import '@octopusdeploy/design-system-tokens/css/globals.css'; import '@octopusdeploy/design-system-tokens/css/textTheme.css'; -import '@octopusdeploy/design-system-tokens/css/lightTheme.css'; -import '@octopusdeploy/design-system-tokens/css/darkTheme.css'; +import '@octopusdeploy/design-system-tokens/css/slateLightTheme.css'; +import '@octopusdeploy/design-system-tokens/css/slateDarkTheme.css'; // Site styles, imported so that Vite will bundle/minify/content-hash them. // Note: @font-face rules in vars.css point at public/docs/css/fa/webfonts, which stay in diff --git a/src/themes/octopus/components/Search.astro b/src/themes/octopus/components/Search.astro index 62d0c6ece2..456af521cf 100644 --- a/src/themes/octopus/components/Search.astro +++ b/src/themes/octopus/components/Search.astro @@ -74,7 +74,7 @@ stats.stop(); > + fill="var(--colorIconPrimary)"> diff --git a/src/themes/octopus/components/ThemeScript.astro b/src/themes/octopus/components/ThemeScript.astro index ce28991a88..3610ffcf3c 100644 --- a/src/themes/octopus/components/ThemeScript.astro +++ b/src/themes/octopus/components/ThemeScript.astro @@ -2,6 +2,7 @@ import { COLOR_SCHEME_QUERY, THEME_ATTRIBUTE, + THEME_ATTRIBUTE_VALUES, THEME_PREFERENCE_ATTRIBUTE, THEME_STORAGE_KEY, THEME_VARIANT_ATTRIBUTE, @@ -27,6 +28,7 @@ const VARIANT_MEDIA = { define:vars={{ COLOR_SCHEME_QUERY, THEME_ATTRIBUTE, + THEME_ATTRIBUTE_VALUES, THEME_PREFERENCE_ATTRIBUTE, THEME_STORAGE_KEY, THEME_VARIANT_ATTRIBUTE, @@ -51,7 +53,7 @@ const VARIANT_MEDIA = { : preference; const root = document.documentElement; - root.setAttribute(THEME_ATTRIBUTE, theme); + root.setAttribute(THEME_ATTRIBUTE, THEME_ATTRIBUTE_VALUES[theme]); root.setAttribute(THEME_PREFERENCE_ATTRIBUTE, preference); // Themed :img{src-dark=...} pictures follow the OS setting as written. When diff --git a/tests/theme.spec.ts b/tests/theme.spec.ts index 30c51b4f95..4d9f3accd2 100644 --- a/tests/theme.spec.ts +++ b/tests/theme.spec.ts @@ -9,8 +9,14 @@ const toggleIcon = `${toggle} .btn__icon`; const drawerToggleIcon = '.top-nav__drawer-theme .btn__icon'; // Auto-retrying so a slow style/attribute write can never make these flaky. -function expectTheme(page: Page, value: string) { - return expect(page.locator('html')).toHaveAttribute('data-theme', value); +// data-theme carries the slate token theme's name for each theme +const themeAttribute = { light: 'slateLight', dark: 'slateDark' } as const; + +function expectTheme(page: Page, theme: 'light' | 'dark') { + return expect(page.locator('html')).toHaveAttribute( + 'data-theme', + themeAttribute[theme] + ); } function expectPreference(page: Page, value: string) { @@ -114,7 +120,7 @@ test.describe('theme', () => { }); // The design token stylesheets define their custom properties only under - // [data-theme='light'] / [data-theme='dark'] and nothing at :root, so a page + // [data-theme='slateLight'] / [data-theme='slateDark'] and nothing at :root, so a page // with no attribute resolves no tokens at all. The server-rendered default in // layouts/Default.astro is what keeps that from happening without scripting. test.describe('with scripting disabled', () => {