|
| 1 | +diff --git a/node_modules/@astrojs/starlight-docsearch/DocSearch.astro b/node_modules/@astrojs/starlight-docsearch/DocSearch.astro |
| 2 | +index f50c208..5309557 100644 |
| 3 | +--- a/node_modules/@astrojs/starlight-docsearch/DocSearch.astro |
| 4 | ++++ b/node_modules/@astrojs/starlight-docsearch/DocSearch.astro |
| 5 | +@@ -109,15 +109,20 @@ const docsearchTranslations: DocSearchTranslationProps = { |
| 6 | + .DocSearch-Button-Keys { |
| 7 | + margin-inline-start: auto; |
| 8 | + } |
| 9 | +- .DocSearch-Button-Keys::before { |
| 10 | +- content: ''; |
| 11 | +- width: 1em; |
| 12 | +- height: 1em; |
| 13 | +- -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 2H7a5 5 0 0 0-5 5v10a5 5 0 0 0 5 5h10a5 5 0 0 0 5-5V7a5 5 0 0 0-5-5Zm3 15a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v10Z'%3E%3C/path%3E%3Cpath d='M15.293 6.707a1 1 0 1 1 1.414 1.414l-8.485 8.486a1 1 0 0 1-1.414-1.415l8.485-8.485Z'%3E%3C/path%3E%3C/svg%3E"); |
| 14 | +- mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 2H7a5 5 0 0 0-5 5v10a5 5 0 0 0 5 5h10a5 5 0 0 0 5-5V7a5 5 0 0 0-5-5Zm3 15a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v10Z'%3E%3C/path%3E%3Cpath d='M15.293 6.707a1 1 0 1 1 1.414 1.414l-8.485 8.486a1 1 0 0 1-1.414-1.415l8.485-8.485Z'%3E%3C/path%3E%3C/svg%3E"); |
| 15 | +- -webkit-mask-size: 100%; |
| 16 | +- mask-size: 100%; |
| 17 | +- background-color: currentColor; |
| 18 | ++ .DocSearch-Button-Key:first-child { |
| 19 | ++ margin-right: 0.4em; |
| 20 | ++ } |
| 21 | ++ .DocSearch-Button-Key { |
| 22 | ++ display: inline-block; |
| 23 | ++ font-size: 0.75em; |
| 24 | ++ font-weight: 600; |
| 25 | ++ opacity: 0.8; |
| 26 | ++ border: 1px solid var(--sl-color-gray-4); |
| 27 | ++ border-radius: 0.25rem; |
| 28 | ++ padding: 0.125rem 0.375rem; |
| 29 | ++ background-color: var(--sl-color-gray-6); |
| 30 | ++ color: var(--sl-color-gray-1); |
| 31 | ++ line-height: 1; |
| 32 | + } |
| 33 | + } |
| 34 | + </style> |
| 35 | +@@ -128,6 +133,7 @@ const docsearchTranslations: DocSearchTranslationProps = { |
| 36 | + class StarlightDocSearch extends HTMLElement { |
| 37 | + constructor() { |
| 38 | + super(); |
| 39 | ++ |
| 40 | + window.addEventListener('DOMContentLoaded', async () => { |
| 41 | + const { default: docsearch } = await import('@docsearch/js'); |
| 42 | + const options = { ...config, container: 'sl-doc-search' }; |
| 43 | +@@ -136,6 +142,27 @@ const docsearchTranslations: DocSearchTranslationProps = { |
| 44 | + Object.assign(options, translations); |
| 45 | + } catch {} |
| 46 | + docsearch(options); |
| 47 | ++ |
| 48 | ++ const keyboardShortcuts = options.keyboardShortcuts ?? {}; |
| 49 | ++ const slashEnabled = keyboardShortcuts?.['/'] !== false; |
| 50 | ++ const ctrlCmdKEnabled = keyboardShortcuts?.['Ctrl/Cmd+K'] !== false; |
| 51 | ++ |
| 52 | ++ if (slashEnabled && !ctrlCmdKEnabled) { |
| 53 | ++ const styleContainer = document.createElement('style'); |
| 54 | ++ styleContainer.innerHTML = ` |
| 55 | ++ .DocSearch-Button-Keys::before { |
| 56 | ++ content: ''; |
| 57 | ++ width: 1em; |
| 58 | ++ height: 1em; |
| 59 | ++ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 2H7a5 5 0 0 0-5 5v10a5 5 0 0 0 5 5h10a5 5 0 0 0 5-5V7a5 5 0 0 0-5-5Zm3 15a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v10Z'%3E%3C/path%3E%3Cpath d='M15.293 6.707a1 1 0 1 1 1.414 1.414l-8.485 8.486a1 1 0 0 1-1.414-1.415l8.485-8.485Z'%3E%3C/path%3E%3C/svg%3E"); |
| 60 | ++ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 2H7a5 5 0 0 0-5 5v10a5 5 0 0 0 5 5h10a5 5 0 0 0 5-5V7a5 5 0 0 0-5-5Zm3 15a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v10Z'%3E%3C/path%3E%3Cpath d='M15.293 6.707a1 1 0 1 1 1.414 1.414l-8.485 8.486a1 1 0 0 1-1.414-1.415l8.485-8.485Z'%3E%3C/path%3E%3C/svg%3E"); |
| 61 | ++ -webkit-mask-size: 100%; |
| 62 | ++ mask-size: 100%; |
| 63 | ++ background-color: currentColor; |
| 64 | ++ } |
| 65 | ++ `; |
| 66 | ++ document.head.appendChild(styleContainer); |
| 67 | ++ } |
| 68 | + }); |
| 69 | + } |
| 70 | + } |
| 71 | +diff --git a/node_modules/@astrojs/starlight-docsearch/index.ts b/node_modules/@astrojs/starlight-docsearch/index.ts |
| 72 | +index e8cc7e5..6c88e07 100644 |
| 73 | +--- a/node_modules/@astrojs/starlight-docsearch/index.ts |
| 74 | ++++ b/node_modules/@astrojs/starlight-docsearch/index.ts |
| 75 | +@@ -43,6 +43,18 @@ const DocSearchConfigSchema = z |
| 76 | + * @see https://www.algolia.com/doc/api-reference/search-api-parameters/ |
| 77 | + */ |
| 78 | + searchParameters: z.custom<SearchOptions>(), |
| 79 | ++ /** |
| 80 | ++ * Configuration for keyboard shortcuts that trigger the DocSearch modal. |
| 81 | ++ * @see https://docsearch.algolia.com/docs/api/#keyboardshortcuts |
| 82 | ++ */ |
| 83 | ++ keyboardShortcuts: z |
| 84 | ++ .object({ |
| 85 | ++ /** Enable/disable Ctrl/Cmd+K shortcut. @default true */ |
| 86 | ++ 'Ctrl/Cmd+K': z.boolean().optional(), |
| 87 | ++ /** Enable/disable / shortcut. @default true */ |
| 88 | ++ '/': z.boolean().optional(), |
| 89 | ++ }) |
| 90 | ++ .optional(), |
| 91 | + }) |
| 92 | + .strict() |
| 93 | + .or( |
0 commit comments