@previewcn/devtools 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -12
- package/dist/index.js +10 -12
- package/dist/styles.css +20 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var be=Object.defineProperty;var d=(e,o)=>()=>(e&&(o=e(e=0)),o);var Pe=(e,o)=>{for(var r in o)be(e,r,{get:o[r],enumerable:true});};var z,A=d(()=>{z=[{name:"neutral",label:"Neutral",primary:{light:"oklch(0.556 0 0)",dark:"oklch(0.708 0 0)"},primaryForeground:{light:"oklch(0.985 0 0)",dark:"oklch(0.205 0 0)"}},{name:"red",label:"Red",primary:{light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.637 0.237 25.331)"},primaryForeground:{light:"oklch(0.971 0.013 17.38)",dark:"oklch(0.971 0.013 17.38)"},destructive:{light:"oklch(0.505 0.213 27.518)"}},{name:"orange",label:"Orange",primary:{light:"oklch(0.646 0.222 41.116)",dark:"oklch(0.705 0.213 47.604)"},primaryForeground:{light:"oklch(0.98 0.016 73.684)",dark:"oklch(0.98 0.016 73.684)"}},{name:"amber",label:"Amber",primary:{light:"oklch(0.67 0.16 58)",dark:"oklch(0.77 0.16 70)"},primaryForeground:{light:"oklch(0.99 0.02 95)",dark:"oklch(0.28 0.07 46)"}},{name:"yellow",label:"Yellow",primary:{light:"oklch(0.852 0.199 91.936)",dark:"oklch(0.795 0.184 86.047)"},primaryForeground:{light:"oklch(0.421 0.095 57.708)",dark:"oklch(0.421 0.095 57.708)"}},{name:"lime",label:"Lime",primary:{light:"oklch(0.65 0.18 132)",dark:"oklch(0.77 0.20 131)"},primaryForeground:{light:"oklch(0.99 0.03 121)",dark:"oklch(0.27 0.07 132)"}},{name:"green",label:"Green",primary:{light:"oklch(0.648 0.2 131.684)",dark:"oklch(0.648 0.2 131.684)"},primaryForeground:{light:"oklch(0.986 0.031 120.757)",dark:"oklch(0.986 0.031 120.757)"}},{name:"emerald",label:"Emerald",primary:{light:"oklch(0.60 0.13 163)",dark:"oklch(0.70 0.15 162)"},primaryForeground:{light:"oklch(0.98 0.02 166)",dark:"oklch(0.26 0.05 173)"}},{name:"teal",label:"Teal",primary:{light:"oklch(0.60 0.10 185)",dark:"oklch(0.70 0.12 183)"},primaryForeground:{light:"oklch(0.98 0.01 181)",dark:"oklch(0.28 0.04 193)"}},{name:"cyan",label:"Cyan",primary:{light:"oklch(0.61 0.11 222)",dark:"oklch(0.71 0.13 215)"},primaryForeground:{light:"oklch(0.98 0.02 201)",dark:"oklch(0.30 0.05 230)"}},{name:"sky",label:"Sky",primary:{light:"oklch(0.59 0.14 242)",dark:"oklch(0.68 0.15 237)"},primaryForeground:{light:"oklch(0.98 0.01 237)",dark:"oklch(0.29 0.06 243)"}},{name:"blue",label:"Blue",primary:{light:"oklch(0.488 0.243 264.376)",dark:"oklch(0.42 0.18 266)"},primaryForeground:{light:"oklch(0.97 0.014 254.604)",dark:"oklch(0.97 0.014 254.604)"}},{name:"indigo",label:"Indigo",primary:{light:"oklch(0.51 0.23 277)",dark:"oklch(0.59 0.20 277)"},primaryForeground:{light:"oklch(0.96 0.02 272)",dark:"oklch(0.96 0.02 272)"}},{name:"violet",label:"Violet",primary:{light:"oklch(0.541 0.281 293.009)",dark:"oklch(0.606 0.25 292.717)"},primaryForeground:{light:"oklch(0.969 0.016 293.756)",dark:"oklch(0.969 0.016 293.756)"}},{name:"purple",label:"Purple",primary:{light:"oklch(0.56 0.25 302)",dark:"oklch(0.63 0.23 304)"},primaryForeground:{light:"oklch(0.98 0.01 308)",dark:"oklch(0.98 0.01 308)"}},{name:"fuchsia",label:"Fuchsia",primary:{light:"oklch(0.59 0.26 323)",dark:"oklch(0.67 0.26 322)"},primaryForeground:{light:"oklch(0.98 0.02 320)",dark:"oklch(0.98 0.02 320)"}},{name:"pink",label:"Pink",primary:{light:"oklch(0.59 0.22 1)",dark:"oklch(0.66 0.21 354)"},primaryForeground:{light:"oklch(0.97 0.01 343)",dark:"oklch(0.97 0.01 343)"}},{name:"rose",label:"Rose",primary:{light:"oklch(0.586 0.253 17.585)",dark:"oklch(0.645 0.246 16.439)"},primaryForeground:{light:"oklch(0.969 0.015 12.422)",dark:"oklch(0.969 0.015 12.422)"}}];});function Se(e){return {name:e.name,label:e.label,colors:{light:{...G.light,primary:e.primary.light,"primary-foreground":e.primaryForeground?.light??K.light,destructive:e.destructive?.light??j.light},dark:{...G.dark,primary:e.primary.dark,"primary-foreground":e.primaryForeground?.dark??K.dark,destructive:e.destructive?.dark??j.dark}}}}function X(e){return L.find(o=>o.name===e)}var G,j,K,L,I=d(()=>{A();G={light:{background:"oklch(1 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(1 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.145 0 0)",secondary:"oklch(0.97 0 0)","secondary-foreground":"oklch(0.205 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.556 0 0)",accent:"oklch(0.97 0 0)","accent-foreground":"oklch(0.205 0 0)",border:"oklch(0.922 0 0)",input:"oklch(0.922 0 0)",ring:"oklch(0.708 0 0)"},dark:{background:"oklch(0.145 0 0)",foreground:"oklch(0.985 0 0)",card:"oklch(0.205 0 0)","card-foreground":"oklch(0.985 0 0)",popover:"oklch(0.205 0 0)","popover-foreground":"oklch(0.985 0 0)",secondary:"oklch(0.269 0 0)","secondary-foreground":"oklch(0.985 0 0)",muted:"oklch(0.269 0 0)","muted-foreground":"oklch(0.708 0 0)",accent:"oklch(0.269 0 0)","accent-foreground":"oklch(0.985 0 0)",border:"oklch(1 0 0 / 10%)",input:"oklch(1 0 0 / 15%)",ring:"oklch(0.556 0 0)"}},j={light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.704 0.191 22.216)"},K={light:"oklch(0.985 0 0)",dark:"oklch(0.985 0 0)"};L=z.map(Se);});function Z(e){return b.find(o=>o.value===e)}var b,$=d(()=>{b=[{label:"Inter",value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"},{label:"Noto Sans",value:"noto-sans",fontFamily:'"Noto Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},{label:"Nunito Sans",value:"nunito-sans",fontFamily:'"Nunito Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700&display=swap"},{label:"Figtree",value:"figtree",fontFamily:'"Figtree", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap"},{label:"Roboto",value:"roboto",fontFamily:'"Roboto", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"},{label:"Raleway",value:"raleway",fontFamily:'"Raleway", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&display=swap"},{label:"DM Sans",value:"dm-sans",fontFamily:'"DM Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"},{label:"Public Sans",value:"public-sans",fontFamily:'"Public Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&display=swap"},{label:"Outfit",value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"},{label:"JetBrains Mono",value:"jetbrains-mono",fontFamily:'"JetBrains Mono", monospace',googleFontsUrl:"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"}];});function P(e){return O.find(o=>o.name===e)}var O,C=d(()=>{O=[{name:"vercel",label:"Vercel",colors:{light:{background:"oklch(0.99 0 0)",foreground:"oklch(0 0 0)",card:"oklch(1.00 0 0)","card-foreground":"oklch(0 0 0)",popover:"oklch(0.99 0 0)","popover-foreground":"oklch(0 0 0)",primary:"oklch(0 0 0)","primary-foreground":"oklch(1.00 0 0)",secondary:"oklch(0.94 0 0)","secondary-foreground":"oklch(0 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.44 0 0)",accent:"oklch(0.94 0 0)","accent-foreground":"oklch(0 0 0)",destructive:"oklch(0.63 0.19 23.03)","destructive-foreground":"oklch(1.00 0 0)",border:"oklch(0.92 0 0)",input:"oklch(0.94 0 0)",ring:"oklch(0 0 0)"},dark:{background:"oklch(0 0 0)",foreground:"oklch(1.00 0 0)",card:"oklch(0.14 0 0)","card-foreground":"oklch(1.00 0 0)",popover:"oklch(0.18 0 0)","popover-foreground":"oklch(1.00 0 0)",primary:"oklch(1.00 0 0)","primary-foreground":"oklch(0 0 0)",secondary:"oklch(0.25 0 0)","secondary-foreground":"oklch(1.00 0 0)",muted:"oklch(0.23 0 0)","muted-foreground":"oklch(0.72 0 0)",accent:"oklch(0.32 0 0)","accent-foreground":"oklch(1.00 0 0)",destructive:"oklch(0.69 0.20 23.91)","destructive-foreground":"oklch(0 0 0)",border:"oklch(0.26 0 0)",input:"oklch(0.32 0 0)",ring:"oklch(0.72 0 0)"}},radius:"0.5rem",font:{value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"}},{name:"supabase",label:"Supabase",colors:{light:{background:"oklch(0.985 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(0.985 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(0.985 0 0)","popover-foreground":"oklch(0.4 0 0)",primary:"oklch(0.82 0.14 155)","primary-foreground":"oklch(0.2 0.03 155)",secondary:"oklch(0.99 0 0)","secondary-foreground":"oklch(0.145 0 0)",muted:"oklch(0.93 0 0)","muted-foreground":"oklch(0.2 0 0)",accent:"oklch(0.93 0 0)","accent-foreground":"oklch(0.2 0 0)",destructive:"oklch(0.55 0.2 25)","destructive-foreground":"oklch(0.99 0 0)",border:"oklch(0.88 0 0)",input:"oklch(0.96 0 0)",ring:"oklch(0.82 0.14 155)"},dark:{background:"oklch(0.16 0 0)",foreground:"oklch(0.9 0.01 240)",card:"oklch(0.18 0 0)","card-foreground":"oklch(0.9 0.01 240)",popover:"oklch(0.22 0 0)","popover-foreground":"oklch(0.7 0 0)",primary:"oklch(0.45 0.12 155)","primary-foreground":"oklch(0.92 0.02 155)",secondary:"oklch(0.22 0 0)","secondary-foreground":"oklch(0.98 0 0)",muted:"oklch(0.2 0 0)","muted-foreground":"oklch(0.68 0 0)",accent:"oklch(0.28 0 0)","accent-foreground":"oklch(0.98 0 0)",destructive:"oklch(0.35 0.12 25)","destructive-foreground":"oklch(0.92 0.02 25)",border:"oklch(0.25 0 0)",input:"oklch(0.22 0 0)",ring:"oklch(0.72 0.18 145)"}},radius:"0.5rem",font:{value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"}},{name:"claude",label:"Claude",colors:{light:{background:"oklch(0.975 0.01 85)",foreground:"oklch(0.3 0.03 85)",card:"oklch(0.975 0.01 85)","card-foreground":"oklch(0.15 0.01 85)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.22 0.02 85)",primary:"oklch(0.58 0.16 35)","primary-foreground":"oklch(1 0 0)",secondary:"oklch(0.92 0.02 85)","secondary-foreground":"oklch(0.4 0.02 85)",muted:"oklch(0.94 0.015 85)","muted-foreground":"oklch(0.58 0.01 85)",accent:"oklch(0.92 0.02 85)","accent-foreground":"oklch(0.22 0.02 85)",destructive:"oklch(0.15 0.01 85)","destructive-foreground":"oklch(1 0 0)",border:"oklch(0.88 0.01 85)",input:"oklch(0.75 0.01 85)",ring:"oklch(0.58 0.16 35)"},dark:{background:"oklch(0.24 0.01 85)",foreground:"oklch(0.8 0.01 85)",card:"oklch(0.24 0.01 85)","card-foreground":"oklch(0.975 0.01 85)",popover:"oklch(0.28 0.01 85)","popover-foreground":"oklch(0.92 0.005 85)",primary:"oklch(0.65 0.14 35)","primary-foreground":"oklch(1 0 0)",secondary:"oklch(0.975 0.01 85)","secondary-foreground":"oklch(0.28 0.01 85)",muted:"oklch(0.2 0.01 85)","muted-foreground":"oklch(0.76 0.01 85)",accent:"oklch(0.18 0.01 85)","accent-foreground":"oklch(0.96 0.01 85)",destructive:"oklch(0.63 0.24 27)","destructive-foreground":"oklch(1 0 0)",border:"oklch(0.32 0.01 85)",input:"oklch(0.4 0.01 85)",ring:"oklch(0.65 0.14 35)"}},radius:"0.5rem"}];});function q(){let e=document.getElementById(D);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let o=document.createElement("style");return o.id=D,document.head.appendChild(o),o}function F(e){return Object.entries(e).map(([o,r])=>`--${o}: ${r};`).join(" ")}function S(e){let o=document.documentElement;e?(o.classList.remove("light"),o.classList.add("dark")):(o.classList.remove("dark"),o.classList.add("light")),o.style.colorScheme=e?"dark":"light";}function f(e){document.documentElement.style.setProperty("--radius",e);}function x(e){let o=X(e);if(!o)return;let r=q(),t=F(o.colors.light),a=F(o.colors.dark);r.textContent=`:root { ${t} } .dark { ${a} }`;}function xe(e){let o=q(),r=F(e.colors.light),t=F(e.colors.dark);o.textContent=`:root { ${r} } .dark { ${t} }`;}function Q(){let e=document.getElementById(U);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let o=document.createElement("style");return o.id=U,document.head.appendChild(o),o}function N(e){let o=Z(e);if(!o)return;let{fontFamily:r,googleFontsUrl:t}=o;if(!t.startsWith("https://fonts.googleapis.com/")){console.warn("[PreviewCN] Invalid font URL");return}let a=`previewcn-font-${e}`;if(!document.getElementById(a)){let l=document.createElement("link");l.id=a,l.rel="stylesheet",l.href=t,document.head.appendChild(l);}let p=Q();p.textContent=`
|
|
2
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Me=Object.defineProperty;var c=(e,r)=>()=>(e&&(r=e(e=0)),r);var Re=(e,r)=>{for(var o in r)Me(e,o,{get:r[o],enumerable:true});};function u(e){return Be.get(e)}var B,Be,y=c(()=>{B=[{name:"vercel",label:"Vercel",colors:{light:{background:"oklch(0.99 0 0)",foreground:"oklch(0 0 0)",card:"oklch(1.00 0 0)","card-foreground":"oklch(0 0 0)",popover:"oklch(0.99 0 0)","popover-foreground":"oklch(0 0 0)",primary:"oklch(0 0 0)","primary-foreground":"oklch(1.00 0 0)",secondary:"oklch(0.94 0 0)","secondary-foreground":"oklch(0 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.44 0 0)",accent:"oklch(0.94 0 0)","accent-foreground":"oklch(0 0 0)",destructive:"oklch(0.63 0.19 23.03)","destructive-foreground":"oklch(1.00 0 0)",border:"oklch(0.92 0 0)",input:"oklch(0.94 0 0)",ring:"oklch(0 0 0)","chart-1":"oklch(0.81 0.17 75.35)","chart-2":"oklch(0.55 0.22 264.53)","chart-3":"oklch(0.72 0 0)","chart-4":"oklch(0.92 0 0)","chart-5":"oklch(0.56 0 0)",sidebar:"oklch(0.99 0 0)","sidebar-foreground":"oklch(0 0 0)","sidebar-primary":"oklch(0 0 0)","sidebar-primary-foreground":"oklch(1.00 0 0)","sidebar-accent":"oklch(0.94 0 0)","sidebar-accent-foreground":"oklch(0 0 0)","sidebar-border":"oklch(0.94 0 0)","sidebar-ring":"oklch(0 0 0)"},dark:{background:"oklch(0 0 0)",foreground:"oklch(1.00 0 0)",card:"oklch(0.14 0 0)","card-foreground":"oklch(1.00 0 0)",popover:"oklch(0.18 0 0)","popover-foreground":"oklch(1.00 0 0)",primary:"oklch(1.00 0 0)","primary-foreground":"oklch(0 0 0)",secondary:"oklch(0.25 0 0)","secondary-foreground":"oklch(1.00 0 0)",muted:"oklch(0.23 0 0)","muted-foreground":"oklch(0.72 0 0)",accent:"oklch(0.32 0 0)","accent-foreground":"oklch(1.00 0 0)",destructive:"oklch(0.69 0.20 23.91)","destructive-foreground":"oklch(0 0 0)",border:"oklch(0.26 0 0)",input:"oklch(0.32 0 0)",ring:"oklch(0.72 0 0)","chart-1":"oklch(0.81 0.17 75.35)","chart-2":"oklch(0.58 0.21 260.84)","chart-3":"oklch(0.56 0 0)","chart-4":"oklch(0.44 0 0)","chart-5":"oklch(0.92 0 0)",sidebar:"oklch(0.18 0 0)","sidebar-foreground":"oklch(1.00 0 0)","sidebar-primary":"oklch(1.00 0 0)","sidebar-primary-foreground":"oklch(0 0 0)","sidebar-accent":"oklch(0.32 0 0)","sidebar-accent-foreground":"oklch(1.00 0 0)","sidebar-border":"oklch(0.32 0 0)","sidebar-ring":"oklch(0.72 0 0)"}},radius:"0.5rem",font:{value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"}},{name:"supabase",label:"Supabase",colors:{light:{background:"#fcfcfc",foreground:"#171717",card:"#fcfcfc","card-foreground":"#171717",popover:"#fcfcfc","popover-foreground":"#525252",primary:"#72e3ad","primary-foreground":"#1e2723",secondary:"#fdfdfd","secondary-foreground":"#171717",muted:"#ededed","muted-foreground":"#202020",accent:"#ededed","accent-foreground":"#202020",destructive:"#ca3214","destructive-foreground":"#fffcfc",border:"#dfdfdf",input:"#f6f6f6",ring:"#72e3ad","chart-1":"#72e3ad","chart-2":"#3b82f6","chart-3":"#8b5cf6","chart-4":"#f59e0b","chart-5":"#10b981",sidebar:"#fcfcfc","sidebar-foreground":"#707070","sidebar-primary":"#72e3ad","sidebar-primary-foreground":"#1e2723","sidebar-accent":"#ededed","sidebar-accent-foreground":"#202020","sidebar-border":"#dfdfdf","sidebar-ring":"#72e3ad"},dark:{background:"#121212",foreground:"#e2e8f0",card:"#171717","card-foreground":"#e2e8f0",popover:"#242424","popover-foreground":"#a9a9a9",primary:"#006239","primary-foreground":"#dde8e3",secondary:"#242424","secondary-foreground":"#fafafa",muted:"#1f1f1f","muted-foreground":"#a2a2a2",accent:"#313131","accent-foreground":"#fafafa",destructive:"#541c15","destructive-foreground":"#ede9e8",border:"#292929",input:"#242424",ring:"#4ade80","chart-1":"#4ade80","chart-2":"#60a5fa","chart-3":"#a78bfa","chart-4":"#fbbf24","chart-5":"#2dd4bf",sidebar:"#121212","sidebar-foreground":"#898989","sidebar-primary":"#006239","sidebar-primary-foreground":"#dde8e3","sidebar-accent":"#313131","sidebar-accent-foreground":"#fafafa","sidebar-border":"#292929","sidebar-ring":"#4ade80"}},radius:"0.5rem",font:{value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"}},{name:"claude",label:"Claude",colors:{light:{background:"#faf9f5",foreground:"#3d3929",card:"#faf9f5","card-foreground":"#141413",popover:"#ffffff","popover-foreground":"#28261b",primary:"#c96442","primary-foreground":"#ffffff",secondary:"#e9e6dc","secondary-foreground":"#535146",muted:"#ede9de","muted-foreground":"#83827d",accent:"#e9e6dc","accent-foreground":"#28261b",destructive:"#141413","destructive-foreground":"#ffffff",border:"#dad9d4",input:"#b4b2a7",ring:"#c96442","chart-1":"#b05730","chart-2":"#9c87f5","chart-3":"#ded8c4","chart-4":"#dbd3f0","chart-5":"#b4552d",sidebar:"#f5f4ee","sidebar-foreground":"#3d3d3a","sidebar-primary":"#c96442","sidebar-primary-foreground":"#fbfbfb","sidebar-accent":"#e9e6dc","sidebar-accent-foreground":"#343434","sidebar-border":"#ebebeb","sidebar-ring":"#b5b5b5"},dark:{background:"#262624",foreground:"#c3c0b6",card:"#262624","card-foreground":"#faf9f5",popover:"#30302e","popover-foreground":"#e5e5e2",primary:"#d97757","primary-foreground":"#ffffff",secondary:"#faf9f5","secondary-foreground":"#30302e",muted:"#1b1b19","muted-foreground":"#b7b5a9",accent:"#1a1915","accent-foreground":"#f5f4ee",destructive:"#ef4444","destructive-foreground":"#ffffff",border:"#3e3e38",input:"#52514a",ring:"#d97757","chart-1":"#b05730","chart-2":"#9c87f5","chart-3":"#1a1915","chart-4":"#2f2b48","chart-5":"#b4552d",sidebar:"#1f1e1d","sidebar-foreground":"#c3c0b6","sidebar-primary":"#343434","sidebar-primary-foreground":"#fbfbfb","sidebar-accent":"#0f0f0e","sidebar-accent-foreground":"#c3c0b6","sidebar-border":"#ebebeb","sidebar-ring":"#b5b5b5"}},radius:"0.5rem"}],Be=new Map(B.map(e=>[e.name,e]));});var Y,z=c(()=>{Y=[{name:"neutral",label:"Neutral",primary:{light:"oklch(0.556 0 0)",dark:"oklch(0.708 0 0)"},primaryForeground:{light:"oklch(0.985 0 0)",dark:"oklch(0.205 0 0)"}},{name:"red",label:"Red",primary:{light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.637 0.237 25.331)"},primaryForeground:{light:"oklch(0.971 0.013 17.38)",dark:"oklch(0.971 0.013 17.38)"},destructive:{light:"oklch(0.505 0.213 27.518)"}},{name:"orange",label:"Orange",primary:{light:"oklch(0.646 0.222 41.116)",dark:"oklch(0.705 0.213 47.604)"},primaryForeground:{light:"oklch(0.98 0.016 73.684)",dark:"oklch(0.98 0.016 73.684)"}},{name:"amber",label:"Amber",primary:{light:"oklch(0.67 0.16 58)",dark:"oklch(0.77 0.16 70)"},primaryForeground:{light:"oklch(0.99 0.02 95)",dark:"oklch(0.28 0.07 46)"}},{name:"yellow",label:"Yellow",primary:{light:"oklch(0.852 0.199 91.936)",dark:"oklch(0.795 0.184 86.047)"},primaryForeground:{light:"oklch(0.421 0.095 57.708)",dark:"oklch(0.421 0.095 57.708)"}},{name:"lime",label:"Lime",primary:{light:"oklch(0.65 0.18 132)",dark:"oklch(0.77 0.20 131)"},primaryForeground:{light:"oklch(0.99 0.03 121)",dark:"oklch(0.27 0.07 132)"}},{name:"green",label:"Green",primary:{light:"oklch(0.648 0.2 131.684)",dark:"oklch(0.648 0.2 131.684)"},primaryForeground:{light:"oklch(0.986 0.031 120.757)",dark:"oklch(0.986 0.031 120.757)"}},{name:"emerald",label:"Emerald",primary:{light:"oklch(0.60 0.13 163)",dark:"oklch(0.70 0.15 162)"},primaryForeground:{light:"oklch(0.98 0.02 166)",dark:"oklch(0.26 0.05 173)"}},{name:"teal",label:"Teal",primary:{light:"oklch(0.60 0.10 185)",dark:"oklch(0.70 0.12 183)"},primaryForeground:{light:"oklch(0.98 0.01 181)",dark:"oklch(0.28 0.04 193)"}},{name:"cyan",label:"Cyan",primary:{light:"oklch(0.61 0.11 222)",dark:"oklch(0.71 0.13 215)"},primaryForeground:{light:"oklch(0.98 0.02 201)",dark:"oklch(0.30 0.05 230)"}},{name:"sky",label:"Sky",primary:{light:"oklch(0.59 0.14 242)",dark:"oklch(0.68 0.15 237)"},primaryForeground:{light:"oklch(0.98 0.01 237)",dark:"oklch(0.29 0.06 243)"}},{name:"blue",label:"Blue",primary:{light:"oklch(0.488 0.243 264.376)",dark:"oklch(0.42 0.18 266)"},primaryForeground:{light:"oklch(0.97 0.014 254.604)",dark:"oklch(0.97 0.014 254.604)"}},{name:"indigo",label:"Indigo",primary:{light:"oklch(0.51 0.23 277)",dark:"oklch(0.59 0.20 277)"},primaryForeground:{light:"oklch(0.96 0.02 272)",dark:"oklch(0.96 0.02 272)"}},{name:"violet",label:"Violet",primary:{light:"oklch(0.541 0.281 293.009)",dark:"oklch(0.606 0.25 292.717)"},primaryForeground:{light:"oklch(0.969 0.016 293.756)",dark:"oklch(0.969 0.016 293.756)"}},{name:"purple",label:"Purple",primary:{light:"oklch(0.56 0.25 302)",dark:"oklch(0.63 0.23 304)"},primaryForeground:{light:"oklch(0.98 0.01 308)",dark:"oklch(0.98 0.01 308)"}},{name:"fuchsia",label:"Fuchsia",primary:{light:"oklch(0.59 0.26 323)",dark:"oklch(0.67 0.26 322)"},primaryForeground:{light:"oklch(0.98 0.02 320)",dark:"oklch(0.98 0.02 320)"}},{name:"pink",label:"Pink",primary:{light:"oklch(0.59 0.22 1)",dark:"oklch(0.66 0.21 354)"},primaryForeground:{light:"oklch(0.97 0.01 343)",dark:"oklch(0.97 0.01 343)"}},{name:"rose",label:"Rose",primary:{light:"oklch(0.586 0.253 17.585)",dark:"oklch(0.645 0.246 16.439)"},primaryForeground:{light:"oklch(0.969 0.015 12.422)",dark:"oklch(0.969 0.015 12.422)"}}];});function Oe(e){return {name:e.name,label:e.label,colors:{light:{...G.light,primary:e.primary.light,"primary-foreground":e.primaryForeground?.light??X.light,destructive:e.destructive?.light??K.light},dark:{...G.dark,primary:e.primary.dark,"primary-foreground":e.primaryForeground?.dark??X.dark,destructive:e.destructive?.dark??K.dark}}}}function T(e){return O.find(r=>r.name===e)}var G,K,X,O,S=c(()=>{z();G={light:{background:"oklch(1 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(1 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.145 0 0)",secondary:"oklch(0.97 0 0)","secondary-foreground":"oklch(0.205 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.556 0 0)",accent:"oklch(0.97 0 0)","accent-foreground":"oklch(0.205 0 0)",border:"oklch(0.922 0 0)",input:"oklch(0.922 0 0)",ring:"oklch(0.708 0 0)"},dark:{background:"oklch(0.145 0 0)",foreground:"oklch(0.985 0 0)",card:"oklch(0.205 0 0)","card-foreground":"oklch(0.985 0 0)",popover:"oklch(0.205 0 0)","popover-foreground":"oklch(0.985 0 0)",secondary:"oklch(0.269 0 0)","secondary-foreground":"oklch(0.985 0 0)",muted:"oklch(0.269 0 0)","muted-foreground":"oklch(0.708 0 0)",accent:"oklch(0.269 0 0)","accent-foreground":"oklch(0.985 0 0)",border:"oklch(1 0 0 / 10%)",input:"oklch(1 0 0 / 15%)",ring:"oklch(0.556 0 0)"}},K={light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.704 0.191 22.216)"},X={light:"oklch(0.985 0 0)",dark:"oklch(0.985 0 0)"};O=Y.map(Oe);});function Z(e){return x.find(r=>r.value===e)}var x,D=c(()=>{x=[{label:"Inter",value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"},{label:"Noto Sans",value:"noto-sans",fontFamily:'"Noto Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},{label:"Nunito Sans",value:"nunito-sans",fontFamily:'"Nunito Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700&display=swap"},{label:"Figtree",value:"figtree",fontFamily:'"Figtree", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap"},{label:"Roboto",value:"roboto",fontFamily:'"Roboto", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"},{label:"Raleway",value:"raleway",fontFamily:'"Raleway", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&display=swap"},{label:"DM Sans",value:"dm-sans",fontFamily:'"DM Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"},{label:"Public Sans",value:"public-sans",fontFamily:'"Public Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&display=swap"},{label:"Outfit",value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"},{label:"JetBrains Mono",value:"jetbrains-mono",fontFamily:'"JetBrains Mono", monospace',googleFontsUrl:"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"}];});function De(){let e=document.getElementById($);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let r=document.createElement("style");return r.id=$,document.head.appendChild(r),r}function q(e){return Object.entries(e).map(([r,o])=>`--${r}: ${o};`).join(" ")}function Q(e){let r=De(),o=q(e.light),t=q(e.dark);r.textContent=`:root { ${o} } .dark { ${t} }`;}function N(e){let r=document.documentElement;e?(r.classList.remove("light"),r.classList.add("dark")):(r.classList.remove("dark"),r.classList.add("light")),r.style.colorScheme=e?"dark":"light";}function v(e){document.documentElement.style.setProperty("--radius",e);}function E(e){let r=T(e);r&&Q(r.colors);}function ee(e){Q(e.colors);}function $e(){let e=document.getElementById(U);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let r=document.createElement("style");return r.id=U,document.head.appendChild(r),r}function V(e){let{fontFamily:r,googleFontsUrl:o,value:t}=e;if(!o.startsWith("https://fonts.googleapis.com/")){console.warn("[PreviewCN] Invalid font URL");return}let i=`previewcn-font-${t}`;if(!document.getElementById(i)){let n=document.createElement("link");n.id=i,n.rel="stylesheet",n.href=o,document.head.appendChild(n);}let p=$e();p.textContent=`
|
|
3
3
|
:root {
|
|
4
4
|
--font-sans: ${r} !important;
|
|
5
5
|
--font-sans-override: ${r} !important;
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
html, body, .font-sans {
|
|
9
9
|
font-family: ${r} !important;
|
|
10
10
|
}
|
|
11
|
-
`;}function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`;}function ee(e){let o=P(e);o&&(xe(o),f(o.radius),o.font&&Ne(o.font));}function B(e){e.colorPreset!==null&&x(e.colorPreset),e.radius!==null&&f(e.radius),e.darkMode!==null&&S(e.darkMode),e.font!==null&&N(e.font);}function oe(){let e=document.getElementById(D);e&&e.remove();let o=document.getElementById(U);o&&o.remove();let r=document.documentElement;r.style.removeProperty("--radius"),r.style.removeProperty("color-scheme"),r.classList.remove("light","dark");}var D,U,T=d(()=>{I();$();C();D="previewcn-devtools-theme-colors",U="previewcn-devtools-theme-font";});function Ee(){if(typeof window>"u")return {};try{let e=localStorage.getItem(_);if(e)return JSON.parse(e)}catch{}return {}}function v(e){if(!(typeof window>"u"))try{localStorage.setItem(_,JSON.stringify(e));}catch{}}function te(){let[e,o]=react.useState(()=>({...re,...Ee()})),r=react.useCallback(n=>{o(u=>{let i={...u,colorPreset:n};return v(i),i}),x(n);},[]),t=react.useCallback(n=>{o(u=>{let i={...u,radius:n};return v(i),i}),f(n);},[]),a=react.useCallback(n=>{o(u=>{let i={...u,darkMode:n};return v(i),i}),S(n);},[]),p=react.useCallback(n=>{o(u=>{let i={...u,font:n};return v(i),i}),N(n);},[]),l=react.useCallback(n=>{let u=P(n);u&&(o(i=>{let V={...i,preset:n,radius:u.radius,font:u.font?.value??i.font,colorPreset:null};return v(V),V}),ee(n));},[]),R=react.useCallback(()=>{typeof window<"u"&&localStorage.removeItem(_),oe(),o(re);},[]);return {config:e,setColorPreset:r,setRadius:t,setDarkMode:a,setFont:p,setPresetTheme:l,resetTheme:R}}var _,re,le=d(()=>{"use client";T();C();_="previewcn-devtools-theme";re={colorPreset:null,radius:null,darkMode:null,font:null,preset:null};});function ne({value:e,onChange:o}){return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Theme"}),jsxRuntime.jsx("div",{className:"previewcn-color-grid",children:L.map(r=>{let t=e===r.name,a=r.colors.light.primary;return jsxRuntime.jsx("button",{onClick:()=>o(r.name),className:`previewcn-color-swatch ${t?"previewcn-color-swatch--selected":""}`,style:{backgroundColor:a},"aria-label":r.label,title:r.label},r.name)})})]})}var ae=d(()=>{"use client";I();});function Le(){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function se({value:e,onChange:o}){let[r,t]=react.useState(false),p=b.find(l=>l.value===e)?.label??"Select font...";return jsxRuntime.jsxs("div",{className:`previewcn-section previewcn-surface ${r?"previewcn-section--overlay":""}`,children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Font"}),jsxRuntime.jsxs("div",{className:"previewcn-select-wrapper",children:[jsxRuntime.jsxs("button",{onClick:()=>t(!r),className:"previewcn-select-trigger previewcn-control","aria-expanded":r,children:[jsxRuntime.jsx("span",{children:p}),jsxRuntime.jsx(Le,{})]}),r&&jsxRuntime.jsx("div",{className:"previewcn-select-dropdown",children:b.map(l=>jsxRuntime.jsx("button",{onClick:()=>{o(l.value),t(false);},className:`previewcn-select-option previewcn-option ${e===l.value?"previewcn-option--selected":""}`,children:l.label},l.value))})]})]})}var ce=d(()=>{"use client";$();});function Ie(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M12 2v2"}),jsxRuntime.jsx("path",{d:"M12 20v2"}),jsxRuntime.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),jsxRuntime.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),jsxRuntime.jsx("path",{d:"M2 12h2"}),jsxRuntime.jsx("path",{d:"M20 12h2"}),jsxRuntime.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),jsxRuntime.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function $e(){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function ie({value:e,onChange:o}){let r=e??false;return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Mode"}),jsxRuntime.jsxs("div",{className:"previewcn-mode-toggle",children:[jsxRuntime.jsxs("button",{onClick:()=>o(false),className:`previewcn-mode-btn previewcn-control ${r?"":"previewcn-control--selected"}`,"aria-label":"Light mode",children:[jsxRuntime.jsx(Ie,{}),jsxRuntime.jsx("span",{children:"Light"})]}),jsxRuntime.jsxs("button",{onClick:()=>o(true),className:`previewcn-mode-btn previewcn-control ${r?"previewcn-control--selected":""}`,"aria-label":"Dark mode",children:[jsxRuntime.jsx($e,{}),jsxRuntime.jsx("span",{children:"Dark"})]})]})]})}var de=d(()=>{"use client";});function pe({value:e,onChange:o}){return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("span",{className:"previewcn-label",children:"Presets"}),jsxRuntime.jsx("div",{className:"previewcn-preset-grid",children:O.map(r=>{let t=e===r.name,a=r.colors.light.primary,p=r.colors.light.background;return jsxRuntime.jsxs("button",{onClick:()=>o(r.name),className:`previewcn-preset-card ${t?"previewcn-preset-card--selected":""}`,"aria-label":r.label,"aria-pressed":t,children:[jsxRuntime.jsxs("div",{className:"previewcn-preset-preview",children:[jsxRuntime.jsx("div",{className:"previewcn-preset-color previewcn-preset-color--bg",style:{backgroundColor:p}}),jsxRuntime.jsx("div",{className:"previewcn-preset-color previewcn-preset-color--primary",style:{backgroundColor:a}})]}),jsxRuntime.jsx("span",{className:"previewcn-preset-label",children:r.label})]},r.name)})})]})}var ue=d(()=>{"use client";C();});var he,ge=d(()=>{he=[{name:"none",label:"None",value:"0rem"},{name:"sm",label:"SM",value:"0.3rem"},{name:"md",label:"MD",value:"0.5rem"},{name:"lg",label:"LG",value:"0.625rem"},{name:"xl",label:"XL",value:"0.75rem"},{name:"full",label:"Full",value:"1rem"}];});function ke({value:e,onChange:o}){return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Radius"}),jsxRuntime.jsx("div",{className:"previewcn-radius-grid",children:he.map(r=>{let t=e===r.value;return jsxRuntime.jsxs("button",{onClick:()=>o(r.value),className:`previewcn-radius-btn previewcn-control ${t?"previewcn-control--selected":""}`,title:r.label,children:[jsxRuntime.jsx("span",{className:"previewcn-radius-preview",style:{borderRadius:r.value}}),jsxRuntime.jsx("span",{className:"previewcn-radius-label",children:r.label})]},r.name)})})]})}var fe=d(()=>{"use client";ge();});var ye={};Pe(ye,{default:()=>ve});function Ue(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]})}function Be(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),jsxRuntime.jsx("path",{d:"M3 3v5h5"})]})}function ve({onClose:e}){let{config:o,setColorPreset:r,setRadius:t,setDarkMode:a,setFont:p,setPresetTheme:l,resetTheme:R}=te(),n=react.useRef(false);return react.useEffect(()=>{n.current||(n.current=true,B(o));},[o]),jsxRuntime.jsxs("div",{className:"previewcn-panel",children:[jsxRuntime.jsxs("div",{className:"previewcn-header",children:[jsxRuntime.jsx("div",{className:"previewcn-title",children:jsxRuntime.jsx("span",{className:"previewcn-logo",children:"previewcn"})}),jsxRuntime.jsx("button",{onClick:e,className:"previewcn-control previewcn-control--ghost previewcn-icon-btn previewcn-close-btn","aria-label":"Close",children:jsxRuntime.jsx(Ue,{})})]}),jsxRuntime.jsxs("div",{className:"previewcn-content",children:[jsxRuntime.jsx(pe,{value:o.preset,onChange:l}),jsxRuntime.jsx(ne,{value:o.colorPreset,onChange:r}),jsxRuntime.jsx(ke,{value:o.radius,onChange:t}),jsxRuntime.jsx(se,{value:o.font,onChange:p}),jsxRuntime.jsx(ie,{value:o.darkMode,onChange:a})]}),jsxRuntime.jsx("div",{className:"previewcn-footer",children:jsxRuntime.jsxs("button",{onClick:R,className:"previewcn-control previewcn-control--ghost previewcn-reset-btn",children:[jsxRuntime.jsx(Be,{}),jsxRuntime.jsx("span",{children:"Reset"})]})})]})}var we=d(()=>{"use client";le();T();ae();ce();de();ue();fe();});function Ce(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.555C21.965 6.012 17.461 2 12 2z"})]})}function Y({onClick:e}){return jsxRuntime.jsx("button",{onClick:e,className:"previewcn-trigger","aria-label":"Open PreviewCN theme editor",title:"PreviewCN Theme Editor",children:jsxRuntime.jsx(Ce,{})})}var Je=react.lazy(()=>Promise.resolve().then(()=>(we(),ye))),Ve=process.env.NODE_ENV==="development";function Ye(){let[e,o]=react.useState(false);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e&&jsxRuntime.jsx(Y,{onClick:()=>o(true)}),e&&jsxRuntime.jsx(react.Suspense,{fallback:null,children:jsxRuntime.jsx(Je,{onClose:()=>o(false)})})]})}function ze(){return Ve?jsxRuntime.jsx(Ye,{}):null}T();
|
|
21
|
-
exports.PreviewcnDevtools=ze;exports.applyColors=x;exports.applyDarkMode=S;exports.applyFont=N;exports.applyRadius=f;exports.applyTheme=B;
|
|
11
|
+
`;}function M(e){let r=Z(e);r&&V(r);}function re(e){let r=u(e);r&&(ee(r),v(r.radius),r.font&&V(r.font));}function W(e){let r=e.preset?u(e.preset):null;e.colorPreset!==null?E(e.colorPreset):r&&ee(r);let o=e.radius??r?.radius;o!=null&&v(o),e.darkMode!==null&&N(e.darkMode),e.font!==null?M(e.font):r?.font&&V(r.font);}function oe(){let e=document.getElementById($);e&&e.remove();let r=document.getElementById(U);r&&r.remove();let o=document.documentElement;o.style.removeProperty("--radius"),o.style.removeProperty("color-scheme"),o.classList.remove("light","dark");}var $,U,R=c(()=>{S();D();y();$="previewcn-devtools-theme-colors",U="previewcn-devtools-theme-font";});function Ve(){if(typeof window>"u")return {};try{let e=localStorage.getItem(_);if(e)return JSON.parse(e)}catch{}return {}}function We(e){if(!(typeof window>"u"))try{localStorage.setItem(_,JSON.stringify(e));}catch{}}function ne(){let[e,r]=react.useState(()=>({...te,...Ve()})),o=react.useCallback(l=>{r(d=>{let b=l(d);return We(b),b});},[]),t=react.useCallback(l=>{o(d=>({...d,colorPreset:l})),E(l);},[o]),i=react.useCallback(l=>{o(d=>({...d,radius:l})),v(l);},[o]),p=react.useCallback(l=>{o(d=>({...d,darkMode:l})),N(l);},[o]),n=react.useCallback(l=>{o(d=>({...d,font:l})),M(l);},[o]),P=react.useCallback(l=>{let d=u(l);d&&(o(b=>({...b,preset:l,radius:d.radius,font:d.font?.value??b.font,colorPreset:null})),re(l));},[o]),F=react.useCallback(()=>{typeof window<"u"&&localStorage.removeItem(_),oe(),r(te);},[]);return {config:e,setColorPreset:t,setRadius:i,setDarkMode:p,setFont:n,setPresetTheme:P,resetTheme:F}}var _,te,le=c(()=>{"use client";y();R();_="previewcn-devtools-theme";te={colorPreset:null,radius:null,darkMode:null,font:null,preset:null};});function ae({value:e,onChange:r}){return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Theme"}),jsxRuntime.jsx("div",{className:"previewcn-color-grid",children:O.map(o=>{let t=e===o.name,i=o.colors.light.primary;return jsxRuntime.jsx("button",{onClick:()=>r(o.name),className:`previewcn-color-swatch ${t?"previewcn-color-swatch--selected":""}`,style:{backgroundColor:i},"aria-label":o.label,title:o.label},o.name)})})]})}var se=c(()=>{"use client";S();});function ie(e,r=" "){return Object.entries(e).map(([o,t])=>`${r}--${o}: ${t};`).join(`
|
|
12
|
+
`)}function He(e){if(e.colorPreset){let r=T(e.colorPreset);if(r)return r.colors}if(e.preset){let r=u(e.preset);if(r)return r.colors}return null}function je(e){if(e.radius)return e.radius;if(e.preset){let r=u(e.preset);if(r)return r.radius}return "0.5rem"}function ce(e){return e.colorPreset!==null||e.preset!==null}function de(e){let r=He(e);if(!r)return null;let t={radius:je(e),...r.light},i=r.dark;return `:root {
|
|
13
|
+
${ie(t)}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dark {
|
|
17
|
+
${ie(i)}
|
|
18
|
+
}`}async function pe(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{let r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.left="-999999px",r.style.top="-999999px",document.body.appendChild(r),r.focus(),r.select();let o=document.execCommand("copy");return document.body.removeChild(r),o}catch{return false}}}var ue=c(()=>{S();y();});function Ae(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),jsxRuntime.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function Ye(){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}function ge({config:e}){let[r,o]=react.useState(false),t=!ce(e),i=async()=>{if(t)return;let n=de(e);if(!n)return;await pe(n)&&(o(true),setTimeout(()=>o(false),2e3));},p=["previewcn-control","previewcn-copy-btn",r&&"previewcn-copy-btn--success",t&&"previewcn-copy-btn--disabled"].filter(Boolean).join(" ");return jsxRuntime.jsxs("button",{onClick:i,className:p,disabled:t,"aria-label":r?"Copied!":"Copy CSS",title:t?"Select a theme first":"Copy CSS to clipboard",children:[r?jsxRuntime.jsx(Ye,{}):jsxRuntime.jsx(Ae,{}),jsxRuntime.jsx("span",{children:r?"Copied!":"Copy CSS"})]})}var fe=c(()=>{"use client";ue();});function Ge(){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function me({value:e,onChange:r}){let[o,t]=react.useState(false),p=x.find(n=>n.value===e)?.label??"Select font...";return jsxRuntime.jsxs("div",{className:`previewcn-section previewcn-surface ${o?"previewcn-section--overlay":""}`,children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Font"}),jsxRuntime.jsxs("div",{className:"previewcn-select-wrapper",children:[jsxRuntime.jsxs("button",{onClick:()=>t(!o),className:"previewcn-select-trigger previewcn-control","aria-expanded":o,children:[jsxRuntime.jsx("span",{children:p}),jsxRuntime.jsx(Ge,{})]}),o&&jsxRuntime.jsx("div",{className:"previewcn-select-dropdown",children:x.map(n=>jsxRuntime.jsx("button",{onClick:()=>{r(n.value),t(false);},className:`previewcn-select-option previewcn-option ${e===n.value?"previewcn-option--selected":""}`,children:n.label},n.value))})]})]})}var ke=c(()=>{"use client";D();});function Ke(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M12 2v2"}),jsxRuntime.jsx("path",{d:"M12 20v2"}),jsxRuntime.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),jsxRuntime.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),jsxRuntime.jsx("path",{d:"M2 12h2"}),jsxRuntime.jsx("path",{d:"M20 12h2"}),jsxRuntime.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),jsxRuntime.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function Xe(){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function be({value:e,onChange:r}){let o=e??false;return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Mode"}),jsxRuntime.jsxs("div",{className:"previewcn-mode-toggle",children:[jsxRuntime.jsxs("button",{onClick:()=>r(false),className:`previewcn-mode-btn previewcn-control ${o?"":"previewcn-control--selected"}`,"aria-label":"Light mode",children:[jsxRuntime.jsx(Ke,{}),jsxRuntime.jsx("span",{children:"Light"})]}),jsxRuntime.jsxs("button",{onClick:()=>r(true),className:`previewcn-mode-btn previewcn-control ${o?"previewcn-control--selected":""}`,"aria-label":"Dark mode",children:[jsxRuntime.jsx(Xe,{}),jsxRuntime.jsx("span",{children:"Dark"})]})]})]})}var ye=c(()=>{"use client";});function ve({value:e,onChange:r}){return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("span",{className:"previewcn-label",children:"Presets"}),jsxRuntime.jsx("div",{className:"previewcn-preset-grid",children:B.map(o=>{let t=e===o.name,i=o.colors.light.primary,p=o.colors.light.background;return jsxRuntime.jsxs("button",{onClick:()=>r(o.name),className:`previewcn-preset-card ${t?"previewcn-preset-card--selected":""}`,"aria-label":o.label,"aria-pressed":t,children:[jsxRuntime.jsxs("div",{className:"previewcn-preset-preview",children:[jsxRuntime.jsx("div",{className:"previewcn-preset-color previewcn-preset-color--bg",style:{backgroundColor:p}}),jsxRuntime.jsx("div",{className:"previewcn-preset-color previewcn-preset-color--primary",style:{backgroundColor:i}})]}),jsxRuntime.jsx("span",{className:"previewcn-preset-label",children:o.label})]},o.name)})})]})}var we=c(()=>{"use client";y();});var Ce,Pe=c(()=>{Ce=[{name:"none",label:"None",value:"0rem"},{name:"sm",label:"SM",value:"0.3rem"},{name:"md",label:"MD",value:"0.5rem"},{name:"lg",label:"LG",value:"0.625rem"},{name:"xl",label:"XL",value:"0.75rem"},{name:"full",label:"Full",value:"1rem"}];});function Te({value:e,onChange:r}){return jsxRuntime.jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Radius"}),jsxRuntime.jsx("div",{className:"previewcn-radius-grid",children:Ce.map(o=>{let t=e===o.value;return jsxRuntime.jsxs("button",{onClick:()=>r(o.value),className:`previewcn-radius-btn previewcn-control ${t?"previewcn-control--selected":""}`,title:o.label,children:[jsxRuntime.jsx("span",{className:"previewcn-radius-preview",style:{borderRadius:o.value}}),jsxRuntime.jsx("span",{className:"previewcn-radius-label",children:o.label})]},o.name)})})]})}var Se=c(()=>{"use client";Pe();});var Ne={};Re(Ne,{default:()=>xe});function Qe(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]})}function er(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),jsxRuntime.jsx("path",{d:"M3 3v5h5"})]})}function xe({onClose:e}){let{config:r,setColorPreset:o,setRadius:t,setDarkMode:i,setFont:p,setPresetTheme:n,resetTheme:P}=ne(),F=react.useRef(false);return react.useEffect(()=>{F.current||(F.current=true,W(r));},[r]),jsxRuntime.jsxs("div",{className:"previewcn-panel",children:[jsxRuntime.jsxs("div",{className:"previewcn-header",children:[jsxRuntime.jsx("div",{className:"previewcn-title",children:jsxRuntime.jsx("span",{className:"previewcn-logo",children:"previewcn"})}),jsxRuntime.jsx("button",{onClick:e,className:"previewcn-control previewcn-control--ghost previewcn-icon-btn previewcn-close-btn","aria-label":"Close",children:jsxRuntime.jsx(Qe,{})})]}),jsxRuntime.jsxs("div",{className:"previewcn-content",children:[jsxRuntime.jsx(ve,{value:r.preset,onChange:n}),jsxRuntime.jsx(ae,{value:r.colorPreset,onChange:o}),jsxRuntime.jsx(Te,{value:r.radius,onChange:t}),jsxRuntime.jsx(me,{value:r.font,onChange:p}),jsxRuntime.jsx(be,{value:r.darkMode,onChange:i})]}),jsxRuntime.jsxs("div",{className:"previewcn-footer",children:[jsxRuntime.jsx(ge,{config:r}),jsxRuntime.jsxs("button",{onClick:P,className:"previewcn-control previewcn-control--ghost previewcn-reset-btn",children:[jsxRuntime.jsx(er,{}),jsxRuntime.jsx("span",{children:"Reset"})]})]})]})}var Ee=c(()=>{"use client";le();R();se();fe();ke();ye();we();Se();});function Le(){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.555C21.965 6.012 17.461 2 12 2z"})]})}function A({onClick:e}){return jsxRuntime.jsx("button",{onClick:e,className:"previewcn-trigger","aria-label":"Open PreviewCN theme editor",title:"PreviewCN Theme Editor",children:jsxRuntime.jsx(Le,{})})}var nr=react.lazy(()=>Promise.resolve().then(()=>(Ee(),Ne))),lr=process.env.NODE_ENV==="development";function ar(){let[e,r]=react.useState(false);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e&&jsxRuntime.jsx(A,{onClick:()=>r(true)}),e&&jsxRuntime.jsx(react.Suspense,{fallback:null,children:jsxRuntime.jsx(nr,{onClose:()=>r(false)})})]})}function sr(){return lr?jsxRuntime.jsx(ar,{}):null}R();
|
|
19
|
+
exports.PreviewcnDevtools=sr;exports.applyColors=E;exports.applyDarkMode=N;exports.applyFont=M;exports.applyRadius=v;exports.applyTheme=W;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {lazy,useRef,useEffect,useState,useCallback,Suspense}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var be=Object.defineProperty;var d=(e,o)=>()=>(e&&(o=e(e=0)),o);var Pe=(e,o)=>{for(var r in o)be(e,r,{get:o[r],enumerable:true});};var z,A=d(()=>{z=[{name:"neutral",label:"Neutral",primary:{light:"oklch(0.556 0 0)",dark:"oklch(0.708 0 0)"},primaryForeground:{light:"oklch(0.985 0 0)",dark:"oklch(0.205 0 0)"}},{name:"red",label:"Red",primary:{light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.637 0.237 25.331)"},primaryForeground:{light:"oklch(0.971 0.013 17.38)",dark:"oklch(0.971 0.013 17.38)"},destructive:{light:"oklch(0.505 0.213 27.518)"}},{name:"orange",label:"Orange",primary:{light:"oklch(0.646 0.222 41.116)",dark:"oklch(0.705 0.213 47.604)"},primaryForeground:{light:"oklch(0.98 0.016 73.684)",dark:"oklch(0.98 0.016 73.684)"}},{name:"amber",label:"Amber",primary:{light:"oklch(0.67 0.16 58)",dark:"oklch(0.77 0.16 70)"},primaryForeground:{light:"oklch(0.99 0.02 95)",dark:"oklch(0.28 0.07 46)"}},{name:"yellow",label:"Yellow",primary:{light:"oklch(0.852 0.199 91.936)",dark:"oklch(0.795 0.184 86.047)"},primaryForeground:{light:"oklch(0.421 0.095 57.708)",dark:"oklch(0.421 0.095 57.708)"}},{name:"lime",label:"Lime",primary:{light:"oklch(0.65 0.18 132)",dark:"oklch(0.77 0.20 131)"},primaryForeground:{light:"oklch(0.99 0.03 121)",dark:"oklch(0.27 0.07 132)"}},{name:"green",label:"Green",primary:{light:"oklch(0.648 0.2 131.684)",dark:"oklch(0.648 0.2 131.684)"},primaryForeground:{light:"oklch(0.986 0.031 120.757)",dark:"oklch(0.986 0.031 120.757)"}},{name:"emerald",label:"Emerald",primary:{light:"oklch(0.60 0.13 163)",dark:"oklch(0.70 0.15 162)"},primaryForeground:{light:"oklch(0.98 0.02 166)",dark:"oklch(0.26 0.05 173)"}},{name:"teal",label:"Teal",primary:{light:"oklch(0.60 0.10 185)",dark:"oklch(0.70 0.12 183)"},primaryForeground:{light:"oklch(0.98 0.01 181)",dark:"oklch(0.28 0.04 193)"}},{name:"cyan",label:"Cyan",primary:{light:"oklch(0.61 0.11 222)",dark:"oklch(0.71 0.13 215)"},primaryForeground:{light:"oklch(0.98 0.02 201)",dark:"oklch(0.30 0.05 230)"}},{name:"sky",label:"Sky",primary:{light:"oklch(0.59 0.14 242)",dark:"oklch(0.68 0.15 237)"},primaryForeground:{light:"oklch(0.98 0.01 237)",dark:"oklch(0.29 0.06 243)"}},{name:"blue",label:"Blue",primary:{light:"oklch(0.488 0.243 264.376)",dark:"oklch(0.42 0.18 266)"},primaryForeground:{light:"oklch(0.97 0.014 254.604)",dark:"oklch(0.97 0.014 254.604)"}},{name:"indigo",label:"Indigo",primary:{light:"oklch(0.51 0.23 277)",dark:"oklch(0.59 0.20 277)"},primaryForeground:{light:"oklch(0.96 0.02 272)",dark:"oklch(0.96 0.02 272)"}},{name:"violet",label:"Violet",primary:{light:"oklch(0.541 0.281 293.009)",dark:"oklch(0.606 0.25 292.717)"},primaryForeground:{light:"oklch(0.969 0.016 293.756)",dark:"oklch(0.969 0.016 293.756)"}},{name:"purple",label:"Purple",primary:{light:"oklch(0.56 0.25 302)",dark:"oklch(0.63 0.23 304)"},primaryForeground:{light:"oklch(0.98 0.01 308)",dark:"oklch(0.98 0.01 308)"}},{name:"fuchsia",label:"Fuchsia",primary:{light:"oklch(0.59 0.26 323)",dark:"oklch(0.67 0.26 322)"},primaryForeground:{light:"oklch(0.98 0.02 320)",dark:"oklch(0.98 0.02 320)"}},{name:"pink",label:"Pink",primary:{light:"oklch(0.59 0.22 1)",dark:"oklch(0.66 0.21 354)"},primaryForeground:{light:"oklch(0.97 0.01 343)",dark:"oklch(0.97 0.01 343)"}},{name:"rose",label:"Rose",primary:{light:"oklch(0.586 0.253 17.585)",dark:"oklch(0.645 0.246 16.439)"},primaryForeground:{light:"oklch(0.969 0.015 12.422)",dark:"oklch(0.969 0.015 12.422)"}}];});function Se(e){return {name:e.name,label:e.label,colors:{light:{...G.light,primary:e.primary.light,"primary-foreground":e.primaryForeground?.light??K.light,destructive:e.destructive?.light??j.light},dark:{...G.dark,primary:e.primary.dark,"primary-foreground":e.primaryForeground?.dark??K.dark,destructive:e.destructive?.dark??j.dark}}}}function X(e){return L.find(o=>o.name===e)}var G,j,K,L,I=d(()=>{A();G={light:{background:"oklch(1 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(1 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.145 0 0)",secondary:"oklch(0.97 0 0)","secondary-foreground":"oklch(0.205 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.556 0 0)",accent:"oklch(0.97 0 0)","accent-foreground":"oklch(0.205 0 0)",border:"oklch(0.922 0 0)",input:"oklch(0.922 0 0)",ring:"oklch(0.708 0 0)"},dark:{background:"oklch(0.145 0 0)",foreground:"oklch(0.985 0 0)",card:"oklch(0.205 0 0)","card-foreground":"oklch(0.985 0 0)",popover:"oklch(0.205 0 0)","popover-foreground":"oklch(0.985 0 0)",secondary:"oklch(0.269 0 0)","secondary-foreground":"oklch(0.985 0 0)",muted:"oklch(0.269 0 0)","muted-foreground":"oklch(0.708 0 0)",accent:"oklch(0.269 0 0)","accent-foreground":"oklch(0.985 0 0)",border:"oklch(1 0 0 / 10%)",input:"oklch(1 0 0 / 15%)",ring:"oklch(0.556 0 0)"}},j={light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.704 0.191 22.216)"},K={light:"oklch(0.985 0 0)",dark:"oklch(0.985 0 0)"};L=z.map(Se);});function Z(e){return b.find(o=>o.value===e)}var b,$=d(()=>{b=[{label:"Inter",value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"},{label:"Noto Sans",value:"noto-sans",fontFamily:'"Noto Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},{label:"Nunito Sans",value:"nunito-sans",fontFamily:'"Nunito Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700&display=swap"},{label:"Figtree",value:"figtree",fontFamily:'"Figtree", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap"},{label:"Roboto",value:"roboto",fontFamily:'"Roboto", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"},{label:"Raleway",value:"raleway",fontFamily:'"Raleway", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&display=swap"},{label:"DM Sans",value:"dm-sans",fontFamily:'"DM Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"},{label:"Public Sans",value:"public-sans",fontFamily:'"Public Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&display=swap"},{label:"Outfit",value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"},{label:"JetBrains Mono",value:"jetbrains-mono",fontFamily:'"JetBrains Mono", monospace',googleFontsUrl:"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"}];});function P(e){return O.find(o=>o.name===e)}var O,C=d(()=>{O=[{name:"vercel",label:"Vercel",colors:{light:{background:"oklch(0.99 0 0)",foreground:"oklch(0 0 0)",card:"oklch(1.00 0 0)","card-foreground":"oklch(0 0 0)",popover:"oklch(0.99 0 0)","popover-foreground":"oklch(0 0 0)",primary:"oklch(0 0 0)","primary-foreground":"oklch(1.00 0 0)",secondary:"oklch(0.94 0 0)","secondary-foreground":"oklch(0 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.44 0 0)",accent:"oklch(0.94 0 0)","accent-foreground":"oklch(0 0 0)",destructive:"oklch(0.63 0.19 23.03)","destructive-foreground":"oklch(1.00 0 0)",border:"oklch(0.92 0 0)",input:"oklch(0.94 0 0)",ring:"oklch(0 0 0)"},dark:{background:"oklch(0 0 0)",foreground:"oklch(1.00 0 0)",card:"oklch(0.14 0 0)","card-foreground":"oklch(1.00 0 0)",popover:"oklch(0.18 0 0)","popover-foreground":"oklch(1.00 0 0)",primary:"oklch(1.00 0 0)","primary-foreground":"oklch(0 0 0)",secondary:"oklch(0.25 0 0)","secondary-foreground":"oklch(1.00 0 0)",muted:"oklch(0.23 0 0)","muted-foreground":"oklch(0.72 0 0)",accent:"oklch(0.32 0 0)","accent-foreground":"oklch(1.00 0 0)",destructive:"oklch(0.69 0.20 23.91)","destructive-foreground":"oklch(0 0 0)",border:"oklch(0.26 0 0)",input:"oklch(0.32 0 0)",ring:"oklch(0.72 0 0)"}},radius:"0.5rem",font:{value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"}},{name:"supabase",label:"Supabase",colors:{light:{background:"oklch(0.985 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(0.985 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(0.985 0 0)","popover-foreground":"oklch(0.4 0 0)",primary:"oklch(0.82 0.14 155)","primary-foreground":"oklch(0.2 0.03 155)",secondary:"oklch(0.99 0 0)","secondary-foreground":"oklch(0.145 0 0)",muted:"oklch(0.93 0 0)","muted-foreground":"oklch(0.2 0 0)",accent:"oklch(0.93 0 0)","accent-foreground":"oklch(0.2 0 0)",destructive:"oklch(0.55 0.2 25)","destructive-foreground":"oklch(0.99 0 0)",border:"oklch(0.88 0 0)",input:"oklch(0.96 0 0)",ring:"oklch(0.82 0.14 155)"},dark:{background:"oklch(0.16 0 0)",foreground:"oklch(0.9 0.01 240)",card:"oklch(0.18 0 0)","card-foreground":"oklch(0.9 0.01 240)",popover:"oklch(0.22 0 0)","popover-foreground":"oklch(0.7 0 0)",primary:"oklch(0.45 0.12 155)","primary-foreground":"oklch(0.92 0.02 155)",secondary:"oklch(0.22 0 0)","secondary-foreground":"oklch(0.98 0 0)",muted:"oklch(0.2 0 0)","muted-foreground":"oklch(0.68 0 0)",accent:"oklch(0.28 0 0)","accent-foreground":"oklch(0.98 0 0)",destructive:"oklch(0.35 0.12 25)","destructive-foreground":"oklch(0.92 0.02 25)",border:"oklch(0.25 0 0)",input:"oklch(0.22 0 0)",ring:"oklch(0.72 0.18 145)"}},radius:"0.5rem",font:{value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"}},{name:"claude",label:"Claude",colors:{light:{background:"oklch(0.975 0.01 85)",foreground:"oklch(0.3 0.03 85)",card:"oklch(0.975 0.01 85)","card-foreground":"oklch(0.15 0.01 85)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.22 0.02 85)",primary:"oklch(0.58 0.16 35)","primary-foreground":"oklch(1 0 0)",secondary:"oklch(0.92 0.02 85)","secondary-foreground":"oklch(0.4 0.02 85)",muted:"oklch(0.94 0.015 85)","muted-foreground":"oklch(0.58 0.01 85)",accent:"oklch(0.92 0.02 85)","accent-foreground":"oklch(0.22 0.02 85)",destructive:"oklch(0.15 0.01 85)","destructive-foreground":"oklch(1 0 0)",border:"oklch(0.88 0.01 85)",input:"oklch(0.75 0.01 85)",ring:"oklch(0.58 0.16 35)"},dark:{background:"oklch(0.24 0.01 85)",foreground:"oklch(0.8 0.01 85)",card:"oklch(0.24 0.01 85)","card-foreground":"oklch(0.975 0.01 85)",popover:"oklch(0.28 0.01 85)","popover-foreground":"oklch(0.92 0.005 85)",primary:"oklch(0.65 0.14 35)","primary-foreground":"oklch(1 0 0)",secondary:"oklch(0.975 0.01 85)","secondary-foreground":"oklch(0.28 0.01 85)",muted:"oklch(0.2 0.01 85)","muted-foreground":"oklch(0.76 0.01 85)",accent:"oklch(0.18 0.01 85)","accent-foreground":"oklch(0.96 0.01 85)",destructive:"oklch(0.63 0.24 27)","destructive-foreground":"oklch(1 0 0)",border:"oklch(0.32 0.01 85)",input:"oklch(0.4 0.01 85)",ring:"oklch(0.65 0.14 35)"}},radius:"0.5rem"}];});function q(){let e=document.getElementById(D);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let o=document.createElement("style");return o.id=D,document.head.appendChild(o),o}function F(e){return Object.entries(e).map(([o,r])=>`--${o}: ${r};`).join(" ")}function S(e){let o=document.documentElement;e?(o.classList.remove("light"),o.classList.add("dark")):(o.classList.remove("dark"),o.classList.add("light")),o.style.colorScheme=e?"dark":"light";}function f(e){document.documentElement.style.setProperty("--radius",e);}function x(e){let o=X(e);if(!o)return;let r=q(),t=F(o.colors.light),a=F(o.colors.dark);r.textContent=`:root { ${t} } .dark { ${a} }`;}function xe(e){let o=q(),r=F(e.colors.light),t=F(e.colors.dark);o.textContent=`:root { ${r} } .dark { ${t} }`;}function Q(){let e=document.getElementById(U);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let o=document.createElement("style");return o.id=U,document.head.appendChild(o),o}function N(e){let o=Z(e);if(!o)return;let{fontFamily:r,googleFontsUrl:t}=o;if(!t.startsWith("https://fonts.googleapis.com/")){console.warn("[PreviewCN] Invalid font URL");return}let a=`previewcn-font-${e}`;if(!document.getElementById(a)){let l=document.createElement("link");l.id=a,l.rel="stylesheet",l.href=t,document.head.appendChild(l);}let p=Q();p.textContent=`
|
|
2
|
+
import {lazy,useRef,useEffect,useState,useCallback,Suspense}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var Me=Object.defineProperty;var c=(e,r)=>()=>(e&&(r=e(e=0)),r);var Re=(e,r)=>{for(var o in r)Me(e,o,{get:r[o],enumerable:true});};function u(e){return Be.get(e)}var B,Be,y=c(()=>{B=[{name:"vercel",label:"Vercel",colors:{light:{background:"oklch(0.99 0 0)",foreground:"oklch(0 0 0)",card:"oklch(1.00 0 0)","card-foreground":"oklch(0 0 0)",popover:"oklch(0.99 0 0)","popover-foreground":"oklch(0 0 0)",primary:"oklch(0 0 0)","primary-foreground":"oklch(1.00 0 0)",secondary:"oklch(0.94 0 0)","secondary-foreground":"oklch(0 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.44 0 0)",accent:"oklch(0.94 0 0)","accent-foreground":"oklch(0 0 0)",destructive:"oklch(0.63 0.19 23.03)","destructive-foreground":"oklch(1.00 0 0)",border:"oklch(0.92 0 0)",input:"oklch(0.94 0 0)",ring:"oklch(0 0 0)","chart-1":"oklch(0.81 0.17 75.35)","chart-2":"oklch(0.55 0.22 264.53)","chart-3":"oklch(0.72 0 0)","chart-4":"oklch(0.92 0 0)","chart-5":"oklch(0.56 0 0)",sidebar:"oklch(0.99 0 0)","sidebar-foreground":"oklch(0 0 0)","sidebar-primary":"oklch(0 0 0)","sidebar-primary-foreground":"oklch(1.00 0 0)","sidebar-accent":"oklch(0.94 0 0)","sidebar-accent-foreground":"oklch(0 0 0)","sidebar-border":"oklch(0.94 0 0)","sidebar-ring":"oklch(0 0 0)"},dark:{background:"oklch(0 0 0)",foreground:"oklch(1.00 0 0)",card:"oklch(0.14 0 0)","card-foreground":"oklch(1.00 0 0)",popover:"oklch(0.18 0 0)","popover-foreground":"oklch(1.00 0 0)",primary:"oklch(1.00 0 0)","primary-foreground":"oklch(0 0 0)",secondary:"oklch(0.25 0 0)","secondary-foreground":"oklch(1.00 0 0)",muted:"oklch(0.23 0 0)","muted-foreground":"oklch(0.72 0 0)",accent:"oklch(0.32 0 0)","accent-foreground":"oklch(1.00 0 0)",destructive:"oklch(0.69 0.20 23.91)","destructive-foreground":"oklch(0 0 0)",border:"oklch(0.26 0 0)",input:"oklch(0.32 0 0)",ring:"oklch(0.72 0 0)","chart-1":"oklch(0.81 0.17 75.35)","chart-2":"oklch(0.58 0.21 260.84)","chart-3":"oklch(0.56 0 0)","chart-4":"oklch(0.44 0 0)","chart-5":"oklch(0.92 0 0)",sidebar:"oklch(0.18 0 0)","sidebar-foreground":"oklch(1.00 0 0)","sidebar-primary":"oklch(1.00 0 0)","sidebar-primary-foreground":"oklch(0 0 0)","sidebar-accent":"oklch(0.32 0 0)","sidebar-accent-foreground":"oklch(1.00 0 0)","sidebar-border":"oklch(0.32 0 0)","sidebar-ring":"oklch(0.72 0 0)"}},radius:"0.5rem",font:{value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"}},{name:"supabase",label:"Supabase",colors:{light:{background:"#fcfcfc",foreground:"#171717",card:"#fcfcfc","card-foreground":"#171717",popover:"#fcfcfc","popover-foreground":"#525252",primary:"#72e3ad","primary-foreground":"#1e2723",secondary:"#fdfdfd","secondary-foreground":"#171717",muted:"#ededed","muted-foreground":"#202020",accent:"#ededed","accent-foreground":"#202020",destructive:"#ca3214","destructive-foreground":"#fffcfc",border:"#dfdfdf",input:"#f6f6f6",ring:"#72e3ad","chart-1":"#72e3ad","chart-2":"#3b82f6","chart-3":"#8b5cf6","chart-4":"#f59e0b","chart-5":"#10b981",sidebar:"#fcfcfc","sidebar-foreground":"#707070","sidebar-primary":"#72e3ad","sidebar-primary-foreground":"#1e2723","sidebar-accent":"#ededed","sidebar-accent-foreground":"#202020","sidebar-border":"#dfdfdf","sidebar-ring":"#72e3ad"},dark:{background:"#121212",foreground:"#e2e8f0",card:"#171717","card-foreground":"#e2e8f0",popover:"#242424","popover-foreground":"#a9a9a9",primary:"#006239","primary-foreground":"#dde8e3",secondary:"#242424","secondary-foreground":"#fafafa",muted:"#1f1f1f","muted-foreground":"#a2a2a2",accent:"#313131","accent-foreground":"#fafafa",destructive:"#541c15","destructive-foreground":"#ede9e8",border:"#292929",input:"#242424",ring:"#4ade80","chart-1":"#4ade80","chart-2":"#60a5fa","chart-3":"#a78bfa","chart-4":"#fbbf24","chart-5":"#2dd4bf",sidebar:"#121212","sidebar-foreground":"#898989","sidebar-primary":"#006239","sidebar-primary-foreground":"#dde8e3","sidebar-accent":"#313131","sidebar-accent-foreground":"#fafafa","sidebar-border":"#292929","sidebar-ring":"#4ade80"}},radius:"0.5rem",font:{value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"}},{name:"claude",label:"Claude",colors:{light:{background:"#faf9f5",foreground:"#3d3929",card:"#faf9f5","card-foreground":"#141413",popover:"#ffffff","popover-foreground":"#28261b",primary:"#c96442","primary-foreground":"#ffffff",secondary:"#e9e6dc","secondary-foreground":"#535146",muted:"#ede9de","muted-foreground":"#83827d",accent:"#e9e6dc","accent-foreground":"#28261b",destructive:"#141413","destructive-foreground":"#ffffff",border:"#dad9d4",input:"#b4b2a7",ring:"#c96442","chart-1":"#b05730","chart-2":"#9c87f5","chart-3":"#ded8c4","chart-4":"#dbd3f0","chart-5":"#b4552d",sidebar:"#f5f4ee","sidebar-foreground":"#3d3d3a","sidebar-primary":"#c96442","sidebar-primary-foreground":"#fbfbfb","sidebar-accent":"#e9e6dc","sidebar-accent-foreground":"#343434","sidebar-border":"#ebebeb","sidebar-ring":"#b5b5b5"},dark:{background:"#262624",foreground:"#c3c0b6",card:"#262624","card-foreground":"#faf9f5",popover:"#30302e","popover-foreground":"#e5e5e2",primary:"#d97757","primary-foreground":"#ffffff",secondary:"#faf9f5","secondary-foreground":"#30302e",muted:"#1b1b19","muted-foreground":"#b7b5a9",accent:"#1a1915","accent-foreground":"#f5f4ee",destructive:"#ef4444","destructive-foreground":"#ffffff",border:"#3e3e38",input:"#52514a",ring:"#d97757","chart-1":"#b05730","chart-2":"#9c87f5","chart-3":"#1a1915","chart-4":"#2f2b48","chart-5":"#b4552d",sidebar:"#1f1e1d","sidebar-foreground":"#c3c0b6","sidebar-primary":"#343434","sidebar-primary-foreground":"#fbfbfb","sidebar-accent":"#0f0f0e","sidebar-accent-foreground":"#c3c0b6","sidebar-border":"#ebebeb","sidebar-ring":"#b5b5b5"}},radius:"0.5rem"}],Be=new Map(B.map(e=>[e.name,e]));});var Y,z=c(()=>{Y=[{name:"neutral",label:"Neutral",primary:{light:"oklch(0.556 0 0)",dark:"oklch(0.708 0 0)"},primaryForeground:{light:"oklch(0.985 0 0)",dark:"oklch(0.205 0 0)"}},{name:"red",label:"Red",primary:{light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.637 0.237 25.331)"},primaryForeground:{light:"oklch(0.971 0.013 17.38)",dark:"oklch(0.971 0.013 17.38)"},destructive:{light:"oklch(0.505 0.213 27.518)"}},{name:"orange",label:"Orange",primary:{light:"oklch(0.646 0.222 41.116)",dark:"oklch(0.705 0.213 47.604)"},primaryForeground:{light:"oklch(0.98 0.016 73.684)",dark:"oklch(0.98 0.016 73.684)"}},{name:"amber",label:"Amber",primary:{light:"oklch(0.67 0.16 58)",dark:"oklch(0.77 0.16 70)"},primaryForeground:{light:"oklch(0.99 0.02 95)",dark:"oklch(0.28 0.07 46)"}},{name:"yellow",label:"Yellow",primary:{light:"oklch(0.852 0.199 91.936)",dark:"oklch(0.795 0.184 86.047)"},primaryForeground:{light:"oklch(0.421 0.095 57.708)",dark:"oklch(0.421 0.095 57.708)"}},{name:"lime",label:"Lime",primary:{light:"oklch(0.65 0.18 132)",dark:"oklch(0.77 0.20 131)"},primaryForeground:{light:"oklch(0.99 0.03 121)",dark:"oklch(0.27 0.07 132)"}},{name:"green",label:"Green",primary:{light:"oklch(0.648 0.2 131.684)",dark:"oklch(0.648 0.2 131.684)"},primaryForeground:{light:"oklch(0.986 0.031 120.757)",dark:"oklch(0.986 0.031 120.757)"}},{name:"emerald",label:"Emerald",primary:{light:"oklch(0.60 0.13 163)",dark:"oklch(0.70 0.15 162)"},primaryForeground:{light:"oklch(0.98 0.02 166)",dark:"oklch(0.26 0.05 173)"}},{name:"teal",label:"Teal",primary:{light:"oklch(0.60 0.10 185)",dark:"oklch(0.70 0.12 183)"},primaryForeground:{light:"oklch(0.98 0.01 181)",dark:"oklch(0.28 0.04 193)"}},{name:"cyan",label:"Cyan",primary:{light:"oklch(0.61 0.11 222)",dark:"oklch(0.71 0.13 215)"},primaryForeground:{light:"oklch(0.98 0.02 201)",dark:"oklch(0.30 0.05 230)"}},{name:"sky",label:"Sky",primary:{light:"oklch(0.59 0.14 242)",dark:"oklch(0.68 0.15 237)"},primaryForeground:{light:"oklch(0.98 0.01 237)",dark:"oklch(0.29 0.06 243)"}},{name:"blue",label:"Blue",primary:{light:"oklch(0.488 0.243 264.376)",dark:"oklch(0.42 0.18 266)"},primaryForeground:{light:"oklch(0.97 0.014 254.604)",dark:"oklch(0.97 0.014 254.604)"}},{name:"indigo",label:"Indigo",primary:{light:"oklch(0.51 0.23 277)",dark:"oklch(0.59 0.20 277)"},primaryForeground:{light:"oklch(0.96 0.02 272)",dark:"oklch(0.96 0.02 272)"}},{name:"violet",label:"Violet",primary:{light:"oklch(0.541 0.281 293.009)",dark:"oklch(0.606 0.25 292.717)"},primaryForeground:{light:"oklch(0.969 0.016 293.756)",dark:"oklch(0.969 0.016 293.756)"}},{name:"purple",label:"Purple",primary:{light:"oklch(0.56 0.25 302)",dark:"oklch(0.63 0.23 304)"},primaryForeground:{light:"oklch(0.98 0.01 308)",dark:"oklch(0.98 0.01 308)"}},{name:"fuchsia",label:"Fuchsia",primary:{light:"oklch(0.59 0.26 323)",dark:"oklch(0.67 0.26 322)"},primaryForeground:{light:"oklch(0.98 0.02 320)",dark:"oklch(0.98 0.02 320)"}},{name:"pink",label:"Pink",primary:{light:"oklch(0.59 0.22 1)",dark:"oklch(0.66 0.21 354)"},primaryForeground:{light:"oklch(0.97 0.01 343)",dark:"oklch(0.97 0.01 343)"}},{name:"rose",label:"Rose",primary:{light:"oklch(0.586 0.253 17.585)",dark:"oklch(0.645 0.246 16.439)"},primaryForeground:{light:"oklch(0.969 0.015 12.422)",dark:"oklch(0.969 0.015 12.422)"}}];});function Oe(e){return {name:e.name,label:e.label,colors:{light:{...G.light,primary:e.primary.light,"primary-foreground":e.primaryForeground?.light??X.light,destructive:e.destructive?.light??K.light},dark:{...G.dark,primary:e.primary.dark,"primary-foreground":e.primaryForeground?.dark??X.dark,destructive:e.destructive?.dark??K.dark}}}}function T(e){return O.find(r=>r.name===e)}var G,K,X,O,S=c(()=>{z();G={light:{background:"oklch(1 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(1 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.145 0 0)",secondary:"oklch(0.97 0 0)","secondary-foreground":"oklch(0.205 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.556 0 0)",accent:"oklch(0.97 0 0)","accent-foreground":"oklch(0.205 0 0)",border:"oklch(0.922 0 0)",input:"oklch(0.922 0 0)",ring:"oklch(0.708 0 0)"},dark:{background:"oklch(0.145 0 0)",foreground:"oklch(0.985 0 0)",card:"oklch(0.205 0 0)","card-foreground":"oklch(0.985 0 0)",popover:"oklch(0.205 0 0)","popover-foreground":"oklch(0.985 0 0)",secondary:"oklch(0.269 0 0)","secondary-foreground":"oklch(0.985 0 0)",muted:"oklch(0.269 0 0)","muted-foreground":"oklch(0.708 0 0)",accent:"oklch(0.269 0 0)","accent-foreground":"oklch(0.985 0 0)",border:"oklch(1 0 0 / 10%)",input:"oklch(1 0 0 / 15%)",ring:"oklch(0.556 0 0)"}},K={light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.704 0.191 22.216)"},X={light:"oklch(0.985 0 0)",dark:"oklch(0.985 0 0)"};O=Y.map(Oe);});function Z(e){return x.find(r=>r.value===e)}var x,D=c(()=>{x=[{label:"Inter",value:"inter",fontFamily:'"Inter", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"},{label:"Noto Sans",value:"noto-sans",fontFamily:'"Noto Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},{label:"Nunito Sans",value:"nunito-sans",fontFamily:'"Nunito Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700&display=swap"},{label:"Figtree",value:"figtree",fontFamily:'"Figtree", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap"},{label:"Roboto",value:"roboto",fontFamily:'"Roboto", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"},{label:"Raleway",value:"raleway",fontFamily:'"Raleway", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&display=swap"},{label:"DM Sans",value:"dm-sans",fontFamily:'"DM Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"},{label:"Public Sans",value:"public-sans",fontFamily:'"Public Sans", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&display=swap"},{label:"Outfit",value:"outfit",fontFamily:'"Outfit", sans-serif',googleFontsUrl:"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap"},{label:"JetBrains Mono",value:"jetbrains-mono",fontFamily:'"JetBrains Mono", monospace',googleFontsUrl:"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"}];});function De(){let e=document.getElementById($);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let r=document.createElement("style");return r.id=$,document.head.appendChild(r),r}function q(e){return Object.entries(e).map(([r,o])=>`--${r}: ${o};`).join(" ")}function Q(e){let r=De(),o=q(e.light),t=q(e.dark);r.textContent=`:root { ${o} } .dark { ${t} }`;}function N(e){let r=document.documentElement;e?(r.classList.remove("light"),r.classList.add("dark")):(r.classList.remove("dark"),r.classList.add("light")),r.style.colorScheme=e?"dark":"light";}function v(e){document.documentElement.style.setProperty("--radius",e);}function E(e){let r=T(e);r&&Q(r.colors);}function ee(e){Q(e.colors);}function $e(){let e=document.getElementById(U);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let r=document.createElement("style");return r.id=U,document.head.appendChild(r),r}function V(e){let{fontFamily:r,googleFontsUrl:o,value:t}=e;if(!o.startsWith("https://fonts.googleapis.com/")){console.warn("[PreviewCN] Invalid font URL");return}let i=`previewcn-font-${t}`;if(!document.getElementById(i)){let n=document.createElement("link");n.id=i,n.rel="stylesheet",n.href=o,document.head.appendChild(n);}let p=$e();p.textContent=`
|
|
3
3
|
:root {
|
|
4
4
|
--font-sans: ${r} !important;
|
|
5
5
|
--font-sans-override: ${r} !important;
|
|
@@ -8,14 +8,12 @@ import {lazy,useRef,useEffect,useState,useCallback,Suspense}from'react';import {
|
|
|
8
8
|
html, body, .font-sans {
|
|
9
9
|
font-family: ${r} !important;
|
|
10
10
|
}
|
|
11
|
-
`;}function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`;}function ee(e){let o=P(e);o&&(xe(o),f(o.radius),o.font&&Ne(o.font));}function B(e){e.colorPreset!==null&&x(e.colorPreset),e.radius!==null&&f(e.radius),e.darkMode!==null&&S(e.darkMode),e.font!==null&&N(e.font);}function oe(){let e=document.getElementById(D);e&&e.remove();let o=document.getElementById(U);o&&o.remove();let r=document.documentElement;r.style.removeProperty("--radius"),r.style.removeProperty("color-scheme"),r.classList.remove("light","dark");}var D,U,T=d(()=>{I();$();C();D="previewcn-devtools-theme-colors",U="previewcn-devtools-theme-font";});function Ee(){if(typeof window>"u")return {};try{let e=localStorage.getItem(_);if(e)return JSON.parse(e)}catch{}return {}}function v(e){if(!(typeof window>"u"))try{localStorage.setItem(_,JSON.stringify(e));}catch{}}function te(){let[e,o]=useState(()=>({...re,...Ee()})),r=useCallback(n=>{o(u=>{let i={...u,colorPreset:n};return v(i),i}),x(n);},[]),t=useCallback(n=>{o(u=>{let i={...u,radius:n};return v(i),i}),f(n);},[]),a=useCallback(n=>{o(u=>{let i={...u,darkMode:n};return v(i),i}),S(n);},[]),p=useCallback(n=>{o(u=>{let i={...u,font:n};return v(i),i}),N(n);},[]),l=useCallback(n=>{let u=P(n);u&&(o(i=>{let V={...i,preset:n,radius:u.radius,font:u.font?.value??i.font,colorPreset:null};return v(V),V}),ee(n));},[]),R=useCallback(()=>{typeof window<"u"&&localStorage.removeItem(_),oe(),o(re);},[]);return {config:e,setColorPreset:r,setRadius:t,setDarkMode:a,setFont:p,setPresetTheme:l,resetTheme:R}}var _,re,le=d(()=>{"use client";T();C();_="previewcn-devtools-theme";re={colorPreset:null,radius:null,darkMode:null,font:null,preset:null};});function ne({value:e,onChange:o}){return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("label",{className:"previewcn-label",children:"Theme"}),jsx("div",{className:"previewcn-color-grid",children:L.map(r=>{let t=e===r.name,a=r.colors.light.primary;return jsx("button",{onClick:()=>o(r.name),className:`previewcn-color-swatch ${t?"previewcn-color-swatch--selected":""}`,style:{backgroundColor:a},"aria-label":r.label,title:r.label},r.name)})})]})}var ae=d(()=>{"use client";I();});function Le(){return jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m6 9 6 6 6-6"})})}function se({value:e,onChange:o}){let[r,t]=useState(false),p=b.find(l=>l.value===e)?.label??"Select font...";return jsxs("div",{className:`previewcn-section previewcn-surface ${r?"previewcn-section--overlay":""}`,children:[jsx("label",{className:"previewcn-label",children:"Font"}),jsxs("div",{className:"previewcn-select-wrapper",children:[jsxs("button",{onClick:()=>t(!r),className:"previewcn-select-trigger previewcn-control","aria-expanded":r,children:[jsx("span",{children:p}),jsx(Le,{})]}),r&&jsx("div",{className:"previewcn-select-dropdown",children:b.map(l=>jsx("button",{onClick:()=>{o(l.value),t(false);},className:`previewcn-select-option previewcn-option ${e===l.value?"previewcn-option--selected":""}`,children:l.label},l.value))})]})]})}var ce=d(()=>{"use client";$();});function Ie(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M12 2v2"}),jsx("path",{d:"M12 20v2"}),jsx("path",{d:"m4.93 4.93 1.41 1.41"}),jsx("path",{d:"m17.66 17.66 1.41 1.41"}),jsx("path",{d:"M2 12h2"}),jsx("path",{d:"M20 12h2"}),jsx("path",{d:"m6.34 17.66-1.41 1.41"}),jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function $e(){return jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function ie({value:e,onChange:o}){let r=e??false;return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("label",{className:"previewcn-label",children:"Mode"}),jsxs("div",{className:"previewcn-mode-toggle",children:[jsxs("button",{onClick:()=>o(false),className:`previewcn-mode-btn previewcn-control ${r?"":"previewcn-control--selected"}`,"aria-label":"Light mode",children:[jsx(Ie,{}),jsx("span",{children:"Light"})]}),jsxs("button",{onClick:()=>o(true),className:`previewcn-mode-btn previewcn-control ${r?"previewcn-control--selected":""}`,"aria-label":"Dark mode",children:[jsx($e,{}),jsx("span",{children:"Dark"})]})]})]})}var de=d(()=>{"use client";});function pe({value:e,onChange:o}){return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("span",{className:"previewcn-label",children:"Presets"}),jsx("div",{className:"previewcn-preset-grid",children:O.map(r=>{let t=e===r.name,a=r.colors.light.primary,p=r.colors.light.background;return jsxs("button",{onClick:()=>o(r.name),className:`previewcn-preset-card ${t?"previewcn-preset-card--selected":""}`,"aria-label":r.label,"aria-pressed":t,children:[jsxs("div",{className:"previewcn-preset-preview",children:[jsx("div",{className:"previewcn-preset-color previewcn-preset-color--bg",style:{backgroundColor:p}}),jsx("div",{className:"previewcn-preset-color previewcn-preset-color--primary",style:{backgroundColor:a}})]}),jsx("span",{className:"previewcn-preset-label",children:r.label})]},r.name)})})]})}var ue=d(()=>{"use client";C();});var he,ge=d(()=>{he=[{name:"none",label:"None",value:"0rem"},{name:"sm",label:"SM",value:"0.3rem"},{name:"md",label:"MD",value:"0.5rem"},{name:"lg",label:"LG",value:"0.625rem"},{name:"xl",label:"XL",value:"0.75rem"},{name:"full",label:"Full",value:"1rem"}];});function ke({value:e,onChange:o}){return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("label",{className:"previewcn-label",children:"Radius"}),jsx("div",{className:"previewcn-radius-grid",children:he.map(r=>{let t=e===r.value;return jsxs("button",{onClick:()=>o(r.value),className:`previewcn-radius-btn previewcn-control ${t?"previewcn-control--selected":""}`,title:r.label,children:[jsx("span",{className:"previewcn-radius-preview",style:{borderRadius:r.value}}),jsx("span",{className:"previewcn-radius-label",children:r.label})]},r.name)})})]})}var fe=d(()=>{"use client";ge();});var ye={};Pe(ye,{default:()=>ve});function Ue(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]})}function Be(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),jsx("path",{d:"M3 3v5h5"})]})}function ve({onClose:e}){let{config:o,setColorPreset:r,setRadius:t,setDarkMode:a,setFont:p,setPresetTheme:l,resetTheme:R}=te(),n=useRef(false);return useEffect(()=>{n.current||(n.current=true,B(o));},[o]),jsxs("div",{className:"previewcn-panel",children:[jsxs("div",{className:"previewcn-header",children:[jsx("div",{className:"previewcn-title",children:jsx("span",{className:"previewcn-logo",children:"previewcn"})}),jsx("button",{onClick:e,className:"previewcn-control previewcn-control--ghost previewcn-icon-btn previewcn-close-btn","aria-label":"Close",children:jsx(Ue,{})})]}),jsxs("div",{className:"previewcn-content",children:[jsx(pe,{value:o.preset,onChange:l}),jsx(ne,{value:o.colorPreset,onChange:r}),jsx(ke,{value:o.radius,onChange:t}),jsx(se,{value:o.font,onChange:p}),jsx(ie,{value:o.darkMode,onChange:a})]}),jsx("div",{className:"previewcn-footer",children:jsxs("button",{onClick:R,className:"previewcn-control previewcn-control--ghost previewcn-reset-btn",children:[jsx(Be,{}),jsx("span",{children:"Reset"})]})})]})}var we=d(()=>{"use client";le();T();ae();ce();de();ue();fe();});function Ce(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),jsx("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),jsx("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),jsx("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.555C21.965 6.012 17.461 2 12 2z"})]})}function Y({onClick:e}){return jsx("button",{onClick:e,className:"previewcn-trigger","aria-label":"Open PreviewCN theme editor",title:"PreviewCN Theme Editor",children:jsx(Ce,{})})}var Je=lazy(()=>Promise.resolve().then(()=>(we(),ye))),Ve=process.env.NODE_ENV==="development";function Ye(){let[e,o]=useState(false);return jsxs(Fragment,{children:[!e&&jsx(Y,{onClick:()=>o(true)}),e&&jsx(Suspense,{fallback:null,children:jsx(Je,{onClose:()=>o(false)})})]})}function ze(){return Ve?jsx(Ye,{}):null}T();
|
|
21
|
-
export{ze as PreviewcnDevtools,x as applyColors,S as applyDarkMode,N as applyFont,f as applyRadius,B as applyTheme};
|
|
11
|
+
`;}function M(e){let r=Z(e);r&&V(r);}function re(e){let r=u(e);r&&(ee(r),v(r.radius),r.font&&V(r.font));}function W(e){let r=e.preset?u(e.preset):null;e.colorPreset!==null?E(e.colorPreset):r&&ee(r);let o=e.radius??r?.radius;o!=null&&v(o),e.darkMode!==null&&N(e.darkMode),e.font!==null?M(e.font):r?.font&&V(r.font);}function oe(){let e=document.getElementById($);e&&e.remove();let r=document.getElementById(U);r&&r.remove();let o=document.documentElement;o.style.removeProperty("--radius"),o.style.removeProperty("color-scheme"),o.classList.remove("light","dark");}var $,U,R=c(()=>{S();D();y();$="previewcn-devtools-theme-colors",U="previewcn-devtools-theme-font";});function Ve(){if(typeof window>"u")return {};try{let e=localStorage.getItem(_);if(e)return JSON.parse(e)}catch{}return {}}function We(e){if(!(typeof window>"u"))try{localStorage.setItem(_,JSON.stringify(e));}catch{}}function ne(){let[e,r]=useState(()=>({...te,...Ve()})),o=useCallback(l=>{r(d=>{let b=l(d);return We(b),b});},[]),t=useCallback(l=>{o(d=>({...d,colorPreset:l})),E(l);},[o]),i=useCallback(l=>{o(d=>({...d,radius:l})),v(l);},[o]),p=useCallback(l=>{o(d=>({...d,darkMode:l})),N(l);},[o]),n=useCallback(l=>{o(d=>({...d,font:l})),M(l);},[o]),P=useCallback(l=>{let d=u(l);d&&(o(b=>({...b,preset:l,radius:d.radius,font:d.font?.value??b.font,colorPreset:null})),re(l));},[o]),F=useCallback(()=>{typeof window<"u"&&localStorage.removeItem(_),oe(),r(te);},[]);return {config:e,setColorPreset:t,setRadius:i,setDarkMode:p,setFont:n,setPresetTheme:P,resetTheme:F}}var _,te,le=c(()=>{"use client";y();R();_="previewcn-devtools-theme";te={colorPreset:null,radius:null,darkMode:null,font:null,preset:null};});function ae({value:e,onChange:r}){return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("label",{className:"previewcn-label",children:"Theme"}),jsx("div",{className:"previewcn-color-grid",children:O.map(o=>{let t=e===o.name,i=o.colors.light.primary;return jsx("button",{onClick:()=>r(o.name),className:`previewcn-color-swatch ${t?"previewcn-color-swatch--selected":""}`,style:{backgroundColor:i},"aria-label":o.label,title:o.label},o.name)})})]})}var se=c(()=>{"use client";S();});function ie(e,r=" "){return Object.entries(e).map(([o,t])=>`${r}--${o}: ${t};`).join(`
|
|
12
|
+
`)}function He(e){if(e.colorPreset){let r=T(e.colorPreset);if(r)return r.colors}if(e.preset){let r=u(e.preset);if(r)return r.colors}return null}function je(e){if(e.radius)return e.radius;if(e.preset){let r=u(e.preset);if(r)return r.radius}return "0.5rem"}function ce(e){return e.colorPreset!==null||e.preset!==null}function de(e){let r=He(e);if(!r)return null;let t={radius:je(e),...r.light},i=r.dark;return `:root {
|
|
13
|
+
${ie(t)}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dark {
|
|
17
|
+
${ie(i)}
|
|
18
|
+
}`}async function pe(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{let r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.left="-999999px",r.style.top="-999999px",document.body.appendChild(r),r.focus(),r.select();let o=document.execCommand("copy");return document.body.removeChild(r),o}catch{return false}}}var ue=c(()=>{S();y();});function Ae(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function Ye(){return jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M20 6 9 17l-5-5"})})}function ge({config:e}){let[r,o]=useState(false),t=!ce(e),i=async()=>{if(t)return;let n=de(e);if(!n)return;await pe(n)&&(o(true),setTimeout(()=>o(false),2e3));},p=["previewcn-control","previewcn-copy-btn",r&&"previewcn-copy-btn--success",t&&"previewcn-copy-btn--disabled"].filter(Boolean).join(" ");return jsxs("button",{onClick:i,className:p,disabled:t,"aria-label":r?"Copied!":"Copy CSS",title:t?"Select a theme first":"Copy CSS to clipboard",children:[r?jsx(Ye,{}):jsx(Ae,{}),jsx("span",{children:r?"Copied!":"Copy CSS"})]})}var fe=c(()=>{"use client";ue();});function Ge(){return jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m6 9 6 6 6-6"})})}function me({value:e,onChange:r}){let[o,t]=useState(false),p=x.find(n=>n.value===e)?.label??"Select font...";return jsxs("div",{className:`previewcn-section previewcn-surface ${o?"previewcn-section--overlay":""}`,children:[jsx("label",{className:"previewcn-label",children:"Font"}),jsxs("div",{className:"previewcn-select-wrapper",children:[jsxs("button",{onClick:()=>t(!o),className:"previewcn-select-trigger previewcn-control","aria-expanded":o,children:[jsx("span",{children:p}),jsx(Ge,{})]}),o&&jsx("div",{className:"previewcn-select-dropdown",children:x.map(n=>jsx("button",{onClick:()=>{r(n.value),t(false);},className:`previewcn-select-option previewcn-option ${e===n.value?"previewcn-option--selected":""}`,children:n.label},n.value))})]})]})}var ke=c(()=>{"use client";D();});function Ke(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M12 2v2"}),jsx("path",{d:"M12 20v2"}),jsx("path",{d:"m4.93 4.93 1.41 1.41"}),jsx("path",{d:"m17.66 17.66 1.41 1.41"}),jsx("path",{d:"M2 12h2"}),jsx("path",{d:"M20 12h2"}),jsx("path",{d:"m6.34 17.66-1.41 1.41"}),jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function Xe(){return jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function be({value:e,onChange:r}){let o=e??false;return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("label",{className:"previewcn-label",children:"Mode"}),jsxs("div",{className:"previewcn-mode-toggle",children:[jsxs("button",{onClick:()=>r(false),className:`previewcn-mode-btn previewcn-control ${o?"":"previewcn-control--selected"}`,"aria-label":"Light mode",children:[jsx(Ke,{}),jsx("span",{children:"Light"})]}),jsxs("button",{onClick:()=>r(true),className:`previewcn-mode-btn previewcn-control ${o?"previewcn-control--selected":""}`,"aria-label":"Dark mode",children:[jsx(Xe,{}),jsx("span",{children:"Dark"})]})]})]})}var ye=c(()=>{"use client";});function ve({value:e,onChange:r}){return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("span",{className:"previewcn-label",children:"Presets"}),jsx("div",{className:"previewcn-preset-grid",children:B.map(o=>{let t=e===o.name,i=o.colors.light.primary,p=o.colors.light.background;return jsxs("button",{onClick:()=>r(o.name),className:`previewcn-preset-card ${t?"previewcn-preset-card--selected":""}`,"aria-label":o.label,"aria-pressed":t,children:[jsxs("div",{className:"previewcn-preset-preview",children:[jsx("div",{className:"previewcn-preset-color previewcn-preset-color--bg",style:{backgroundColor:p}}),jsx("div",{className:"previewcn-preset-color previewcn-preset-color--primary",style:{backgroundColor:i}})]}),jsx("span",{className:"previewcn-preset-label",children:o.label})]},o.name)})})]})}var we=c(()=>{"use client";y();});var Ce,Pe=c(()=>{Ce=[{name:"none",label:"None",value:"0rem"},{name:"sm",label:"SM",value:"0.3rem"},{name:"md",label:"MD",value:"0.5rem"},{name:"lg",label:"LG",value:"0.625rem"},{name:"xl",label:"XL",value:"0.75rem"},{name:"full",label:"Full",value:"1rem"}];});function Te({value:e,onChange:r}){return jsxs("div",{className:"previewcn-section previewcn-surface",children:[jsx("label",{className:"previewcn-label",children:"Radius"}),jsx("div",{className:"previewcn-radius-grid",children:Ce.map(o=>{let t=e===o.value;return jsxs("button",{onClick:()=>r(o.value),className:`previewcn-radius-btn previewcn-control ${t?"previewcn-control--selected":""}`,title:o.label,children:[jsx("span",{className:"previewcn-radius-preview",style:{borderRadius:o.value}}),jsx("span",{className:"previewcn-radius-label",children:o.label})]},o.name)})})]})}var Se=c(()=>{"use client";Pe();});var Ne={};Re(Ne,{default:()=>xe});function Qe(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]})}function er(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),jsx("path",{d:"M3 3v5h5"})]})}function xe({onClose:e}){let{config:r,setColorPreset:o,setRadius:t,setDarkMode:i,setFont:p,setPresetTheme:n,resetTheme:P}=ne(),F=useRef(false);return useEffect(()=>{F.current||(F.current=true,W(r));},[r]),jsxs("div",{className:"previewcn-panel",children:[jsxs("div",{className:"previewcn-header",children:[jsx("div",{className:"previewcn-title",children:jsx("span",{className:"previewcn-logo",children:"previewcn"})}),jsx("button",{onClick:e,className:"previewcn-control previewcn-control--ghost previewcn-icon-btn previewcn-close-btn","aria-label":"Close",children:jsx(Qe,{})})]}),jsxs("div",{className:"previewcn-content",children:[jsx(ve,{value:r.preset,onChange:n}),jsx(ae,{value:r.colorPreset,onChange:o}),jsx(Te,{value:r.radius,onChange:t}),jsx(me,{value:r.font,onChange:p}),jsx(be,{value:r.darkMode,onChange:i})]}),jsxs("div",{className:"previewcn-footer",children:[jsx(ge,{config:r}),jsxs("button",{onClick:P,className:"previewcn-control previewcn-control--ghost previewcn-reset-btn",children:[jsx(er,{}),jsx("span",{children:"Reset"})]})]})]})}var Ee=c(()=>{"use client";le();R();se();fe();ke();ye();we();Se();});function Le(){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),jsx("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),jsx("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),jsx("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.555C21.965 6.012 17.461 2 12 2z"})]})}function A({onClick:e}){return jsx("button",{onClick:e,className:"previewcn-trigger","aria-label":"Open PreviewCN theme editor",title:"PreviewCN Theme Editor",children:jsx(Le,{})})}var nr=lazy(()=>Promise.resolve().then(()=>(Ee(),Ne))),lr=process.env.NODE_ENV==="development";function ar(){let[e,r]=useState(false);return jsxs(Fragment,{children:[!e&&jsx(A,{onClick:()=>r(true)}),e&&jsx(Suspense,{fallback:null,children:jsx(nr,{onClose:()=>r(false)})})]})}function sr(){return lr?jsx(ar,{}):null}R();
|
|
19
|
+
export{sr as PreviewcnDevtools,E as applyColors,N as applyDarkMode,M as applyFont,v as applyRadius,W as applyTheme};
|
package/dist/styles.css
CHANGED
|
@@ -173,6 +173,9 @@
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
@layer utilities {
|
|
176
|
+
.fixed {
|
|
177
|
+
position: fixed;
|
|
178
|
+
}
|
|
176
179
|
.border {
|
|
177
180
|
border-style: var(--tw-border-style);
|
|
178
181
|
border-width: 1px;
|
|
@@ -600,6 +603,23 @@
|
|
|
600
603
|
gap: 6px;
|
|
601
604
|
font-size: 12px;
|
|
602
605
|
}
|
|
606
|
+
.previewcn-copy-btn {
|
|
607
|
+
gap: 6px;
|
|
608
|
+
font-size: 12px;
|
|
609
|
+
margin-right: auto;
|
|
610
|
+
}
|
|
611
|
+
.previewcn-copy-btn--success {
|
|
612
|
+
border-color: oklch(0.72 0.17 142);
|
|
613
|
+
color: oklch(0.72 0.17 142);
|
|
614
|
+
}
|
|
615
|
+
.previewcn-copy-btn--disabled {
|
|
616
|
+
opacity: 0.5;
|
|
617
|
+
cursor: not-allowed;
|
|
618
|
+
}
|
|
619
|
+
.previewcn-copy-btn--disabled:hover {
|
|
620
|
+
background: var(--pcn-surface);
|
|
621
|
+
border-color: var(--pcn-border);
|
|
622
|
+
}
|
|
603
623
|
@keyframes previewcn-rise {
|
|
604
624
|
from {
|
|
605
625
|
opacity: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@previewcn/devtools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Embedded devtools for PreviewCN - real-time shadcn/ui theme preview inside your app",
|
|
5
5
|
"keywords": ["shadcn", "shadcn-ui", "theme", "preview", "devtools", "react", "tailwind"],
|
|
6
6
|
"license": "MIT",
|