@previewcn/devtools 0.1.0-alpha.1
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/README.md +63 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +2 -0
- package/dist/styles.css +615 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @previewcn/devtools
|
|
2
|
+
|
|
3
|
+
Embedded devtools for PreviewCN - real-time shadcn/ui theme preview inside your app.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **In-app theme editor** - No iframe, no separate server
|
|
8
|
+
- 🎯 **DevTools-style UI** - Click the palette icon to open
|
|
9
|
+
- 💾 **Persistent settings** - Theme choices saved in localStorage
|
|
10
|
+
- 🚀 **Production-safe** - Automatically excluded in production builds
|
|
11
|
+
- âš¡ **Lazy-loaded** - Panel only loads when opened
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Using pnpm
|
|
17
|
+
pnpm add -D @previewcn/devtools
|
|
18
|
+
|
|
19
|
+
# Using npm
|
|
20
|
+
npm install -D @previewcn/devtools
|
|
21
|
+
|
|
22
|
+
# Using yarn
|
|
23
|
+
yarn add -D @previewcn/devtools
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or use the CLI:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx previewcn init --devtools
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Add to your `app/layout.tsx`:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import "@previewcn/devtools/styles.css";
|
|
38
|
+
import { PreviewcnDevtools } from "@previewcn/devtools";
|
|
39
|
+
|
|
40
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
41
|
+
return (
|
|
42
|
+
<html lang="en">
|
|
43
|
+
<body>
|
|
44
|
+
{process.env.NODE_ENV === "development" && <PreviewcnDevtools />}
|
|
45
|
+
{children}
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## How It Works
|
|
53
|
+
|
|
54
|
+
1. A small palette icon appears in the bottom-right corner of your app
|
|
55
|
+
2. Click it to open the theme editor panel
|
|
56
|
+
3. The theme is applied only after user interaction (opening the panel / changing settings)
|
|
57
|
+
4. Changes are applied directly to your app in real-time
|
|
58
|
+
5. Settings are persisted in localStorage
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
|
63
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var de=Object.defineProperty;var p=(e,o)=>()=>(e&&(o=e(e=0)),o);var pe=(e,o)=>{for(var r in o)de(e,r,{get:o[r],enumerable:true});};var U,$=p(()=>{U=[{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 ge(e){return {name:e.name,label:e.label,colors:{light:{...W.light,primary:e.primary.light,"primary-foreground":e.primaryForeground?.light??J.light,destructive:e.destructive?.light??_.light},dark:{...W.dark,primary:e.primary.dark,"primary-foreground":e.primaryForeground?.dark??J.dark,destructive:e.destructive?.dark??_.dark}}}}function V(e){return M.find(o=>o.name===e)}var W,_,J,M,T=p(()=>{$();W={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)"}},_={light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.704 0.191 22.216)"},J={light:"oklch(0.985 0 0)",dark:"oklch(0.985 0 0)"};M=U.map(ge);});function z(e){return y.find(o=>o.value===e)}var y,R=p(()=>{y=[{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 he(){let e=document.getElementById(E);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let o=document.createElement("style");return o.id=E,document.head.appendChild(o),o}function A(e){return Object.entries(e).map(([o,r])=>`--${o}: ${r};`).join(" ")}function w(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 b(e){document.documentElement.style.setProperty("--radius",e);}function C(e){let o=V(e);if(!o)return;let r=he(),n=A(o.colors.light),c=A(o.colors.dark);r.textContent=`:root { ${n} } .dark { ${c} }`;}function P(e){let o=z(e);if(!o)return;let{fontFamily:r,googleFontsUrl:n}=o;if(!n.startsWith("https://fonts.googleapis.com/")){console.warn("[PreviewCN] Invalid font URL");return}let c=`previewcn-font-${e}`;if(!document.getElementById(c)){let a=document.createElement("link");a.id=c,a.rel="stylesheet",a.href=n,document.head.appendChild(a);}let u=document.documentElement;u.style.setProperty("--font-sans-override",r),u.style.setProperty("--font-sans",r);}function L(e){e.colorPreset!==null&&C(e.colorPreset),e.radius!==null&&b(e.radius),e.darkMode!==null&&w(e.darkMode),e.font!==null&&P(e.font);}function G(){let e=document.getElementById(E);e&&e.remove();let o=document.documentElement;o.style.removeProperty("--radius"),o.style.removeProperty("--font-sans-override"),o.style.removeProperty("--font-sans"),o.style.removeProperty("color-scheme"),o.classList.remove("light","dark");}var E,F=p(()=>{T();R();E="previewcn-devtools-theme-colors";});function fe(){if(typeof window>"u")return {};try{let e=localStorage.getItem(D);if(e)return JSON.parse(e)}catch{}return {}}function S(e){if(!(typeof window>"u"))try{localStorage.setItem(D,JSON.stringify(e));}catch{}}function K(){let[e,o]=react.useState(()=>({...H,...fe()})),r=react.useCallback(s=>{o(d=>{let i={...d,colorPreset:s};return S(i),i}),C(s);},[]),n=react.useCallback(s=>{o(d=>{let i={...d,radius:s};return S(i),i}),b(s);},[]),c=react.useCallback(s=>{o(d=>{let i={...d,darkMode:s};return S(i),i}),w(s);},[]),u=react.useCallback(s=>{o(d=>{let i={...d,font:s};return S(i),i}),P(s);},[]),a=react.useCallback(()=>{typeof window<"u"&&localStorage.removeItem(D),G(),o(H);},[]);return {config:e,setColorPreset:r,setRadius:n,setDarkMode:c,setFont:u,resetTheme:a}}var D,H,Y=p(()=>{"use client";F();D="previewcn-devtools-theme";H={colorPreset:null,radius:null,darkMode:null,font:null};});function j({value:e,onChange:o}){return jsxRuntime.jsxs("div",{className:"previewcn-section",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Color"}),jsxRuntime.jsx("div",{className:"previewcn-color-grid",children:M.map(r=>{let n=e===r.name,c=r.colors.light.primary;return jsxRuntime.jsx("button",{onClick:()=>o(r.name),className:`previewcn-color-swatch ${n?"previewcn-color-swatch--selected":""}`,style:{backgroundColor:c},"aria-label":r.label,title:r.label},r.name)})})]})}var X=p(()=>{"use client";T();});function we(){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 Z({value:e,onChange:o}){let[r,n]=react.useState(false),u=y.find(a=>a.value===e)?.label??"Select font...";return jsxRuntime.jsxs("div",{className:"previewcn-section",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Font"}),jsxRuntime.jsxs("div",{className:"previewcn-select-wrapper",children:[jsxRuntime.jsxs("button",{onClick:()=>n(!r),className:"previewcn-select-trigger","aria-expanded":r,children:[jsxRuntime.jsx("span",{children:u}),jsxRuntime.jsx(we,{})]}),r&&jsxRuntime.jsx("div",{className:"previewcn-select-dropdown",children:y.map(a=>jsxRuntime.jsx("button",{onClick:()=>{o(a.value),n(false);},className:`previewcn-select-option ${e===a.value?"previewcn-select-option--selected":""}`,children:a.label},a.value))})]})]})}var q=p(()=>{"use client";R();});function be(){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 Ce(){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 Q({value:e,onChange:o}){let r=e??false;return jsxRuntime.jsxs("div",{className:"previewcn-section",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 ${r?"":"previewcn-mode-btn--selected"}`,"aria-label":"Light mode",children:[jsxRuntime.jsx(be,{}),jsxRuntime.jsx("span",{children:"Light"})]}),jsxRuntime.jsxs("button",{onClick:()=>o(true),className:`previewcn-mode-btn ${r?"previewcn-mode-btn--selected":""}`,"aria-label":"Dark mode",children:[jsxRuntime.jsx(Ce,{}),jsxRuntime.jsx("span",{children:"Dark"})]})]})]})}var ee=p(()=>{"use client";});var oe,re=p(()=>{oe=[{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 le({value:e,onChange:o}){return jsxRuntime.jsxs("div",{className:"previewcn-section",children:[jsxRuntime.jsx("label",{className:"previewcn-label",children:"Radius"}),jsxRuntime.jsx("div",{className:"previewcn-radius-grid",children:oe.map(r=>{let n=e===r.value;return jsxRuntime.jsxs("button",{onClick:()=>o(r.value),className:`previewcn-radius-btn ${n?"previewcn-radius-btn--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 ne=p(()=>{"use client";re();});var ie={};pe(ie,{default:()=>se});function Se(){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 Ne(){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 se({onClose:e}){let{config:o,setColorPreset:r,setRadius:n,setDarkMode:c,setFont:u,resetTheme:a}=K(),s=react.useRef(false);react.useEffect(()=>{s.current||(s.current=true,L(o));},[o]);let d=react.useCallback(v=>{v.key==="Escape"&&e();},[e]);return react.useEffect(()=>(window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)),[d]),jsxRuntime.jsx("div",{className:"previewcn-backdrop",onClick:v=>{v.target===v.currentTarget&&e();},children:jsxRuntime.jsxs("div",{className:"previewcn-panel",children:[jsxRuntime.jsxs("div",{className:"previewcn-header",children:[jsxRuntime.jsxs("div",{className:"previewcn-title",children:[jsxRuntime.jsx("span",{className:"previewcn-logo",children:"PreviewCN"}),jsxRuntime.jsx("span",{className:"previewcn-badge",children:"DEV"})]}),jsxRuntime.jsx("button",{onClick:e,className:"previewcn-close-btn","aria-label":"Close",children:jsxRuntime.jsx(Se,{})})]}),jsxRuntime.jsxs("div",{className:"previewcn-content",children:[jsxRuntime.jsx(j,{value:o.colorPreset,onChange:r}),jsxRuntime.jsx(le,{value:o.radius,onChange:n}),jsxRuntime.jsx(Z,{value:o.font,onChange:u}),jsxRuntime.jsx(Q,{value:o.darkMode,onChange:c})]}),jsxRuntime.jsx("div",{className:"previewcn-footer",children:jsxRuntime.jsxs("button",{onClick:a,className:"previewcn-reset-btn",children:[jsxRuntime.jsx(Ne,{}),jsxRuntime.jsx("span",{children:"Reset"})]})})]})})}var ce=p(()=>{"use client";Y();F();X();q();ee();ne();});function ue(){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 B({onClick:e}){return jsxRuntime.jsx("button",{onClick:e,className:"previewcn-trigger","aria-label":"Open PreviewCN theme editor",title:"PreviewCN Theme Editor",children:jsxRuntime.jsx(ue,{})})}var Re=react.lazy(()=>Promise.resolve().then(()=>(ce(),ie))),Ee=process.env.NODE_ENV==="development";function Le(){let[e,o]=react.useState(false);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(B,{onClick:()=>o(true)}),e&&jsxRuntime.jsx(react.Suspense,{fallback:null,children:jsxRuntime.jsx(Re,{onClose:()=>o(false)})})]})}function De(){return Ee?jsxRuntime.jsx(Le,{}):null}F();
|
|
2
|
+
exports.PreviewcnDevtools=De;exports.applyColors=C;exports.applyDarkMode=w;exports.applyFont=P;exports.applyRadius=b;exports.applyTheme=L;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare function PreviewcnDevtools(): react_jsx_runtime.JSX.Element | null;
|
|
4
|
+
|
|
5
|
+
type ThemeConfig = {
|
|
6
|
+
colorPreset: string | null;
|
|
7
|
+
radius: string | null;
|
|
8
|
+
darkMode: boolean | null;
|
|
9
|
+
font: string | null;
|
|
10
|
+
};
|
|
11
|
+
declare function applyDarkMode(darkMode: boolean): void;
|
|
12
|
+
declare function applyRadius(radius: string): void;
|
|
13
|
+
declare function applyColors(colorPresetName: string): void;
|
|
14
|
+
declare function applyFont(fontId: string): void;
|
|
15
|
+
declare function applyTheme(config: ThemeConfig): void;
|
|
16
|
+
|
|
17
|
+
export { PreviewcnDevtools, type ThemeConfig, applyColors, applyDarkMode, applyFont, applyRadius, applyTheme };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare function PreviewcnDevtools(): react_jsx_runtime.JSX.Element | null;
|
|
4
|
+
|
|
5
|
+
type ThemeConfig = {
|
|
6
|
+
colorPreset: string | null;
|
|
7
|
+
radius: string | null;
|
|
8
|
+
darkMode: boolean | null;
|
|
9
|
+
font: string | null;
|
|
10
|
+
};
|
|
11
|
+
declare function applyDarkMode(darkMode: boolean): void;
|
|
12
|
+
declare function applyRadius(radius: string): void;
|
|
13
|
+
declare function applyColors(colorPresetName: string): void;
|
|
14
|
+
declare function applyFont(fontId: string): void;
|
|
15
|
+
declare function applyTheme(config: ThemeConfig): void;
|
|
16
|
+
|
|
17
|
+
export { PreviewcnDevtools, type ThemeConfig, applyColors, applyDarkMode, applyFont, applyRadius, applyTheme };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {lazy,useRef,useEffect,useCallback,useState,Suspense}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var de=Object.defineProperty;var p=(e,o)=>()=>(e&&(o=e(e=0)),o);var pe=(e,o)=>{for(var r in o)de(e,r,{get:o[r],enumerable:true});};var U,$=p(()=>{U=[{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 ge(e){return {name:e.name,label:e.label,colors:{light:{...W.light,primary:e.primary.light,"primary-foreground":e.primaryForeground?.light??J.light,destructive:e.destructive?.light??_.light},dark:{...W.dark,primary:e.primary.dark,"primary-foreground":e.primaryForeground?.dark??J.dark,destructive:e.destructive?.dark??_.dark}}}}function V(e){return M.find(o=>o.name===e)}var W,_,J,M,T=p(()=>{$();W={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)"}},_={light:"oklch(0.577 0.245 27.325)",dark:"oklch(0.704 0.191 22.216)"},J={light:"oklch(0.985 0 0)",dark:"oklch(0.985 0 0)"};M=U.map(ge);});function z(e){return y.find(o=>o.value===e)}var y,R=p(()=>{y=[{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 he(){let e=document.getElementById(E);if(e instanceof HTMLStyleElement)return e;e&&e.remove();let o=document.createElement("style");return o.id=E,document.head.appendChild(o),o}function A(e){return Object.entries(e).map(([o,r])=>`--${o}: ${r};`).join(" ")}function w(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 b(e){document.documentElement.style.setProperty("--radius",e);}function C(e){let o=V(e);if(!o)return;let r=he(),n=A(o.colors.light),c=A(o.colors.dark);r.textContent=`:root { ${n} } .dark { ${c} }`;}function P(e){let o=z(e);if(!o)return;let{fontFamily:r,googleFontsUrl:n}=o;if(!n.startsWith("https://fonts.googleapis.com/")){console.warn("[PreviewCN] Invalid font URL");return}let c=`previewcn-font-${e}`;if(!document.getElementById(c)){let a=document.createElement("link");a.id=c,a.rel="stylesheet",a.href=n,document.head.appendChild(a);}let u=document.documentElement;u.style.setProperty("--font-sans-override",r),u.style.setProperty("--font-sans",r);}function L(e){e.colorPreset!==null&&C(e.colorPreset),e.radius!==null&&b(e.radius),e.darkMode!==null&&w(e.darkMode),e.font!==null&&P(e.font);}function G(){let e=document.getElementById(E);e&&e.remove();let o=document.documentElement;o.style.removeProperty("--radius"),o.style.removeProperty("--font-sans-override"),o.style.removeProperty("--font-sans"),o.style.removeProperty("color-scheme"),o.classList.remove("light","dark");}var E,F=p(()=>{T();R();E="previewcn-devtools-theme-colors";});function fe(){if(typeof window>"u")return {};try{let e=localStorage.getItem(D);if(e)return JSON.parse(e)}catch{}return {}}function S(e){if(!(typeof window>"u"))try{localStorage.setItem(D,JSON.stringify(e));}catch{}}function K(){let[e,o]=useState(()=>({...H,...fe()})),r=useCallback(s=>{o(d=>{let i={...d,colorPreset:s};return S(i),i}),C(s);},[]),n=useCallback(s=>{o(d=>{let i={...d,radius:s};return S(i),i}),b(s);},[]),c=useCallback(s=>{o(d=>{let i={...d,darkMode:s};return S(i),i}),w(s);},[]),u=useCallback(s=>{o(d=>{let i={...d,font:s};return S(i),i}),P(s);},[]),a=useCallback(()=>{typeof window<"u"&&localStorage.removeItem(D),G(),o(H);},[]);return {config:e,setColorPreset:r,setRadius:n,setDarkMode:c,setFont:u,resetTheme:a}}var D,H,Y=p(()=>{"use client";F();D="previewcn-devtools-theme";H={colorPreset:null,radius:null,darkMode:null,font:null};});function j({value:e,onChange:o}){return jsxs("div",{className:"previewcn-section",children:[jsx("label",{className:"previewcn-label",children:"Color"}),jsx("div",{className:"previewcn-color-grid",children:M.map(r=>{let n=e===r.name,c=r.colors.light.primary;return jsx("button",{onClick:()=>o(r.name),className:`previewcn-color-swatch ${n?"previewcn-color-swatch--selected":""}`,style:{backgroundColor:c},"aria-label":r.label,title:r.label},r.name)})})]})}var X=p(()=>{"use client";T();});function we(){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 Z({value:e,onChange:o}){let[r,n]=useState(false),u=y.find(a=>a.value===e)?.label??"Select font...";return jsxs("div",{className:"previewcn-section",children:[jsx("label",{className:"previewcn-label",children:"Font"}),jsxs("div",{className:"previewcn-select-wrapper",children:[jsxs("button",{onClick:()=>n(!r),className:"previewcn-select-trigger","aria-expanded":r,children:[jsx("span",{children:u}),jsx(we,{})]}),r&&jsx("div",{className:"previewcn-select-dropdown",children:y.map(a=>jsx("button",{onClick:()=>{o(a.value),n(false);},className:`previewcn-select-option ${e===a.value?"previewcn-select-option--selected":""}`,children:a.label},a.value))})]})]})}var q=p(()=>{"use client";R();});function be(){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 Ce(){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 Q({value:e,onChange:o}){let r=e??false;return jsxs("div",{className:"previewcn-section",children:[jsx("label",{className:"previewcn-label",children:"Mode"}),jsxs("div",{className:"previewcn-mode-toggle",children:[jsxs("button",{onClick:()=>o(false),className:`previewcn-mode-btn ${r?"":"previewcn-mode-btn--selected"}`,"aria-label":"Light mode",children:[jsx(be,{}),jsx("span",{children:"Light"})]}),jsxs("button",{onClick:()=>o(true),className:`previewcn-mode-btn ${r?"previewcn-mode-btn--selected":""}`,"aria-label":"Dark mode",children:[jsx(Ce,{}),jsx("span",{children:"Dark"})]})]})]})}var ee=p(()=>{"use client";});var oe,re=p(()=>{oe=[{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 le({value:e,onChange:o}){return jsxs("div",{className:"previewcn-section",children:[jsx("label",{className:"previewcn-label",children:"Radius"}),jsx("div",{className:"previewcn-radius-grid",children:oe.map(r=>{let n=e===r.value;return jsxs("button",{onClick:()=>o(r.value),className:`previewcn-radius-btn ${n?"previewcn-radius-btn--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 ne=p(()=>{"use client";re();});var ie={};pe(ie,{default:()=>se});function Se(){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 Ne(){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 se({onClose:e}){let{config:o,setColorPreset:r,setRadius:n,setDarkMode:c,setFont:u,resetTheme:a}=K(),s=useRef(false);useEffect(()=>{s.current||(s.current=true,L(o));},[o]);let d=useCallback(v=>{v.key==="Escape"&&e();},[e]);return useEffect(()=>(window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)),[d]),jsx("div",{className:"previewcn-backdrop",onClick:v=>{v.target===v.currentTarget&&e();},children:jsxs("div",{className:"previewcn-panel",children:[jsxs("div",{className:"previewcn-header",children:[jsxs("div",{className:"previewcn-title",children:[jsx("span",{className:"previewcn-logo",children:"PreviewCN"}),jsx("span",{className:"previewcn-badge",children:"DEV"})]}),jsx("button",{onClick:e,className:"previewcn-close-btn","aria-label":"Close",children:jsx(Se,{})})]}),jsxs("div",{className:"previewcn-content",children:[jsx(j,{value:o.colorPreset,onChange:r}),jsx(le,{value:o.radius,onChange:n}),jsx(Z,{value:o.font,onChange:u}),jsx(Q,{value:o.darkMode,onChange:c})]}),jsx("div",{className:"previewcn-footer",children:jsxs("button",{onClick:a,className:"previewcn-reset-btn",children:[jsx(Ne,{}),jsx("span",{children:"Reset"})]})})]})})}var ce=p(()=>{"use client";Y();F();X();q();ee();ne();});function ue(){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 B({onClick:e}){return jsx("button",{onClick:e,className:"previewcn-trigger","aria-label":"Open PreviewCN theme editor",title:"PreviewCN Theme Editor",children:jsx(ue,{})})}var Re=lazy(()=>Promise.resolve().then(()=>(ce(),ie))),Ee=process.env.NODE_ENV==="development";function Le(){let[e,o]=useState(false);return jsxs(Fragment,{children:[jsx(B,{onClick:()=>o(true)}),e&&jsx(Suspense,{fallback:null,children:jsx(Re,{onClose:()=>o(false)})})]})}function De(){return Ee?jsx(Le,{}):null}F();
|
|
2
|
+
export{De as PreviewcnDevtools,C as applyColors,w as applyDarkMode,P as applyFont,b as applyRadius,L as applyTheme};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
|
|
7
|
+
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
8
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
9
|
+
"Courier New", monospace;
|
|
10
|
+
--spacing: 0.25rem;
|
|
11
|
+
--text-xs: 0.75rem;
|
|
12
|
+
--text-xs--line-height: calc(1 / 0.75);
|
|
13
|
+
--text-sm: 0.875rem;
|
|
14
|
+
--text-sm--line-height: calc(1.25 / 0.875);
|
|
15
|
+
--font-weight-medium: 500;
|
|
16
|
+
--font-weight-semibold: 600;
|
|
17
|
+
--tracking-tight: -0.025em;
|
|
18
|
+
--tracking-wider: 0.05em;
|
|
19
|
+
--radius-md: 0.375rem;
|
|
20
|
+
--radius-xl: 0.75rem;
|
|
21
|
+
--default-transition-duration: 150ms;
|
|
22
|
+
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
23
|
+
--default-font-family: var(--font-sans);
|
|
24
|
+
--default-mono-font-family: var(--font-mono);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@layer base {
|
|
28
|
+
*, ::after, ::before, ::backdrop, ::file-selector-button {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
border: 0 solid;
|
|
33
|
+
}
|
|
34
|
+
html, :host {
|
|
35
|
+
line-height: 1.5;
|
|
36
|
+
-webkit-text-size-adjust: 100%;
|
|
37
|
+
-moz-tab-size: 4;
|
|
38
|
+
-o-tab-size: 4;
|
|
39
|
+
tab-size: 4;
|
|
40
|
+
font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
|
|
41
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
42
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
43
|
+
-webkit-tap-highlight-color: transparent;
|
|
44
|
+
}
|
|
45
|
+
hr {
|
|
46
|
+
height: 0;
|
|
47
|
+
color: inherit;
|
|
48
|
+
border-top-width: 1px;
|
|
49
|
+
}
|
|
50
|
+
abbr:where([title]) {
|
|
51
|
+
-webkit-text-decoration: underline dotted;
|
|
52
|
+
text-decoration: underline dotted;
|
|
53
|
+
}
|
|
54
|
+
h1, h2, h3, h4, h5, h6 {
|
|
55
|
+
font-size: inherit;
|
|
56
|
+
font-weight: inherit;
|
|
57
|
+
}
|
|
58
|
+
a {
|
|
59
|
+
color: inherit;
|
|
60
|
+
-webkit-text-decoration: inherit;
|
|
61
|
+
text-decoration: inherit;
|
|
62
|
+
}
|
|
63
|
+
b, strong {
|
|
64
|
+
font-weight: bolder;
|
|
65
|
+
}
|
|
66
|
+
code, kbd, samp, pre {
|
|
67
|
+
font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
|
|
68
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
69
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
70
|
+
font-size: 1em;
|
|
71
|
+
}
|
|
72
|
+
small {
|
|
73
|
+
font-size: 80%;
|
|
74
|
+
}
|
|
75
|
+
sub, sup {
|
|
76
|
+
font-size: 75%;
|
|
77
|
+
line-height: 0;
|
|
78
|
+
position: relative;
|
|
79
|
+
vertical-align: baseline;
|
|
80
|
+
}
|
|
81
|
+
sub {
|
|
82
|
+
bottom: -0.25em;
|
|
83
|
+
}
|
|
84
|
+
sup {
|
|
85
|
+
top: -0.5em;
|
|
86
|
+
}
|
|
87
|
+
table {
|
|
88
|
+
text-indent: 0;
|
|
89
|
+
border-color: inherit;
|
|
90
|
+
border-collapse: collapse;
|
|
91
|
+
}
|
|
92
|
+
:-moz-focusring {
|
|
93
|
+
outline: auto;
|
|
94
|
+
}
|
|
95
|
+
progress {
|
|
96
|
+
vertical-align: baseline;
|
|
97
|
+
}
|
|
98
|
+
summary {
|
|
99
|
+
display: list-item;
|
|
100
|
+
}
|
|
101
|
+
ol, ul, menu {
|
|
102
|
+
list-style: none;
|
|
103
|
+
}
|
|
104
|
+
img, svg, video, canvas, audio, iframe, embed, object {
|
|
105
|
+
display: block;
|
|
106
|
+
vertical-align: middle;
|
|
107
|
+
}
|
|
108
|
+
img, video {
|
|
109
|
+
max-width: 100%;
|
|
110
|
+
height: auto;
|
|
111
|
+
}
|
|
112
|
+
button, input, select, optgroup, textarea, ::file-selector-button {
|
|
113
|
+
font: inherit;
|
|
114
|
+
font-feature-settings: inherit;
|
|
115
|
+
font-variation-settings: inherit;
|
|
116
|
+
letter-spacing: inherit;
|
|
117
|
+
color: inherit;
|
|
118
|
+
border-radius: 0;
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
opacity: 1;
|
|
121
|
+
}
|
|
122
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
123
|
+
font-weight: bolder;
|
|
124
|
+
}
|
|
125
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
126
|
+
padding-inline-start: 20px;
|
|
127
|
+
}
|
|
128
|
+
::file-selector-button {
|
|
129
|
+
margin-inline-end: 4px;
|
|
130
|
+
}
|
|
131
|
+
::-moz-placeholder {
|
|
132
|
+
opacity: 1;
|
|
133
|
+
}
|
|
134
|
+
::placeholder {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
}
|
|
137
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
138
|
+
::-moz-placeholder {
|
|
139
|
+
color: currentcolor;
|
|
140
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
141
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
::placeholder {
|
|
145
|
+
color: currentcolor;
|
|
146
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
147
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
textarea {
|
|
152
|
+
resize: vertical;
|
|
153
|
+
}
|
|
154
|
+
::-webkit-search-decoration {
|
|
155
|
+
-webkit-appearance: none;
|
|
156
|
+
}
|
|
157
|
+
::-webkit-date-and-time-value {
|
|
158
|
+
min-height: 1lh;
|
|
159
|
+
text-align: inherit;
|
|
160
|
+
}
|
|
161
|
+
::-webkit-datetime-edit {
|
|
162
|
+
display: inline-flex;
|
|
163
|
+
}
|
|
164
|
+
::-webkit-datetime-edit-fields-wrapper {
|
|
165
|
+
padding: 0;
|
|
166
|
+
}
|
|
167
|
+
::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
|
|
168
|
+
padding-block: 0;
|
|
169
|
+
}
|
|
170
|
+
::-webkit-calendar-picker-indicator {
|
|
171
|
+
line-height: 1;
|
|
172
|
+
}
|
|
173
|
+
:-moz-ui-invalid {
|
|
174
|
+
box-shadow: none;
|
|
175
|
+
}
|
|
176
|
+
button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {
|
|
177
|
+
-webkit-appearance: button;
|
|
178
|
+
-moz-appearance: button;
|
|
179
|
+
appearance: button;
|
|
180
|
+
}
|
|
181
|
+
::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
|
|
182
|
+
height: auto;
|
|
183
|
+
}
|
|
184
|
+
[hidden]:where(:not([hidden="until-found"])) {
|
|
185
|
+
display: none !important;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
@layer utilities {
|
|
189
|
+
.border {
|
|
190
|
+
border-style: var(--tw-border-style);
|
|
191
|
+
border-width: 1px;
|
|
192
|
+
}
|
|
193
|
+
.ring {
|
|
194
|
+
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
195
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
.previewcn-trigger {
|
|
199
|
+
position: fixed;
|
|
200
|
+
bottom: 16px;
|
|
201
|
+
right: 16px;
|
|
202
|
+
z-index: 99999;
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
width: 48px;
|
|
207
|
+
height: 48px;
|
|
208
|
+
border-radius: 9999px;
|
|
209
|
+
background: oklch(0.2 0.02 260);
|
|
210
|
+
color: oklch(0.95 0 0);
|
|
211
|
+
border: 1px solid oklch(0.4 0.02 260);
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
box-shadow: 0 4px 12px oklch(0 0 0 / 40%),
|
|
214
|
+
0 0 0 1px oklch(1 0 0 / 5%);
|
|
215
|
+
transition: transform 0.2s ease,
|
|
216
|
+
background-color 0.2s ease,
|
|
217
|
+
border-color 0.2s ease;
|
|
218
|
+
}
|
|
219
|
+
.previewcn-trigger:hover {
|
|
220
|
+
background: oklch(0.3 0.02 260);
|
|
221
|
+
transform: scale(1.05);
|
|
222
|
+
}
|
|
223
|
+
.previewcn-trigger:active {
|
|
224
|
+
transform: scale(1);
|
|
225
|
+
}
|
|
226
|
+
.previewcn-trigger:focus-visible {
|
|
227
|
+
outline: 2px solid oklch(0.7 0.12 260);
|
|
228
|
+
outline-offset: 2px;
|
|
229
|
+
}
|
|
230
|
+
.previewcn-backdrop {
|
|
231
|
+
position: fixed;
|
|
232
|
+
inset: calc(var(--spacing) * 0);
|
|
233
|
+
z-index: 99998;
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: flex-end;
|
|
236
|
+
justify-content: flex-end;
|
|
237
|
+
padding: calc(var(--spacing) * 4);
|
|
238
|
+
background: oklch(0 0 0 / 30%);
|
|
239
|
+
backdrop-filter: blur(2px);
|
|
240
|
+
animation: previewcn-fade-in 0.15s ease-out;
|
|
241
|
+
}
|
|
242
|
+
.previewcn-panel {
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
overflow: hidden;
|
|
246
|
+
border-radius: var(--radius-xl);
|
|
247
|
+
--tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));
|
|
248
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
249
|
+
width: 320px;
|
|
250
|
+
max-height: calc(100vh - 32px);
|
|
251
|
+
background: oklch(0.18 0.015 260);
|
|
252
|
+
border: 1px solid oklch(0.3 0.02 260);
|
|
253
|
+
color: oklch(0.95 0 0);
|
|
254
|
+
font-family: system-ui,
|
|
255
|
+
-apple-system,
|
|
256
|
+
sans-serif;
|
|
257
|
+
font-size: 14px;
|
|
258
|
+
animation: previewcn-slide-up 0.2s ease-out;
|
|
259
|
+
}
|
|
260
|
+
.previewcn-header {
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
justify-content: space-between;
|
|
264
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
265
|
+
padding-block: calc(var(--spacing) * 3);
|
|
266
|
+
border-bottom: 1px solid oklch(0.3 0.02 260);
|
|
267
|
+
}
|
|
268
|
+
.previewcn-title {
|
|
269
|
+
display: flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
gap: calc(var(--spacing) * 2);
|
|
272
|
+
}
|
|
273
|
+
.previewcn-logo {
|
|
274
|
+
--tw-font-weight: var(--font-weight-semibold);
|
|
275
|
+
font-weight: var(--font-weight-semibold);
|
|
276
|
+
--tw-tracking: var(--tracking-tight);
|
|
277
|
+
letter-spacing: var(--tracking-tight);
|
|
278
|
+
font-size: 15px;
|
|
279
|
+
}
|
|
280
|
+
.previewcn-badge {
|
|
281
|
+
border-radius: 0.25rem;
|
|
282
|
+
padding-inline: calc(var(--spacing) * 1.5);
|
|
283
|
+
padding-block: calc(var(--spacing) * 0.5);
|
|
284
|
+
font-size: var(--text-xs);
|
|
285
|
+
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
286
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
287
|
+
font-weight: var(--font-weight-medium);
|
|
288
|
+
background: oklch(0.55 0.2 280);
|
|
289
|
+
color: oklch(1 0 0);
|
|
290
|
+
}
|
|
291
|
+
.previewcn-close-btn {
|
|
292
|
+
display: flex;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
border-radius: var(--radius-md);
|
|
296
|
+
padding: calc(var(--spacing) * 1.5);
|
|
297
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
298
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
299
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
300
|
+
color: oklch(0.7 0 0);
|
|
301
|
+
}
|
|
302
|
+
.previewcn-close-btn:hover {
|
|
303
|
+
background: oklch(0.25 0.02 260);
|
|
304
|
+
color: oklch(0.95 0 0);
|
|
305
|
+
}
|
|
306
|
+
.previewcn-content {
|
|
307
|
+
flex: 1;
|
|
308
|
+
overflow-y: auto;
|
|
309
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
310
|
+
padding-block: calc(var(--spacing) * 4);
|
|
311
|
+
}
|
|
312
|
+
.previewcn-section {
|
|
313
|
+
margin-bottom: calc(var(--spacing) * 5);
|
|
314
|
+
}
|
|
315
|
+
.previewcn-section:last-child {
|
|
316
|
+
margin-bottom: calc(var(--spacing) * 0);
|
|
317
|
+
}
|
|
318
|
+
.previewcn-label {
|
|
319
|
+
margin-bottom: calc(var(--spacing) * 2);
|
|
320
|
+
display: block;
|
|
321
|
+
font-size: var(--text-xs);
|
|
322
|
+
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
323
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
324
|
+
font-weight: var(--font-weight-medium);
|
|
325
|
+
--tw-tracking: var(--tracking-wider);
|
|
326
|
+
letter-spacing: var(--tracking-wider);
|
|
327
|
+
text-transform: uppercase;
|
|
328
|
+
color: oklch(0.65 0 0);
|
|
329
|
+
}
|
|
330
|
+
.previewcn-color-grid {
|
|
331
|
+
display: grid;
|
|
332
|
+
gap: calc(var(--spacing) * 2);
|
|
333
|
+
grid-template-columns: repeat(6, 1fr);
|
|
334
|
+
}
|
|
335
|
+
.previewcn-color-swatch {
|
|
336
|
+
aspect-ratio: 1 / 1;
|
|
337
|
+
cursor: pointer;
|
|
338
|
+
border-radius: var(--radius-md);
|
|
339
|
+
transition-property: all;
|
|
340
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
341
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
342
|
+
border: 2px solid transparent;
|
|
343
|
+
}
|
|
344
|
+
.previewcn-color-swatch:hover {
|
|
345
|
+
transform: scale(1.1);
|
|
346
|
+
}
|
|
347
|
+
.previewcn-color-swatch--selected {
|
|
348
|
+
border-color: oklch(1 0 0);
|
|
349
|
+
box-shadow: 0 0 0 2px oklch(0.18 0.015 260),
|
|
350
|
+
0 0 0 4px oklch(1 0 0 / 50%);
|
|
351
|
+
}
|
|
352
|
+
.previewcn-radius-grid {
|
|
353
|
+
display: grid;
|
|
354
|
+
gap: calc(var(--spacing) * 2);
|
|
355
|
+
grid-template-columns: repeat(3, 1fr);
|
|
356
|
+
}
|
|
357
|
+
.previewcn-radius-btn {
|
|
358
|
+
display: flex;
|
|
359
|
+
flex-direction: column;
|
|
360
|
+
align-items: center;
|
|
361
|
+
gap: calc(var(--spacing) * 1.5);
|
|
362
|
+
border-radius: var(--radius-md);
|
|
363
|
+
padding-inline: calc(var(--spacing) * 2);
|
|
364
|
+
padding-block: calc(var(--spacing) * 2);
|
|
365
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
366
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
367
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
368
|
+
background: oklch(0.22 0.015 260);
|
|
369
|
+
border: 1px solid oklch(0.3 0.02 260);
|
|
370
|
+
}
|
|
371
|
+
.previewcn-radius-btn:hover {
|
|
372
|
+
background: oklch(0.28 0.02 260);
|
|
373
|
+
}
|
|
374
|
+
.previewcn-radius-btn--selected {
|
|
375
|
+
background: oklch(0.32 0.03 260);
|
|
376
|
+
border-color: oklch(0.5 0.1 260);
|
|
377
|
+
}
|
|
378
|
+
.previewcn-radius-preview {
|
|
379
|
+
display: block;
|
|
380
|
+
width: 24px;
|
|
381
|
+
height: 16px;
|
|
382
|
+
background: oklch(0.5 0.15 260);
|
|
383
|
+
border-top-left-radius: inherit;
|
|
384
|
+
border-top-right-radius: inherit;
|
|
385
|
+
}
|
|
386
|
+
.previewcn-radius-label {
|
|
387
|
+
font-size: var(--text-xs);
|
|
388
|
+
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
389
|
+
color: oklch(0.75 0 0);
|
|
390
|
+
}
|
|
391
|
+
.previewcn-mode-toggle {
|
|
392
|
+
display: grid;
|
|
393
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
394
|
+
gap: calc(var(--spacing) * 2);
|
|
395
|
+
}
|
|
396
|
+
.previewcn-mode-btn {
|
|
397
|
+
display: flex;
|
|
398
|
+
align-items: center;
|
|
399
|
+
justify-content: center;
|
|
400
|
+
gap: calc(var(--spacing) * 2);
|
|
401
|
+
border-radius: var(--radius-md);
|
|
402
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
403
|
+
padding-block: calc(var(--spacing) * 2);
|
|
404
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
405
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
406
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
407
|
+
background: oklch(0.22 0.015 260);
|
|
408
|
+
border: 1px solid oklch(0.3 0.02 260);
|
|
409
|
+
font-size: 13px;
|
|
410
|
+
}
|
|
411
|
+
.previewcn-mode-btn:hover {
|
|
412
|
+
background: oklch(0.28 0.02 260);
|
|
413
|
+
}
|
|
414
|
+
.previewcn-mode-btn--selected {
|
|
415
|
+
background: oklch(0.32 0.03 260);
|
|
416
|
+
border-color: oklch(0.5 0.1 260);
|
|
417
|
+
}
|
|
418
|
+
.previewcn-select-wrapper {
|
|
419
|
+
position: relative;
|
|
420
|
+
}
|
|
421
|
+
.previewcn-select-trigger {
|
|
422
|
+
display: flex;
|
|
423
|
+
width: 100%;
|
|
424
|
+
align-items: center;
|
|
425
|
+
justify-content: space-between;
|
|
426
|
+
border-radius: var(--radius-md);
|
|
427
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
428
|
+
padding-block: calc(var(--spacing) * 2);
|
|
429
|
+
text-align: left;
|
|
430
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
431
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
432
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
433
|
+
background: oklch(0.22 0.015 260);
|
|
434
|
+
border: 1px solid oklch(0.3 0.02 260);
|
|
435
|
+
font-size: 13px;
|
|
436
|
+
}
|
|
437
|
+
.previewcn-select-trigger:hover {
|
|
438
|
+
background: oklch(0.28 0.02 260);
|
|
439
|
+
}
|
|
440
|
+
.previewcn-select-dropdown {
|
|
441
|
+
position: absolute;
|
|
442
|
+
top: 100%;
|
|
443
|
+
left: calc(var(--spacing) * 0);
|
|
444
|
+
z-index: 10;
|
|
445
|
+
margin-top: calc(var(--spacing) * 1);
|
|
446
|
+
width: 100%;
|
|
447
|
+
overflow: hidden;
|
|
448
|
+
border-radius: var(--radius-md);
|
|
449
|
+
background: oklch(0.2 0.015 260);
|
|
450
|
+
border: 1px solid oklch(0.35 0.02 260);
|
|
451
|
+
box-shadow: 0 8px 24px oklch(0 0 0 / 40%);
|
|
452
|
+
max-height: 200px;
|
|
453
|
+
overflow-y: auto;
|
|
454
|
+
}
|
|
455
|
+
.previewcn-select-option {
|
|
456
|
+
width: 100%;
|
|
457
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
458
|
+
padding-block: calc(var(--spacing) * 2);
|
|
459
|
+
text-align: left;
|
|
460
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
461
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
462
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
463
|
+
font-size: 13px;
|
|
464
|
+
}
|
|
465
|
+
.previewcn-select-option:hover {
|
|
466
|
+
background: oklch(0.28 0.02 260);
|
|
467
|
+
}
|
|
468
|
+
.previewcn-select-option--selected {
|
|
469
|
+
background: oklch(0.32 0.03 260);
|
|
470
|
+
}
|
|
471
|
+
.previewcn-footer {
|
|
472
|
+
display: flex;
|
|
473
|
+
align-items: center;
|
|
474
|
+
justify-content: flex-end;
|
|
475
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
476
|
+
padding-block: calc(var(--spacing) * 3);
|
|
477
|
+
border-top: 1px solid oklch(0.3 0.02 260);
|
|
478
|
+
}
|
|
479
|
+
.previewcn-reset-btn {
|
|
480
|
+
display: flex;
|
|
481
|
+
align-items: center;
|
|
482
|
+
gap: calc(var(--spacing) * 1.5);
|
|
483
|
+
border-radius: var(--radius-md);
|
|
484
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
485
|
+
padding-block: calc(var(--spacing) * 1.5);
|
|
486
|
+
font-size: var(--text-sm);
|
|
487
|
+
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
488
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
489
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
490
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
491
|
+
color: oklch(0.7 0 0);
|
|
492
|
+
}
|
|
493
|
+
.previewcn-reset-btn:hover {
|
|
494
|
+
background: oklch(0.25 0.02 260);
|
|
495
|
+
color: oklch(0.95 0 0);
|
|
496
|
+
}
|
|
497
|
+
@keyframes previewcn-fade-in {
|
|
498
|
+
from {
|
|
499
|
+
opacity: 0;
|
|
500
|
+
}
|
|
501
|
+
to {
|
|
502
|
+
opacity: 1;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
@keyframes previewcn-slide-up {
|
|
506
|
+
from {
|
|
507
|
+
opacity: 0;
|
|
508
|
+
transform: translateY(16px);
|
|
509
|
+
}
|
|
510
|
+
to {
|
|
511
|
+
opacity: 1;
|
|
512
|
+
transform: translateY(0);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
@property --tw-border-style {
|
|
516
|
+
syntax: "*";
|
|
517
|
+
inherits: false;
|
|
518
|
+
initial-value: solid;
|
|
519
|
+
}
|
|
520
|
+
@property --tw-shadow {
|
|
521
|
+
syntax: "*";
|
|
522
|
+
inherits: false;
|
|
523
|
+
initial-value: 0 0 #0000;
|
|
524
|
+
}
|
|
525
|
+
@property --tw-shadow-color {
|
|
526
|
+
syntax: "*";
|
|
527
|
+
inherits: false;
|
|
528
|
+
}
|
|
529
|
+
@property --tw-shadow-alpha {
|
|
530
|
+
syntax: "<percentage>";
|
|
531
|
+
inherits: false;
|
|
532
|
+
initial-value: 100%;
|
|
533
|
+
}
|
|
534
|
+
@property --tw-inset-shadow {
|
|
535
|
+
syntax: "*";
|
|
536
|
+
inherits: false;
|
|
537
|
+
initial-value: 0 0 #0000;
|
|
538
|
+
}
|
|
539
|
+
@property --tw-inset-shadow-color {
|
|
540
|
+
syntax: "*";
|
|
541
|
+
inherits: false;
|
|
542
|
+
}
|
|
543
|
+
@property --tw-inset-shadow-alpha {
|
|
544
|
+
syntax: "<percentage>";
|
|
545
|
+
inherits: false;
|
|
546
|
+
initial-value: 100%;
|
|
547
|
+
}
|
|
548
|
+
@property --tw-ring-color {
|
|
549
|
+
syntax: "*";
|
|
550
|
+
inherits: false;
|
|
551
|
+
}
|
|
552
|
+
@property --tw-ring-shadow {
|
|
553
|
+
syntax: "*";
|
|
554
|
+
inherits: false;
|
|
555
|
+
initial-value: 0 0 #0000;
|
|
556
|
+
}
|
|
557
|
+
@property --tw-inset-ring-color {
|
|
558
|
+
syntax: "*";
|
|
559
|
+
inherits: false;
|
|
560
|
+
}
|
|
561
|
+
@property --tw-inset-ring-shadow {
|
|
562
|
+
syntax: "*";
|
|
563
|
+
inherits: false;
|
|
564
|
+
initial-value: 0 0 #0000;
|
|
565
|
+
}
|
|
566
|
+
@property --tw-ring-inset {
|
|
567
|
+
syntax: "*";
|
|
568
|
+
inherits: false;
|
|
569
|
+
}
|
|
570
|
+
@property --tw-ring-offset-width {
|
|
571
|
+
syntax: "<length>";
|
|
572
|
+
inherits: false;
|
|
573
|
+
initial-value: 0px;
|
|
574
|
+
}
|
|
575
|
+
@property --tw-ring-offset-color {
|
|
576
|
+
syntax: "*";
|
|
577
|
+
inherits: false;
|
|
578
|
+
initial-value: #fff;
|
|
579
|
+
}
|
|
580
|
+
@property --tw-ring-offset-shadow {
|
|
581
|
+
syntax: "*";
|
|
582
|
+
inherits: false;
|
|
583
|
+
initial-value: 0 0 #0000;
|
|
584
|
+
}
|
|
585
|
+
@property --tw-font-weight {
|
|
586
|
+
syntax: "*";
|
|
587
|
+
inherits: false;
|
|
588
|
+
}
|
|
589
|
+
@property --tw-tracking {
|
|
590
|
+
syntax: "*";
|
|
591
|
+
inherits: false;
|
|
592
|
+
}
|
|
593
|
+
@layer properties {
|
|
594
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
595
|
+
*, ::before, ::after, ::backdrop {
|
|
596
|
+
--tw-border-style: solid;
|
|
597
|
+
--tw-shadow: 0 0 #0000;
|
|
598
|
+
--tw-shadow-color: initial;
|
|
599
|
+
--tw-shadow-alpha: 100%;
|
|
600
|
+
--tw-inset-shadow: 0 0 #0000;
|
|
601
|
+
--tw-inset-shadow-color: initial;
|
|
602
|
+
--tw-inset-shadow-alpha: 100%;
|
|
603
|
+
--tw-ring-color: initial;
|
|
604
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
605
|
+
--tw-inset-ring-color: initial;
|
|
606
|
+
--tw-inset-ring-shadow: 0 0 #0000;
|
|
607
|
+
--tw-ring-inset: initial;
|
|
608
|
+
--tw-ring-offset-width: 0px;
|
|
609
|
+
--tw-ring-offset-color: #fff;
|
|
610
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
611
|
+
--tw-font-weight: initial;
|
|
612
|
+
--tw-tracking: initial;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@previewcn/devtools",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Embedded devtools for PreviewCN - real-time shadcn/ui theme preview inside your app",
|
|
5
|
+
"keywords": ["shadcn", "shadcn-ui", "theme", "preview", "devtools", "react", "tailwind"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "PreviewCN",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/taishikato/previewcn.git",
|
|
11
|
+
"directory": "packages/devtools"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./styles.css": "./dist/styles.css"
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"files": ["dist", "README.md"],
|
|
26
|
+
"sideEffects": ["./dist/styles.css"],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "pnpm build:js && pnpm build:css",
|
|
29
|
+
"build:js": "tsup",
|
|
30
|
+
"build:css": "postcss src/styles.css -o dist/styles.css",
|
|
31
|
+
"dev": "concurrently \"tsup --watch\" \"postcss src/styles.css -o dist/styles.css --watch\"",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"clean": "rm -rf dist node_modules",
|
|
34
|
+
"prepublishOnly": "pnpm build",
|
|
35
|
+
"format:write": "prettier --write \"**/*.{ts,tsx,css}\" --cache",
|
|
36
|
+
"format:check": "prettier --check \"**/*.{ts,tsx,css}\" --cache"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": ">=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^22",
|
|
43
|
+
"@types/react": "^19",
|
|
44
|
+
"autoprefixer": "^10.4.21",
|
|
45
|
+
"concurrently": "^9.1.2",
|
|
46
|
+
"postcss": "^8.5.4",
|
|
47
|
+
"postcss-cli": "^11.0.1",
|
|
48
|
+
"react": "19.2.1",
|
|
49
|
+
"tailwindcss": "^4.1.8",
|
|
50
|
+
"@tailwindcss/postcss": "^4.1.8",
|
|
51
|
+
"tsup": "^8.5.0",
|
|
52
|
+
"typescript": "^5"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|