valaxy-theme-press 1.0.0-rc.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +8 -0
- package/README.md +9 -0
- package/THIRD-PARTY-NOTICES.md +29 -0
- package/components/PressAlgoliaSearch.vue +110 -36
- package/components/PressApiIndex.vue +245 -0
- package/components/PressAside.vue +19 -331
- package/components/PressBackdrop.vue +6 -6
- package/components/PressButton.vue +47 -26
- package/components/PressCategory.vue +55 -46
- package/components/PressCategoryByName.vue +2 -1
- package/components/PressDocFooter.vue +2 -2
- package/components/PressDocFooterLastUpdated.vue +3 -2
- package/components/PressFeature.vue +34 -22
- package/components/PressFeatures.vue +36 -12
- package/components/PressFuseSearchButton.vue +5 -4
- package/components/PressFuseSearchModal.vue +32 -32
- package/components/PressGetStarted.vue +20 -53
- package/components/PressHome.vue +17 -5
- package/components/PressHomeCommand.vue +104 -0
- package/components/PressHomeFeatures.vue +34 -5
- package/components/PressHomeHero.vue +219 -51
- package/components/PressHomeOrbit.vue +255 -0
- package/components/PressLocalNav.vue +34 -71
- package/components/PressLocalNavOutlineDropdown.vue +68 -99
- package/components/PressLocalSearchModal.vue +30 -30
- package/components/PressNav.vue +53 -5
- package/components/PressNavBar.vue +41 -27
- package/components/PressNavBarHamburger.vue +7 -2
- package/components/PressNavBarMenu.vue +3 -5
- package/components/PressNavBarSearch.vue +6 -6
- package/components/PressNavBarSearchButton.vue +1 -0
- package/components/PressNavBarTranslations.vue +32 -1
- package/components/PressNavItemGroup.vue +17 -11
- package/components/PressNavItemGroupChild.vue +1 -1
- package/components/PressNavScreen.vue +49 -60
- package/components/PressNavScreenAppearance.vue +4 -3
- package/components/PressNavScreenMenu.vue +1 -1
- package/components/PressNavScreenMenuGroup.vue +9 -14
- package/components/PressNavScreenMenuGroupLink.vue +2 -2
- package/components/PressNavScreenMenuLink.vue +4 -4
- package/components/PressNotFoundVisual.vue +12 -12
- package/components/PressPostActions.vue +1 -1
- package/components/PressSidebar.vue +89 -98
- package/components/PressSidebarItem.vue +80 -136
- package/components/PressToggleLocale.vue +3 -2
- package/components/ValaxyMain.vue +6 -6
- package/components/layout.vue +55 -6
- package/composables/locale.ts +24 -3
- package/composables/nav.ts +9 -24
- package/composables/prev-next.ts +14 -15
- package/composables/sidebar.ts +10 -13
- package/composables/useEditLink.ts +3 -2
- package/layouts/404.vue +15 -15
- package/locales/en.yml +13 -0
- package/locales/zh-CN.yml +14 -1
- package/package.json +7 -7
- package/setup/main.ts +4 -12
- package/stores/app.ts +25 -3
- package/styles/api.scss +68 -0
- package/styles/code-group.css +85 -0
- package/styles/code.css +16 -0
- package/styles/css-vars.scss +24 -3
- package/styles/doc.css +634 -0
- package/styles/docsearch.css +8 -3
- package/styles/main.scss +17 -0
- package/styles/markdown.scss +38 -1
- package/styles/sidebar.scss +113 -0
- package/styles/tokens.css +126 -0
- package/types/algolia.ts +12 -3
- package/types/home.d.ts +12 -0
- package/utils/api-index.ts +15 -0
package/.npmignore
ADDED
package/README.md
CHANGED
|
@@ -33,3 +33,12 @@ export default defineValaxyConfig<PressTheme.Config>({
|
|
|
33
33
|
|
|
34
34
|
- [vitepress](https://vitepress.dev/)
|
|
35
35
|
- [nextjs](https://nextjs.org/)
|
|
36
|
+
|
|
37
|
+
## Native theme styles
|
|
38
|
+
|
|
39
|
+
Press ships its own documentation styles and `PressTheme.SidebarItem` type; it does
|
|
40
|
+
not require the `vitepress` package. Theme CSS uses `--press-*` variables and
|
|
41
|
+
`.press-doc`. When updating custom styles, replace `--vp-*` and `.vp-doc` with
|
|
42
|
+
these names. Valaxy’s shared Markdown code-group classes remain supported.
|
|
43
|
+
See [third-party notices](./THIRD-PARTY-NOTICES.md) for the adapted styles’ source
|
|
44
|
+
and license.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The styles in `styles/tokens.css`, `styles/doc.css`, `styles/code.css`, and
|
|
4
|
+
`styles/code-group.css` are adapted from [VitePress 2.0.0-alpha.20](https://github.com/vuejs/vitepress/tree/v2.0.0-alpha.20/src/client/theme-default/styles).
|
|
5
|
+
Valaxy owns the `press-*` namespace; the `vp-code-group` and `vp-block` selectors
|
|
6
|
+
remain compatible with Valaxy’s existing Markdown output. Copy icons use Valaxy’s
|
|
7
|
+
existing `--va-icon-copy` and `--va-icon-copied` variables.
|
|
8
|
+
|
|
9
|
+
MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2019-present, Yuxi (Evan) You
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DocSearchProps as DocSearchAIProps, DocSearchInstance } from '@docsearch/js'
|
|
3
|
+
import type { DocSearchProps } from '@docsearch/js/docsearch'
|
|
3
4
|
import type { SidepanelInstance, SidepanelProps } from '@docsearch/sidepanel-js'
|
|
4
5
|
import type { AlgoliaSearchOptions } from '../types/algolia'
|
|
5
6
|
import { useAddonConfig } from 'valaxy'
|
|
6
|
-
import { nextTick, onUnmounted, watch } from 'vue'
|
|
7
|
+
import { nextTick, onMounted, onUnmounted, watch } from 'vue'
|
|
7
8
|
import { useRouter } from 'vue-router'
|
|
8
9
|
|
|
9
10
|
import '../styles/docsearch.css'
|
|
@@ -19,27 +20,32 @@ const router = useRouter()
|
|
|
19
20
|
|
|
20
21
|
const algoliaConfig = useAddonConfig<AlgoliaSearchOptions>('valaxy-addon-algolia')
|
|
21
22
|
|
|
22
|
-
let cleanup = () => {}
|
|
23
23
|
let docsearchInstance: DocSearchInstance | undefined
|
|
24
24
|
let sidepanelInstance: SidepanelInstance | undefined
|
|
25
25
|
let openOnReady: 'search' | 'askAi' | null = null
|
|
26
26
|
let initializeCount = 0
|
|
27
|
-
let docsearchLoader: Promise<typeof import('@docsearch/js')> | undefined
|
|
27
|
+
let docsearchLoader: Promise<typeof import('@docsearch/js/docsearch')> | undefined
|
|
28
|
+
let docsearchAiLoader: Promise<typeof import('@docsearch/js')> | undefined
|
|
28
29
|
let sidepanelLoader: Promise<typeof import('@docsearch/sidepanel-js')> | undefined
|
|
29
30
|
let lastFocusedElement: HTMLElement | null = null
|
|
30
31
|
let skipEventDocsearch = false
|
|
31
32
|
let skipEventSidepanel = false
|
|
32
33
|
|
|
33
|
-
watch(
|
|
34
|
+
onMounted(() => watch(
|
|
34
35
|
() => algoliaConfig.value?.options,
|
|
35
36
|
(options) => {
|
|
36
37
|
if (options)
|
|
37
38
|
update(options)
|
|
38
39
|
},
|
|
39
40
|
{ immediate: true },
|
|
40
|
-
)
|
|
41
|
+
))
|
|
41
42
|
|
|
42
|
-
onUnmounted(
|
|
43
|
+
onUnmounted(() => {
|
|
44
|
+
++initializeCount
|
|
45
|
+
cleanup()
|
|
46
|
+
openOnReady = null
|
|
47
|
+
lastFocusedElement = null
|
|
48
|
+
})
|
|
43
49
|
|
|
44
50
|
watch(
|
|
45
51
|
() => props.openRequest?.nonce,
|
|
@@ -84,11 +90,14 @@ watch(
|
|
|
84
90
|
)
|
|
85
91
|
|
|
86
92
|
async function update(options: AlgoliaSearchOptions) {
|
|
93
|
+
const currentInitialize = ++initializeCount
|
|
87
94
|
await nextTick()
|
|
95
|
+
if (currentInitialize !== initializeCount)
|
|
96
|
+
return
|
|
88
97
|
|
|
89
|
-
// Normalize askAi: string -> {
|
|
98
|
+
// Normalize askAi: string -> { agentId }
|
|
90
99
|
const askAi = typeof options.askAi === 'string'
|
|
91
|
-
? {
|
|
100
|
+
? { agentId: options.askAi }
|
|
92
101
|
: options.askAi || undefined
|
|
93
102
|
|
|
94
103
|
const appId = options.appId ?? askAi?.appId
|
|
@@ -109,15 +118,22 @@ async function initialize(userOptions: AlgoliaSearchOptions) {
|
|
|
109
118
|
// Always tear down previous instances first
|
|
110
119
|
cleanup()
|
|
111
120
|
|
|
112
|
-
const {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
const {
|
|
122
|
+
askAi: _askAi,
|
|
123
|
+
locales: _locales,
|
|
124
|
+
mode: _mode,
|
|
125
|
+
indexName,
|
|
126
|
+
searchParameters,
|
|
127
|
+
translations,
|
|
128
|
+
...docSearchUserOptions
|
|
129
|
+
} = userOptions
|
|
130
|
+
// Normalize askAi: string -> { agentId }
|
|
131
|
+
const normalizedAskAi = typeof _askAi === 'string'
|
|
132
|
+
? { agentId: _askAi }
|
|
116
133
|
: _askAi || undefined
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return
|
|
134
|
+
const askAi = normalizedAskAi?.agentId ? normalizedAskAi : undefined
|
|
135
|
+
if (normalizedAskAi && !askAi)
|
|
136
|
+
console.warn('[valaxy-theme-press] Ask AI requires a published Agent Studio agentId. Migrate the legacy assistant in the Algolia dashboard.')
|
|
121
137
|
|
|
122
138
|
// Initialize sidepanel if askAi.sidePanel is configured
|
|
123
139
|
if (askAi?.sidePanel) {
|
|
@@ -130,10 +146,11 @@ async function initialize(userOptions: AlgoliaSearchOptions) {
|
|
|
130
146
|
sidepanelInstance = sidepanel({
|
|
131
147
|
...sidePanelConfig,
|
|
132
148
|
container: '#press-docsearch-sidepanel',
|
|
133
|
-
indexName: askAi.indexName ?? docSearchUserOptions.indexName,
|
|
134
149
|
appId: askAi.appId ?? docSearchUserOptions.appId,
|
|
135
150
|
apiKey: askAi.apiKey ?? docSearchUserOptions.apiKey,
|
|
136
|
-
|
|
151
|
+
agentId: askAi.agentId,
|
|
152
|
+
indices: askAi.indices ?? [askAi.indexName ?? indexName],
|
|
153
|
+
searchParameters: askAi.searchParameters,
|
|
137
154
|
onOpen: focusInput,
|
|
138
155
|
onClose: onClose.bind(null, 'sidepanel'),
|
|
139
156
|
onReady: () => {
|
|
@@ -149,8 +166,13 @@ async function initialize(userOptions: AlgoliaSearchOptions) {
|
|
|
149
166
|
}
|
|
150
167
|
|
|
151
168
|
const options: DocSearchProps = {
|
|
152
|
-
...docSearchUserOptions as DocSearchProps,
|
|
169
|
+
...docSearchUserOptions as Omit<DocSearchProps, 'container' | 'indices'>,
|
|
153
170
|
container: '#press-docsearch',
|
|
171
|
+
indices: [{
|
|
172
|
+
name: indexName,
|
|
173
|
+
searchParameters: searchParameters as Exclude<DocSearchProps['indices'][number], string>['searchParameters'],
|
|
174
|
+
}],
|
|
175
|
+
translations: normalizeTranslations(translations),
|
|
154
176
|
navigator: {
|
|
155
177
|
navigate(item) {
|
|
156
178
|
const { pathname, hash } = new URL(item.itemUrl, location.origin)
|
|
@@ -162,13 +184,6 @@ async function initialize(userOptions: AlgoliaSearchOptions) {
|
|
|
162
184
|
...item,
|
|
163
185
|
url: getRelativePath(item.url),
|
|
164
186
|
})),
|
|
165
|
-
// When sidepanel is enabled, intercept Ask AI events to open it instead
|
|
166
|
-
...(sidepanelInstance && {
|
|
167
|
-
interceptAskAiEvent: (initialMessage: any) => {
|
|
168
|
-
onBeforeOpen('sidepanel', () => sidepanelInstance?.open(initialMessage))
|
|
169
|
-
return true
|
|
170
|
-
},
|
|
171
|
-
}),
|
|
172
187
|
onOpen: focusInput,
|
|
173
188
|
onClose: onClose.bind(null, 'docsearch'),
|
|
174
189
|
onReady: () => {
|
|
@@ -187,18 +202,45 @@ async function initialize(userOptions: AlgoliaSearchOptions) {
|
|
|
187
202
|
},
|
|
188
203
|
}
|
|
189
204
|
|
|
190
|
-
|
|
205
|
+
if (askAi) {
|
|
206
|
+
const { default: docsearchAi } = await loadDocsearchAi()
|
|
207
|
+
if (currentInitialize !== initializeCount)
|
|
208
|
+
return
|
|
191
209
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
210
|
+
const aiOptions: DocSearchAIProps = {
|
|
211
|
+
...options,
|
|
212
|
+
askAi: {
|
|
213
|
+
agentId: askAi.agentId,
|
|
214
|
+
appId: askAi.appId,
|
|
215
|
+
apiKey: askAi.apiKey,
|
|
216
|
+
indices: askAi.indices ?? [askAi.indexName ?? indexName],
|
|
217
|
+
searchParameters: askAi.searchParameters,
|
|
218
|
+
suggestedQuestions: askAi.suggestedQuestions,
|
|
219
|
+
},
|
|
220
|
+
...(sidepanelInstance && {
|
|
221
|
+
interceptAskAiEvent: (initialMessage) => {
|
|
222
|
+
onBeforeOpen('sidepanel', () => sidepanelInstance?.open(initialMessage))
|
|
223
|
+
return true
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
}
|
|
227
|
+
docsearchInstance = docsearchAi(aiOptions)
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
const { default: docsearch } = await loadDocsearch()
|
|
231
|
+
if (currentInitialize !== initializeCount)
|
|
232
|
+
return
|
|
233
|
+
docsearchInstance = docsearch(options)
|
|
199
234
|
}
|
|
200
235
|
}
|
|
201
236
|
|
|
237
|
+
function cleanup() {
|
|
238
|
+
docsearchInstance?.destroy()
|
|
239
|
+
sidepanelInstance?.destroy()
|
|
240
|
+
docsearchInstance = undefined
|
|
241
|
+
sidepanelInstance = undefined
|
|
242
|
+
}
|
|
243
|
+
|
|
202
244
|
function focusInput() {
|
|
203
245
|
requestAnimationFrame(() => {
|
|
204
246
|
const input
|
|
@@ -253,16 +295,48 @@ function onClose(target: 'docsearch' | 'sidepanel') {
|
|
|
253
295
|
|
|
254
296
|
function loadDocsearch() {
|
|
255
297
|
if (!docsearchLoader)
|
|
256
|
-
docsearchLoader = import('@docsearch/js')
|
|
298
|
+
docsearchLoader = import('@docsearch/js/docsearch')
|
|
257
299
|
return docsearchLoader
|
|
258
300
|
}
|
|
259
301
|
|
|
302
|
+
function loadDocsearchAi() {
|
|
303
|
+
if (!docsearchAiLoader)
|
|
304
|
+
docsearchAiLoader = import('@docsearch/js')
|
|
305
|
+
return docsearchAiLoader
|
|
306
|
+
}
|
|
307
|
+
|
|
260
308
|
function loadSidepanel() {
|
|
261
309
|
if (!sidepanelLoader)
|
|
262
310
|
sidepanelLoader = import('@docsearch/sidepanel-js')
|
|
263
311
|
return sidepanelLoader
|
|
264
312
|
}
|
|
265
313
|
|
|
314
|
+
function normalizeTranslations(translations: AlgoliaSearchOptions['translations']): DocSearchProps['translations'] {
|
|
315
|
+
if (!translations)
|
|
316
|
+
return undefined
|
|
317
|
+
|
|
318
|
+
const modal = translations.modal as Record<string, any> | undefined
|
|
319
|
+
const searchBox = modal?.searchBox as Record<string, string> | undefined
|
|
320
|
+
const footer = modal?.footer as Record<string, string> | undefined
|
|
321
|
+
const { searchBox: _searchBox, footer: _footer, ...screenTranslations } = modal ?? {}
|
|
322
|
+
return {
|
|
323
|
+
button: translations.button,
|
|
324
|
+
modal: {
|
|
325
|
+
...screenTranslations,
|
|
326
|
+
searchBox: searchBox && {
|
|
327
|
+
clearButtonTitle: searchBox.resetButtonTitle,
|
|
328
|
+
clearButtonAriaLabel: searchBox.resetButtonAriaLabel,
|
|
329
|
+
closeButtonText: searchBox.cancelButtonText,
|
|
330
|
+
closeButtonAriaLabel: searchBox.cancelButtonAriaLabel,
|
|
331
|
+
},
|
|
332
|
+
footer: footer && {
|
|
333
|
+
...footer,
|
|
334
|
+
poweredByText: footer.searchByText,
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
266
340
|
function getRelativePath(url: string) {
|
|
267
341
|
const { pathname, hash } = new URL(url, location.origin)
|
|
268
342
|
return pathname.replace(/\.html$/, '') + hash
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ApiIndexGroup } from '../utils/api-index'
|
|
3
|
+
import { computed, onMounted, shallowRef, useId } from 'vue'
|
|
4
|
+
import { filterApiGroups } from '../utils/api-index'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<{
|
|
7
|
+
groups: ApiIndexGroup[]
|
|
8
|
+
label?: string
|
|
9
|
+
placeholder?: string
|
|
10
|
+
emptyText?: string
|
|
11
|
+
allText?: string
|
|
12
|
+
clearText?: string
|
|
13
|
+
resultsText?: string
|
|
14
|
+
}>(), {
|
|
15
|
+
label: 'Filter APIs',
|
|
16
|
+
placeholder: 'Search by name or category',
|
|
17
|
+
emptyText: 'No matching APIs.',
|
|
18
|
+
allText: 'All modules',
|
|
19
|
+
clearText: 'Clear filters',
|
|
20
|
+
resultsText: 'APIs',
|
|
21
|
+
})
|
|
22
|
+
const query = shallowRef('')
|
|
23
|
+
const ready = shallowRef(false)
|
|
24
|
+
onMounted(() => ready.value = true)
|
|
25
|
+
const module = shallowRef('')
|
|
26
|
+
const inputId = useId()
|
|
27
|
+
const modules = computed(() => [...new Set(props.groups.map(group => group.module).filter((name): name is string => !!name))])
|
|
28
|
+
const filtered = computed(() => filterApiGroups(props.groups, query.value, module.value))
|
|
29
|
+
const count = computed(() => filtered.value.reduce((total, group) => total + group.items.length, 0))
|
|
30
|
+
const sections = computed(() => [...new Set(filtered.value.map(group => group.module || ''))].map(name => ({
|
|
31
|
+
name,
|
|
32
|
+
groups: filtered.value.filter(group => (group.module || '') === name),
|
|
33
|
+
})))
|
|
34
|
+
function clear() {
|
|
35
|
+
query.value = ''
|
|
36
|
+
module.value = ''
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div class="press-api-index not-prose">
|
|
42
|
+
<div class="api-filter">
|
|
43
|
+
<label :for="inputId" class="api-filter-label">{{ label }}</label>
|
|
44
|
+
<div class="api-search-field">
|
|
45
|
+
<span class="api-search-icon" aria-hidden="true">⌕</span>
|
|
46
|
+
<input :id="inputId" v-model="query" :disabled="!ready" type="search" class="api-filter-input" :placeholder="placeholder" autocomplete="off" spellcheck="false">
|
|
47
|
+
</div>
|
|
48
|
+
<span class="api-result-count" role="status" aria-live="polite">{{ count }} {{ resultsText }}</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div v-if="modules.length > 1" class="api-module-filter" role="group" :aria-label="allText">
|
|
51
|
+
<button type="button" :disabled="!ready" :aria-pressed="!module" @click="module = ''">
|
|
52
|
+
{{ allText }}
|
|
53
|
+
</button>
|
|
54
|
+
<button v-for="name in modules" :key="name" type="button" :disabled="!ready" :aria-pressed="module === name" @click="module = name">
|
|
55
|
+
{{ name }}
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
<section v-for="section in sections" :key="section.name" class="api-module">
|
|
59
|
+
<h2 v-if="section.name" class="api-module-title">
|
|
60
|
+
{{ section.name }}
|
|
61
|
+
</h2>
|
|
62
|
+
<div class="api-groups">
|
|
63
|
+
<section v-for="group in section.groups" :key="group.title" class="api-group">
|
|
64
|
+
<h3 class="api-group-title">
|
|
65
|
+
{{ group.title }} <span>{{ group.items.length }}</span>
|
|
66
|
+
</h3>
|
|
67
|
+
<ul class="api-items">
|
|
68
|
+
<li v-for="item in group.items" :key="item.link" class="api-item">
|
|
69
|
+
<AppLink :to="item.link" class="api-link">
|
|
70
|
+
{{ item.text }}
|
|
71
|
+
</AppLink>
|
|
72
|
+
</li>
|
|
73
|
+
</ul>
|
|
74
|
+
</section>
|
|
75
|
+
</div>
|
|
76
|
+
</section>
|
|
77
|
+
<div v-if="!filtered.length" class="api-empty">
|
|
78
|
+
<p>{{ emptyText }}</p>
|
|
79
|
+
<button type="button" class="api-clear" @click="clear">
|
|
80
|
+
{{ clearText }}
|
|
81
|
+
</button>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<style scoped>
|
|
87
|
+
.press-api-index {
|
|
88
|
+
margin-top: 1.5rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.api-filter {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 0.75rem;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.api-filter-label {
|
|
99
|
+
width: 100%;
|
|
100
|
+
font-size: 0.875rem;
|
|
101
|
+
font-weight: 600;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.api-search-field {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
flex: 1;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
border: 1px solid var(--pr-c-divider-light);
|
|
110
|
+
border-radius: 8px;
|
|
111
|
+
background: var(--pr-c-surface);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.api-search-icon {
|
|
115
|
+
padding-left: 0.875rem;
|
|
116
|
+
font-size: 1.5rem;
|
|
117
|
+
color: var(--pr-c-text-2);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.api-filter-input {
|
|
121
|
+
width: 100%;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
padding: 0.75rem;
|
|
124
|
+
background: transparent;
|
|
125
|
+
color: var(--pr-c-text-1);
|
|
126
|
+
font: inherit;
|
|
127
|
+
font-size: 1rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.api-search-field:focus-within {
|
|
131
|
+
outline: 2px solid var(--pr-c-brand);
|
|
132
|
+
outline-offset: 2px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.api-filter-input:focus {
|
|
136
|
+
outline: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.api-result-count {
|
|
140
|
+
font-size: 0.75rem;
|
|
141
|
+
color: var(--pr-c-text-2);
|
|
142
|
+
font-variant-numeric: tabular-nums;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.api-module-filter {
|
|
146
|
+
display: flex;
|
|
147
|
+
gap: 0.375rem;
|
|
148
|
+
flex-wrap: wrap;
|
|
149
|
+
margin: 1rem 0 2.5rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.api-module-filter button {
|
|
153
|
+
padding: 0.375rem 0.875rem;
|
|
154
|
+
border-radius: 6px;
|
|
155
|
+
color: var(--pr-c-text-2);
|
|
156
|
+
font-size: 0.8125rem;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.api-module-filter button[aria-pressed="true"] {
|
|
161
|
+
background: var(--pr-c-brand-soft);
|
|
162
|
+
color: var(--pr-c-brand);
|
|
163
|
+
font-weight: 600;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.api-module-filter button:hover {
|
|
167
|
+
color: var(--pr-c-brand);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.api-module + .api-module {
|
|
171
|
+
margin-top: 3rem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.press-api-index .api-module-title {
|
|
175
|
+
margin: 0 0 1.25rem;
|
|
176
|
+
padding: 0 0 0.75rem;
|
|
177
|
+
border: 0;
|
|
178
|
+
border-bottom: 1px solid var(--pr-c-divider-light);
|
|
179
|
+
color: var(--pr-c-text-1);
|
|
180
|
+
font-size: 1.5rem;
|
|
181
|
+
font-family: var(--pr-font-mono);
|
|
182
|
+
letter-spacing: -0.03em;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.api-groups {
|
|
186
|
+
display: grid;
|
|
187
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
|
|
188
|
+
gap: 1.75rem;
|
|
189
|
+
align-items: start;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.press-api-index .api-group-title {
|
|
193
|
+
margin: 0 0 0.625rem;
|
|
194
|
+
padding: 0;
|
|
195
|
+
border: 0;
|
|
196
|
+
font-size: 0.875rem;
|
|
197
|
+
font-weight: 600;
|
|
198
|
+
color: var(--pr-c-text-2);
|
|
199
|
+
letter-spacing: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.api-group-title span {
|
|
203
|
+
margin-left: 0.375rem;
|
|
204
|
+
font-weight: 400;
|
|
205
|
+
font-size: 0.75rem;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.api-items {
|
|
209
|
+
padding: 0;
|
|
210
|
+
margin: 0;
|
|
211
|
+
list-style: none;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.api-item {
|
|
215
|
+
margin: 0;
|
|
216
|
+
overflow-wrap: anywhere;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.api-link {
|
|
220
|
+
display: block;
|
|
221
|
+
padding: 0.25rem 0;
|
|
222
|
+
color: var(--pr-c-brand);
|
|
223
|
+
font-size: 0.8125rem;
|
|
224
|
+
line-height: 1.65;
|
|
225
|
+
font-family: var(--pr-font-mono);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.api-empty {
|
|
229
|
+
padding: 2rem 0;
|
|
230
|
+
color: var(--pr-c-text-2);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.api-clear {
|
|
234
|
+
margin-top: 1rem;
|
|
235
|
+
color: var(--pr-c-brand);
|
|
236
|
+
text-decoration: underline;
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@media (width < 640px) {
|
|
241
|
+
.api-result-count {
|
|
242
|
+
width: 100%;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
</style>
|