mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-11-18 14:20:18 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 973d4db205 | |||
| 386a5c18eb | |||
| a3b5ce5b7e | |||
| 818cbbeb38 |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Keep links in generated Markdown usable outside the source page.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Fade the bottom of collapsed code blocks so readers can tell there is more code, matching the editor.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Bump Next.js to 16.4.6 and OpenNext (Cloudflare 1.20.17, AWS 4.1.16), keeping the dev-mode OOM patch.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Fix horizontal page scroll caused by card carousels bleeding past the viewport.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Fix the table of contents keeping published pages busy in older Chrome versions such as Chrome 130.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Fix `'use cache'` entries never being stored in or read from R2 and the regional cache on Cloudflare.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Remove duplicated declarations from the global stylesheet.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@gitbook/icons": minor
|
||||
---
|
||||
|
||||
Add a `@gitbook/icons/validateIconName` entry that validates icon names without loading the icon labels and search terms.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Keep inline code and highlighted text readable when a paragraph crosses the bottom edge of a background page cover.
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
"@gitbook/icons": patch
|
||||
---
|
||||
|
||||
Add a skip link, keyboard navigation between content tabs, focusable table of contents toggles, and hide decorative icons from assistive technologies.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Reduce memory and CPU use of the OpenNext workers: minify the middleware, resolve the site context once per request, cache parsed OpenAPI descriptions across a spec, drop the redis client and the unused force-revalidate route from the server bundle.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Load the OpenAPI stylesheet only on pages with OpenAPI blocks.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Limit the MCP `searchDocumentation` tool to one language: the one the client passes in the new optional `language` argument, or else the language of the site variant the MCP endpoint is served from.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Flush insights events when the page is hidden, preload the search index at low priority and prioritize the dark page cover on dark-default sites.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@gitbook/react-openapi": patch
|
||||
---
|
||||
|
||||
Copy the current spec's server in OpenAPI endpoint URLs instead of a server kept from a previously visited page.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Show H3 headings in the page outline.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Respect disabled change request previews on published sites.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Fix the search button accessible name, hoverable link previews, IME-safe Enter on Safari, cookie banner semantics, active outline item announcement and textarea shrinking.
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
"@gitbook/embed": patch
|
||||
---
|
||||
|
||||
Respect reduced motion for enter and exit animations, keep the header separator and input focus visible in forced colors mode, and size mobile surfaces with dynamic viewport units.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Send only the site origin as referrer to third parties, and only let the embedding page open the embed messaging channel.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Remove the ChatGPT-specific plain text response for Markdown and llms.txt routes; these now always serve `text/markdown`.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Send site searches straight to the search API when the site hands out a search pass, and use the site's search route when it does not or when the API refuses a search.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Send each search once on sites without a top header, and make search work between 768 and 1023 px wide.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Show loading rows shaped like search results while search waits for the server.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Stop caching site search results in the framework cache, so every search reaches the API.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Show one server-ordered search list and open its top result on Enter.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Follow the API's cache lifetime for site data, so a site preview shows layout changes soon after they are saved.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Render small cards in a responsive four-column grid and carousel.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Ignore tag category references when displaying assigned tags and update filters.
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"packages/embed": {
|
||||
"name": "@gitbook/embed",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.1",
|
||||
"dependencies": {
|
||||
"@gitbook/api": "catalog:",
|
||||
"bidc": "catalog:",
|
||||
@@ -109,7 +109,7 @@
|
||||
},
|
||||
"packages/gitbook": {
|
||||
"name": "gitbook",
|
||||
"version": "0.28.2",
|
||||
"version": "0.28.3",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "catalog:",
|
||||
"@cloudflare/workers-types": "^4.20251011.0",
|
||||
@@ -228,7 +228,7 @@
|
||||
},
|
||||
"packages/icons": {
|
||||
"name": "@gitbook/icons",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"bin": {
|
||||
"gitbook-icons": "./bin/gitbook-icons.js",
|
||||
},
|
||||
@@ -266,7 +266,7 @@
|
||||
},
|
||||
"packages/react-contentkit": {
|
||||
"name": "@gitbook/react-contentkit",
|
||||
"version": "0.7.18",
|
||||
"version": "0.7.19",
|
||||
"dependencies": {
|
||||
"@gitbook/api": "catalog:",
|
||||
"@gitbook/icons": "workspace:*",
|
||||
@@ -309,7 +309,7 @@
|
||||
},
|
||||
"packages/react-openapi": {
|
||||
"name": "@gitbook/react-openapi",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "catalog:",
|
||||
"@gitbook/expr": "workspace:*",
|
||||
@@ -1021,43 +1021,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.93.0", "", { "os": "android", "cpu": "arm" }, "sha512-KKw70pbD5Pvq3G2lJ+WQ71XPMjCmg37rkSe2+mDqCRP3PoTSdDMuEi4UOnE8JBtyNM7bek61EC2s0Jt7S7u+Sg=="],
|
||||
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.94.0", "", { "os": "android", "cpu": "arm" }, "sha512-730FKSBsKg/NawYnpI3gXRroXptOVqY32iYBPLUZaSx0vgYzOeiNtwojZL4gJdzo9wDvHUlstShmGRHrWcbRYg=="],
|
||||
|
||||
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.93.0", "", { "os": "android", "cpu": "arm64" }, "sha512-fvr1fTUZGelwRxKDt64pf28aL1WaWgviwz3X+E/FcRYvrlEahH0NECRz/c1SY+K+KWmZk5uAf6h1kQnyBkp/2A=="],
|
||||
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.94.0", "", { "os": "android", "cpu": "arm64" }, "sha512-8v8TICIiZpXLot1HSq5+vsG9NEKQ5czQBYlUqJR75OVfFDr3cGOmRU/CtHDWnS4tm8nW+Z4Y357qGToSfYqFvA=="],
|
||||
|
||||
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.93.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-VdvSN9JRf4Es6ZzoAdvEeh8tgKdw8L4H82WmA8MMPVfPdZGCwE/nI27Z1HrRHYQhPxOh4kmnxQEioSUFrOvDaw=="],
|
||||
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.94.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-NePcRMO/ltt1Pnytohl6pl0bd/QyRX8HbpptuDz9LK7FTsFD4lKxDMBt7di9k6IFLO0J05jO2nm7wGqIh6dRHA=="],
|
||||
|
||||
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.93.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-QR1V890Ml0YGRG0F/iV0K9igG+pOhe+VWd+aZnxY849rRHZf3F2gEoQks5+GVHf105X9Mh/6HdShTP5juekG2g=="],
|
||||
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.94.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-QV+m+OaEgLmYyillvP1wKXhMm6tDZEWx3vG7Wjmx9ybg15+6YMfqzvp6e+uPukC6zNywuule0vMn0fZgihZzZA=="],
|
||||
|
||||
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.93.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-jDfIbi30zZaKi+rTvig3sge+Xhi8pFFSgHxb0jzovc4qh8ETm/irKV9c7N/JsuwnYc5sbvf4IC8w1vQQ0IL+BA=="],
|
||||
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.94.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-KVZjca581nrV6P71kZ9M1otBib9LH0IMn9rr4mrnbRp18V0HiZhBHbU26gji/Ieq2G34qMacnMc3zrmKmvWqWA=="],
|
||||
|
||||
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.93.0", "", { "os": "linux", "cpu": "arm" }, "sha512-qtxZ714ND/koFgVH00QgxlzZiIbRPmguaPhnHRU5DFFtrtEdOrSnZD4U/H2AzXrXkZ59eQbMBnJwbum5XohrIQ=="],
|
||||
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.94.0", "", { "os": "linux", "cpu": "arm" }, "sha512-AMQtgQJk8DgdIV+qaQ5sFoHAko4iKa8zo+gYqELy2grtU8hXWB08DAGB3u90aQL1YSxbd3zqHjgcODBHDFyzBQ=="],
|
||||
|
||||
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.93.0", "", { "os": "linux", "cpu": "arm" }, "sha512-5pJ9NjMvH7WMUqXB6bTTOSemBm39w2cod27Hu3+Yom/GhbTeNXlYcpDx1o4CgBP6fhp0YHG66TNdVaUm6sHjsA=="],
|
||||
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.94.0", "", { "os": "linux", "cpu": "arm" }, "sha512-ZLzoGVGAmQkp9leeB5rNxAXLcvlmkmd/GY71LKd5uikk+28NEApY3S2FB3pq6MkfOCFFnFg6QgD9lJIjd07D0Q=="],
|
||||
|
||||
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.93.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-pRf+7jtbt2fHE23SX7qBxRgnBZicUgsoCK1PVIjnOk+t3a6UBkpt/GrKI99WlxsKUxftz/5nv/kfKvScmYywkw=="],
|
||||
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.94.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-N1dW6o7cY90hLVkDsvz8nWIFOwbO+n272pvW7uLYB7u47HagJVnLChfK6QA9dWFdiPudud9zfksVUOciHc5PNA=="],
|
||||
|
||||
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.93.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-zM8Fd/K8sqGvsBcJBZ3oVZ3ctGWbszA08IaGt5gFFF5RcunppAI/ZnAXbouABvnWeJ//S44KKlfPZnDDbeiphg=="],
|
||||
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.94.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-7tCF4OV/bGDQ2xxgb+sDI97SpmmDrUII4JxTG553voJVA9cnkbXSGSXzo78Ax73BuhEOPoQc2Qi6VrfT0cDG2A=="],
|
||||
|
||||
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.93.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-7qKCnvhZKDXJG2pdbLazd2hw4FxjJHbZOFrrbzyy5PdHfPLH9vnNUa1le01A8uItZuYKPBPncH+HCoEiFT4SgA=="],
|
||||
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.94.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-B5vUHE4wNisVEuaYxwFUn6tY+vw7A+9APxxqGKI+UmP3yKLpkhnt0qsaCrzjpX55F8rCRHBaTvIDdYo32NE36g=="],
|
||||
|
||||
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.93.0", "", { "os": "linux", "cpu": "none" }, "sha512-2pgulxC6G8V5wE750NJE/fRkf9aO6i6yoj10wyaR2EdiNtan4OemsOtsQ0ZTXGdY8Q3IoTmlND3GYvjJsvikYg=="],
|
||||
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.94.0", "", { "os": "linux", "cpu": "none" }, "sha512-/U0b15+c4hTodo8YhEqDlQ6OjnGKvc8igjM/mh23ukqqCUBKiBCaxqUV8bcaofK9uZ+f8wCygkyXLS6LN25YSA=="],
|
||||
|
||||
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.93.0", "", { "os": "linux", "cpu": "none" }, "sha512-yWsn6Gg2PnGG5jlyDz5+pHGiMTMiy4adaa4WRMzDgzB8efaShk1JMmTHIBSVLQMh0tYXRs4CN5uJCO79r4Mi4g=="],
|
||||
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.94.0", "", { "os": "linux", "cpu": "none" }, "sha512-ba94Vwl0qOnwXIXNDR33AEbLXuX++ckM74t+9Te7CiPSPAHivhOYyeEkUAicrvOEei1pxXkWggLbFeBFFBTuHA=="],
|
||||
|
||||
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.93.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-WCn5plwp/ezS2RDPQKp0/EXEVRr9/dDexUdRKmsMFqzNM5xBSZ1wbsi3PuMk1VfkMRnI5BuazCsziCWMXRDOlw=="],
|
||||
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.94.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-GVwwwms3O8pdgbCiPavwq2vltyB4661GkDz6kJduZ0E5nsSJUDJ0svaP+ePYpuDVYi4+K1qhCKnWa/Ec8I4LUA=="],
|
||||
|
||||
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.93.0", "", { "os": "linux", "cpu": "x64" }, "sha512-F2CGjb9LAkzH+IYTZSzd1klQ1vk5z6Utjax64WeLByCkYXbVDbsun+Oy2hLfW2MDSKCvW+jwy/9ld0EPgdeu+A=="],
|
||||
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.94.0", "", { "os": "linux", "cpu": "x64" }, "sha512-iUfCFJN8ZIresSnpTfiIkhF3s8X+XA4I9KJ249QwR2QYTMwh0+pla1pj1xaFi+HtR9McjM4Jaemf70HzX7ilOQ=="],
|
||||
|
||||
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.93.0", "", { "os": "linux", "cpu": "x64" }, "sha512-plf5DE2objcG8Tf7mXRuRa8tT8rzDkpjqXQtKoGsKHWkpgsialbON1+cCtoSEUTVbQUjXvuAm8vV9+3rR0yCBw=="],
|
||||
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.94.0", "", { "os": "linux", "cpu": "x64" }, "sha512-RqWVeWpDACS4Oh0m21OBmy+CQ50CbbhuHFmNNPVS2P/4R3d188MjEuEuV7So82/tAM8UAT+UuMDtRDESd9NJ7g=="],
|
||||
|
||||
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.93.0", "", { "os": "none", "cpu": "arm64" }, "sha512-Kp2yJrKvoTe9FfKdO/xwLNUbs2bYTMKx0+aoQD1s0h/Tx0kSgtHSdGmrk8tTKdluosjFbo88qYRIaNIX43AfFw=="],
|
||||
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.94.0", "", { "os": "none", "cpu": "arm64" }, "sha512-K/2DHOUoypwYVqzxJMRPdMuBKjAetZEAsGPP7rHimd+2+5J1TxM+17pG8kw+ayH4+rqBXiPd+H9wgPcU+fF77A=="],
|
||||
|
||||
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.93.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-vigjcHCFsR6KjnWTEVfaCxcMYapEuaK9FZa1MpewwQ1S+Xud3v0okfkj1RySsD6RF1NRHIjSlQSalTnKIaj3nA=="],
|
||||
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.94.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-hYOCaOJiB4ZCGswBWKl3JQrhqu6mnC5DCUw/1UMNzRXgsHIJ0V226J43LAVICVIDGlhFUZTYShFW+wHWpt6qCQ=="],
|
||||
|
||||
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.93.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-0Ot3BEe/AAr2/uQhe55r8CmPlperYk2mQmxdutOru7oU0kir6IiEVHb1TG3GORRlfra97lPHVDLhgmihiKzLrg=="],
|
||||
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.94.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-1l1FDlzbPmAeDoZ8UGspOE2dOmz1ZL6SlDsvOmRCmWSQjCdTy5LzUepS8mO/SGpAoz4D6WAt/yNZAUyHqbkmkQ=="],
|
||||
|
||||
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.93.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ZzzIIVs/Qkm8trUWYKF0OYub5ALlv50/3gsEZbKAvWgz+yNJX6uRmQ8ySPXU2Q0/Y9m4JCOjhpmC8XUYbPHX5Q=="],
|
||||
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.94.0", "", { "os": "win32", "cpu": "x64" }, "sha512-I3eZdd4bemIJQDNv9XDV/FEofDxIoN32tzCv98wIgLdW05EqxZb5hF4AwPrRzHD/dQhl0n7KgPy5AQPfM0HWrA=="],
|
||||
|
||||
"@panzoom/panzoom": ["@panzoom/panzoom@4.6.1", "", {}, "sha512-ogf/KhHHjj+DYAvHfaf3TXMQ8OE36pJtKpabLlx1OmpjcgtpCvkUoCiNONA8kuVRPGJdLiqMf0n8LRFXj1OyuA=="],
|
||||
|
||||
@@ -1363,17 +1363,17 @@
|
||||
|
||||
"@tsconfig/strictest": ["@tsconfig/strictest@2.0.6", "", {}, "sha512-tPOhmDhIUcDjvpDDYyiUdssP84Eqm7n5KxJe5J3/g+s6xoDIPAf+SIn06dhw7VkhxIvLOnhDDrX7tsqMHNEhDg=="],
|
||||
|
||||
"@turbo/darwin-64": ["@turbo/darwin-64@2.11.11", "", { "os": "darwin", "cpu": "x64" }, "sha512-HMMeUIEAsmyIbSYn1ySvF/4gGMa0joiTMq4dQDuloIAnOpbtFT3JEiVsYnASdTWDXvplbRbZlqjU1EBeSR9G1A=="],
|
||||
"@turbo/darwin-64": ["@turbo/darwin-64@2.11.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-IF9fY2GVKpwSs+aAmby8BKb8qgGPZl0lhBER3HpPRxfY5jtA3veKXPqphiI5+jEhqXh3OXXpG73kHv990lqfWQ=="],
|
||||
|
||||
"@turbo/darwin-arm64": ["@turbo/darwin-arm64@2.11.11", "", { "os": "darwin", "cpu": "arm64" }, "sha512-+8iySNgqYWY6PZYUQzYu6zn0C04z2OEq1vQ6oMGsJ9sxN6wOpg1gzi1AJ5VKDHviWvMUjhqng51hTEQZOuiqYQ=="],
|
||||
"@turbo/darwin-arm64": ["@turbo/darwin-arm64@2.11.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-2gEvJbwUEupoWFbMPCDU1ZxHXRqaq3w92gFBZ4+7ovJw90qONecUvX8IOQe/8pr3qMmYMiNjA5/+HkUNmTTFgg=="],
|
||||
|
||||
"@turbo/linux-64": ["@turbo/linux-64@2.11.11", "", { "os": [ "linux", "android", ], "cpu": "x64" }, "sha512-uImTKFYCFKsoFxjaXeJXlMPv4uU3OIIDjyzoIwYVqOtu9LnCZ/5/fzu/WP6+G9YfwGAPRplTHkKFfcI5t97RGw=="],
|
||||
"@turbo/linux-64": ["@turbo/linux-64@2.11.12", "", { "os": [ "linux", "android", ], "cpu": "x64" }, "sha512-2yULGKE5+uVxU0ELgq3vprzBE/Ua/Loaui0eO1E17hFyCeesG9UpQpWmTlf/MjaU0kTlVAh6CfbMsziaTELSMw=="],
|
||||
|
||||
"@turbo/linux-arm64": ["@turbo/linux-arm64@2.11.11", "", { "os": [ "linux", "android", ], "cpu": "arm64" }, "sha512-Y7xffSVfyyYRGzNy6PLdrFL4xXN6iTuR3W0SyJvH/yd3d4defA6dansZwJpPDVnIpD8a2Qn256DwY/Qin4Ip4g=="],
|
||||
"@turbo/linux-arm64": ["@turbo/linux-arm64@2.11.12", "", { "os": [ "linux", "android", ], "cpu": "arm64" }, "sha512-OK2PbiujzK3y3WleafqL6eUa5SaKvsTFOnpSIXD6jDxAPqlF8bEr/VWxbThHWvN8XV/4iKi/mDXJAM9Tpx9PDg=="],
|
||||
|
||||
"@turbo/windows-64": ["@turbo/windows-64@2.11.11", "", { "os": "win32", "cpu": "x64" }, "sha512-e2WqNtkPGo3QDwNNwwBo89Dx3PtSJ9Wp9QuRNzn80rrRnSHB+1mfBMZTpdHjA8/G/sG9rl76TdWdpgVsimjRdg=="],
|
||||
"@turbo/windows-64": ["@turbo/windows-64@2.11.12", "", { "os": "win32", "cpu": "x64" }, "sha512-2LOX0kvuvtDtLYH2HQinE3v4Ch8OcR+8gO1RacAP1s1j/m1Spf/HbBGn0EOlkEBsBzKnnxFnYqBGYvBfzrtLNg=="],
|
||||
|
||||
"@turbo/windows-arm64": ["@turbo/windows-arm64@2.11.11", "", { "os": "win32", "cpu": "arm64" }, "sha512-LURivfmgv34Osm8NR1gZGx4vdlux9KAgRM+FoooXNG0838ff0+akWZ76iPSke0NS2rsf7Z4Gw+YSaygzNTZuRA=="],
|
||||
"@turbo/windows-arm64": ["@turbo/windows-arm64@2.11.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-Mg8HvtTCJLIfNdrXaU+CoLRzrMIgWBRTBohatbrsdfyO0Iw6Nvr6gC2bwiQXflSQ8u/7yWJ/J91f/H2u52lqeQ=="],
|
||||
|
||||
"@tusbar/cache-control": ["@tusbar/cache-control@1.0.2", "", {}, "sha512-PXfjYTYBVvMPYCLDWj+xIOA9ITFbbhWCHzLcqUCJ5TPGm4JO4cxpGb7x3K8Q1K1ADgNgfBxLsDcTMVRydtZB9A=="],
|
||||
|
||||
@@ -2697,7 +2697,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.93.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.93.0", "@oxlint/binding-android-arm64": "1.93.0", "@oxlint/binding-darwin-arm64": "1.93.0", "@oxlint/binding-darwin-x64": "1.93.0", "@oxlint/binding-freebsd-x64": "1.93.0", "@oxlint/binding-linux-arm-gnueabihf": "1.93.0", "@oxlint/binding-linux-arm-musleabihf": "1.93.0", "@oxlint/binding-linux-arm64-gnu": "1.93.0", "@oxlint/binding-linux-arm64-musl": "1.93.0", "@oxlint/binding-linux-ppc64-gnu": "1.93.0", "@oxlint/binding-linux-riscv64-gnu": "1.93.0", "@oxlint/binding-linux-riscv64-musl": "1.93.0", "@oxlint/binding-linux-s390x-gnu": "1.93.0", "@oxlint/binding-linux-x64-gnu": "1.93.0", "@oxlint/binding-linux-x64-musl": "1.93.0", "@oxlint/binding-openharmony-arm64": "1.93.0", "@oxlint/binding-win32-arm64-msvc": "1.93.0", "@oxlint/binding-win32-ia32-msvc": "1.93.0", "@oxlint/binding-win32-x64-msvc": "1.93.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2005", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-19JMsQFX+YvEbcUTFQxjTwhvs0Ibg0D6CFneSLgpwnACWcY/6LjhpGpkPodh0T5aIT1pjMTLlYaeBFzaVgugTA=="],
|
||||
"oxlint": ["oxlint@1.94.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.94.0", "@oxlint/binding-android-arm64": "1.94.0", "@oxlint/binding-darwin-arm64": "1.94.0", "@oxlint/binding-darwin-x64": "1.94.0", "@oxlint/binding-freebsd-x64": "1.94.0", "@oxlint/binding-linux-arm-gnueabihf": "1.94.0", "@oxlint/binding-linux-arm-musleabihf": "1.94.0", "@oxlint/binding-linux-arm64-gnu": "1.94.0", "@oxlint/binding-linux-arm64-musl": "1.94.0", "@oxlint/binding-linux-ppc64-gnu": "1.94.0", "@oxlint/binding-linux-riscv64-gnu": "1.94.0", "@oxlint/binding-linux-riscv64-musl": "1.94.0", "@oxlint/binding-linux-s390x-gnu": "1.94.0", "@oxlint/binding-linux-x64-gnu": "1.94.0", "@oxlint/binding-linux-x64-musl": "1.94.0", "@oxlint/binding-openharmony-arm64": "1.94.0", "@oxlint/binding-win32-arm64-msvc": "1.94.0", "@oxlint/binding-win32-ia32-msvc": "1.94.0", "@oxlint/binding-win32-x64-msvc": "1.94.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2007", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-Fnt+3wSKRhtLmvgRfxgRX0excSPCoyiXRol4eWKZLtXxWMQtwQ3KjKQUYXOw5loyinfnZfGzh4RCYf7opfL0vw=="],
|
||||
|
||||
"p-filter": ["p-filter@2.1.0", "", { "dependencies": { "p-map": "^2.0.0" } }, "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw=="],
|
||||
|
||||
@@ -3131,7 +3131,7 @@
|
||||
|
||||
"tsx": ["tsx@4.21.0", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="],
|
||||
|
||||
"turbo": ["turbo@2.11.11", "", { "optionalDependencies": { "@turbo/darwin-64": "2.11.11", "@turbo/darwin-arm64": "2.11.11", "@turbo/linux-64": "2.11.11", "@turbo/linux-arm64": "2.11.11", "@turbo/windows-64": "2.11.11", "@turbo/windows-arm64": "2.11.11" }, "bin": { "turbo": "bin/turbo" } }, "sha512-AI4UJbUE/2cVZdoXJ4PODc8qvrjhQQX9Fa93eKGOI6Ims/w7+kUIb9T1jhlgSnZcf+gtUruci/ohSwqtNNC5Yw=="],
|
||||
"turbo": ["turbo@2.11.12", "", { "optionalDependencies": { "@turbo/darwin-64": "2.11.12", "@turbo/darwin-arm64": "2.11.12", "@turbo/linux-64": "2.11.12", "@turbo/linux-arm64": "2.11.12", "@turbo/windows-64": "2.11.12", "@turbo/windows-arm64": "2.11.12" }, "bin": { "turbo": "bin/turbo" } }, "sha512-NbxpCtwXayklTelyQowpb6Qv483qLP+95cSD/gnpBaIL/tw14JtPhl1XIRwkz/tG2k5cq1De+xhX6/ph713Inw=="],
|
||||
|
||||
"type": ["type@2.7.3", "", {}, "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ=="],
|
||||
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.31.1",
|
||||
"oxfmt": "^0.62.0",
|
||||
"oxlint": "^1.93.0",
|
||||
"turbo": "^2.11.11",
|
||||
"oxlint": "^1.94.0",
|
||||
"turbo": "^2.11.12",
|
||||
"vercel": "50.37.3"
|
||||
},
|
||||
"packageManager": "bun@1.3.7",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @gitbook/embed
|
||||
|
||||
## 0.7.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 65210b7: Respect reduced motion for enter and exit animations, keep the header separator and input focus visible in forced colors mode, and size mobile surfaces with dynamic viewport units.
|
||||
|
||||
## 0.7.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@gitbook/api": "catalog:",
|
||||
|
||||
@@ -1,5 +1,48 @@
|
||||
# gitbook
|
||||
|
||||
## 0.28.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4eb32b1: Keep links in generated Markdown usable outside the source page.
|
||||
- 960d7ec: Fade the bottom of collapsed code blocks so readers can tell there is more code, matching the editor.
|
||||
- 818cbbe: Answer Assistant questions with medium reasoning instead of low, matching AI search.
|
||||
- ddccd3d: Bump Next.js to 16.4.6 and OpenNext (Cloudflare 1.20.17, AWS 4.1.16), keeping the dev-mode OOM patch.
|
||||
- 0c3a51e: Fix horizontal page scroll caused by card carousels bleeding past the viewport.
|
||||
- ae1e370: Fix the table of contents keeping published pages busy in older Chrome versions such as Chrome 130.
|
||||
- c85d84f: Fix `'use cache'` entries never being stored in or read from R2 and the regional cache on Cloudflare.
|
||||
- 5997a66: Remove duplicated declarations from the global stylesheet.
|
||||
- c3df458: Keep inline code and highlighted text readable when a paragraph crosses the bottom edge of a background page cover.
|
||||
- 265ca4b: Add a skip link, keyboard navigation between content tabs, focusable table of contents toggles, and hide decorative icons from assistive technologies.
|
||||
- 9fcde5f: Reduce memory and CPU use of the OpenNext workers: minify the middleware, resolve the site context once per request, cache parsed OpenAPI descriptions across a spec, drop the redis client and the unused force-revalidate route from the server bundle.
|
||||
- 9b5b8c8: Load the OpenAPI stylesheet only on pages with OpenAPI blocks.
|
||||
- a3b5ce5: Render the llms.txt directive as the first element in the page body so agents find it before the navigation.
|
||||
- adfd921: Limit the MCP `searchDocumentation` tool to one language: the one the client passes in the new optional `language` argument, or else the language of the site variant the MCP endpoint is served from.
|
||||
- 19660ed: Flush insights events when the page is hidden, preload the search index at low priority and prioritize the dark page cover on dark-default sites.
|
||||
- c09da2e: Show H3 headings in the page outline.
|
||||
- 6cdbafc: Respect disabled change request previews on published sites.
|
||||
- 19660ed: Fix the search button accessible name, hoverable link previews, IME-safe Enter on Safari, cookie banner semantics, active outline item announcement and textarea shrinking.
|
||||
- 65210b7: Respect reduced motion for enter and exit animations, keep the header separator and input focus visible in forced colors mode, and size mobile surfaces with dynamic viewport units.
|
||||
- 3e86382: Send only the site origin as referrer to third parties, and only let the embedding page open the embed messaging channel.
|
||||
- 7d1cd9f: Remove the ChatGPT-specific plain text response for Markdown and llms.txt routes; these now always serve `text/markdown`.
|
||||
- cf8c3d5: Send site searches straight to the search API when the site hands out a search pass, and use the site's search route when it does not or when the API refuses a search.
|
||||
- adbec4c: Send each search once on sites without a top header, and make search work between 768 and 1023 px wide.
|
||||
- 8f5175e: Show loading rows shaped like search results while search waits for the server.
|
||||
- 386a5c1: Show search results with one-line breadcrumbs and no icons or shortcut hints, and select the result under the mouse.
|
||||
- b145bfc: Stop caching site search results in the framework cache, so every search reaches the API.
|
||||
- 7856e08: Show one server-ordered search list and open its top result on Enter.
|
||||
- 1c71849: Follow the API's cache lifetime for site data, so a site preview shows layout changes soon after they are saved.
|
||||
- b5f7e55: Render small cards in a responsive four-column grid and carousel.
|
||||
- 8dd308b: Ignore tag category references when displaying assigned tags and update filters.
|
||||
- Updated dependencies [9fcde5f]
|
||||
- Updated dependencies [265ca4b]
|
||||
- Updated dependencies [262749a]
|
||||
- Updated dependencies [65210b7]
|
||||
- @gitbook/icons@0.6.0
|
||||
- @gitbook/react-openapi@2.0.2
|
||||
- @gitbook/embed@0.7.1
|
||||
- @gitbook/react-contentkit@0.7.19
|
||||
|
||||
## 0.28.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -441,6 +441,33 @@ const searchTestCases: Test[] = [
|
||||
expect(new URL(page.url()).pathname).toBe(new URL(topResult.href, page.url()).pathname);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Search - Enter opens the result under the mouse',
|
||||
url: `blocks/lists${getCustomizationURL({
|
||||
ai: {
|
||||
mode: CustomizationAIMode.None,
|
||||
},
|
||||
})}`,
|
||||
screenshot: false,
|
||||
run: async (page) => {
|
||||
await waitForCookiesDialog(page);
|
||||
const searchInput = page.getByTestId('search-input');
|
||||
await searchInput.focus();
|
||||
await searchInput.pressSequentially('gitbook');
|
||||
|
||||
const searchPopup = page.getByTestId('search-popover');
|
||||
const hovered = searchPopup.getByTestId('search-page-result').nth(1);
|
||||
await hovered.hover();
|
||||
await expect(hovered).toHaveClass(/is-active/);
|
||||
await expect(searchPopup.locator('[role="option"].is-active')).toHaveCount(1);
|
||||
|
||||
const href = await hovered.getAttribute('href');
|
||||
await page.keyboard.press('Enter');
|
||||
await expect
|
||||
.poll(() => new URL(page.url()).pathname, { timeout: 20000 })
|
||||
.toBe(new URL(href ?? '', page.url()).pathname);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Ask - AI Mode: Assistant - Complete flow',
|
||||
url: getCustomizationURL({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitbook",
|
||||
"version": "0.28.2",
|
||||
"version": "0.28.3",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@base-ui/react": "catalog:",
|
||||
|
||||
@@ -65,7 +65,7 @@ export async function* streamAIChatResponse({
|
||||
},
|
||||
]
|
||||
: [],
|
||||
model: AIModel.ReasoningLow,
|
||||
model: AIModel.ReasoningMedium,
|
||||
previousResponseId,
|
||||
toolCall,
|
||||
tools,
|
||||
|
||||
@@ -52,6 +52,7 @@ export function EmbeddableSearch(props: EmbeddableSearchProps) {
|
||||
onInputKeyDown,
|
||||
inputHandlers,
|
||||
onResultSelect,
|
||||
onResultHover,
|
||||
query,
|
||||
results,
|
||||
resultsId,
|
||||
@@ -80,6 +81,7 @@ export function EmbeddableSearch(props: EmbeddableSearchProps) {
|
||||
resultsId={resultsId}
|
||||
resultsRef={resultsRef}
|
||||
onResultSelect={onResultSelect}
|
||||
onResultHover={onResultHover}
|
||||
showAsk={showAsk}
|
||||
dataTestId="embed-search"
|
||||
input={
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
hasTopLevelBlock,
|
||||
isNodeEmpty,
|
||||
} from '@/lib/document';
|
||||
import { getLLMsTxtURL, getPageMarkdownURL } from '@/lib/llms-directive';
|
||||
import type { AncestorRevisionPage } from '@/lib/pages';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
import { getPageRSSURL } from '@/routes/rss';
|
||||
@@ -122,7 +121,6 @@ export async function PageBody(props: {
|
||||
)}
|
||||
>
|
||||
<PreservePageLayout wideLayout={wideLayout} pageHasToc={pageHasToc} />
|
||||
<LLMsTxtPageDirective context={context} page={page} />
|
||||
{page.cover && page.layout.cover && page.layout.coverSize === 'hero' ? (
|
||||
<PageCover as="hero" page={page} cover={page.cover} context={context} />
|
||||
) : null}
|
||||
@@ -207,14 +205,3 @@ export async function PageBody(props: {
|
||||
</CurrentPageProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function LLMsTxtPageDirective(props: { context: GitBookSiteContext; page: RevisionPageDocument }) {
|
||||
const { context, page } = props;
|
||||
|
||||
return (
|
||||
<div className="sr-only">
|
||||
For the complete documentation index, see <a href={getLLMsTxtURL(context)}>llms.txt</a>.
|
||||
This page is also available as <a href={getPageMarkdownURL(context, page)}>Markdown</a>.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import { KeyboardShortcut } from '../primitives/KeyboardShortcut';
|
||||
import { addRecentSearchQuery } from './recent-queries';
|
||||
import { SearchResultItem } from './SearchResultItem';
|
||||
import { useSearchLink } from './useSearch';
|
||||
@@ -16,10 +15,10 @@ export function SearchAskBar(props: {
|
||||
query: string;
|
||||
assistant: Assistant;
|
||||
active?: boolean;
|
||||
withShortcut?: boolean;
|
||||
onHover?: () => void;
|
||||
onSelect?: () => void;
|
||||
}) {
|
||||
const { query, assistant, active = false, withShortcut = false, onSelect } = props;
|
||||
const { query, assistant, active = false, onHover, onSelect } = props;
|
||||
const language = useLanguage();
|
||||
const { siteSpaceId } = useCurrentContent();
|
||||
const getSearchLinkProps = useSearchLink();
|
||||
@@ -43,18 +42,14 @@ export function SearchAskBar(props: {
|
||||
<SearchResultItem
|
||||
{...linkProps}
|
||||
active={active}
|
||||
onHover={onHover}
|
||||
action={tString(language, 'ask')}
|
||||
leadingIcon={assistant.icon}
|
||||
data-testid="search-ask-question"
|
||||
className="gutter-stable rounded-none! shrink-0 overflow-y-scroll border-t border-tint-subtle pl-6 pr-5"
|
||||
>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="line-clamp-1">
|
||||
{t(language, 'ai_chat_ask_query', assistant.label, query)}
|
||||
</div>
|
||||
{withShortcut ? (
|
||||
<KeyboardShortcut className="bg-tint-base" keys={['mod', 'i']} />
|
||||
) : null}
|
||||
<div className="line-clamp-1">
|
||||
{t(language, 'ai_chat_ask_query', assistant.label, query)}
|
||||
</div>
|
||||
</SearchResultItem>
|
||||
);
|
||||
|
||||
@@ -58,6 +58,7 @@ export function SearchContainer({
|
||||
onInputKeyDown,
|
||||
inputHandlers,
|
||||
onResultSelect,
|
||||
onResultHover,
|
||||
open,
|
||||
query,
|
||||
results,
|
||||
@@ -179,6 +180,7 @@ export function SearchContainer({
|
||||
resultsId={resultsId}
|
||||
resultsRef={resultsRef}
|
||||
onResultSelect={onResultSelect}
|
||||
onResultHover={onResultHover}
|
||||
showAsk={showAsk}
|
||||
scopeControl={scopeControlNode}
|
||||
fillHeight={usesSideSheet || shouldFillHeight}
|
||||
|
||||
@@ -9,8 +9,6 @@ import {
|
||||
EmbeddableFrameMain,
|
||||
EmbeddableFrameSidebar,
|
||||
} from '../Embeddable/EmbeddableFrame';
|
||||
import { Tooltip } from '../primitives';
|
||||
import { KeyboardShortcut } from '../primitives/KeyboardShortcut';
|
||||
import { ScrollContainer } from '../primitives/ScrollContainer';
|
||||
import { SearchAskAnswer } from './SearchAskAnswer';
|
||||
import { SearchAskBar } from './SearchAskBar';
|
||||
@@ -31,6 +29,8 @@ export function SearchFrame(props: {
|
||||
resultsId: string;
|
||||
resultsRef: React.Ref<SearchResultsRef>;
|
||||
onResultSelect?: () => void;
|
||||
/** Select the result under the mouse, so hover and keyboard share one highlight. */
|
||||
onResultHover?: (index: number) => void;
|
||||
scopeControl?: React.ReactNode;
|
||||
showAsk: boolean;
|
||||
sidebar?: React.ReactNode;
|
||||
@@ -52,6 +52,7 @@ export function SearchFrame(props: {
|
||||
resultsId,
|
||||
resultsRef,
|
||||
onResultSelect,
|
||||
onResultHover,
|
||||
scopeControl,
|
||||
showAsk,
|
||||
sidebar,
|
||||
@@ -99,8 +100,16 @@ export function SearchFrame(props: {
|
||||
<ScrollContainer
|
||||
orientation="vertical"
|
||||
className={tcls(fillHeight ? 'min-h-0 flex-1' : '')}
|
||||
leading={{ fade: 'long', button: false }}
|
||||
trailing={{
|
||||
fade: 'long',
|
||||
button: true,
|
||||
// Loading placeholders are not more results.
|
||||
buttonAlwaysVisible: results.length > 0,
|
||||
}}
|
||||
contentClassName={tcls(
|
||||
'gutter-stable scroll-py-3 p-3',
|
||||
// Keeps the keyboard selection clear of the faded edges.
|
||||
'gutter-stable scroll-pt-12 scroll-pb-24 p-3',
|
||||
fillHeight ? 'min-h-full' : ''
|
||||
)}
|
||||
>
|
||||
@@ -116,6 +125,7 @@ export function SearchFrame(props: {
|
||||
cursor={cursor}
|
||||
error={error}
|
||||
onResultSelect={onResultSelect}
|
||||
onResultHover={onResultHover}
|
||||
/>
|
||||
)}
|
||||
</ScrollContainer>
|
||||
@@ -126,21 +136,16 @@ export function SearchFrame(props: {
|
||||
query={query}
|
||||
assistant={assistant}
|
||||
active={cursor === results.length + index}
|
||||
withShortcut={assistant === assistants[0]}
|
||||
onHover={() => onResultHover?.(results.length + index)}
|
||||
onSelect={onResultSelect}
|
||||
/>
|
||||
))
|
||||
: null}
|
||||
<div
|
||||
className={tcls(
|
||||
'flex gap-2 border-tint-subtle border-t bg-tint-subtle px-4 py-1.5',
|
||||
!scopeControl ? 'not-pointer-fine:hidden' : '',
|
||||
showAsk ? 'hidden' : ''
|
||||
)}
|
||||
>
|
||||
{scopeControl && !showAsk ? scopeControl : null}
|
||||
<SearchFrameKeyboardHints />
|
||||
</div>
|
||||
{scopeControl && !showAsk ? (
|
||||
<div className="flex gap-2 border-t border-tint-subtle bg-tint-subtle px-4 py-1.5">
|
||||
{scopeControl}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</React.Suspense>
|
||||
</EmbeddableFrameMain>
|
||||
@@ -148,31 +153,3 @@ export function SearchFrame(props: {
|
||||
</SearchAskProvider>
|
||||
);
|
||||
}
|
||||
|
||||
const SearchFrameKeyboardHints = () => {
|
||||
return (
|
||||
<div className="not-pointer-fine:hidden flex w-full items-center justify-end py-1.5 @container/keyboard-hint">
|
||||
{/* Compact view */}
|
||||
<div className="@max-[6rem]/keyboard-hint:hidden @min-[12rem]/keyboard-hint:hidden flex items-center gap-2">
|
||||
<Tooltip label="Navigate">
|
||||
<div>
|
||||
<KeyboardShortcut className="bg-tint-base" keys={['up', 'down']} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
/
|
||||
<Tooltip label="Close">
|
||||
<div>
|
||||
<KeyboardShortcut className="bg-tint-base" keys={['esc']} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/* Normal view */}
|
||||
<div className="@max-[12rem]/keyboard-hint:hidden flex items-center gap-2">
|
||||
<KeyboardShortcut className="bg-tint-base" keys={['up', 'down']} />
|
||||
Navigate
|
||||
<KeyboardShortcut className="ml-1 bg-tint-base" keys={['esc']} />
|
||||
Close
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Icon, type IconName } from '@gitbook/icons';
|
||||
import { Icon } from '@gitbook/icons';
|
||||
|
||||
import { useResizeObserver } from '../hooks';
|
||||
import { Tooltip } from '../primitives';
|
||||
import { getPageResultPresentation } from './getPageResultHref';
|
||||
import { HighlightQuery } from './HighlightQuery';
|
||||
@@ -43,7 +44,6 @@ export const SearchPageResultItem = React.forwardRef(function SearchPageResultIt
|
||||
active={active}
|
||||
data-testid="search-page-result"
|
||||
action={tString(language, 'view')}
|
||||
leadingIcon={<Icon icon="file-lines" className="size-4" />}
|
||||
insights={insights}
|
||||
aria-label={tString(language, 'search_page_result_title', item.title)}
|
||||
style={{
|
||||
@@ -87,70 +87,147 @@ export const SearchPageResultItem = React.forwardRef(function SearchPageResultIt
|
||||
);
|
||||
});
|
||||
|
||||
const Breadcrumbs = (props: {
|
||||
breadcrumbs: ComputedPageResult['breadcrumbs'];
|
||||
withOverflow?: boolean;
|
||||
}) => {
|
||||
const { breadcrumbs, withOverflow = (breadcrumbs?.length ?? 0) > 4 } = props;
|
||||
/** Widest a single crumb gets, so one long title can't collapse the rest by itself. */
|
||||
const CRUMB_MAX_WIDTH = 200;
|
||||
|
||||
if (!breadcrumbs || breadcrumbs.length === 0) return null;
|
||||
/**
|
||||
* One line of breadcrumbs that shows the whole path when it fits. When it doesn't, the levels next
|
||||
* to the root fold into a "⋯" in second place, moving toward the result until the line fits; the
|
||||
* last crumb is cut short only once everything between is folded. The folded levels show on a
|
||||
* deliberate hover only, so moving the mouse across results doesn't pop them up.
|
||||
*/
|
||||
const Breadcrumbs = (props: { breadcrumbs: ComputedPageResult['breadcrumbs'] }) => {
|
||||
const { breadcrumbs = [] } = props;
|
||||
const containerRef = React.useRef<HTMLDivElement>(null);
|
||||
const measureRef = React.useRef<HTMLDivElement>(null);
|
||||
const [folded, setFolded] = React.useState(0);
|
||||
|
||||
const crumbs =
|
||||
breadcrumbs?.map((crumb) => (
|
||||
<span key={crumb.label} className="flex items-center gap-1">
|
||||
{crumb.icon ? <Icon className="size-3" icon={crumb.icon as IconName} /> : null}
|
||||
{crumb.label}
|
||||
</span>
|
||||
)) ?? [];
|
||||
|
||||
// Format breadcrumbs for display. Helper function to avoid code duplication across normal and in-tooltip display.
|
||||
function formatCrumbs(crumbs: React.ReactElement[], className?: string) {
|
||||
return (
|
||||
<div
|
||||
className={tcls(
|
||||
'transition-colors',
|
||||
'font-normal',
|
||||
'flex',
|
||||
'flex-wrap',
|
||||
'gap-x-2',
|
||||
'gap-y-0',
|
||||
'items-center',
|
||||
className
|
||||
)}
|
||||
>
|
||||
{crumbs.map((crumb, index) => (
|
||||
<React.Fragment key={index}>
|
||||
{index !== 0 ? (
|
||||
<Icon
|
||||
key={`${crumb.key}-icon`}
|
||||
icon="chevron-right"
|
||||
className="size-2"
|
||||
/>
|
||||
) : null}
|
||||
<span className="line-clamp-1">{crumb}</span>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
const measureFolding = () => {
|
||||
const container = containerRef.current;
|
||||
const measure = measureRef.current;
|
||||
if (!container || !measure) {
|
||||
return;
|
||||
}
|
||||
const widths = Array.from(measure.children, (element) =>
|
||||
Math.min(element.getBoundingClientRect().width, CRUMB_MAX_WIDTH)
|
||||
);
|
||||
}
|
||||
const ellipsisWidth = widths.pop() ?? 0;
|
||||
const separatorWidth =
|
||||
(widths.pop() ?? 0) + 2 * Number.parseFloat(getComputedStyle(container).columnGap);
|
||||
setFolded(countFoldedCrumbs(widths, container.clientWidth, separatorWidth, ellipsisWidth));
|
||||
};
|
||||
// The measuring copy resizes when the labels change, the container when the row does.
|
||||
useResizeObserver(containerRef, measureFolding);
|
||||
useResizeObserver(measureRef, measureFolding);
|
||||
|
||||
return formatCrumbs(
|
||||
withOverflow
|
||||
? [
|
||||
...crumbs.slice(0, 3),
|
||||
<Tooltip
|
||||
key="breadcrumbs-overflow"
|
||||
label={formatCrumbs(crumbs.slice(3, -1))}
|
||||
delay={0}
|
||||
arrow
|
||||
>
|
||||
<span>
|
||||
<Icon key="ellipsis" icon="ellipsis-h" className="size-3" />
|
||||
</span>
|
||||
</Tooltip>,
|
||||
...crumbs.slice(-1),
|
||||
]
|
||||
: crumbs,
|
||||
'text-tint/7 contrast-more:text-tint group-[.is-active]:text-tint text-xs'
|
||||
const first = breadcrumbs[0];
|
||||
if (!first) return null;
|
||||
|
||||
const hidden = breadcrumbs.slice(1, 1 + folded);
|
||||
const shown = breadcrumbs.slice(1 + folded);
|
||||
const separator = <Icon icon="chevron-right" className="size-2 shrink-0" />;
|
||||
const textClassName = 'text-xs font-normal whitespace-nowrap';
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={tcls(
|
||||
'relative flex min-w-0 items-center gap-x-2 overflow-hidden text-tint/7 transition-colors group-[.is-active]:text-tint contrast-more:text-tint',
|
||||
textClassName
|
||||
)}
|
||||
>
|
||||
<div
|
||||
ref={measureRef}
|
||||
aria-hidden
|
||||
className="invisible absolute left-0 top-0 flex items-center"
|
||||
>
|
||||
{breadcrumbs.map((crumb, index) => (
|
||||
<span key={index}>{crumb.label}</span>
|
||||
))}
|
||||
{separator}
|
||||
<Icon icon="ellipsis" className="size-3" />
|
||||
</div>
|
||||
<CrumbLabel label={first.label} className="shrink-0" />
|
||||
{hidden.length > 0 ? (
|
||||
<>
|
||||
{separator}
|
||||
<Tooltip
|
||||
delay={1000}
|
||||
label={
|
||||
<span className="flex flex-col py-0.5">
|
||||
{hidden.map((crumb, index) => (
|
||||
<span key={index}>{crumb.label}</span>
|
||||
))}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<span className="flex shrink-0 items-center">
|
||||
<Icon icon="ellipsis" className="size-3" />
|
||||
<span className="sr-only">
|
||||
{hidden.map((crumb) => crumb.label).join(' › ')}
|
||||
</span>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
) : null}
|
||||
{shown.map((crumb, index) => (
|
||||
<React.Fragment key={index}>
|
||||
{separator}
|
||||
<CrumbLabel
|
||||
label={crumb.label}
|
||||
className={index === shown.length - 1 ? 'min-w-[3ch] shrink' : 'shrink-0'}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const CrumbLabel = (props: { label: string; className: string }) => {
|
||||
const { label, className } = props;
|
||||
const ref = React.useRef<HTMLSpanElement>(null);
|
||||
const [truncated, setTruncated] = React.useState(false);
|
||||
|
||||
useResizeObserver(ref, () => {
|
||||
const element = ref.current;
|
||||
if (element) {
|
||||
setTruncated(element.scrollWidth > element.clientWidth);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<span
|
||||
ref={ref}
|
||||
className={tcls('max-w-[200px] truncate', className)}
|
||||
title={truncated ? label : undefined}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* How many crumbs after the first to fold into the "⋯" so the line fits `available` pixels. The
|
||||
* first and last crumbs never fold; when even folding everything between doesn't fit, the last
|
||||
* crumb is cut short instead.
|
||||
*/
|
||||
function countFoldedCrumbs(
|
||||
widths: number[],
|
||||
available: number,
|
||||
separatorWidth: number,
|
||||
ellipsisWidth: number
|
||||
): number {
|
||||
const foldable = Math.max(widths.length - 2, 0);
|
||||
for (let folded = 0; folded <= foldable; folded++) {
|
||||
const visible = widths.filter((_, index) => index === 0 || index > folded);
|
||||
const items = visible.length + (folded > 0 ? 1 : 0);
|
||||
const total =
|
||||
visible.reduce((sum, width) => sum + width, 0) +
|
||||
(folded > 0 ? ellipsisWidth : 0) +
|
||||
(items - 1) * separatorWidth;
|
||||
if (total <= available + 0.5) {
|
||||
return folded;
|
||||
}
|
||||
}
|
||||
return foldable;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ export const SearchResultItem = React.forwardRef(function SearchResultItem(
|
||||
size?: 'small' | 'medium';
|
||||
leadingIcon?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
/** Called when the mouse moves over the item, to make it the selected one. */
|
||||
onHover?: () => void;
|
||||
} & LinkInsightsProps &
|
||||
Omit<React.ComponentProps<typeof Link>, keyof LinkInsightsProps>,
|
||||
ref: React.Ref<HTMLAnchorElement>
|
||||
@@ -29,6 +31,7 @@ export const SearchResultItem = React.forwardRef(function SearchResultItem(
|
||||
size = 'medium',
|
||||
action,
|
||||
disabled,
|
||||
onHover,
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
@@ -37,6 +40,16 @@ export const SearchResultItem = React.forwardRef(function SearchResultItem(
|
||||
ref={ref}
|
||||
href={href ?? '#'}
|
||||
aria-disabled={disabled}
|
||||
// Only a real mouse move selects, so rows scrolling under a still pointer don't.
|
||||
onPointerMove={
|
||||
onHover && !active
|
||||
? (event: React.PointerEvent) => {
|
||||
if (event.pointerType === 'mouse') {
|
||||
onHover();
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
className={tcls(
|
||||
'flex',
|
||||
'items-center',
|
||||
@@ -46,27 +59,26 @@ export const SearchResultItem = React.forwardRef(function SearchResultItem(
|
||||
'pr-2',
|
||||
'py-2',
|
||||
'text-tint',
|
||||
disabled ? ['pointer-events-none'] : ['hover:bg-tint', 'hover:text-tint-strong'],
|
||||
'group',
|
||||
disabled ? ['pointer-events-none'] : null,
|
||||
'transition-colors',
|
||||
'rounded-corners:rounded-md',
|
||||
'circular-corners:rounded-2xl',
|
||||
active
|
||||
? ['is-active', 'bg-primary', 'text-primary-strong', 'hover:bg-primary']
|
||||
: null,
|
||||
active ? ['is-active', 'bg-primary', 'text-primary-strong'] : null,
|
||||
className
|
||||
)}
|
||||
role="option"
|
||||
{...rest}
|
||||
>
|
||||
<div className="size-4 shrink-0 text-tint-subtle">
|
||||
{typeof leadingIcon === 'string' ? (
|
||||
<Icon icon={leadingIcon as IconName} className="size-4" />
|
||||
) : (
|
||||
leadingIcon
|
||||
)}
|
||||
</div>
|
||||
<div className="grow">{children}</div>
|
||||
{leadingIcon ? (
|
||||
<div className="size-4 shrink-0 text-tint-subtle">
|
||||
{typeof leadingIcon === 'string' ? (
|
||||
<Icon icon={leadingIcon as IconName} className="size-4" />
|
||||
) : (
|
||||
leadingIcon
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="min-w-0 grow">{children}</div>
|
||||
{disabled ? null : active ? (
|
||||
<Button
|
||||
label={action}
|
||||
|
||||
@@ -63,10 +63,12 @@ export const SearchResults = React.forwardRef(function SearchResults(
|
||||
cursor: number | null;
|
||||
error: boolean;
|
||||
onResultSelect?: () => void;
|
||||
onResultHover?: (index: number) => void;
|
||||
},
|
||||
ref: React.Ref<SearchResultsRef>
|
||||
) {
|
||||
const { children, id, query, results, fetching, cursor, error, onResultSelect } = props;
|
||||
const { children, id, query, results, fetching, cursor, error, onResultSelect, onResultHover } =
|
||||
props;
|
||||
|
||||
const language = useLanguage();
|
||||
const { siteSpaceId } = useCurrentContent();
|
||||
@@ -81,6 +83,7 @@ export const SearchResults = React.forwardRef(function SearchResults(
|
||||
}
|
||||
|
||||
const refs = React.useRef<(null | HTMLAnchorElement)[]>([]);
|
||||
const selectedByPointer = React.useRef(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
for (const item of results) {
|
||||
@@ -88,8 +91,12 @@ export const SearchResults = React.forwardRef(function SearchResults(
|
||||
}
|
||||
}, [results]);
|
||||
|
||||
// Scroll to the active result.
|
||||
// Scroll to the active result, unless the mouse picked it: it is already under the pointer.
|
||||
React.useEffect(() => {
|
||||
if (selectedByPointer.current) {
|
||||
selectedByPointer.current = false;
|
||||
return;
|
||||
}
|
||||
if (cursor === null || !refs.current[cursor]) {
|
||||
return;
|
||||
}
|
||||
@@ -230,6 +237,12 @@ export const SearchResults = React.forwardRef(function SearchResults(
|
||||
'aria-setsize': results.length,
|
||||
id: `${id}-${index}`,
|
||||
onClickCapture: handleResultSelect,
|
||||
onHover: onResultHover
|
||||
? () => {
|
||||
selectedByPointer.current = true;
|
||||
onResultHover(index);
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
switch (item.type) {
|
||||
case 'page': {
|
||||
@@ -375,7 +388,6 @@ const SearchResultsPlaceholder = () =>
|
||||
aria-hidden
|
||||
className="flex items-center gap-3 py-2 pl-3 pr-2"
|
||||
>
|
||||
<div className="size-4 shrink-0 rounded-sm bg-tint-solid/2" />
|
||||
<div className="grow">
|
||||
<PlaceholderLine className="text-xs" barClassName="h-2" width={crumb} />
|
||||
<PlaceholderLine
|
||||
|
||||
@@ -161,7 +161,11 @@ function useSearchKeyboardNavigation(props: {
|
||||
// Enter pressed before the answer arrived: open the top result of this exact query and scope,
|
||||
// or Ask when that answer is empty. Closing the search cancels it.
|
||||
const pendingOpenRef = React.useRef<string | null>(null);
|
||||
const { cursor, moveBy: moveCursorBy } = useSearchResultsCursor({
|
||||
const {
|
||||
cursor,
|
||||
setCursor,
|
||||
moveBy: moveCursorBy,
|
||||
} = useSearchResultsCursor({
|
||||
query,
|
||||
fetching,
|
||||
resultCount: results.length,
|
||||
@@ -235,6 +239,7 @@ function useSearchKeyboardNavigation(props: {
|
||||
|
||||
return {
|
||||
cursor,
|
||||
setCursor,
|
||||
onInputKeyDown,
|
||||
};
|
||||
}
|
||||
@@ -427,7 +432,7 @@ export function useSearchController(
|
||||
|
||||
const askCount = normalizedQuery && !showAsk ? assistants.length : 0;
|
||||
|
||||
const { cursor, onInputKeyDown } = useSearchKeyboardNavigation({
|
||||
const { cursor, setCursor, onInputKeyDown } = useSearchKeyboardNavigation({
|
||||
query: normalizedQuery,
|
||||
results,
|
||||
fetching,
|
||||
@@ -454,6 +459,7 @@ export function useSearchController(
|
||||
open: onOpen,
|
||||
close: onClose,
|
||||
onResultSelect,
|
||||
onResultHover: setCursor,
|
||||
query: normalizedQuery,
|
||||
results,
|
||||
resultsId: searchResultsId,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { GitBookSiteContext } from '@/lib/context';
|
||||
import { getLLMsTxtURL } from '@/lib/llms-directive';
|
||||
|
||||
/**
|
||||
* Agent-facing pointer to the site index and the Markdown versions of pages.
|
||||
*/
|
||||
export function LLMsTxtDirective(props: { context: GitBookSiteContext }) {
|
||||
const { context } = props;
|
||||
|
||||
return (
|
||||
<div className="sr-only">
|
||||
For the complete documentation index, see <a href={getLLMsTxtURL(context)}>llms.txt</a>.
|
||||
Markdown versions of documentation pages are available by appending <code>.md</code> to
|
||||
page URLs.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import * as ReactDOM from 'react-dom';
|
||||
import { CustomizationDefaultThemeMode, CustomizationPageActionType } from '@gitbook/api';
|
||||
|
||||
import { AIContextProvider } from '../AI';
|
||||
import { LLMsTxtDirective } from './LLMsTxtDirective';
|
||||
import { RocketLoaderDetector } from './RocketLoaderDetector';
|
||||
import { SiteLayoutClientContexts } from './SiteLayoutClientContexts';
|
||||
import { AdminToolbar } from '@/components/AdminToolbar';
|
||||
@@ -81,62 +82,66 @@ export async function SiteLayout(props: {
|
||||
});
|
||||
|
||||
return (
|
||||
<SiteLayoutClientContexts
|
||||
contextId={context.contextId}
|
||||
forcedTheme={
|
||||
forcedTheme ??
|
||||
// Only force concrete light/dark; System stays unforced so next-themes resolves prefers-color-scheme pre-paint (avoids the flash). A theme saved while the toggle was previously on still wins — see the PR's "Known limitation". RND-11643
|
||||
(customization.themes.toggeable ||
|
||||
customization.themes.default === CustomizationDefaultThemeMode.System
|
||||
? undefined
|
||||
: customization.themes.default)
|
||||
}
|
||||
defaultTheme={customization.themes.default}
|
||||
externalLinksTarget={customization.externalLinks.target}
|
||||
proxyOrigin={context.site.proxy?.origin}
|
||||
siteURL={removeTrailingSlash(
|
||||
context.linker.toAbsoluteURL(context.linker.toPathInSite(''))
|
||||
)}
|
||||
searchPrewarmURL={context.linker.toPathInSite('~gitbook/search-prewarm')}
|
||||
directSearch={getDirectSearchProps(context)}
|
||||
>
|
||||
<AIContextProvider
|
||||
aiMode={customization.ai?.mode}
|
||||
suggestions={context.customization.ai?.suggestions}
|
||||
trademark={customization.trademark.enabled}
|
||||
greeting={aiGreeting ? { subtitle: aiGreeting } : undefined}
|
||||
<>
|
||||
{/* First in <body> so agents reading the HTML find it before the navigation. */}
|
||||
<LLMsTxtDirective context={context} />
|
||||
<SiteLayoutClientContexts
|
||||
contextId={context.contextId}
|
||||
forcedTheme={
|
||||
forcedTheme ??
|
||||
// Only force concrete light/dark; System stays unforced so next-themes resolves prefers-color-scheme pre-paint (avoids the flash). A theme saved while the toggle was previously on still wins — see the PR's "Known limitation". RND-11643
|
||||
(customization.themes.toggeable ||
|
||||
customization.themes.default === CustomizationDefaultThemeMode.System
|
||||
? undefined
|
||||
: customization.themes.default)
|
||||
}
|
||||
defaultTheme={customization.themes.default}
|
||||
externalLinksTarget={customization.externalLinks.target}
|
||||
proxyOrigin={context.site.proxy?.origin}
|
||||
siteURL={removeTrailingSlash(
|
||||
context.linker.toAbsoluteURL(context.linker.toPathInSite(''))
|
||||
)}
|
||||
searchPrewarmURL={context.linker.toPathInSite('~gitbook/search-prewarm')}
|
||||
directSearch={getDirectSearchProps(context)}
|
||||
>
|
||||
<SpaceLayout
|
||||
context={context}
|
||||
withTracking={withTracking}
|
||||
visitorAuthClaims={visitorAuthClaims}
|
||||
<AIContextProvider
|
||||
aiMode={customization.ai?.mode}
|
||||
suggestions={context.customization.ai?.suggestions}
|
||||
trademark={customization.trademark.enabled}
|
||||
greeting={aiGreeting ? { subtitle: aiGreeting } : undefined}
|
||||
>
|
||||
{children}
|
||||
</SpaceLayout>
|
||||
</AIContextProvider>
|
||||
<SpaceLayout
|
||||
context={context}
|
||||
withTracking={withTracking}
|
||||
visitorAuthClaims={visitorAuthClaims}
|
||||
>
|
||||
{children}
|
||||
</SpaceLayout>
|
||||
</AIContextProvider>
|
||||
|
||||
<LoadIntegrations />
|
||||
{customization.pageActions.items.includes(CustomizationPageActionType.Mcp) ? (
|
||||
<WebMCP mcpURL={context.linker.toPathInSite('~gitbook/mcp')} />
|
||||
) : null}
|
||||
{scripts.map(({ script }) =>
|
||||
isDeferrableScript(script) ? (
|
||||
<Script key={script} src={script} strategy="lazyOnload" />
|
||||
) : (
|
||||
<script key={script} async src={script} />
|
||||
)
|
||||
)}
|
||||
<LoadIntegrations />
|
||||
{customization.pageActions.items.includes(CustomizationPageActionType.Mcp) ? (
|
||||
<WebMCP mcpURL={context.linker.toPathInSite('~gitbook/mcp')} />
|
||||
) : null}
|
||||
{scripts.map(({ script }) =>
|
||||
isDeferrableScript(script) ? (
|
||||
<Script key={script} src={script} strategy="lazyOnload" />
|
||||
) : (
|
||||
<script key={script} async src={script} />
|
||||
)
|
||||
)}
|
||||
|
||||
{scripts.some((script) => script.cookies) || customization.privacyPolicy.url ? (
|
||||
<React.Suspense fallback={null}>
|
||||
<CookiesToast privacyPolicy={customization.privacyPolicy.url} />
|
||||
</React.Suspense>
|
||||
) : null}
|
||||
{scripts.some((script) => script.cookies) || customization.privacyPolicy.url ? (
|
||||
<React.Suspense fallback={null}>
|
||||
<CookiesToast privacyPolicy={customization.privacyPolicy.url} />
|
||||
</React.Suspense>
|
||||
) : null}
|
||||
|
||||
<RocketLoaderDetector />
|
||||
<RocketLoaderDetector />
|
||||
|
||||
<AdminToolbar context={context} />
|
||||
</SiteLayoutClientContexts>
|
||||
<AdminToolbar context={context} />
|
||||
</SiteLayoutClientContexts>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,3 +11,4 @@ export * from './useListOverflow';
|
||||
export * from './useCurrentPageMetadata';
|
||||
export * from './useBackToSpace';
|
||||
export * from './useCopyToClipboard';
|
||||
export * from './useResizeObserver';
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
/**
|
||||
* Call `onResize` once the element is mounted and again whenever its size changes. Browsers
|
||||
* without `ResizeObserver` get the first call only.
|
||||
*/
|
||||
export function useResizeObserver(ref: React.RefObject<HTMLElement | null>, onResize: () => void) {
|
||||
const callback = React.useRef(onResize);
|
||||
React.useLayoutEffect(() => {
|
||||
callback.current = onResize;
|
||||
});
|
||||
|
||||
React.useLayoutEffect(() => {
|
||||
const element = ref.current;
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
const run = () => callback.current();
|
||||
run();
|
||||
if (typeof ResizeObserver === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const observer = new ResizeObserver(run);
|
||||
observer.observe(element);
|
||||
return () => observer.disconnect();
|
||||
}, [ref]);
|
||||
}
|
||||
@@ -22,19 +22,23 @@ export type ScrollContainerProps = {
|
||||
orientation: 'horizontal' | 'vertical';
|
||||
|
||||
leading?: {
|
||||
/** Whether to fade out the leading edge of the container. */
|
||||
fade: boolean;
|
||||
/** Whether to fade out the leading edge of the container, over 1rem or 3rem (`long`). */
|
||||
fade: boolean | 'long';
|
||||
/** Whether to show a button to scroll back. */
|
||||
button: boolean | ButtonProps;
|
||||
/** Show the button whenever the container can scroll back, not only on hover. */
|
||||
buttonAlwaysVisible?: boolean;
|
||||
/** Optional class(es) to apply when there the container can be scrolled on the leading (left or top) edge */
|
||||
className?: string;
|
||||
};
|
||||
|
||||
trailing?: {
|
||||
/** Whether to fade out the trailing edge of the container. */
|
||||
fade: boolean;
|
||||
/** Whether to fade out the trailing edge of the container, over 1rem or 6rem (`long`). */
|
||||
fade: boolean | 'long';
|
||||
/** Whether to show a button to scroll forward. */
|
||||
button: boolean | ButtonProps;
|
||||
/** Show the button whenever the container can scroll forward, not only on hover. */
|
||||
buttonAlwaysVisible?: boolean;
|
||||
/** Optional class(es) to apply when there the container can be scrolled on the trailing (right or bottom) edge */
|
||||
className?: string;
|
||||
};
|
||||
@@ -190,13 +194,21 @@ export function ScrollContainer(props: ScrollContainerProps) {
|
||||
orientation === 'horizontal' ? 'overflow-x-scroll' : 'flex-col overflow-y-auto',
|
||||
leading.fade && scrollPosition > 0
|
||||
? orientation === 'horizontal'
|
||||
? 'mask-l-from-[calc(100%-1rem)]'
|
||||
: 'mask-t-from-[calc(100%-1rem)]'
|
||||
? leading.fade === 'long'
|
||||
? 'mask-l-from-[calc(100%-3rem)]'
|
||||
: 'mask-l-from-[calc(100%-1rem)]'
|
||||
: leading.fade === 'long'
|
||||
? 'mask-t-from-[calc(100%-3rem)]'
|
||||
: 'mask-t-from-[calc(100%-1rem)]'
|
||||
: '',
|
||||
trailing.fade && scrollPosition < scrollSize
|
||||
? orientation === 'horizontal'
|
||||
? 'mask-r-from-[calc(100%-1rem)]'
|
||||
: 'mask-b-from-[calc(100%-1rem)]'
|
||||
? trailing.fade === 'long'
|
||||
? 'mask-r-from-[calc(100%-6rem)]'
|
||||
: 'mask-r-from-[calc(100%-1rem)]'
|
||||
: trailing.fade === 'long'
|
||||
? 'mask-b-from-[calc(100%-6rem)]'
|
||||
: 'mask-b-from-[calc(100%-1rem)]'
|
||||
: '',
|
||||
contentClassName
|
||||
)}
|
||||
@@ -223,7 +235,9 @@ export function ScrollContainer(props: ScrollContainerProps) {
|
||||
: '-translate-x-1/2! top-0 left-1/2 mt-2',
|
||||
'absolute z-10 not-pointer-none:block hidden scale-0 opacity-0 transition-[scale,opacity]',
|
||||
scrollPosition > 0
|
||||
? 'not-pointer-none:group-hover/scroll-container:scale-100 not-pointer-none:group-hover/scroll-container:opacity-11'
|
||||
? leading.buttonAlwaysVisible
|
||||
? 'not-pointer-none:scale-100 not-pointer-none:opacity-11'
|
||||
: 'not-pointer-none:group-hover/scroll-container:scale-100 not-pointer-none:group-hover/scroll-container:opacity-11'
|
||||
: 'pointer-events-none',
|
||||
typeof leading.button === 'object' ? leading.button.className : ''
|
||||
)}
|
||||
@@ -246,7 +260,9 @@ export function ScrollContainer(props: ScrollContainerProps) {
|
||||
: '-translate-x-1/2! bottom-0 left-1/2 mb-2',
|
||||
'absolute z-10 not-pointer-none:block hidden scale-0 transition-[scale,opacity]',
|
||||
scrollPosition < scrollSize
|
||||
? 'not-pointer-none:group-hover/scroll-container:scale-100 not-pointer-none:group-hover/scroll-container:opacity-11'
|
||||
? trailing.buttonAlwaysVisible
|
||||
? 'not-pointer-none:scale-100 not-pointer-none:opacity-11'
|
||||
: 'not-pointer-none:group-hover/scroll-container:scale-100 not-pointer-none:group-hover/scroll-container:opacity-11'
|
||||
: 'pointer-events-none',
|
||||
typeof trailing.button === 'object' ? trailing.button.className : ''
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# @gitbook/icons
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 9fcde5f: Add a `@gitbook/icons/validateIconName` entry that validates icon names without loading the icon labels and search terms.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 265ca4b: Add a skip link, keyboard navigation between content tabs, focusable table of contents toggles, and hide decorative icons from assistive technologies.
|
||||
|
||||
## 0.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
||||
"@gitbook/fontawesome-pro": "1.0.23"
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @gitbook/react-contentkit
|
||||
|
||||
## 0.7.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9fcde5f]
|
||||
- Updated dependencies [265ca4b]
|
||||
- @gitbook/icons@0.6.0
|
||||
|
||||
## 0.7.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitbook/react-contentkit",
|
||||
"version": "0.7.18",
|
||||
"version": "0.7.19",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @gitbook/react-openapi
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 262749a: Copy the current spec's server in OpenAPI endpoint URLs instead of a server kept from a previously visited page.
|
||||
|
||||
## 2.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@base-ui/react": "catalog:",
|
||||
|
||||
Reference in New Issue
Block a user