1import { createApp, h, nextTick, onMounted, ref } from "https://esm.sh/vue@3.4.21";
2
3function useMarkdownResolver() {
4 const markdown = ref("");
5 const processedMarkdown = ref("");
85}
86
87function client() {
88 const RootComponent = {
89 setup() {
150if (typeof document !== "undefined") { client(); }
151
152export default async function server(request: Request): Promise<Response> {
153 // Handle link resolution endpoint
154 if (request.method === "POST" && new URL(request.url).pathname === "/resolve-links") {
349}
350
351async function resolveRedirect(url: string): Promise<string> {
352 const fetchOptions = {
353 headers: {
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [youtubeUrl, setYoutubeUrl] = useState("https://www.youtube.com/embed/QskiaNqaqlc?si=MvD_ydotKgovS9pC");
8 const [postVideoImages, setPostVideoImages] = useState<string[]>([]);
207}
208
209function client() {
210 createRoot(document.getElementById("root")).render(<App />);
211}
212if (typeof document !== "undefined") { client(); }
213
214export default async function server(request: Request): Promise<Response> {
215 // Image proxy endpoint
216 const url = new URL(request.url);
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [youtubeUrl, setYoutubeUrl] = useState("https://www.youtube.com/embed/QskiaNqaqlc?si=MvD_ydotKgovS9pC");
8 const [postVideoImages, setPostVideoImages] = useState<string[]>([]);
218}
219
220function client() {
221 createRoot(document.getElementById("root")).render(<App />);
222}
223if (typeof document !== "undefined") { client(); }
224
225export default async function server(request: Request): Promise<Response> {
226 // Image proxy endpoint
227 const url = new URL(request.url);
15};
16
17export default async function server(request: Request): Promise<Response> {
18 // Default modules to include
19 const defaultModules = [
172 `
173
174function setup(){
175 const canvas = createCanvas(100,100);
176 canvas.parent("sketch");
178}
179
180function draw() {}
181`,
182 );
13}
14
15function Tooltip({ children, content }: TooltipProps) {
16 const [isVisible, setIsVisible] = useState(false);
17 const tooltipRef = useRef<HTMLDivElement>(null);
52}
53
54function formatBytes(bytes: number, decimals = 2) {
55 if (bytes === 0) return "0 Bytes";
56 const k = 1024;
61}
62
63function copyToClipboard(text: string) {
64 navigator.clipboard.writeText(text).then(() => {
65 console.log("Text copied to clipboard");
69}
70
71function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72 const [isOpen, setIsOpen] = useState(false);
73 const menuRef = useRef(null);
76
77 useEffect(() => {
78 function handleClickOutside(event) {
79 if (menuRef.current && !menuRef.current.contains(event.target)) {
80 event.stopPropagation();
158}
159
160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161 const [isLoading, setIsLoading] = useState(false);
162 const decodedKey = decodeURIComponent(blob.key);
219}
220
221function App({ initialEmail, initialProfile }) {
222 const encodeKey = (key: string) => encodeURIComponent(key);
223 const decodeKey = (key: string) => decodeURIComponent(key);
645}
646
647function client() {
648 const initialEmail = document.getElementById("root").getAttribute("data-email");
649 const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
13}
14
15function Tooltip({ children, content }: TooltipProps) {
16 const [isVisible, setIsVisible] = useState(false);
17 const tooltipRef = useRef<HTMLDivElement>(null);
52}
53
54function formatBytes(bytes: number, decimals = 2) {
55 if (bytes === 0) return "0 Bytes";
56 const k = 1024;
61}
62
63function copyToClipboard(text: string) {
64 navigator.clipboard.writeText(text).then(() => {
65 console.log("Text copied to clipboard");
69}
70
71function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72 const [isOpen, setIsOpen] = useState(false);
73 const menuRef = useRef(null);
76
77 useEffect(() => {
78 function handleClickOutside(event) {
79 if (menuRef.current && !menuRef.current.contains(event.target)) {
80 event.stopPropagation();
158}
159
160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161 const [isLoading, setIsLoading] = useState(false);
162 const decodedKey = decodeURIComponent(blob.key);
219}
220
221function App({ initialEmail, initialProfile }) {
222 const encodeKey = (key: string) => encodeURIComponent(key);
223 const decodeKey = (key: string) => decodeURIComponent(key);
645}
646
647function client() {
648 const initialEmail = document.getElementById("root").getAttribute("data-email");
649 const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
15 "recipe ingredient converter and scaler",
16 "morse code translator with audio output",
17 "random quote generator with tweet functionality",
18 "personal finance tracker with basic charts",
19 "multiplayer rock-paper-scissors game",
20];
21
22function Dashboard() {
23 const [stats, setStats] = useState<{
24 totalGenerations: number;
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
97}
98
99function App() {
100 const [prompt, setPrompt] = useState(
101 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
128
129 useEffect(() => {
130 async function fetchUsageStats() {
131 const response = await fetch("/usage-stats");
132 const data = await response.json();
136 }, []);
137
138 async function handleSubmit(e: React.FormEvent) {
139 e.preventDefault();
140 setLoading(true);
170 }
171
172 function handleVersionChange(direction: "back" | "forward") {
173 const { currentVersionIndex, versions } = versionHistory;
174
271}
272
273function client() {
274 const path = window.location.pathname;
275 const root = createRoot(document.getElementById("root")!);
286}
287
288function extractCodeFromFence(text: string): string {
289 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
290 return htmlMatch ? htmlMatch[1].trim() : text;
291}
292
293export default async function server(req: Request): Promise<Response> {
294 // Dynamic import for SQLite to avoid client-side import
295 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1export function main() {
2 return `# Test on Apples\n\n1. What color are most ripe apples?\n a) Blue\n b) Red\n c) Yellow\n d) Purple\n\n2. Which part of the apple tree is edible?\n a) Root\n b) Trunk\n c) Fruit\n d) Leaves\n\n3. Apples are a rich source of:\n a) Vitamin C\n b) Vitamin D\n c) Protein\n d) Calcium\n\n4. What is the scientific name of the apple tree?\n a) Malus domestica\n b) Prunus avium\n c) Citrus limon\n d) Musa acuminata`;
3}
1export function handler() { return "Hello, Val Town!"; }
1export function run() {
2 return "Hello, Val Town!";
3}