UNPKG

@baseplate-dev/project-builder-web

Version:

Web interface for constructing project builder JSON

12 lines (10 loc) 25.8 kB
import{i as n}from"./_virtual___federation_fn_import-C4el_tlG.js";import{j as t}from"./jsx-runtime-D_zvdyIk.js";import{s as q}from"./index-BsqYBobW.js";import{c as N,D as J,E as Q,F as X}from"./index--XHV4ygU.js";import{e as f}from"./index.esm-C5MSuOl4.js";import{i as Y}from"./inflection-C1nKqrJS.js";import{c as Z,f as e1}from"./index-D5UX5AHP.js";const{generateCssFromThemeConfig:F}=await n("@baseplate-dev/project-builder-lib"),{TextareaField:t1}=await n("@baseplate-dev/ui-components"),{useMemo:a1}=await n("react");function A(s){return Object.entries(s).map(([e,r])=>` ${e}: ${r};`).join(` `)}function s1({className:s,control:e}){const r=f({control:e,name:"colors"}),l=a1(()=>` :root { ${A(F(r.light))} } .dark, html[data-theme='dark'] { ${A(F(r.dark))} } `.trim(),[r]);return t.jsx("div",{className:N("",s),children:t.jsx(t1,{className:"h-60",readOnly:!0,value:l})})}const{convertHexToOklch:r1,convertOklchToColorName:o1,convertOklchToHex:l1,getDefaultThemeColorFromShade:n1,THEME_COLORS:i1}=await n("@baseplate-dev/project-builder-lib"),{Button:H,ColorPickerFieldController:h1,Tooltip:c1,TooltipContent:x1,TooltipTrigger:p1}=await n("@baseplate-dev/ui-components");function z({className:s,control:e,mode:r,setValue:l}){const a=Object.entries(i1),x=f({control:e,name:"palettes"}),c=f({control:e,name:`colors.${r}`});return t.jsx("div",{className:N("flex w-full max-w-xl gap-4",s),children:t.jsx("div",{className:"grid flex-1 grid-cols-1 gap-4 sm:grid-cols-2",children:a.map(([m,i],o)=>{const h=m,b=(o>0?a[o-1][1].groupKey:void 0)!==i.groupKey,g=c[h],u=n1(x,r,h);return t.jsxs("div",{className:N(b?"col-start-1":void 0,"relative"),children:[t.jsx(h1,{control:e,className:"w-full",wrapperClassName:"flex-col items-start",label:t.jsxs("div",{className:"flex h-6 w-full items-center gap-1",children:[t.jsx("div",{children:i.name}),t.jsxs(c1,{delayDuration:500,children:[t.jsx(p1,{asChild:!0,children:t.jsx(H,{variant:"ghost",size:"icon","aria-label":"Color Info",className:"opacity-30",children:t.jsx(J,{})})}),t.jsx(x1,{align:"start",side:"bottom",className:"max-w-[400px]",children:t.jsx("div",{className:"font-normal",children:i.description})})]})]}),parseColor:l1,serializeColor:r1,formatColorName:j=>{const p=Object.entries(x.base.shades).find(([,S])=>S===j)?.[0];if(p)return`base-${p}`;const d=Object.entries(x.primary.shades).find(([,S])=>S===j)?.[0];return d?`primary-${d}`:o1(j)},name:`colors.${r}.${h}`}),g!==u&&t.jsx(H,{className:"absolute right-2 bottom-1",onClick:()=>{l(`colors.${r}.${h}`,u)},size:"icon",variant:"ghost","aria-label":"Reset Color",children:t.jsx(Q,{})})]},m)})})})}const{generateCssFromThemeConfig:d1}=await n("@baseplate-dev/project-builder-lib"),{Badge:v,Button:M,Card:m1,CardContent:u1,CardDescription:M1,CardHeader:b1,CardTitle:j1,Combobox:f1,ComboboxContent:g1,ComboboxEmpty:v1,ComboboxInput:C1,ComboboxItem:k}=await n("@baseplate-dev/ui-components");function T1({className:s,control:e,mode:r}){const l=f({control:e,name:`colors.${r}`}),a=d1(l);return t.jsx("div",{className:N("size-full rounded-xl border border-border bg-background p-4",s),style:a,children:t.jsxs(m1,{children:[t.jsxs(b1,{children:[t.jsx(j1,{children:"Color Preview"}),t.jsx(M1,{children:"This is a preview of how your theme colors will be applied on various elements"})]}),t.jsxs(u1,{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(C,{children:"Paragraph Text"}),t.jsx("p",{className:"text-base",children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin faucibus."})]}),t.jsxs("div",{children:[t.jsx(C,{children:"Combobox"}),t.jsxs(f1,{children:[t.jsx(C1,{placeholder:"Select an option"}),t.jsxs(g1,{style:a,children:[t.jsx(k,{value:"opt1",label:"Option 1",children:"Option 1"}),t.jsx(k,{value:"green",label:"Option 2",children:"Option 2"}),t.jsx(k,{value:"blue",label:"Option 3",children:"Option 3"}),t.jsx(v1,{children:"No results found"})]})]})]}),t.jsxs("div",{children:[t.jsx(C,{children:"Badges"}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx(v,{variant:"default",children:"Default"}),t.jsx(v,{variant:"destructive",children:"Destructive"}),t.jsx(v,{variant:"secondary",children:"Secondary"}),t.jsx(v,{variant:"outline",children:"Outline"})]})]}),t.jsxs("div",{children:[t.jsx(C,{children:"Buttons"}),t.jsxs("div",{className:"flex flex-wrap gap-2 rounded-lg border border-border p-1",children:[t.jsx(M,{type:"button",children:"Primary"}),t.jsx(M,{variant:"destructive",type:"button",children:"Destructive"}),t.jsx(M,{variant:"ghost",type:"button",children:"Ghost"}),t.jsx(M,{variant:"link",type:"button",children:"Link"}),t.jsx(M,{variant:"secondary",type:"button",children:"Secondary"}),t.jsx(M,{variant:"outline",type:"button",children:"Outline"})]})]})]})]})})}function C({children:s}){return t.jsx("h4",{className:"text-lg font-semibold",children:s})}function w1(s){const e=new Float32Array([s.r,s.g,s.b]);return{"50-r":1/(1+1/Math.exp(1.8661608695983887+1.969373345375061*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.4601062536239624*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.7962396740913391*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"50-g":1/(1+1/Math.exp(1.9256014823913574+1.231925129890442*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.3603883981704712*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.8378368616104126*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"50-b":1/(1+1/Math.exp(1.5751663446426392+.6084778904914856*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.0512851476669312*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+1.9236465692520142*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"100-r":1/(1+1/Math.exp(1.6104178428649902+2.411083698272705*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.4946855306625366*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.5684743523597717*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"100-g":1/(1+1/Math.exp(1.6873022317886353+.7176924347877502*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.6131407022476196*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.15697577595710754*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"100-b":1/(1+1/Math.exp(1.0808522701263428-.09388591349124908*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.5177313685417175*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+2.6253278255462646*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"200-r":1/(1+1/Math.exp(1.3480290174484253+2.2088170051574707*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-1.1226733922958374*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.41870957612991333*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"200-g":1/(1+1/Math.exp(1.3919278383255005+.2666841745376587*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.5987523794174194*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.23637670278549194*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"200-b":1/(1+1/Math.exp(.6176453232765198-.6029531359672546*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.21029342710971832*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+2.906541109085083*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"300-r":1/(1+1/Math.exp(.9194338321685791+2.3936944007873535*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-1.68363356590271*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.36374539136886597*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"300-g":1/(1+1/Math.exp(1.1811708211898804-.08378893882036209*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.4275716543197632*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.6511568427085876*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"300-b":1/(1+1/Math.exp(-.04160493612289429-1.0422184467315674*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.1739543229341507*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+3.306165933609009*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"400-r":1/(1+1/Math.exp(.5908379554748535+2.6282155513763428*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-2.483553886413574*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+.16029347479343414*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"400-g":1/(1+1/Math.exp(.9054368138313293-.38720616698265076*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.231947422027588*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.0837976932525635*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"400-b":1/(1+1/Math.exp(-.6404189467430115-1.6898466348648071*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.029696132987737656*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+3.7177767753601074*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"500-r":1/(1+1/Math.exp(.3420727550983429+2.987776756286621*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-3.3403704166412354*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.07194828987121582*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"500-g":1/(1+1/Math.exp(.5289734601974487-.5567987561225891*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.3352314233779907*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.4835448265075684*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"500-b":1/(1+1/Math.exp(-1.2478309869766235-2.2976744174957275*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.30013492703437805*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+4.339084625244141*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"600-r":1/(1+1/Math.exp(.18572008609771729+2.5128233432769775*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-3.407212495803833*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.20814435184001923*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"600-g":1/(1+1/Math.exp(.15741883218288422-.7273809909820557*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.2500137090682983*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.6501106023788452*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"600-b":1/(1+1/Math.exp(-1.3073996305465698-2.5112154483795166*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.7157139182090759*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+4.086366176605225*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"700-r":1/(1+1/Math.exp(-.25121745467185974+1.7795124053955078*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-2.7557551860809326*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.0411522202193737*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"700-g":1/(1+1/Math.exp(-.43503373861312866-.6766132712364197*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+1.150789737701416*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.3406033515930176*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"700-b":1/(1+1/Math.exp(-1.1124053001403809-2.359389305114746*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.943118691444397*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+3.267453908920288*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"800-r":1/(1+1/Math.exp(-.42729225754737854+1.2738885879516602*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-2.573699474334717*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.11818580329418182*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"800-g":1/(1+1/Math.exp(-.6730203628540039-.770199716091156*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.9060920476913452*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.2600882053375244*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"800-b":1/(1+1/Math.exp(-1.32567298412323-1.9301948547363281*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.8552113175392151*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+2.6513888835906982*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"900-r":1/(1+1/Math.exp(-.6309270858764648+1.0235852003097534*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-2.4659388065338135*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.15058130025863647*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"900-g":1/(1+1/Math.exp(-.9010928273200989-.7559532523155212*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.7665435075759888*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.1884112358093262*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"900-b":1/(1+1/Math.exp(-1.5088001489639282-1.5986618995666504*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.7353832125663757*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+2.180158853530884*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"950-r":1/(1+1/Math.exp(-1.166185975074768+.5363732576370239*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-2.587523937225342*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-.061746854335069656*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"950-g":1/(1+1/Math.exp(-1.2907893657684326-1.3924223184585571*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))+.5465696454048157*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))-1.2647709846496582*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0))))),"950-b":1/(1+1/Math.exp(-1.8633685111999512-1.8034374713897705*1/(1+1/Math.exp(.5648569464683533+8.592248916625977*(e[0]||0)-2.0615885257720947*(e[1]||0)-7.465658187866211*(e[2]||0)))-.8856748938560486*1/(1+1/Math.exp(.6313956379890442-7.673094272613525*(e[0]||0)+8.008654594421387*(e[1]||0)-1.6121777296066284*(e[2]||0)))+1.8510282039642334*1/(1+1/Math.exp(.08400232344865799-.9345706105232239*(e[0]||0)-7.6551032066345215*(e[1]||0)+8.717894554138184*(e[2]||0)))))}}const{PALETTE_SHADES:N1}=await n("@baseplate-dev/project-builder-lib");function $(s,e){return`${s}-${e}`}function y1(s){const r=Z("rgb")(s);if(!r)throw new Error(`Invalid color: ${s}`);const l=w1(r);return Object.fromEntries(N1.map(a=>{const x={mode:"rgb",r:l[$(a,"r")],g:l[$(a,"g")],b:l[$(a,"b")]};return[a,e1(x)]}))}const{COLOR_PALETTES:P,convertHexToOklch:R,convertOklchToHex:I,PALETTE_SHADES:S1}=await n("@baseplate-dev/project-builder-lib"),{Button:k1,ColorPickerFieldController:K,ComboboxFieldController:$1}=await n("@baseplate-dev/ui-components"),{useCallback:P1}=await n("react");function _({control:s,getValues:e,setValue:r,onShadesChange:l,type:a}){const x=[{value:"custom",label:"Custom Base"},...Object.keys(P).map(o=>({value:o,label:Y.capitalize(o)}))],c=f({control:s,name:`palettes.${a}.paletteName`}),m=P1(o=>{if(!o||!Object.prototype.hasOwnProperty.call(P,o))return;const h=P[o];r(`palettes.${a}.shades`,h),l?.(h)},[r,l,a]),i=()=>{const o=e(`palettes.${a}.customBase`);if(!o)return;const h=y1(o);r(`palettes.${a}.shades`,h),l?.(h)};return t.jsxs("div",{className:"flex max-w-fit flex-col gap-4",children:[t.jsx($1,{name:`palettes.${a}.paletteName`,control:s,options:x,placeholder:"Choose a base palette",onChange:m}),c==="custom"&&t.jsxs("div",{className:"flex max-w-xl items-center justify-between",children:[t.jsx(K,{className:"flex-1 space-x-1",wrapperClassName:"items-center",control:s,name:`palettes.${a}.customBase`,label:"Custom Base Color",placeholder:"Choose a color",parseColor:I,serializeColor:R}),t.jsx(k1,{variant:"secondary",onClick:i,size:"sm",children:"Generate"})]}),t.jsx("div",{className:"flex gap-3",children:S1.map(o=>t.jsx(K,{wrapperClassName:"flex flex-col items-center",hideText:!0,control:s,name:`palettes.${a}.shades.${o}`,label:o,parseColor:I,serializeColor:R,onChange:()=>l?.(e(`palettes.${a}.shades`))},o))})]})}const{createThemeSchema:O1,generateDefaultTheme:E1,generateThemeColorsFromShade:W}=await n("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:B1,useDefinitionSchema:D1,useProjectDefinition:L1,useResettableForm:F1}=await n("@baseplate-dev/project-builder-lib/web"),{Alert:A1,AlertDescription:H1,AlertTitle:z1,Button:R1,FormActionBar:I1,SectionList:K1,SectionListSection:O,SectionListSectionContent:E,SectionListSectionDescription:B,SectionListSectionHeader:D,SectionListSectionTitle:L,Tabs:G,TabsContent:T,TabsList:U,TabsTrigger:w}=await n("@baseplate-dev/ui-components"),{useCallback:V,useMemo:_1,useState:W1}=await n("react"),Y1=function(){const{definition:e,saveDefinitionWithFeedback:r}=L1(),l=D1(O1),a=_1(()=>e.settings.theme??E1(),[e.settings.theme]),x=F1({resolver:q(l),values:a}),{control:c,handleSubmit:m,setValue:i,getValues:o,reset:h}=x,y=m(p=>r(d=>{d.settings.theme=p}));B1({control:c,reset:h,onSubmit:y});const b=V(p=>{const d=o("palettes");i("colors",{light:W(d,"light",p?void 0:{palettes:a.palettes,config:a.colors.light}),dark:W(d,"dark",p?void 0:{palettes:a.palettes,config:a.colors.dark})})},[o,i,a]),g=V(()=>{b()},[b]),[u,j]=W1("light");return t.jsxs("form",{className:"relative h-full max-h-full pb-(--action-bar-height)",onSubmit:y,children:[t.jsxs("div",{className:"flex h-full max-h-full flex-1 flex-col overflow-y-auto px-6",children:[t.jsxs("div",{className:"sticky top-0 z-10 space-y-2 border-b bg-background py-6",children:[t.jsx("h1",{children:"Theme Builder"}),t.jsxs("p",{className:"max-w-3xl text-muted-foreground",children:["The theme of the UI is based off color variables used with"," ",t.jsx("a",{href:"https://ui.shadcn.com/docs/theming",target:"_blank",rel:"noreferrer",className:"underline",children:"the Shadn UI component library"}),". We generate the color variables based off the Tailwind color palette structure but you can customize them as you wish."]})]}),t.jsxs("div",{className:"pt-4",children:[t.jsxs(A1,{className:"max-w-fit",children:[t.jsx(X,{}),t.jsx(z1,{children:"Work in Progress"}),t.jsx(H1,{children:"This page is still a work in progress. It is not being used for generation at the moment."})]}),t.jsxs(K1,{children:[t.jsxs(O,{children:[t.jsxs(D,{children:[t.jsx(L,{children:"Theme Palettes"}),t.jsx(B,{children:"Pick the colors for your theme"})]}),t.jsx(E,{className:"max-w-3xl",children:t.jsxs(G,{defaultValue:"base",children:[t.jsxs(U,{children:[t.jsx(w,{value:"base",children:"Base"}),t.jsx(w,{value:"primary",children:"Primary"})]}),t.jsx(T,{value:"base",children:t.jsx(_,{control:c,getValues:o,setValue:i,type:"base",onShadesChange:g})}),t.jsx(T,{value:"primary",children:t.jsx(_,{control:c,getValues:o,setValue:i,type:"primary",onShadesChange:g})})]})})]}),t.jsxs(O,{children:[t.jsxs(D,{children:[t.jsx(L,{children:"Theme Colors"}),t.jsx(B,{children:"Pick the colors for your theme"}),t.jsx("div",{className:"sticky top-44",children:t.jsx(T1,{control:c,mode:u},u)})]}),t.jsxs(E,{className:"flex flex-col gap-4",children:[t.jsxs(G,{value:u,onValueChange:j,children:[t.jsxs(U,{children:[t.jsx(w,{value:"light",children:"Light"}),t.jsx(w,{value:"dark",children:"Dark"})]}),t.jsx(T,{value:"light",children:t.jsx(z,{control:c,setValue:i,mode:"light"})}),t.jsx(T,{value:"dark",children:t.jsx(z,{control:c,setValue:i,mode:"dark"})})]}),t.jsx(R1,{onClick:()=>{b(!0)},variant:"outline",size:"sm",type:"button",className:"w-fit",children:"Reset Colors"})]})]}),t.jsxs(O,{children:[t.jsxs(D,{children:[t.jsx(L,{children:"CSS Preview"}),t.jsx(B,{children:"Preview the CSS for your theme"})]}),t.jsx(E,{className:"flex flex-col gap-4",children:t.jsx(s1,{control:c})})]})]})]})]}),t.jsx(I1,{form:x})]})};export{Y1 as component}; //# sourceMappingURL=theme-builder-DBncXgCU.js.map