diff --git a/docs/latest/examples/websockets.md b/docs/latest/advanced/websockets.md similarity index 100% rename from docs/latest/examples/websockets.md rename to docs/latest/advanced/websockets.md diff --git a/docs/latest/examples/common-patterns.md b/docs/latest/examples/common-patterns.md index f14a3a9d..d9b44108 100644 --- a/docs/latest/examples/common-patterns.md +++ b/docs/latest/examples/common-patterns.md @@ -176,7 +176,7 @@ export const handler = define.handlers({ ## WebSockets Fresh provides first-class WebSocket support via `ctx.upgrade()`. See the full -[WebSocket guide](/docs/examples/websockets) for all options. +[WebSocket guide](/docs/advanced/websockets) for all options. ## Subdomain routing diff --git a/docs/latest/examples/index.md b/docs/latest/examples/index.md index f5a4b9f6..957bbe20 100644 --- a/docs/latest/examples/index.md +++ b/docs/latest/examples/index.md @@ -13,5 +13,4 @@ that you may like in your Fresh project. - [Sharing state between islands](./examples/sharing-state-between-islands) - [Active links](./examples/active-links) - [Session management](./examples/session-management) -- [WebSockets](./examples/websockets) - [Common Patterns](./examples/common-patterns) diff --git a/docs/toc.ts b/docs/toc.ts index 15c3937c..4d3c5d7c 100644 --- a/docs/toc.ts +++ b/docs/toc.ts @@ -61,6 +61,7 @@ const toc: RawTableOfContents = { ["environment-variables", "Environment Variables", "link:latest"], ["head", "
element", "link:latest"], ["vite", "Vite Plugin Options", "link:latest"], + ["websockets", "WebSockets", "link:latest"], ["opentelemetry", "OpenTelemetry", "link:latest"], ["api-reference", "API Reference", "link:latest"], ["troubleshooting", "Troubleshooting", "link:latest"], @@ -107,7 +108,6 @@ const toc: RawTableOfContents = { ], ["active-links", "Active links", "link:latest"], ["session-management", "Session management", "link:latest"], - ["websockets", "WebSockets", "link:latest"], ["common-patterns", "Common Patterns", "link:latest"], ], }, diff --git a/www/components/CodeBlock.tsx b/www/components/CodeBlock.tsx index 9e6354da..7aff8a9f 100644 --- a/www/components/CodeBlock.tsx +++ b/www/components/CodeBlock.tsx @@ -5,7 +5,7 @@ export function CodeBlock( ) { return (
diff --git a/www/components/CodeWindow.tsx b/www/components/CodeWindow.tsx
index 911255f0..94befe05 100644
--- a/www/components/CodeWindow.tsx
+++ b/www/components/CodeWindow.tsx
@@ -14,7 +14,7 @@ export function CodeWindow(props: CodeWindowProps) {
style={props.style}
>
+ Define{" "}
+
+ GET
+ ,{" "}
+
+ POST
+ ,{" "}
+
+ DELETE
+ {" "}
+ — any HTTP method as a named handler on your route. Fresh maps
+ requests to the right function automatically, with full type safety.
+
- Don't fight the browser. Fresh helps you handle form submissions and - other dynamic requests server-side, from any route. -
-- Since Fresh is built on{" "} - Deno, it's built on - web standards. + Handle submissions server-side with standard Request and FormData. + No client-side state management, no serialization headaches. + Progressive enhancement comes free.
+ Use the{" "}
+ {" "}
+ component from any page or island to set titles, meta tags,
+ stylesheets, and scripts — no hoisting hacks or side channels
+ needed.
+
Introducing Fresh:
+ No config files, no build step, no node_modules. Just one file and + you have a server with routing, JSX, and islands. +
- Fresh ships plain HTML to the client, then hydrates with JavaScript - only where needed. + Most of your page is static HTML. Islands are the small, interactive + parts that get hydrated with JavaScript. You choose exactly what + runs on the client.
- Because it's Preact, you get best-in-class performance, plus the - convenience of{" "} + Built on{" "} + Preact and + {" "} Signals - . + , so islands are tiny and reactive out of the box.
{f.description}
+{e.description}
+ + ))} +- Fresh Partials let you fetch HTML and slot it directly into the - page, without a full page reload - perfect for interactive elements - and dynamic apps. + Swap chunks of HTML from the server straight into the page. No full + reload, no client-side routing library. Click a link or submit a + form and Fresh streams just the part that changed. Perfect for + interactive elements and dynamic apps.
Freshly server-rendered {time}
+Freshly server-rendered {now}
); }`; @@ -22,8 +23,8 @@ export function RenderingSection() { aria-hidden="true" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-atom text-fresh" - width="4rem" - height="4rem" + width="2.5rem" + height="2.5rem" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" @@ -38,16 +39,13 @@ export function RenderingSection() {- Fresh routes are dynamically server-rendered{" "} + Every route renders on the server as a{" "} Preact{" "} - components, so there's zero JavaScript shipped to the browser by - default. + component. Zero JavaScript hits the browser unless you opt in with + an island. Pages are fast because they start as plain HTML.
-Simple to write; fast to run.
- Freshly server-rendered {new Date().toLocaleString("default", { - dateStyle: "medium", - timeStyle: "medium", - })} UTC + Freshly server-rendered{" "} + {Temporal.Now.plainDateTimeISO().toLocaleString("en-US")}
+ When OpenTelemetry is active, Fresh automatically injects a{" "}
+
+ traceparent
+ {" "}
+ meta tag into every page — connecting your browser traces to server
+ spans end-to-end, zero config required.
+
+ Get full-stack observability across your entire request lifecycle + with zero configuration. +
+- Fresh is designed to be easy to use by building on the best well-known - tools, conventions, and web standards. + No config files, no build step, no node_modules. Just one file and you + have a server with routing, JSX, and islands.
{props.description}
-
- {props.code}
-
-
diff --git a/www/components/homepage/TransitionsSection.tsx b/www/components/homepage/TransitionsSection.tsx
new file mode 100644
index 00000000..dbb85e46
--- /dev/null
+++ b/www/components/homepage/TransitionsSection.tsx
@@ -0,0 +1,81 @@
+import { CodeBlock } from "../../components/CodeBlock.tsx";
+import { CodeWindow } from "../../components/CodeWindow.tsx";
+import { PageSection } from "../../components/PageSection.tsx";
+import { SideBySide } from "../../components/SideBySide.tsx";
+import { SectionHeading } from "../../components/homepage/SectionHeading.tsx";
+import { FancyLink } from "../../components/FancyLink.tsx";
+
+const transitionCode = `import { App } from "fresh";
+
+const app = new App({
+ // Enable the View Transitions API
+ // for smooth client-side navigation
+ viewTransition: true,
+});
+
+app.listen();`;
+
+const cssCode = `/* Style your transitions with CSS */
+::view-transition-old(root) {
+ animation: fade-out 0.2s ease-in;
+}
+::view-transition-new(root) {
+ animation: fade-in 0.2s ease-out;
+}`;
+
+export function TransitionsSection() {
+ return (
+ + Fresh supports the{" "} + + View Transitions API + {" "} + out of the box, giving your app native-feeling page transitions with + a single config flag. +
++ Pages crossfade automatically. Customize animations per-element with + plain CSS — no JavaScript animation libraries needed. +
+
+ Add real-time endpoints with{" "}
+
+ app.ws()
+ {" "}
+ — define open, message, and close handlers in a single object. Build
+ chat, live dashboards, or collaborative editing without leaving
+ Fresh.
+