eink-framefontsTest.tsx2 matches
4import { BodyWrapper, Content, Footer, Header, Headline } from "../components.tsx";
56function Render() {
7const line = "To be taught if fortunate";
8return (
36}
3738export default async function(): Promise<Response> {
39const html = renderToString(<Render />);
40
eink-framefetchWithCache.ts1 match
6};
78export default async function fetchWithCache(
9apiUrl: string,
10cacheKey: string,
eink-framecomponents.tsx7 matches
45// Display components can be used to change the look and feel of each frame.
6export function Header({ title = "Eink" }) {
7return (
8<head>
39}
4041export function Footer() {
42const currentDate = new Date().toLocaleDateString("en-US", {
43timeZone: "America/Los_Angeles",
62}
6364export function Headline({ text = "Headline missing" }: { text: string }) {
65return (
66<div className="flex justify-between items-center p-5">
70}
7172export function Content(props: any) {
73return <div className="relative p-5 overflow-none">{props.children}</div>;
74}
7576export function BodyWrapper(props: any) {
77return (
78<body className="bg-black p-0 m-0">
84}
8586export function App() {
87return (
88<html>
99}
100101export default async function(): Promise<Response> {
102const html = renderToString(<App />);
103
eink-frameapod.tsx2 matches
67// Displays NASA's astronomy photo of the day
8function Render({ data }: { data: APOD }) {
9return (
10<html>
25}
2627export default async function(req: Request): Promise<Response> {
28const data: APOD = await GetAPOD(req).then((res: any) => res.json());
29const html = renderToString(<Render data={data} />);
eink-frameapod.ts1 match
13const NASA_API_KEY = Deno.env.get("NASA_API_KEY");
1415export default async function GetAPOD(req: Request): Promise<Response> {
16const url = `https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}&thumbs=true`;
17const cacheKey = "nasa_apod";
353637// Function to safely calculate tan, clamping output
38float safeTan(float x) {
39// Clamp output to avoid extreme values that break rendering.
8586// --- React Component ---
87function App() {
88const canvasRef = useRef<HTMLCanvasElement>(null);
89170console.log("Position buffer created.");
171172// --- Resize Function ---
173const resizeCanvasToDisplaySize = () => {
174if (!canvas) return false;
261262// --- Client Entry ---
263function client() {
264const rootElement = document.getElementById("root");
265if (!rootElement) {
280canvas { display: block; width: 100%; height: 100%; }
281`;
282export default async function server(request: Request): Promise<Response> {
283const valUrl = import.meta.url;
284return new Response(
21const float EPS = 1e-5; // Epsilon for safe division etc.
2223// Helper functions must be defined before they are called in GLSL 1.0
2425// Smooth minimum function
26float opSmoothUnion( float d1, float d2, float k )
27{
31}
3233// Signed distance function for a sphere
34float sdSphere( vec3 p, float s )
35{
37}
3839// Main distance function for the scene (map)
40// Uses a loop to combine multiple moving spheres smoothly
41float map(vec3 p)
66const float h = 1e-5;
67const vec2 k = vec2(1.0,-1.0); // Helper vectors for offsets
68// Sample map function at points slightly offset from p in different directions
69return normalize( k.xyy*map( p + k.xyy*h ) +
70k.yyx*map( p + k.yyx*h ) +
73}
7475// Main function
76void main()
77{
108109// --- React Component ---
110function App() {
111const canvasRef = useRef<HTMLCanvasElement>(null);
112193console.log("Position buffer created.");
194195// --- Resize Function ---
196const resizeCanvasToDisplaySize = () => {
197if (!canvas) return false;
259260// --- Client Entry ---
261function client() {
262const rootElement = document.getElementById("root");
263if (!rootElement) {
278canvas { display: block; width: 100%; height: 100%; }
279`;
280export default async function server(request: Request): Promise<Response> {
281const valUrl = import.meta.url;
282return new Response(
141142// --- React Component ---
143function App() {
144const canvasRef = useRef<HTMLCanvasElement>(null);
145// No mouse input needed
227console.log("Position buffer created.");
228229// --- Resize Function ---
230const resizeCanvasToDisplaySize = () => {
231if (!canvas) return false;
313314// --- Client Entry ---
315function client() {
316const rootElement = document.getElementById("root");
317if (!rootElement) {
332canvas { display: block; width: 100%; height: 100%; }
333`;
334export default async function server(request: Request): Promise<Response> {
335const valUrl = import.meta.url;
336return new Response(
reactHonoStarterApp.tsx1 match
2import { useState } from "https://esm.sh/react@18.2.0";
34export function App() {
5const [clicked, setClicked] = useState(0);
6return (
34const mat2 m = mat2( 1.6, 1.2, -1.2, 1.6 );
3536// Hash function generates pseudo-random 2D vector
37vec2 hash( vec2 p ) {
38p = vec2(dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)));
41}
4243// Simplex noise function (gradient noise)
44float noise( vec2 p ) { // Removed 'in' qualifier for GLSL 1.0
45const float K1 = 0.366025404; // (sqrt(3)-1)/2;
171172// --- React Component ---
173function App() {
174const canvasRef = useRef<HTMLCanvasElement>(null);
175// No mouse input needed for this shader
260console.log("Position buffer created.");
261262// --- Resize Function ---
263const resizeCanvasToDisplaySize = () => {
264if (!canvas) return false;
346347// --- Client Entry ---
348function client() {
349const rootElement = document.getElementById("root");
350if (!rootElement) {
365canvas { display: block; width: 100%; height: 100%; }
366`;
367export default async function server(request: Request): Promise<Response> {
368const valUrl = import.meta.url;
369return new Response(