MCPcopy
hub / github.com/wandb/openui / wrappedCode

Function wrappedCode

frontend/src/lib/html.ts:45–118  ·  view source on GitHub ↗
(code: string, framework: Framework, theme: Theme)

Source from the content-addressed store, hash-verified

43}
44
45export function wrappedCode(code: string, framework: Framework, theme: Theme) {
46 if (framework === 'html') {
47 return `<html>
48 <head>
49 <meta charset="UTF-8">
50 <meta name="viewport" content="width=device-width, initial-scale=1.0">
51 <script src="https://cdn.tailwindcss.com?plugins=forms,typography"></script>
52 <script src="https://unpkg.com/unlazy@0.11.3/dist/unlazy.with-hashing.iife.js" defer init></script>
53 <script type="text/javascript">
54 window.tailwind.config = {
55 darkMode: ['class'],
56 theme: {
57 extend: {
58 colors: {
59 border: 'hsl(var(--border))',
60 input: 'hsl(var(--input))',
61 ring: 'hsl(var(--ring))',
62 background: 'hsl(var(--background))',
63 foreground: 'hsl(var(--foreground))',
64 primary: {
65 DEFAULT: 'hsl(var(--primary))',
66 foreground: 'hsl(var(--primary-foreground))'
67 },
68 secondary: {
69 DEFAULT: 'hsl(var(--secondary))',
70 foreground: 'hsl(var(--secondary-foreground))'
71 },
72 destructive: {
73 DEFAULT: 'hsl(var(--destructive))',
74 foreground: 'hsl(var(--destructive-foreground))'
75 },
76 muted: {
77 DEFAULT: 'hsl(var(--muted))',
78 foreground: 'hsl(var(--muted-foreground))'
79 },
80 accent: {
81 DEFAULT: 'hsl(var(--accent))',
82 foreground: 'hsl(var(--accent-foreground))'
83 },
84 popover: {
85 DEFAULT: 'hsl(var(--popover))',
86 foreground: 'hsl(var(--popover-foreground))'
87 },
88 card: {
89 DEFAULT: 'hsl(var(--card))',
90 foreground: 'hsl(var(--card-foreground))'
91 },
92 },
93 }
94 }
95 }
96 </script>
97 <style type="text/tailwindcss">
98 @layer base {
99 :root {
100 ${Object.entries(theme.cssVars.light)
101 .map(([key, value]) => `--${key}: ${value};`)
102 .join('\n')}

Callers 2

ChatFunction · 0.90
CodeViewerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected