admin08077/Githubgemini
0
1import{r as i,j as e}from"./react-CIdJ77ke.js";import{h as N,$ as S,S as P,W as T,L as k}from"./index-CX7Qxd1D.js";import{f as w}from"./fileUtils-DLahR3l0.js";import"./accessibilityService-PX6aNbbc.js";import"./workspaceConnectorService-KhhKdOYD.js";import"./@braintree-DzxiOROe.js";import"./react-dom-R9L8nDNe.js";import"./scheduler-CoSDG3-6.js";import"./@google-CcUHq7Ay.js";import"./idb-Dob3nYDb.js";import"./marked-BrGMJkBT.js";import"./mermaid-KwKZWwy0.js";import"./dayjs-CeEF-NGT.js";import"./d3-transition-CiCB8KJE.js";import"./d3-timer-DdKHrDhs.js";import"./d3-dispatch-kxCwF96_.js";import"./d3-interpolate-CtIaNujU.js";import"./d3-color-amxIadob.js";import"./d3-selection-C52G7wmG.js";import"./d3-ease-DRPgKoYJ.js";import"./d3-zoom-BYoC3mS3.js";import"./dompurify-J5RlrwSC.js";import"./dagre-d3-es-CTpFWynZ.js";import"./lodash-es-Dt6r0yiR.js";import"./d3-shape-CX8xTzfR.js";import"./d3-path-CimkQT29.js";import"./d3-fetch-BOsq7VnW.js";import"./khroma-DUX6PT6k.js";import"./uuid-DhYbOkY1.js";import"./d3-scale-DRZz3QW5.js";import"./internmap-BkD7Hj8s.js";import"./d3-array-DGRYoJHh.js";import"./d3-format-CzD4bSOQ.js";import"./d3-time-format-CUNN4Ell.js";import"./d3-time-6cSPyVSY.js";import"./d3-axis-DSWTncID.js";import"./elkjs-oKFFZvz7.js";import"./cytoscape-DtBltrT8.js";import"./cytoscape-cose-bilkent-Cgr1thlj.js";import"./cose-base-CwCxnKwh.js";import"./layout-base-CMXQqlmj.js";import"./d3-sankey-DgqkLiUE.js";import"./d3-scale-chromatic-B-NsZVaP.js";import"./ts-dedent-DrFu-skq.js";import"./stylis-D5iaQeiq.js";import"./mdast-util-from-markdown-CLAsVoWb.js";import"./micromark-CTBPIv-_.js";import"./micromark-util-combine-extensions-Bka6Sc1c.js";import"./micromark-util-chunked-DrRIdSP-.js";import"./micromark-factory-space-x2vfxbz5.js";import"./micromark-util-character-Bcm1tP9o.js";import"./micromark-core-commonmark-AH8VCgT7.js";import"./micromark-util-classify-character-Cq7Fg3xE.js";import"./micromark-util-resolve-all-PQCKh0dx.js";import"./decode-named-character-reference-C3-224fz.js";import"./micromark-util-subtokenize-QwsxNXk2.js";import"./micromark-factory-destination-CypD_wgM.js";import"./micromark-factory-label-CRHH4ZHP.js";import"./micromark-factory-title-B7kCBvC9.js";import"./micromark-factory-whitespace-B322EA6O.js";import"./micromark-util-normalize-identifier-C9ANKk3v.js";import"./micromark-util-html-tag-name-DbKNfynz.js";import"./micromark-util-decode-numeric-character-reference-DRnCnno4.js";import"./micromark-util-decode-string-DJl8Y_PO.js";import"./unist-util-stringify-position-Ch_qCilz.js";import"./mdast-util-to-string-C_aolqmU.js";import"./jszip-CFFhfFtd.js";import"./octokit-B6bKu3NB.js";import"./@octokit-MBEWYTsi.js";import"./bottleneck-D_vuF9V7.js";import"./universal-user-agent-CLgqIJsR.js";import"./before-after-hook-y8XtM9xW.js";import"./fast-content-type-parse-3SwieiST.js";import"./axe-core-Cc5paZPx.js";const a=({name:r,color:t})=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded-md border border-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full border border-border",style:{backgroundColor:t.value}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary capitalize",children:r}),e.jsx("p",{className:"text-xs text-text-secondary",children:t.name})]})]}),e.jsx("span",{className:"font-mono text-sm text-text-secondary",children:t.value})]}),d=({name:r,check:t})=>{const l=t.score==="AAA"?"text-green-600":t.score==="AA"?"text-emerald-600":"text-red-600";return e.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded-md border border-border text-sm",children:[e.jsx("p",{className:"text-text-secondary",children:r}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:t.ratio.toFixed(2)}),e.jsx("span",{className:`font-bold px-2 py-0.5 rounded-full text-xs ${l} ${l.replace("text-","bg-")}/10`,children:t.score})]})]})},Qe=()=>{const[r,t]=i.useState(null),[l,x]=i.useState("A calming, minimalist theme for a blog"),[m,j]=i.useState(null),[n,h]=i.useState(!1),[u,b]=i.useState(""),[,,f]=N(),y=i.useCallback(async()=>{const o={text:`Generate a theme based on this description: "${l}"`},s=m?{inlineData:{mimeType:"image/png",data:m.base64}}:null,p=s?[o,s]:[o];h(!0),b("");try{const c=await S({parts:p});t(c)}catch(c){b(c instanceof Error?c.message:"An unknown error occurred.")}finally{h(!1)}},[l,m]),g=async o=>{const s=o.target.files?.[0];if(s){const p=await w(s);j({base64:p,name:s.name}),x(`A theme based on the uploaded image: ${s.name}`)}};i.useEffect(()=>{y()},[]);const v=()=>{if(!r)return;const o={primary:r.palette.primary.value,background:r.theme.background.value,surface:r.theme.surface.value,textPrimary:r.theme.textPrimary.value,textSecondary:r.theme.textSecondary.value,textOnPrimary:r.theme.textOnPrimary.value,border:r.theme.border.value};f(o,r.mode)};return e.jsxs("div",{className:"h-full flex flex-col p-4 sm:p-6 lg:p-8 text-text-primary",children:[e.jsxs("header",{className:"mb-6",children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[e.jsx(P,{}),e.jsx("span",{className:"ml-3",children:"AI Theme Designer"})]}),e.jsx("p",{className:"text-text-secondary mt-1",children:"Generate a full design system from a description or image."})]}),e.jsxs("div",{className:"flex-grow grid grid-cols-1 md:grid-cols-2 gap-6 min-h-0",children:[e.jsxs("div",{className:"md:col-span-1 flex flex-col gap-4 bg-surface border border-border p-6 rounded-lg overflow-y-auto",children:[e.jsx("h3",{className:"text-xl font-bold",children:"Describe or Upload"}),e.jsx("textarea",{value:l,onChange:o=>x(o.target.value),className:"p-2 bg-background border border-border rounded-md resize-none text-sm h-24",placeholder:"e.g., A light, airy theme for a blog"}),e.jsxs("div",{className:"relative border border-dashed border-border rounded-lg p-4 text-center",children:[e.jsx("input",{type:"file",onChange:g,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"}),e.jsx(T,{}),e.jsx("p",{className:"text-sm mt-1",children:m?`Image: ${m.name}`:"Upload an image (optional)"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:y,disabled:n,className:"btn-primary flex-grow flex items-center justify-center gap-2 px-4 py-2",children:n?e.jsx(k,{}):"Generate New Theme"}),e.jsx("button",{onClick:v,disabled:n||!r,className:"px-4 py-2 bg-emerald-600 text-white font-bold rounded-md hover:opacity-90 transition-all disabled:opacity-50 shadow-md",children:"Apply to App"})]}),u&&e.jsx("p",{className:"text-red-500 text-xs text-center",children:u}),r&&!n&&e.jsxs("div",{className:"mt-4 border-t border-border pt-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold mb-2",children:"Palette"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{name:"Primary",color:r.palette.primary}),e.jsx(a,{name:"Secondary",color:r.palette.secondary}),e.jsx(a,{name:"Accent",color:r.palette.accent}),e.jsx(a,{name:"Neutral",color:r.palette.neutral})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold mb-2",children:"Theme Roles"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{name:"Background",color:r.theme.background}),e.jsx(a,{name:"Surface",color:r.theme.surface}),e.jsx(a,{name:"Text Primary",color:r.theme.textPrimary}),e.jsx(a,{name:"Text Secondary",color:r.theme.textSecondary}),e.jsx(a,{name:"Text on Primary",color:r.theme.textOnPrimary}),e.jsx(a,{name:"Border",color:r.theme.border})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold mb-2",children:"Accessibility (WCAG 2.1)"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{name:"Primary on Surface",check:r.accessibility.primaryOnSurface}),e.jsx(d,{name:"Text on Surface",check:r.accessibility.textPrimaryOnSurface}),e.jsx(d,{name:"Subtle Text on Surface",check:r.accessibility.textSecondaryOnSurface}),e.jsx(d,{name:"Text on Primary",check:r.accessibility.textOnPrimaryOnPrimary})]})]})]})]}),e.jsxs("div",{className:"md:col-span-1 rounded-lg p-8 overflow-y-auto border border-border",style:{backgroundColor:r?.theme.background.value,color:r?.theme.textPrimary.value},children:[e.jsx("h3",{className:"text-2xl font-bold mb-6",children:"Live Preview"}),r?e.jsxs("div",{className:"p-6 rounded-lg grid grid-cols-1 md:grid-cols-2 gap-6",style:{backgroundColor:r.theme.surface.value},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-lg font-bold",children:"Sample Card"}),e.jsx("p",{className:"text-sm",style:{color:r.theme.textSecondary.value},children:"This is a sample card to demonstrate the theme colors. It contains a primary button and some secondary text."}),e.jsx("button",{className:"px-4 py-2 rounded-md font-bold transition-colors",style:{backgroundColor:r.palette.primary.value,color:r.theme.textOnPrimary.value},children:"Primary Button"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{type:"text",placeholder:"Text input",className:"w-full px-3 py-2 rounded-md border",style:{backgroundColor:r.theme.background.value,borderColor:r.theme.border.value,color:r.theme.textPrimary.value}}),e.jsx("div",{className:"p-3 border rounded",style:{borderColor:r.theme.border.value,color:r.theme.textSecondary.value},children:e.jsx("p",{children:"A bordered container."})})]})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary",children:"Theme preview will appear here."})]})]})]})};export{Qe as ThemeDesigner};2//# sourceMappingURL=ThemeDesigner-DPl6yDXo.js.map3 