Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions apps/registry/lib/jsonld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ export function softwareSourceCodeLd(component: {
};
}

export function itemListLd(items: ReadonlyArray<{
readonly name: string;
readonly title: string;
}>): JsonLdNode {
return {
"@context": "https://schema.org",
"@type": "ItemList",
name: "VLLNT UI Components",
numberOfItems: items.length,
itemListElement: items.map((item, index) => ({
"@type": "ListItem",
position: index + 1,
name: item.title,
url: `${SITE_URL}/components/${item.name}`,
})),
};
}

export function breadcrumbLd(trail: ReadonlyArray<{
readonly name: string;
readonly url: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/registry/lib/og-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const DESCRIPTION_MAX = 120;
const TITLE_MAX_LARGE = 25;
const TITLE_MAX_SMALL = 30;

export const OG_TEMPLATES = {
const OG_TEMPLATES = {
component: {
descriptionMaxLength: DESCRIPTION_MAX,
footerLabel: "COMPONENT",
Expand Down
5 changes: 2 additions & 3 deletions apps/registry/lib/og.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const OG_IMAGE_HEIGHT = 1260;

const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://ui.vllnt.ai";

export const ogImageParametersSchema = z.object({
const ogImageParametersSchema = z.object({
category: z.string().max(100).optional(),
description: z.string().max(500).optional(),
title: z.string().min(1).max(200).default("VLLNT UI"),
Expand All @@ -15,9 +15,8 @@ export const ogImageParametersSchema = z.object({
});

export type OGImageParametersInput = z.input<typeof ogImageParametersSchema>;
export type OGImageParameters = z.infer<typeof ogImageParametersSchema>;

export function generateOGImageURL(parameters: OGImageParametersInput): string {
function generateOGImageURL(parameters: OGImageParametersInput): string {
const validated = ogImageParametersSchema.parse(parameters);

const searchParameters = new URLSearchParams({
Expand Down
3 changes: 1 addition & 2 deletions apps/registry/lib/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod";

export const ogImageFrontmatterSchema = z.object({
const ogImageFrontmatterSchema = z.object({
category: z.string().optional(),
description: z.string().optional(),
title: z.string().optional(),
Expand All @@ -15,4 +15,3 @@ export const pageFrontmatterSchema = z.object({
});

export type PageFrontmatter = z.infer<typeof pageFrontmatterSchema>;
export type OGImageFrontmatter = z.infer<typeof ogImageFrontmatterSchema>;
4 changes: 2 additions & 2 deletions apps/registry/lib/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export function getRegistryGeneratedAt(): string | undefined {
return REGISTRY.generatedAt;
}

export type CategoryStat = {
type CategoryStat = {
readonly category: string;
readonly count: number;
};

export function getCategoryStats(): readonly CategoryStat[] {
function getCategoryStats(): readonly CategoryStat[] {
const counts = new Map<string, number>();
for (const item of REGISTRY.items) {
const key = item.category ?? "uncategorized";
Expand Down
5 changes: 3 additions & 2 deletions apps/registry/registry/default/blog-card/blog-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ export function ContentCard({
);
}

// Keep BlogCard as an alias for backward compatibility
export const BlogCard = ContentCard;
export function BlogCard(props: ContentCardProps) {
return <ContentCard {...props} />;
}
14 changes: 7 additions & 7 deletions apps/registry/types/registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type RegistryFile = {
type RegistryFile = {
path: string;
type: string;
};
Expand All @@ -13,30 +13,30 @@ export type ComponentCategory =
| "overlay"
| "utility";

export type Stability = "stable" | "beta" | "experimental" | "deprecated";
type Stability = "stable" | "beta" | "experimental" | "deprecated";

export type A11yKeyboardBinding = {
type A11yKeyboardBinding = {
keys: string;
action: string;
};

export type A11ySchema = {
type A11ySchema = {
role?: string;
keyboard?: A11yKeyboardBinding[];
aria?: string[];
focusManagement?: "auto" | "manual";
notes?: string;
};

export type UsageExample = {
type UsageExample = {
title: string;
description?: string;
code: string;
framework?: "react" | "next";
storyId?: string;
};

export type PropDefinition = {
type PropDefinition = {
name: string;
type: string;
required?: boolean;
Expand All @@ -62,7 +62,7 @@ export type RegistryComponent = {
version?: string;
};

export type RegistryItem = RegistryComponent;
type RegistryItem = RegistryComponent;

export type Registry = {
$schema?: string;
Expand Down
23 changes: 23 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"workspaces": {
"apps/registry": {
"ignore": [
"components/component-preview/component-preview.tsx",
"content/pages/**",
"lib/utils.ts",
"registry.ts",
"registry/default/**",
"styles.css",
"themes/default.css"
]
},
"packages/ui": {
"ignore": [
".storybook/next-stubs.ts",
".storybook/next-themes-stub.ts",
"styles.dev.css"
]
}
}
}
6 changes: 4 additions & 2 deletions packages/ui/src/components/blog-card/blog-card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ describe("ContentCard", () => {
});

describe("BlogCard", () => {
it("is the same component as ContentCard", () => {
expect(BlogCard).toBe(ContentCard);
it("renders through the backwards-compatible alias", () => {
render(<BlogCard href="/posts/first-post" post={post} />);

expect(screen.getByText("First post")).toBeInTheDocument();
});
});
5 changes: 3 additions & 2 deletions packages/ui/src/components/blog-card/blog-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ export function ContentCard({
);
}

// Keep BlogCard as an alias for backward compatibility
export const BlogCard = ContentCard;
export function BlogCard(props: ContentCardProps) {
return <ContentCard {...props} />;
}
Loading