Aurora AI JSX Preview
aurora-dinglebear-ai/aurora-ai-jsx-previewFreeBlock
Aurora-native jsx preview parity surface from AI Elements.
Install it
npx shadcn@latest add https://aurora.dinglebear.ai/r/aurora-ai-jsx-preview.jsonSource
1"use client"23import * as React from "react"4import { Check, Code, Copy } from "lucide-react"5import { cn } from "@/lib/utils"6import { Badge } from "@/registry/aurora/ui/badge"7import { Button } from "@/registry/aurora/ui/button"8import { useClipboard } from "@/registry/aurora/lib/use-clipboard"910export interface JsxPreviewProps extends React.HTMLAttributes<HTMLDivElement> {11 /** Source to render in the preview surface. */12 code: string13 /** Filename shown in the header, e.g. `DeployButton.jsx`. */14 filename?: string15 /** Language pill label. Defaults to `JSX`. */16 language?: string17 /** Show the gutter line numbers. Defaults to `true`. */18 lineNumbers?: boolean19}2021// ── Aurora token panel surface (mirrors the elements panelStyle) ───────────────22function jsxPanelStyle(style?: React.CSSProperties): React.CSSProperties {23 return {24 background: "var(--aurora-surface-raised)",25 border: "1px solid var(--aurora-border-strong)",26 borderRadius: "var(--aurora-radius-1)",27 boxShadow: "var(--aurora-shadow-medium), var(--aurora-highlight-medium)",28 ...style,29 }30}3132// ── Lightweight JSX token tinting (cosmetic — not a real tokenizer) ────────────33const KEYWORDS = new Set([34 "export",35 "function",36 "return",37 "const",38 "let",39 "var",40 "import",41 "from",42 "default",43 "if",44 "else",45 "for",46 "while",47 "new",48 "await",49 "async",50])5152type Tone =53 | "keyword"54 | "tag"55 | "string"56 | "comment"57 | "punctuation"58 | "plain"5960const TONE_COLOR: Record<Tone, string> = {61 keyword: "var(--aurora-accent-pink)",62 tag: "var(--aurora-code-function)",63 string: "var(--aurora-accent-strong)",64 comment: "var(--aurora-text-muted)",65 punctuation: "var(--aurora-text-muted)",66 plain: "var(--aurora-text-primary)",67}6869// Split a line into tinted spans. Order matters: strings/comments first so we70// don't re-tokenize their contents.71function tintLine(line: string, keyPrefix: string): React.ReactNode[] {72 const out: React.ReactNode[] = []73 // Match strings, comments, JSX tags, identifiers, or any other run.74 const re =75 /(\/\/[^\n]*)|("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)|(<\/?[A-Za-z][\w.]*)|([A-Za-z_$][\w$]*)|([^\sA-Za-z_$"'`/]+)|(\s+|.)/g76 let m: RegExpExecArray | null77 let i = 078 while ((m = re.exec(line)) !== null) {79 const [, comment, str, tag, ident, punct] = m80 const text = m[0]81 let tone: Tone = "plain"82 if (comment) tone = "comment"83// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aurora
All 176 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aurora AI Actionaurora-ai-action | aurora | Blocks | Free | 1 dep | |
| Aurora AI Actionsaurora-ai-actions | aurora | Blocks | Free | 1 dep | |
| Aurora AI Agentaurora-ai-agent | aurora | Blocks | Free | 1 dep | |
| Aurora AI Image Gridaurora-ai-ai-image-grid | aurora | Blocks | Free | 1 dep | |
| Aurora AI Attachmentsaurora-ai-attachments | aurora | Blocks | Free | 1 dep | |
| Aurora AI Audio Playeraurora-ai-audio-player | aurora | Blocks | Free | 1 dep | |
| Aurora AI Branchaurora-ai-branch | aurora | Blocks | Free | 1 dep | |
| Aurora AI Canvasaurora-ai-canvas | aurora | Blocks | Free | 1 dep |
