flipswitchreversemain.tsx5 matches
3839/**
40* HTML GENERATOR FUNCTION
41*/
42function generateHtml(sourceUrl: string, defaultProjects: ProjectItem[] = []) {
43return `<!DOCTYPE html>
44<html lang="en">
226const API_URL = '${sourceUrl}';
227228function ripple(type) {
229layers.forEach(layer => {
230const ripple = document.createElement('div');
248});
249250function moveToLayer(type) {
251const {rx,ry,z} = CORNER_TO_ROTATE[type] || {rx:0,ry:0,z:0};
252stack.style.transform = \`rotateX(\${rx}deg) rotateY(\${ry}deg) translateZ(\${z}px)\`;
296* SERVERLESS HANDLER FOR VAL TOWN
297*/
298export default async function(req: Request) {
299const url = new URL(req.url);
300const action = url.searchParams.get("action");
DayOldCalculatorindex.tsx2 matches
40}
4142function getQueryParams() {
43const params = new URLSearchParams(window.location.search)
44const milestonesParam = params.get("milestones")
72}
7374function setQueryParams(
75birthday: string,
76name: string,
revamp-ncfmain.tsx19 matches
3var sections;
45function initDarkNavSwitch() {
6// script pour navbar Negative on dark section
7sections = document.querySelectorAll("[bg-theme]"); // adjust if needed
11}
1213function GoDark() {
14navElements.forEach(element => {
15const classToAdd = element.getAttribute("darkMode");
21}
2223function GoLight() {
24navElements.forEach(element => {
25const classToAdd = element.getAttribute("darkMode");
31}
3233function checkNavbarSection() {
34for (const section of sections) {
35const rect = section.getBoundingClientRect();
50});
5152document.addEventListener("DOMContentLoaded", function() {
53initDarkNavSwitch();
54});
58/* */
59/* */
60document.addEventListener("DOMContentLoaded", function() {
61// S'assurer que GSAP est chargé
62if (typeof gsap === "undefined") {
7980// Au survol du déclencheur
81startElement.addEventListener("mouseenter", function() {
82const targetElements = document.querySelectorAll(`[load-nav-menu="${menuName}"]`);
839495// Quand on quitte le déclencheur
96startElement.addEventListener("mouseleave", function() {
97const targetElements = document.querySelectorAll(`[load-nav-menu="${menuName}"]`);
98113/* */
114/* */
115document.addEventListener("DOMContentLoaded", function() {
116// Vérification si l'appareil est mobile
117const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
151152// Fonction d'animation
153function animate() {
154// Position actuelle
155let currentX = parseFloat(shape.style.left);
186/* */
187/* */
188document.addEventListener("DOMContentLoaded", function() {
189// Vérifier si nous devons initialiser l'animation lettre par lettre
190const allTexts = document.querySelectorAll(".startup-txt, .pme-txt, .scaleup-txt, .grandgroupe-txt");
217218// Fonction pour désactiver tous les textes
219function resetAllTexts() {
220allTexts.forEach(text => text.classList.remove("text-active"));
221}
223// Event listeners pour chaque carte
224if (cardStartup) {
225cardStartup.addEventListener("mouseenter", function() {
226resetAllTexts();
227txtStartup.classList.add("text-active");
230231if (cardPme) {
232cardPme.addEventListener("mouseenter", function() {
233resetAllTexts();
234txtPme.classList.add("text-active");
237238if (cardScaleup) {
239cardScaleup.addEventListener("mouseenter", function() {
240resetAllTexts();
241txtScaleup.classList.add("text-active");
244245if (cardGrandgroupe) {
246cardGrandgroupe.addEventListener("mouseenter", function() {
247resetAllTexts();
248txtGrandgroupe.classList.add("text-active");
253const cardsContainer = document.querySelector(".cards-container");
254if (cardsContainer) {
255cardsContainer.addEventListener("mouseleave", function() {
256resetAllTexts();
257});
271272// Fonction pour mettre à jour la position du curseur
273function updateCursorPosition(e) {
274customCursor.style.left = `${e.clientX}px`;
275customCursor.style.top = `${e.clientY}px`;
299}
300301function animateCurrentSlide() {
302document.querySelectorAll("[cascade-animate]").forEach((el, index) => {
303const grandparent = el.parentElement?.parentElement;
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
ChatclientTools.ts13 matches
32}
3334// Tool handler function type
35export type ToolHandler = (
36input: any,
42) => Promise<string>;
4344// AsyncFunction constructor for safe code execution
45const AsyncFunction = async function() {}.constructor;
4647/* ──────────────────────────── Tool Definitions ─────────────────────────── */
107type: "string",
108description:
109"JavaScript/TypeScript code that defines an async execute function: `const execute = async (input, tools) => {}`. The 'tools' parameter contains all available tool handlers (client-side + MCP tools) that can be called directly. Return value will be JSON stringified.",
110},
111key: {
112type: "string",
113description:
114"Key of file containing source code (from MCP or local) that exports an async execute function: `const execute = async (input, tools) => {}`. The 'tools' parameter provides access to all available tool handlers.",
115},
116input: {
117type: "object",
118description: "Input parameter passed to the execute function as the first argument",
119},
120},
156const expression = input.expression || "";
157158// Enhanced safety check - allow more math functions
159const safeExpression = expression
160.replace(/[^0-9+\-*/().\s]/g, "") // Remove unsafe characters
165}
166167// Use Function constructor for safe evaluation (limited scope)
168const result = new Function("return " + safeExpression)();
169170if (typeof result === "number" && !isNaN(result) && isFinite(result)) {
223224// Execute the code with tools parameter
225const result = await new AsyncFunction(`${code}\n\nreturn await execute(arguments[0], arguments[1]);`)(
226input.input,
227tools || {},
802* Get all available tools (client-side + MCP tools)
803*/
804export async function getAllAvailableTools(mcpClientPool: MCPClientPool): Promise<ClientTool[]> {
805const allTools: ClientTool[] = [...CLIENT_TOOLS];
806return allTools;
838* Get all available tool handlers (client-side + MCP handlers)
839*/
840export async function getAllToolHandlers(
841mcpClientPool: MCPClientPool,
842affordanceManager: any,
896* Execute a tool by name with the appropriate handler
897*/
898export async function executeTool(
899toolName: string,
900input: any,
cerebras_codermain.tsx11 matches
24);
2526function Hero({
27prompt,
28setPrompt,
4546<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47Turn your ideas into fully functional apps in{" "}
48<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49less than a second
116}
117118function App() {
119const previewRef = React.useRef<HTMLDivElement>(null);
120const [prompt, setPrompt] = useState("");
170});
171172function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173setLoading(true);
174setTimeout(() => handleSubmit(promptItem.prompt), 0);
175}
176177async function handleSubmit(e: React.FormEvent | string) {
178if (typeof e !== "string") {
179e.preventDefault();
226}
227228function handleVersionChange(direction: "back" | "forward") {
229const { currentVersionIndex, versions } = versionHistory;
230if (direction === "back" && currentVersionIndex > 0) {
974);
975976function client() {
977const path = window.location.pathname;
978const root = createRoot(document.getElementById("root")!);
1010}
10111012function extractCodeFromFence(text: string): string {
1013const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014return htmlMatch ? htmlMatch[1].trim() : text;
1015}
10161017async function generateCode(prompt: string, currentCode: string) {
1018const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019if (starterPrompt) {
1060}
10611062export default async function cerebras_coder(req: Request): Promise<Response> {
1063// Dynamic import for SQLite to avoid client-side import
1064const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163<meta property="og:site_name" content="Cerebras Coder">
1164<meta property="og:url" content="https://cerebrascoder.com"/>
1165<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1// 写法一
2// export default async function(request: Request): Promise<Response> {}
3// 写法二
4// export default (req: Request) => handle(req);
52* @returns {Promise<Response>}
53*/
54async function handle(request: Request) {
55// 只处理 POST 请求和特定路径
56const url = new URL(request.url);
untitled-2001main.tsx4 matches
1718// --- HTML & FRONTEND ---
19function generateHtml(sourceUrl: string) {
20return `<!DOCTYPE html>
21<html lang="en">
150};
151152function createCardElement(imageData, index) {
153const { prompt } = imageData;
154const encodedPrompt = encodeURIComponent(prompt);
172}
173174async function fetchAndRenderGallery() {
175dom.grid.innerHTML = '';
176dom.loader.classList.remove('hidden');
214215// --- VAL TOWN EXPORT ---
216export default async function(req: Request) {
217const url = new URL(req.url);
218const action = url.searchParams.get("action");
untitled-1968http.ts1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
untitled-1768main.tsx1 match
1export default async function (_req: Request): Promise<Response> {
2return Response.json({ ok: true });
3}