Home /Modules/website/SLWebsiteDesign.sleela

SLWebsiteDesign.sleela

lib/website/SLWebsiteDesign.sleela · 85 line(s) · sleela

<< lib/website/SLWebsiteDesign.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines the SLeeLa standard-library type SLWebsiteDesign used within the website library family. >>
#sleela 2.5
material;
< Unified SLeeLa standard-library front-end object. >
< Family: website. The global look of a generated site: a named theme, a >
< palette (brand/base/accent), a corner-radius rhythm, the "energy" dial that >
< makes a site calm or exciting, and a layout grammar. The emitter reads these >
< to turn plain signs into a styled, dependency-free page. No new VM opcodes >
< are required: everything here is value assignment, arithmetic, and the >
< existing String concatenation on OP_ADD. >
<  >
< Layout grammar: 0 stack, 1 split, 2 grid, 3 canvas. >
class SLWebsiteDesign {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10056;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-03";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  String theme; String brand; String base; String accent; String font; int radius; int energy; int grammar;

  void configure(String t, String b, String ba, String ac, String f, int r, int e, int g) {
    theme = t; brand = b; base = ba; accent = ac; font = f;
    radius = clamp(r, 0, 24); energy = clamp(e, 0, 100); grammar = clamp(g, 0, 3);
  }

  < Named presets. A front end can start from a preset then override. >
  void preset(String name) {
    if (name == "neon") { configure("neon", "#7c3aed", "#0b0714", "#22d3ee", "'Space Grotesk', system-ui, sans-serif", 18, 95, 3); return; }
    if (name == "brutalist") { configure("brutalist", "#111111", "#f5f5f5", "#ff3b30", "'Arial Black', system-ui, sans-serif", 0, 70, 0); return; }
    if (name == "editorial") { configure("editorial", "#1f2937", "#fbfbf8", "#b45309", "Georgia, 'Times New Roman', serif", 4, 15, 1); return; }
    configure("aurora", "#2563eb", "#0f172a", "#38bdf8", "'Inter', system-ui, sans-serif", 14, 60, 2);
  }

  < Energy drives flat color (0), soft gradient (1), or bold animated gradient (2). >
  int motionLevel() {
    if (energy >= 75) { return 2; }
    if (energy >= 35) { return 1; }
    return 0;
  }

  int clamp(int v, int lo, int hi) {
    if (v < lo) { return lo; }
    if (v > hi) { return hi; }
    return v;
  }
}