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-DOo8C-zl.js";import{j as t}from"./jsx-runtime-D_zvdyIk.js";import{b as q}from"./index-DiAhmW9l.js";import{c as N,D as J,E as Q,F as X}from"./index-G5ZRloOW.js";import{e as b}from"./index.esm-DImnoN58.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(a){return Object.entries(a).map(([e,r])=>` ${e}: ${r};`).join(` `)}function s1({className:a,control:e}){const r=b({control:e,name:"colors"}),o=a1(()=>` :root { ${A(F(r.light))} } .dark, html[data-theme='dark'] { ${A(F(r.dark))} } `.trim(),[r]);return t.jsx("div",{className:N("",a),children:t.jsx(t1,{className:"h-60",readOnly:!0,value:o})})}const{convertHexToOklch:r1,convertOklchToColorName:o1,convertOklchToHex:l1,getDefaultThemeColorFromShade:i1,THEME_COLORS:n1}=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:a,control:e,mode:r,setValue:o}){const s=Object.entries(n1),i=b({control:e,name:"palettes"}),u=b({control:e,name:`colors.${r}`});return t.jsx("div",{className:N("flex w-full max-w-xl gap-4",a),children:t.jsx("div",{className:"grid flex-1 grid-cols-1 gap-4 sm:grid-cols-2",children:s.map(([c,x],l)=>{const h=c,f=(l>0?s[l-1][1].groupKey:void 0)!==x.groupKey,M=u[h],g=i1(i,r,h);return t.jsxs("div",{className:N(f?"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:x.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:x.description})})]})]}),parseColor:l1,serializeColor:r1,formatColorName:p=>{const d=Object.entries(i.base.shades).find(([,y])=>y===p)?.[0];if(d)return`base-${d}`;const L=Object.entries(i.primary.shades).find(([,y])=>y===p)?.[0];return L?`primary-${L}`:o1(p)},name:`colors.${r}.${h}`}),M!==g&&t.jsx(H,{className:"absolute right-2 bottom-1",onClick:()=>{o(`colors.${r}.${h}`,g)},size:"icon",variant:"ghost","aria-label":"Reset Color",children:t.jsx(Q,{})})]},c)})})})}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:S}=await n("@baseplate-dev/ui-components");function T1({className:a,control:e,mode:r}){const o=b({control:e,name:`colors.${r}`}),s=d1(o);return t.jsx("div",{className:N("size-full rounded-xl border border-border bg-background p-4",a),style:s,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:s,children:[t.jsx(S,{value:"opt1",label:"Option 1",children:"Option 1"}),t.jsx(S,{value:"green",label:"Option 2",children:"Option 2"}),t.jsx(S,{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:a}){return t.jsx("h4",{className:"text-lg font-semibold",children:a})}function w1(a){const e=new Float32Array([a.r,a.g,a.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 k(a,e){return`${a}-${e}`}function y1(a){const r=Z("rgb")(a);if(!r)throw new Error(`Invalid color: ${a}`);const o=w1(r);return Object.fromEntries(N1.map(s=>{const i={mode:"rgb",r:o[k(s,"r")],g:o[k(s,"g")],b:o[k(s,"b")]};return[s,e1(i)]}))}const{COLOR_PALETTES:$,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:a,getValues:e,setValue:r,onShadesChange:o,type:s}){const i=[{value:"custom",label:"Custom Base"},...Object.keys($).map(l=>({value:l,label:Y.capitalize(l)}))],u=b({control:a,name:`palettes.${s}.paletteName`}),c=P1(l=>{if(!l||!Object.prototype.hasOwnProperty.call($,l))return;const h=$[l];r(`palettes.${s}.shades`,h),o?.(h)},[r,o,s]),x=()=>{const l=e(`palettes.${s}.customBase`);if(!l)return;const h=y1(l);r(`palettes.${s}.shades`,h),o?.(h)};return t.jsxs("div",{className:"flex max-w-fit flex-col gap-4",children:[t.jsx($1,{name:`palettes.${s}.paletteName`,control:a,options:i,placeholder:"Choose a base palette",onChange:c}),u==="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:a,name:`palettes.${s}.customBase`,label:"Custom Base Color",placeholder:"Choose a color",parseColor:I,serializeColor:R}),t.jsx(k1,{variant:"secondary",onClick:x,size:"sm",children:"Generate"})]}),t.jsx("div",{className:"flex gap-3",children:S1.map(l=>t.jsx(K,{wrapperClassName:"flex flex-col items-center",hideText:!0,control:a,name:`palettes.${s}.shades.${l}`,label:l,parseColor:I,serializeColor:R,onChange:()=>o?.(e(`palettes.${s}.shades`))},l))})]})}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:P,SectionListSectionContent:O,SectionListSectionDescription:E,SectionListSectionHeader:B,SectionListSectionTitle:D,Tabs:G,TabsContent:T,TabsList:U,TabsTrigger:w}=await n("@baseplate-dev/ui-components"),{useCallback:V,useMemo:_1,useState:W1}=await n("react");function Y1(){const{definition:a,saveDefinitionWithFeedback:e}=L1(),r=D1(O1),o=_1(()=>a.settings.theme??E1(),[a.settings.theme]),s=F1({resolver:q(r),values:o}),{control:i,handleSubmit:u,setValue:c,getValues:x,reset:l}=s,h=u(p=>e(d=>{d.settings.theme=p}));B1({control:i,reset:l,onSubmit:h});const j=V(p=>{const d=x("palettes");c("colors",{light:W(d,"light",p?void 0:{palettes:o.palettes,config:o.colors.light}),dark:W(d,"dark",p?void 0:{palettes:o.palettes,config:o.colors.dark})})},[x,c,o]),f=V(()=>{j()},[j]),[M,g]=W1("light");return t.jsxs("form",{className:"relative h-full max-h-full pb-(--action-bar-height)",onSubmit:h,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(P,{children:[t.jsxs(B,{children:[t.jsx(D,{children:"Theme Palettes"}),t.jsx(E,{children:"Pick the colors for your theme"})]}),t.jsx(O,{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:i,getValues:x,setValue:c,type:"base",onShadesChange:f})}),t.jsx(T,{value:"primary",children:t.jsx(_,{control:i,getValues:x,setValue:c,type:"primary",onShadesChange:f})})]})})]}),t.jsxs(P,{children:[t.jsxs(B,{children:[t.jsx(D,{children:"Theme Colors"}),t.jsx(E,{children:"Pick the colors for your theme"}),t.jsx("div",{className:"sticky top-44",children:t.jsx(T1,{control:i,mode:M},M)})]}),t.jsxs(O,{className:"flex flex-col gap-4",children:[t.jsxs(G,{value:M,onValueChange:g,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:i,setValue:c,mode:"light"})}),t.jsx(T,{value:"dark",children:t.jsx(z,{control:i,setValue:c,mode:"dark"})})]}),t.jsx(R1,{onClick:()=>{j(!0)},variant:"outline",size:"sm",type:"button",className:"w-fit",children:"Reset Colors"})]})]}),t.jsxs(P,{children:[t.jsxs(B,{children:[t.jsx(D,{children:"CSS Preview"}),t.jsx(E,{children:"Preview the CSS for your theme"})]}),t.jsx(O,{className:"flex flex-col gap-4",children:t.jsx(s1,{control:i})})]})]})]})]}),t.jsx(I1,{form:s})]})}export{Y1 as component}; //# sourceMappingURL=theme-builder-BAJifUOw.js.map