Compare commits

..

2 Commits

Author SHA1 Message Date
Peter White a34f5c96c4 changeset 2026-11-30 23:13:50 +00:00
Peter White e71835d046 Improve WCAG contrast on published navigation, disabled buttons, and empty checkboxes 2026-11-30 23:13:50 +00:00
26 changed files with 153 additions and 99 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": minor
---
Let visitors choose their country in a country picker, overriding the detected one, on sites that enable it and declare regions. Countries are grouped by the site's regions, then under "Other".
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Strip the trailing slash from the API URL used by browser site search.
@@ -0,0 +1,6 @@
---
"@gitbook/colors": patch
"gitbook": patch
---
Improve WCAG contrast across published documentation navigation, disabled buttons, and empty task-list checkboxes.
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Use a permanent 308 redirect with a bounded Cache-Control header for trailing-slash GET and HEAD requests.
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Advertise the public URL in the MCP OAuth metadata of sites served from a custom subdirectory, so MCP clients accept the connection.
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Fix MCP sign-in showing "This authorization link has expired" after login on sites served from a custom subdirectory.
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Coalesce typing-prefix search_type_query events and skip single-character ASCII queries before flushing insights batches.
+21 -21
View File
@@ -109,7 +109,7 @@
},
"packages/gitbook": {
"name": "gitbook",
"version": "0.30.0",
"version": "0.29.0",
"dependencies": {
"@base-ui/react": "catalog:",
"@cloudflare/workers-types": "^4.20251011.0",
@@ -1025,43 +1025,43 @@
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.62.0", "", { "os": "win32", "cpu": "x64" }, "sha512-dlI5SY7XYQCiCBafntWagCR6HcAJB/NpsLtdlPx8x08+Osz8Ok1HHz1GZuusegCe/VoJ6pAnF5a4pd5OZAq7qQ=="],
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.96.0", "", { "os": "android", "cpu": "arm" }, "sha512-SCINGNIfxMCeONnTjTQdm27XYY3zWv5olN/RIJmoTbMgphJ8JkZMeivswWqPdjwYpTAuskGNpHbevtECumuIxg=="],
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.95.0", "", { "os": "android", "cpu": "arm" }, "sha512-hJna6w3COWJjfMPxomjZL82klTdrITm56PEpCsfO/xMkzQw/fNtJWauQ/YEwQqVttj0L5vDIa8rCcuhfAE3L4w=="],
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.96.0", "", { "os": "android", "cpu": "arm64" }, "sha512-jmRRp4pThMoYheXzhDrEMOHMU6X0geGSzJznkF2xhE9l0aViXNBvZrWasR5WLc3FXlc0rQAtV/o9mH1wosXZGQ=="],
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.95.0", "", { "os": "android", "cpu": "arm64" }, "sha512-uAIGZQ9uJVUeogeWOSboI3F7twOuM4mNuZcHXD9+LdYLcWp7J6kbtRUXJ6GVqcs5E0Cjb4emmSBK9FNrkGuhqQ=="],
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.96.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RxRoSJY2xa9/dKRzPv1rLn36OvaCwu7Qg9o+NhrSIP7FkLWackAkfbf+5bcgIC5H1r78sdWUvVAIDJKDdfkXPg=="],
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.95.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Ogh1vfHO5vshKRop/He46r+WqC5BTqonYwhB4fp9e2gvOFvg1Xi6XsHTuM/lBSH85ZcaG+DS99EMAy9GcwDong=="],
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.96.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-pokl9aeRHG0ke37GooIG/Jjd5bIFx9TDZ9//JkO0KDROJ3MIGz+KD9/hlq6siE40+auswpyaolZ4xNqzaX1VWw=="],
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.95.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-kTrE1xfpQUBMMS50Ws6KY92N8OsJ8LE6JqxKqkHEY3KdsmguQ6kKVGSjzyt1HLwsSi0fQCvNRog8YRBBovD1AA=="],
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.96.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-zV8oqk0kzAFa8hsiBXz431E9DvYZuhIOveTKk7bgKmeYy1KixJ//iwdBMvD6+IGq0HAxxX2eCAbdzecC2Qsrpw=="],
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.95.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-ho7E1VCInK0VnpneRaI1BEpe1ceJE8VjxP2O9THWdReV6bth1Q4+80kYVGGK47mHRyZ2NGztQZ2dWRo6j1lavA=="],
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.96.0", "", { "os": "linux", "cpu": "arm" }, "sha512-hT4CHT09eiWrwIikLjqiQrcjF1lASaRrJR4rGwXhHQcXC8Z5ohkDOy897tV/+UK/RkDvhtX3YOV3LGultcJTxg=="],
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.95.0", "", { "os": "linux", "cpu": "arm" }, "sha512-94afnouMHcnHr/OtRh07gG5LehC9M0GjiSoik3xxTtrmq6cWxXOTAhYlBtxa67u/GlycbnHlDoGJfYlTshcr/w=="],
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.96.0", "", { "os": "linux", "cpu": "arm" }, "sha512-ro+mX13ijz/Z2IIstN3TnPjoOzMZmvvS6xj/RIkyWZJveU/W5WkuFkISb81M7dxVDywHNUUljs9kGXL+ZpCkAA=="],
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.95.0", "", { "os": "linux", "cpu": "arm" }, "sha512-LEeclqV1/fafxPgJWN21Bri6HBBBZpEFluq/ZH7Avvu9HjJh/XOn6WwogJqX9X7pG2aITZ2nRH39+sUKEQt2WA=="],
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.96.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-kpJqgwJ4xCzg0HiZr0IqPumqoskk7z9m+epDKC8cxuC6sS5GeX0u8XpuotC7BKto0htzq+AmpZ6/LPIqOJ2J2w=="],
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.95.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-EpXpEQKmgtkvc6RyU84LM1e3CrVDWQkgghVzf1hMGgwjBzgKAJ/QntHgnzmu5cNeLBfa7GPCY+gGXxEll8Adcg=="],
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.96.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-sPqrWFuk8IsDx5ftGQVCaxRfnR95b3aXFQrknHDsb0W6UGYkhmhU6ZcirV/9Etyf44dAYo3ZMyA30bRow1sz5w=="],
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.95.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-+96Md8c2BAgFp8nWHrUrpqba87DoU+HVJYIun6qA+QKFoeNd3xAWq1JYE6da4nVli9GgwRpfncfRePcgmQQaIQ=="],
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.96.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-41bcNpgz0TDw2bPseL18MWtiyxrkadp5XVqRPr3TmGSDO2NpXdrHQ3UbXOiSpi5Dko7H22iNg9kcl/q/TZrcWA=="],
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.95.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-6yG99vsXct3Uv536w6Z1s03w2makRKnE0q3eJSmf+W/IwPmO56QLk8XUA6ebu/R5peCbJ67HmcWqACH+kg/6Bg=="],
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.96.0", "", { "os": "linux", "cpu": "none" }, "sha512-XsuYByplvx4CjLwBTDNiWEB3Igk1NVgg0jqndZA9Op59ssCqO9PYZmg8af+GMOfrOtpdiFiGnogi0PfvCihGrg=="],
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.95.0", "", { "os": "linux", "cpu": "none" }, "sha512-Eir0Z4ldh55AsQUqVDlLF4Pw3lSFXIdAl8ZNgU8tp/gTwT9JVCzWY0o3+ys9pCcpTN0vCqBwwuQfAUxzbIgvcQ=="],
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.96.0", "", { "os": "linux", "cpu": "none" }, "sha512-J+JcvoObB6gsi3TxaY8tu0gc2ZEcxYbKz7t0N85RurdEU1ubXHTJqKOe8D5aH3KPSmlT3+8f81UhVI4qF4WoUQ=="],
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.95.0", "", { "os": "linux", "cpu": "none" }, "sha512-ceRx+K2WJ7C3tIv+XjZS28oAoZ7DY29ZcWChPdXG5M100phI72FRDYwGRlWZEeDfmkROnarLTMKnnrQAtsC42Q=="],
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.96.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-wON5n7KlNpVWMhzYt9G3Ew2iuL6hHt0LV69dg51quv78mx7jOWFZp/+2ny2vARWl1542RRSip70hb7DAj2yy+Q=="],
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.95.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-WbD3sM08ZDk2QE6060wK/omihQKbRm+LVzKIg4W5zNTbEhYJChciqX49UZuqW59RGF+wBUxzAup7egUIESTjUA=="],
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.96.0", "", { "os": "linux", "cpu": "x64" }, "sha512-AURdLIDjJvUK1XjWtnQI6TJs8F3SAQOFsDeL3QQChNwKAWbCZmT4jjflXMb6hjTY6NS1mnP1Z2sWz/yLI1BvTg=="],
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.95.0", "", { "os": "linux", "cpu": "x64" }, "sha512-F4ST2ZkFIiLL9OKyRCyC0KQQpwM5WIv0GTcMiZuYVa6xSRJHR05iVRqst+arOVudEPkhP47EnbuoC9UfVCYDyg=="],
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.96.0", "", { "os": "linux", "cpu": "x64" }, "sha512-4+qtiKtCov+b8psbs4/O3nOtNh40bZN/QYxjjmOgV7OHmcD8rBwJqV4AeeXGZ/pSUCGNYGm1sQtiy4AAhJ5xqQ=="],
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.95.0", "", { "os": "linux", "cpu": "x64" }, "sha512-hEpYDZatpuxLrWlTlkwhHZ1e8QkL02aFS55BPQX1XA9iOd+yUEADGFF1iY6z+xkw6RkpzXFrtnDFe4/JNOLSRA=="],
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.96.0", "", { "os": "none", "cpu": "arm64" }, "sha512-eYZmZlTFgwz3c0+nLlZc+QdFTJJQ9B98vvLSk8LPJm+edhhiuLOe6jIUiLWwc52s95GKz5US05cAsVd8e5BzOA=="],
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.95.0", "", { "os": "none", "cpu": "arm64" }, "sha512-+JwIH9/uLgQXfxBvOAKzvp616m5i0fBR5ELEBHm5D+++fStBZ+74T7YW4xBpX13zNU2blr52Swoe3GTF1JyqRg=="],
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.96.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-elsIvBZeDYDO3swjXGBh8kGrsVrlcDNv6X2+ASA7q02UPuAWjH5F8urTa2d32c+f7l9MFohMokdWZ82pV+oZ9Q=="],
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.95.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-pzJgcp3WkOSchukg5y5pn5mVIQ6P83RDI79YJ9gQZKed1pOgjhrmlc5AMizjuq6/P8VifhxzBsMqYI6LLjO2TA=="],
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.96.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-Sl6tX5MdGZ886jSHmeg71ijhtsELauPl4ii4pfAtrQV3W7uj+v5QF1eAZB74KySWt6sdZuNDyjfhaKGaCf6NWA=="],
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.95.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-54MeQvLRXkJqF1nEFs7wb73SrnurZJQy9fVK4NdEwumNKVwyUUxpGHhvfDMIY2NqJZS7kz0pY9uVty5664Gt1Q=="],
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.96.0", "", { "os": "win32", "cpu": "x64" }, "sha512-gLx6y/CsxfNZdfBfSLbVHB75AHDfV2/XdilDqPgh7oNRL6y72s75TCbMt500km+Mk5izFYNYXX8+LYR6U4n/zA=="],
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.95.0", "", { "os": "win32", "cpu": "x64" }, "sha512-I/Fn+Fed1qzb1k2uRjMe2VRtRN1+ZObyU+E76B6v/Ul3Z6JdeAW5zBHSe0n5d8a0ZyU4iorzVy0Rw9LYgo3MSQ=="],
"@panzoom/panzoom": ["@panzoom/panzoom@4.6.1", "", {}, "sha512-ogf/KhHHjj+DYAvHfaf3TXMQ8OE36pJtKpabLlx1OmpjcgtpCvkUoCiNONA8kuVRPGJdLiqMf0n8LRFXj1OyuA=="],
@@ -2691,7 +2691,7 @@
"oxfmt": ["oxfmt@0.62.0", "", { "dependencies": { "tinypool": "2.1.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.62.0", "@oxfmt/binding-android-arm64": "0.62.0", "@oxfmt/binding-darwin-arm64": "0.62.0", "@oxfmt/binding-darwin-x64": "0.62.0", "@oxfmt/binding-freebsd-x64": "0.62.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.62.0", "@oxfmt/binding-linux-arm-musleabihf": "0.62.0", "@oxfmt/binding-linux-arm64-gnu": "0.62.0", "@oxfmt/binding-linux-arm64-musl": "0.62.0", "@oxfmt/binding-linux-ppc64-gnu": "0.62.0", "@oxfmt/binding-linux-riscv64-gnu": "0.62.0", "@oxfmt/binding-linux-riscv64-musl": "0.62.0", "@oxfmt/binding-linux-s390x-gnu": "0.62.0", "@oxfmt/binding-linux-x64-gnu": "0.62.0", "@oxfmt/binding-linux-x64-musl": "0.62.0", "@oxfmt/binding-openharmony-arm64": "0.62.0", "@oxfmt/binding-win32-arm64-msvc": "0.62.0", "@oxfmt/binding-win32-ia32-msvc": "0.62.0", "@oxfmt/binding-win32-x64-msvc": "0.62.0" }, "peerDependencies": { "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-vxgGHTmnDU9j4CX7dDBLzxgmHxfda/yPcgJkGCMUSCwRmz+euo/V08xXLNgXTeqAB9Fhf3Pe2nO1RNKLCVgphQ=="],
"oxlint": ["oxlint@1.96.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.96.0", "@oxlint/binding-android-arm64": "1.96.0", "@oxlint/binding-darwin-arm64": "1.96.0", "@oxlint/binding-darwin-x64": "1.96.0", "@oxlint/binding-freebsd-x64": "1.96.0", "@oxlint/binding-linux-arm-gnueabihf": "1.96.0", "@oxlint/binding-linux-arm-musleabihf": "1.96.0", "@oxlint/binding-linux-arm64-gnu": "1.96.0", "@oxlint/binding-linux-arm64-musl": "1.96.0", "@oxlint/binding-linux-ppc64-gnu": "1.96.0", "@oxlint/binding-linux-riscv64-gnu": "1.96.0", "@oxlint/binding-linux-riscv64-musl": "1.96.0", "@oxlint/binding-linux-s390x-gnu": "1.96.0", "@oxlint/binding-linux-x64-gnu": "1.96.0", "@oxlint/binding-linux-x64-musl": "1.96.0", "@oxlint/binding-openharmony-arm64": "1.96.0", "@oxlint/binding-win32-arm64-msvc": "1.96.0", "@oxlint/binding-win32-ia32-msvc": "1.96.0", "@oxlint/binding-win32-x64-msvc": "1.96.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2008", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-jyiSvUjzM6GPHNbNQSk9ov63KDusn7FJaIX4LqxJYN/VnRrEgwMplyZaoAfmVclfzxCmVhaIXLixnRJ2IAa0Hw=="],
"oxlint": ["oxlint@1.95.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.95.0", "@oxlint/binding-android-arm64": "1.95.0", "@oxlint/binding-darwin-arm64": "1.95.0", "@oxlint/binding-darwin-x64": "1.95.0", "@oxlint/binding-freebsd-x64": "1.95.0", "@oxlint/binding-linux-arm-gnueabihf": "1.95.0", "@oxlint/binding-linux-arm-musleabihf": "1.95.0", "@oxlint/binding-linux-arm64-gnu": "1.95.0", "@oxlint/binding-linux-arm64-musl": "1.95.0", "@oxlint/binding-linux-ppc64-gnu": "1.95.0", "@oxlint/binding-linux-riscv64-gnu": "1.95.0", "@oxlint/binding-linux-riscv64-musl": "1.95.0", "@oxlint/binding-linux-s390x-gnu": "1.95.0", "@oxlint/binding-linux-x64-gnu": "1.95.0", "@oxlint/binding-linux-x64-musl": "1.95.0", "@oxlint/binding-openharmony-arm64": "1.95.0", "@oxlint/binding-win32-arm64-msvc": "1.95.0", "@oxlint/binding-win32-ia32-msvc": "1.95.0", "@oxlint/binding-win32-x64-msvc": "1.95.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2008", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-eNzjFjm1TU02/+ohAJjOB7aekRQgTXhOWxMGscEm8VJMokNnnix+PCZn7kqIuGIqxAoBnHxatqlN3Chz3N6PKA=="],
"p-filter": ["p-filter@2.1.0", "", { "dependencies": { "p-map": "^2.0.0" } }, "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw=="],
+1 -1
View File
@@ -7,7 +7,7 @@
"devDependencies": {
"@changesets/cli": "^2.31.1",
"oxfmt": "^0.62.0",
"oxlint": "^1.96.0",
"oxlint": "^1.95.0",
"turbo": "^2.11.13",
"vercel": "50.37.3"
},
+71 -1
View File
@@ -1,6 +1,76 @@
import { describe, expect, it } from 'bun:test';
import { colorScale, hexToRgbArray } from './transformations';
import { DEFAULT_PRIMARY_COLOR, DEFAULT_TINT_COLOR } from './colors';
import { colorScale, hexToRgbArray, rgbToLinear } from './transformations';
function wcagContrast(hexA: string, hexB: string): number {
const [rA, gA, bA] = rgbToLinear(hexToRgbArray(hexA));
const [rB, gB, bB] = rgbToLinear(hexToRgbArray(hexB));
const lumA = 0.2126 * rA + 0.7152 * gA + 0.0722 * bA;
const lumB = 0.2126 * rB + 0.7152 * gB + 0.0722 * bB;
const lighter = Math.max(lumA, lumB);
const darker = Math.min(lumA, lumB);
return (lighter + 0.05) / (darker + 0.05);
}
describe('colorScale WCAG contrast', () => {
const sampleColors = [
DEFAULT_TINT_COLOR,
DEFAULT_PRIMARY_COLOR,
'#0202C4',
'#FFFF00',
'#00C950',
'#FE9A00',
'#FB2C36',
'#FE551B',
'#F5F3EF',
'#0B0F19',
];
it('meets WCAG AA (4.5:1) for step 11 text over base, subtle, and hover surfaces', () => {
for (const darkMode of [false, true]) {
for (const hex of sampleColors) {
for (const baseStep of [undefined, 1, 2] as const) {
const scale = colorScale(hex, { darkMode, baseStep });
const text = scale[10]!;
expect(wcagContrast(text, scale[0]!)).toBeGreaterThanOrEqual(4.5);
expect(wcagContrast(text, scale[1]!)).toBeGreaterThanOrEqual(4.5);
expect(wcagContrast(text, scale[3]!)).toBeGreaterThanOrEqual(4.5);
}
}
}
});
it('meets WCAG AA (4.5:1) for step 11 when tint mixes with neutral or primary', () => {
const mixedScales = [
colorScale(DEFAULT_TINT_COLOR, {
baseStep: 1,
mix: { color: DEFAULT_PRIMARY_COLOR, ratio: 0.2 },
}),
colorScale(DEFAULT_TINT_COLOR, {
darkMode: true,
baseStep: 1,
mix: { color: DEFAULT_PRIMARY_COLOR, ratio: 0.1 },
}),
colorScale('#0202C4', {
baseStep: 1,
mix: { color: DEFAULT_TINT_COLOR, ratio: 0.4 },
}),
colorScale('#FFFF00', {
darkMode: true,
baseStep: 1,
mix: { color: DEFAULT_TINT_COLOR, ratio: 0.4 },
}),
];
for (const scale of mixedScales) {
const text = scale[10]!;
expect(wcagContrast(text, scale[0]!)).toBeGreaterThanOrEqual(4.5);
expect(wcagContrast(text, scale[1]!)).toBeGreaterThanOrEqual(4.5);
expect(wcagContrast(text, scale[3]!)).toBeGreaterThanOrEqual(4.5);
}
});
});
describe('colorScale exact base', () => {
it('takes a very light tint as the exact background on step 1 (clean/bold)', () => {
+1 -1
View File
@@ -78,7 +78,7 @@ export const scale: Record<ColorCategory, ColorSubScale> = {
*/
export const colorMixMapping = {
// bgs |components |borders |solid |text
light: [0, 0.02, 0.03, 0.05, 0.07, 0.1, 0.15, 0.2, 0.5, 0.55, 0.6, 1],
light: [0, 0.02, 0.03, 0.05, 0.07, 0.1, 0.15, 0.2, 0.5, 0.55, 0.65, 1],
dark: [0, 0.03, 0.08, 0.1, 0.13, 0.15, 0.2, 0.25, 0.5, 0.55, 0.75, 1],
};
-14
View File
@@ -1,19 +1,5 @@
# gitbook
## 0.30.0
### Minor Changes
- 0f7ca03: Let visitors choose their country in a country picker, overriding the detected one, on sites that enable it and declare regions. Countries are grouped by the site's regions, then under "Other".
### Patch Changes
- 1c8da29: Strip the trailing slash from the API URL used by browser site search.
- 5b326bf: Use a permanent 308 redirect with a bounded Cache-Control header for trailing-slash GET and HEAD requests.
- d51605f: Advertise the public URL in the MCP OAuth metadata of sites served from a custom subdirectory, so MCP clients accept the connection.
- c2daee4: Fix MCP sign-in showing "This authorization link has expired" after login on sites served from a custom subdirectory.
- 348a04d: Coalesce typing-prefix search_type_query events and skip single-character ASCII queries before flushing insights batches.
## 0.29.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "0.30.0",
"version": "0.29.0",
"private": true,
"dependencies": {
"@base-ui/react": "catalog:",
@@ -33,7 +33,7 @@ const SECONDARY_COLOR_CLASSES = tcls(
'hover:not-disabled:depth-flat:bg-secondary-hover',
'hover:not-disabled:text-secondary',
'contrast-more:bg-secondary-subtle',
'disabled:text-secondary/8',
'disabled:text-secondary',
'border-secondary',
'hover:border-secondary-hover',
'disabled:border-secondary',
@@ -158,8 +158,6 @@ export function ScrollSectionsList({ sections }: { sections: DocumentSection[] }
section.depth > 2
? 'sidebar-list-line:pl-9'
: 'sidebar-list-line:pl-6',
'opacity-8',
'contrast-more:opacity-11',
'sidebar-list-default:rounded-l-none!',
'sidebar-list-default:border-l',
@@ -5,17 +5,8 @@ import { type ClassValue, tcls } from '@/lib/tailwind';
/**
* Icon shown beside a section in the site section tabs.
*/
export function SectionIcon(props: { icon: IconName; isActive: boolean; className?: ClassValue }) {
const { icon, isActive, className } = props;
export function SectionIcon(props: { icon: IconName; className?: ClassValue }) {
const { icon, className } = props;
return (
<Icon
icon={icon}
className={tcls(
'size-[1em] shrink-0 text-inherit opacity-8',
isActive && 'text-inherit opacity-10',
className
)}
/>
);
return <Icon icon={icon} className={tcls('size-[1em] shrink-0 text-inherit', className)} />;
}
@@ -125,11 +125,9 @@ export function SiteSectionListItem(props: {
)}
>
{item.icon ? (
<SectionIcon icon={item.icon as IconName} isActive={isActive} />
<SectionIcon icon={item.icon as IconName} />
) : (
<span className={tcls('text-sm opacity-8', isActive && 'opacity-10')}>
{item.title.substring(0, 2)}
</span>
<span className="text-sm">{item.title.substring(0, 2)}</span>
)}
</div>
{item.title}
@@ -180,11 +178,9 @@ export function SiteSectionGroupItem(props: {
)}
>
{group.icon ? (
<SectionIcon icon={group.icon as IconName} isActive={isActiveGroup} />
<SectionIcon icon={group.icon as IconName} />
) : (
<span className={`text-sm opacity-8 ${isActiveGroup && 'opacity-10'}`}>
{group.title.substring(0, 2)}
</span>
<span className="text-sm">{group.title.substring(0, 2)}</span>
)}
</div>
{group.title}
@@ -212,16 +208,7 @@ export function SiteSectionGroupItem(props: {
<ToggleChevron
open={isOpen}
orientation="right-to-down"
className={tcls(
'shrink-0',
'size-3',
'm-1',
'transition-opacity',
'text-current',
'opacity-6',
'group-hover:opacity-11',
'contrast-more:opacity-11'
)}
className={tcls('shrink-0', 'size-3', 'm-1', 'text-current')}
/>
</span>
</button>
@@ -210,7 +210,7 @@ const SectionTab = React.forwardRef(function SectionTab(
size="small"
variant="blank"
{...rest}
icon={icon ? <SectionIcon isActive={isActive} icon={icon} /> : null}
icon={icon ? <SectionIcon icon={icon} /> : null}
label={title}
trailing={isGroup ? <ToggleChevron /> : null}
active={isActive}
@@ -375,7 +375,7 @@ function SectionGroupTile(props: {
: 'text-tint-strong group-hover/section-tile:bg-tint-base'
)}
>
<SectionIcon isActive={isActive} icon={icon as IconName} />
<SectionIcon icon={icon as IconName} />
</div>
)}
<div className="flex min-w-0 flex-col gap-0.5">
@@ -406,9 +406,7 @@ function SectionGroupTile(props: {
)}
>
<div className="mb-1 mt-2 flex min-w-0 gap-2 px-2.5 font-heading text-xs font-semibold text-tint-subtle">
{icon && (
<SectionIcon className="mt-0.5" isActive={false} icon={icon as IconName} />
)}
{icon && <SectionIcon className="mt-0.5" icon={icon as IconName} />}
<span className="min-w-0 flex-1 whitespace-normal">{title}</span>
</div>
<ul
@@ -75,7 +75,7 @@ export function PageGroupItem(props: { page: ClientTOCPageGroup; isFirst?: boole
'toc-group-chevron ml-auto mr-1 flex shrink-0 transition-opacity duration-150',
isOpen
? 'pointer-events-none opacity-0 delay-75'
: 'opacity-6 delay-0'
: 'opacity-11 delay-0'
)}
>
<ToggleChevron
@@ -53,10 +53,7 @@ export function PageLinkItem(props: { page: ClientTOCPageLink }) {
'place-self-start',
'shrink-0',
'text-current',
'transition-all',
'opacity-6',
'group-hover/toclink:opacity-11',
'contrast-more:opacity-11'
'transition-all'
)}
/>
) : null}
@@ -12,7 +12,6 @@ export function TOCPageIcon({ page }: { page: Pick<RevisionPage, 'emoji' | 'icon
page={page}
style={tcls(
'text-base',
'in-[.toclink]:text-tint-strong/6',
'group-aria-current-page/toclink:text-primary-subtle',
'contrast-more:group-aria-current-page/toclink:text-primary',
@@ -165,11 +165,7 @@ function Toggler(props: {
return (
<Button
icon={
<ToggleChevron
open={isOpen}
orientation="right-to-down"
className="m-0! size-3! opacity-6 group-hover:opacity-11"
/>
<ToggleChevron open={isOpen} orientation="right-to-down" className="m-0! size-3!" />
}
onClick={(event) => {
event.preventDefault();
@@ -9,7 +9,7 @@ export const ToCItemBaseStyles = [
export const ToCLinkItemStyles = [
'group/toclink toclink relative transition-colors',
ToCItemBaseStyles,
'text-balance font-normal text-sm text-tint-strong/7 hover:bg-tint-hover hover:text-tint-strong contrast-more:text-tint-strong',
'text-balance font-normal text-sm text-tint hover:bg-tint-hover hover:text-tint-strong contrast-more:text-tint-strong',
'contrast-more:hover:text-tint-strong contrast-more:hover:ring-1 contrast-more:hover:ring-tint-12',
];
@@ -37,7 +37,7 @@ export const variantClasses = {
'contrast-more:text-contrast-primary-solid',
'disabled:border-primary-2',
'disabled:bg-primary-subtle',
'disabled:text-primary/8',
'disabled:text-primary',
],
blank: [
'bg-transparent',
@@ -53,8 +53,8 @@ export const variantClasses = {
'aria-expanded:bg-tint-hover',
'aria-expanded:text-tint-strong',
'contrast-more:bg-tint-subtle',
'disabled:text-tint/8',
'disabled:bg-transparent',
'disabled:text-tint',
'disabled:bg-tint-subtle',
],
secondary: [
'bg-tint',
@@ -65,7 +65,7 @@ export const variantClasses = {
'hover:not-disabled:text-tint',
'contrast-more:bg-tint-subtle',
'disabled:bg-transparent',
'disabled:text-tint/8',
'disabled:text-tint',
],
header: [
'bg-tint-base text-tint',
@@ -25,7 +25,7 @@ export function Checkbox({ className, size = 'medium', ...props }: CheckboxProps
'circular-corners:rounded-md',
'straight-corners:rounded-none',
'ring-1',
'ring-tint-12/4',
'ring-tint-11',
'ring-inset',
'flex',
'items-center',
@@ -11,11 +11,7 @@ export function ToggleChevron(props: {
orientation?: 'down-to-up' | 'right-to-down'; // The direction of the chevron when open.
className?: ClassValue;
}) {
const {
open,
orientation = 'down-to-up',
className = 'opacity-6 group-hover/dropdown:opacity-11',
} = props;
const { open, orientation = 'down-to-up', className } = props;
const classes = {
'down-to-up': {