Lachlan McMurtrie commited on
The app is a collaborative component builder. it begin by starting a project, entering in a description. the next page will be an ai assisted project scope, where the user will type the component type, which will be a list of core components (all that are core across ui domains). The ai will then ask for a framework of native react or react for web. the behavioral hooks, interactions and utilites that align with the component will then be showed. for web, these must be all react-aria, for native, these will be react-native. assume react-shared types for cross platform as common, as well as react-stately for states which are also cross platform. provide the user with a the data attributes as per react-aria or native equivilant documentation, ask them how they want to recieve their code files - combined as typed primitives, or separated through the use of an adapter that exports the behaviors etc to the primitive.
Browse files- README.md +8 -5
- code.html +270 -0
- components/footer.js +69 -0
- components/header.js +107 -0
- index.html +126 -19
- scope.html +282 -0
- script.js +144 -0
- style.css +62 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ComponentForge AI Builder 🛠️
|
| 3 |
+
colorFrom: gray
|
| 4 |
+
colorTo: blue
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
code.html
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ComponentForge - Code Generation</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gray-900 text-white min-h-screen">
|
| 14 |
+
<custom-header></custom-header>
|
| 15 |
+
|
| 16 |
+
<main class="container mx-auto px-4 py-8">
|
| 17 |
+
<div class="max-w-6xl mx-auto">
|
| 18 |
+
<!-- Progress Bar -->
|
| 19 |
+
<div class="mb-8">
|
| 20 |
+
<div class="flex items-center justify-between mb-2">
|
| 21 |
+
<span class="text-sm text-gray-400">Step 3 of 3</span>
|
| 22 |
+
<span class="text-sm text-green-400">Code Generation</span>
|
| 23 |
+
</div>
|
| 24 |
+
<div class="w-full bg-gray-700 rounded-full h-2">
|
| 25 |
+
<div class="bg-gradient-to-r from-purple-500 via-pink-500 to-green-500 h-2 rounded-full w-full"></div>
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<!-- Project Summary -->
|
| 29 |
+
<div class="bg-gray-800 rounded-xl p-6 mb-6 border border-gray-700">
|
| 30 |
+
<div class="flex items-center justify-between">
|
| 31 |
+
<div>
|
| 32 |
+
<h2 class="text-xl font-bold" id="finalProjectTitle">Project: Loading...</h2>
|
| 33 |
+
<div class="flex items-center space-x-4 mt-2">
|
| 34 |
+
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-purple-500/20 text-purple-300 border border-purple-500/30" id="frameworkBadge"></span>
|
| 35 |
+
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-pink-500/20 text-pink-300 border border-pink-500/30" id="structureBadge"></span>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
<button onclick="window.location.href = 'scope.html'" class="text-gray-400 hover:text-white transition-colors">
|
| 39 |
+
<i data-feather="arrow-left" class="w-5 h-5"></i>
|
| 40 |
+
</button>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
|
| 44 |
+
<!-- Generated Code -->
|
| 45 |
+
<div class="grid lg:grid-cols-2 gap-8">
|
| 46 |
+
<!-- Component Files -->
|
| 47 |
+
<div class="space-y-6">
|
| 48 |
+
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 49 |
+
<div class="flex items-center justify-between mb-4">
|
| 50 |
+
<div class="flex items-center">
|
| 51 |
+
<i data-feather="file-text" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 52 |
+
<h3 class="text-lg font-semibold">Generated Files</h3>
|
| 53 |
+
</div>
|
| 54 |
+
<button id="downloadAllBtn" class="px-4 py-2 bg-green-600 hover:bg-green-700 text-white font-medium rounded-lg transition-all duration-200 flex items-center">
|
| 55 |
+
<i data-feather="download" class="w-4 h-4 mr-2"></i>
|
| 56 |
+
Download All
|
| 57 |
+
</button>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<!-- File Tabs -->
|
| 61 |
+
<div class="border-b border-gray-700 mb-4">
|
| 62 |
+
<div class="flex space-x-2">
|
| 63 |
+
<button class="file-tab active px-4 py-2 text-sm font-medium border-b-2 border-purple-500">
|
| 64 |
+
Component.tsx
|
| 65 |
+
</button>
|
| 66 |
+
<button class="file-tab px-4 py-2 text-sm font-medium text-gray-400 hover:text-white transition-colors" data-file="hooks">
|
| 67 |
+
Hooks.ts
|
| 68 |
+
</button>
|
| 69 |
+
<button class="file-tab px-4 py-2 text-sm font-medium text-gray-400 hover:text-white transition-colors" data-file="types">
|
| 70 |
+
Types.ts
|
| 71 |
+
</button>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<!-- Code Preview -->
|
| 76 |
+
<div class="bg-gray-900 rounded-lg p-4 border border-gray-700">
|
| 77 |
+
<pre id="codePreview" class="text-sm font-mono text-gray-300 overflow-x-auto">
|
| 78 |
+
<code>// Your component code will appear here</code>
|
| 79 |
+
</pre>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<!-- Next Steps -->
|
| 84 |
+
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 85 |
+
<div class="flex items-center mb-4">
|
| 86 |
+
<i data-feather="check-circle" class="w-6 h-6 text-green-500 mr-3"></i>
|
| 87 |
+
<h3 class="text-lg font-semibold">Next Steps</h3>
|
| 88 |
+
</div>
|
| 89 |
+
<div class="space-y-3">
|
| 90 |
+
<div class="flex items-center p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 91 |
+
<i data-feather="download" class="w-4 h-4 text-green-500 mr-3"></i>
|
| 92 |
+
<span class="text-sm">Install dependencies in your project</span>
|
| 93 |
+
</div>
|
| 94 |
+
<div class="flex items-center p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 95 |
+
<i data-feather="folder" class="w-4 h-4 text-blue-500 mr-3"></i>
|
| 96 |
+
<span class="text-sm">Copy the generated files to your codebase</span>
|
| 97 |
+
</div>
|
| 98 |
+
<div class="flex items-center p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 99 |
+
<i data-feather="settings" class="w-4 h-4 text-yellow-500 mr-3"></i>
|
| 100 |
+
<span class="text-sm">Configure TypeScript paths if needed</span>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<!-- Preview & Documentation -->
|
| 107 |
+
<div class="space-y-6">
|
| 108 |
+
<!-- Component Preview -->
|
| 109 |
+
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 110 |
+
<div class="flex items-center mb-4">
|
| 111 |
+
<i data-feather="eye" class="w-6 h-6 text-pink-500 mr-3"></i>
|
| 112 |
+
<h3 class="text-lg font-semibold">Live Preview</h3>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="bg-gray-900 rounded-lg p-8 border border-gray-700 flex items-center justify-center min-h-[200px]">
|
| 115 |
+
<div class="text-center text-gray-500">
|
| 116 |
+
<i data-feather="code" class="w-12 h-12 mx-auto mb-3"></i>
|
| 117 |
+
<p class="text-sm">Component preview will appear here</p>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
<!-- Documentation -->
|
| 122 |
+
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 123 |
+
<div class="flex items-center mb-4">
|
| 124 |
+
<i data-feather="book" class="w-6 h-6 text-blue-500 mr-3"></i>
|
| 125 |
+
<h3 class="text-lg font-semibold">Usage Documentation</h3>
|
| 126 |
+
</div>
|
| 127 |
+
<div class="space-y-3">
|
| 128 |
+
<div class="p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 129 |
+
<h4 class="font-semibold text-sm mb-2">Basic Usage</h4>
|
| 130 |
+
<pre class="text-xs font-mono text-gray-400 bg-gray-800 p-2 rounded mt-1">
|
| 131 |
+
<code>import { Component } from './Component';</code>
|
| 132 |
+
</pre>
|
| 133 |
+
</div>
|
| 134 |
+
<div class="p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 135 |
+
<h4 class="font-semibold text-sm mb-2">Props</h4>
|
| 136 |
+
<div class="text-xs text-gray-400 mt-1">
|
| 137 |
+
<div class="flex justify-between py-1 border-b border-gray-600">
|
| 138 |
+
<span class="font-mono">value</span>
|
| 139 |
+
<span class="text-gray-500">string</span>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
|
| 147 |
+
<!-- Action Buttons -->
|
| 148 |
+
<div class="flex justify-between items-center mt-8">
|
| 149 |
+
<button onclick="window.location.href = 'scope.html'" class="px-6 py-3 bg-gray-700 hover:bg-gray-600 text-white font-medium rounded-lg transition-all duration-200 flex items-center">
|
| 150 |
+
<i data-feather="arrow-left" class="w-5 h-5 mr-2"></i>
|
| 151 |
+
Back to Scope
|
| 152 |
+
</button>
|
| 153 |
+
<button onclick="window.location.href = 'index.html'" class="px-6 py-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white font-semibold rounded-lg transition-all duration-200 transform hover:scale-105 focus:ring-4 focus:ring-purple-500 focus:ring-opacity-50 flex items-center">
|
| 154 |
+
<i data-feather="plus" class="w-5 h-5 mr-2"></i>
|
| 155 |
+
Start New Project
|
| 156 |
+
</button>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
</main>
|
| 160 |
+
|
| 161 |
+
<custom-footer></custom-footer>
|
| 162 |
+
|
| 163 |
+
<script src="components/header.js"></script>
|
| 164 |
+
<script src="components/footer.js"></script>
|
| 165 |
+
<script src="script.js"></script>
|
| 166 |
+
<script>
|
| 167 |
+
feather.replace();
|
| 168 |
+
|
| 169 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 170 |
+
const projectData = StorageManager.getProjectData();
|
| 171 |
+
document.getElementById('finalProjectTitle').textContent = `Project: ${projectData.name}`;
|
| 172 |
+
|
| 173 |
+
// Update badges
|
| 174 |
+
const frameworkBadge = document.getElementById('frameworkBadge');
|
| 175 |
+
const structureBadge = document.getElementById('structureBadge');
|
| 176 |
+
|
| 177 |
+
frameworkBadge.innerHTML = `<i data-feather="${projectData.framework === 'react-web' ? 'globe' : 'smartphone'}" class="w-3 h-3 mr-1"></i> ${projectData.framework === 'react-web' ? 'React Web' : 'React Native'}`;
|
| 178 |
+
|
| 179 |
+
structureBadge.innerHTML = `<i data-feather="${projectData.codeStructure === 'typed-primitives' ? 'type' : 'layers'}" class="w-3 h-3 mr-1"></i> ${projectData.codeStructure === 'typed-primitives' ? 'Typed Primitives' : 'Adapter Pattern'}`;
|
| 180 |
+
|
| 181 |
+
// File tab switching
|
| 182 |
+
document.querySelectorAll('.file-tab').forEach(tab => {
|
| 183 |
+
tab.addEventListener('click', function() {
|
| 184 |
+
document.querySelectorAll('.file-tab').forEach(t => {
|
| 185 |
+
t.classList.remove('active', 'border-purple-500', 'text-white'};
|
| 186 |
+
t.classList.add('text-gray-400'});
|
| 187 |
+
});
|
| 188 |
+
this.classList.add('active', 'border-purple-500', 'text-white'});
|
| 189 |
+
this.classList.remove('text-gray-400'});
|
| 190 |
+
|
| 191 |
+
// Update code preview based on selected file
|
| 192 |
+
const fileType = this.dataset.file || 'component';
|
| 193 |
+
this.updateCodePreview(fileType);
|
| 194 |
+
});
|
| 195 |
+
});
|
| 196 |
+
|
| 197 |
+
// Download all files
|
| 198 |
+
document.getElementById('downloadAllBtn').addEventListener('click', function() {
|
| 199 |
+
// Generate and download all files as zip
|
| 200 |
+
this.generateAndDownloadFiles();
|
| 201 |
+
}.bind(this));
|
| 202 |
+
});
|
| 203 |
+
|
| 204 |
+
// Update code preview based on file type
|
| 205 |
+
function updateCodePreview(fileType) {
|
| 206 |
+
const codePreview = document.getElementById('codePreview');
|
| 207 |
+
const mockCode = {
|
| 208 |
+
component: `import React from 'react';
|
| 209 |
+
import { useButton } from '@react-aria/button';
|
| 210 |
+
import { useFocusRing } from '@react-aria/focus';
|
| 211 |
+
import type { ButtonProps } from './types';
|
| 212 |
+
|
| 213 |
+
export const Button: React.FC<ButtonProps> = (props) => {
|
| 214 |
+
const ref = React.useRef<HTMLButtonElement>(null);
|
| 215 |
+
const { buttonProps } = useButton(props, ref);
|
| 216 |
+
const { focusProps, isFocusVisible } = useFocusRing();
|
| 217 |
+
|
| 218 |
+
return (
|
| 219 |
+
<button
|
| 220 |
+
{...buttonProps}
|
| 221 |
+
{...focusProps}
|
| 222 |
+
ref={ref}
|
| 223 |
+
data-focused={isFocusVisible}
|
| 224 |
+
data-pressed={buttonProps['aria-pressed']}
|
| 225 |
+
data-disabled={props.disabled}
|
| 226 |
+
className={\`px-4 py-2 rounded-lg transition-all \${props.disabled ? 'opacity-50 cursor-not-allowed' : 'hover:bg-opacity-90'} \${isFocusVisible ? 'ring-2 ring-purple-500' : ''}\`}
|
| 227 |
+
>
|
| 228 |
+
{props.children}
|
| 229 |
+
</button>
|
| 230 |
+
);
|
| 231 |
+
};`,
|
| 232 |
+
hooks: `import { useButton } from '@react-aria/button';
|
| 233 |
+
import { useFocusRing } from '@react-aria/focus';
|
| 234 |
+
|
| 235 |
+
export const useButtonBehavior = (props: ButtonProps) => {
|
| 236 |
+
const ref = React.useRef<HTMLButtonElement>(null);
|
| 237 |
+
const { buttonProps } = useButton(props, ref);
|
| 238 |
+
const { focusProps, isFocusVisible } = useFocusRing();
|
| 239 |
+
|
| 240 |
+
return {
|
| 241 |
+
buttonProps: {
|
| 242 |
+
...buttonProps,
|
| 243 |
+
...focusProps
|
| 244 |
+
},
|
| 245 |
+
ref,
|
| 246 |
+
state: {
|
| 247 |
+
isFocusVisible,
|
| 248 |
+
isPressed: buttonProps['aria-pressed']
|
| 249 |
+
}
|
| 250 |
+
};
|
| 251 |
+
};`,
|
| 252 |
+
types: `export interface ButtonProps {
|
| 253 |
+
children: React.ReactNode;
|
| 254 |
+
disabled?: boolean;
|
| 255 |
+
onPress?: () => void;
|
| 256 |
+
type?: 'button' | 'submit' | 'reset';
|
| 257 |
+
}`
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
codePreview.innerHTML = `<code>${mockCode[fileType]}</code>`;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
// Generate and download files as zip
|
| 264 |
+
function generateAndDownloadFiles() {
|
| 265 |
+
// In a real implementation, this would generate actual files and create a zip
|
| 266 |
+
alert('All files would be downloaded as a ZIP archive in a real implementation!');
|
| 267 |
+
}
|
| 268 |
+
</script>
|
| 269 |
+
</body>
|
| 270 |
+
</html>
|
components/footer.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
footer {
|
| 7 |
+
background: rgba(17, 24, 39, 0.8);
|
| 8 |
+
border-top: 1px solid rgba(55, 65, 81, 0.5);
|
| 9 |
+
margin-top: auto;
|
| 10 |
+
}
|
| 11 |
+
.container {
|
| 12 |
+
max-width: 1200px;
|
| 13 |
+
margin: 0 auto;
|
| 14 |
+
padding: 0 1rem;
|
| 15 |
+
}
|
| 16 |
+
.footer-content {
|
| 17 |
+
display: flex;
|
| 18 |
+
justify-content: space-between;
|
| 19 |
+
align-items: center;
|
| 20 |
+
padding: 2rem 0;
|
| 21 |
+
}
|
| 22 |
+
.footer-links {
|
| 23 |
+
display: flex;
|
| 24 |
+
gap: 2rem;
|
| 25 |
+
}
|
| 26 |
+
.footer-link {
|
| 27 |
+
color: #9ca3af;
|
| 28 |
+
text-decoration: none;
|
| 29 |
+
font-size: 0.875rem;
|
| 30 |
+
transition: color 0.2s;
|
| 31 |
+
}
|
| 32 |
+
.footer-link:hover {
|
| 33 |
+
color: white;
|
| 34 |
+
}
|
| 35 |
+
.copyright {
|
| 36 |
+
color: #6b7280;
|
| 37 |
+
font-size: 0.875rem;
|
| 38 |
+
}
|
| 39 |
+
@media (max-width: 768px) {
|
| 40 |
+
.footer-content {
|
| 41 |
+
flex-direction: column;
|
| 42 |
+
gap: 1rem;
|
| 43 |
+
text-align: center;
|
| 44 |
+
}
|
| 45 |
+
.footer-links {
|
| 46 |
+
gap: 1rem;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
</style>
|
| 50 |
+
<footer>
|
| 51 |
+
<div class="container">
|
| 52 |
+
<div class="footer-content">
|
| 53 |
+
<div class="copyright">
|
| 54 |
+
© 2024 ComponentForge AI. Built with 💜 and React.
|
| 55 |
+
</div>
|
| 56 |
+
<div class="footer-links">
|
| 57 |
+
<a href="#" class="footer-link">Privacy</a>
|
| 58 |
+
<a href="#" class="footer-link">Terms</a>
|
| 59 |
+
<a href="#" class="footer-link">GitHub</a>
|
| 60 |
+
<a href="#" class="footer-link">Contact</a>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
</footer>
|
| 65 |
+
`;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
customElements.define('custom-footer', CustomFooter);
|
components/header.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomHeader extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
header {
|
| 7 |
+
background: rgba(17, 24, 39, 0.8);
|
| 8 |
+
backdrop-filter: blur(10px);
|
| 9 |
+
border-bottom: 1px solid rgba(55, 65, 81, 0.5);
|
| 10 |
+
}
|
| 11 |
+
.container {
|
| 12 |
+
max-width: 1200px;
|
| 13 |
+
margin: 0 auto;
|
| 14 |
+
padding: 0 1rem;
|
| 15 |
+
}
|
| 16 |
+
nav {
|
| 17 |
+
display: flex;
|
| 18 |
+
align-items: center;
|
| 19 |
+
justify-content: space-between;
|
| 20 |
+
padding: 1rem 0;
|
| 21 |
+
}
|
| 22 |
+
.logo {
|
| 23 |
+
font-weight: 700;
|
| 24 |
+
font-size: 1.5rem;
|
| 25 |
+
background: linear-gradient(135deg, #a855f7, #ec4899);
|
| 26 |
+
-webkit-background-clip: text;
|
| 27 |
+
-webkit-text-fill-color: transparent;
|
| 28 |
+
background-clip: text;
|
| 29 |
+
}
|
| 30 |
+
.nav-links {
|
| 31 |
+
display: flex;
|
| 32 |
+
align-items: center;
|
| 33 |
+
gap: 2rem;
|
| 34 |
+
}
|
| 35 |
+
.nav-link {
|
| 36 |
+
color: #d1d5db;
|
| 37 |
+
text-decoration: none;
|
| 38 |
+
transition: color 0.2s;
|
| 39 |
+
}
|
| 40 |
+
.nav-link:hover {
|
| 41 |
+
color: white;
|
| 42 |
+
}
|
| 43 |
+
.theme-toggle {
|
| 44 |
+
background: none;
|
| 45 |
+
border: none;
|
| 46 |
+
color: #d1d5db;
|
| 47 |
+
cursor: pointer;
|
| 48 |
+
padding: 0.5rem;
|
| 49 |
+
border-radius: 0.375rem;
|
| 50 |
+
transition: all 0.2s;
|
| 51 |
+
}
|
| 52 |
+
.theme-toggle:hover {
|
| 53 |
+
color: white;
|
| 54 |
+
background: rgba(55, 65, 81, 0.5);
|
| 55 |
+
}
|
| 56 |
+
@media (max-width: 768px) {
|
| 57 |
+
.nav-links {
|
| 58 |
+
gap: 1rem;
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
</style>
|
| 62 |
+
<header>
|
| 63 |
+
<div class="container">
|
| 64 |
+
<nav>
|
| 65 |
+
<a href="index.html" class="logo">ComponentForge</a>
|
| 66 |
+
<div class="nav-links">
|
| 67 |
+
<a href="index.html" class="nav-link">New Project</a>
|
| 68 |
+
<a href="#" class="nav-link">Templates</a>
|
| 69 |
+
<a href="#" class="nav-link">Docs</a>
|
| 70 |
+
<button class="theme-toggle" id="themeToggle">
|
| 71 |
+
<i data-feather="moon"></i>
|
| 72 |
+
</button>
|
| 73 |
+
</div>
|
| 74 |
+
</nav>
|
| 75 |
+
</div>
|
| 76 |
+
</header>
|
| 77 |
+
`;
|
| 78 |
+
|
| 79 |
+
// Initialize feather icons in shadow DOM
|
| 80 |
+
const featherScript = document.createElement('script');
|
| 81 |
+
featherScript.src = 'https://unpkg.com/feather-icons';
|
| 82 |
+
this.shadowRoot.appendChild(featherScript);
|
| 83 |
+
|
| 84 |
+
featherScript.onload = () => {
|
| 85 |
+
feather.replace();
|
| 86 |
+
|
| 87 |
+
// Theme toggle functionality
|
| 88 |
+
const themeToggle = this.shadowRoot.getElementById('themeToggle');
|
| 89 |
+
themeToggle.addEventListener('click', () => {
|
| 90 |
+
themeManager.toggleTheme();
|
| 91 |
+
this.updateThemeIcon();
|
| 92 |
+
});
|
| 93 |
+
};
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
updateThemeIcon() {
|
| 97 |
+
const themeIcon = this.shadowRoot.querySelector('#themeToggle i');
|
| 98 |
+
if (themeManager.currentTheme === 'dark') {
|
| 99 |
+
themeIcon.setAttribute('data-feather', 'sun');
|
| 100 |
+
} else {
|
| 101 |
+
themeIcon.setAttribute('data-feather', 'moon');
|
| 102 |
+
}
|
| 103 |
+
feather.replace();
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
customElements.define('custom-header', CustomHeader);
|
index.html
CHANGED
|
@@ -1,19 +1,126 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ComponentForge - Start Your Project</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gray-900 text-white min-h-screen">
|
| 14 |
+
<custom-header></custom-header>
|
| 15 |
+
|
| 16 |
+
<main class="container mx-auto px-4 py-8">
|
| 17 |
+
<div class="max-w-4xl mx-auto">
|
| 18 |
+
<!-- Hero Section -->
|
| 19 |
+
<div class="text-center mb-12">
|
| 20 |
+
<h1 class="text-5xl font-bold mb-6 bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-transparent">
|
| 21 |
+
ComponentForge AI
|
| 22 |
+
</h1>
|
| 23 |
+
<p class="text-xl text-gray-300 mb-8">
|
| 24 |
+
Build cross-platform React components with AI assistance. From concept to production-ready code.
|
| 25 |
+
</p>
|
| 26 |
+
<div class="flex justify-center space-x-4">
|
| 27 |
+
<div class="w-3 h-3 bg-purple-500 rounded-full animate-pulse"></div>
|
| 28 |
+
<div class="w-3 h-3 bg-pink-500 rounded-full animate-pulse delay-150"></div>
|
| 29 |
+
<div class="w-3 h-3 bg-blue-500 rounded-full animate-pulse delay-300"></div>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<!-- Project Start Form -->
|
| 34 |
+
<div class="bg-gray-800 rounded-2xl p-8 shadow-2xl border border-gray-700">
|
| 35 |
+
<div class="flex items-center mb-6">
|
| 36 |
+
<i data-feather="plus-circle" class="w-8 h-8 text-purple-500 mr-3"></i>
|
| 37 |
+
<h2 class="text-2xl font-bold">Start New Component Project</h2>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
<form id="projectForm" class="space-y-6">
|
| 41 |
+
<div>
|
| 42 |
+
<label for="projectName" class="block text-sm font-medium text-gray-300 mb-2">
|
| 43 |
+
Project Name
|
| 44 |
+
</label>
|
| 45 |
+
<input
|
| 46 |
+
type="text"
|
| 47 |
+
id="projectName"
|
| 48 |
+
name="projectName"
|
| 49 |
+
required
|
| 50 |
+
class="w-full px-4 py-3 bg-gray-700 border border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent text-white placeholder-gray-400 transition-all duration-200"
|
| 51 |
+
placeholder="Enter your component project name..."
|
| 52 |
+
>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
<div>
|
| 56 |
+
<label for="projectDescription" class="block text-sm font-medium text-gray-300 mb-2">
|
| 57 |
+
Project Description
|
| 58 |
+
</label>
|
| 59 |
+
<textarea
|
| 60 |
+
id="projectDescription"
|
| 61 |
+
name="projectDescription"
|
| 62 |
+
rows="4"
|
| 63 |
+
required
|
| 64 |
+
class="w-full px-4 py-3 bg-gray-700 border border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent text-white placeholder-gray-400 resize-none transition-all duration-200"
|
| 65 |
+
placeholder="Describe your component in detail... What problem does it solve? What features should it have?"
|
| 66 |
+
></textarea>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<div class="flex items-center justify-between pt-4">
|
| 70 |
+
<div class="flex items-center text-gray-400">
|
| 71 |
+
<i data-feather="zap" class="w-4 h-4 mr-2"></i>
|
| 72 |
+
<span class="text-sm">AI-powered scope generation</span>
|
| 73 |
+
</div>
|
| 74 |
+
<button
|
| 75 |
+
type="submit"
|
| 76 |
+
class="px-8 py-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white font-semibold rounded-lg transition-all duration-200 transform hover:scale-105 focus:ring-4 focus:ring-purple-500 focus:ring-opacity-50 flex items-center"
|
| 77 |
+
>
|
| 78 |
+
<i data-feather="arrow-right" class="w-5 h-5 mr-2"></i>
|
| 79 |
+
Generate Scope
|
| 80 |
+
</button>
|
| 81 |
+
</div>
|
| 82 |
+
</form>
|
| 83 |
+
</div>
|
| 84 |
+
|
| 85 |
+
<!-- Features Grid -->
|
| 86 |
+
<div class="grid md:grid-cols-3 gap-6 mt-12">
|
| 87 |
+
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700 hover:border-purple-500 transition-all duration-300">
|
| 88 |
+
<i data-feather="cpu" class="w-8 h-8 text-purple-500 mb-4"></i>
|
| 89 |
+
<h3 class="text-lg font-semibold mb-2">AI-Powered Scoping</h3>
|
| 90 |
+
<p class="text-gray-400 text-sm">Intelligent analysis of your requirements to suggest optimal component architecture.</p>
|
| 91 |
+
</div>
|
| 92 |
+
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700 hover:border-pink-500 transition-all duration-300">
|
| 93 |
+
<i data-feather="code" class="w-8 h-8 text-pink-500 mb-4"></i>
|
| 94 |
+
<h3 class="text-lg font-semibold mb-2">Cross-Platform Ready</h3>
|
| 95 |
+
<p class="text-gray-400 text-sm">Generate components for React Web with react-aria or React Native with platform-specific APIs.</p>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700 hover:border-blue-500 transition-all duration-300">
|
| 98 |
+
<i data-feather="package" class="w-8 h-8 text-blue-500 mb-4"></i>
|
| 99 |
+
<h3 class="text-lg font-semibold mb-2">Production Quality</h3>
|
| 100 |
+
<p class="text-gray-400 text-sm">Type-safe, accessible, and following React ecosystem best practices.</p>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</main>
|
| 105 |
+
|
| 106 |
+
<custom-footer></custom-footer>
|
| 107 |
+
|
| 108 |
+
<script src="components/header.js"></script>
|
| 109 |
+
<script src="components/footer.js"></script>
|
| 110 |
+
<script src="script.js"></script>
|
| 111 |
+
<script>
|
| 112 |
+
feather.replace();
|
| 113 |
+
document.getElementById('projectForm').addEventListener('submit', function(e) {
|
| 114 |
+
e.preventDefault();
|
| 115 |
+
const projectName = document.getElementById('projectName').value;
|
| 116 |
+
const projectDescription = document.getElementById('projectDescription').value;
|
| 117 |
+
|
| 118 |
+
localStorage.setItem('projectName', projectName);
|
| 119 |
+
localStorage.setItem('projectDescription', projectDescription);
|
| 120 |
+
|
| 121 |
+
window.location.href = 'scope.html';
|
| 122 |
+
});
|
| 123 |
+
</script>
|
| 124 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 125 |
+
</body>
|
| 126 |
+
</html>
|
scope.html
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ComponentForge - AI Scope Generation</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gray-900 text-white min-h-screen">
|
| 14 |
+
<custom-header></custom-header>
|
| 15 |
+
|
| 16 |
+
<main class="container mx-auto px-4 py-8">
|
| 17 |
+
<div class="max-w-6xl mx-auto">
|
| 18 |
+
<!-- Progress Bar -->
|
| 19 |
+
<div class="mb-8">
|
| 20 |
+
<div class="flex items-center justify-between mb-2">
|
| 21 |
+
<span class="text-sm text-gray-400">Step 2 of 3</span>
|
| 22 |
+
<span class="text-sm text-purple-400">AI Scope Generation</span>
|
| 23 |
+
</div>
|
| 24 |
+
<div class="w-full bg-gray-700 rounded-full h-2">
|
| 25 |
+
<div class="bg-gradient-to-r from-purple-500 to-pink-500 h-2 rounded-full w-2/3"></div>
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<!-- Project Info -->
|
| 29 |
+
<div class="bg-gray-800 rounded-xl p-6 mb-6 border border-gray-700">
|
| 30 |
+
<div class="flex items-center justify-between">
|
| 31 |
+
<div>
|
| 32 |
+
<h2 class="text-xl font-bold" id="projectTitle">Project: Loading...</h2>
|
| 33 |
+
<p class="text-gray-400 mt-1" id="projectDesc"></p>
|
| 34 |
+
</div>
|
| 35 |
+
<button onclick="window.location.href = 'index.html'" class="text-gray-400 hover:text-white transition-colors">
|
| 36 |
+
<i data-feather="edit" class="w-5 h-5"></i>
|
| 37 |
+
</button>
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
|
| 41 |
+
<!-- AI Scope Generator -->
|
| 42 |
+
<div class="grid lg:grid-cols-2 gap-8">
|
| 43 |
+
<!-- Left Column - Input -->
|
| 44 |
+
<div class="space-y-6">
|
| 45 |
+
<!-- Component Type Selection -->
|
| 46 |
+
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 47 |
+
<div class="flex items-center mb-4">
|
| 48 |
+
<i data-feather="grid" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 49 |
+
<h3 class="text-lg font-semibold">Component Type</h3>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
<div class="grid grid-cols-2 gap-3">
|
| 53 |
+
<button class="component-type-btn bg-gray-700 hover:bg-purple-600 p-4 rounded-lg border border-gray-600 hover:border-purple-500 transition-all duration-200" data-type="button">
|
| 54 |
+
<i data-feather="mouse-pointer" class="w-6 h-6 mb-2 mx-auto"></i>
|
| 55 |
+
<span class="text-sm font-medium">Button</span>
|
| 56 |
+
</button>
|
| 57 |
+
<button class="component-type-btn bg-gray-700 hover:bg-pink-600 p-4 rounded-lg border border-gray-600 hover:border-pink-500 transition-all duration-200" data-type="input">
|
| 58 |
+
<i data-feather="edit" class="w-6 h-6 mb-2 mx-auto"></i>
|
| 59 |
+
<span class="text-sm font-medium">Input</span>
|
| 60 |
+
</button>
|
| 61 |
+
<button class="component-type-btn bg-gray-700 hover:bg-blue-600 p-4 rounded-lg border border-gray-600 hover:border-blue-500 transition-all duration-200" data-type="select">
|
| 62 |
+
<i data-feather="chevron-down" class="w-6 h-6 mb-2 mx-auto"></i>
|
| 63 |
+
<span class="text-sm font-medium">Select</span>
|
| 64 |
+
</button>
|
| 65 |
+
<button class="component-type-btn bg-gray-700 hover:bg-green-600 p-4 rounded-lg border border-gray-600 hover:border-green-500 transition-all duration-200" data-type="modal">
|
| 66 |
+
<i data-feather="square" class="w-6 h-6 mb-2 mx-auto"></i>
|
| 67 |
+
<span class="text-sm font-medium">Modal</span>
|
| 68 |
+
</button>
|
| 69 |
+
<button class="component-type-btn bg-gray-700 hover:bg-yellow-600 p-4 rounded-lg border border-gray-600 hover:border-yellow-500 transition-all duration-200" data-type="menu">
|
| 70 |
+
<i data-feather="menu" class="w-6 h-6 mb-2 mx-auto"></i>
|
| 71 |
+
<span class="text-sm font-medium">Menu</span>
|
| 72 |
+
</button>
|
| 73 |
+
<button class="component-type-btn bg-gray-700 hover:bg-indigo-600 p-4 rounded-lg border border-gray-600 hover:border-indigo-500 transition-all duration-200" data-type="tabs">
|
| 74 |
+
<i data-feather="folder" class="w-6 h-6 mb-2 mx-auto"></i>
|
| 75 |
+
<span class="text-sm font-medium">Tabs</span>
|
| 76 |
+
</button>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<!-- Additional Requirements -->
|
| 80 |
+
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 81 |
+
<div class="flex items-center mb-4">
|
| 82 |
+
<i data-feather="list" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 83 |
+
<h3 class="text-lg font-semibold">Additional Requirements</h3>
|
| 84 |
+
</div>
|
| 85 |
+
<textarea
|
| 86 |
+
id="additionalReqs"
|
| 87 |
+
class="w-full px-4 py-3 bg-gray-700 border border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent text-white placeholder-gray-400 resize-none transition-all duration-200"
|
| 88 |
+
rows="3"
|
| 89 |
+
placeholder="Any specific behaviors, accessibility requirements, or custom features?"
|
| 90 |
+
></textarea>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<!-- Generate Button -->
|
| 94 |
+
<button
|
| 95 |
+
id="generateScopeBtn"
|
| 96 |
+
class="w-full px-6 py-4 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white font-semibold rounded-lg transition-all duration-200 transform hover:scale-105 focus:ring-4 focus:ring-purple-500 focus:ring-opacity-50 flex items-center justify-center"
|
| 97 |
+
>
|
| 98 |
+
<i data-feather="zap" class="w-5 h-5 mr-2"></i>
|
| 99 |
+
Generate AI Scope
|
| 100 |
+
</button>
|
| 101 |
+
</div>
|
| 102 |
+
|
| 103 |
+
<!-- Right Column - AI Output -->
|
| 104 |
+
<div class="space-y-6">
|
| 105 |
+
<!-- Loading State -->
|
| 106 |
+
<div id="loadingState" class="hidden bg-gray-800 rounded-xl p-8 border border-gray-700 text-center">
|
| 107 |
+
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-purple-500 mx-auto mb-4"></div>
|
| 108 |
+
<p class="text-gray-300">AI is analyzing your requirements and generating optimal component scope...</p>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
<!-- Framework Selection -->
|
| 112 |
+
<div id="frameworkSection" class="hidden bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 113 |
+
<div class="flex items-center mb-4">
|
| 114 |
+
<i data-feather="smartphone" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 115 |
+
<h3 class="text-lg font-semibold">Target Framework</h3>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="grid grid-cols-2 gap-4">
|
| 118 |
+
<button class="framework-btn bg-gray-700 hover:bg-purple-600 p-4 rounded-lg border border-gray-600 transition-all duration-200" data-framework="react-web">
|
| 119 |
+
<i data-feather="globe" class="w-8 h-8 mb-3 mx-auto"></i>
|
| 120 |
+
<span class="text-sm font-medium">React Web</span>
|
| 121 |
+
<p class="text-xs text-gray-400 mt-1">With react-aria hooks</p>
|
| 122 |
+
</button>
|
| 123 |
+
<button class="framework-btn bg-gray-700 hover:bg-pink-600 p-4 rounded-lg border border-gray-600 transition-all duration-200" data-framework="react-native">
|
| 124 |
+
<i data-feather="smartphone" class="w-8 h-8 mb-3 mx-auto"></i>
|
| 125 |
+
<span class="text-sm font-medium">React Native</span>
|
| 126 |
+
<p class="text-xs text-gray-400 mt-1">With native APIs</p>
|
| 127 |
+
</button>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<!-- Hooks & Behaviors -->
|
| 132 |
+
<div id="hooksSection" class="hidden bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 133 |
+
<div class="flex items-center mb-4">
|
| 134 |
+
<i data-feather="anchor" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 135 |
+
<h3 class="text-lg font-semibold">Suggested Hooks & Behaviors</h3>
|
| 136 |
+
</div>
|
| 137 |
+
<div id="hooksList" class="space-y-2">
|
| 138 |
+
<!-- Hooks will be populated here -->
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
|
| 142 |
+
<!-- Data Attributes -->
|
| 143 |
+
<div id="attributesSection" class="hidden bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 144 |
+
<div class="flex items-center mb-4">
|
| 145 |
+
<i data-feather="database" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 146 |
+
<h3 class="text-lg font-semibold">Data Attributes</h3>
|
| 147 |
+
</div>
|
| 148 |
+
<div id="attributesList" class="space-y-2">
|
| 149 |
+
<!-- Attributes will be populated here -->
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<!-- Code Structure -->
|
| 154 |
+
<div id="structureSection" class="hidden bg-gray-800 rounded-xl p-6 border border-gray-700">
|
| 155 |
+
<div class="flex items-center mb-4">
|
| 156 |
+
<i data-feather="code" class="w-6 h-6 text-purple-500 mr-3"></i>
|
| 157 |
+
<h3 class="text-lg font-semibold">Code Structure</h3>
|
| 158 |
+
</div>
|
| 159 |
+
<div class="grid grid-cols-2 gap-4">
|
| 160 |
+
<button class="structure-btn bg-gray-700 hover:bg-purple-600 p-4 rounded-lg border border-gray-600 transition-all duration-200" data-structure="typed-primitives">
|
| 161 |
+
<i data-feather="type" class="w-8 h-8 mb-3 mx-auto"></i>
|
| 162 |
+
<span class="text-sm font-medium">Typed Primitives</span>
|
| 163 |
+
<p class="text-xs text-gray-400 mt-1">Combined approach</p>
|
| 164 |
+
</button>
|
| 165 |
+
<button class="structure-btn bg-gray-700 hover:bg-pink-600 p-4 rounded-lg border border-gray-600 transition-all duration-200" data-structure="adapter-pattern">
|
| 166 |
+
<i data-feather="layers" class="w-8 h-8 mb-3 mx-auto"></i>
|
| 167 |
+
<span class="text-sm font-medium">Adapter Pattern</span>
|
| 168 |
+
<p class="text-xs text-gray-400 mt-1">Separated behaviors</p>
|
| 169 |
+
</button>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<!-- Continue Button -->
|
| 174 |
+
<div id="continueSection" class="hidden">
|
| 175 |
+
<button
|
| 176 |
+
id="continueBtn"
|
| 177 |
+
class="w-full px-6 py-4 bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 text-white font-semibold rounded-lg transition-all duration-200 transform hover:scale-105 focus:ring-4 focus:ring-green-500 focus:ring-opacity-50 flex items-center justify-center"
|
| 178 |
+
>
|
| 179 |
+
<i data-feather="arrow-right" class="w-5 h-5 mr-2"></i>
|
| 180 |
+
Continue to Code Generation
|
| 181 |
+
</button>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
</main>
|
| 186 |
+
|
| 187 |
+
<custom-footer></custom-footer>
|
| 188 |
+
|
| 189 |
+
<script src="components/header.js"></script>
|
| 190 |
+
<script src="components/footer.js"></script>
|
| 191 |
+
<script src="script.js"></script>
|
| 192 |
+
<script>
|
| 193 |
+
feather.replace();
|
| 194 |
+
|
| 195 |
+
// Load project data
|
| 196 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 197 |
+
const projectData = StorageManager.getProjectData();
|
| 198 |
+
document.getElementById('projectTitle').textContent = `Project: ${projectData.name}`;
|
| 199 |
+
document.getElementById('projectDesc').textContent = projectData.description;
|
| 200 |
+
|
| 201 |
+
// Component type selection
|
| 202 |
+
document.querySelectorAll('.component-type-btn').forEach(btn => {
|
| 203 |
+
btn.addEventListener('click', function() {
|
| 204 |
+
document.querySelectorAll('.component-type-btn').forEach(b => b.classList.remove('bg-purple-600', 'bg-pink-600', 'bg-blue-600', 'bg-green-600', 'bg-yellow-600', 'bg-indigo-600'));
|
| 205 |
+
this.classList.add(this.classList.contains('hover:bg-purple-600') ? 'bg-purple-600' :
|
| 206 |
+
this.classList.contains('hover:bg-pink-600') ? 'bg-pink-600' :
|
| 207 |
+
this.classList.contains('hover:bg-blue-600') ? 'bg-blue-600' :
|
| 208 |
+
this.classList.contains('hover:bg-green-600') ? 'bg-green-600' :
|
| 209 |
+
this.classList.contains('hover:bg-yellow-600') ? 'bg-yellow-600' : 'bg-indigo-600');
|
| 210 |
+
});
|
| 211 |
+
});
|
| 212 |
+
|
| 213 |
+
// Generate scope
|
| 214 |
+
document.getElementById('generateScopeBtn').addEventListener('click', async function() {
|
| 215 |
+
const selectedType = document.querySelector('.component-type-btn.bg-purple-600, .component-type-btn.bg-pink-600, .component-type-btn.bg-blue-600, .component-type-btn.bg-green-600, .component-type-btn.bg-yellow-600, .component-type-btn.bg-indigo-600')?.dataset.type || 'button';
|
| 216 |
+
const additionalReqs = document.getElementById('additionalReqs').value;
|
| 217 |
+
|
| 218 |
+
// Show loading
|
| 219 |
+
document.getElementById('loadingState').classList.remove('hidden');
|
| 220 |
+
|
| 221 |
+
try {
|
| 222 |
+
const scope = await AIService.generateComponentScope(projectData.description, selectedType);
|
| 223 |
+
|
| 224 |
+
// Store scope
|
| 225 |
+
localStorage.setItem('projectScope', JSON.stringify(scope));
|
| 226 |
+
|
| 227 |
+
// Hide loading, show results
|
| 228 |
+
document.getElementById('loadingState').classList.add('hidden');
|
| 229 |
+
document.getElementById('frameworkSection').classList.remove('hidden');
|
| 230 |
+
document.getElementById('hooksSection').classList.remove('hidden');
|
| 231 |
+
document.getElementById('attributesSection').classList.remove('hidden');
|
| 232 |
+
document.getElementById('structureSection').classList.remove('hidden');
|
| 233 |
+
|
| 234 |
+
// Populate hooks
|
| 235 |
+
const hooksList = document.getElementById('hooksList');
|
| 236 |
+
hooksList.innerHTML = scope.suggestedHooks.map(hook => `
|
| 237 |
+
<div class="flex items-center p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 238 |
+
<i data-feather="check-circle" class="w-4 h-4 text-green-500 mr-3"></i>
|
| 239 |
+
<span class="text-sm font-mono">${hook}</span>
|
| 240 |
+
`).join('');
|
| 241 |
+
|
| 242 |
+
// Populate attributes
|
| 243 |
+
const attributesList = document.getElementById('attributesList');
|
| 244 |
+
attributesList.innerHTML = scope.dataAttributes.map(attr => `
|
| 245 |
+
<div class="flex items-center p-3 bg-gray-700 rounded-lg border border-gray-600">
|
| 246 |
+
<i data-feather="tag" class="w-4 h-4 text-blue-500 mr-3"></i>
|
| 247 |
+
<span class="text-sm font-mono">${attr}</span>
|
| 248 |
+
</div>
|
| 249 |
+
`).join('');
|
| 250 |
+
|
| 251 |
+
} catch (error) {
|
| 252 |
+
console.error('Error generating scope:', error);
|
| 253 |
+
document.getElementById('loadingState').classList.add('hidden');
|
| 254 |
+
alert('Error generating scope. Please try again.');
|
| 255 |
+
}
|
| 256 |
+
});
|
| 257 |
+
|
| 258 |
+
// Framework selection
|
| 259 |
+
document.querySelectorAll('.framework-btn').forEach(btn => {
|
| 260 |
+
btn.addEventListener('click', function() {
|
| 261 |
+
document.querySelectorAll('.framework-btn').forEach(b => b.classList.remove('bg-purple-600', 'bg-pink-600'));
|
| 262 |
+
this.classList.add(this.classList.contains('hover:bg-purple-600') ? 'bg-purple-600' : 'bg-pink-600');
|
| 263 |
+
localStorage.setItem('selectedFramework', this.dataset.framework);
|
| 264 |
+
document.getElementById('continueSection').classList.remove('hidden');
|
| 265 |
+
});
|
| 266 |
+
|
| 267 |
+
// Structure selection
|
| 268 |
+
document.querySelectorAll('.structure-btn').forEach(btn => {
|
| 269 |
+
btn.addEventListener('click', function() {
|
| 270 |
+
document.querySelectorAll('.structure-btn').forEach(b => b.classList.remove('bg-purple-600', 'bg-pink-600'));
|
| 271 |
+
this.classList.add(this.classList.contains('hover:bg-purple-600') ? 'bg-purple-600' : 'bg-pink-600');
|
| 272 |
+
localStorage.setItem('selectedCodeStructure', this.dataset.structure);
|
| 273 |
+
});
|
| 274 |
+
|
| 275 |
+
// Continue to next page
|
| 276 |
+
document.getElementById('continueBtn').addEventListener('click', function() {
|
| 277 |
+
window.location.href = 'code.html';
|
| 278 |
+
});
|
| 279 |
+
});
|
| 280 |
+
</script>
|
| 281 |
+
</body>
|
| 282 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Shared utility functions for the application
|
| 2 |
+
|
| 3 |
+
// Theme management
|
| 4 |
+
class ThemeManager {
|
| 5 |
+
constructor() {
|
| 6 |
+
this.currentTheme = 'dark';
|
| 7 |
+
this.init();
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
init() {
|
| 11 |
+
// Check for saved theme preference or respect OS preference
|
| 12 |
+
const savedTheme = localStorage.getItem('theme');
|
| 13 |
+
if (savedTheme) {
|
| 14 |
+
this.setTheme(savedTheme);
|
| 15 |
+
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
| 16 |
+
this.setTheme('dark');
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
setTheme(theme) {
|
| 21 |
+
this.currentTheme = theme;
|
| 22 |
+
document.documentElement.className = theme;
|
| 23 |
+
localStorage.setItem('theme', theme);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
toggleTheme() {
|
| 27 |
+
this.setTheme(this.currentTheme === 'dark' ? 'light' : 'dark');
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
// Initialize theme manager
|
| 32 |
+
const themeManager = new ThemeManager();
|
| 33 |
+
|
| 34 |
+
// Form validation helpers
|
| 35 |
+
class FormValidator {
|
| 36 |
+
static validateRequired(value) {
|
| 37 |
+
return value && value.trim().length > 0;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
static validateEmail(email) {
|
| 41 |
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
| 42 |
+
return emailRegex.test(email);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
static showError(input, message) {
|
| 46 |
+
const errorElement = input.nextElementSibling;
|
| 47 |
+
if (errorElement && errorElement.classList.contains('error-message')) {
|
| 48 |
+
errorElement.textContent = message;
|
| 49 |
+
} else {
|
| 50 |
+
const errorDiv = document.createElement('div');
|
| 51 |
+
errorDiv.className = 'error-message text-red-400 text-sm mt-1';
|
| 52 |
+
errorDiv.textContent = message;
|
| 53 |
+
input.parentNode.insertBefore(errorDiv, input.nextSibling);
|
| 54 |
+
}
|
| 55 |
+
input.classList.add('border-red-500');
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
static clearError(input) {
|
| 59 |
+
const errorElement = input.nextElementSibling;
|
| 60 |
+
if (errorElement && errorElement.classList.contains('error-message')) {
|
| 61 |
+
errorElement.remove();
|
| 62 |
+
}
|
| 63 |
+
input.classList.remove('border-red-500');
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
// API service for AI interactions
|
| 68 |
+
class AIService {
|
| 69 |
+
static async generateComponentScope(description, componentType) {
|
| 70 |
+
// Mock AI service - in real implementation, this would call your backend
|
| 71 |
+
return new Promise((resolve) => {
|
| 72 |
+
setTimeout(() => {
|
| 73 |
+
const mockResponse = {
|
| 74 |
+
frameworkOptions: ['React Web', 'React Native'],
|
| 75 |
+
suggestedHooks: this.getSuggestedHooks(componentType),
|
| 76 |
+
dataAttributes: this.getDataAttributes(componentType),
|
| 77 |
+
codeStructure: ['Typed Primitives', 'Adapter Pattern']
|
| 78 |
+
};
|
| 79 |
+
resolve(mockResponse);
|
| 80 |
+
}, 1500);
|
| 81 |
+
});
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
static getSuggestedHooks(componentType) {
|
| 85 |
+
const hooksMap = {
|
| 86 |
+
'button': ['useButton', 'usePress', 'useFocusRing'],
|
| 87 |
+
'input': ['useTextField', 'useFocus', 'useKeyboard'],
|
| 88 |
+
'select': ['useSelect', 'useListBox', 'useOverlay'],
|
| 89 |
+
'modal': ['useDialog', 'useOverlay', 'useModal'],
|
| 90 |
+
'menu': ['useMenu', 'useMenuItem', 'useSubmenu'],
|
| 91 |
+
'tabs': ['useTab', 'useTabList', 'useTabPanel'],
|
| 92 |
+
'accordion': ['useAccordion', 'useAccordionItem'],
|
| 93 |
+
'slider': ['useSlider', 'useSliderThumb'],
|
| 94 |
+
'switch': ['useSwitch'],
|
| 95 |
+
'checkbox': ['useCheckbox', 'useCheckboxGroup'],
|
| 96 |
+
'radio': ['useRadio', 'useRadioGroup']
|
| 97 |
+
};
|
| 98 |
+
return hooksMap[componentType] || ['useId', 'useFocus', 'useKeyboard'];
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
static getDataAttributes(componentType) {
|
| 102 |
+
const attributesMap = {
|
| 103 |
+
'button': ['data-focused', 'data-pressed', 'data-disabled', 'data-loading'],
|
| 104 |
+
'input': ['data-focused', 'data-invalid', 'data-disabled', 'data-readonly'],
|
| 105 |
+
'select': ['data-focused', 'data-open', 'data-disabled', 'data-invalid'],
|
| 106 |
+
'modal': ['data-open', 'data-placement', 'data-size'],
|
| 107 |
+
'menu': ['data-open', 'data-focused', 'data-disabled'],
|
| 108 |
+
'tabs': ['data-selected', 'data-disabled', 'data-orientation'],
|
| 109 |
+
'accordion': ['data-expanded', 'data-disabled'],
|
| 110 |
+
'slider': ['data-dragging', 'data-focused', 'data-disabled'],
|
| 111 |
+
'switch': ['data-selected', 'data-focused', 'data-disabled'],
|
| 112 |
+
'checkbox': ['data-selected', 'data-indeterminate', 'data-focused', 'data-disabled'],
|
| 113 |
+
'radio': ['data-selected', 'data-focused', 'data-disabled']
|
| 114 |
+
};
|
| 115 |
+
return attributesMap[componentType] || ['data-component'];
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
// Local storage management
|
| 120 |
+
class StorageManager {
|
| 121 |
+
static getProjectData() {
|
| 122 |
+
return {
|
| 123 |
+
name: localStorage.getItem('projectName'),
|
| 124 |
+
description: localStorage.getItem('projectDescription'),
|
| 125 |
+
scope: JSON.parse(localStorage.getItem('projectScope') || '{}'),
|
| 126 |
+
framework: localStorage.getItem('selectedFramework'),
|
| 127 |
+
codeStructure: localStorage.getItem('selectedCodeStructure')
|
| 128 |
+
};
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
static clearProjectData() {
|
| 132 |
+
localStorage.removeItem('projectName');
|
| 133 |
+
localStorage.removeItem('projectDescription');
|
| 134 |
+
localStorage.removeItem('projectScope');
|
| 135 |
+
localStorage.removeItem('selectedFramework');
|
| 136 |
+
localStorage.removeItem('selectedCodeStructure');
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// Export for use in other files
|
| 141 |
+
window.ThemeManager = ThemeManager;
|
| 142 |
+
window.FormValidator = FormValidator;
|
| 143 |
+
window.AIService = AIService;
|
| 144 |
+
window.StorageManager = StorageManager;
|
style.css
CHANGED
|
@@ -1,28 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 2 |
+
|
| 3 |
+
* {
|
| 4 |
+
margin: 0;
|
| 5 |
+
padding: 0;
|
| 6 |
+
box-sizing: border-box;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
body {
|
| 10 |
+
font-family: 'Inter', sans-serif;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
/* Custom scrollbar for dark theme */
|
| 14 |
+
::-webkit-scrollbar {
|
| 15 |
+
width: 8px;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
::-webkit-scrollbar-track {
|
| 19 |
+
background: #1f2937;
|
| 20 |
}
|
| 21 |
|
| 22 |
+
::-webkit-scrollbar-thumb {
|
| 23 |
+
background: #4b5563;
|
| 24 |
+
border-radius: 4px;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
::-webkit-scrollbar-thumb:hover {
|
| 28 |
+
background: #6b7280;
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|
| 30 |
|
| 31 |
+
/* Smooth transitions for all interactive elements */
|
| 32 |
+
button, input, textarea, select {
|
| 33 |
+
transition: all 0.2s ease-in-out;
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
+
/* Custom focus styles */
|
| 37 |
+
input:focus, textarea:focus, select:focus {
|
| 38 |
+
outline: none;
|
| 39 |
+
box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
|
| 40 |
}
|
| 41 |
+
|
| 42 |
+
/* Loading animation */
|
| 43 |
+
@keyframes pulse {
|
| 44 |
+
0%, 100% {
|
| 45 |
+
opacity: 1;
|
| 46 |
+
}
|
| 47 |
+
50% {
|
| 48 |
+
opacity: 0.5;
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.animate-pulse {
|
| 53 |
+
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/* Gradient text animation */
|
| 57 |
+
@keyframes gradient-shift {
|
| 58 |
+
0% {
|
| 59 |
+
background-position: 0% 50%;
|
| 60 |
+
}
|
| 61 |
+
50% {
|
| 62 |
+
background-position: 100% 50%;
|
| 63 |
+
}
|
| 64 |
+
100% {
|
| 65 |
+
background-position: 0% 50%;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.animate-gradient {
|
| 70 |
+
background-size: 200% 200%;
|
| 71 |
+
animation: gradient-shift 3s ease infinite;
|
| 72 |
+
}
|