Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

view/svelte: get ssr and client-side hydration working (WIP) #383

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,17 @@ example.hn.watch:
# Go
##

GO_SOURCE := ./internal/... ./package/... ./framework/...
GO_SOURCE := ./internal/... ./package/... ./framework/... ./runtime/...

go.tools:
@ go install \
github.com/evanw/esbuild/cmd/esbuild \
github.com/pointlander/peg \
src.techknowlogick.com/xgo

go.mod.tidy:
@ go mod tidy

# Run go generate
go.generate:
@ go generate $(GO_SOURCE)
@ go generate -mod=mod $(GO_SOURCE)

# TODO: add -race back in
go.test:
Expand Down Expand Up @@ -173,8 +170,8 @@ budjs.test:
##

test: test.dev
test.dev: go.tools go.generate go.fmt go.vet go.staticcheck budjs.check budjs.test go.test
test.all: go.tools go.generate go.vet go.staticcheck budjs.check budjs.test go.test
test.dev: go.generate go.fmt go.vet go.staticcheck budjs.check budjs.test go.test
test.all: go.generate go.vet go.staticcheck budjs.check budjs.test go.test

##
# CI
Expand Down
21 changes: 21 additions & 0 deletions example/docs/controller/controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package controller

type Controller struct {
}

func (c *Controller) Layout(theme *string) (title, style string) {
if theme == nil {
*theme = "light"
}
return "This title is from the controller!", *theme
}

func (c *Controller) Frame() (categories []string) {
return []string{
"Finance",
"Sports",
"Politics",
"Entertainment",
"Technology",
}
}
147 changes: 147 additions & 0 deletions example/docs/controller/posts/posts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package posts

// func NewViewer(svelteViewer *svelte.Viewer) *Viewer {
// return &Viewer{svelteViewer}
// }

// type SvelteViewer struct{}
// type HTMLViewer struct{}

// type Viewers map[string]viewer.Viewer

// func (vs Viewers) Render(key string, propMap *viewer.Page) {
// }

// type Viewer struct {
// svelteViewer *svelte.Viewer
// }

// func New(layoutFrame *controller.Controller) *Controller {
// return &Controller{
// layoutFrame: layoutFrame,
// }
// }

type Controller struct {
// layoutFrame *controller.Controller
// viewer *Viewer
}

type Post struct {
ID int `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
}

func (c *Controller) Frame(id int) (likes int) {
// Another use case (related posts)
return 10
}

// func (c *Controller) show(id int) (*Post, error) {
// return &Post{
// Title: "Hello world!",
// Body: "This is a post.",
// }, nil
// }

// func (c *Controller) ShowJSON(id int) (*Post, error) {
// return c.show(id)
// }

// type layoutRequest struct {
// Theme string `json:"theme,omitempty"`
// }

// type layoutResponse struct {
// Title string `json:"title,omitempty"`
// Style string `json:"style,omitempty"`
// }

// type layoutView struct {
// Controller *controller.Controller
// Request layoutRequest
// Response layoutResponse
// }

// func (l *layoutView) Run(ctx context.Context) error {

// }

// // Generated (by hand). Do not Edit.
// func (c *Controller) Show(w http.ResponseWriter, r *http.Request) {
// var layout struct {
// Theme string `json:"theme,omitempty"`
// }
// var frame struct {
// }
// var postsFrame struct {
// ID int `json:"id,omitempty"`
// }
// var postsPage struct {
// ID int `json:"id,omitempty"`
// }
// // TODO: consider a request umarshaller that takes multiple structs
// if err := request.Unmarshal(r, &layout); err != nil {
// console.Err(err, "unable to marshal")
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// if err := request.Unmarshal(r, &frame); err != nil {
// console.Err(err, "unable to frame")
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// if err := request.Unmarshal(r, &postsFrame); err != nil {
// console.Err(err, "unable to posts/frame")
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// if err := request.Unmarshal(r, &postsPage); err != nil {
// console.Err(err, "unable to posts/page")
// w.WriteHeader(http.StatusBadRequest)
// return
// }

// // // This part should happen concurrently
// // title, style := c.layoutFrame.Layout(&layout.Theme)
// // layoutProps := viewer.Props{
// // "title": title,
// // "style": style,
// // }
// // categories := c.layoutFrame.Frame()
// // frame0Props := viewer.Props{
// // "categories": categories,
// // }
// // likes := c.Frame(postsFrame.ID)
// // frame1Props := viewer.Props{
// // "likes": likes,
// // }
// // post, err := c.show(postsPage.ID)
// // if err != nil {
// // console.Err(err, "unable to show post")
// // w.WriteHeader(http.StatusInternalServerError)
// // return
// // }
// // pageProps := viewer.Props{
// // "post": post,
// // }
// // // Once done, we come back together for rendering
// // _ = layoutProps
// // _ = frame0Props
// // _ = frame1Props
// // _ = pageProps
// // fmt.Println("got post", post)
// // c.Post()
// // fmt.Println(layout, frame, postsFrame, postsPage)
// // _, _, _, _ = Layout, Frame, PostsFrame, PostsPage
// w.Write([]byte("Hello world!!!"))
// }

func (c *Controller) Show(id int) (*Post, error) {
return &Post{
ID: id,
Title: "Hello world",
Body: "This is a post",
}, nil
}
29 changes: 29 additions & 0 deletions example/docs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module github.com/livebud/bud/example/docs

go 1.19

replace github.com/livebud/bud => /Users/m/dev/src/github.com/livebud/bud

require github.com/livebud/bud v0.0.0-00010101000000-000000000000

require (
github.com/RyanCarrier/dijkstra v1.1.0 // indirect
github.com/ajg/form v1.5.2-0.20200323032839-9aeb3cf462e1 // indirect
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/evanw/esbuild v0.17.10 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/keegancsmith/rpc v1.3.0 // indirect
github.com/livebud/transpiler v0.0.3 // indirect
github.com/matthewmueller/gotext v0.0.0-20210424201144-265ed61725ac // indirect
github.com/matthewmueller/text v0.0.0-20210424201111-ec1e4af8dfe8 // indirect
github.com/mattn/go-sqlite3 v1.14.16 // indirect
github.com/timewasted/go-accept-headers v0.0.0-20130320203746-c78f304b1b09 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
)
89 changes: 89 additions & 0 deletions example/docs/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/RyanCarrier/dijkstra v1.1.0 h1:/NDihjfJA3CxFaZz8EdzTwdFKFZDvvB881OVLdakRcI=
github.com/RyanCarrier/dijkstra v1.1.0/go.mod h1:5agGUBNEtUAGIANmbw09fuO3a2htPEkc1jNH01qxCWA=
github.com/RyanCarrier/dijkstra-1 v0.0.0-20170512020943-0e5801a26345 h1:fgSpoKViTSqRb4hjDNj10ig5wUvO0CayCzFdLf6fuRM=
github.com/RyanCarrier/dijkstra-1 v0.0.0-20170512020943-0e5801a26345/go.mod h1:OK4EvWJ441LQqGzed5NGB6vKBAE34n3z7iayPcEwr30=
github.com/ajg/form v1.5.2-0.20200323032839-9aeb3cf462e1 h1:8Qzi+0Uch1VJvdrOhJ8U8FqoPLbUdETPgMqGJ6DSMSQ=
github.com/ajg/form v1.5.2-0.20200323032839-9aeb3cf462e1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/albertorestifo/dijkstra v0.0.0-20160910063646-aba76f725f72 h1:uGeGZl8PxSq8VZGG4QK5njJTFA4/G/x5CYORvQVXtAE=
github.com/albertorestifo/dijkstra v0.0.0-20160910063646-aba76f725f72/go.mod h1:o+JdB7VetTHjLhU0N57x18B9voDBQe0paApdEAEoEfw=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo=
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/evanw/esbuild v0.17.10 h1:RMwM8ehohA6RSgWVirjnsZ+u9ttNt0gWfRLYCxUbAoc=
github.com/evanw/esbuild v0.17.10/go.mod h1:iINY06rn799hi48UqEnaQvVfZWe6W9bET78LbvN8VWk=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ=
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813/go.mod h1:P+oSoE9yhSRvsmYyZsshflcR6ePWYLql6UU1amW13IM=
github.com/gitchander/permutation v0.0.0-20201214100618-1f3e7285f953 h1:+rJDfq6waeB1BncyEfuFL1N3U7t3aahrAjPqcKLpMys=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/hexops/valast v1.4.1 h1:vlB+usah+MLacCyDDqACn2yhAoCDlpHYkpEKtej+RXE=
github.com/keegancsmith/rpc v1.3.0 h1:wGWOpjcNrZaY8GDYZJfvyxmlLljm3YQWF+p918DXtDk=
github.com/keegancsmith/rpc v1.3.0/go.mod h1:6O2xnOGjPyvIPbvp0MdrOe5r6cu1GZ4JoTzpzDhWeo0=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY=
github.com/livebud/transpiler v0.0.3 h1:OFKPsmfTOywBDoOE/ZFMVjAupk/xVXFlXoAgZNRhh5Q=
github.com/livebud/transpiler v0.0.3/go.mod h1:vQYMN//Y2cnM55tw0lOmLGbEETugP7alxTyhQHzNdTI=
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
github.com/matthewmueller/diff v0.0.0-20220104030700-cb2fe910d90c h1:yjGBNrCIE7IghJAwrFcyDzwzwJKf0oRPeOHx60wfkmA=
github.com/matthewmueller/gotext v0.0.0-20210424201144-265ed61725ac h1:SjopLdUF96kdJU8ynYmGVHoJmngpwFHRvR5p2plBXG4=
github.com/matthewmueller/gotext v0.0.0-20210424201144-265ed61725ac/go.mod h1:0mnotoJNdO4NPxld/GcrLppxwGWuMqgroWyu413oOvw=
github.com/matthewmueller/text v0.0.0-20201215225457-a00346c71bb3/go.mod h1:vtPaEU72VzARd4tSSzHIX7DddCEamoO2X4ozlrdmtNY=
github.com/matthewmueller/text v0.0.0-20210424201111-ec1e4af8dfe8 h1:XTmVlF7P9bpSNkLFlxpNlhig0kaVJ5mO4D3yK2CYjmM=
github.com/matthewmueller/text v0.0.0-20210424201111-ec1e4af8dfe8/go.mod h1:vtPaEU72VzARd4tSSzHIX7DddCEamoO2X4ozlrdmtNY=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mattomatic/dijkstra v0.0.0-20130617153013-6f6d134eb237 h1:acuCHBjzG7MFTugvx3buC4m5rLDLaKC9J8C9jtlraRc=
github.com/mattomatic/dijkstra v0.0.0-20130617153013-6f6d134eb237/go.mod h1:UOnLAUmVG5paym8pD3C4B9BQylUDC2vXFJJpT7JrlEA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041 h1:llrF3Fs4018ePo4+G/HV/uQUqEI1HMDjCeOf2V6puPc=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/timewasted/go-accept-headers v0.0.0-20130320203746-c78f304b1b09 h1:QVxbx5l/0pzciWYOynixQMtUhPYC3YKD6EcUlOsgGqw=
github.com/timewasted/go-accept-headers v0.0.0-20130320203746-c78f304b1b09/go.mod h1:Uy/Rnv5WKuOO+PuDhuYLEpUiiKIZtss3z519uk67aF0=
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk=
github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
go.kuoruan.net/v8go-polyfills v0.5.1-0.20220727011656-c74c5b408ebd h1:lMfOO39WTD+CxBPmqZvLdISrLVsEjgNfWoV4viBt15M=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f h1:OKYpQQVE3DKSc3r3zHVzq46vq5YH7x8xpR3/k9ixmUg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
mvdan.cc/gofumpt v0.2.0 h1:AInyCTHfhp4bFrP2VYC5kR2wPwgWj7eGSb+7437zn7I=
rogchap.com/v8go v0.8.0 h1:/crDEiga68kOtbIqw3K9Rt9OztYz0LhAPHm2e3wK7Q4=
4 changes: 4 additions & 0 deletions example/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "docs",
"private": "true"
}
5 changes: 5 additions & 0 deletions example/docs/view/Header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
export let title
</script>

<h1>{title}</h1>
7 changes: 7 additions & 0 deletions example/docs/view/error.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
export let error = {
message: "",
}
</script>

<h2>An error has occurred: {error.message}</h2>
18 changes: 18 additions & 0 deletions example/docs/view/frame.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script>
export let categories = ["Soccer", "Football"]
</script>

<main>
<aside>
{#each categories as category}
<p>{category}</p>
{/each}
</aside>
<article><slot /></article>
</main>

<style>
p {
color: orange;
}
</style>
24 changes: 24 additions & 0 deletions example/docs/view/layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
export let title = "My Wonderful Blog"
export let theme = "light"
// import Header from "./Header.svelte"
</script>

<html lang="en">
<head>
<title>{title}</title>
<slot name="head" />
</head>
<body data-theme={theme}>
<h1>{title}</h1>
<main>
<slot />
</main>
</body>
</html>

<style>
h1 {
color: green;
}
</style>
Loading