| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using Spry;
- using Inversion;
- /**
- * HomePage - Documentation landing page for the Spry framework
- *
- * Clean, minimal design focused on helping developers get started
- * with Spry quickly.
- */
- public class HomePage : PageComponent {
-
- public const string ROUTE = "/";
-
- private ComponentFactory factory = inject<ComponentFactory>();
-
- public override string markup { get {
- return """
- <div class="doc-content">
-
- <!-- Hero Section -->
- <section class="home-hero">
- <h1 class="hero-title">Spry</h1>
- <p class="hero-tagline">A component-based web framework for Vala</p>
- </section>
-
- <!-- Introduction -->
- <section class="doc-section">
- <p class="intro">
- Spry is a web framework that lets you build dynamic, interactive web applications
- using Vala. It features HTMX integration for reactive UIs, dependency injection
- for clean architecture, and a component model that keeps markup and logic together.
- </p>
- <p>
- Whether you're building a simple web service or a complex interactive application,
- Spry provides the tools you need with full type safety and native performance.
- </p>
- </section>
-
- <!-- Quick Links -->
- <section class="doc-section">
- <h2>Documentation</h2>
- <div class="quick-links">
- <a href="/components/overview" class="quick-link-card">
- <h3>Components</h3>
- <p>Learn about Spry's component model, lifecycle, and how to build interactive UIs.</p>
- </a>
- <a href="/page-components/overview" class="quick-link-card">
- <h3>Page Components</h3>
- <p>Understand how to create pages and use templates for consistent layouts.</p>
- </a>
- <a href="/static-resources/overview" class="quick-link-card">
- <h3>Static Resources</h3>
- <p>Serve CSS, JavaScript, images, and other static assets efficiently.</p>
- </a>
- </div>
- </section>
-
- <!-- Get Started Code Example -->
- <section class="doc-section">
- <h2>Get Started</h2>
- <p>
- Here's a minimal "Hello World" Spry application to get you started:
- </p>
- <spry-component name="CodeBlockComponent" sid="hello-code"/>
- </section>
-
- <!-- Features -->
- <section class="doc-section">
- <h2>Why Spry?</h2>
- <ul class="features-list">
- <li>
- <strong>Type-Safe</strong> — Full Vala type safety catches errors at compile time,
- not runtime.
- </li>
- <li>
- <strong>Component-Based</strong> — Build encapsulated, reusable components with
- markup and logic in one place.
- </li>
- <li>
- <strong>HTMX Integration</strong> — Create dynamic interfaces without writing
- JavaScript. HTMX handles the complexity.
- </li>
- <li>
- <strong>Dependency Injection</strong> — Clean architecture with Inversion of
- Control for services and stores.
- </li>
- <li>
- <strong>Native Performance</strong> — Compiled to native code for maximum
- throughput and minimal resource usage.
- </li>
- <li>
- <strong>Free & Open Source</strong> — Released under a permissive license,
- free to use for any project.
- </li>
- </ul>
- </section>
-
- </div>
- """;
- }}
-
- public override async void prepare() throws Error {
- var helloCode = get_component_child<CodeBlockComponent>("hello-code");
- helloCode.language = "Vala";
- helloCode.code = "public class HelloPage : PageComponent {\n" +
- " public override string markup { get {\n" +
- " return \"\"\"<!DOCTYPE html>\n" +
- "<html>\n" +
- "<body>\n" +
- " <h1>Hello, Spry!</h1>\n" +
- "</body>\n" +
- "</html>\"\"\";\n" +
- " }}\n" +
- "}\n\n" +
- "// In Main.vala\n" +
- "spry_cfg.add_page<HelloPage>(new EndpointRoute(\"/\"));";
- }
- }
|