Skip to main content

logicaffeine_web/ui/pages/
crates.rs

1//! Crate documentation landing page.
2//!
3//! Displays a grid of crate cards with descriptions, linking to rustdoc HTML.
4//! Each card links directly to `/crates/{crate_name}/index.html`.
5
6use crate::ui::components::footer::Footer;
7use crate::ui::components::main_nav::{ActivePage, MainNav};
8use crate::ui::seo::{
9    breadcrumb_schema, organization_schema, pages as seo_pages, tech_article_schema,
10    BreadcrumbItem, JsonLdMultiple, PageHead,
11};
12use dioxus::prelude::*;
13#[cfg(all(feature = "split", target_arch = "wasm32"))]
14use dioxus::wasm_split;
15
16const CRATES_STYLE: &str = r#"
17.crates-page {
18    min-height: 100vh;
19    color: var(--text-primary);
20    background:
21        radial-gradient(1200px 600px at 50% -120px, rgba(167,139,250,0.14), transparent 60%),
22        radial-gradient(900px 500px at 15% 30%, rgba(96,165,250,0.14), transparent 60%),
23        radial-gradient(800px 450px at 90% 45%, rgba(34,197,94,0.08), transparent 62%),
24        linear-gradient(180deg, #070a12, #0b1022 55%, #070a12);
25    font-family: var(--font-sans);
26}
27
28.crates-hero {
29    max-width: 1280px;
30    margin: 0 auto;
31    padding: 60px var(--spacing-xl) 40px;
32}
33
34.crates-hero h1 {
35    font-size: var(--font-display-lg);
36    font-weight: 900;
37    letter-spacing: -1.5px;
38    line-height: 1.1;
39    background: linear-gradient(180deg, #ffffff 0%, rgba(229,231,235,0.78) 65%, rgba(229,231,235,0.62) 100%);
40    -webkit-background-clip: text;
41    -webkit-text-fill-color: transparent;
42    margin: 0 0 var(--spacing-lg);
43}
44
45.crates-hero p {
46    font-size: var(--font-body-lg);
47    color: var(--text-secondary);
48    max-width: 600px;
49    line-height: 1.6;
50    margin: 0;
51}
52
53.crates-hero .crates-hero-version {
54    margin-top: var(--spacing-md);
55    font-size: 0.95rem;
56    opacity: 0.75;
57}
58
59.crates-hero-badge {
60    display: inline-flex;
61    align-items: center;
62    gap: var(--spacing-sm);
63    padding: var(--spacing-sm) 14px;
64    border-radius: var(--radius-full);
65    background: rgba(255,255,255,0.06);
66    border: 1px solid rgba(255,255,255,0.10);
67    font-size: var(--font-caption-md);
68    font-weight: 600;
69    color: var(--text-primary);
70    margin-bottom: var(--spacing-xl);
71}
72
73.crates-hero-badge .dot {
74    width: 8px;
75    height: 8px;
76    border-radius: 50%;
77    background: var(--color-accent-purple);
78    box-shadow: 0 0 0 4px rgba(167,139,250,0.15);
79}
80
81.crates-content {
82    max-width: 1280px;
83    margin: 0 auto;
84    padding: 0 var(--spacing-xl) 80px;
85}
86
87.crates-grid {
88    display: grid;
89    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
90    gap: 24px;
91}
92
93.crate-card {
94    display: block;
95    background: rgba(255,255,255,0.03);
96    border: 1px solid rgba(255,255,255,0.08);
97    border-radius: var(--radius-xl);
98    padding: 24px;
99    text-decoration: none;
100    color: inherit;
101    transition: transform 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
102}
103
104.crate-card:hover {
105    transform: translateY(-2px);
106    border-color: rgba(167,139,250,0.4);
107    background: rgba(255,255,255,0.05);
108    box-shadow: 0 12px 30px rgba(167,139,250,0.08);
109}
110
111.crate-header {
112    display: flex;
113    justify-content: space-between;
114    align-items: flex-start;
115    margin-bottom: 12px;
116}
117
118.crate-name {
119    font-size: 18px;
120    font-weight: 700;
121    color: #fff;
122    margin: 0;
123    font-family: var(--font-mono);
124    display: flex;
125    align-items: center;
126    gap: 8px;
127}
128
129.crate-badge {
130    display: inline-flex;
131    align-items: center;
132    font-size: 11px;
133    font-weight: 700;
134    padding: 3px 8px;
135    border-radius: 999px;
136}
137
138.crate-badge.core {
139    background: linear-gradient(135deg, rgba(96,165,250,0.9), rgba(167,139,250,0.9));
140    color: #060814;
141}
142
143.crate-badge.app {
144    background: rgba(34,197,94,0.2);
145    color: #22c55e;
146    border: 1px solid rgba(34,197,94,0.3);
147}
148
149.crate-description {
150    color: var(--text-secondary);
151    font-size: 14px;
152    line-height: 1.6;
153    margin: 0;
154}
155
156.crate-arrow {
157    display: flex;
158    align-items: center;
159    justify-content: flex-end;
160    margin-top: 16px;
161    color: var(--text-tertiary);
162    font-size: 13px;
163    gap: 6px;
164    transition: color 0.2s;
165}
166
167.crate-card:hover .crate-arrow {
168    color: var(--color-accent-purple);
169}
170
171.crate-arrow svg {
172    width: 16px;
173    height: 16px;
174    transition: transform 0.2s;
175}
176
177.crate-card:hover .crate-arrow svg {
178    transform: translateX(3px);
179}
180
181.crate-links {
182    display: flex;
183    gap: 12px;
184    margin-top: 16px;
185    padding-top: 16px;
186    border-top: 1px solid rgba(255,255,255,0.06);
187}
188
189.crate-link {
190    display: inline-flex;
191    align-items: center;
192    gap: 6px;
193    padding: 8px 14px;
194    border-radius: var(--radius-md);
195    font-size: var(--font-caption-md);
196    font-weight: 600;
197    text-decoration: none;
198    transition: all 0.2s ease;
199}
200
201.crate-link.docs {
202    background: rgba(167,139,250,0.15);
203    color: #a78bfa;
204    border: 1px solid rgba(167,139,250,0.3);
205}
206
207.crate-link.docs:hover {
208    background: rgba(167,139,250,0.25);
209    border-color: rgba(167,139,250,0.5);
210}
211
212.crate-link.crates-io {
213    background: rgba(249,115,22,0.15);
214    color: #fb923c;
215    border: 1px solid rgba(249,115,22,0.3);
216}
217
218.crate-link.crates-io:hover {
219    background: rgba(249,115,22,0.25);
220    border-color: rgba(249,115,22,0.5);
221}
222
223.crate-link svg {
224    width: 16px;
225    height: 16px;
226}
227
228.crates-section {
229    margin-bottom: 48px;
230}
231
232.crates-section-title {
233    font-size: var(--font-body-md);
234    font-weight: 700;
235    text-transform: uppercase;
236    letter-spacing: 1.5px;
237    color: var(--text-tertiary);
238    margin: 0 0 24px;
239    padding-bottom: var(--spacing-md);
240    border-bottom: 1px solid rgba(255,255,255,0.08);
241}
242
243@media (max-width: 768px) {
244    .crates-grid {
245        grid-template-columns: 1fr;
246    }
247
248    .crates-hero h1 {
249        font-size: var(--font-display-md);
250    }
251
252    .crates-hero {
253        padding: 40px var(--spacing-xl) var(--spacing-xxl);
254    }
255}
256"#;
257
258/// The workspace version every crate on the page is published at.
259const VERSION: &str = env!("CARGO_PKG_VERSION");
260
261#[derive(Clone, Copy, PartialEq)]
262struct CrateInfo {
263    name: &'static str,
264    description: &'static str,
265    badge: &'static str,
266    crates_io: Option<&'static str>,
267}
268
269/// The language, the compiler and its execution tiers, the proof kernel and the platform, in the order the
270/// docs site's landing page groups them.
271const CORE_CRATES: &[CrateInfo] = &[
272    CrateInfo {
273        name: "logicaffeine_language",
274        description: "The LOGOS front end: English sentences to first-order logic, and the parser for LOGOS programs and LGX pages",
275        badge: "Core",
276        crates_io: Some("https://crates.io/crates/logicaffeine-language"),
277    },
278    CrateInfo {
279        name: "logicaffeine_lexicon",
280        description: "The English vocabulary behind LOGOS: verb, noun and adjective metadata for build-time lookup tables, plus an optional runtime JSON index",
281        badge: "Core",
282        crates_io: Some("https://crates.io/crates/logicaffeine-lexicon"),
283    },
284    CrateInfo {
285        name: "logicaffeine_compile",
286        description: "The LOGOS compiler: type checking, the optimizer, the interpreter and bytecode VM, and the Rust, C, WASM, RISC-V, CUDA and hardware backends",
287        badge: "Core",
288        crates_io: Some("https://crates.io/crates/logicaffeine-compile"),
289    },
290    CrateInfo {
291        name: "logicaffeine_runtime",
292        description: "Deterministic, replayable concurrency runtime for the LOGOS interpreter and VM: task scheduler, channels, Select, timers, seed and trace",
293        badge: "Core",
294        crates_io: Some("https://crates.io/crates/logicaffeine-runtime"),
295    },
296    CrateInfo {
297        name: "logicaffeine_forge",
298        description: "The machine-code layer of the LOGOS copy-and-patch JIT: W^X executable memory, build-time stencils, a register-allocating x86-64 backend",
299        badge: "Core",
300        crates_io: Some("https://crates.io/crates/logicaffeine-forge"),
301    },
302    CrateInfo {
303        name: "logicaffeine_jit",
304        description: "Native execution tier for the LOGOS bytecode VM: hot functions and loops tier up to x86-64 machine code",
305        badge: "Core",
306        crates_io: Some("https://crates.io/crates/logicaffeine-jit"),
307    },
308    CrateInfo {
309        name: "logicaffeine_kernel",
310        description: "Calculus of Constructions proof kernel with inductive types, universes, quotients, a second checker and Lean 4 import",
311        badge: "Core",
312        crates_io: Some("https://crates.io/crates/logicaffeine-kernel"),
313    },
314    CrateInfo {
315        name: "logicaffeine_proof",
316        description: "Kernel-checked proof search and tactics, certified SAT/CDCL with DRAT/LRAT output, and a number-theory and cryptanalysis library",
317        badge: "Core",
318        crates_io: Some("https://crates.io/crates/logicaffeine-proof"),
319    },
320    CrateInfo {
321        name: "logicaffeine_base",
322        description: "Foundation types for Logicaffeine: arenas, string interning, spans, and exact integers, decimals, quantities, money, dates and UUIDs",
323        badge: "Core",
324        crates_io: Some("https://crates.io/crates/logicaffeine-base"),
325    },
326    CrateInfo {
327        name: "logicaffeine_data",
328        description: "LOGOS runtime values, collections, wire format and CRDTs, shared by native and WASM builds",
329        badge: "Core",
330        crates_io: Some("https://crates.io/crates/logicaffeine-data"),
331    },
332    CrateInfo {
333        name: "logicaffeine_system",
334        description: "Platform IO, networking, HTTP serving, persistence, and post-quantum crypto (Keccak/SHA-3, ChaCha20-Poly1305, ML-KEM, ML-DSA) for LOGOS",
335        badge: "Core",
336        crates_io: Some("https://crates.io/crates/logicaffeine-system"),
337    },
338];
339
340const VERIFY_CRATES: &[CrateInfo] = &[
341    CrateInfo {
342        name: "logicaffeine_verify",
343        description: "Z3-based static verification and model checking for Logicaffeine",
344        badge: "Z3",
345        crates_io: Some("https://crates.io/crates/logicaffeine-verify"),
346    },
347    CrateInfo {
348        name: "logicaffeine_tv",
349        description: "Translation validation for LOGOS: a symbolic encoder of the source, checked with Z3 against the tree-walking interpreter per program",
350        badge: "Z3",
351        crates_io: Some("https://crates.io/crates/logicaffeine-tv"),
352    },
353];
354
355const APP_CRATES: &[CrateInfo] = &[
356    CrateInfo {
357        name: "logicaffeine_cli",
358        description: "largo — the LOGOS build tool: projects, builds, tests, serving, proofs, and the package registry",
359        badge: "Tool",
360        crates_io: Some("https://crates.io/crates/logicaffeine-cli"),
361    },
362    CrateInfo {
363        name: "logicaffeine_lsp",
364        description: "The LOGOS language server (LSP): diagnostics, completion, hover, navigation and refactoring for .lg files, literate .md files and LGX pages",
365        badge: "Tool",
366        crates_io: Some("https://crates.io/crates/logicaffeine-lsp"),
367    },
368    CrateInfo {
369        name: "logicaffeine_web",
370        description: "The logicaffeine.com site (Dioxus/WASM): LOGOS Studio with live LGX previews, Learn, Syntax Guide, benchmarks, news and the registry browser",
371        badge: "Tool",
372        crates_io: None,
373    },
374];
375
376#[component(lazy)]
377pub fn Crates() -> Element {
378    let breadcrumbs = vec![
379        BreadcrumbItem {
380            name: "Home",
381            path: "/",
382        },
383        BreadcrumbItem {
384            name: "Crates",
385            path: "/crates",
386        },
387    ];
388    let schemas = vec![
389        organization_schema(),
390        tech_article_schema("LOGICAFFEINE Crate Documentation", "The Rust crates behind LOGOS: the English-to-logic front end, the compiler and its execution tiers, the proof kernel, and the tools, with API docs and crates.io links.", "/crates"),
391        breadcrumb_schema(&breadcrumbs),
392    ];
393
394    rsx! {
395        PageHead {
396            title: seo_pages::CRATES.title,
397            description: seo_pages::CRATES.description,
398            canonical_path: seo_pages::CRATES.canonical_path,
399        }
400        style { "{CRATES_STYLE}" }
401        JsonLdMultiple { schemas }
402
403        div { class: "crates-page",
404            MainNav {
405                active: ActivePage::Crates,
406                subtitle: Some("Crate Documentation"),
407            }
408
409            header { class: "crates-hero",
410                div { class: "crates-hero-badge",
411                    div { class: "dot" }
412                    span { "Rustdoc" }
413                }
414                h1 { "LOGOS Crates" }
415                p {
416                    "LOGOS is a workspace of Rust crates you can use on their own: parse English into logic, compile and run LOGOS programs, or check a proof with the kernel. Each card links to the crate's API documentation and its crates.io page."
417                }
418                p { class: "crates-hero-version", "Version {VERSION}" }
419            }
420
421            main { class: "crates-content",
422                section { class: "crates-section",
423                    h2 { class: "crates-section-title", "Language, compiler and kernel" }
424                    div { class: "crates-grid",
425                        for crate_info in CORE_CRATES.iter() {
426                            CrateCard { info: crate_info }
427                        }
428                    }
429                }
430
431                section { class: "crates-section",
432                    h2 { class: "crates-section-title", "Z3 verification" }
433                    div { class: "crates-grid",
434                        for crate_info in VERIFY_CRATES.iter() {
435                            CrateCard { info: crate_info }
436                        }
437                    }
438                }
439
440                section { class: "crates-section",
441                    h2 { class: "crates-section-title", "Tools" }
442                    div { class: "crates-grid",
443                        for crate_info in APP_CRATES.iter() {
444                            CrateCard { info: crate_info }
445                        }
446                    }
447                }
448            }
449
450            Footer {}
451        }
452    }
453}
454
455#[component]
456fn CrateCard(info: &'static CrateInfo) -> Element {
457    let doc_url = format!("https://docs.logicaffeine.com/{}/index.html", info.name);
458
459    rsx! {
460        div { class: "crate-card",
461            div { class: "crate-header",
462                h3 { class: "crate-name",
463                    "{info.name}"
464                }
465                span {
466                    class: if info.badge == "Core" { "crate-badge core" } else { "crate-badge app" },
467                    "{info.badge}"
468                }
469            }
470            p { class: "crate-description", "{info.description}" }
471            div { class: "crate-links",
472                a {
473                    class: "crate-link docs",
474                    href: "{doc_url}",
475                    target: "_blank",
476                    rel: "noopener",
477                    svg {
478                        xmlns: "http://www.w3.org/2000/svg",
479                        fill: "none",
480                        view_box: "0 0 24 24",
481                        stroke: "currentColor",
482                        stroke_width: "2",
483                        path {
484                            stroke_linecap: "round",
485                            stroke_linejoin: "round",
486                            d: "M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"
487                        }
488                    }
489                    "Docs"
490                }
491                if let Some(crates_url) = info.crates_io {
492                    a {
493                        class: "crate-link crates-io",
494                        href: "{crates_url}",
495                        target: "_blank",
496                        rel: "noopener",
497                        svg {
498                            xmlns: "http://www.w3.org/2000/svg",
499                            fill: "none",
500                            view_box: "0 0 24 24",
501                            stroke: "currentColor",
502                            stroke_width: "2",
503                            path {
504                                stroke_linecap: "round",
505                                stroke_linejoin: "round",
506                                d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"
507                            }
508                        }
509                        "crates.io"
510                    }
511                }
512            }
513        }
514    }
515}