--- import { getCollection } from 'astro:content'; import ContentWidth from '@/components/frames/ContentWidth.astro'; import MarkdownCode from '@/components/typography/MarkdownCode.astro'; import Table from '@/components/typography/Table.astro'; import Tbody from '@/components/typography/Tbody.astro'; import Td from '@/components/typography/Td.astro'; import Th from '@/components/typography/Th.astro'; import Thead from '@/components/typography/Thead.astro'; import Tr from '@/components/typography/Tr.astro'; import { isValidFramework } from '@/types/docs'; import type { PresetReference as PresetReferenceType } from '@/types/preset-reference'; import DocsLink from '../DocsLink.astro'; import FrameworkCase from '../FrameworkCase.astro'; import InlineMarkdown from './InlineMarkdown.astro'; const entries = await getCollection('presetReference'); const PINNED_PRESETS = ['video', 'audio']; const presets: PresetReferenceType[] = entries .map((e) => e.data) .sort((a, b) => { const aPin = PINNED_PRESETS.indexOf(a.name); const bPin = PINNED_PRESETS.indexOf(b.name); if (aPin !== -1 && bPin !== -1) return aPin - bPin; if (aPin !== -1) return -1; if (bPin !== -1) return 1; return a.name.localeCompare(b.name); }); const { framework } = Astro.params; const pkg = framework && isValidFramework(framework) ? `@videojs/${framework}` : '@videojs/html'; /** * Native media elements used by presets that don't have a custom element. * The pipeline can't detect these since they're not classes with `static tagName`. */ const NATIVE_MEDIA_ELEMENTS: Record = { video: 'video', audio: 'audio', }; function htmlMediaElement(preset: PresetReferenceType): string | undefined { return preset.html.mediaElement ?? NATIVE_MEDIA_ELEMENTS[preset.name]; } const listFormat = new Intl.ListFormat('en', { style: 'long', type: 'unit' }); --- { presets.map((preset) => { const id = `preset-${preset.name}`; const htmlMedia = htmlMediaElement(preset); return ( <> ); }) }
Import Description Details
{`${pkg}/${preset.name}`} {preset.description && ( )}