mirror of
https://github.com/vercel-labs/json-render.git
synced 2026-09-14 13:41:32 +08:00
c1b1aaaddb
* add rate limits
* fix lint
* better
generate prompt
update examples
* fixes
* fixes
* new api
* update docs
* fixes
* fixes
* generated prompt
* Add tests for catalog validation and prompt generation
- Test generateSystemPrompt with components, actions, custom rules
- Test new defineCatalog API from schema system
- Test catalog.prompt() method with custom rules
- Test catalog.validate() for valid and invalid specs
- Test catalog.zodSchema() for custom validation
- Test catalog.jsonSchema() for structured outputs
- Add tests for nested specs with children
- Add tests for rejecting invalid component types
* Fix lint: pass children as nested elements in renderer
Change from children={...} prop to nested children pattern
to satisfy react/no-children-prop rule.
* Fix lint errors in dashboard and web apps
- Disable react/prop-types in both eslint configs (TypeScript handles this)
- Allow styled-jsx 'jsx' property in dashboard
- Add DATABASE_URL to turbo env allowlist
- Remove unused drizzle-orm imports (and, sql)
- Suppress unused variable warnings where intentional
* Add server entry point for @json-render/remotion
The main package entry includes React components that require
client-side context (React.createContext). This causes build
failures when importing in server-side API routes.
Added `@json-render/remotion/server` entry point that exports
only schema and catalog definitions without React dependencies:
- schema, RemotionSchema, RemotionSpec
- standardComponentDefinitions, standardTransitionDefinitions
- standardEffectDefinitions
- Type exports for catalogs
Updated remotion example to import from /server in catalog.ts
* Make dashboard database connection lazy-initialized
The database connection threw an error at module load time if
DATABASE_URL was not set, causing builds to fail in CI where
the database is not available.
Changed to lazy initialization using a Proxy so the error only
occurs when the database is actually used at runtime, not at
build time.
* Fix previousSpec property name and lazy rate limiting
- Fix property name mismatch: playground now passes previousSpec
instead of previousTree to match what useUIStream hook expects
- Make rate limiting lazy-initialized to avoid runtime errors when
Redis env vars (KV_REST_API_URL, KV_REST_API_TOKEN) are not set
- Rate limiting gracefully becomes a no-op when Redis is unavailable
128 lines
2.7 KiB
TypeScript
128 lines
2.7 KiB
TypeScript
import * as React from "react";
|
|
import {
|
|
ChevronLeftIcon,
|
|
ChevronRightIcon,
|
|
MoreHorizontalIcon,
|
|
} from "lucide-react";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
import { buttonVariants, type Button } from "@/components/ui/button";
|
|
|
|
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
return (
|
|
<nav
|
|
role="navigation"
|
|
aria-label="pagination"
|
|
data-slot="pagination"
|
|
className={cn("mx-auto flex w-full justify-center", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function PaginationContent({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"ul">) {
|
|
return (
|
|
<ul
|
|
data-slot="pagination-content"
|
|
className={cn("flex flex-row items-center gap-1", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
return <li data-slot="pagination-item" {...props} />;
|
|
}
|
|
|
|
type PaginationLinkProps = {
|
|
isActive?: boolean;
|
|
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
|
React.ComponentProps<"a">;
|
|
|
|
function PaginationLink({
|
|
className,
|
|
isActive,
|
|
size = "icon",
|
|
...props
|
|
}: PaginationLinkProps) {
|
|
return (
|
|
<a
|
|
aria-current={isActive ? "page" : undefined}
|
|
data-slot="pagination-link"
|
|
data-active={isActive}
|
|
className={cn(
|
|
buttonVariants({
|
|
variant: isActive ? "outline" : "ghost",
|
|
size,
|
|
}),
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function PaginationPrevious({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof PaginationLink>) {
|
|
return (
|
|
<PaginationLink
|
|
aria-label="Go to previous page"
|
|
size="default"
|
|
className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
|
|
{...props}
|
|
>
|
|
<ChevronLeftIcon />
|
|
<span className="hidden sm:block">Previous</span>
|
|
</PaginationLink>
|
|
);
|
|
}
|
|
|
|
function PaginationNext({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof PaginationLink>) {
|
|
return (
|
|
<PaginationLink
|
|
aria-label="Go to next page"
|
|
size="default"
|
|
className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
|
|
{...props}
|
|
>
|
|
<span className="hidden sm:block">Next</span>
|
|
<ChevronRightIcon />
|
|
</PaginationLink>
|
|
);
|
|
}
|
|
|
|
function PaginationEllipsis({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
aria-hidden
|
|
data-slot="pagination-ellipsis"
|
|
className={cn("flex size-9 items-center justify-center", className)}
|
|
{...props}
|
|
>
|
|
<MoreHorizontalIcon className="size-4" />
|
|
<span className="sr-only">More pages</span>
|
|
</span>
|
|
);
|
|
}
|
|
|
|
export {
|
|
Pagination,
|
|
PaginationContent,
|
|
PaginationLink,
|
|
PaginationItem,
|
|
PaginationPrevious,
|
|
PaginationNext,
|
|
PaginationEllipsis,
|
|
};
|