blocks rather than: shadcn's * DocsCode is unhighlighted, and a block whose text the element replaces has * no highlighting to keep in step. Each takes `tabindex="0"`, since it * scrolls (the site's code-block rule). * * shadcn's framework select becomes a font-source select (see docs.ts for * why). Both sources' steps are rendered and the select shows one. With * JavaScript off the default shows. */ // moves its class onto the element it renders, so the host itself // is a plain block and breaks the flex column that lets the panel scroll. // The container makes the host a flex column too. const TABS_HOST = '[&_ui-tabs]:flex [&_ui-tabs]:min-h-0 [&_ui-tabs]:flex-1 [&_ui-tabs]:flex-col'; function code(key: string, text: string, className = '') { return html` `; } const prose = (text: unknown) => html`${text}${text}
`; function section(step: number, title: string, body: unknown) { return html``; } // A copy button, shadcn's outline `sm` with the copy icon swapping to a check // for two seconds. `href`, when given, makes it a link that works with no // script (the stylesheet opens), and the element copies instead. function copyButton(label: string, kind: 'css' | 'prompt', href?: string) { const cls = cn(buttonClass({ variant: 'outline', size: 'sm' }), 'group/copy w-fit no-underline'); const body = html`${CopyIcon('')}${CheckIcon('')}${label}`; return href ? html`${body}` : html``; } function fontStepsFor(params: TypesetParams, source: FontSource, shown: boolean) { return html` ${step}. ${title}
${body}${fontSteps(params, source).map((step, i) => html`${prose(step.prose)}${code(`font-${source}-${i}`, step.code)}`)}`; } /** The tabs, shared by the xl panel and the Get Code drawer. */ export function docsContent(params: TypesetParams, origin: string) { return html``; } /** * shadcn's "Read the docs". This site has no typeset docs page yet, and the * stylesheet is shadcn's unchanged, so shadcn's page is the true reference. * (Asking modules/ui/docs/nav.ts would ship this page to the browser: the * elision analyser reads that module as client work.) */ function readTheDocs() { return html`Read the docs`; } /** The right-hand panel, from xl up. */ export function docsPanel(params: TypesetParams, origin: string) { return html` Docs Prompt ${ChevronDownIcon(nativeSelectIconClass())}`; } /** Below xl the panel moves into a drawer, opened from the customizer's Get Code button. */ export function getCodeDrawer(params: TypesetParams, origin: string, triggerClass: string) { return html`${docsContent(params, origin)}${readTheDocs()}`; } ${docsContent(params, origin)}Get Code
Install typeset with the values you picked.