design-system-provider.tsx — ui Source File
Architecture documentation for design-system-provider.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8cd76466_2b61_eda9_5470_c5e644ff3e2f["design-system-provider.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 8cd76466_2b61_eda9_5470_c5e644ff3e2f --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 f14cf7ca_f213_afc2_bc66_ebc0fb7d9834["config"] 8cd76466_2b61_eda9_5470_c5e644ff3e2f --> f14cf7ca_f213_afc2_bc66_ebc0fb7d9834 e7f842e9_1cb7_8b3b_1b3f_99b8b4328fb6["use-iframe-sync"] 8cd76466_2b61_eda9_5470_c5e644ff3e2f --> e7f842e9_1cb7_8b3b_1b3f_99b8b4328fb6 3d93decf_c957_3d20_9f5e_e6c328cd39c2["fonts"] 8cd76466_2b61_eda9_5470_c5e644ff3e2f --> 3d93decf_c957_3d20_9f5e_e6c328cd39c2 c27c6e95_5daf_4dd4_dc3a_add496837570["search-params"] 8cd76466_2b61_eda9_5470_c5e644ff3e2f --> c27c6e95_5daf_4dd4_dc3a_add496837570 style 8cd76466_2b61_eda9_5470_c5e644ff3e2f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import {
buildRegistryTheme,
DEFAULT_CONFIG,
type DesignSystemConfig,
} from "@/registry/config"
import { useIframeMessageListener } from "@/app/(create)/hooks/use-iframe-sync"
import { FONTS } from "@/app/(create)/lib/fonts"
import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"
export function DesignSystemProvider({
children,
}: {
children: React.ReactNode
}) {
const [
{ style, theme, font, baseColor, menuAccent, menuColor, radius },
setSearchParams,
] = useDesignSystemSearchParams({
shallow: true, // No need to go through the server…
history: "replace", // …or push updates into the iframe history.
})
useIframeMessageListener("design-system-params", setSearchParams)
const [isReady, setIsReady] = React.useState(false)
// Use useLayoutEffect for synchronous style updates to prevent flash.
React.useLayoutEffect(() => {
if (!style || !theme || !font || !baseColor) {
return
}
const body = document.body
// Update style class in place (remove old, add new).
body.classList.forEach((className) => {
if (className.startsWith("style-")) {
body.classList.remove(className)
}
})
body.classList.add(`style-${style}`)
// Update base color class in place.
body.classList.forEach((className) => {
if (className.startsWith("base-color-")) {
body.classList.remove(className)
}
})
body.classList.add(`base-color-${baseColor}`)
// Update font.
const selectedFont = FONTS.find((f) => f.value === font)
if (selectedFont) {
const fontFamily = selectedFont.font.style.fontFamily
document.documentElement.style.setProperty("--font-sans", fontFamily)
}
setIsReady(true)
// ... (115 more lines)
Domain
Subdomains
Functions
Dependencies
- config
- fonts
- react
- search-params
- use-iframe-sync
Source
Frequently Asked Questions
What does design-system-provider.tsx do?
design-system-provider.tsx is a source file in the ui codebase, written in tsx. It belongs to the DesignEngine domain, PreviewSystem subdomain.
What functions are defined in design-system-provider.tsx?
design-system-provider.tsx defines 1 function(s): DesignSystemProvider.
What does design-system-provider.tsx depend on?
design-system-provider.tsx imports 5 module(s): config, fonts, react, search-params, use-iframe-sync.
Where is design-system-provider.tsx in the architecture?
design-system-provider.tsx is located at apps/v4/app/(create)/components/design-system-provider.tsx (domain: DesignEngine, subdomain: PreviewSystem, directory: apps/v4/app/(create)/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free