Skip to content

PasteStack/paste-surface-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paste-surface-spec

Language-agnostic specification for PasteStack Surface Rendering Layer.

Overview

This specification defines the contracts for rendering HTML templates using PasteStack. Implementations:

  • Scala/Twirlpaste-surface-scala
  • Python/Jinjapaste-surface-python (planned)
  • Basic HTML → Use paste-assetgraph directly (no surface needed)

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ Level 4: paste-surface-*                                        │
│   Templated UI (Scala/Twirl, Python/Jinja)                      │
├─────────────────────────────────────────────────────────────────┤
│ Level 3: paste-surface-spec (this repo)                         │
│   Contract for how elements get templated                        │
├─────────────────────────────────────────────────────────────────┤
│ Level 2: paste-elements                                          │
│   UI behaviors (JS + SCSS only, YUI-style modules)               │
├─────────────────────────────────────────────────────────────────┤
│ Level 1: paste-assetgraph                                        │
│   Asset pipeline (Rust binary, JAM URLs, manifest)               │
└─────────────────────────────────────────────────────────────────┘

MVP Pattern

Inspired by Model-View-Presenter pattern:

Route -> Presenter -> ViewModelFactory -> ViewModel -> Template
                           ↓
                      (or JSON)

Presenters are optional. Simple sites use ViewModels directly in templates.

Specification Contents

View Models

  • Page — PageMeta (SEO, meta tags)
  • Components — Hero, Address
  • Includes — CSS/JS asset injection with JAM

View Model Factories

  • Factories — PageMetaFactory, HeroFactory, IncludesFactory

Presenters (Optional)

Layouts

Components

Config

Directory Structure

spec/
├── view_models/
│   ├── page.md           # PageMeta
│   ├── components.md     # Hero, Address
│   └── includes.md       # CSSInclude, JSInclude (JAM)
├── view_model_factories/
│   └── factories.md      # PageMetaFactory, HeroFactory, IncludesFactory
├── presenters/
│   └── presenters.md     # PagePresenter (optional)
├── layouts/
│   └── webbase.md        # Base HTML layout
├── components/
│   └── formfield/
│       └── form.md       # Input, Button, Textarea, Hidden
└── config/
    └── config.md         # SurfaceConfig

Relationship: Elements → Components

paste-elements (JS + SCSS)     paste-surface-* (Templates)
─────────────────────────      ────────────────────────────
src/js/heroscroll.js      →    components/hero.html
src/js/stickynav.js       →    components/hero.html (data attrs)
src/js/autogrow.js        →    components/formfield/textarea.html
src/scss/heroscroll.scss  →    (bundled CSS)

Elements = JS behaviors + SCSS styles
Components = Template implementations that use elements

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published