Composable building blocks for shadcn/ui. A shadcn/ui registry that extends shadcn/ui instead of replacing it: a Tiptap rich text editor, a CodeMirror code editor, Video.js audio and video players, responsive image components and a streaming-safe markdown renderer, plus the blocks built on them. shadcn/ui is installed first and Blocove only adds the blocks and components it needs.
Blocove is developed against the shadcn/ui b0 preset (Base UI,
base-nova style, neutral palette, Lucide icons, Inter font), but it ships no
theme of its own: no base config, no theme tokens and no fonts. Items inherit
the shadcn/ui setup of the project they are added to, so your own preset and
theme stay in place. The flagship additions are five families: a composable
Tiptap rich text editor, whose shell, nodes and marks are
separate registry items with their own documentation page and whose content is
typeset with shadcn/typeset; a
CodeMirror code editor with
shiki highlighting, split into a shell and composable
extensions; a media family of Video.js audio and video
players whose skins are themed by the shadcn/ui tokens of the project they are
added to; an image family of native <img>/<picture> components that reserve
their space, serve a srcset and compose into viewers and editorial blocks; and a
markdown renderer that turns a growing string into the same typeset nodes, with
shiki fences, KaTeX math, Pele diagrams and shadcn/ui charts as optional
capability items.
Items are grouped per family. The rich text editor lives under the
rich-text-editor-* prefix and installs into components/blocove/rich-text-editor/,
the code editor under code-editor-* into components/blocove/code-editor/, the
media items into components/blocove/media/, the image items into
components/blocove/image/ and the markdown items into
components/blocove/markdown/, so a new family can be added next to them without
renaming existing items. Blocove owns its own namespace, so its files never mix
with shadcn/ui's components/ui.
The site is built with TanStack Start and the registry itself is plain JSON, so the same items work with the shadcn CLI from a GitHub address, a URL, or a namespace.
-
Node.js >= 22.22
-
pnpm >= 11 (
corepack enableis enough) -
Chromium for the browser tests:
pnpm exec playwright install chromium(one-off; Playwright only drives Vitest's browser mode) -
A project already set up with shadcn/ui using Base UI primitives. Blocove is developed against the
b0preset but ships no theme, so your own preset and colors stay in place:npx shadcn@latest init --preset b0
From a project with components.json and shadcn/ui installed:
# The rich text editor shell. It installs the basic nodes as well.
npx shadcn@latest add litingyes/blocove/rich-text-editor
# Add only the nodes and marks you compose into the editor.
npx shadcn@latest add litingyes/blocove/rich-text-editor-heading litingyes/blocove/rich-text-editor-bold
# A video player with the themed Video.js skin, or the hero block around it.
npx shadcn@latest add litingyes/blocove/video-player
npx shadcn@latest add litingyes/blocove/video-hero
# The markdown renderer, with the fences, diagrams and charts an answer needs.
npx shadcn@latest add litingyes/blocove/markdown
npx shadcn@latest add litingyes/blocove/markdown-code-block
npx shadcn@latest add litingyes/blocove/markdown-mermaid
npx shadcn@latest add litingyes/blocove/markdown-chartPin a release for reproducible installs:
npx shadcn@latest add litingyes/blocove/rich-text-editor#v0.2.0After the site is deployed, add the registry to components.json:
{
"registries": {
"@blocove": "https://blocove.vercel.app/r/{name}.json"
}
}or with the CLI:
npx shadcn@latest registry add @blocove=https://blocove.vercel.app/r/{name}.jsonThen install by namespace:
npx shadcn@latest add @blocove/rich-text-editorRegistry dependencies that point at shadcn/ui use the official item names (
button,kbd,toggle, ...), which the CLI resolves fromui.shadcn.comusing your project style. Dependencies between Blocove items use GitHub addresses (litingyes/blocove/...), so resolution works for both GitHub and namespace installs. The repository must stay public.
The editor is declarative: each Tiptap node or mark is a component that registers
its extension, and the base editor collects them from its children. The
rich-text-editor item installs the shell and the basic nodes; add the nodes and marks
you compose on top.
The family installs into components/blocove/rich-text-editor/, so imports are
namespaced: @/components/blocove/rich-text-editor/editor,
@/components/blocove/rich-text-editor/bold, and so on. The internal helper
installs as @/lib/blocove/rich-text-editor-extension.
import { EditorBold, EditorBoldToolbar } from '@/components/blocove/rich-text-editor/bold'
import {
Editor,
EditorBubbleMenu,
EditorCharacterCount,
EditorContent,
EditorToolbar,
} from '@/components/blocove/rich-text-editor/editor'
import { EditorHardBreak } from '@/components/blocove/rich-text-editor/hard-break'
import { EditorHeading, EditorHeadingToolbar } from '@/components/blocove/rich-text-editor/heading'
import { EditorLink, EditorLinkToolbar } from '@/components/blocove/rich-text-editor/link'
import { EditorParagraph } from '@/components/blocove/rich-text-editor/paragraph'
import { EditorText } from '@/components/blocove/rich-text-editor/text'
export function RichTextEditorExample() {
return (
<Editor defaultValue="<h2>Hello</h2><p>Blocove editor</p>">
<EditorText />
<EditorParagraph />
<EditorHardBreak />
<EditorHeading />
<EditorBold />
<EditorLink />
<EditorToolbar>
<EditorHeadingToolbar />
<EditorBoldToolbar />
<EditorLinkToolbar />
</EditorToolbar>
<EditorBubbleMenu>
<EditorBoldToolbar />
</EditorBubbleMenu>
<EditorContent className="min-h-40" />
<EditorCharacterCount />
</Editor>
)
}Four items bring Yjs collaboration to the editor.
rich-text-editor-collaboration binds the document to a Y.Doc,
rich-text-editor-collaboration-caret draws the remote cursors,
rich-text-editor-presence adds the avatar stack and the connection status, and
rich-text-editor-collaboration-block composes all of them in one file.
The items never import a provider package. They read a structural
CollaborationProvider (awareness plus an optional status), so Hocuspocus, a
Tiptap Cloud provider or a local transport all fit, and the block owns no
transport at all.
import { HocuspocusProvider } from '@hocuspocus/provider'
import * as Y from 'yjs'
import { RichTextEditorCollaborationBlock } from '@/components/blocove/rich-text-editor-collaboration-block'
const sharedDocument = new Y.Doc()
const provider = new HocuspocusProvider({
url: 'wss://collab.example.com',
name: 'product-launch',
document: sharedDocument,
})
export function DocumentEditor() {
return (
<RichTextEditorCollaborationBlock
document={sharedDocument}
provider={provider}
user={{ name: 'Ada Lovelace', color: '#2563eb' }}
onChange={html => console.log(html)}
/>
)
}The Yjs document is the source of truth: once collaboration is declared the
editor ignores value and defaultValue, and its local undo history steps aside
for the one collaboration owns. Seed the document instead of the React tree, and
dispose the provider with the document when the component unmounts.
Editor content is wrapped in a shadcn/typeset container. Download the stylesheet next to your main CSS file, import it after Tailwind, and add the preset:
curl -o src/typeset.css https://ui.shadcn.com/typeset.css/* src/styles.css */
@import 'tailwindcss';
@import './typeset.css';
@import '@fontsource-variable/inter';
@import '@fontsource-variable/jetbrains-mono';
@theme inline {
--font-inter: 'Inter Variable', sans-serif;
--font-jetbrains-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
--font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
}
.typeset-docs {
--typeset-font-body: var(--font-inter);
--typeset-font-heading: var(--font-inter);
--typeset-font-mono: var(--font-jetbrains-mono);
--typeset-size: 16px;
--typeset-leading: 1.75;
--typeset-flow: 1.25em;
}EditorContent renders typeset typeset-docs around the ProseMirror document;
pass typeset={false} to opt out. The typeset selectors skip elements with a
data-slot attribute, so component chrome keeps its own styles.
rich-text-editordepends onrich-text-editor-extension(internal helper),rich-text-editor-text,rich-text-editor-paragraphandrich-text-editor-hard-break, plus the shadcn/ui primitives used by the toolbar.- Every node and mark item depends on
rich-text-editor, so installing one item brings a working editor and the basic nodes. - Nodes:
rich-text-editor-text,rich-text-editor-paragraph,rich-text-editor-hard-break,rich-text-editor-heading,rich-text-editor-code-block,rich-text-editor-details,rich-text-editor-image,rich-text-editor-table. - Marks:
rich-text-editor-bold,rich-text-editor-italic,rich-text-editor-underline,rich-text-editor-strike,rich-text-editor-code,rich-text-editor-link. - Blocks:
rich-text-editor-blockcomposes the shell, every node and every mark into one installable editor, so a project can start from a complete editor instead of assembling the items itself.
The code editor is declarative in the same way: the shell is a CodeMirror view and
each capability — highlighting, language support, editor chrome — is a separate
item declared as a component inside <CodeEditor>. The code-editor item installs
the shell; add the extensions you compose on top.
The family installs into components/blocove/code-editor/, so imports are
namespaced: @/components/blocove/code-editor/editor,
@/components/blocove/code-editor/shiki, and so on. The helpers install as
@/lib/blocove/code-editor-extension and @/lib/blocove/code-editor-shiki.
import {
CodeEditor,
CodeEditorContent,
CodeEditorStatusBar,
CodeEditorToolbar,
} from '@/components/blocove/code-editor/editor'
import { CodeEditorLanguages } from '@/components/blocove/code-editor/languages'
import { CodeEditorLineNumbers } from '@/components/blocove/code-editor/line-numbers'
import { CodeEditorShiki } from '@/components/blocove/code-editor/shiki'
export function CodeEditorExample() {
return (
<CodeEditor defaultValue="const answer = 42" language="tsx" className="h-72">
<CodeEditorShiki />
<CodeEditorLanguages />
<CodeEditorLineNumbers />
<CodeEditorToolbar />
<CodeEditorContent />
<CodeEditorStatusBar />
</CodeEditor>
)
}The language prop on <CodeEditor> is shared by the declarations: highlighting
and language support read it unless they set their own. Highlighting is done by
shiki with the github-light and github-dark themes, following the page color
scheme; language support loads CodeMirror grammars on demand for indentation,
bracket matching and folding. The document is controlled through value and
onChange, and the shell renders the frame, toolbar, surface and status bar as
separate components.
Pass readOnly to render a document that can be selected and copied but not
edited; the status bar labels it and the diff controls keep working.
<CodeEditor defaultValue={modified} language="tsx" className="h-72">
<CodeEditorDiff original={original} />
<CodeEditorShiki />
<CodeEditorLanguages />
<CodeEditorLineNumbers />
<CodeEditorToolbar>
<CodeEditorDiffToolbar />
</CodeEditorToolbar>
<CodeEditorContent />
<CodeEditorStatusBar />
</CodeEditor>code-editor-diff adds an inline diff view: the document is compared against
original, and the changed and deleted lines are themed with the editor tokens
in both color schemes. CodeEditorDiffToolbar turns the toolbar into a review
surface: previous and next change (wrapping around) with the position and the
added and removed line counts, accept or reject for the chunk under the cursor,
accept or reject for every remaining chunk, and a reset once nothing is left.
Keyboard: Mod Alt Down and Mod Alt Up move between changes, Mod Enter
accepts and Shift Mod Enter rejects the chunk under the cursor; pass
shortcuts={false} to leave the bindings to the consumer. Accepting moves the
comparison base forward, rejecting restores the buffer from it, so both keep
working in a readOnly editor; labels localizes the per-chunk controls.
Pass mode="split" to render the two documents side by side instead: the editor
content stays on the right and original on the left, and revertControls
(default 'a-to-b') adds a control between the panes that copies a chunk across.
Navigation and the change counter keep working in both modes; the accept and
reject actions are hidden in split, where reverting happens between the panes.
code-editordepends oncode-editor-extension(internal helper) and the shadcn/ui primitives used by the toolbar and status bar.code-editor-shiki,code-editor-languagesandcode-editor-line-numbersdepend oncode-editor-extension; combine them with the shell.code-editor-diffdepends oncode-editor(it reuses the toolbar button) andcode-editor-extension(it replaces the editor surface when rendering side by side), and on theseparatorprimitive; it adds the themed diff view plus the review toolbar.code-editor-shikialso installslib/blocove/code-editor-shiki.ts, the shiki highlighter shared by the docs code panels and the editor.code-editor-blockdepends oncode-editor,code-editor-shiki,code-editor-languagesandcode-editor-line-numbers, and composes them into one installable editor: highlighted, language aware, with line numbers, the toolbar and the status bar.
Video and audio come as small composable items built on Video.js 10
(@videojs/react). A shell owns the Video.js player and its packaged skin, the
media element is a separate item, and the skin is themed through the settings the
packaged skins publish: the radius, hairline, font and scale are mapped from your
shadcn/ui tokens, while the accent keeps the skin's contrasting default unless you
pass accentColor.
The family installs into components/blocove/media/, so imports are namespaced:
@/components/blocove/media/video, @/components/blocove/media/audio,
@/components/blocove/media/ambient-video, @/components/blocove/media/live,
@/components/blocove/media/hls-video, @/components/blocove/media/hls-audio,
and the two internal helpers in @/lib/blocove/media-theme and
@/components/blocove/media/tracks. Four items cover the family: video-player
and audio-player for progressive files, live-player for live and DVR streams,
and hls-media for adaptive HLS manifests. The shells and the media elements mix
freely, so a stream and a download play through the same interface.
import { VideoMedia, VideoPlayer } from '@/components/blocove/media/video'
export function Clip() {
return (
<VideoPlayer title="Episode one" poster="/poster.jpg">
<VideoMedia src="/clip.mp4" />
</VideoPlayer>
)
}VideoPlayer is the Video.js video preset and its skin; VideoMedia is the
native <video> element. Because the media element registers itself with the
player on mount, the shell never needs to change when the source does, and
tracks on the media element becomes the captions menu:
<VideoPlayer title="Captioned clip" aspectRatio="video">
<VideoMedia
src="/clip.mp4"
tracks={[
{
src: '/captions.vtt',
label: 'English',
srcLang: 'en',
default: true
}
]}
/>
</VideoPlayer>audio-player pairs AudioPlayer with AudioMedia and a skin that follows the
inherited color-scheme, so a dark page gets a dark player. ambient-video
renders the chrome-less background preset — muted, looped and autoplaying — with
a slot for the content drawn over it.
hls-media swaps the progressive element for an adaptive one. HlsVideoMedia and
HlsAudioMedia register with the player the same way, so the shell, the skin and
the captions menu stay exactly as they were:
import { HlsVideoMedia } from '@/components/blocove/media/hls-video'
import { VideoPlayer } from '@/components/blocove/media/video'
export function Stream() {
return (
<VideoPlayer title="Adaptive stream" poster="/poster.jpg">
<HlsVideoMedia src="/stream.m3u8" />
</VideoPlayer>
)
}HLS plays through the stream engine packaged with Video.js 10: it runs over Media
Source Extensions, fills the quality menu from the renditions the manifest
declares and needs no extra dependency. The engine resolves the segment URIs
against the manifest and fetches them itself, so use a source the page can reach.
streamType accepts 'on-demand', 'live' or 'unknown': set it to pin the
reported delivery before the playlist is parsed, omit it to let the engine detect
it, and pass crossOrigin/source when the manifest needs CORS credentials or a
DRM configuration.
live-player pairs the Video.js live presets with any media element. The live
button seeks back to the edge, and the DVR window follows the playlist:
import { HlsVideoMedia } from '@/components/blocove/media/hls-video'
import { LiveVideoPlayer } from '@/components/blocove/media/live'
export function Live() {
return (
<LiveVideoPlayer title="Live from the edge" poster="/poster.jpg">
<HlsVideoMedia src="/live.m3u8" streamType="live" />
</LiveVideoPlayer>
)
}LiveAudioPlayer is the audio equivalent for radio and live episodes. Every
shell accepts locale, a BCP 47 tag that translates the player labels through
the Video.js i18n provider; omit it and the labels keep the provider already in
your app. VideoPlayer also accepts renderThumbnail, which replaces the
storyboard frame the skin draws while you scrub the timeline.
The items pass the aspect ratio, the accent and the object fit as props, and
forward className/style to the skin, which is the only styling surface the
packaged skins consider public.
video-playerdepends onmedia-themeandmedia-tracks(internal helpers),@videojs/reactandcn.audio-playerdepends on the same helpers, plus@videojs/react.ambient-videodepends onmedia-themeand@videojs/react.hls-mediadepends onmedia-tracks(internal helper) and@videojs/react; it ships both adaptive media elements.live-playerdepends onmedia-theme(internal helper),@videojs/reactandcn; it ships the live video and audio shells.video-herodepends onambient-videoand thebadgeprimitive.video-showcasedepends onvideo-player,media-tracks,badgeandseparator.audio-episode-playerdepends onaudio-player,badgeandseparator.video-playlistdepends onvideo-playerandscroll-area.
public/media/ holds the sample clips the docs demos and the browser suite play.
They are committed so the docs and the tests run without a network request. The
material is NASA's: public/media/CREDITS.md records the two sources, the exact
excerpts and the licensing, and scripts/generate-media-samples.mjs rebuilds the
files from them (node scripts/generate-media-samples.mjs). The script downloads
the sources into .cache/media-samples once and only needs ffmpeg after that.
sample-video.mp4,sample-video-alt.mp4andsample-audio.m4aare the documentation previews: H.264/AAC, which every desktop browser decodes. The two videos are 8 s excerpts of NASA's Artemis II launch trailer; the audio is the twenty-second opening of a "Houston, We Have a Podcast" episode.sample-video.webm,sample-video-alt.webmandsample-audio.webmare for the browser suite: the Chromium build Vitest drives ships no H.264 or AAC decoder, so the tests play VP9/Opus.sample-poster.jpg,sample-poster-alt.jpgandsample-cover.jpgare frames of the trailer excerpt, so previews stay visually consistent, andsample-captions.vttis NASA's own subtitle file cut down to the main clip, so the caption demos show the words that are actually being spoken.
scripts/generate-media-samples.sh wraps those clips as the committed HLS
fixtures in public/media/hls/; rerun it instead of editing the manifests by
hand:
sample-video.m3u8is a two-rendition ABR master (640x360 and 960x540) with fMP4/CMAF segments, andsample-audio.m3u8is the audio master.sample-live.m3u8andsample-live-audio.m3u8are the live masters. Each one lists an EVENT playlist without an end marker, so the live demos read as live without a network stream.- Every public manifest is a master, because the Video.js 10 stream engine resolves a source as a multivariant playlist: a bare media playlist attaches MediaSource and then never requests a segment.
Images are native <img> and <picture> elements, not a framework image
loader: the primitive owns the layout-stable box, the srcset, the focal point,
the placeholder and the fallback. It adds no dependency, so it installs next to
whatever framework you already use and can be replaced by next/image without
changing the surface around it.
The family installs into components/blocove/image/:
@/components/blocove/image/image, figure, zoom, gallery and compare,
with the helper in @/lib/blocove/image-pipeline.
import { Image } from '@/components/blocove/image/image'
export function Frame() {
return (
<Image
src="/launch-960.jpg"
alt="The launch vehicle on the pad"
aspectRatio="16 / 9"
widths={[320, 480, 640, 960]}
sizes="(min-width: 1024px) 640px, 100vw"
transform={(src, width) => src.replace(/-960\.jpg$/, `-${width}.jpg`)}
placeholder="var(--muted)"
/>
)
}widths and transform build the srcset; pass an explicit srcSet instead when
the URLs come straight from your CDN. priority switches the image to eager
loading, synchronous decoding and a high fetch priority for the largest
contentful element on the page. focalPoint, objectFit and placeholder
control how the box looks before the file loads; fallback replaces a failed
image instead of leaving the browser's broken-image icon in the layout.
The viewers compose on top of that primitive: image-zoom opens the full image
in a dialog, image-gallery adds a roving-focus thumbnail grid, and
image-compare uses a native range input for a before/after split.
image-figure adds the editorial caption and credit, while the two blocks
(image-hero and image-showcase) are complete surfaces built from them.
imagedepends onimage-pipeline(internal: srcset, focal point and placeholder helpers).image-figuredepends onimage;image-comparedepends onimagetoo.image-zoomdepends onimageand thedialogprimitive.image-gallerydepends onimage,image-zoomand thebuttonprimitive.image-herodepends onimageandbadge.image-showcasedepends onimage,image-gallery,image-zoom,badgeandseparator.
public/image/ holds the sample photographs the docs demos and the browser suite
render. They are derived from the NASA material already committed for the media
family; public/image/CREDITS.md records the lineage and
scripts/generate-image-samples.mjs rebuilds every file from
public/media/sample-poster.jpg and public/media/sample-video.mp4 with ffmpeg.
The sample-launch-* files are the poster at four widths for the srcset demos,
sample-frame-a/b/c.jpg are three frames for the gallery, and
sample-before-960.jpg/sample-after-960.jpg are the same frame desaturated and
untouched for the comparison.
The markdown family is a renderer, not an editor: <Markdown source> parses the
string into semantic elements inside the typeset typeset-docs container, so
every node style comes from shadcn/typeset and a document reads like the rich
text editor. The shell has no runtime dependencies; the fence, math, Mermaid and
chart renderers are optional capability items registered through the components
map. code is the fallback fence renderer, math typesets formulas, and fences
dispatches a fence to a renderer by its language.
The family installs into components/blocove/markdown/, so imports are
namespaced: @/components/blocove/markdown/markdown,
@/components/blocove/markdown/code-block,
@/components/blocove/markdown/math,
@/components/blocove/markdown/mermaid and
@/components/blocove/markdown/chart. The parser installs as
@/lib/blocove/markdown-parse; the capability items also ship
@/lib/blocove/markdown-shiki, @/lib/blocove/markdown-mermaid and
@/lib/blocove/markdown-chart.
import { MarkdownChart } from '@/components/blocove/markdown/chart'
import { MarkdownCodeBlock } from '@/components/blocove/markdown/code-block'
import { Markdown } from '@/components/blocove/markdown/markdown'
import { MarkdownMath } from '@/components/blocove/markdown/math'
import { MarkdownMermaid } from '@/components/blocove/markdown/mermaid'
export function Answer({ source, streaming }: { source: string, streaming: boolean }) {
return (
<Markdown
source={source}
streaming={streaming}
components={{
code: MarkdownCodeBlock,
math: MarkdownMath,
fences: { mermaid: MarkdownMermaid, chart: MarkdownChart },
}}
/>
)
}source is the whole document, not a delta: pass the string you have so far and
keep appending to it. Streaming is the default behaviour, not a second mode:
while the source grows, the parser keeps every block that already ended, by
identity, and re-parses only the open one, so finished elements keep their DOM, a
completed fence is not tokenized again and a half-written marker stays literal
until its closing token arrives. streaming only marks the surface (aria-busy,
data-streaming) and the block still being written while tokens are arriving.
Fence renderers also receive complete: the closing fence arrived, or the source
is final (a stream that ends on the closing fence without a trailing newline).
That is the signal a renderer uses to draw a diagram or a chart instead of
showing the source.
The parser covers headings (ATX and setext), paragraphs, fenced code, blockquotes,
bullet, ordered and task lists with nesting, GFM tables, thematic breaks, math
fences and footnote definitions; inline it covers strong, emphasis,
strikethrough, code spans, links, images, math, footnote references and hard
breaks. Raw HTML is escaped, and only http, https, mailto, tel, fragment
and relative targets become anchors. Raw HTML passthrough, reference-style links,
multi-paragraph footnote bodies and heading ids are out of scope. Fence chrome
(language title and copy) comes from markdown-code-block; a fence with no
registered renderer keeps its source, so Mermaid and chart rendering stay opt-in.
markdown-parseis internal: the block scanner, the inline parser and the append-only cache, with no dependencies.markdowndepends onmarkdown-parseandcn, and ships the shell, the node renderers and the streaming cache hook.markdown-code-blockdepends onmarkdown-parseand thecode-blockitem, addsshiki, and ships the fence renderer plus the tokenizer that highlights a streamed fence line by line. It renders the shadcn/ui code block with the language in the header and a copy action.markdown-mathdepends onmarkdown-parse, addskatex, and ships the math renderer; importkatex/dist/katex.min.cssonce in the application.markdown-mermaiddepends onmarkdown-parseandcode-block, addspele, and rendersmermaidfences after the closing fence. Register it underfences.mermaid.markdown-chartdepends onmarkdown-parse,chartandcode-block, addsrecharts, and renderschartfences from the JSON spec. Register it underfences.chart.- The capability items are optional: without a registered renderer the shell
falls back to a plain
<pre><code>fence and literal$…$text.
Mermaid diagrams are drawn by Pele: the Mermaid 12.1 built-in diagram types,
colors from the shadcn CSS variables, images disabled, and the source stays
visible until the fence closes or the diagram is rejected. Charts are a small
JSON contract rather than arbitrary components: bar, line, area and pie,
1–200 rows and 1–8 series, with a pie limited to one series and 1–12 slices.
Both render client-side; server rendering keeps the source.
| Item | Type | Description |
|---|---|---|
rich-text-editor |
registry:ui |
Rich text editor shell: root, content, toolbar, bubble menu and count |
rich-text-editor-block |
registry:block |
Complete editor block: every node, mark, control and the count |
rich-text-editor-extension |
registry:lib |
Internal helper for declaring Tiptap extensions as components |
rich-text-editor-text |
registry:ui |
Tiptap Text node |
rich-text-editor-paragraph |
registry:ui |
Tiptap Paragraph node |
rich-text-editor-hard-break |
registry:ui |
Tiptap HardBreak node |
rich-text-editor-heading |
registry:ui |
Heading node and toolbar selector |
rich-text-editor-code-block |
registry:ui |
Code block node and toolbar toggle |
rich-text-editor-details |
registry:ui |
Collapsible details node with a React node view |
rich-text-editor-image |
registry:ui |
Image node and URL insert control |
rich-text-editor-table |
registry:ui |
Table kit and command menu |
rich-text-editor-bold |
registry:ui |
Bold mark and toolbar toggle |
rich-text-editor-italic |
registry:ui |
Italic mark and toolbar toggle |
rich-text-editor-underline |
registry:ui |
Underline mark and toolbar toggle |
rich-text-editor-strike |
registry:ui |
Strikethrough mark and toolbar toggle |
rich-text-editor-code |
registry:ui |
Inline code mark and toolbar toggle |
rich-text-editor-link |
registry:ui |
Link mark and URL popover |
code-editor |
registry:ui |
Code editor shell: root, surface, toolbar and status bar |
code-editor-extension |
registry:lib |
Internal helper for declaring CodeMirror extensions as components |
code-editor-shiki |
registry:ui |
Shiki syntax highlighting for the editor |
code-editor-languages |
registry:ui |
CodeMirror language support for indentation, brackets and folding |
code-editor-line-numbers |
registry:ui |
Line numbers, fold gutter and active line highlight |
code-editor-diff |
registry:ui |
Inline or side-by-side diff with accept, revert and chunk navigation |
code-editor-block |
registry:block |
Complete code editor block: highlighting, languages, chrome and status |
video-player |
registry:ui |
Video player shell: themed skin, native media and track declarations |
audio-player |
registry:ui |
Audio player shell with a skin that follows the page color scheme |
ambient-video |
registry:ui |
Chrome-less background video with a slot for the content over it |
live-player |
registry:ui |
Live video and audio shells on the Video.js live presets |
hls-media |
registry:ui |
Adaptive HLS video and audio media elements for the same shells |
media-theme |
registry:lib |
Internal helper mapping shadcn/ui tokens to the skin settings |
media-tracks |
registry:ui |
Internal helper rendering track declarations as native <track>s |
video-hero |
registry:block |
Hero section with ambient video, a headline and calls to action |
video-showcase |
registry:block |
Captioned video: player, title, description, facts and actions |
audio-episode-player |
registry:block |
Podcast episode: cover art, facts, player and actions |
video-playlist |
registry:block |
Video next to a selectable playlist that swaps the media |
image-pipeline |
registry:lib |
Internal helper: srcset, focal-point and placeholder values |
image |
registry:ui |
Responsive image: reserved box, srcset, placeholder and fallback |
image-figure |
registry:ui |
Image with an editorial caption and credit |
image-zoom |
registry:ui |
Thumbnail that opens the full image in a dialog |
image-gallery |
registry:ui |
Selected image plus a roving-focus thumbnail grid |
image-compare |
registry:ui |
Before/after split driven by a native range input |
image-hero |
registry:block |
Hero with a full-bleed photograph behind the copy |
image-showcase |
registry:block |
Editorial photo story with a lead image, facts and a gallery |
markdown |
registry:ui |
Streaming-safe markdown renderer inside a shadcn/typeset container |
markdown-parse |
registry:lib |
Internal parser: block scanner, inline parser and streaming cache |
markdown-code-block |
registry:ui |
Shiki-highlighted fences inside the shadcn/ui code block |
markdown-math |
registry:ui |
KaTeX math renderer for the markdown shell |
markdown-mermaid |
registry:ui |
Mermaid fence renderer drawn with Pele, source while streaming |
markdown-chart |
registry:ui |
JSON-driven shadcn/ui charts for chart fences |
Every Blocove file declares an explicit target, so items install into the
Blocove namespace instead of shadcn/ui's ui alias: the rich-text-editor-*,
code-editor-*, media, image and markdown UI items land in
components/blocove/rich-text-editor/, components/blocove/code-editor/,
components/blocove/media/, components/blocove/image/ and
components/blocove/markdown/, the media and image blocks in
components/blocove/, and the helpers in lib/blocove/. Projects that
use a src directory get the same paths under src/.
The blocks ship one file each: blocks/rich-text-editor-block.tsx targets
components/blocove/rich-text-editor-block.tsx and depends on the shell and
every node and mark item, so a single install produces a complete editor;
blocks/code-editor-block.tsx targets
components/blocove/code-editor-block.tsx and depends on the shell, the
highlighting, the language support and the line-number item.
The complete editor blocks are rich-text-editor-block and
code-editor-block; they were named rich-text-editor-playground and
code-editor-playground while they were only demos. A block is the normal,
functional editor of its family, so the Playground suffix is gone from the
registry item, the installed file and the documentation. The shell items keep
their names (rich-text-editor and code-editor), so composing the pieces
yourself is unchanged. No release was tagged with the old names, so no aliases
are kept and the old /r/*-playground.json payloads no longer exist.
Blocove ships no base config: every item installs files into your project and
official shadcn/ui components arrive as that item's registryDependencies. Your
shadcn/ui preset, fonts and theme tokens stay authoritative; Blocove does not
overwrite them.
rich-text-editor-extension, code-editor-extension, markdown-parse and the
media helpers (media-theme, media-tracks) are internal: they are installed as
dependencies of their family's items and are hidden from the site catalog and
documentation navigation.
The base item was removed. It only declared the official shadcn/ui components
and Blocove's own default configuration (b0 preset, neutral palette, Lucide
icons, Inter), a setup that belongs to the consuming project. It shipped no
files, so nothing has to be deleted from existing projects: drop
litingyes/blocove/base from install scripts and install the items you use.
Installs pinned to a tag that still lists base keep working.
Blocove no longer re-ships shadcn/ui primitives. The button, input, label,
card, theme and utils items were removed from HEAD because they were
verbatim copies of shadcn/ui. Install the official components instead:
npx shadcn@latest add button card input labelInstalls pinned to the v0.1.0 tag keep working, since tags are immutable.
The rich text editor items were renamed to the rich-text-editor-* family (previously
editor, editor-bold, ...) and the login-01 block was removed before the
v0.2.0 release. Nothing was tagged with the old names, so no aliases are kept
and /r/editor*.json URLs no longer exist.
Blocove items no longer install into shadcn/ui's components/ui namespace:
| Before | After |
|---|---|
components/ui/rich-text-editor/<name>.tsx |
components/blocove/rich-text-editor/<name>.tsx |
components/ui/code-editor/<name>.tsx |
components/blocove/code-editor/<name>.tsx |
components/rich-text-editor-block.tsx |
components/blocove/rich-text-editor-block.tsx |
lib/rich-text-editor-extension.ts |
lib/blocove/rich-text-editor-extension.ts |
lib/code-editor-extension.ts |
lib/blocove/code-editor-extension.ts |
lib/code-editor-shiki.ts |
lib/blocove/code-editor-shiki.ts |
Re-run shadcn add for the items you use, delete the files left at the old
paths, and update the imports. shadcn/ui primitives keep their components/ui
paths.
BRAND.md # slogan, voice and naming rules for the brand
registry.json # registry catalog entry point (name, homepage, include)
vitest.config.ts # Vitest projects: happy-dom unit suite + Chromium E2E
tests/
setup/unit.ts # unit setup: act flag, RTL cleanup, DOM shims
helpers/ # render shells, fixtures, registry manifest reader
unit/ # happy-dom suites (components, libs, distribution contract)
e2e/ # Vitest browser mode suites on real Chromium
src/registry/blocove/
registry.json # item definitions, included by the root registry
lib/code-editor-extension.ts # registry:lib helper for the code editor family
lib/code-editor-shiki.ts # registry:lib shiki highlighter for the code editor
lib/rich-text-editor-extension.ts # registry:lib helper for the rich text editor family
lib/markdown-parse.ts # registry:lib parser and streaming cache for markdown
lib/markdown-shiki.tsx # registry:lib shiki tokenizer for streamed fences
lib/markdown-mermaid.ts # registry:lib Pele loader and mount options for Mermaid
lib/markdown-chart.ts # registry:lib chart spec parser and validator
lib/media-theme.ts # registry:lib helper mapping shadcn/ui tokens to the skins
lib/image-pipeline.ts # registry:lib helper for srcsets, focal points and placeholders
ui/code-editor/ # registry:ui items (shell, highlighting, languages, chrome)
ui/media/ # registry:ui items (video, audio, tracks, ambient video)
ui/image/ # registry:ui items (image, figure, zoom, gallery, compare)
ui/markdown/ # registry:ui items (renderer, code fence, math, mermaid, chart)
ui/rich-text-editor/ # registry:ui items (shell, nodes, marks)
blocks/rich-text-editor-block.tsx # registry:block item (complete editor)
blocks/code-editor-block.tsx # registry:block item (complete code editor)
blocks/video-hero.tsx # registry:block items (hero, showcase, episode, playlist)
blocks/video-showcase.tsx
blocks/audio-episode-player.tsx
blocks/video-playlist.tsx
blocks/image-hero.tsx # registry:block items (hero and photo story)
blocks/image-showcase.tsx
src/docs/
types.ts # DocsPage and DocsPageData types
nav.ts # docs navigation, one tree per kind, grouped per family
item-endpoints.ts # markdown responses and the legacy /items redirects
item-head.ts # document head shared by the components and blocks routes
pages/ # docs pages, auto-registered from the module tree
examples/ # demo components shown on each page
snippets/ # generated usage snippets for the code panels
src/components/docs/ # docs shell: sidebar, TOC, preview tabs, code block, API
src/typeset.css # vendored shadcn/typeset stylesheet
src/lib/docs-commands.ts # CLI commands used by the installation section
src/lib/docs-markdown.ts # Copy Page markdown and the .md endpoint
src/lib/download-file.ts # code panel download file names and blobs
src/lib/registry-source.ts # raw registry sources for the manual install
src/lib/registry-data.ts # generated catalog and item lookup used by the routes
src/components/ui/ # official shadcn/ui components (installed with the CLI)
src/hooks/ # official shadcn/ui hooks (installed with the CLI)
src/lib/highlighter.tsx # official shadcn/ui helper (installed with the CLI)
src/routes/ # TanStack Start site (home, catalogs, item pages, .md endpoints)
src/styles.css # Tailwind CSS entry (b0 preset theme + typeset)
scripts/build-catalog.mjs # public/r/registry.json -> src/generated/registry.json
scripts/clean-registry.mjs # clears generated registry artifacts before a build
scripts/check-preset.mjs # asserts the project still resolves to the b0 preset
scripts/check-registry-paths.mjs # asserts every item targets the Blocove namespace
scripts/generate-media-samples.mjs # downloads the NASA sources, cuts and encodes the sample clips
scripts/generate-media-samples.sh # wraps the clips as the committed HLS fixtures
scripts/generate-image-samples.mjs # resizes the poster and extracts the sample image frames
public/r/ # generated registry JSON (gitignored)
public/media/ # committed sample clips, posters, captions, credits and HLS fixtures
public/image/ # committed sample photographs and their creditssrc/registry/blocove/is the single source of truth for Blocove extensions. Items are grouped by family: the rich text editor lives inui/rich-text-editor/, the complete editor block inblocks/, the code editor inui/code-editor/, the Video.js items inui/media/, the image items inui/image/, the markdown renderer inui/markdown/, and a new family gets its own folder and item prefix. Every shipped file declares atargetundercomponents/blocove/...orlib/blocove/....src/components/ui/,src/hooks/andsrc/lib/highlighter.tsxare vendored from shadcn/ui. This repository installs the full official component set so the whole shadcn/ui surface is available as context for composing new extensions. Consumers only install the items they use.src/typeset.cssis vendored verbatim from shadcn/ui and excluded from ESLint as well, so refreshing it is a file copy.
Docs demos import registry files through the repository path
(@/registry/blocove/ui/rich-text-editor/bold). The shipped items themselves use the
exact paths consumers get (@/components/blocove/rich-text-editor/*,
@/components/blocove/code-editor/*, @/components/blocove/media/*,
@/components/blocove/image/*, @/lib/blocove/*), so the site resolves
those specifiers to the registry sources in tsconfig.json and
vite.config.ts. The family mappings cover every node and mark, which is what
lets the blocks run their shipped imports in the docs preview. Add a
mapping there when a registry item imports another item that has no local file
under src/components/ui or src/lib.
pnpm install # installs dependencies and the git hooks
pnpm dev # http://localhost:3000, regenerates public/r firstUseful scripts:
| Script | Description |
|---|---|
pnpm registry:build |
Clear public/r and run shadcn build |
pnpm registry:check |
Fail unless every item targets the Blocove namespace |
pnpm registry:prepare |
Build registry JSON, check paths, generate the catalog |
pnpm registry:validate |
Validate litingyes/blocove from GitHub |
pnpm collab:dev |
Hocuspocus server for the collaboration demo (port 1234) |
pnpm preset:check |
Fail unless the project resolves to the b0 preset |
pnpm typecheck |
TypeScript |
pnpm lint |
ESLint: lint and formatting |
pnpm lint:fix |
ESLint with autofix |
pnpm check |
preset check, typecheck, lint and production build |
The generated files (public/r, src/generated) are gitignored. predev,
prebuild and pretypecheck regenerate them automatically.
src/components/ui/**, src/hooks/** and src/lib/highlighter.tsx are excluded
from ESLint so they stay identical to upstream and can be updated with
pnpm exec shadcn add --overwrite. src/typeset.css is excluded for the same
reason.
To refresh the components, run:
pnpm exec shadcn add --all -y
pnpm run typecheckUpstream scroll-area.tsx ships an unused import * as React from "react" that
trips noUnusedLocals; Blocove removes that one line locally. If a refresh adds it
back, delete it again.
pnpm install runs prepare and installs the git hooks with
lefthook. The pre-commit hook runs
lint-staged, which applies
eslint --fix to every staged file and stages the result again, so lint and
formatting errors never reach a commit.
- Skip the hook once with
LEFTHOOK=0 git commit ...orgit commit --no-verify; CI still runspnpm lint. - Reinstall the hooks with
pnpm exec lefthook install.
ESLint is the single source of truth for linting and formatting
(@antfu/eslint-config).
.css, .md, .json and .yaml files are formatted through its formatters
integration, and Tailwind class names are kept in canonical order by
eslint-plugin-better-tailwindcss.
Blocove only ships extensions. Never copy a shadcn/ui component into the registry: reference it instead.
- Put the source files under
src/registry/blocove/(lib/,ui/,blocks/, ...). - Import shadcn/ui components from
@/components/ui/*and other Blocove items from@/components/blocove/*or@/lib/blocove/*. The CLI rewrites those specifiers to the consumer's aliases on install. - Add an item to
src/registry/blocove/registry.json. Paths are relative to that file:Every shipped file needs an explicit{ "name": "settings-dialog", "type": "registry:block", "title": "Settings Dialog", "description": "A settings dialog composed from shadcn/ui primitives.", "dependencies": ["cn"], "registryDependencies": ["button", "dialog", "field", "input", "label"], "files": [ { "path": "blocks/settings-dialog/components/settings-dialog.tsx", "type": "registry:component", "target": "components/blocove/settings-dialog.tsx" } ] }targetundercomponents/blocove/orlib/blocove/;pnpm registry:checkenforces it. - Add a suite under
tests/unit/(component helpers live intests/helpers/). The distribution contract suite picks the new item up automatically, and the coverage gate fails when the item ships untested code. - Run
pnpm run registry:prepareand checkpublic/r/<name>.json. - Commit the source and item definition, then tag a release.
- Create
src/registry/blocove/ui/rich-text-editor/<name>.tsx. - Declare the extension with the shared helper:
import { Heading } from '@tiptap/extension-heading' import { defineExtensionComponent } from '@/lib/blocove/rich-text-editor-extension' export const EditorHeading = defineExtensionComponent('heading', props => [ Heading.configure(props), ])
- Export a toolbar control when the extension needs one. Controls use
useCurrentEditor()andEditorToolbarButtonfrom@/components/blocove/rich-text-editor/editor; guard the null editor, then read active state in an inner component withuseEditorState. - Add the item to
src/registry/blocove/registry.jsonwithtype: "registry:ui", pathui/rich-text-editor/<name>.tsxandtarget: "components/blocove/rich-text-editor/<name>.tsx", the Tiptap package independencies, andregistryDependencies: ["litingyes/blocove/rich-text-editor"]plus the shadcn/ui primitives the control uses. - Document it:
- demo:
src/docs/examples/rich-text-editor/<name>.tsx, composingRichTextEditorDemoFramefromsrc/docs/examples/rich-text-editor/frame.tsx; - data:
src/docs/pages/rich-text-editor/<name>.tsexporting adocsPagewith the item name andrichTextEditorUsage(...)as the example code. Pages are auto-registered from the module tree, so no index edit is needed; - add the item name to
src/docs/nav.tsunder theRich Text Editorsection.
- demo:
- Add a suite in
tests/unit/rich-text-editor/withrenderRichTextEditorfromtests/helpers/render-rich-text-editor.tsx; click the toolbar control, assert the emitted HTML and the pressed state. - Run
pnpm test,pnpm run typecheck,pnpm run lintandpnpm run build.
- Create
src/registry/blocove/ui/code-editor/<name>.tsx. - Declare the CodeMirror extension with the shared helper:
import { lineNumbers } from '@codemirror/view' import { defineCodeEditorExtension } from '@/lib/blocove/code-editor-extension' export const CodeEditorNumbers = defineCodeEditorExtension('numbers', () => [ lineNumbers(), ])
- The factory receives the declaration props and the editor root context, so a
declaration can fall back to the
languageset once on<CodeEditor>. - Add the item to
src/registry/blocove/registry.jsonwithtype: "registry:ui", pathui/code-editor/<name>.tsxandtarget: "components/blocove/code-editor/<name>.tsx", the CodeMirror or shiki packages independencies, andregistryDependencies: ["litingyes/blocove/code-editor-extension"]plus the shadcn/ui primitives the declaration renders. - Document it:
- demo:
src/docs/examples/code-editor/<name>.tsx, composingCodeEditorDemoFramefromsrc/docs/examples/code-editor/frame.tsx; - data:
src/docs/pages/code-editor/<name>.tsexporting adocsPagewith the item name andcodeEditorUsage(...)as the example code. Pages are auto-registered from the module tree, so no index edit is needed; - add the item name to
src/docs/nav.tsunder theCode Editorsection.
- demo:
- Add a suite in
tests/unit/code-editor/withrenderCodeEditorfromtests/helpers/render-code-editor.tsx; drive the extension through the view and assert its state or decorations. - Run
pnpm test,pnpm run typecheck,pnpm run lintandpnpm run build.
- Create
src/registry/blocove/ui/media/<name>.tsxfor a component, orsrc/registry/blocove/blocks/<name>.tsxfor a block. - Build on the published Video.js surface: import the preset and the skin from
@videojs/react/<preset>, import the preset stylesheet once, and style the skin throughmediaThemeStylefrom@/lib/blocove/media-theme. Do not copy the packaged skin source into the registry, and do not reach into its internal class names: only the published CSS custom properties and thestyle/classNameprops are stable. - Shipped imports use the installed namespaces (
@/components/blocove/media/*,@/lib/blocove/*), and the media helpers go inregistryDependencies. - Map the family once in
tsconfig.jsonandvite.config.tsso the docs site and the tests resolve those specifiers tosrc/registry/blocove/ui/media. - Document it: a demo in
src/docs/examples/media/, a page insrc/docs/pages/media/, the item name insrc/docs/nav.tsunderMedia, and a snippet fromsrc/docs/snippets/media.ts(blocks show their shipped source instead). - Test it: unit tests mock the
@videojs/reactpresets and assert the composed props and markup; the browser suite covers real playback with the WebM samples. Blocks also get a suite intests/unit/media/blocks.test.tsx.
- Build on the shipped primitive: import
Imagefrom@/components/blocove/image/image, give it an aspect ratio or intrinsic dimensions, and compose your surface on top. Viewers wrap the primitive; they never reimplement the<img>logic. - Put shared helpers in
src/registry/blocove/lib/image-pipeline.ts(an internalregistry:libitem) only when more than one item needs them. - The family adds no npm dependency of its own. List the shadcn/ui primitives a
file imports (
dialog,button,badge,separator) inregistryDependencies, and other Blocove items with their GitHub address. tsconfig.jsonandvite.config.tsalready map@/components/blocove/image/*tosrc/registry/blocove/ui/image; no change is needed for a new component in the family.- Document it: a demo in
src/docs/examples/image/, a page insrc/docs/pages/image/, the item name insrc/docs/nav.tsunderImage, and a snippet fromsrc/docs/snippets/image.ts(blocks show their shipped source instead). - Test it in
tests/unit/image/with happy-dom; use the browser suite for behaviour that needs real layout, such as the dialog focus cycle, the gallery keys and the comparison range.
- Add capability renderers under
src/registry/blocove/ui/markdown/; a math renderer receivesMarkdownMathProps, and a fence renderer receivesMarkdownCodeProps(includingcomplete). Register a fence renderer through the shell'scomponents.fencesmap, keyed by lowercase language;codestays the fallback for fences no language claims. Pure parser changes live insrc/registry/blocove/lib/markdown-parse.ts. - Register the item in
src/registry/blocove/registry.jsonwithregistryDependencies: ["litingyes/blocove/markdown-parse"]plus the shell when the page composes it, then add the dependency packages (shiki,katex, ...) todependencies. - Document it with a demo in
src/docs/examples/markdown/(composeMarkdownDemoFramefromsrc/docs/examples/markdown/frame.tsx, passing itscode/math/mermaid/chartflag), a page insrc/docs/pages/markdown/, and the item name insrc/docs/nav.tsunderMarkdown; extendsrc/docs/snippets/markdown.tswhen the page needs generated code. - Add a suite in
tests/unit/markdown/. The parser keeps the strictsrc/registry/blocove/lib/**coverage gate, so a new branch needs a case.
To add a whole editor family, give it its own folder (ui/<family>/), item
prefix, docs section in src/docs/nav.ts, demo frame and snippet builder. The
rich text editor, code editor, media, image and markdown items are unaffected.
Conventions:
- List every npm package a file imports in
dependencies; list official shadcn/ui items by their registry name (button,font-inter, ...) inregistryDependencies; list other Blocove items with the GitHub address (litingyes/blocove/<item>). - Give every item a
titleanddescription; they are surfaced in the catalog and are useful for LLM tooling. - Every Blocove file sets an explicit
target: UI and block files undercomponents/blocove/, lib helpers underlib/blocove/. This keeps Blocove items out of shadcn/ui'scomponents/uinamespace;pnpm registry:checkfails the build when a file drifts. registry:pageandregistry:fileitems require atarget.- Blocove ships no base config or theme tokens: the consumer's shadcn/ui setup
(Tailwind CSS v4,
shadcn/tailwind.css, the@theme inlinecolor mappings and preset) stays authoritative. Items are built against the Base UI primitives of theb0preset.
Vitest runs two projects, defined in vitest.config.ts:
unitruns on happy-dom and covers component behaviour, the pure helpers and the distribution contract. It is the fast default.browserruns in real Chromium through Vitest browser mode and covers what needs layout and real events: typing, selections, clipboard, highlighting, diff review, markdown streaming and media playback. The media suite plays the committed WebM samples through the shipped items: play and pause, captions, audio playback, ambient autoplay and the playlist swap. It uses WebM on purpose, because the Chromium build Vitest drives has no H.264 or AAC decoder.
Playwright is only the driver behind Vitest's browser mode. The tests are plain Vitest files; there is no Playwright config and no Playwright spec.
| Command | What it does |
|---|---|
pnpm test |
happy-dom suite (pnpm run test:watch for watch mode) |
pnpm run test:e2e |
Chromium suite |
pnpm run test:coverage |
happy-dom suite with the coverage gate |
pnpm run test:all |
both projects |
pnpm run check |
every gate: preset, typecheck, lint, coverage, E2E, build |
Tests live in tests/ and never inside src/registry/blocove/: the docs bundle the
whole registry directory as raw sources, so a test file there would ship with the site.
The distribution contract is part of the suite. tests/unit/registry/manifest.test.ts
checks that every item file exists and is listed exactly once, that every file targets
the Blocove namespace, that every @/ import and npm package is declared by the item
that uses it, and that pinned versions match package.json. docs.test.ts checks the
generated snippets import modules that exist, and build-artifacts.test.ts compares
public/r/*.json with the sources (it skips when the artifacts are absent; CI builds
them first).
Coverage is limited to the shipped registry and the distribution helpers, and it counts
files that no test imports (coverage.include), so a new item without tests lowers the
gate. Thresholds live in vitest.config.ts; raise them, never lower them.
/introduces the project: the extension philosophy, the family features, the quick start commands and a showcase with one live block per family. It does not list every item; the two catalogs do./componentsand/blocksare the catalogs. Each lists its items grouped by family and links into the item pages, which is why the header offersComponentsandBlocksas two separate destinations./components/<name>and/blocks/<name>render the standard shadcn/ui docs layout: title and description, a demo with Preview and Code tabs, installation (Command and Manual tabs with pnpm/npm/yarn/bun commands), usage snippets and an API reference table. The code panel uses the shadcn/ui code block with copy, download and a line-wrap toggle. Asking for an item under the wrong section answers with a permanent redirect to the section that owns it./items/<name>is the compatibility address: it permanently redirects to the item's canonical page, so links published before the split keep working./components/<name>.mdand/blocks/<name>.mdanswer with the page as plain markdown, exactly what Copy Page copies. The Copy Page split button opens it through “View as Markdown”. The suffix is part of the route segment, so.mdrequests never render the item page;/items/<name>.mdredirects to the section's markdown as well.- The left navigation is one tree per kind and groups pages per family:
Rich Text Editor,Code Editor,MediaandMarkdown. Components lead with the family's shell, then list the nodes, marks or extensions it is composed from; blocks list the complete compositions. A new family adds a section to both trees, not a third nav tree. The right column tracks the current section. - The light/dark switch runs through the View Transitions API with a circular
reveal from the control that was clicked, and falls back to an instant switch
without
document.startViewTransitionor with reduced motion. - Docs data lives in
src/docs/pages/(auto-registered, one module per item), demos insrc/docs/examples/. Code panels are generated by the per-family snippet builders insrc/docs/snippets/, so every page shows the same composition and the imports match what the CLI installs. The block pages show the shipped block source instead of a generated snippet. - The installation section reads the built registry JSON, so the commands, file
targets and dependency lists always match what
shadcn addinstalls.
The media items wrap the branded skins that ship inside @videojs/react. Read
these before planning on top of them:
- React StrictMode.
@videojs/react10.3.0 loops inside its menu state when React runs the player's layout effects twice, which unmounts the page (videojs/video.js#9261, open). The docs site therefore serves its dev client entry with a passthrough element instead ofStrictMode(relaxStrictModeinvite.config.ts), andreactandreact-domare pinned to19.3.0: on19.3.1the same loop fires even without a captions track. If your app enables StrictMode, keep the React pin and expect the player to be sensitive to it until upstream ships a fix; production builds never double-invoke effects and are unaffected. - Packaged skins, not skin source. Blocove themes the published skin settings and never copies the skin source, so the control markup and layout belong to Video.js. Adding, removing or rearranging controls means adding the skin source from the Video.js shadcn registry to your project first; a Blocove-style skin of our own is a separate project.
- Streaming is network-shaped. The HLS and live items play through the stream
engine packaged inside
@videojs/react: the engine resolves the manifest, fetches the segments and fills the quality menu itself, so the source has to be reachable from the page (CORS-enabled when it lives on another origin). The committed fixtures inpublic/media/hls/let the docs and the browser suite play a manifest without the internet; a real stream still fetches over the network. - Sample media is committed. The clips in
public/media/are binary assets generated byscripts/generate-media-samples.mjs, and the HLS fixtures inpublic/media/hls/byscripts/generate-media-samples.sh; rerun those scripts instead of editing them by hand.
pnpm run preset:check # project still resolves to b0
pnpm run registry:prepare
pnpm dev
npx shadcn@latest view http://localhost:3000/r/rich-text-editor.json # targets: components/blocove/...
npx shadcn@latest add --dry-run http://localhost:3000/r/rich-text-editor.json
npx shadcn@latest add --dry-run http://localhost:3000/r/rich-text-editor-heading.json
npx shadcn@latest add --dry-run http://localhost:3000/r/rich-text-editor-table.json
npx shadcn@latest add --dry-run http://localhost:3000/r/rich-text-editor-block.json
npx shadcn@latest add --dry-run http://localhost:3000/r/code-editor-block.json
npx shadcn@latest add --dry-run http://localhost:3000/r/video-player.json # targets: components/blocove/media/...
npx shadcn@latest add --dry-run http://localhost:3000/r/hls-media.json # two adaptive media elements
npx shadcn@latest add --dry-run http://localhost:3000/r/live-player.json
npx shadcn@latest add --dry-run http://localhost:3000/r/video-hero.json
npx shadcn@latest add --dry-run http://localhost:3000/r/markdown.json
npx shadcn@latest add --dry-run http://localhost:3000/r/markdown-code-block.json # fence item plus the shiki helper
curl -sSL http://localhost:3000/blocks/rich-text-editor-block.md | head
curl -sSI http://localhost:3000/items/rich-text-editor-block | grep -i location # 308 -> /blocks/...For a full end-to-end check, create a throwaway project, run
npx shadcn@latest init --preset b0, install rich-text-editor-block (or
rich-text-editor plus the nodes and marks you need), add typeset, then run its
typecheck and build.
The build produces static registry JSON in public/r plus the TanStack Start
server output. Any host supported by TanStack Start works (Vercel, Netlify,
Cloudflare or a Node server); make sure /r/*.json is served publicly.
The public site is blocove.vercel.app. The
@blocove namespace resolves items from
https://blocove.vercel.app/r/{name}.json. If the domain changes, update the
root registry homepage and the namespace URLs together, then re-run
pnpm run registry:prepare.
The docs demo syncs across tabs through a BroadcastChannel by default, so the
published site needs no backend. To run the same demo against a real websocket,
start the server and point the site at it:
pnpm collab:dev # ws://localhost:1234
VITE_COLLAB_URL=ws://localhost:1234 pnpm devFor production, deploy scripts/collab-server.mjs (or the official Hocuspocus
image) to a host that keeps a Node process alive: Railway, Fly.io, Render or a
VPS. Hocuspocus keeps each room in process memory, so every peer of a room has
to reach the same instance; a serverless platform that cannot pin a websocket to
one instance needs the Redis extension. Build the site with
VITE_COLLAB_URL=wss://collab.example.com to point it at the deployed server.
Without the variable the site keeps the in-browser transport, and the status item
shows the connection honestly either way.
MIT