WIP update deps, sql builder instead of jet
This commit is contained in:
3
vendor/maragu.dev/gomponents/Makefile
vendored
3
vendor/maragu.dev/gomponents/Makefile
vendored
@@ -1,6 +1,6 @@
|
||||
.PHONY: benchmark
|
||||
benchmark:
|
||||
go test -bench=.
|
||||
go test -bench=. ./...
|
||||
|
||||
.PHONY: cover
|
||||
cover:
|
||||
@@ -13,4 +13,3 @@ lint:
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -coverprofile=cover.out -shuffle on ./...
|
||||
|
||||
|
||||
41
vendor/maragu.dev/gomponents/README.md
vendored
41
vendor/maragu.dev/gomponents/README.md
vendored
@@ -71,6 +71,47 @@ func NavbarLink(href, name, currentPath string) Node {
|
||||
(Some people don't like dot-imports, and luckily it's completely optional.)
|
||||
|
||||
For a more complete example, see [the examples directory](internal/examples/).
|
||||
There's also the [gomponents-starter-kit](https://github.com/maragudk/gomponents-starter-kit) for a full application template.
|
||||
|
||||
## Architecture
|
||||
|
||||
gomponents is organized into several packages:
|
||||
|
||||
- `gomponents`: Core interfaces and functions like `Node`, `El`, `Attr`, and helpers like `Map`, `Group`, `If`, `Text`, `Raw`.
|
||||
- `gomponents/html`: HTML elements and attributes.
|
||||
- `gomponents/components`: Higher-level components and utilities.
|
||||
- `gomponents/http`: HTTP-related utilities for web servers.
|
||||
|
||||
### Void Elements
|
||||
|
||||
Void elements in HTML (like `<br>`, `<img>`, `<input>`) don't have closing tags.
|
||||
gomponents handles these correctly by checking against an internal list of void elements during rendering.
|
||||
When you create a void element, any child nodes that are not attributes will be ignored automatically to ensure valid HTML output.
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
gomponents renders directly to an `io.Writer`, making it efficient for server-side rendering.
|
||||
The library avoids unnecessary allocations where possible.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Is gomponents production-ready?
|
||||
|
||||
Yes! gomponents is mature, stable, fully tested with 100% coverage, and has been used in production by myself and many others.
|
||||
|
||||
### Should I choose `html/template`, Templ, or gomponents?
|
||||
|
||||
These are all good choices, and it largely comes down to preference.
|
||||
I wrote gomponents because I didn't like how I think it's hard to pass data around between templates in `html/template`.
|
||||
gomponents is pure Go, with no extra build step like Templ, so it works with all tools that already support Go.
|
||||
|
||||
That said, both `html/template` and Templ will do the same thing as gomponents in the end. Try them all and choose what you like!
|
||||
|
||||
### I don't like how HTML looks in Go.
|
||||
|
||||
First of all, that's not a question. 😉
|
||||
|
||||
More seriously, think of gomponents like a DSL for HTML. You're building UI components. Give it a day, and it'll feel natural.
|
||||
|
||||
### What's up with the specially named elements and attributes?
|
||||
|
||||
|
||||
3
vendor/maragu.dev/gomponents/codecov.yml
vendored
3
vendor/maragu.dev/gomponents/codecov.yml
vendored
@@ -1,3 +1,2 @@
|
||||
ignore:
|
||||
- "examples"
|
||||
- "internal/assert"
|
||||
- "internal/"
|
||||
|
||||
2
vendor/maragu.dev/gomponents/gomponents.go
vendored
2
vendor/maragu.dev/gomponents/gomponents.go
vendored
@@ -250,7 +250,7 @@ func Rawf(format string, a ...interface{}) Node {
|
||||
|
||||
// Map a slice of anything to a [Group] (which is just a slice of [Node]-s).
|
||||
func Map[T any](ts []T, cb func(T) Node) Group {
|
||||
var nodes []Node
|
||||
nodes := make([]Node, 0, len(ts))
|
||||
for _, t := range ts {
|
||||
nodes = append(nodes, cb(t))
|
||||
}
|
||||
|
||||
44
vendor/maragu.dev/gomponents/html/attributes.go
vendored
44
vendor/maragu.dev/gomponents/html/attributes.go
vendored
@@ -40,6 +40,10 @@ func Disabled() g.Node {
|
||||
return g.Attr("disabled")
|
||||
}
|
||||
|
||||
func Download(v string) g.Node {
|
||||
return g.Attr("download", v)
|
||||
}
|
||||
|
||||
func Draggable(v string) g.Node {
|
||||
return g.Attr("draggable", v)
|
||||
}
|
||||
@@ -133,14 +137,38 @@ func DataAttr(name, v string) g.Node {
|
||||
return Data(name, v)
|
||||
}
|
||||
|
||||
func SlotAttr(v string) g.Node {
|
||||
return g.Attr("slot", v)
|
||||
}
|
||||
|
||||
func For(v string) g.Node {
|
||||
return g.Attr("for", v)
|
||||
}
|
||||
|
||||
func FormAction(v string) g.Node {
|
||||
return g.Attr("formaction", v)
|
||||
}
|
||||
|
||||
func FormAttr(v string) g.Node {
|
||||
return g.Attr("form", v)
|
||||
}
|
||||
|
||||
func FormEncType(v string) g.Node {
|
||||
return g.Attr("formenctype", v)
|
||||
}
|
||||
|
||||
func FormMethod(v string) g.Node {
|
||||
return g.Attr("formmethod", v)
|
||||
}
|
||||
|
||||
func FormNoValidate() g.Node {
|
||||
return g.Attr("formnovalidate")
|
||||
}
|
||||
|
||||
func FormTarget(v string) g.Node {
|
||||
return g.Attr("formtarget", v)
|
||||
}
|
||||
|
||||
func Height(v string) g.Node {
|
||||
return g.Attr("height", v)
|
||||
}
|
||||
@@ -209,6 +237,18 @@ func Placeholder(v string) g.Node {
|
||||
return g.Attr("placeholder", v)
|
||||
}
|
||||
|
||||
func Popover(value ...string) g.Node {
|
||||
return g.Attr("popover", value...)
|
||||
}
|
||||
|
||||
func PopoverTarget(v string) g.Node {
|
||||
return g.Attr("popovertarget", v)
|
||||
}
|
||||
|
||||
func PopoverTargetAction(v string) g.Node {
|
||||
return g.Attr("popovertargetaction", v)
|
||||
}
|
||||
|
||||
func Poster(v string) g.Node {
|
||||
return g.Attr("poster", v)
|
||||
}
|
||||
@@ -217,6 +257,10 @@ func Preload(v string) g.Node {
|
||||
return g.Attr("preload", v)
|
||||
}
|
||||
|
||||
func ReferrerPolicy(v string) g.Node {
|
||||
return g.Attr("referrerpolicy", v)
|
||||
}
|
||||
|
||||
func Rel(v string) g.Node {
|
||||
return g.Attr("rel", v)
|
||||
}
|
||||
|
||||
@@ -264,6 +264,10 @@ func Select(children ...g.Node) g.Node {
|
||||
return g.El("select", children...)
|
||||
}
|
||||
|
||||
func SlotEl(children ...g.Node) g.Node {
|
||||
return g.El("slot", children...)
|
||||
}
|
||||
|
||||
func Source(children ...g.Node) g.Node {
|
||||
return g.El("source", children...)
|
||||
}
|
||||
@@ -296,6 +300,10 @@ func Td(children ...g.Node) g.Node {
|
||||
return g.El("td", children...)
|
||||
}
|
||||
|
||||
func Template(children ...g.Node) g.Node {
|
||||
return g.El("template", children...)
|
||||
}
|
||||
|
||||
func Textarea(children ...g.Node) g.Node {
|
||||
return g.El("textarea", children...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user