diff --git a/homedocs/src/components/CodeExample.astro b/homedocs/src/components/CodeExample.astro index 276f888fc..679987a55 100644 --- a/homedocs/src/components/CodeExample.astro +++ b/homedocs/src/components/CodeExample.astro @@ -354,55 +354,20 @@ const stackblitzProjectData = stackblitzProject && JSON.stringify(stackblitzProj class="code-block relative rounded-lg overflow-hidden border border-border bg-[hsl(var(--code-bg))]" > { - !hasTabs && stackblitzProject && ( - - ) - } - { - hasTabs && ( + (hasTabs || stackblitzProject) && (
+ {/* Without tabs, the bar only holds the StackBlitz link, so the link doesn't cover the first line of code */} + {hasTabs && ( +
{modelCode && ( )} +
+ )} {stackblitzProject && (
@@ -578,6 +550,51 @@ const stackblitzProjectData = stackblitzProject && JSON.stringify(stackblitzProj color: rgba(255, 255, 255, 0.5); } + /* On narrow screens the tabs scroll sideways, without a visible scrollbar */ + .code-tab-list { + scrollbar-width: none; + } + + .code-tab-list::-webkit-scrollbar { + display: none; + } + + /* Scroll hint: a fade along the bottom edge and a count of the lines below it. Both are overlays, so showing or + hiding them does not change the layout. */ + .code-scroll-fade, + .code-scroll-more { + position: absolute; + pointer-events: none; + opacity: 0; + transition: opacity 0.15s ease; + } + + .code-scroll-fade { + left: 0; + right: 0; + bottom: 0; + height: 3rem; + background: linear-gradient(to bottom, transparent, hsl(var(--code-bg))); + } + + .code-scroll-more { + right: 0.75rem; + bottom: 0.5rem; + padding: 0.125rem 0.5rem; + border-radius: 9999px; + font-size: 11px; + line-height: 1.5; + font-weight: 500; + color: rgba(255, 255, 255, 0.75); + background: hsl(var(--code-bg) / 0.85); + border: 1px solid hsl(var(--code-border)); + } + + .code-scroll-area[data-more] .code-scroll-fade, + .code-scroll-area[data-more] .code-scroll-more { + opacity: 1; + } + .code-tab:hover { color: rgba(255, 255, 255, 0.8); } @@ -647,6 +664,62 @@ const stackblitzProjectData = stackblitzProject && JSON.stringify(stackblitzProj initCodeExampleTabs(); document.addEventListener("astro:page-load", initCodeExampleTabs); + + // Scroll hint: while the visible tab continues below the bottom edge of the code block, show a fade and the number + // of lines that are cut off or hidden. + function initCodeScrollHints() { + document.querySelectorAll(".code-example .code-scroll-area").forEach(function (area) { + if (area.dataset.scrollHint) return; + area.dataset.scrollHint = "1"; + + var wrapper = area.querySelector(".code-content-wrapper"); + var fade = area.querySelector(".code-scroll-fade"); + var label = area.querySelector(".code-scroll-more"); + if (!wrapper || !fade || !label) return; + + function update() { + var bottom = wrapper.getBoundingClientRect().bottom; + var hidden = 0; + wrapper.querySelectorAll(".code-content:not(.hidden) .line").forEach(function (line) { + if (line.getBoundingClientRect().bottom > bottom + 1) hidden++; + }); + + if (hidden > 0) { + // keep the fade off the vertical scrollbar + var scrollbar = wrapper.offsetWidth - wrapper.clientWidth; + fade.style.right = scrollbar + "px"; + label.style.right = 12 + scrollbar + "px"; + label.textContent = "↓ " + hidden + (hidden === 1 ? " more line" : " more lines"); + area.setAttribute("data-more", ""); + } else { + area.removeAttribute("data-more"); + } + } + + wrapper.addEventListener("scroll", update, { passive: true }); + + var example = area.closest(".code-example"); + example.querySelectorAll(".code-tab").forEach(function (tab) { + tab.addEventListener("click", function () { + requestAnimationFrame(update); + }); + }); + + // size changes: viewport width, font loading, code wrapping + if (window.ResizeObserver) { + var observer = new ResizeObserver(update); + observer.observe(wrapper); + wrapper.querySelectorAll(".code-content").forEach(function (content) { + observer.observe(content); + }); + } + + update(); + }); + } + + initCodeScrollHints(); + document.addEventListener("astro:page-load", initCodeScrollHints); + diff --git a/homedocs/src/pages/docs/charts/chart.mdx b/homedocs/src/pages/docs/charts/chart.mdx index ead890b20..fc8679afe 100644 --- a/homedocs/src/pages/docs/charts/chart.mdx +++ b/homedocs/src/pages/docs/charts/chart.mdx @@ -18,7 +18,7 @@ import ChartSecondaryAxisExampleCode from "../../../examples/charts/ChartSeconda - + The `Chart` widget defines axes and bounds for two-dimensional charts such as line, scatter, bar, and column charts. diff --git a/homedocs/src/pages/index.astro b/homedocs/src/pages/index.astro index 7b136068d..0d3096517 100644 --- a/homedocs/src/pages/index.astro +++ b/homedocs/src/pages/index.astro @@ -93,6 +93,29 @@ import InventoryExample from '../examples/homepage/InventoryExample.tsx'; .feature-icon { transition: transform 0.3s ease; } + + /* Cards fade in on scroll. Only the script hides them, so they stay visible if it doesn't run. */ + .js-reveal { + opacity: 0; + } + + /* Reduced motion: no animations, everything shown in its final state */ + @media (prefers-reduced-motion: reduce) { + .float-1, .float-2, .float-3, .float-4, .pulse-glow, .fade-in-up, .slide-in-left, .slide-in-right, .gradient-text { + animation: none !important; + } + .animate-delay-100, .animate-delay-200, .animate-delay-300, .animate-delay-400, .js-reveal { + opacity: 1 !important; + } + .grid-pattern { + animation: none; + opacity: 0.05; + } + .feature-card:hover, + .feature-card:hover .feature-icon { + transform: none; + } + }
@@ -122,8 +145,8 @@ import InventoryExample from '../examples/homepage/InventoryExample.tsx'; Version 26 Now Available
-

- The One-Stop Shop for
Portals and Dashboards +

+ The One-Stop Shop for Portals and Dashboards

@@ -131,11 +154,11 @@ import InventoryExample from '../examples/homepage/InventoryExample.tsx';

- + Get started - + GitHub @@ -409,10 +432,10 @@ import InventoryExample from '../examples/homepage/InventoryExample.tsx';

Get Started - + @@ -478,17 +501,21 @@ import InventoryExample from '../examples/homepage/InventoryExample.tsx'; rootMargin: '0px 0px -50px 0px' }; + // Cards are visible by default and hidden here only when they can be revealed again on scroll + if (!('IntersectionObserver' in window) || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; + const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { + entry.target.classList.remove('js-reveal'); entry.target.classList.add('fade-in-up'); observer.unobserve(entry.target); } }); }, observerOptions); - document.querySelectorAll('.feature-card').forEach(card => { - card.style.opacity = '0'; + document.querySelectorAll('.feature-card:not(.fade-in-up)').forEach(card => { + card.classList.add('js-reveal'); observer.observe(card); }); } diff --git a/homedocs/src/pages/new-landing.astro b/homedocs/src/pages/new-landing.astro index 08355d7ea..88f9cbb02 100644 --- a/homedocs/src/pages/new-landing.astro +++ b/homedocs/src/pages/new-landing.astro @@ -76,7 +76,7 @@ import InventoryExample from "../examples/homepage/InventoryExample.tsx";
Get started @@ -517,7 +517,7 @@ import InventoryExample from "../examples/homepage/InventoryExample.tsx";

Get started diff --git a/homedocs/src/styles/global.scss b/homedocs/src/styles/global.scss index 096cf886d..cba93a5d3 100644 --- a/homedocs/src/styles/global.scss +++ b/homedocs/src/styles/global.scss @@ -53,7 +53,8 @@ --sl-color-gray-7: #f9fafb; --sl-color-accent: #27aae1; --sl-color-accent-low: #e0f4fc; - --sl-color-text-accent: #27aae1; + // Darker than the brand color, for text on light backgrounds (5:1 on white) + --sl-color-text-accent: #0975aa; --sl-color-bg: #ffffff; --sl-color-bg-sidebar: #ffffff; --sl-color-bg-content: #f9fafb; @@ -61,9 +62,13 @@ // CxJS Brand Colors --cx-c-brand: #27aae1; - --cx-c-brand-light: #5bbac7; + --cx-c-brand-light: #5bc4ef; --cx-c-brand-dark: #358dbf; + // Violet from the middle of the logo gradient (#a28cc2), darkened for inline code text (5.5:1 on white) + --cx-c-brand-secondary: #7b55b5; + --code-text: var(--cx-c-brand-secondary); + color-scheme: light; } @@ -77,8 +82,8 @@ --popover: 0 0% 14%; --popover-foreground: 0 0% 98%; - --primary: 234 89% 73%; - --primary-foreground: 243 47% 20%; + --primary: 197 80% 60%; + --primary-foreground: 200 60% 12%; --secondary: 0 0% 18%; --secondary-foreground: 0 0% 98%; @@ -94,7 +99,7 @@ --border: 0 0% 22%; --input: 0 0% 22%; - --ring: 234 89% 73%; + --ring: 197 80% 60%; --code-bg: 0 0% 6%; --code-border: 0 0% 20%; @@ -113,19 +118,23 @@ --sl-color-gray-5: #404040; --sl-color-gray-6: #262626; --sl-color-gray-7: #171717; - --sl-color-accent: #a78bfa; - --sl-color-accent-low: #3b1f6e; - --sl-color-text-accent: #a78bfa; + --sl-color-accent: #47bceb; + --sl-color-accent-low: #0f3a4d; + --sl-color-text-accent: #47bceb; --sl-color-bg: #171717; --sl-color-bg-sidebar: #1f1f1f; --sl-color-bg-content: #262626; --sl-color-text: #fafafa; - // CxJS Brand Colors - Dark mode - --cx-c-brand: #5bbac7; - --cx-c-brand-light: #8fccd5; + // CxJS Brand Colors - Dark mode (lighter cyan, same as --primary) + --cx-c-brand: #47bceb; + --cx-c-brand-light: #7dd0f1; --cx-c-brand-dark: #27aae1; + // Violet from the logo gradient, lightened for dark backgrounds (7.5:1) + --cx-c-brand-secondary: #b39ddb; + --code-text: var(--cx-c-brand-secondary); + color-scheme: dark; } @@ -164,6 +173,16 @@ body { color 0.2s ease; } +// Fira Code is loaded for code; its ligatures (=> as an arrow, !== as a crossed-out sign) are turned off so code reads +// and copies as typed. +code, +pre, +kbd, +samp { + font-variant-ligatures: none; + font-feature-settings: "liga" 0, "calt" 0; +} + // Code blocks are dark in both themes. With the scrollbar-color of the CxJS theme, Chrome draws the scrollbar itself // and uses a hover color for light backgrounds, which is invisible on dark ones. Code blocks therefore reset // scrollbar-color and scrollbar-width, so that Chrome applies the ::-webkit-scrollbar styles below; other browsers diff --git a/homedocs/src/styles/homedocsDark.ts b/homedocs/src/styles/homedocsDark.ts index e3bee1130..85e7cdef4 100644 --- a/homedocs/src/styles/homedocsDark.ts +++ b/homedocs/src/styles/homedocsDark.ts @@ -9,6 +9,7 @@ const homedocsDarkPreset: ThemeVariables = { // Primary colors primaryColor: "hsl(var(--primary))", + primaryTextColor: "hsl(var(--primary-foreground))", accentColor: "hsl(var(--accent))", accentTextColor: "hsl(0, 0%, 98%)", dangerColor: "#ef4444", diff --git a/homedocs/src/styles/pagefind.scss b/homedocs/src/styles/pagefind.scss index 58f1aa8ad..d7593be57 100644 --- a/homedocs/src/styles/pagefind.scss +++ b/homedocs/src/styles/pagefind.scss @@ -92,11 +92,14 @@ align-items: center; justify-content: center; + // An SVG cross instead of the "×" character, which sits below the center of the circle in Inter &::before { - content: "×"; - font-size: 14px; - color: hsl(var(--muted-foreground)); - line-height: 1; + content: ""; + width: 8px; + height: 8px; + background: hsl(var(--muted-foreground)); + mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1 1l6 6M7 1L1 7' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") + center / contain no-repeat; } &:hover { @@ -229,3 +232,45 @@ 0 4px 24px -4px rgba(0, 0, 0, 0.4), 0 8px 32px -8px rgba(0, 0, 0, 0.3); } + +// Mobile search panel (see Header.astro): full-width input, results below it instead of in a dropdown. +// It is only used below 640px; the header script also closes it when the viewport gets wider. +@media (min-width: 640px) { + #mobile-search-panel, + #mobile-search-backdrop { + display: none !important; + } +} + +#mobile-search-panel { + .pagefind-ui .pagefind-ui__search-input { + width: 100%; + height: 40px; + font-size: 16px; // 16px or more keeps iOS from zooming in on focus + padding-right: 36px !important; + } + + // The results are part of the form here, so the icon and clear button are centered on the 40px input, not the form + .pagefind-ui .pagefind-ui__form::before, + .pagefind-ui .pagefind-ui__search-clear { + top: 20px; + } + + .pagefind-ui .pagefind-ui__drawer { + position: static; + width: auto; + max-width: none; + max-height: none; + overflow: visible; + margin-top: 8px; + border: 0; + border-radius: 0; + box-shadow: none; + background: transparent; + } + + .pagefind-ui .pagefind-ui__result { + padding: 10px 4px !important; + border-radius: 6px; + } +} diff --git a/homedocs/src/styles/prose.scss b/homedocs/src/styles/prose.scss index ed5a6362b..c5337f3d4 100644 --- a/homedocs/src/styles/prose.scss +++ b/homedocs/src/styles/prose.scss @@ -38,6 +38,17 @@ list-style: decimal; } +// Bullets and numbers in a muted gray: visible on white, calmer than the text in dark mode +.prose ul > li::marker, +.prose ol > li::marker { + color: hsl(220 9% 58%); +} + +.dark .prose ul > li::marker, +.dark .prose ol > li::marker { + color: hsl(var(--muted-foreground) / 0.8); +} + // Nested lists .prose li ul, .prose li ol { @@ -55,12 +66,13 @@ .prose a:not(.cxb-button):not(.cxb-tab) { color: var(--sl-color-text-accent); text-decoration: none; - //border-bottom: 1px solid transparent; - //transition: border-color 0.15s ease; +} - &:hover { - //border-bottom-color: currentColor; - } +// Underline text links on hover; cards, anchors and widgets (not-prose) are left alone +.prose a:not(.cxb-button):not(.cxb-tab):not(.heading-anchor):not(.nav-link):not(:where(.not-prose *)):hover { + text-decoration: underline; + text-decoration-thickness: 1px; + text-underline-offset: 3px; } .prose blockquote { @@ -150,9 +162,10 @@ .prose p code, .prose li code { - font-size: inherit; - font-weight: 600; - color: var(--sl-color-text-accent); + // Monospace glyphs are wider and taller than Inter at the same size, so inline code is set slightly smaller + font-size: 0.9em; + font-weight: 500; + color: var(--code-text); background: var(--sl-color-gray-6); @apply px-1 rounded; } @@ -161,6 +174,11 @@ color: var(--sl-color-text-accent); } +// Code inside a link takes the link color, so linked and plain code can be told apart +.prose a code { + color: inherit !important; +} + // Table styles - only apply to direct table children to avoid conflicts with CxJS widgets .prose > table { width: 100%; @@ -197,7 +215,7 @@ border-bottom: 1px solid hsl(var(--border) / 0.5); code { - color: hsl(var(--primary)); + color: var(--code-text); background: hsl(var(--secondary)); padding: 0.125rem 0.375rem; border-radius: 0.25rem;