New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@tapstack/siteio-react-sdk

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapstack/siteio-react-sdk - npm Package Compare versions

Comparing version
0.0.11
to
0.0.12
+1
-13
dist/index.d.mts

@@ -162,14 +162,2 @@ import * as react_jsx_runtime from 'react/jsx-runtime';

interface ThemeHydratorProps {
theme: Theme;
}
/**
* Client component that applies theme CSS variables as inline styles
* on the <html> element after hydration.
*
* This matches the builder's behavior where theme variables are set
* directly on document.documentElement.style.
*/
declare function ThemeHydrator({ theme }: ThemeHydratorProps): null;
interface FetchProjectOptions {

@@ -215,2 +203,2 @@ projectId: string;

export { Avatar, AvatarFallback, AvatarImage, Badge, type BaseBlock, type Block, type BooleanExpression, type BooleanOperand, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ComparisonOperator, type ComparisonType, type Component, type ComponentBlock, type ComponentData, type ComponentRegistry, type DefaultComponentBlock, type ElementBlock, type FieldOperand, Input, Label, type LogicalOperatorType, type NAryLogicalOperator, type PageData, PreviewBlockRenderer, type ProjectData, type ProjectStyles, RewebProject, type RewebProjectProps, type RewebSDKConfig, Separator, type TextBlock, type Theme, ThemeHydrator, type ThemeItem, type ValueOperand, fetchProject };
export { Avatar, AvatarFallback, AvatarImage, Badge, type BaseBlock, type Block, type BooleanExpression, type BooleanOperand, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ComparisonOperator, type ComparisonType, type Component, type ComponentBlock, type ComponentData, type ComponentRegistry, type DefaultComponentBlock, type ElementBlock, type FieldOperand, Input, Label, type LogicalOperatorType, type NAryLogicalOperator, type PageData, PreviewBlockRenderer, type ProjectData, type ProjectStyles, RewebProject, type RewebProjectProps, type RewebSDKConfig, Separator, type TextBlock, type Theme, type ThemeItem, type ValueOperand, fetchProject };

@@ -162,14 +162,2 @@ import * as react_jsx_runtime from 'react/jsx-runtime';

interface ThemeHydratorProps {
theme: Theme;
}
/**
* Client component that applies theme CSS variables as inline styles
* on the <html> element after hydration.
*
* This matches the builder's behavior where theme variables are set
* directly on document.documentElement.style.
*/
declare function ThemeHydrator({ theme }: ThemeHydratorProps): null;
interface FetchProjectOptions {

@@ -215,2 +203,2 @@ projectId: string;

export { Avatar, AvatarFallback, AvatarImage, Badge, type BaseBlock, type Block, type BooleanExpression, type BooleanOperand, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ComparisonOperator, type ComparisonType, type Component, type ComponentBlock, type ComponentData, type ComponentRegistry, type DefaultComponentBlock, type ElementBlock, type FieldOperand, Input, Label, type LogicalOperatorType, type NAryLogicalOperator, type PageData, PreviewBlockRenderer, type ProjectData, type ProjectStyles, RewebProject, type RewebProjectProps, type RewebSDKConfig, Separator, type TextBlock, type Theme, ThemeHydrator, type ThemeItem, type ValueOperand, fetchProject };
export { Avatar, AvatarFallback, AvatarImage, Badge, type BaseBlock, type Block, type BooleanExpression, type BooleanOperand, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ComparisonOperator, type ComparisonType, type Component, type ComponentBlock, type ComponentData, type ComponentRegistry, type DefaultComponentBlock, type ElementBlock, type FieldOperand, Input, Label, type LogicalOperatorType, type NAryLogicalOperator, type PageData, PreviewBlockRenderer, type ProjectData, type ProjectStyles, RewebProject, type RewebProjectProps, type RewebSDKConfig, Separator, type TextBlock, type Theme, type ThemeItem, type ValueOperand, fetchProject };
+38
-29

@@ -646,22 +646,2 @@ 'use strict';

// src/utils/theme.ts
function applyFontsToDocument(document2, fonts) {
const root = document2.documentElement;
fonts.forEach((font) => {
const fontFamily = `"${font.value}"`;
root.style.setProperty(font.variable, fontFamily);
});
}
function applyColorToDocument(document2, color) {
document2.documentElement.style.setProperty(color.variable, color.value);
}
function applyBorderRadiusToDocument(document2, borderRadius) {
document2.documentElement.style.setProperty("--radius", `${borderRadius}rem`);
}
function applyThemeToDocument(document2, theme) {
applyFontsToDocument(document2, Object.values(theme.fonts));
applyBorderRadiusToDocument(document2, theme.borderRadius);
Object.values(theme.colors).forEach(
(color) => applyColorToDocument(document2, color)
);
}
function applyThemeToStyleTag(theme) {

@@ -805,9 +785,33 @@ const styles = [];

}
// src/components/ThemeHydrator.tsx
function ThemeHydrator({ theme }) {
React2.useEffect(() => {
applyThemeToDocument(document, theme);
}, [theme]);
return null;
function generateThemeScript(theme) {
const themeData = JSON.stringify({
colors: theme.colors,
fonts: theme.fonts,
borderRadius: theme.borderRadius
});
return `
(function() {
try {
var theme = ${themeData};
var root = document.documentElement;
// Apply colors
Object.keys(theme.colors).forEach(function(key) {
var color = theme.colors[key];
root.style.setProperty(color.variable, color.value);
});
// Apply fonts
Object.keys(theme.fonts).forEach(function(key) {
var font = theme.fonts[key];
root.style.setProperty(font.variable, '"' + font.value + '"');
});
// Apply border radius
root.style.setProperty('--radius', theme.borderRadius + 'rem');
} catch (e) {
console.error('SiteIO theme script error:', e);
}
})();
`.trim();
}

@@ -874,3 +878,9 @@ async function RewebProject({

projectCss ? /* @__PURE__ */ jsxRuntime.jsx("style", { "data-siteio-project-css": true, dangerouslySetInnerHTML: { __html: projectCss } }) : null,
/* @__PURE__ */ jsxRuntime.jsx(ThemeHydrator, { theme: data.project.theme }),
/* @__PURE__ */ jsxRuntime.jsx(
"script",
{
"data-siteio-theme-script": true,
dangerouslySetInnerHTML: { __html: generateThemeScript(data.project.theme) }
}
),
/* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-siteio-theme": true, children: currentPage.blocks.map((block) => /* @__PURE__ */ jsxRuntime.jsx(

@@ -904,5 +914,4 @@ PreviewBlockRenderer,

exports.Separator = Separator;
exports.ThemeHydrator = ThemeHydrator;
exports.fetchProject = fetchProject;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/utils/fetchProject.ts","../src/components/Icon.tsx","../src/utils/cn.ts","../src/components/ui/button.tsx","../src/components/ui/card.tsx","../src/components/ui/badge.tsx","../src/components/ui/input.tsx","../src/components/ui/label.tsx","../src/components/ui/separator.tsx","../src/components/ui/avatar.tsx","../src/utils/blockUtils.ts","../src/utils/booleanExpressions.ts","../src/utils/propsUtils.ts","../src/components/PreviewBlockRenderer.tsx","../src/utils/theme.ts","../src/components/ThemeHydrator.tsx","../src/components/RewebProject.tsx"],"names":["forwardRef","LucideIcons","jsx","twMerge","clsx","React","React2","React3","React4","React5","React6","Fragment","component","document","useEffect","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,eAAsB,YAAA,CAAa;AAAA,EACjC,SAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS;AACpE,CAAA,EAA8C;AAC5C,EAAA,MAAM,MAAM,IAAI,GAAA,CAAI,GAAG,MAAM,CAAA,aAAA,EAAgB,SAAS,CAAA,CAAE,CAAA;AACxD,EAAA,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,OAAA,EAAS,KAAK,CAAA;AAEnC,EAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,CAAI,UAAS,EAAG;AAAA,IAC3C,MAAA,EAAQ,KAAA;AAAA,IACR,OAAA,EAAS;AAAA,MACP,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,KAAA,EAAO;AAAA;AAAA,GACR,CAAA;AAED,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,IAAA,MAAM,KAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAK,CAAE,MAAM,OAAO,EAAE,KAAA,EAAO,eAAA,EAAgB,CAAE,CAAA;AAC5E,IAAA,MAAM,IAAI,KAAA,CAAM,KAAA,CAAM,SAAS,CAAA,yBAAA,EAA4B,QAAA,CAAS,UAAU,CAAA,CAAE,CAAA;AAAA,EAClF;AAEA,EAAA,OA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K,MAAA,CAAO,KAAK,IAAA,CAAK,OAAA,CAAQ,OAAO,MAAA,IAAU,EAAE,CAAA,CAAE,MAAM;AAAA,uBAAA,EACpD,WAAW,MAAM,CAAA;AAAA,wBAAA,EAChB,YAAY,MAAM,CAAA;AAAA,GAAA,CAAA;AAG1C,EAAA,uBACEa,eAAA,CAAAJ,qBAAA,EAEE,QAAA,EAAA;AAAA,oBAAAT,cAAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,0BAAA,EAAwB,IAAA;AAAA,QACxB,uBAAA,EAAyB,EAAE,MAAA,EAAQ,SAAA,GAAY,OAAO,WAAA;AAAY;AAAA,KACpE;AAAA,IACC,UAAA,mBACCA,cAAAA,CAAC,OAAA,EAAA,EAAM,yBAAA,EAAuB,IAAA,EAAC,uBAAA,EAAyB,EAAE,MAAA,EAAQ,UAAA,EAAW,EAAG,CAAA,GAC9E,IAAA;AAAA,oBAEJA,cAAAA,CAAC,aAAA,EAAA,EAAc,KAAA,EAAO,IAAA,CAAK,QAAQ,KAAA,EAAO,CAAA;AAAA,oBAC1CA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,mBAAA,EAAiB,IAAA,EACzC,QAAA,EAAA,WAAA,CAAY,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,qBACvBA,cAAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QAEC,KAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAHK,KAAA,CAAM;AAAA,KAKd,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["import { ProjectData } from \"../types\";\n\nexport interface FetchProjectOptions {\n projectId: string;\n token: string;\n apiUrl?: string;\n}\n\nexport async function fetchProject({\n projectId,\n token,\n apiUrl = typeof window !== \"undefined\" ? window.location.origin : \"http://localhost:3000\",\n}: FetchProjectOptions): Promise<ProjectData> {\n const url = new URL(`${apiUrl}/api/project/${projectId}`);\n url.searchParams.set(\"token\", token);\n\n const response = await fetch(url.toString(), {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n cache: \"no-store\", // Disable caching for real-time updates\n });\n\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `Failed to fetch project: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n\n\n\n","import * as LucideIcons from \"lucide-react\";\nimport { forwardRef } from \"react\";\n\ninterface IconProps {\n name: string;\n size?: number;\n className?: string;\n strokeWidth?: number;\n [key: string]: any;\n}\n\n/**\n * Dynamic icon component that renders Lucide React icons by name.\n * This allows the SDK to render any icon used in the SiteIO builder.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(\n ({ name, size = 24, className, strokeWidth, ...props }, ref) => {\n // Get the icon component from Lucide\n const IconComponent = (LucideIcons as Record<string, any>)[name];\n\n if (!IconComponent) {\n // Return empty span if icon not found to avoid breaking the layout\n console.warn(`[SiteIO SDK] Icon \"${name}\" not found in lucide-react`);\n return <span className={className} style={{ width: size, height: size }} />;\n }\n\n return (\n <IconComponent\n ref={ref}\n size={size}\n className={className}\n strokeWidth={strokeWidth}\n {...props}\n />\n );\n },\n);\n\nIcon.displayName = \"Icon\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n\n\n\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n variant?:\n | \"default\"\n | \"destructive\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\";\n size?: \"default\" | \"sm\" | \"lg\" | \"icon\";\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n },\n ref\n ) => {\n const baseStyles =\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\";\n\n const variants: Record<string, string> = {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n };\n\n const sizes: Record<string, string> = {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n };\n\n return (\n <button\n className={cn(baseStyles, variants[variant], sizes[size], className)}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n className\n )}\n {...props}\n />\n));\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n {...props}\n />\n));\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"text-2xl font-semibold leading-none tracking-tight\",\n className\n )}\n {...props}\n />\n));\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nCardDescription.displayName = \"CardDescription\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n));\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center p-6 pt-0\", className)}\n {...props}\n />\n));\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n};\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: \"default\" | \"secondary\" | \"destructive\" | \"outline\";\n}\n\nfunction Badge({ className, variant = \"default\", ...props }: BadgeProps) {\n const baseStyles =\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\";\n\n const variants: Record<string, string> = {\n default:\n \"border-transparent bg-primary text-primary-foreground hover:bg-primary/80\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n destructive:\n \"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80\",\n outline: \"text-foreground\",\n };\n\n return (\n <div className={cn(baseStyles, variants[variant], className)} {...props} />\n );\n}\n\nexport { Badge };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Input = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n});\nInput.displayName = \"Input\";\n\nexport { Input };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n));\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\ninterface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n decorative?: boolean;\n}\n\nconst Separator = React.forwardRef<HTMLDivElement, SeparatorProps>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <div\n ref={ref}\n role={decorative ? \"none\" : \"separator\"}\n aria-orientation={decorative ? undefined : orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n )\n);\nSeparator.displayName = \"Separator\";\n\nexport { Separator };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Avatar = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n className\n )}\n {...props}\n />\n));\nAvatar.displayName = \"Avatar\";\n\nconst AvatarImage = React.forwardRef<\n HTMLImageElement,\n React.ImgHTMLAttributes<HTMLImageElement>\n>(({ className, ...props }, ref) => (\n <img\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = \"AvatarImage\";\n\nconst AvatarFallback = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted\",\n className\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = \"AvatarFallback\";\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","import { Icon } from \"../components/Icon\";\nimport {\n Button,\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n Badge,\n Input,\n Label,\n Separator,\n Avatar,\n AvatarImage,\n AvatarFallback,\n} from \"../components/ui\";\nimport {\n Block,\n ElementBlock,\n DefaultComponentBlock,\n TextBlock,\n ComponentBlock,\n ComponentRegistry,\n} from \"../types\";\n\nexport function isTextBlock(block: Block): block is TextBlock {\n return block.type === \"text\";\n}\n\nexport function isElementBlock(block: Block): block is ElementBlock {\n return block.type === \"element\";\n}\n\nexport function isDefaultComponentBlock(\n block: Block\n): block is DefaultComponentBlock {\n return block.type === \"component\";\n}\n\nexport function isComponentBlock(block: Block): block is ComponentBlock {\n return block.type === \"custom-component\";\n}\n\n/**\n * Built-in SDK components that are always available.\n * These don't require the user to install any additional packages.\n * Includes all common UI components used in SiteIO projects.\n */\nexport const SDK_BUILT_IN_COMPONENTS: ComponentRegistry = {\n // Icons\n Icon,\n // Button\n Button,\n // Card\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n // Badge\n Badge,\n // Form elements\n Input,\n Label,\n // Layout\n Separator,\n // Avatar\n Avatar,\n AvatarImage,\n AvatarFallback,\n};\n\n/**\n * Default fallback tags for components when no registry is provided.\n * Maps component names to semantic HTML elements.\n * Note: These are FALLBACKS - the actual styling comes from the compiled CSS.\n */\nconst DEFAULT_COMPONENT_TAGS: Record<string, keyof JSX.IntrinsicElements> = {\n Button: \"button\",\n Link: \"a\",\n Image: \"img\",\n Input: \"input\",\n Textarea: \"textarea\",\n Label: \"label\",\n Separator: \"hr\",\n Badge: \"span\",\n Card: \"div\",\n CardContent: \"div\",\n CardHeader: \"div\",\n CardTitle: \"h3\",\n CardDescription: \"p\",\n CardFooter: \"div\",\n Avatar: \"span\",\n AvatarImage: \"img\",\n AvatarFallback: \"span\",\n Table: \"table\",\n TableHeader: \"thead\",\n TableBody: \"tbody\",\n TableFooter: \"tfoot\",\n TableRow: \"tr\",\n TableHead: \"th\",\n TableCell: \"td\",\n TableCaption: \"caption\",\n};\n\nexport function getBlockCurrentClassNames(block: Block): string[] {\n const defaultClassNames = block.classNames?.default || [];\n const addedClassNames = block.classNames?.added || [];\n const removedClassNames = block.classNames?.removed || [];\n\n // Start with the default class names\n let currentClassNames = [...defaultClassNames];\n\n // Add the added class names\n currentClassNames = currentClassNames.concat(addedClassNames);\n\n // Remove the removed class names\n currentClassNames = currentClassNames.filter(\n (className) => !removedClassNames.includes(className)\n );\n\n // Return the unique set of class names\n return Array.from(new Set(currentClassNames));\n}\n\nconst VIEWPORT_HEIGHT = 900;\n\nexport function convertVhClassesToPx(classNames: string[]): string[] {\n const viewportHeight = VIEWPORT_HEIGHT;\n\n const vhUnits = [\"vh\", \"dvh\", \"svh\", \"lvh\"];\n const screenClasses = [\"h-screen\", \"h-dvh\", \"h-svh\", \"h-lvh\"];\n\n return classNames.map((className) => {\n // Handle h-screen and similar classes\n const screenMatch = screenClasses.find((sc) => className.includes(sc));\n if (screenMatch) {\n return className.replace(screenMatch, `h-[${viewportHeight}px]`);\n }\n\n // Handle percentage-based vh units\n for (const unit of vhUnits) {\n if (className.includes(unit)) {\n const match = className.match(new RegExp(`(\\\\d+)${unit}`));\n if (match) {\n const value = parseInt(match[1], 10);\n const pxValue = (value / 100) * viewportHeight;\n return className.replace(`${value}${unit}`, `${pxValue}px`);\n }\n }\n }\n\n return className;\n });\n}\n\nexport function getBlockClassnamesToApply(\n block: Block,\n options?: {\n isPreview?: boolean;\n replaceVhClasses?: boolean;\n }\n): string[] {\n const { isPreview = false, replaceVhClasses = true } = options || {};\n let currentClassNames = getBlockCurrentClassNames(block);\n\n if (isPreview) {\n const isLink = isElementBlock(block) && block.tag === \"a\";\n\n if (isLink) {\n currentClassNames = [...currentClassNames, \"cursor-pointer\"];\n }\n }\n\n if (replaceVhClasses) {\n return convertVhClassesToPx(currentClassNames);\n }\n\n return currentClassNames;\n}\n\n/**\n * Gets the tag or component to render for a block.\n *\n * @param block - The block to get the tag for\n * @param componentRegistry - Optional registry of React components\n * @returns A React component, HTML tag name, or undefined\n */\nexport function getBlockTagName(\n block: ElementBlock | DefaultComponentBlock,\n componentRegistry?: ComponentRegistry\n): React.ComponentType<any> | keyof JSX.IntrinsicElements | undefined {\n if (isDefaultComponentBlock(block)) {\n // First, check SDK built-in components (Icon, etc.)\n if (SDK_BUILT_IN_COMPONENTS[block.component]) {\n return SDK_BUILT_IN_COMPONENTS[block.component];\n }\n\n // Then, try to get the component from the user's registry\n if (componentRegistry && componentRegistry[block.component]) {\n return componentRegistry[block.component];\n }\n\n // Fallback to semantic HTML tags for common components\n if (DEFAULT_COMPONENT_TAGS[block.component]) {\n return DEFAULT_COMPONENT_TAGS[block.component];\n }\n\n // Last resort: render as div\n return \"div\";\n }\n\n return (block.tag as keyof JSX.IntrinsicElements) ?? \"div\";\n}\n","import { BooleanExpression, ComparisonOperator, NAryLogicalOperator } from \"../types\";\n\nexport function evaluateExpression(\n expression: BooleanExpression,\n props: Record<string, any>,\n): boolean {\n if (\"type\" in expression && (expression.type === \"and\" || expression.type === \"or\" || expression.type === \"not\")) {\n return evaluateNAryLogicalOperator(expression as NAryLogicalOperator, props);\n }\n\n if (\"type\" in expression && (expression.type === \"eq\" || expression.type === \"neq\")) {\n return evaluateComparisonOperator(expression as ComparisonOperator, props);\n }\n\n return true;\n}\n\nfunction evaluateNAryLogicalOperator(\n operator: NAryLogicalOperator,\n props: Record<string, any>,\n): boolean {\n if (operator.type === \"not\") {\n if (operator.operands.length !== 1) return true;\n return !evaluateExpression(operator.operands[0], props);\n }\n\n if (operator.type === \"and\") {\n return operator.operands.every((operand) => evaluateExpression(operand, props));\n }\n\n if (operator.type === \"or\") {\n return operator.operands.some((operand) => evaluateExpression(operand, props));\n }\n\n return true;\n}\n\nfunction evaluateComparisonOperator(\n operator: ComparisonOperator,\n props: Record<string, any>,\n): boolean {\n const leftValue = getOperandValue(operator.left, props);\n const rightValue = getOperandValue(operator.right, props);\n\n if (operator.type === \"eq\") {\n return leftValue === rightValue;\n }\n\n if (operator.type === \"neq\") {\n return leftValue !== rightValue;\n }\n\n return true;\n}\n\nfunction getOperandValue(operand: { type: string; value: any }, props: Record<string, any>): any {\n if (operand.type === \"field\") {\n return props[operand.value];\n }\n\n if (operand.type === \"value\") {\n return operand.value;\n }\n\n return undefined;\n}\n\n\n\n\n","import { Block, Component, TextBlock } from \"../types\";\nimport { isComponentBlock, isDefaultComponentBlock, isElementBlock } from \"./blockUtils\";\n\nexport interface CurrentComponent {\n id: string;\n props: Record<string, any>;\n propsConfig: Record<string, any>;\n}\n\nfunction isPropValue(value: any): boolean {\n return typeof value === \"string\" && value.startsWith(\"{{\") && value.endsWith(\"}}\");\n}\n\nfunction getPropNameFromValue(value: string): string {\n return value.slice(2, -2).trim();\n}\n\nexport function getBlockText(block: TextBlock, props?: Record<string, any>): string {\n if (block.text.startsWith(\"{\") && props) {\n const propName = block.text.slice(1, -1).replace(\"props.\", \"\");\n return props?.[propName]?.toString() || block.text;\n }\n return block.text;\n}\n\nexport function htmlToText(html: string): string {\n if (typeof window === \"undefined\") return html;\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, \"text/html\");\n return doc.body.textContent || \"\";\n}\n\nexport function getBlockProps(\n block: Block,\n currentComponent: CurrentComponent | null,\n): Record<string, any> {\n const props = { ...block.props };\n if (!currentComponent) return props;\n\n for (const key in props) {\n const value = props[key];\n\n // If a prop is set to the prop of a component, substitute it with the actual value of the component prop\n if (isPropValue(value)) {\n const propName = getPropNameFromValue(value);\n const componentPropValue = currentComponent.props[propName];\n\n if (componentPropValue !== undefined) {\n props[key] = componentPropValue;\n }\n }\n }\n\n return props;\n}\n\nexport function getBlockPropsToApply(\n block: Block,\n currentComponent: CurrentComponent | null,\n options?: {\n isPreview?: boolean;\n },\n): Record<string, any> {\n const { isPreview = false } = options || {};\n\n // If it's the instance of a component, the props don't need to be applied to the component block itself,\n // rather they are handled by the component block renderer.\n const props = isComponentBlock(block) ? {} : getBlockProps(block, currentComponent);\n\n if (!isPreview) {\n // If it's a Link component, set href to \"#\" so it doesn't navigate anywhere\n if (isDefaultComponentBlock(block) && block.component === \"Link\") {\n props.href = \"#\";\n } else {\n // Otherwise, just delete href (for a normal anchor tag)\n delete props.href;\n }\n\n const isButton =\n (isDefaultComponentBlock(block) && block.component === \"Button\") ||\n (isElementBlock(block) && block.tag === \"button\");\n if (isButton) {\n props.type = \"button\";\n }\n }\n\n // Remove Next.js Image-specific props that shouldn't be passed to DOM elements\n // Note: asChild is intentionally kept as it's needed by Radix components (Button, etc.)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n ...domProps\n } = props;\n\n // Handle asChild - add data-parent-block-id for proper block identification\n const isAsChild = !!domProps?.asChild;\n if (isAsChild) {\n domProps[\"data-parent-block-id\"] = block.id;\n }\n\n return {\n ...domProps,\n \"data-block-id\": block.id,\n };\n}\n","import { forwardRef } from \"react\";\nimport { Block, Component, ComponentRegistry } from \"../types\";\nimport {\n isTextBlock,\n isComponentBlock,\n getBlockClassnamesToApply,\n getBlockTagName,\n} from \"../utils/blockUtils\";\nimport { evaluateExpression } from \"../utils/booleanExpressions\";\nimport {\n getBlockProps,\n getBlockPropsToApply,\n getBlockText,\n htmlToText,\n CurrentComponent,\n} from \"../utils/propsUtils\";\nimport { cn } from \"../utils/cn\";\n\ninterface PreviewBlockRendererProps {\n block: Block;\n components?: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[];\n currentComponent?: CurrentComponent | null;\n replaceVhClasses?: boolean;\n className?: string;\n /** Registry of UI components (Button, Card, etc.) for proper rendering */\n componentRegistry?: ComponentRegistry;\n [key: string]: any;\n}\n\nexport const PreviewChildrenRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n ({ block, ...restProps }, ref) => {\n if (!block.children) return null;\n\n if (block.children.length === 1) {\n return <PreviewBlockRenderer block={block.children[0]} ref={ref} {...restProps} />;\n }\n\n return (\n <>\n {block.children.map((child: Block) => (\n <PreviewBlockRenderer key={child.id} block={child} {...restProps} />\n ))}\n </>\n );\n },\n);\n\nPreviewChildrenRenderer.displayName = \"ChildrenRenderer\";\n\n/**\n * Strip props that are not valid DOM attributes.\n * This includes React-specific props, Next.js Image props, and Framer Motion animation props.\n */\nconst stripNonDomProps = (p: Record<string, any>) => {\n const {\n // React/Radix props\n asChild,\n // Next.js Image props\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n // Framer Motion animation props\n whileHover,\n whileTap,\n whileFocus,\n whileDrag,\n whileInView,\n animate,\n initial,\n exit,\n transition,\n variants,\n layout,\n layoutId,\n drag,\n dragConstraints,\n dragElastic,\n dragMomentum,\n dragTransition,\n dragPropagation,\n dragControls,\n dragListener,\n dragSnapToOrigin,\n onDrag,\n onDragStart,\n onDragEnd,\n onDirectionLock,\n onDragTransitionEnd,\n onAnimationStart,\n onAnimationComplete,\n onUpdate,\n onPan,\n onPanStart,\n onPanEnd,\n onTap,\n onTapStart,\n onTapCancel,\n onHoverStart,\n onHoverEnd,\n onViewportEnter,\n onViewportLeave,\n viewport,\n custom,\n inherit,\n // Other non-DOM props that might leak through\n motionValue,\n transformTemplate,\n ...clean\n } = p ?? {};\n return clean;\n};\n\nexport const PreviewBlockRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n (\n {\n block,\n components = [],\n currentComponent,\n replaceVhClasses = false,\n componentRegistry,\n ...rest\n },\n ref,\n ) => {\n const classNamesToApply = getBlockClassnamesToApply(block, {\n isPreview: false, // SSR mode - no preview features\n replaceVhClasses,\n });\n const className = cn(\n // If is text block, don't apply the className from the parent (with asChild), since text blocks normally can't have props at all since they're just text nodes.\n classNamesToApply,\n isTextBlock(block) ? undefined : rest?.className,\n );\n const blockProps = getBlockPropsToApply(block, currentComponent ?? null, {\n isPreview: false, // SSR mode - no preview/client-side features\n });\n\n if (block.renderCondition) {\n const shouldRender = evaluateExpression(block.renderCondition, currentComponent?.props ?? {});\n if (!shouldRender) return null;\n }\n\n if (isTextBlock(block)) {\n return <>{htmlToText(getBlockText(block, currentComponent?.props))}</>;\n }\n\n if (isComponentBlock(block)) {\n const component = components.find(\n (component: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">) =>\n component.id === block.componentId,\n );\n if (!component) return null;\n\n // For nested components, the props could be set to a prop of the outer component\n const currentComponentProps = getBlockProps(block, currentComponent ?? null);\n const innerCurrentComponent: CurrentComponent = {\n id: component.id,\n props: currentComponentProps,\n propsConfig: component.propsConfig,\n };\n\n return (\n <PreviewBlockRenderer\n block={component.blocks[0]}\n components={components}\n currentComponent={innerCurrentComponent}\n componentRegistry={componentRegistry}\n className={className}\n />\n );\n }\n\n const Tag = getBlockTagName(block, componentRegistry);\n if (!Tag) return null;\n\n const mergedProps: Record<string, any> = {\n // ...rest shouldn't be passed to text blocks because they normally can't have props at all since they're just text nodes.\n ...(isTextBlock(block) ? {} : rest),\n className,\n // blockProps Needs to be after ...rest to override the props passed from a parent component (e.g. data-block-id). (for child of asChild component)\n ...blockProps,\n ref,\n };\n\n // In SSR mode, links work normally - no client-side navigation needed\n // Remove onClick handlers that would require client-side code\n\n // Only strip non-DOM props when Tag is a real DOM element (string), not a React component\n const finalProps = typeof Tag === \"string\" ? stripNonDomProps(mergedProps) : mergedProps;\n\n if (!block.children?.length) {\n return <Tag {...finalProps} />;\n }\n\n return (\n <Tag {...finalProps}>\n <PreviewChildrenRenderer\n block={block}\n components={components}\n currentComponent={currentComponent}\n componentRegistry={componentRegistry}\n />\n </Tag>\n );\n },\n);\n\nPreviewBlockRenderer.displayName = \"BlockRenderer\";\n","import { Theme, ThemeItem } from \"../types\";\n\nexport function applyFontsToDocument(document: Document, fonts: ThemeItem[]) {\n const root = document.documentElement;\n const head = document.head;\n\n // Simple implementation - in production you'd want to handle Google Fonts and local fonts\n fonts.forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n root.style.setProperty(font.variable, fontFamily);\n });\n}\n\nexport function applyColorToDocument(document: Document, color: ThemeItem) {\n document.documentElement.style.setProperty(color.variable, color.value);\n}\n\nexport function applyBorderRadiusToDocument(\n document: Document,\n borderRadius: number\n) {\n document.documentElement.style.setProperty(\"--radius\", `${borderRadius}rem`);\n}\n\nexport function applyThemeToDocument(document: Document, theme: Theme) {\n applyFontsToDocument(document, Object.values(theme.fonts));\n applyBorderRadiusToDocument(document, theme.borderRadius);\n Object.values(theme.colors).forEach((color) =>\n applyColorToDocument(document, color)\n );\n}\n\n/**\n * Generate CSS styles for theme that can be injected into a style tag for SSR.\n * This is a pure function that works on the server.\n * Uses scoped selectors to ensure SiteIO theme variables take precedence over project theme.\n */\nexport function applyThemeToStyleTag(theme: Theme): string {\n const styles: string[] = [];\n\n // Apply fonts\n Object.values(theme.fonts).forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n styles.push(` ${font.variable}: ${fontFamily} !important;`);\n });\n\n // Apply border radius\n styles.push(` --radius: ${theme.borderRadius}rem !important;`);\n\n // Apply colors - SiteIO uses HSL format (e.g., \"250 93% 66%\")\n Object.values(theme.colors).forEach((color) => {\n styles.push(` ${color.variable}: ${color.value} !important;`);\n });\n\n // Use high specificity selectors to ensure SiteIO theme variables override consuming app\n // The [data-siteio-theme] attribute is added to the SDK wrapper element\n const scopedStyles = styles.map((s) => s.replace(\" !important\", \"\"));\n\n return `\n/* SiteIO Base Styles - Required for proper rendering */\n:root {\n /* Default fallback values - will be overridden by theme */\n --background: 0 0% 5%;\n --foreground: 0 0% 98%;\n --card: 0 0% 17%;\n --card-foreground: 0 0% 98%;\n --popover: 0 0% 17%;\n --popover-foreground: 0 0% 98%;\n --primary: 217 91% 60%;\n --primary-foreground: 210 40% 98%;\n --secondary: 0 0% 17%;\n --secondary-foreground: 0 0% 98%;\n --muted: 0 0% 14.9%;\n --muted-foreground: 0 0% 63.9%;\n --accent: 0 0% 33%;\n --accent-foreground: 0 0% 98%;\n --destructive: 345 87% 53%;\n --destructive-foreground: 0 0% 98%;\n --border: 0 0% 15%;\n --input: 0 0% 14.9%;\n --ring: 0 0% 83.1%;\n --radius: 0.75rem;\n}\n\n/* SiteIO Theme Variables - Override with project theme */\n:root {\n${styles.join(\"\\n\")}\n}\n\n/* SiteIO Theme Variables - Scoped to SDK component */\n[data-siteio-theme] {\n${styles.join(\"\\n\")}\n}\n\n/* Ensure child elements also have access to variables */\n[data-siteio-theme] * {\n${scopedStyles.join(\"\\n\")}\n}\n\n/* SiteIO Base Element Styles */\n[data-siteio-theme] {\n background-color: hsl(var(--background));\n color: hsl(var(--foreground));\n}\n\n/* Utility class mappings for Tailwind CDN compatibility */\n.bg-background { background-color: hsl(var(--background)) !important; }\n.bg-foreground { background-color: hsl(var(--foreground)) !important; }\n.bg-card { background-color: hsl(var(--card)) !important; }\n.bg-popover { background-color: hsl(var(--popover)) !important; }\n.bg-primary { background-color: hsl(var(--primary)) !important; }\n.bg-secondary { background-color: hsl(var(--secondary)) !important; }\n.bg-muted { background-color: hsl(var(--muted)) !important; }\n.bg-accent { background-color: hsl(var(--accent)) !important; }\n.bg-destructive { background-color: hsl(var(--destructive)) !important; }\n\n.text-foreground { color: hsl(var(--foreground)) !important; }\n.text-background { color: hsl(var(--background)) !important; }\n.text-card-foreground { color: hsl(var(--card-foreground)) !important; }\n.text-popover-foreground { color: hsl(var(--popover-foreground)) !important; }\n.text-primary { color: hsl(var(--primary)) !important; }\n.text-primary-foreground { color: hsl(var(--primary-foreground)) !important; }\n.text-secondary-foreground { color: hsl(var(--secondary-foreground)) !important; }\n.text-muted-foreground { color: hsl(var(--muted-foreground)) !important; }\n.text-accent-foreground { color: hsl(var(--accent-foreground)) !important; }\n.text-destructive { color: hsl(var(--destructive)) !important; }\n.text-destructive-foreground { color: hsl(var(--destructive-foreground)) !important; }\n\n.border-border { border-color: hsl(var(--border)) !important; }\n.border-input { border-color: hsl(var(--input)) !important; }\n.ring-ring { --tw-ring-color: hsl(var(--ring)) !important; }\n.ring-offset-background { --tw-ring-offset-color: hsl(var(--background)) !important; }\n\n.rounded-lg { border-radius: var(--radius) !important; }\n.rounded-md { border-radius: calc(var(--radius) - 2px) !important; }\n.rounded-sm { border-radius: calc(var(--radius) - 4px) !important; }\n\n/* Hover states with opacity */\n.hover\\\\:bg-primary\\\\/90:hover { background-color: hsl(var(--primary) / 0.9) !important; }\n.hover\\\\:bg-primary\\\\/80:hover { background-color: hsl(var(--primary) / 0.8) !important; }\n.hover\\\\:bg-secondary\\\\/80:hover { background-color: hsl(var(--secondary) / 0.8) !important; }\n.hover\\\\:bg-destructive\\\\/90:hover { background-color: hsl(var(--destructive) / 0.9) !important; }\n.hover\\\\:bg-accent:hover { background-color: hsl(var(--accent)) !important; }\n.hover\\\\:text-accent-foreground:hover { color: hsl(var(--accent-foreground)) !important; }\n\n/* Focus visible states */\n.focus-visible\\\\:outline-none:focus-visible { outline: 2px solid transparent; outline-offset: 2px; }\n.focus-visible\\\\:ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\\\:ring-ring:focus-visible { --tw-ring-color: hsl(var(--ring)); }\n.focus-visible\\\\:ring-offset-2:focus-visible { --tw-ring-offset-width: 2px; }\n\n/* Disabled states */\n.disabled\\\\:opacity-50:disabled { opacity: 0.5; }\n.disabled\\\\:pointer-events-none:disabled { pointer-events: none; }\n\n/* Card styles */\n.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }\n\n/* Input & Form elements */\ninput, textarea, select {\n background-color: transparent;\n border-color: hsl(var(--input));\n}\n\n/* Separator */\nhr, [role=\"separator\"] {\n border-color: hsl(var(--border));\n background-color: hsl(var(--border));\n}\n\n/* Button transitions */\nbutton, [role=\"button\"], a {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n/* Border default */\n.border { border-width: 1px; border-color: hsl(var(--border)); }\n`.trim();\n}\n","\"use client\";\n\nimport { useEffect } from \"react\";\nimport { Theme } from \"../types\";\nimport { applyThemeToDocument } from \"../utils/theme\";\n\ninterface ThemeHydratorProps {\n theme: Theme;\n}\n\n/**\n * Client component that applies theme CSS variables as inline styles\n * on the <html> element after hydration.\n * \n * This matches the builder's behavior where theme variables are set\n * directly on document.documentElement.style.\n */\nexport function ThemeHydrator({ theme }: ThemeHydratorProps) {\n useEffect(() => {\n applyThemeToDocument(document, theme);\n }, [theme]);\n\n return null; // This component only has side effects\n}\n","import { fetchProject } from \"../utils/fetchProject\";\nimport { PreviewBlockRenderer } from \"./PreviewBlockRenderer\";\nimport { ThemeHydrator } from \"./ThemeHydrator\";\nimport { RewebProjectProps, Component, ProjectData } from \"../types\";\nimport { applyThemeToStyleTag } from \"../utils/theme\";\n\n/**\n * Pure SSR server component that fetches and renders project data on the server.\n * No client-side JavaScript required - works entirely in SSR mode.\n */\nexport async function RewebProject({\n projectId,\n token,\n initialPageId,\n config,\n className,\n componentRegistry,\n}: RewebProjectProps) {\n // Fetch data on the server\n let data: ProjectData;\n let error: Error | null = null;\n\n try {\n data = await fetchProject({\n projectId,\n token,\n apiUrl: config?.apiUrl,\n });\n } catch (err) {\n error = err instanceof Error ? err : new Error(\"Failed to fetch project\");\n // Return error UI - this will be rendered on server\n return (\n <div className={className}>\n <div>Error: {error.message}</div>\n </div>\n );\n }\n\n // Determine which page to render\n let currentPageId = initialPageId;\n if (!currentPageId) {\n // Find home page (url === \"/\")\n const homePage = data.pages.find((page) => page.url === \"/\");\n if (homePage) {\n currentPageId = homePage.public_id;\n } else if (data.pages.length > 0) {\n currentPageId = data.pages[0].public_id;\n }\n }\n\n const currentPage = data.pages.find((page) => page.public_id === currentPageId);\n if (!currentPage) {\n return (\n <div className={className}>\n <div>Page not found</div>\n </div>\n );\n }\n\n // Prepare components data\n const components: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[] = data.components.map(\n (component) => ({\n id: component.public_id,\n blocks: component.blocks,\n propsConfig: component.props_config,\n }),\n );\n\n // Generate theme styles for SSR\n const themeStyles = applyThemeToStyleTag(data.project.theme);\n const projectCss = data.styles?.css ?? \"\";\n\n // Debug info (visible in page source)\n const debugInfo = `\n/* SiteIO SDK Debug Info:\n * Theme colors count: ${Object.keys(data.project.theme?.colors || {}).length}\n * Project CSS length: ${projectCss.length} chars\n * Theme styles length: ${themeStyles.length} chars\n */`;\n\n return (\n <>\n {/* Inject theme styles for SSR - scoped to SiteIO component */}\n <style\n data-siteio-theme-styles\n dangerouslySetInnerHTML={{ __html: debugInfo + \"\\n\" + themeStyles }}\n />\n {projectCss ? (\n <style data-siteio-project-css dangerouslySetInnerHTML={{ __html: projectCss }} />\n ) : null}\n {/* Client: Apply inline styles to <html> after hydration */}\n <ThemeHydrator theme={data.project.theme} />\n <div className={className} data-siteio-theme>\n {currentPage.blocks.map((block) => (\n <PreviewBlockRenderer\n key={block.id}\n block={block}\n components={components}\n componentRegistry={componentRegistry}\n />\n ))}\n </div>\n </>\n );\n}\n"]}
{"version":3,"sources":["../src/utils/fetchProject.ts","../src/components/Icon.tsx","../src/utils/cn.ts","../src/components/ui/button.tsx","../src/components/ui/card.tsx","../src/components/ui/badge.tsx","../src/components/ui/input.tsx","../src/components/ui/label.tsx","../src/components/ui/separator.tsx","../src/components/ui/avatar.tsx","../src/utils/blockUtils.ts","../src/utils/booleanExpressions.ts","../src/utils/propsUtils.ts","../src/components/PreviewBlockRenderer.tsx","../src/utils/theme.ts","../src/components/RewebProject.tsx"],"names":["forwardRef","LucideIcons","jsx","twMerge","clsx","React","React2","React3","React4","React5","React6","Fragment","component","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,eAAsB,YAAA,CAAa;AAAA,EACjC,SAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS;AACpE,CAAA,EAA8C;AAC5C,EAAA,MAAM,MAAM,IAAI,GAAA,CAAI,GAAG,MAAM,CAAA,aAAA,EAAgB,SAAS,CAAA,CAAE,CAAA;AACxD,EAAA,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,OAAA,EAAS,KAAK,CAAA;AAEnC,EAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,CAAI,UAAS,EAAG;AAAA,IAC3C,MAAA,EAAQ,KAAA;AAAA,IACR,OAAA,EAAS;AAAA,MACP,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,KAAA,EAAO;AAAA;AAAA,GACR,CAAA;AAED,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,IAAA,MAAM,KAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAK,CAAE,MAAM,OAAO,EAAE,KAAA,EAAO,eAAA,EAAgB,CAAE,CAAA;AAC5E,IAAA,MAAM,IAAI,KAAA,CAAM,KAAA,CAAM,SAAS,CAAA,yBAAA,EAA4B,QAAA,CA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;AAAA,KAC7E;AAAA,oBACAA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,mBAAA,EAAiB,IAAA,EACzC,QAAA,EAAA,WAAA,CAAY,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,qBACvBA,cAAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QAEC,KAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAHK,KAAA,CAAM;AAAA,KAKd,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["import { ProjectData } from \"../types\";\n\nexport interface FetchProjectOptions {\n projectId: string;\n token: string;\n apiUrl?: string;\n}\n\nexport async function fetchProject({\n projectId,\n token,\n apiUrl = typeof window !== \"undefined\" ? window.location.origin : \"http://localhost:3000\",\n}: FetchProjectOptions): Promise<ProjectData> {\n const url = new URL(`${apiUrl}/api/project/${projectId}`);\n url.searchParams.set(\"token\", token);\n\n const response = await fetch(url.toString(), {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n cache: \"no-store\", // Disable caching for real-time updates\n });\n\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `Failed to fetch project: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n\n\n\n","import * as LucideIcons from \"lucide-react\";\nimport { forwardRef } from \"react\";\n\ninterface IconProps {\n name: string;\n size?: number;\n className?: string;\n strokeWidth?: number;\n [key: string]: any;\n}\n\n/**\n * Dynamic icon component that renders Lucide React icons by name.\n * This allows the SDK to render any icon used in the SiteIO builder.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(\n ({ name, size = 24, className, strokeWidth, ...props }, ref) => {\n // Get the icon component from Lucide\n const IconComponent = (LucideIcons as Record<string, any>)[name];\n\n if (!IconComponent) {\n // Return empty span if icon not found to avoid breaking the layout\n console.warn(`[SiteIO SDK] Icon \"${name}\" not found in lucide-react`);\n return <span className={className} style={{ width: size, height: size }} />;\n }\n\n return (\n <IconComponent\n ref={ref}\n size={size}\n className={className}\n strokeWidth={strokeWidth}\n {...props}\n />\n );\n },\n);\n\nIcon.displayName = \"Icon\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n\n\n\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n variant?:\n | \"default\"\n | \"destructive\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\";\n size?: \"default\" | \"sm\" | \"lg\" | \"icon\";\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n },\n ref\n ) => {\n const baseStyles =\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\";\n\n const variants: Record<string, string> = {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n };\n\n const sizes: Record<string, string> = {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n };\n\n return (\n <button\n className={cn(baseStyles, variants[variant], sizes[size], className)}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n className\n )}\n {...props}\n />\n));\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n {...props}\n />\n));\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"text-2xl font-semibold leading-none tracking-tight\",\n className\n )}\n {...props}\n />\n));\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nCardDescription.displayName = \"CardDescription\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n));\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center p-6 pt-0\", className)}\n {...props}\n />\n));\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n};\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: \"default\" | \"secondary\" | \"destructive\" | \"outline\";\n}\n\nfunction Badge({ className, variant = \"default\", ...props }: BadgeProps) {\n const baseStyles =\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\";\n\n const variants: Record<string, string> = {\n default:\n \"border-transparent bg-primary text-primary-foreground hover:bg-primary/80\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n destructive:\n \"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80\",\n outline: \"text-foreground\",\n };\n\n return (\n <div className={cn(baseStyles, variants[variant], className)} {...props} />\n );\n}\n\nexport { Badge };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Input = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n});\nInput.displayName = \"Input\";\n\nexport { Input };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n));\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\ninterface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n decorative?: boolean;\n}\n\nconst Separator = React.forwardRef<HTMLDivElement, SeparatorProps>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <div\n ref={ref}\n role={decorative ? \"none\" : \"separator\"}\n aria-orientation={decorative ? undefined : orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n )\n);\nSeparator.displayName = \"Separator\";\n\nexport { Separator };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Avatar = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n className\n )}\n {...props}\n />\n));\nAvatar.displayName = \"Avatar\";\n\nconst AvatarImage = React.forwardRef<\n HTMLImageElement,\n React.ImgHTMLAttributes<HTMLImageElement>\n>(({ className, ...props }, ref) => (\n <img\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = \"AvatarImage\";\n\nconst AvatarFallback = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted\",\n className\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = \"AvatarFallback\";\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","import { Icon } from \"../components/Icon\";\nimport {\n Button,\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n Badge,\n Input,\n Label,\n Separator,\n Avatar,\n AvatarImage,\n AvatarFallback,\n} from \"../components/ui\";\nimport {\n Block,\n ElementBlock,\n DefaultComponentBlock,\n TextBlock,\n ComponentBlock,\n ComponentRegistry,\n} from \"../types\";\n\nexport function isTextBlock(block: Block): block is TextBlock {\n return block.type === \"text\";\n}\n\nexport function isElementBlock(block: Block): block is ElementBlock {\n return block.type === \"element\";\n}\n\nexport function isDefaultComponentBlock(\n block: Block\n): block is DefaultComponentBlock {\n return block.type === \"component\";\n}\n\nexport function isComponentBlock(block: Block): block is ComponentBlock {\n return block.type === \"custom-component\";\n}\n\n/**\n * Built-in SDK components that are always available.\n * These don't require the user to install any additional packages.\n * Includes all common UI components used in SiteIO projects.\n */\nexport const SDK_BUILT_IN_COMPONENTS: ComponentRegistry = {\n // Icons\n Icon,\n // Button\n Button,\n // Card\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n // Badge\n Badge,\n // Form elements\n Input,\n Label,\n // Layout\n Separator,\n // Avatar\n Avatar,\n AvatarImage,\n AvatarFallback,\n};\n\n/**\n * Default fallback tags for components when no registry is provided.\n * Maps component names to semantic HTML elements.\n * Note: These are FALLBACKS - the actual styling comes from the compiled CSS.\n */\nconst DEFAULT_COMPONENT_TAGS: Record<string, keyof JSX.IntrinsicElements> = {\n Button: \"button\",\n Link: \"a\",\n Image: \"img\",\n Input: \"input\",\n Textarea: \"textarea\",\n Label: \"label\",\n Separator: \"hr\",\n Badge: \"span\",\n Card: \"div\",\n CardContent: \"div\",\n CardHeader: \"div\",\n CardTitle: \"h3\",\n CardDescription: \"p\",\n CardFooter: \"div\",\n Avatar: \"span\",\n AvatarImage: \"img\",\n AvatarFallback: \"span\",\n Table: \"table\",\n TableHeader: \"thead\",\n TableBody: \"tbody\",\n TableFooter: \"tfoot\",\n TableRow: \"tr\",\n TableHead: \"th\",\n TableCell: \"td\",\n TableCaption: \"caption\",\n};\n\nexport function getBlockCurrentClassNames(block: Block): string[] {\n const defaultClassNames = block.classNames?.default || [];\n const addedClassNames = block.classNames?.added || [];\n const removedClassNames = block.classNames?.removed || [];\n\n // Start with the default class names\n let currentClassNames = [...defaultClassNames];\n\n // Add the added class names\n currentClassNames = currentClassNames.concat(addedClassNames);\n\n // Remove the removed class names\n currentClassNames = currentClassNames.filter(\n (className) => !removedClassNames.includes(className)\n );\n\n // Return the unique set of class names\n return Array.from(new Set(currentClassNames));\n}\n\nconst VIEWPORT_HEIGHT = 900;\n\nexport function convertVhClassesToPx(classNames: string[]): string[] {\n const viewportHeight = VIEWPORT_HEIGHT;\n\n const vhUnits = [\"vh\", \"dvh\", \"svh\", \"lvh\"];\n const screenClasses = [\"h-screen\", \"h-dvh\", \"h-svh\", \"h-lvh\"];\n\n return classNames.map((className) => {\n // Handle h-screen and similar classes\n const screenMatch = screenClasses.find((sc) => className.includes(sc));\n if (screenMatch) {\n return className.replace(screenMatch, `h-[${viewportHeight}px]`);\n }\n\n // Handle percentage-based vh units\n for (const unit of vhUnits) {\n if (className.includes(unit)) {\n const match = className.match(new RegExp(`(\\\\d+)${unit}`));\n if (match) {\n const value = parseInt(match[1], 10);\n const pxValue = (value / 100) * viewportHeight;\n return className.replace(`${value}${unit}`, `${pxValue}px`);\n }\n }\n }\n\n return className;\n });\n}\n\nexport function getBlockClassnamesToApply(\n block: Block,\n options?: {\n isPreview?: boolean;\n replaceVhClasses?: boolean;\n }\n): string[] {\n const { isPreview = false, replaceVhClasses = true } = options || {};\n let currentClassNames = getBlockCurrentClassNames(block);\n\n if (isPreview) {\n const isLink = isElementBlock(block) && block.tag === \"a\";\n\n if (isLink) {\n currentClassNames = [...currentClassNames, \"cursor-pointer\"];\n }\n }\n\n if (replaceVhClasses) {\n return convertVhClassesToPx(currentClassNames);\n }\n\n return currentClassNames;\n}\n\n/**\n * Gets the tag or component to render for a block.\n *\n * @param block - The block to get the tag for\n * @param componentRegistry - Optional registry of React components\n * @returns A React component, HTML tag name, or undefined\n */\nexport function getBlockTagName(\n block: ElementBlock | DefaultComponentBlock,\n componentRegistry?: ComponentRegistry\n): React.ComponentType<any> | keyof JSX.IntrinsicElements | undefined {\n if (isDefaultComponentBlock(block)) {\n // First, check SDK built-in components (Icon, etc.)\n if (SDK_BUILT_IN_COMPONENTS[block.component]) {\n return SDK_BUILT_IN_COMPONENTS[block.component];\n }\n\n // Then, try to get the component from the user's registry\n if (componentRegistry && componentRegistry[block.component]) {\n return componentRegistry[block.component];\n }\n\n // Fallback to semantic HTML tags for common components\n if (DEFAULT_COMPONENT_TAGS[block.component]) {\n return DEFAULT_COMPONENT_TAGS[block.component];\n }\n\n // Last resort: render as div\n return \"div\";\n }\n\n return (block.tag as keyof JSX.IntrinsicElements) ?? \"div\";\n}\n","import { BooleanExpression, ComparisonOperator, NAryLogicalOperator } from \"../types\";\n\nexport function evaluateExpression(\n expression: BooleanExpression,\n props: Record<string, any>,\n): boolean {\n if (\"type\" in expression && (expression.type === \"and\" || expression.type === \"or\" || expression.type === \"not\")) {\n return evaluateNAryLogicalOperator(expression as NAryLogicalOperator, props);\n }\n\n if (\"type\" in expression && (expression.type === \"eq\" || expression.type === \"neq\")) {\n return evaluateComparisonOperator(expression as ComparisonOperator, props);\n }\n\n return true;\n}\n\nfunction evaluateNAryLogicalOperator(\n operator: NAryLogicalOperator,\n props: Record<string, any>,\n): boolean {\n if (operator.type === \"not\") {\n if (operator.operands.length !== 1) return true;\n return !evaluateExpression(operator.operands[0], props);\n }\n\n if (operator.type === \"and\") {\n return operator.operands.every((operand) => evaluateExpression(operand, props));\n }\n\n if (operator.type === \"or\") {\n return operator.operands.some((operand) => evaluateExpression(operand, props));\n }\n\n return true;\n}\n\nfunction evaluateComparisonOperator(\n operator: ComparisonOperator,\n props: Record<string, any>,\n): boolean {\n const leftValue = getOperandValue(operator.left, props);\n const rightValue = getOperandValue(operator.right, props);\n\n if (operator.type === \"eq\") {\n return leftValue === rightValue;\n }\n\n if (operator.type === \"neq\") {\n return leftValue !== rightValue;\n }\n\n return true;\n}\n\nfunction getOperandValue(operand: { type: string; value: any }, props: Record<string, any>): any {\n if (operand.type === \"field\") {\n return props[operand.value];\n }\n\n if (operand.type === \"value\") {\n return operand.value;\n }\n\n return undefined;\n}\n\n\n\n\n","import { Block, Component, TextBlock } from \"../types\";\nimport { isComponentBlock, isDefaultComponentBlock, isElementBlock } from \"./blockUtils\";\n\nexport interface CurrentComponent {\n id: string;\n props: Record<string, any>;\n propsConfig: Record<string, any>;\n}\n\nfunction isPropValue(value: any): boolean {\n return typeof value === \"string\" && value.startsWith(\"{{\") && value.endsWith(\"}}\");\n}\n\nfunction getPropNameFromValue(value: string): string {\n return value.slice(2, -2).trim();\n}\n\nexport function getBlockText(block: TextBlock, props?: Record<string, any>): string {\n if (block.text.startsWith(\"{\") && props) {\n const propName = block.text.slice(1, -1).replace(\"props.\", \"\");\n return props?.[propName]?.toString() || block.text;\n }\n return block.text;\n}\n\nexport function htmlToText(html: string): string {\n if (typeof window === \"undefined\") return html;\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, \"text/html\");\n return doc.body.textContent || \"\";\n}\n\nexport function getBlockProps(\n block: Block,\n currentComponent: CurrentComponent | null,\n): Record<string, any> {\n const props = { ...block.props };\n if (!currentComponent) return props;\n\n for (const key in props) {\n const value = props[key];\n\n // If a prop is set to the prop of a component, substitute it with the actual value of the component prop\n if (isPropValue(value)) {\n const propName = getPropNameFromValue(value);\n const componentPropValue = currentComponent.props[propName];\n\n if (componentPropValue !== undefined) {\n props[key] = componentPropValue;\n }\n }\n }\n\n return props;\n}\n\nexport function getBlockPropsToApply(\n block: Block,\n currentComponent: CurrentComponent | null,\n options?: {\n isPreview?: boolean;\n },\n): Record<string, any> {\n const { isPreview = false } = options || {};\n\n // If it's the instance of a component, the props don't need to be applied to the component block itself,\n // rather they are handled by the component block renderer.\n const props = isComponentBlock(block) ? {} : getBlockProps(block, currentComponent);\n\n if (!isPreview) {\n // If it's a Link component, set href to \"#\" so it doesn't navigate anywhere\n if (isDefaultComponentBlock(block) && block.component === \"Link\") {\n props.href = \"#\";\n } else {\n // Otherwise, just delete href (for a normal anchor tag)\n delete props.href;\n }\n\n const isButton =\n (isDefaultComponentBlock(block) && block.component === \"Button\") ||\n (isElementBlock(block) && block.tag === \"button\");\n if (isButton) {\n props.type = \"button\";\n }\n }\n\n // Remove Next.js Image-specific props that shouldn't be passed to DOM elements\n // Note: asChild is intentionally kept as it's needed by Radix components (Button, etc.)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n ...domProps\n } = props;\n\n // Handle asChild - add data-parent-block-id for proper block identification\n const isAsChild = !!domProps?.asChild;\n if (isAsChild) {\n domProps[\"data-parent-block-id\"] = block.id;\n }\n\n return {\n ...domProps,\n \"data-block-id\": block.id,\n };\n}\n","import { forwardRef } from \"react\";\nimport { Block, Component, ComponentRegistry } from \"../types\";\nimport {\n isTextBlock,\n isComponentBlock,\n getBlockClassnamesToApply,\n getBlockTagName,\n} from \"../utils/blockUtils\";\nimport { evaluateExpression } from \"../utils/booleanExpressions\";\nimport {\n getBlockProps,\n getBlockPropsToApply,\n getBlockText,\n htmlToText,\n CurrentComponent,\n} from \"../utils/propsUtils\";\nimport { cn } from \"../utils/cn\";\n\ninterface PreviewBlockRendererProps {\n block: Block;\n components?: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[];\n currentComponent?: CurrentComponent | null;\n replaceVhClasses?: boolean;\n className?: string;\n /** Registry of UI components (Button, Card, etc.) for proper rendering */\n componentRegistry?: ComponentRegistry;\n [key: string]: any;\n}\n\nexport const PreviewChildrenRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n ({ block, ...restProps }, ref) => {\n if (!block.children) return null;\n\n if (block.children.length === 1) {\n return <PreviewBlockRenderer block={block.children[0]} ref={ref} {...restProps} />;\n }\n\n return (\n <>\n {block.children.map((child: Block) => (\n <PreviewBlockRenderer key={child.id} block={child} {...restProps} />\n ))}\n </>\n );\n },\n);\n\nPreviewChildrenRenderer.displayName = \"ChildrenRenderer\";\n\n/**\n * Strip props that are not valid DOM attributes.\n * This includes React-specific props, Next.js Image props, and Framer Motion animation props.\n */\nconst stripNonDomProps = (p: Record<string, any>) => {\n const {\n // React/Radix props\n asChild,\n // Next.js Image props\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n // Framer Motion animation props\n whileHover,\n whileTap,\n whileFocus,\n whileDrag,\n whileInView,\n animate,\n initial,\n exit,\n transition,\n variants,\n layout,\n layoutId,\n drag,\n dragConstraints,\n dragElastic,\n dragMomentum,\n dragTransition,\n dragPropagation,\n dragControls,\n dragListener,\n dragSnapToOrigin,\n onDrag,\n onDragStart,\n onDragEnd,\n onDirectionLock,\n onDragTransitionEnd,\n onAnimationStart,\n onAnimationComplete,\n onUpdate,\n onPan,\n onPanStart,\n onPanEnd,\n onTap,\n onTapStart,\n onTapCancel,\n onHoverStart,\n onHoverEnd,\n onViewportEnter,\n onViewportLeave,\n viewport,\n custom,\n inherit,\n // Other non-DOM props that might leak through\n motionValue,\n transformTemplate,\n ...clean\n } = p ?? {};\n return clean;\n};\n\nexport const PreviewBlockRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n (\n {\n block,\n components = [],\n currentComponent,\n replaceVhClasses = false,\n componentRegistry,\n ...rest\n },\n ref,\n ) => {\n const classNamesToApply = getBlockClassnamesToApply(block, {\n isPreview: false, // SSR mode - no preview features\n replaceVhClasses,\n });\n const className = cn(\n // If is text block, don't apply the className from the parent (with asChild), since text blocks normally can't have props at all since they're just text nodes.\n classNamesToApply,\n isTextBlock(block) ? undefined : rest?.className,\n );\n const blockProps = getBlockPropsToApply(block, currentComponent ?? null, {\n isPreview: false, // SSR mode - no preview/client-side features\n });\n\n if (block.renderCondition) {\n const shouldRender = evaluateExpression(block.renderCondition, currentComponent?.props ?? {});\n if (!shouldRender) return null;\n }\n\n if (isTextBlock(block)) {\n return <>{htmlToText(getBlockText(block, currentComponent?.props))}</>;\n }\n\n if (isComponentBlock(block)) {\n const component = components.find(\n (component: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">) =>\n component.id === block.componentId,\n );\n if (!component) return null;\n\n // For nested components, the props could be set to a prop of the outer component\n const currentComponentProps = getBlockProps(block, currentComponent ?? null);\n const innerCurrentComponent: CurrentComponent = {\n id: component.id,\n props: currentComponentProps,\n propsConfig: component.propsConfig,\n };\n\n return (\n <PreviewBlockRenderer\n block={component.blocks[0]}\n components={components}\n currentComponent={innerCurrentComponent}\n componentRegistry={componentRegistry}\n className={className}\n />\n );\n }\n\n const Tag = getBlockTagName(block, componentRegistry);\n if (!Tag) return null;\n\n const mergedProps: Record<string, any> = {\n // ...rest shouldn't be passed to text blocks because they normally can't have props at all since they're just text nodes.\n ...(isTextBlock(block) ? {} : rest),\n className,\n // blockProps Needs to be after ...rest to override the props passed from a parent component (e.g. data-block-id). (for child of asChild component)\n ...blockProps,\n ref,\n };\n\n // In SSR mode, links work normally - no client-side navigation needed\n // Remove onClick handlers that would require client-side code\n\n // Only strip non-DOM props when Tag is a real DOM element (string), not a React component\n const finalProps = typeof Tag === \"string\" ? stripNonDomProps(mergedProps) : mergedProps;\n\n if (!block.children?.length) {\n return <Tag {...finalProps} />;\n }\n\n return (\n <Tag {...finalProps}>\n <PreviewChildrenRenderer\n block={block}\n components={components}\n currentComponent={currentComponent}\n componentRegistry={componentRegistry}\n />\n </Tag>\n );\n },\n);\n\nPreviewBlockRenderer.displayName = \"BlockRenderer\";\n","import { Theme, ThemeItem } from \"../types\";\n\nexport function applyFontsToDocument(document: Document, fonts: ThemeItem[]) {\n const root = document.documentElement;\n const head = document.head;\n\n // Simple implementation - in production you'd want to handle Google Fonts and local fonts\n fonts.forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n root.style.setProperty(font.variable, fontFamily);\n });\n}\n\nexport function applyColorToDocument(document: Document, color: ThemeItem) {\n document.documentElement.style.setProperty(color.variable, color.value);\n}\n\nexport function applyBorderRadiusToDocument(\n document: Document,\n borderRadius: number\n) {\n document.documentElement.style.setProperty(\"--radius\", `${borderRadius}rem`);\n}\n\nexport function applyThemeToDocument(document: Document, theme: Theme) {\n applyFontsToDocument(document, Object.values(theme.fonts));\n applyBorderRadiusToDocument(document, theme.borderRadius);\n Object.values(theme.colors).forEach((color) =>\n applyColorToDocument(document, color)\n );\n}\n\n/**\n * Generate CSS styles for theme that can be injected into a style tag for SSR.\n * This is a pure function that works on the server.\n * Uses scoped selectors to ensure SiteIO theme variables take precedence over project theme.\n */\nexport function applyThemeToStyleTag(theme: Theme): string {\n const styles: string[] = [];\n\n // Apply fonts\n Object.values(theme.fonts).forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n styles.push(` ${font.variable}: ${fontFamily} !important;`);\n });\n\n // Apply border radius\n styles.push(` --radius: ${theme.borderRadius}rem !important;`);\n\n // Apply colors - SiteIO uses HSL format (e.g., \"250 93% 66%\")\n Object.values(theme.colors).forEach((color) => {\n styles.push(` ${color.variable}: ${color.value} !important;`);\n });\n\n // Use high specificity selectors to ensure SiteIO theme variables override consuming app\n // The [data-siteio-theme] attribute is added to the SDK wrapper element\n const scopedStyles = styles.map((s) => s.replace(\" !important\", \"\"));\n\n return `\n/* SiteIO Base Styles - Required for proper rendering */\n:root {\n /* Default fallback values - will be overridden by theme */\n --background: 0 0% 5%;\n --foreground: 0 0% 98%;\n --card: 0 0% 17%;\n --card-foreground: 0 0% 98%;\n --popover: 0 0% 17%;\n --popover-foreground: 0 0% 98%;\n --primary: 217 91% 60%;\n --primary-foreground: 210 40% 98%;\n --secondary: 0 0% 17%;\n --secondary-foreground: 0 0% 98%;\n --muted: 0 0% 14.9%;\n --muted-foreground: 0 0% 63.9%;\n --accent: 0 0% 33%;\n --accent-foreground: 0 0% 98%;\n --destructive: 345 87% 53%;\n --destructive-foreground: 0 0% 98%;\n --border: 0 0% 15%;\n --input: 0 0% 14.9%;\n --ring: 0 0% 83.1%;\n --radius: 0.75rem;\n}\n\n/* SiteIO Theme Variables - Override with project theme */\n:root {\n${styles.join(\"\\n\")}\n}\n\n/* SiteIO Theme Variables - Scoped to SDK component */\n[data-siteio-theme] {\n${styles.join(\"\\n\")}\n}\n\n/* Ensure child elements also have access to variables */\n[data-siteio-theme] * {\n${scopedStyles.join(\"\\n\")}\n}\n\n/* SiteIO Base Element Styles */\n[data-siteio-theme] {\n background-color: hsl(var(--background));\n color: hsl(var(--foreground));\n}\n\n/* Utility class mappings for Tailwind CDN compatibility */\n.bg-background { background-color: hsl(var(--background)) !important; }\n.bg-foreground { background-color: hsl(var(--foreground)) !important; }\n.bg-card { background-color: hsl(var(--card)) !important; }\n.bg-popover { background-color: hsl(var(--popover)) !important; }\n.bg-primary { background-color: hsl(var(--primary)) !important; }\n.bg-secondary { background-color: hsl(var(--secondary)) !important; }\n.bg-muted { background-color: hsl(var(--muted)) !important; }\n.bg-accent { background-color: hsl(var(--accent)) !important; }\n.bg-destructive { background-color: hsl(var(--destructive)) !important; }\n\n.text-foreground { color: hsl(var(--foreground)) !important; }\n.text-background { color: hsl(var(--background)) !important; }\n.text-card-foreground { color: hsl(var(--card-foreground)) !important; }\n.text-popover-foreground { color: hsl(var(--popover-foreground)) !important; }\n.text-primary { color: hsl(var(--primary)) !important; }\n.text-primary-foreground { color: hsl(var(--primary-foreground)) !important; }\n.text-secondary-foreground { color: hsl(var(--secondary-foreground)) !important; }\n.text-muted-foreground { color: hsl(var(--muted-foreground)) !important; }\n.text-accent-foreground { color: hsl(var(--accent-foreground)) !important; }\n.text-destructive { color: hsl(var(--destructive)) !important; }\n.text-destructive-foreground { color: hsl(var(--destructive-foreground)) !important; }\n\n.border-border { border-color: hsl(var(--border)) !important; }\n.border-input { border-color: hsl(var(--input)) !important; }\n.ring-ring { --tw-ring-color: hsl(var(--ring)) !important; }\n.ring-offset-background { --tw-ring-offset-color: hsl(var(--background)) !important; }\n\n.rounded-lg { border-radius: var(--radius) !important; }\n.rounded-md { border-radius: calc(var(--radius) - 2px) !important; }\n.rounded-sm { border-radius: calc(var(--radius) - 4px) !important; }\n\n/* Hover states with opacity */\n.hover\\\\:bg-primary\\\\/90:hover { background-color: hsl(var(--primary) / 0.9) !important; }\n.hover\\\\:bg-primary\\\\/80:hover { background-color: hsl(var(--primary) / 0.8) !important; }\n.hover\\\\:bg-secondary\\\\/80:hover { background-color: hsl(var(--secondary) / 0.8) !important; }\n.hover\\\\:bg-destructive\\\\/90:hover { background-color: hsl(var(--destructive) / 0.9) !important; }\n.hover\\\\:bg-accent:hover { background-color: hsl(var(--accent)) !important; }\n.hover\\\\:text-accent-foreground:hover { color: hsl(var(--accent-foreground)) !important; }\n\n/* Focus visible states */\n.focus-visible\\\\:outline-none:focus-visible { outline: 2px solid transparent; outline-offset: 2px; }\n.focus-visible\\\\:ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\\\:ring-ring:focus-visible { --tw-ring-color: hsl(var(--ring)); }\n.focus-visible\\\\:ring-offset-2:focus-visible { --tw-ring-offset-width: 2px; }\n\n/* Disabled states */\n.disabled\\\\:opacity-50:disabled { opacity: 0.5; }\n.disabled\\\\:pointer-events-none:disabled { pointer-events: none; }\n\n/* Card styles */\n.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }\n\n/* Input & Form elements */\ninput, textarea, select {\n background-color: transparent;\n border-color: hsl(var(--input));\n}\n\n/* Separator */\nhr, [role=\"separator\"] {\n border-color: hsl(var(--border));\n background-color: hsl(var(--border));\n}\n\n/* Button transitions */\nbutton, [role=\"button\"], a {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n/* Border default */\n.border { border-width: 1px; border-color: hsl(var(--border)); }\n`.trim();\n}\n\n/**\n * Generate an inline script that applies theme CSS variables as inline styles\n * on the <html> element. This runs immediately without waiting for React hydration.\n * \n * This matches the builder's behavior where theme variables are set directly\n * on document.documentElement.style.\n */\nexport function generateThemeScript(theme: Theme): string {\n // Serialize theme data safely for inline script\n const themeData = JSON.stringify({\n colors: theme.colors,\n fonts: theme.fonts,\n borderRadius: theme.borderRadius,\n });\n\n return `\n(function() {\n try {\n var theme = ${themeData};\n var root = document.documentElement;\n \n // Apply colors\n Object.keys(theme.colors).forEach(function(key) {\n var color = theme.colors[key];\n root.style.setProperty(color.variable, color.value);\n });\n \n // Apply fonts\n Object.keys(theme.fonts).forEach(function(key) {\n var font = theme.fonts[key];\n root.style.setProperty(font.variable, '\"' + font.value + '\"');\n });\n \n // Apply border radius\n root.style.setProperty('--radius', theme.borderRadius + 'rem');\n } catch (e) {\n console.error('SiteIO theme script error:', e);\n }\n})();\n`.trim();\n}\n","import { fetchProject } from \"../utils/fetchProject\";\nimport { PreviewBlockRenderer } from \"./PreviewBlockRenderer\";\nimport { RewebProjectProps, Component, ProjectData } from \"../types\";\nimport { applyThemeToStyleTag, generateThemeScript } from \"../utils/theme\";\n\n/**\n * Pure SSR server component that fetches and renders project data on the server.\n * No client-side JavaScript required - works entirely in SSR mode.\n */\nexport async function RewebProject({\n projectId,\n token,\n initialPageId,\n config,\n className,\n componentRegistry,\n}: RewebProjectProps) {\n // Fetch data on the server\n let data: ProjectData;\n let error: Error | null = null;\n\n try {\n data = await fetchProject({\n projectId,\n token,\n apiUrl: config?.apiUrl,\n });\n } catch (err) {\n error = err instanceof Error ? err : new Error(\"Failed to fetch project\");\n // Return error UI - this will be rendered on server\n return (\n <div className={className}>\n <div>Error: {error.message}</div>\n </div>\n );\n }\n\n // Determine which page to render\n let currentPageId = initialPageId;\n if (!currentPageId) {\n // Find home page (url === \"/\")\n const homePage = data.pages.find((page) => page.url === \"/\");\n if (homePage) {\n currentPageId = homePage.public_id;\n } else if (data.pages.length > 0) {\n currentPageId = data.pages[0].public_id;\n }\n }\n\n const currentPage = data.pages.find((page) => page.public_id === currentPageId);\n if (!currentPage) {\n return (\n <div className={className}>\n <div>Page not found</div>\n </div>\n );\n }\n\n // Prepare components data\n const components: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[] = data.components.map(\n (component) => ({\n id: component.public_id,\n blocks: component.blocks,\n propsConfig: component.props_config,\n }),\n );\n\n // Generate theme styles for SSR\n const themeStyles = applyThemeToStyleTag(data.project.theme);\n const projectCss = data.styles?.css ?? \"\";\n\n // Debug info (visible in page source)\n const debugInfo = `\n/* SiteIO SDK Debug Info:\n * Theme colors count: ${Object.keys(data.project.theme?.colors || {}).length}\n * Project CSS length: ${projectCss.length} chars\n * Theme styles length: ${themeStyles.length} chars\n */`;\n\n return (\n <>\n {/* Inject theme styles for SSR - scoped to SiteIO component */}\n <style\n data-siteio-theme-styles\n dangerouslySetInnerHTML={{ __html: debugInfo + \"\\n\" + themeStyles }}\n />\n {projectCss ? (\n <style data-siteio-project-css dangerouslySetInnerHTML={{ __html: projectCss }} />\n ) : null}\n {/* Apply inline styles to <html> element immediately (no React hydration needed) */}\n <script\n data-siteio-theme-script\n dangerouslySetInnerHTML={{ __html: generateThemeScript(data.project.theme) }}\n />\n <div className={className} data-siteio-theme>\n {currentPage.blocks.map((block) => (\n <PreviewBlockRenderer\n key={block.id}\n block={block}\n components={components}\n componentRegistry={componentRegistry}\n />\n ))}\n </div>\n </>\n );\n}\n"]}
import * as React2 from 'react';
import { forwardRef, useEffect } from 'react';
import { forwardRef } from 'react';
import * as LucideIcons from 'lucide-react';

@@ -624,22 +624,2 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';

// src/utils/theme.ts
function applyFontsToDocument(document2, fonts) {
const root = document2.documentElement;
fonts.forEach((font) => {
const fontFamily = `"${font.value}"`;
root.style.setProperty(font.variable, fontFamily);
});
}
function applyColorToDocument(document2, color) {
document2.documentElement.style.setProperty(color.variable, color.value);
}
function applyBorderRadiusToDocument(document2, borderRadius) {
document2.documentElement.style.setProperty("--radius", `${borderRadius}rem`);
}
function applyThemeToDocument(document2, theme) {
applyFontsToDocument(document2, Object.values(theme.fonts));
applyBorderRadiusToDocument(document2, theme.borderRadius);
Object.values(theme.colors).forEach(
(color) => applyColorToDocument(document2, color)
);
}
function applyThemeToStyleTag(theme) {

@@ -783,9 +763,33 @@ const styles = [];

}
// src/components/ThemeHydrator.tsx
function ThemeHydrator({ theme }) {
useEffect(() => {
applyThemeToDocument(document, theme);
}, [theme]);
return null;
function generateThemeScript(theme) {
const themeData = JSON.stringify({
colors: theme.colors,
fonts: theme.fonts,
borderRadius: theme.borderRadius
});
return `
(function() {
try {
var theme = ${themeData};
var root = document.documentElement;
// Apply colors
Object.keys(theme.colors).forEach(function(key) {
var color = theme.colors[key];
root.style.setProperty(color.variable, color.value);
});
// Apply fonts
Object.keys(theme.fonts).forEach(function(key) {
var font = theme.fonts[key];
root.style.setProperty(font.variable, '"' + font.value + '"');
});
// Apply border radius
root.style.setProperty('--radius', theme.borderRadius + 'rem');
} catch (e) {
console.error('SiteIO theme script error:', e);
}
})();
`.trim();
}

@@ -852,3 +856,9 @@ async function RewebProject({

projectCss ? /* @__PURE__ */ jsx("style", { "data-siteio-project-css": true, dangerouslySetInnerHTML: { __html: projectCss } }) : null,
/* @__PURE__ */ jsx(ThemeHydrator, { theme: data.project.theme }),
/* @__PURE__ */ jsx(
"script",
{
"data-siteio-theme-script": true,
dangerouslySetInnerHTML: { __html: generateThemeScript(data.project.theme) }
}
),
/* @__PURE__ */ jsx("div", { className, "data-siteio-theme": true, children: currentPage.blocks.map((block) => /* @__PURE__ */ jsx(

@@ -866,4 +876,4 @@ PreviewBlockRenderer,

export { Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, Label, PreviewBlockRenderer, RewebProject, Separator, ThemeHydrator, fetchProject };
export { Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, Label, PreviewBlockRenderer, RewebProject, Separator, fetchProject };
//# sourceMappingURL=index.mjs.map
//# sourceMappingURL=index.mjs.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/utils/fetchProject.ts","../src/components/Icon.tsx","../src/utils/cn.ts","../src/components/ui/button.tsx","../src/components/ui/card.tsx","../src/components/ui/badge.tsx","../src/components/ui/input.tsx","../src/components/ui/label.tsx","../src/components/ui/separator.tsx","../src/components/ui/avatar.tsx","../src/utils/blockUtils.ts","../src/utils/booleanExpressions.ts","../src/utils/propsUtils.ts","../src/components/PreviewBlockRenderer.tsx","../src/utils/theme.ts","../src/components/ThemeHydrator.tsx","../src/components/RewebProject.tsx"],"names":["React","jsx","React3","React4","React5","React6","forwardRef","component","document","Fragment"],"mappings":";;;;;;;;AAQA,eAAsB,YAAA,CAAa;AAAA,EACjC,SAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS;AACpE,CAAA,EAA8C;AAC5C,EAAA,MAAM,MAAM,IAAI,GAAA,CAAI,GAAG,MAAM,CAAA,aAAA,EAAgB,SAAS,CAAA,CAAE,CAAA;AACxD,EAAA,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,OAAA,EAAS,KAAK,CAAA;AAEnC,EAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,CAAI,UAAS,EAAG;AAAA,IAC3C,MAAA,EAAQ,KAAA;AAAA,IACR,OAAA,EAAS;AAAA,MACP,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,KAAA,EAAO;AAAA;AAAA,GACR,CAAA;AAED,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,IAAA,MAAM,KAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAK,CAAE,MAAM,OAAO,EAAE,KAAA,EAAO,eAAA,EAAgB,CAAE,CAAA;AAC5E,IAAA,MAAM,IAAI,KAAA,CAAM,K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,EAAA;AAGvC,EAAA,MAAM,SAAA,GAAY;AAAA;AAAA,uBAAA,EAEK,MAAA,CAAO,KAAK,IAAA,CAAK,OAAA,CAAQ,OAAO,MAAA,IAAU,EAAE,CAAA,CAAE,MAAM;AAAA,uBAAA,EACpD,WAAW,MAAM,CAAA;AAAA,wBAAA,EAChB,YAAY,MAAM,CAAA;AAAA,GAAA,CAAA;AAG1C,EAAA,uBACE,IAAA,CAAAQ,UAAA,EAEE,QAAA,EAAA;AAAA,oBAAAR,GAAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,0BAAA,EAAwB,IAAA;AAAA,QACxB,uBAAA,EAAyB,EAAE,MAAA,EAAQ,SAAA,GAAY,OAAO,WAAA;AAAY;AAAA,KACpE;AAAA,IACC,UAAA,mBACCA,GAAAA,CAAC,OAAA,EAAA,EAAM,yBAAA,EAAuB,IAAA,EAAC,uBAAA,EAAyB,EAAE,MAAA,EAAQ,UAAA,EAAW,EAAG,CAAA,GAC9E,IAAA;AAAA,oBAEJA,GAAAA,CAAC,aAAA,EAAA,EAAc,KAAA,EAAO,IAAA,CAAK,QAAQ,KAAA,EAAO,CAAA;AAAA,oBAC1CA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,mBAAA,EAAiB,IAAA,EACzC,QAAA,EAAA,WAAA,CAAY,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,qBACvBA,GAAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QAEC,KAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAHK,KAAA,CAAM;AAAA,KAKd,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ","file":"index.mjs","sourcesContent":["import { ProjectData } from \"../types\";\n\nexport interface FetchProjectOptions {\n projectId: string;\n token: string;\n apiUrl?: string;\n}\n\nexport async function fetchProject({\n projectId,\n token,\n apiUrl = typeof window !== \"undefined\" ? window.location.origin : \"http://localhost:3000\",\n}: FetchProjectOptions): Promise<ProjectData> {\n const url = new URL(`${apiUrl}/api/project/${projectId}`);\n url.searchParams.set(\"token\", token);\n\n const response = await fetch(url.toString(), {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n cache: \"no-store\", // Disable caching for real-time updates\n });\n\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `Failed to fetch project: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n\n\n\n","import * as LucideIcons from \"lucide-react\";\nimport { forwardRef } from \"react\";\n\ninterface IconProps {\n name: string;\n size?: number;\n className?: string;\n strokeWidth?: number;\n [key: string]: any;\n}\n\n/**\n * Dynamic icon component that renders Lucide React icons by name.\n * This allows the SDK to render any icon used in the SiteIO builder.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(\n ({ name, size = 24, className, strokeWidth, ...props }, ref) => {\n // Get the icon component from Lucide\n const IconComponent = (LucideIcons as Record<string, any>)[name];\n\n if (!IconComponent) {\n // Return empty span if icon not found to avoid breaking the layout\n console.warn(`[SiteIO SDK] Icon \"${name}\" not found in lucide-react`);\n return <span className={className} style={{ width: size, height: size }} />;\n }\n\n return (\n <IconComponent\n ref={ref}\n size={size}\n className={className}\n strokeWidth={strokeWidth}\n {...props}\n />\n );\n },\n);\n\nIcon.displayName = \"Icon\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n\n\n\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n variant?:\n | \"default\"\n | \"destructive\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\";\n size?: \"default\" | \"sm\" | \"lg\" | \"icon\";\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n },\n ref\n ) => {\n const baseStyles =\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\";\n\n const variants: Record<string, string> = {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n };\n\n const sizes: Record<string, string> = {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n };\n\n return (\n <button\n className={cn(baseStyles, variants[variant], sizes[size], className)}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n className\n )}\n {...props}\n />\n));\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n {...props}\n />\n));\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"text-2xl font-semibold leading-none tracking-tight\",\n className\n )}\n {...props}\n />\n));\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nCardDescription.displayName = \"CardDescription\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n));\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center p-6 pt-0\", className)}\n {...props}\n />\n));\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n};\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: \"default\" | \"secondary\" | \"destructive\" | \"outline\";\n}\n\nfunction Badge({ className, variant = \"default\", ...props }: BadgeProps) {\n const baseStyles =\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\";\n\n const variants: Record<string, string> = {\n default:\n \"border-transparent bg-primary text-primary-foreground hover:bg-primary/80\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n destructive:\n \"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80\",\n outline: \"text-foreground\",\n };\n\n return (\n <div className={cn(baseStyles, variants[variant], className)} {...props} />\n );\n}\n\nexport { Badge };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Input = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n});\nInput.displayName = \"Input\";\n\nexport { Input };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n));\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\ninterface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n decorative?: boolean;\n}\n\nconst Separator = React.forwardRef<HTMLDivElement, SeparatorProps>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <div\n ref={ref}\n role={decorative ? \"none\" : \"separator\"}\n aria-orientation={decorative ? undefined : orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n )\n);\nSeparator.displayName = \"Separator\";\n\nexport { Separator };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Avatar = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n className\n )}\n {...props}\n />\n));\nAvatar.displayName = \"Avatar\";\n\nconst AvatarImage = React.forwardRef<\n HTMLImageElement,\n React.ImgHTMLAttributes<HTMLImageElement>\n>(({ className, ...props }, ref) => (\n <img\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = \"AvatarImage\";\n\nconst AvatarFallback = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted\",\n className\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = \"AvatarFallback\";\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","import { Icon } from \"../components/Icon\";\nimport {\n Button,\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n Badge,\n Input,\n Label,\n Separator,\n Avatar,\n AvatarImage,\n AvatarFallback,\n} from \"../components/ui\";\nimport {\n Block,\n ElementBlock,\n DefaultComponentBlock,\n TextBlock,\n ComponentBlock,\n ComponentRegistry,\n} from \"../types\";\n\nexport function isTextBlock(block: Block): block is TextBlock {\n return block.type === \"text\";\n}\n\nexport function isElementBlock(block: Block): block is ElementBlock {\n return block.type === \"element\";\n}\n\nexport function isDefaultComponentBlock(\n block: Block\n): block is DefaultComponentBlock {\n return block.type === \"component\";\n}\n\nexport function isComponentBlock(block: Block): block is ComponentBlock {\n return block.type === \"custom-component\";\n}\n\n/**\n * Built-in SDK components that are always available.\n * These don't require the user to install any additional packages.\n * Includes all common UI components used in SiteIO projects.\n */\nexport const SDK_BUILT_IN_COMPONENTS: ComponentRegistry = {\n // Icons\n Icon,\n // Button\n Button,\n // Card\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n // Badge\n Badge,\n // Form elements\n Input,\n Label,\n // Layout\n Separator,\n // Avatar\n Avatar,\n AvatarImage,\n AvatarFallback,\n};\n\n/**\n * Default fallback tags for components when no registry is provided.\n * Maps component names to semantic HTML elements.\n * Note: These are FALLBACKS - the actual styling comes from the compiled CSS.\n */\nconst DEFAULT_COMPONENT_TAGS: Record<string, keyof JSX.IntrinsicElements> = {\n Button: \"button\",\n Link: \"a\",\n Image: \"img\",\n Input: \"input\",\n Textarea: \"textarea\",\n Label: \"label\",\n Separator: \"hr\",\n Badge: \"span\",\n Card: \"div\",\n CardContent: \"div\",\n CardHeader: \"div\",\n CardTitle: \"h3\",\n CardDescription: \"p\",\n CardFooter: \"div\",\n Avatar: \"span\",\n AvatarImage: \"img\",\n AvatarFallback: \"span\",\n Table: \"table\",\n TableHeader: \"thead\",\n TableBody: \"tbody\",\n TableFooter: \"tfoot\",\n TableRow: \"tr\",\n TableHead: \"th\",\n TableCell: \"td\",\n TableCaption: \"caption\",\n};\n\nexport function getBlockCurrentClassNames(block: Block): string[] {\n const defaultClassNames = block.classNames?.default || [];\n const addedClassNames = block.classNames?.added || [];\n const removedClassNames = block.classNames?.removed || [];\n\n // Start with the default class names\n let currentClassNames = [...defaultClassNames];\n\n // Add the added class names\n currentClassNames = currentClassNames.concat(addedClassNames);\n\n // Remove the removed class names\n currentClassNames = currentClassNames.filter(\n (className) => !removedClassNames.includes(className)\n );\n\n // Return the unique set of class names\n return Array.from(new Set(currentClassNames));\n}\n\nconst VIEWPORT_HEIGHT = 900;\n\nexport function convertVhClassesToPx(classNames: string[]): string[] {\n const viewportHeight = VIEWPORT_HEIGHT;\n\n const vhUnits = [\"vh\", \"dvh\", \"svh\", \"lvh\"];\n const screenClasses = [\"h-screen\", \"h-dvh\", \"h-svh\", \"h-lvh\"];\n\n return classNames.map((className) => {\n // Handle h-screen and similar classes\n const screenMatch = screenClasses.find((sc) => className.includes(sc));\n if (screenMatch) {\n return className.replace(screenMatch, `h-[${viewportHeight}px]`);\n }\n\n // Handle percentage-based vh units\n for (const unit of vhUnits) {\n if (className.includes(unit)) {\n const match = className.match(new RegExp(`(\\\\d+)${unit}`));\n if (match) {\n const value = parseInt(match[1], 10);\n const pxValue = (value / 100) * viewportHeight;\n return className.replace(`${value}${unit}`, `${pxValue}px`);\n }\n }\n }\n\n return className;\n });\n}\n\nexport function getBlockClassnamesToApply(\n block: Block,\n options?: {\n isPreview?: boolean;\n replaceVhClasses?: boolean;\n }\n): string[] {\n const { isPreview = false, replaceVhClasses = true } = options || {};\n let currentClassNames = getBlockCurrentClassNames(block);\n\n if (isPreview) {\n const isLink = isElementBlock(block) && block.tag === \"a\";\n\n if (isLink) {\n currentClassNames = [...currentClassNames, \"cursor-pointer\"];\n }\n }\n\n if (replaceVhClasses) {\n return convertVhClassesToPx(currentClassNames);\n }\n\n return currentClassNames;\n}\n\n/**\n * Gets the tag or component to render for a block.\n *\n * @param block - The block to get the tag for\n * @param componentRegistry - Optional registry of React components\n * @returns A React component, HTML tag name, or undefined\n */\nexport function getBlockTagName(\n block: ElementBlock | DefaultComponentBlock,\n componentRegistry?: ComponentRegistry\n): React.ComponentType<any> | keyof JSX.IntrinsicElements | undefined {\n if (isDefaultComponentBlock(block)) {\n // First, check SDK built-in components (Icon, etc.)\n if (SDK_BUILT_IN_COMPONENTS[block.component]) {\n return SDK_BUILT_IN_COMPONENTS[block.component];\n }\n\n // Then, try to get the component from the user's registry\n if (componentRegistry && componentRegistry[block.component]) {\n return componentRegistry[block.component];\n }\n\n // Fallback to semantic HTML tags for common components\n if (DEFAULT_COMPONENT_TAGS[block.component]) {\n return DEFAULT_COMPONENT_TAGS[block.component];\n }\n\n // Last resort: render as div\n return \"div\";\n }\n\n return (block.tag as keyof JSX.IntrinsicElements) ?? \"div\";\n}\n","import { BooleanExpression, ComparisonOperator, NAryLogicalOperator } from \"../types\";\n\nexport function evaluateExpression(\n expression: BooleanExpression,\n props: Record<string, any>,\n): boolean {\n if (\"type\" in expression && (expression.type === \"and\" || expression.type === \"or\" || expression.type === \"not\")) {\n return evaluateNAryLogicalOperator(expression as NAryLogicalOperator, props);\n }\n\n if (\"type\" in expression && (expression.type === \"eq\" || expression.type === \"neq\")) {\n return evaluateComparisonOperator(expression as ComparisonOperator, props);\n }\n\n return true;\n}\n\nfunction evaluateNAryLogicalOperator(\n operator: NAryLogicalOperator,\n props: Record<string, any>,\n): boolean {\n if (operator.type === \"not\") {\n if (operator.operands.length !== 1) return true;\n return !evaluateExpression(operator.operands[0], props);\n }\n\n if (operator.type === \"and\") {\n return operator.operands.every((operand) => evaluateExpression(operand, props));\n }\n\n if (operator.type === \"or\") {\n return operator.operands.some((operand) => evaluateExpression(operand, props));\n }\n\n return true;\n}\n\nfunction evaluateComparisonOperator(\n operator: ComparisonOperator,\n props: Record<string, any>,\n): boolean {\n const leftValue = getOperandValue(operator.left, props);\n const rightValue = getOperandValue(operator.right, props);\n\n if (operator.type === \"eq\") {\n return leftValue === rightValue;\n }\n\n if (operator.type === \"neq\") {\n return leftValue !== rightValue;\n }\n\n return true;\n}\n\nfunction getOperandValue(operand: { type: string; value: any }, props: Record<string, any>): any {\n if (operand.type === \"field\") {\n return props[operand.value];\n }\n\n if (operand.type === \"value\") {\n return operand.value;\n }\n\n return undefined;\n}\n\n\n\n\n","import { Block, Component, TextBlock } from \"../types\";\nimport { isComponentBlock, isDefaultComponentBlock, isElementBlock } from \"./blockUtils\";\n\nexport interface CurrentComponent {\n id: string;\n props: Record<string, any>;\n propsConfig: Record<string, any>;\n}\n\nfunction isPropValue(value: any): boolean {\n return typeof value === \"string\" && value.startsWith(\"{{\") && value.endsWith(\"}}\");\n}\n\nfunction getPropNameFromValue(value: string): string {\n return value.slice(2, -2).trim();\n}\n\nexport function getBlockText(block: TextBlock, props?: Record<string, any>): string {\n if (block.text.startsWith(\"{\") && props) {\n const propName = block.text.slice(1, -1).replace(\"props.\", \"\");\n return props?.[propName]?.toString() || block.text;\n }\n return block.text;\n}\n\nexport function htmlToText(html: string): string {\n if (typeof window === \"undefined\") return html;\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, \"text/html\");\n return doc.body.textContent || \"\";\n}\n\nexport function getBlockProps(\n block: Block,\n currentComponent: CurrentComponent | null,\n): Record<string, any> {\n const props = { ...block.props };\n if (!currentComponent) return props;\n\n for (const key in props) {\n const value = props[key];\n\n // If a prop is set to the prop of a component, substitute it with the actual value of the component prop\n if (isPropValue(value)) {\n const propName = getPropNameFromValue(value);\n const componentPropValue = currentComponent.props[propName];\n\n if (componentPropValue !== undefined) {\n props[key] = componentPropValue;\n }\n }\n }\n\n return props;\n}\n\nexport function getBlockPropsToApply(\n block: Block,\n currentComponent: CurrentComponent | null,\n options?: {\n isPreview?: boolean;\n },\n): Record<string, any> {\n const { isPreview = false } = options || {};\n\n // If it's the instance of a component, the props don't need to be applied to the component block itself,\n // rather they are handled by the component block renderer.\n const props = isComponentBlock(block) ? {} : getBlockProps(block, currentComponent);\n\n if (!isPreview) {\n // If it's a Link component, set href to \"#\" so it doesn't navigate anywhere\n if (isDefaultComponentBlock(block) && block.component === \"Link\") {\n props.href = \"#\";\n } else {\n // Otherwise, just delete href (for a normal anchor tag)\n delete props.href;\n }\n\n const isButton =\n (isDefaultComponentBlock(block) && block.component === \"Button\") ||\n (isElementBlock(block) && block.tag === \"button\");\n if (isButton) {\n props.type = \"button\";\n }\n }\n\n // Remove Next.js Image-specific props that shouldn't be passed to DOM elements\n // Note: asChild is intentionally kept as it's needed by Radix components (Button, etc.)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n ...domProps\n } = props;\n\n // Handle asChild - add data-parent-block-id for proper block identification\n const isAsChild = !!domProps?.asChild;\n if (isAsChild) {\n domProps[\"data-parent-block-id\"] = block.id;\n }\n\n return {\n ...domProps,\n \"data-block-id\": block.id,\n };\n}\n","import { forwardRef } from \"react\";\nimport { Block, Component, ComponentRegistry } from \"../types\";\nimport {\n isTextBlock,\n isComponentBlock,\n getBlockClassnamesToApply,\n getBlockTagName,\n} from \"../utils/blockUtils\";\nimport { evaluateExpression } from \"../utils/booleanExpressions\";\nimport {\n getBlockProps,\n getBlockPropsToApply,\n getBlockText,\n htmlToText,\n CurrentComponent,\n} from \"../utils/propsUtils\";\nimport { cn } from \"../utils/cn\";\n\ninterface PreviewBlockRendererProps {\n block: Block;\n components?: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[];\n currentComponent?: CurrentComponent | null;\n replaceVhClasses?: boolean;\n className?: string;\n /** Registry of UI components (Button, Card, etc.) for proper rendering */\n componentRegistry?: ComponentRegistry;\n [key: string]: any;\n}\n\nexport const PreviewChildrenRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n ({ block, ...restProps }, ref) => {\n if (!block.children) return null;\n\n if (block.children.length === 1) {\n return <PreviewBlockRenderer block={block.children[0]} ref={ref} {...restProps} />;\n }\n\n return (\n <>\n {block.children.map((child: Block) => (\n <PreviewBlockRenderer key={child.id} block={child} {...restProps} />\n ))}\n </>\n );\n },\n);\n\nPreviewChildrenRenderer.displayName = \"ChildrenRenderer\";\n\n/**\n * Strip props that are not valid DOM attributes.\n * This includes React-specific props, Next.js Image props, and Framer Motion animation props.\n */\nconst stripNonDomProps = (p: Record<string, any>) => {\n const {\n // React/Radix props\n asChild,\n // Next.js Image props\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n // Framer Motion animation props\n whileHover,\n whileTap,\n whileFocus,\n whileDrag,\n whileInView,\n animate,\n initial,\n exit,\n transition,\n variants,\n layout,\n layoutId,\n drag,\n dragConstraints,\n dragElastic,\n dragMomentum,\n dragTransition,\n dragPropagation,\n dragControls,\n dragListener,\n dragSnapToOrigin,\n onDrag,\n onDragStart,\n onDragEnd,\n onDirectionLock,\n onDragTransitionEnd,\n onAnimationStart,\n onAnimationComplete,\n onUpdate,\n onPan,\n onPanStart,\n onPanEnd,\n onTap,\n onTapStart,\n onTapCancel,\n onHoverStart,\n onHoverEnd,\n onViewportEnter,\n onViewportLeave,\n viewport,\n custom,\n inherit,\n // Other non-DOM props that might leak through\n motionValue,\n transformTemplate,\n ...clean\n } = p ?? {};\n return clean;\n};\n\nexport const PreviewBlockRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n (\n {\n block,\n components = [],\n currentComponent,\n replaceVhClasses = false,\n componentRegistry,\n ...rest\n },\n ref,\n ) => {\n const classNamesToApply = getBlockClassnamesToApply(block, {\n isPreview: false, // SSR mode - no preview features\n replaceVhClasses,\n });\n const className = cn(\n // If is text block, don't apply the className from the parent (with asChild), since text blocks normally can't have props at all since they're just text nodes.\n classNamesToApply,\n isTextBlock(block) ? undefined : rest?.className,\n );\n const blockProps = getBlockPropsToApply(block, currentComponent ?? null, {\n isPreview: false, // SSR mode - no preview/client-side features\n });\n\n if (block.renderCondition) {\n const shouldRender = evaluateExpression(block.renderCondition, currentComponent?.props ?? {});\n if (!shouldRender) return null;\n }\n\n if (isTextBlock(block)) {\n return <>{htmlToText(getBlockText(block, currentComponent?.props))}</>;\n }\n\n if (isComponentBlock(block)) {\n const component = components.find(\n (component: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">) =>\n component.id === block.componentId,\n );\n if (!component) return null;\n\n // For nested components, the props could be set to a prop of the outer component\n const currentComponentProps = getBlockProps(block, currentComponent ?? null);\n const innerCurrentComponent: CurrentComponent = {\n id: component.id,\n props: currentComponentProps,\n propsConfig: component.propsConfig,\n };\n\n return (\n <PreviewBlockRenderer\n block={component.blocks[0]}\n components={components}\n currentComponent={innerCurrentComponent}\n componentRegistry={componentRegistry}\n className={className}\n />\n );\n }\n\n const Tag = getBlockTagName(block, componentRegistry);\n if (!Tag) return null;\n\n const mergedProps: Record<string, any> = {\n // ...rest shouldn't be passed to text blocks because they normally can't have props at all since they're just text nodes.\n ...(isTextBlock(block) ? {} : rest),\n className,\n // blockProps Needs to be after ...rest to override the props passed from a parent component (e.g. data-block-id). (for child of asChild component)\n ...blockProps,\n ref,\n };\n\n // In SSR mode, links work normally - no client-side navigation needed\n // Remove onClick handlers that would require client-side code\n\n // Only strip non-DOM props when Tag is a real DOM element (string), not a React component\n const finalProps = typeof Tag === \"string\" ? stripNonDomProps(mergedProps) : mergedProps;\n\n if (!block.children?.length) {\n return <Tag {...finalProps} />;\n }\n\n return (\n <Tag {...finalProps}>\n <PreviewChildrenRenderer\n block={block}\n components={components}\n currentComponent={currentComponent}\n componentRegistry={componentRegistry}\n />\n </Tag>\n );\n },\n);\n\nPreviewBlockRenderer.displayName = \"BlockRenderer\";\n","import { Theme, ThemeItem } from \"../types\";\n\nexport function applyFontsToDocument(document: Document, fonts: ThemeItem[]) {\n const root = document.documentElement;\n const head = document.head;\n\n // Simple implementation - in production you'd want to handle Google Fonts and local fonts\n fonts.forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n root.style.setProperty(font.variable, fontFamily);\n });\n}\n\nexport function applyColorToDocument(document: Document, color: ThemeItem) {\n document.documentElement.style.setProperty(color.variable, color.value);\n}\n\nexport function applyBorderRadiusToDocument(\n document: Document,\n borderRadius: number\n) {\n document.documentElement.style.setProperty(\"--radius\", `${borderRadius}rem`);\n}\n\nexport function applyThemeToDocument(document: Document, theme: Theme) {\n applyFontsToDocument(document, Object.values(theme.fonts));\n applyBorderRadiusToDocument(document, theme.borderRadius);\n Object.values(theme.colors).forEach((color) =>\n applyColorToDocument(document, color)\n );\n}\n\n/**\n * Generate CSS styles for theme that can be injected into a style tag for SSR.\n * This is a pure function that works on the server.\n * Uses scoped selectors to ensure SiteIO theme variables take precedence over project theme.\n */\nexport function applyThemeToStyleTag(theme: Theme): string {\n const styles: string[] = [];\n\n // Apply fonts\n Object.values(theme.fonts).forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n styles.push(` ${font.variable}: ${fontFamily} !important;`);\n });\n\n // Apply border radius\n styles.push(` --radius: ${theme.borderRadius}rem !important;`);\n\n // Apply colors - SiteIO uses HSL format (e.g., \"250 93% 66%\")\n Object.values(theme.colors).forEach((color) => {\n styles.push(` ${color.variable}: ${color.value} !important;`);\n });\n\n // Use high specificity selectors to ensure SiteIO theme variables override consuming app\n // The [data-siteio-theme] attribute is added to the SDK wrapper element\n const scopedStyles = styles.map((s) => s.replace(\" !important\", \"\"));\n\n return `\n/* SiteIO Base Styles - Required for proper rendering */\n:root {\n /* Default fallback values - will be overridden by theme */\n --background: 0 0% 5%;\n --foreground: 0 0% 98%;\n --card: 0 0% 17%;\n --card-foreground: 0 0% 98%;\n --popover: 0 0% 17%;\n --popover-foreground: 0 0% 98%;\n --primary: 217 91% 60%;\n --primary-foreground: 210 40% 98%;\n --secondary: 0 0% 17%;\n --secondary-foreground: 0 0% 98%;\n --muted: 0 0% 14.9%;\n --muted-foreground: 0 0% 63.9%;\n --accent: 0 0% 33%;\n --accent-foreground: 0 0% 98%;\n --destructive: 345 87% 53%;\n --destructive-foreground: 0 0% 98%;\n --border: 0 0% 15%;\n --input: 0 0% 14.9%;\n --ring: 0 0% 83.1%;\n --radius: 0.75rem;\n}\n\n/* SiteIO Theme Variables - Override with project theme */\n:root {\n${styles.join(\"\\n\")}\n}\n\n/* SiteIO Theme Variables - Scoped to SDK component */\n[data-siteio-theme] {\n${styles.join(\"\\n\")}\n}\n\n/* Ensure child elements also have access to variables */\n[data-siteio-theme] * {\n${scopedStyles.join(\"\\n\")}\n}\n\n/* SiteIO Base Element Styles */\n[data-siteio-theme] {\n background-color: hsl(var(--background));\n color: hsl(var(--foreground));\n}\n\n/* Utility class mappings for Tailwind CDN compatibility */\n.bg-background { background-color: hsl(var(--background)) !important; }\n.bg-foreground { background-color: hsl(var(--foreground)) !important; }\n.bg-card { background-color: hsl(var(--card)) !important; }\n.bg-popover { background-color: hsl(var(--popover)) !important; }\n.bg-primary { background-color: hsl(var(--primary)) !important; }\n.bg-secondary { background-color: hsl(var(--secondary)) !important; }\n.bg-muted { background-color: hsl(var(--muted)) !important; }\n.bg-accent { background-color: hsl(var(--accent)) !important; }\n.bg-destructive { background-color: hsl(var(--destructive)) !important; }\n\n.text-foreground { color: hsl(var(--foreground)) !important; }\n.text-background { color: hsl(var(--background)) !important; }\n.text-card-foreground { color: hsl(var(--card-foreground)) !important; }\n.text-popover-foreground { color: hsl(var(--popover-foreground)) !important; }\n.text-primary { color: hsl(var(--primary)) !important; }\n.text-primary-foreground { color: hsl(var(--primary-foreground)) !important; }\n.text-secondary-foreground { color: hsl(var(--secondary-foreground)) !important; }\n.text-muted-foreground { color: hsl(var(--muted-foreground)) !important; }\n.text-accent-foreground { color: hsl(var(--accent-foreground)) !important; }\n.text-destructive { color: hsl(var(--destructive)) !important; }\n.text-destructive-foreground { color: hsl(var(--destructive-foreground)) !important; }\n\n.border-border { border-color: hsl(var(--border)) !important; }\n.border-input { border-color: hsl(var(--input)) !important; }\n.ring-ring { --tw-ring-color: hsl(var(--ring)) !important; }\n.ring-offset-background { --tw-ring-offset-color: hsl(var(--background)) !important; }\n\n.rounded-lg { border-radius: var(--radius) !important; }\n.rounded-md { border-radius: calc(var(--radius) - 2px) !important; }\n.rounded-sm { border-radius: calc(var(--radius) - 4px) !important; }\n\n/* Hover states with opacity */\n.hover\\\\:bg-primary\\\\/90:hover { background-color: hsl(var(--primary) / 0.9) !important; }\n.hover\\\\:bg-primary\\\\/80:hover { background-color: hsl(var(--primary) / 0.8) !important; }\n.hover\\\\:bg-secondary\\\\/80:hover { background-color: hsl(var(--secondary) / 0.8) !important; }\n.hover\\\\:bg-destructive\\\\/90:hover { background-color: hsl(var(--destructive) / 0.9) !important; }\n.hover\\\\:bg-accent:hover { background-color: hsl(var(--accent)) !important; }\n.hover\\\\:text-accent-foreground:hover { color: hsl(var(--accent-foreground)) !important; }\n\n/* Focus visible states */\n.focus-visible\\\\:outline-none:focus-visible { outline: 2px solid transparent; outline-offset: 2px; }\n.focus-visible\\\\:ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\\\:ring-ring:focus-visible { --tw-ring-color: hsl(var(--ring)); }\n.focus-visible\\\\:ring-offset-2:focus-visible { --tw-ring-offset-width: 2px; }\n\n/* Disabled states */\n.disabled\\\\:opacity-50:disabled { opacity: 0.5; }\n.disabled\\\\:pointer-events-none:disabled { pointer-events: none; }\n\n/* Card styles */\n.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }\n\n/* Input & Form elements */\ninput, textarea, select {\n background-color: transparent;\n border-color: hsl(var(--input));\n}\n\n/* Separator */\nhr, [role=\"separator\"] {\n border-color: hsl(var(--border));\n background-color: hsl(var(--border));\n}\n\n/* Button transitions */\nbutton, [role=\"button\"], a {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n/* Border default */\n.border { border-width: 1px; border-color: hsl(var(--border)); }\n`.trim();\n}\n","\"use client\";\n\nimport { useEffect } from \"react\";\nimport { Theme } from \"../types\";\nimport { applyThemeToDocument } from \"../utils/theme\";\n\ninterface ThemeHydratorProps {\n theme: Theme;\n}\n\n/**\n * Client component that applies theme CSS variables as inline styles\n * on the <html> element after hydration.\n * \n * This matches the builder's behavior where theme variables are set\n * directly on document.documentElement.style.\n */\nexport function ThemeHydrator({ theme }: ThemeHydratorProps) {\n useEffect(() => {\n applyThemeToDocument(document, theme);\n }, [theme]);\n\n return null; // This component only has side effects\n}\n","import { fetchProject } from \"../utils/fetchProject\";\nimport { PreviewBlockRenderer } from \"./PreviewBlockRenderer\";\nimport { ThemeHydrator } from \"./ThemeHydrator\";\nimport { RewebProjectProps, Component, ProjectData } from \"../types\";\nimport { applyThemeToStyleTag } from \"../utils/theme\";\n\n/**\n * Pure SSR server component that fetches and renders project data on the server.\n * No client-side JavaScript required - works entirely in SSR mode.\n */\nexport async function RewebProject({\n projectId,\n token,\n initialPageId,\n config,\n className,\n componentRegistry,\n}: RewebProjectProps) {\n // Fetch data on the server\n let data: ProjectData;\n let error: Error | null = null;\n\n try {\n data = await fetchProject({\n projectId,\n token,\n apiUrl: config?.apiUrl,\n });\n } catch (err) {\n error = err instanceof Error ? err : new Error(\"Failed to fetch project\");\n // Return error UI - this will be rendered on server\n return (\n <div className={className}>\n <div>Error: {error.message}</div>\n </div>\n );\n }\n\n // Determine which page to render\n let currentPageId = initialPageId;\n if (!currentPageId) {\n // Find home page (url === \"/\")\n const homePage = data.pages.find((page) => page.url === \"/\");\n if (homePage) {\n currentPageId = homePage.public_id;\n } else if (data.pages.length > 0) {\n currentPageId = data.pages[0].public_id;\n }\n }\n\n const currentPage = data.pages.find((page) => page.public_id === currentPageId);\n if (!currentPage) {\n return (\n <div className={className}>\n <div>Page not found</div>\n </div>\n );\n }\n\n // Prepare components data\n const components: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[] = data.components.map(\n (component) => ({\n id: component.public_id,\n blocks: component.blocks,\n propsConfig: component.props_config,\n }),\n );\n\n // Generate theme styles for SSR\n const themeStyles = applyThemeToStyleTag(data.project.theme);\n const projectCss = data.styles?.css ?? \"\";\n\n // Debug info (visible in page source)\n const debugInfo = `\n/* SiteIO SDK Debug Info:\n * Theme colors count: ${Object.keys(data.project.theme?.colors || {}).length}\n * Project CSS length: ${projectCss.length} chars\n * Theme styles length: ${themeStyles.length} chars\n */`;\n\n return (\n <>\n {/* Inject theme styles for SSR - scoped to SiteIO component */}\n <style\n data-siteio-theme-styles\n dangerouslySetInnerHTML={{ __html: debugInfo + \"\\n\" + themeStyles }}\n />\n {projectCss ? (\n <style data-siteio-project-css dangerouslySetInnerHTML={{ __html: projectCss }} />\n ) : null}\n {/* Client: Apply inline styles to <html> after hydration */}\n <ThemeHydrator theme={data.project.theme} />\n <div className={className} data-siteio-theme>\n {currentPage.blocks.map((block) => (\n <PreviewBlockRenderer\n key={block.id}\n block={block}\n components={components}\n componentRegistry={componentRegistry}\n />\n ))}\n </div>\n </>\n );\n}\n"]}
{"version":3,"sources":["../src/utils/fetchProject.ts","../src/components/Icon.tsx","../src/utils/cn.ts","../src/components/ui/button.tsx","../src/components/ui/card.tsx","../src/components/ui/badge.tsx","../src/components/ui/input.tsx","../src/components/ui/label.tsx","../src/components/ui/separator.tsx","../src/components/ui/avatar.tsx","../src/utils/blockUtils.ts","../src/utils/booleanExpressions.ts","../src/utils/propsUtils.ts","../src/components/PreviewBlockRenderer.tsx","../src/utils/theme.ts","../src/components/RewebProject.tsx"],"names":["React","jsx","React3","React4","React5","React6","forwardRef","component","Fragment"],"mappings":";;;;;;;;AAQA,eAAsB,YAAA,CAAa;AAAA,EACjC,SAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS;AACpE,CAAA,EAA8C;AAC5C,EAAA,MAAM,MAAM,IAAI,GAAA,CAAI,GAAG,MAAM,CAAA,aAAA,EAAgB,SAAS,CAAA,CAAE,CAAA;AACxD,EAAA,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,OAAA,EAAS,KAAK,CAAA;AAEnC,EAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,CAAI,UAAS,EAAG;AAAA,IAC3C,MAAA,EAAQ,KAAA;AAAA,IACR,OAAA,EAAS;AAAA,MACP,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,KAAA,EAAO;AAAA;AAAA,GACR,CAAA;AAED,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,IAAA,MAAM,KAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAK,CAAE,MAAM,OAAO,EAAE,KAAA,EAAO,eAAA,EAAgB,CAAE,CAAA;AAC5E,IAAA,MAAM,IAAI,KAAA,CAAM,KAAA,CAAM,SAAS,CAAA,yBAAA,EAA4B,QA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AA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,mBAAA,EAAiB,IAAA,EACzC,QAAA,EAAA,WAAA,CAAY,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,qBACvBA,GAAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QAEC,KAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAHK,KAAA,CAAM;AAAA,KAKd,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ","file":"index.mjs","sourcesContent":["import { ProjectData } from \"../types\";\n\nexport interface FetchProjectOptions {\n projectId: string;\n token: string;\n apiUrl?: string;\n}\n\nexport async function fetchProject({\n projectId,\n token,\n apiUrl = typeof window !== \"undefined\" ? window.location.origin : \"http://localhost:3000\",\n}: FetchProjectOptions): Promise<ProjectData> {\n const url = new URL(`${apiUrl}/api/project/${projectId}`);\n url.searchParams.set(\"token\", token);\n\n const response = await fetch(url.toString(), {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n cache: \"no-store\", // Disable caching for real-time updates\n });\n\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `Failed to fetch project: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n\n\n\n","import * as LucideIcons from \"lucide-react\";\nimport { forwardRef } from \"react\";\n\ninterface IconProps {\n name: string;\n size?: number;\n className?: string;\n strokeWidth?: number;\n [key: string]: any;\n}\n\n/**\n * Dynamic icon component that renders Lucide React icons by name.\n * This allows the SDK to render any icon used in the SiteIO builder.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(\n ({ name, size = 24, className, strokeWidth, ...props }, ref) => {\n // Get the icon component from Lucide\n const IconComponent = (LucideIcons as Record<string, any>)[name];\n\n if (!IconComponent) {\n // Return empty span if icon not found to avoid breaking the layout\n console.warn(`[SiteIO SDK] Icon \"${name}\" not found in lucide-react`);\n return <span className={className} style={{ width: size, height: size }} />;\n }\n\n return (\n <IconComponent\n ref={ref}\n size={size}\n className={className}\n strokeWidth={strokeWidth}\n {...props}\n />\n );\n },\n);\n\nIcon.displayName = \"Icon\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n\n\n\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n variant?:\n | \"default\"\n | \"destructive\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\";\n size?: \"default\" | \"sm\" | \"lg\" | \"icon\";\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n },\n ref\n ) => {\n const baseStyles =\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\";\n\n const variants: Record<string, string> = {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n };\n\n const sizes: Record<string, string> = {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n };\n\n return (\n <button\n className={cn(baseStyles, variants[variant], sizes[size], className)}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n className\n )}\n {...props}\n />\n));\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n {...props}\n />\n));\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"text-2xl font-semibold leading-none tracking-tight\",\n className\n )}\n {...props}\n />\n));\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nCardDescription.displayName = \"CardDescription\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n));\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center p-6 pt-0\", className)}\n {...props}\n />\n));\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n};\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: \"default\" | \"secondary\" | \"destructive\" | \"outline\";\n}\n\nfunction Badge({ className, variant = \"default\", ...props }: BadgeProps) {\n const baseStyles =\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\";\n\n const variants: Record<string, string> = {\n default:\n \"border-transparent bg-primary text-primary-foreground hover:bg-primary/80\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n destructive:\n \"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80\",\n outline: \"text-foreground\",\n };\n\n return (\n <div className={cn(baseStyles, variants[variant], className)} {...props} />\n );\n}\n\nexport { Badge };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Input = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n});\nInput.displayName = \"Input\";\n\nexport { Input };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n));\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\ninterface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n decorative?: boolean;\n}\n\nconst Separator = React.forwardRef<HTMLDivElement, SeparatorProps>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <div\n ref={ref}\n role={decorative ? \"none\" : \"separator\"}\n aria-orientation={decorative ? undefined : orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n )\n);\nSeparator.displayName = \"Separator\";\n\nexport { Separator };\n","import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nconst Avatar = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n className\n )}\n {...props}\n />\n));\nAvatar.displayName = \"Avatar\";\n\nconst AvatarImage = React.forwardRef<\n HTMLImageElement,\n React.ImgHTMLAttributes<HTMLImageElement>\n>(({ className, ...props }, ref) => (\n <img\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = \"AvatarImage\";\n\nconst AvatarFallback = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted\",\n className\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = \"AvatarFallback\";\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","import { Icon } from \"../components/Icon\";\nimport {\n Button,\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n Badge,\n Input,\n Label,\n Separator,\n Avatar,\n AvatarImage,\n AvatarFallback,\n} from \"../components/ui\";\nimport {\n Block,\n ElementBlock,\n DefaultComponentBlock,\n TextBlock,\n ComponentBlock,\n ComponentRegistry,\n} from \"../types\";\n\nexport function isTextBlock(block: Block): block is TextBlock {\n return block.type === \"text\";\n}\n\nexport function isElementBlock(block: Block): block is ElementBlock {\n return block.type === \"element\";\n}\n\nexport function isDefaultComponentBlock(\n block: Block\n): block is DefaultComponentBlock {\n return block.type === \"component\";\n}\n\nexport function isComponentBlock(block: Block): block is ComponentBlock {\n return block.type === \"custom-component\";\n}\n\n/**\n * Built-in SDK components that are always available.\n * These don't require the user to install any additional packages.\n * Includes all common UI components used in SiteIO projects.\n */\nexport const SDK_BUILT_IN_COMPONENTS: ComponentRegistry = {\n // Icons\n Icon,\n // Button\n Button,\n // Card\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n // Badge\n Badge,\n // Form elements\n Input,\n Label,\n // Layout\n Separator,\n // Avatar\n Avatar,\n AvatarImage,\n AvatarFallback,\n};\n\n/**\n * Default fallback tags for components when no registry is provided.\n * Maps component names to semantic HTML elements.\n * Note: These are FALLBACKS - the actual styling comes from the compiled CSS.\n */\nconst DEFAULT_COMPONENT_TAGS: Record<string, keyof JSX.IntrinsicElements> = {\n Button: \"button\",\n Link: \"a\",\n Image: \"img\",\n Input: \"input\",\n Textarea: \"textarea\",\n Label: \"label\",\n Separator: \"hr\",\n Badge: \"span\",\n Card: \"div\",\n CardContent: \"div\",\n CardHeader: \"div\",\n CardTitle: \"h3\",\n CardDescription: \"p\",\n CardFooter: \"div\",\n Avatar: \"span\",\n AvatarImage: \"img\",\n AvatarFallback: \"span\",\n Table: \"table\",\n TableHeader: \"thead\",\n TableBody: \"tbody\",\n TableFooter: \"tfoot\",\n TableRow: \"tr\",\n TableHead: \"th\",\n TableCell: \"td\",\n TableCaption: \"caption\",\n};\n\nexport function getBlockCurrentClassNames(block: Block): string[] {\n const defaultClassNames = block.classNames?.default || [];\n const addedClassNames = block.classNames?.added || [];\n const removedClassNames = block.classNames?.removed || [];\n\n // Start with the default class names\n let currentClassNames = [...defaultClassNames];\n\n // Add the added class names\n currentClassNames = currentClassNames.concat(addedClassNames);\n\n // Remove the removed class names\n currentClassNames = currentClassNames.filter(\n (className) => !removedClassNames.includes(className)\n );\n\n // Return the unique set of class names\n return Array.from(new Set(currentClassNames));\n}\n\nconst VIEWPORT_HEIGHT = 900;\n\nexport function convertVhClassesToPx(classNames: string[]): string[] {\n const viewportHeight = VIEWPORT_HEIGHT;\n\n const vhUnits = [\"vh\", \"dvh\", \"svh\", \"lvh\"];\n const screenClasses = [\"h-screen\", \"h-dvh\", \"h-svh\", \"h-lvh\"];\n\n return classNames.map((className) => {\n // Handle h-screen and similar classes\n const screenMatch = screenClasses.find((sc) => className.includes(sc));\n if (screenMatch) {\n return className.replace(screenMatch, `h-[${viewportHeight}px]`);\n }\n\n // Handle percentage-based vh units\n for (const unit of vhUnits) {\n if (className.includes(unit)) {\n const match = className.match(new RegExp(`(\\\\d+)${unit}`));\n if (match) {\n const value = parseInt(match[1], 10);\n const pxValue = (value / 100) * viewportHeight;\n return className.replace(`${value}${unit}`, `${pxValue}px`);\n }\n }\n }\n\n return className;\n });\n}\n\nexport function getBlockClassnamesToApply(\n block: Block,\n options?: {\n isPreview?: boolean;\n replaceVhClasses?: boolean;\n }\n): string[] {\n const { isPreview = false, replaceVhClasses = true } = options || {};\n let currentClassNames = getBlockCurrentClassNames(block);\n\n if (isPreview) {\n const isLink = isElementBlock(block) && block.tag === \"a\";\n\n if (isLink) {\n currentClassNames = [...currentClassNames, \"cursor-pointer\"];\n }\n }\n\n if (replaceVhClasses) {\n return convertVhClassesToPx(currentClassNames);\n }\n\n return currentClassNames;\n}\n\n/**\n * Gets the tag or component to render for a block.\n *\n * @param block - The block to get the tag for\n * @param componentRegistry - Optional registry of React components\n * @returns A React component, HTML tag name, or undefined\n */\nexport function getBlockTagName(\n block: ElementBlock | DefaultComponentBlock,\n componentRegistry?: ComponentRegistry\n): React.ComponentType<any> | keyof JSX.IntrinsicElements | undefined {\n if (isDefaultComponentBlock(block)) {\n // First, check SDK built-in components (Icon, etc.)\n if (SDK_BUILT_IN_COMPONENTS[block.component]) {\n return SDK_BUILT_IN_COMPONENTS[block.component];\n }\n\n // Then, try to get the component from the user's registry\n if (componentRegistry && componentRegistry[block.component]) {\n return componentRegistry[block.component];\n }\n\n // Fallback to semantic HTML tags for common components\n if (DEFAULT_COMPONENT_TAGS[block.component]) {\n return DEFAULT_COMPONENT_TAGS[block.component];\n }\n\n // Last resort: render as div\n return \"div\";\n }\n\n return (block.tag as keyof JSX.IntrinsicElements) ?? \"div\";\n}\n","import { BooleanExpression, ComparisonOperator, NAryLogicalOperator } from \"../types\";\n\nexport function evaluateExpression(\n expression: BooleanExpression,\n props: Record<string, any>,\n): boolean {\n if (\"type\" in expression && (expression.type === \"and\" || expression.type === \"or\" || expression.type === \"not\")) {\n return evaluateNAryLogicalOperator(expression as NAryLogicalOperator, props);\n }\n\n if (\"type\" in expression && (expression.type === \"eq\" || expression.type === \"neq\")) {\n return evaluateComparisonOperator(expression as ComparisonOperator, props);\n }\n\n return true;\n}\n\nfunction evaluateNAryLogicalOperator(\n operator: NAryLogicalOperator,\n props: Record<string, any>,\n): boolean {\n if (operator.type === \"not\") {\n if (operator.operands.length !== 1) return true;\n return !evaluateExpression(operator.operands[0], props);\n }\n\n if (operator.type === \"and\") {\n return operator.operands.every((operand) => evaluateExpression(operand, props));\n }\n\n if (operator.type === \"or\") {\n return operator.operands.some((operand) => evaluateExpression(operand, props));\n }\n\n return true;\n}\n\nfunction evaluateComparisonOperator(\n operator: ComparisonOperator,\n props: Record<string, any>,\n): boolean {\n const leftValue = getOperandValue(operator.left, props);\n const rightValue = getOperandValue(operator.right, props);\n\n if (operator.type === \"eq\") {\n return leftValue === rightValue;\n }\n\n if (operator.type === \"neq\") {\n return leftValue !== rightValue;\n }\n\n return true;\n}\n\nfunction getOperandValue(operand: { type: string; value: any }, props: Record<string, any>): any {\n if (operand.type === \"field\") {\n return props[operand.value];\n }\n\n if (operand.type === \"value\") {\n return operand.value;\n }\n\n return undefined;\n}\n\n\n\n\n","import { Block, Component, TextBlock } from \"../types\";\nimport { isComponentBlock, isDefaultComponentBlock, isElementBlock } from \"./blockUtils\";\n\nexport interface CurrentComponent {\n id: string;\n props: Record<string, any>;\n propsConfig: Record<string, any>;\n}\n\nfunction isPropValue(value: any): boolean {\n return typeof value === \"string\" && value.startsWith(\"{{\") && value.endsWith(\"}}\");\n}\n\nfunction getPropNameFromValue(value: string): string {\n return value.slice(2, -2).trim();\n}\n\nexport function getBlockText(block: TextBlock, props?: Record<string, any>): string {\n if (block.text.startsWith(\"{\") && props) {\n const propName = block.text.slice(1, -1).replace(\"props.\", \"\");\n return props?.[propName]?.toString() || block.text;\n }\n return block.text;\n}\n\nexport function htmlToText(html: string): string {\n if (typeof window === \"undefined\") return html;\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, \"text/html\");\n return doc.body.textContent || \"\";\n}\n\nexport function getBlockProps(\n block: Block,\n currentComponent: CurrentComponent | null,\n): Record<string, any> {\n const props = { ...block.props };\n if (!currentComponent) return props;\n\n for (const key in props) {\n const value = props[key];\n\n // If a prop is set to the prop of a component, substitute it with the actual value of the component prop\n if (isPropValue(value)) {\n const propName = getPropNameFromValue(value);\n const componentPropValue = currentComponent.props[propName];\n\n if (componentPropValue !== undefined) {\n props[key] = componentPropValue;\n }\n }\n }\n\n return props;\n}\n\nexport function getBlockPropsToApply(\n block: Block,\n currentComponent: CurrentComponent | null,\n options?: {\n isPreview?: boolean;\n },\n): Record<string, any> {\n const { isPreview = false } = options || {};\n\n // If it's the instance of a component, the props don't need to be applied to the component block itself,\n // rather they are handled by the component block renderer.\n const props = isComponentBlock(block) ? {} : getBlockProps(block, currentComponent);\n\n if (!isPreview) {\n // If it's a Link component, set href to \"#\" so it doesn't navigate anywhere\n if (isDefaultComponentBlock(block) && block.component === \"Link\") {\n props.href = \"#\";\n } else {\n // Otherwise, just delete href (for a normal anchor tag)\n delete props.href;\n }\n\n const isButton =\n (isDefaultComponentBlock(block) && block.component === \"Button\") ||\n (isElementBlock(block) && block.tag === \"button\");\n if (isButton) {\n props.type = \"button\";\n }\n }\n\n // Remove Next.js Image-specific props that shouldn't be passed to DOM elements\n // Note: asChild is intentionally kept as it's needed by Radix components (Button, etc.)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n ...domProps\n } = props;\n\n // Handle asChild - add data-parent-block-id for proper block identification\n const isAsChild = !!domProps?.asChild;\n if (isAsChild) {\n domProps[\"data-parent-block-id\"] = block.id;\n }\n\n return {\n ...domProps,\n \"data-block-id\": block.id,\n };\n}\n","import { forwardRef } from \"react\";\nimport { Block, Component, ComponentRegistry } from \"../types\";\nimport {\n isTextBlock,\n isComponentBlock,\n getBlockClassnamesToApply,\n getBlockTagName,\n} from \"../utils/blockUtils\";\nimport { evaluateExpression } from \"../utils/booleanExpressions\";\nimport {\n getBlockProps,\n getBlockPropsToApply,\n getBlockText,\n htmlToText,\n CurrentComponent,\n} from \"../utils/propsUtils\";\nimport { cn } from \"../utils/cn\";\n\ninterface PreviewBlockRendererProps {\n block: Block;\n components?: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[];\n currentComponent?: CurrentComponent | null;\n replaceVhClasses?: boolean;\n className?: string;\n /** Registry of UI components (Button, Card, etc.) for proper rendering */\n componentRegistry?: ComponentRegistry;\n [key: string]: any;\n}\n\nexport const PreviewChildrenRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n ({ block, ...restProps }, ref) => {\n if (!block.children) return null;\n\n if (block.children.length === 1) {\n return <PreviewBlockRenderer block={block.children[0]} ref={ref} {...restProps} />;\n }\n\n return (\n <>\n {block.children.map((child: Block) => (\n <PreviewBlockRenderer key={child.id} block={child} {...restProps} />\n ))}\n </>\n );\n },\n);\n\nPreviewChildrenRenderer.displayName = \"ChildrenRenderer\";\n\n/**\n * Strip props that are not valid DOM attributes.\n * This includes React-specific props, Next.js Image props, and Framer Motion animation props.\n */\nconst stripNonDomProps = (p: Record<string, any>) => {\n const {\n // React/Radix props\n asChild,\n // Next.js Image props\n blurDataURL,\n fill,\n placeholder,\n priority,\n quality,\n sizes,\n unoptimized,\n loader,\n srcSet,\n // Framer Motion animation props\n whileHover,\n whileTap,\n whileFocus,\n whileDrag,\n whileInView,\n animate,\n initial,\n exit,\n transition,\n variants,\n layout,\n layoutId,\n drag,\n dragConstraints,\n dragElastic,\n dragMomentum,\n dragTransition,\n dragPropagation,\n dragControls,\n dragListener,\n dragSnapToOrigin,\n onDrag,\n onDragStart,\n onDragEnd,\n onDirectionLock,\n onDragTransitionEnd,\n onAnimationStart,\n onAnimationComplete,\n onUpdate,\n onPan,\n onPanStart,\n onPanEnd,\n onTap,\n onTapStart,\n onTapCancel,\n onHoverStart,\n onHoverEnd,\n onViewportEnter,\n onViewportLeave,\n viewport,\n custom,\n inherit,\n // Other non-DOM props that might leak through\n motionValue,\n transformTemplate,\n ...clean\n } = p ?? {};\n return clean;\n};\n\nexport const PreviewBlockRenderer = forwardRef<HTMLElement, PreviewBlockRendererProps>(\n (\n {\n block,\n components = [],\n currentComponent,\n replaceVhClasses = false,\n componentRegistry,\n ...rest\n },\n ref,\n ) => {\n const classNamesToApply = getBlockClassnamesToApply(block, {\n isPreview: false, // SSR mode - no preview features\n replaceVhClasses,\n });\n const className = cn(\n // If is text block, don't apply the className from the parent (with asChild), since text blocks normally can't have props at all since they're just text nodes.\n classNamesToApply,\n isTextBlock(block) ? undefined : rest?.className,\n );\n const blockProps = getBlockPropsToApply(block, currentComponent ?? null, {\n isPreview: false, // SSR mode - no preview/client-side features\n });\n\n if (block.renderCondition) {\n const shouldRender = evaluateExpression(block.renderCondition, currentComponent?.props ?? {});\n if (!shouldRender) return null;\n }\n\n if (isTextBlock(block)) {\n return <>{htmlToText(getBlockText(block, currentComponent?.props))}</>;\n }\n\n if (isComponentBlock(block)) {\n const component = components.find(\n (component: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">) =>\n component.id === block.componentId,\n );\n if (!component) return null;\n\n // For nested components, the props could be set to a prop of the outer component\n const currentComponentProps = getBlockProps(block, currentComponent ?? null);\n const innerCurrentComponent: CurrentComponent = {\n id: component.id,\n props: currentComponentProps,\n propsConfig: component.propsConfig,\n };\n\n return (\n <PreviewBlockRenderer\n block={component.blocks[0]}\n components={components}\n currentComponent={innerCurrentComponent}\n componentRegistry={componentRegistry}\n className={className}\n />\n );\n }\n\n const Tag = getBlockTagName(block, componentRegistry);\n if (!Tag) return null;\n\n const mergedProps: Record<string, any> = {\n // ...rest shouldn't be passed to text blocks because they normally can't have props at all since they're just text nodes.\n ...(isTextBlock(block) ? {} : rest),\n className,\n // blockProps Needs to be after ...rest to override the props passed from a parent component (e.g. data-block-id). (for child of asChild component)\n ...blockProps,\n ref,\n };\n\n // In SSR mode, links work normally - no client-side navigation needed\n // Remove onClick handlers that would require client-side code\n\n // Only strip non-DOM props when Tag is a real DOM element (string), not a React component\n const finalProps = typeof Tag === \"string\" ? stripNonDomProps(mergedProps) : mergedProps;\n\n if (!block.children?.length) {\n return <Tag {...finalProps} />;\n }\n\n return (\n <Tag {...finalProps}>\n <PreviewChildrenRenderer\n block={block}\n components={components}\n currentComponent={currentComponent}\n componentRegistry={componentRegistry}\n />\n </Tag>\n );\n },\n);\n\nPreviewBlockRenderer.displayName = \"BlockRenderer\";\n","import { Theme, ThemeItem } from \"../types\";\n\nexport function applyFontsToDocument(document: Document, fonts: ThemeItem[]) {\n const root = document.documentElement;\n const head = document.head;\n\n // Simple implementation - in production you'd want to handle Google Fonts and local fonts\n fonts.forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n root.style.setProperty(font.variable, fontFamily);\n });\n}\n\nexport function applyColorToDocument(document: Document, color: ThemeItem) {\n document.documentElement.style.setProperty(color.variable, color.value);\n}\n\nexport function applyBorderRadiusToDocument(\n document: Document,\n borderRadius: number\n) {\n document.documentElement.style.setProperty(\"--radius\", `${borderRadius}rem`);\n}\n\nexport function applyThemeToDocument(document: Document, theme: Theme) {\n applyFontsToDocument(document, Object.values(theme.fonts));\n applyBorderRadiusToDocument(document, theme.borderRadius);\n Object.values(theme.colors).forEach((color) =>\n applyColorToDocument(document, color)\n );\n}\n\n/**\n * Generate CSS styles for theme that can be injected into a style tag for SSR.\n * This is a pure function that works on the server.\n * Uses scoped selectors to ensure SiteIO theme variables take precedence over project theme.\n */\nexport function applyThemeToStyleTag(theme: Theme): string {\n const styles: string[] = [];\n\n // Apply fonts\n Object.values(theme.fonts).forEach((font) => {\n const fontFamily = `\"${font.value}\"`;\n styles.push(` ${font.variable}: ${fontFamily} !important;`);\n });\n\n // Apply border radius\n styles.push(` --radius: ${theme.borderRadius}rem !important;`);\n\n // Apply colors - SiteIO uses HSL format (e.g., \"250 93% 66%\")\n Object.values(theme.colors).forEach((color) => {\n styles.push(` ${color.variable}: ${color.value} !important;`);\n });\n\n // Use high specificity selectors to ensure SiteIO theme variables override consuming app\n // The [data-siteio-theme] attribute is added to the SDK wrapper element\n const scopedStyles = styles.map((s) => s.replace(\" !important\", \"\"));\n\n return `\n/* SiteIO Base Styles - Required for proper rendering */\n:root {\n /* Default fallback values - will be overridden by theme */\n --background: 0 0% 5%;\n --foreground: 0 0% 98%;\n --card: 0 0% 17%;\n --card-foreground: 0 0% 98%;\n --popover: 0 0% 17%;\n --popover-foreground: 0 0% 98%;\n --primary: 217 91% 60%;\n --primary-foreground: 210 40% 98%;\n --secondary: 0 0% 17%;\n --secondary-foreground: 0 0% 98%;\n --muted: 0 0% 14.9%;\n --muted-foreground: 0 0% 63.9%;\n --accent: 0 0% 33%;\n --accent-foreground: 0 0% 98%;\n --destructive: 345 87% 53%;\n --destructive-foreground: 0 0% 98%;\n --border: 0 0% 15%;\n --input: 0 0% 14.9%;\n --ring: 0 0% 83.1%;\n --radius: 0.75rem;\n}\n\n/* SiteIO Theme Variables - Override with project theme */\n:root {\n${styles.join(\"\\n\")}\n}\n\n/* SiteIO Theme Variables - Scoped to SDK component */\n[data-siteio-theme] {\n${styles.join(\"\\n\")}\n}\n\n/* Ensure child elements also have access to variables */\n[data-siteio-theme] * {\n${scopedStyles.join(\"\\n\")}\n}\n\n/* SiteIO Base Element Styles */\n[data-siteio-theme] {\n background-color: hsl(var(--background));\n color: hsl(var(--foreground));\n}\n\n/* Utility class mappings for Tailwind CDN compatibility */\n.bg-background { background-color: hsl(var(--background)) !important; }\n.bg-foreground { background-color: hsl(var(--foreground)) !important; }\n.bg-card { background-color: hsl(var(--card)) !important; }\n.bg-popover { background-color: hsl(var(--popover)) !important; }\n.bg-primary { background-color: hsl(var(--primary)) !important; }\n.bg-secondary { background-color: hsl(var(--secondary)) !important; }\n.bg-muted { background-color: hsl(var(--muted)) !important; }\n.bg-accent { background-color: hsl(var(--accent)) !important; }\n.bg-destructive { background-color: hsl(var(--destructive)) !important; }\n\n.text-foreground { color: hsl(var(--foreground)) !important; }\n.text-background { color: hsl(var(--background)) !important; }\n.text-card-foreground { color: hsl(var(--card-foreground)) !important; }\n.text-popover-foreground { color: hsl(var(--popover-foreground)) !important; }\n.text-primary { color: hsl(var(--primary)) !important; }\n.text-primary-foreground { color: hsl(var(--primary-foreground)) !important; }\n.text-secondary-foreground { color: hsl(var(--secondary-foreground)) !important; }\n.text-muted-foreground { color: hsl(var(--muted-foreground)) !important; }\n.text-accent-foreground { color: hsl(var(--accent-foreground)) !important; }\n.text-destructive { color: hsl(var(--destructive)) !important; }\n.text-destructive-foreground { color: hsl(var(--destructive-foreground)) !important; }\n\n.border-border { border-color: hsl(var(--border)) !important; }\n.border-input { border-color: hsl(var(--input)) !important; }\n.ring-ring { --tw-ring-color: hsl(var(--ring)) !important; }\n.ring-offset-background { --tw-ring-offset-color: hsl(var(--background)) !important; }\n\n.rounded-lg { border-radius: var(--radius) !important; }\n.rounded-md { border-radius: calc(var(--radius) - 2px) !important; }\n.rounded-sm { border-radius: calc(var(--radius) - 4px) !important; }\n\n/* Hover states with opacity */\n.hover\\\\:bg-primary\\\\/90:hover { background-color: hsl(var(--primary) / 0.9) !important; }\n.hover\\\\:bg-primary\\\\/80:hover { background-color: hsl(var(--primary) / 0.8) !important; }\n.hover\\\\:bg-secondary\\\\/80:hover { background-color: hsl(var(--secondary) / 0.8) !important; }\n.hover\\\\:bg-destructive\\\\/90:hover { background-color: hsl(var(--destructive) / 0.9) !important; }\n.hover\\\\:bg-accent:hover { background-color: hsl(var(--accent)) !important; }\n.hover\\\\:text-accent-foreground:hover { color: hsl(var(--accent-foreground)) !important; }\n\n/* Focus visible states */\n.focus-visible\\\\:outline-none:focus-visible { outline: 2px solid transparent; outline-offset: 2px; }\n.focus-visible\\\\:ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\\\:ring-ring:focus-visible { --tw-ring-color: hsl(var(--ring)); }\n.focus-visible\\\\:ring-offset-2:focus-visible { --tw-ring-offset-width: 2px; }\n\n/* Disabled states */\n.disabled\\\\:opacity-50:disabled { opacity: 0.5; }\n.disabled\\\\:pointer-events-none:disabled { pointer-events: none; }\n\n/* Card styles */\n.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }\n\n/* Input & Form elements */\ninput, textarea, select {\n background-color: transparent;\n border-color: hsl(var(--input));\n}\n\n/* Separator */\nhr, [role=\"separator\"] {\n border-color: hsl(var(--border));\n background-color: hsl(var(--border));\n}\n\n/* Button transitions */\nbutton, [role=\"button\"], a {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n/* Border default */\n.border { border-width: 1px; border-color: hsl(var(--border)); }\n`.trim();\n}\n\n/**\n * Generate an inline script that applies theme CSS variables as inline styles\n * on the <html> element. This runs immediately without waiting for React hydration.\n * \n * This matches the builder's behavior where theme variables are set directly\n * on document.documentElement.style.\n */\nexport function generateThemeScript(theme: Theme): string {\n // Serialize theme data safely for inline script\n const themeData = JSON.stringify({\n colors: theme.colors,\n fonts: theme.fonts,\n borderRadius: theme.borderRadius,\n });\n\n return `\n(function() {\n try {\n var theme = ${themeData};\n var root = document.documentElement;\n \n // Apply colors\n Object.keys(theme.colors).forEach(function(key) {\n var color = theme.colors[key];\n root.style.setProperty(color.variable, color.value);\n });\n \n // Apply fonts\n Object.keys(theme.fonts).forEach(function(key) {\n var font = theme.fonts[key];\n root.style.setProperty(font.variable, '\"' + font.value + '\"');\n });\n \n // Apply border radius\n root.style.setProperty('--radius', theme.borderRadius + 'rem');\n } catch (e) {\n console.error('SiteIO theme script error:', e);\n }\n})();\n`.trim();\n}\n","import { fetchProject } from \"../utils/fetchProject\";\nimport { PreviewBlockRenderer } from \"./PreviewBlockRenderer\";\nimport { RewebProjectProps, Component, ProjectData } from \"../types\";\nimport { applyThemeToStyleTag, generateThemeScript } from \"../utils/theme\";\n\n/**\n * Pure SSR server component that fetches and renders project data on the server.\n * No client-side JavaScript required - works entirely in SSR mode.\n */\nexport async function RewebProject({\n projectId,\n token,\n initialPageId,\n config,\n className,\n componentRegistry,\n}: RewebProjectProps) {\n // Fetch data on the server\n let data: ProjectData;\n let error: Error | null = null;\n\n try {\n data = await fetchProject({\n projectId,\n token,\n apiUrl: config?.apiUrl,\n });\n } catch (err) {\n error = err instanceof Error ? err : new Error(\"Failed to fetch project\");\n // Return error UI - this will be rendered on server\n return (\n <div className={className}>\n <div>Error: {error.message}</div>\n </div>\n );\n }\n\n // Determine which page to render\n let currentPageId = initialPageId;\n if (!currentPageId) {\n // Find home page (url === \"/\")\n const homePage = data.pages.find((page) => page.url === \"/\");\n if (homePage) {\n currentPageId = homePage.public_id;\n } else if (data.pages.length > 0) {\n currentPageId = data.pages[0].public_id;\n }\n }\n\n const currentPage = data.pages.find((page) => page.public_id === currentPageId);\n if (!currentPage) {\n return (\n <div className={className}>\n <div>Page not found</div>\n </div>\n );\n }\n\n // Prepare components data\n const components: Pick<Component, \"id\" | \"blocks\" | \"propsConfig\">[] = data.components.map(\n (component) => ({\n id: component.public_id,\n blocks: component.blocks,\n propsConfig: component.props_config,\n }),\n );\n\n // Generate theme styles for SSR\n const themeStyles = applyThemeToStyleTag(data.project.theme);\n const projectCss = data.styles?.css ?? \"\";\n\n // Debug info (visible in page source)\n const debugInfo = `\n/* SiteIO SDK Debug Info:\n * Theme colors count: ${Object.keys(data.project.theme?.colors || {}).length}\n * Project CSS length: ${projectCss.length} chars\n * Theme styles length: ${themeStyles.length} chars\n */`;\n\n return (\n <>\n {/* Inject theme styles for SSR - scoped to SiteIO component */}\n <style\n data-siteio-theme-styles\n dangerouslySetInnerHTML={{ __html: debugInfo + \"\\n\" + themeStyles }}\n />\n {projectCss ? (\n <style data-siteio-project-css dangerouslySetInnerHTML={{ __html: projectCss }} />\n ) : null}\n {/* Apply inline styles to <html> element immediately (no React hydration needed) */}\n <script\n data-siteio-theme-script\n dangerouslySetInnerHTML={{ __html: generateThemeScript(data.project.theme) }}\n />\n <div className={className} data-siteio-theme>\n {currentPage.blocks.map((block) => (\n <PreviewBlockRenderer\n key={block.id}\n block={block}\n components={components}\n componentRegistry={componentRegistry}\n />\n ))}\n </div>\n </>\n );\n}\n"]}
{
"name": "@tapstack/siteio-react-sdk",
"version": "0.0.11",
"version": "0.0.12",
"description": "SDK for rendering SiteIO projects in external Next.js applications",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -7,2 +7,3 @@ # @tapstack/siteio-react-sdk

## Installation

@@ -9,0 +10,0 @@