init - add project files
This commit is contained in:
15
vendor/maragu.dev/gomponents-htmx/.editorconfig
vendored
Normal file
15
vendor/maragu.dev/gomponents-htmx/.editorconfig
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[{*.go,*.md}]
|
||||
indent_style = tab
|
||||
1
vendor/maragu.dev/gomponents-htmx/.gitignore
vendored
Normal file
1
vendor/maragu.dev/gomponents-htmx/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
cover.out
|
||||
21
vendor/maragu.dev/gomponents-htmx/LICENSE
vendored
Normal file
21
vendor/maragu.dev/gomponents-htmx/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Maragu ApS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
12
vendor/maragu.dev/gomponents-htmx/Makefile
vendored
Normal file
12
vendor/maragu.dev/gomponents-htmx/Makefile
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
.PHONY: cover
|
||||
cover:
|
||||
go tool cover -html=cover.out
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -coverprofile=cover.out -shuffle on ./...
|
||||
|
||||
99
vendor/maragu.dev/gomponents-htmx/README.md
vendored
Normal file
99
vendor/maragu.dev/gomponents-htmx/README.md
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
# gomponents-htmx
|
||||
|
||||
<img src="logo.png" alt="Logo" width="300" align="right">
|
||||
|
||||
[](https://pkg.go.dev/maragu.dev/gomponents-htmx)
|
||||
[](https://github.com/maragudk/gomponents-htmx/actions/workflows/ci.yml)
|
||||
|
||||
[HTMX](https://htmx.org) attributes and helpers for [gomponents](https://www.gomponents.com).
|
||||
|
||||
Made with ✨sparkles✨ by [maragu](https://www.maragu.dev/).
|
||||
|
||||
Does your company depend on this project? [Contact me at markus@maragu.dk](mailto:markus@maragu.dk?Subject=Supporting%20your%20project) to discuss options for a one-time or recurring invoice to ensure its continued thriving.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
go get maragu.dev/gomponents-htmx
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
. "maragu.dev/gomponents"
|
||||
. "maragu.dev/gomponents/components"
|
||||
. "maragu.dev/gomponents/html"
|
||||
. "maragu.dev/gomponents/http"
|
||||
|
||||
hx "maragu.dev/gomponents-htmx"
|
||||
hxhttp "maragu.dev/gomponents-htmx/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := start(); err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func start() error {
|
||||
now := time.Now()
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", Adapt(func(w http.ResponseWriter, r *http.Request) (Node, error) {
|
||||
if r.Method == http.MethodPost && hxhttp.IsBoosted(r.Header) {
|
||||
now = time.Now()
|
||||
|
||||
hxhttp.SetPushURL(w.Header(), "/?time="+now.Format(timeOnly))
|
||||
|
||||
return partial(now), nil
|
||||
}
|
||||
return page(now), nil
|
||||
}))
|
||||
|
||||
log.Println("Starting on http://localhost:8080")
|
||||
if err := http.ListenAndServe("localhost:8080", mux); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
const timeOnly = "15:04:05"
|
||||
|
||||
func page(now time.Time) Node {
|
||||
return HTML5(HTML5Props{
|
||||
Title: now.Format(timeOnly),
|
||||
|
||||
Head: []Node{
|
||||
Script(Src("https://cdn.tailwindcss.com?plugins=forms,typography")),
|
||||
Script(Src("https://unpkg.com/htmx.org")),
|
||||
},
|
||||
|
||||
Body: []Node{
|
||||
Div(Class("max-w-7xl mx-auto p-4 prose lg:prose-lg xl:prose-xl"),
|
||||
H1(Text(`gomponents + HTMX`)),
|
||||
|
||||
P(Textf(`Time at last full page refresh was %v.`, now.Format(timeOnly))),
|
||||
|
||||
partial(now),
|
||||
|
||||
Form(Method("post"), Action("/"),
|
||||
hx.Boost("true"), hx.Target("#partial"), hx.Swap("outerHTML"),
|
||||
|
||||
Button(Type("submit"), Text(`Update time`),
|
||||
Class("rounded-md border border-transparent bg-orange-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-orange-500 focus:ring-offset-2"),
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func partial(now time.Time) Node {
|
||||
return P(ID("partial"), Textf(`Time was last updated at %v.`, now.Format(timeOnly)))
|
||||
}
|
||||
```
|
||||
226
vendor/maragu.dev/gomponents-htmx/htmx.go
vendored
Normal file
226
vendor/maragu.dev/gomponents-htmx/htmx.go
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
// Package htmx provides HTMX attributes and helpers for gomponents.
|
||||
// See https://htmx.org/
|
||||
package htmx
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
g "maragu.dev/gomponents"
|
||||
)
|
||||
|
||||
// Boost to add or remove progressive enhancement for links and forms.
|
||||
// See https://htmx.org/attributes/hx-boost
|
||||
func Boost(v string) g.Node {
|
||||
return attr("boost", v)
|
||||
}
|
||||
|
||||
// Get from the specified URL.
|
||||
// See https://htmx.org/attributes/hx-get
|
||||
func Get(url string) g.Node {
|
||||
return attr("get", url)
|
||||
}
|
||||
|
||||
// On handles any event with a script inline.
|
||||
// See https://htmx.org/attributes/hx-on
|
||||
func On(name string, v string) g.Node {
|
||||
return &rawAttr{name: "on:" + name, value: v}
|
||||
}
|
||||
|
||||
// Post to the specified URL.
|
||||
// See https://htmx.org/attributes/hx-post
|
||||
func Post(url string) g.Node {
|
||||
return attr("post", url)
|
||||
}
|
||||
|
||||
// PushURL into the browser location bar, creating a new history entry.
|
||||
// See https://htmx.org/attributes/hx-push-url
|
||||
func PushURL(v string) g.Node {
|
||||
return attr("push-url", v)
|
||||
}
|
||||
|
||||
// Select content to swap in from a response.
|
||||
// See https://htmx.org/attributes/hx-select
|
||||
func Select(v string) g.Node {
|
||||
return attr("select", v)
|
||||
}
|
||||
|
||||
// SelectOOB content to swap in from a response, out of band (somewhere other than the target).
|
||||
// See https://htmx.org/attributes/hx-select-oob
|
||||
func SelectOOB(v string) g.Node {
|
||||
return attr("select-oob", v)
|
||||
}
|
||||
|
||||
// Swap controls how content is swapped in.
|
||||
// See https://htmx.org/attributes/hx-swap
|
||||
func Swap(v string) g.Node {
|
||||
return attr("swap", v)
|
||||
}
|
||||
|
||||
// SwapOOB marks content in a response to be out of band (should swap in somewhere other than the target).
|
||||
// See https://htmx.org/attributes/hx-swap-oob
|
||||
func SwapOOB(v string) g.Node {
|
||||
return attr("swap-oob", v)
|
||||
}
|
||||
|
||||
// Target specifies the target element to be swapped.
|
||||
// See https://htmx.org/attributes/hx-target
|
||||
func Target(v string) g.Node {
|
||||
return attr("target", v)
|
||||
}
|
||||
|
||||
// Trigger specifies the event that triggers the request.
|
||||
// See https://htmx.org/attributes/hx-trigger
|
||||
func Trigger(v string) g.Node {
|
||||
return attr("trigger", v)
|
||||
}
|
||||
|
||||
// Vals adds values to the parameters to submit with the request (JSON-formatted).
|
||||
// See https://htmx.org/attributes/hx-vals
|
||||
func Vals(v string) g.Node {
|
||||
return attr("vals", v)
|
||||
}
|
||||
|
||||
// Confirm shows a confirm() dialog before issuing a request.
|
||||
// See https://htmx.org/attributes/hx-confirm
|
||||
func Confirm(v string) g.Node {
|
||||
return attr("confirm", v)
|
||||
}
|
||||
|
||||
// Delete will issue a DELETE to the specified URL and swap the HTML into the DOM using a swap strategy.
|
||||
// See https://htmx.org/attributes/hx-delete
|
||||
func Delete(v string) g.Node {
|
||||
return attr("delete", v)
|
||||
}
|
||||
|
||||
// Disable htmx processing for the given node and any children nodes.
|
||||
// See https://htmx.org/attributes/hx-disable
|
||||
func Disable(v string) g.Node {
|
||||
return attr("disable", v)
|
||||
}
|
||||
|
||||
// Disable element until htmx request completes.
|
||||
// See https://htmx.org/attributes/hx-disabled-elt/
|
||||
func DisabledElt(v string) g.Node {
|
||||
return attr("disabled-elt", v)
|
||||
}
|
||||
|
||||
// Disinherit controls and disables automatic attribute inheritance for child nodes.
|
||||
// See https://htmx.org/attributes/hx-disinherit
|
||||
func Disinherit(v string) g.Node {
|
||||
return attr("disinherit", v)
|
||||
}
|
||||
|
||||
// Encoding changes the request encoding type.
|
||||
// See https://htmx.org/attributes/hx-encoding
|
||||
func Encoding(v string) g.Node {
|
||||
return attr("encoding", v)
|
||||
}
|
||||
|
||||
// Ext sets extensions to use for this element.
|
||||
// See https://htmx.org/attributes/hx-ext
|
||||
func Ext(v string) g.Node {
|
||||
return attr("ext", v)
|
||||
}
|
||||
|
||||
// Headers adds to the headers that will be submitted with the request.
|
||||
// See https://htmx.org/attributes/hx-headers
|
||||
func Headers(v string) g.Node {
|
||||
return attr("headers", v)
|
||||
}
|
||||
|
||||
// History prevents sensitive data being saved to the history cache.
|
||||
// See https://htmx.org/attributes/hx-history
|
||||
func History(v string) g.Node {
|
||||
return attr("history", v)
|
||||
}
|
||||
|
||||
// HistoryElt sets the element to snapshot and restore during history navigation.
|
||||
// See https://htmx.org/attributes/hx-history-elt
|
||||
func HistoryElt(v string) g.Node {
|
||||
return attr("history-elt", v)
|
||||
}
|
||||
|
||||
// Include additional data in requests.
|
||||
// See https://htmx.org/attributes/hx-include
|
||||
func Include(v string) g.Node {
|
||||
return attr("include", v)
|
||||
}
|
||||
|
||||
// Indicator sets the element to put the htmx-request class on during the request.
|
||||
// See https://htmx.org/attributes/hx-indicator
|
||||
func Indicator(v string) g.Node {
|
||||
return attr("indicator", v)
|
||||
}
|
||||
|
||||
// Params filters the parameters that will be submitted with a request.
|
||||
// See https://htmx.org/attributes/hx-params
|
||||
func Params(v string) g.Node {
|
||||
return attr("params", v)
|
||||
}
|
||||
|
||||
// Patch issues a PATCH to the specified URL.
|
||||
// See https://htmx.org/attributes/hx-patch
|
||||
func Patch(v string) g.Node {
|
||||
return attr("patch", v)
|
||||
}
|
||||
|
||||
// Preserve specifies elements to keep unchanged between requests.
|
||||
// See https://htmx.org/attributes/hx-preserve
|
||||
func Preserve(v string) g.Node {
|
||||
return attr("preserve", v)
|
||||
}
|
||||
|
||||
// Prompt shows a prompt() before submitting a request.
|
||||
// See https://htmx.org/attributes/hx-prompt
|
||||
func Prompt(v string) g.Node {
|
||||
return attr("prompt", v)
|
||||
}
|
||||
|
||||
// Put issues a PUT to the specified URL.
|
||||
// See https://htmx.org/attributes/hx-put
|
||||
func Put(v string) g.Node {
|
||||
return attr("put", v)
|
||||
}
|
||||
|
||||
// ReplaceURL replaces the URL in the browser location bar.
|
||||
// See https://htmx.org/attributes/hx-replace-url
|
||||
func ReplaceURL(v string) g.Node {
|
||||
return attr("replace-url", v)
|
||||
}
|
||||
|
||||
// Request configures various aspects of the request.
|
||||
// See https://htmx.org/attributes/hx-request
|
||||
func Request(v string) g.Node {
|
||||
return attr("request", v)
|
||||
}
|
||||
|
||||
// Sync controls how requests made by different elements are synchronized.
|
||||
// See https://htmx.org/attributes/hx-sync
|
||||
func Sync(v string) g.Node {
|
||||
return attr("sync", v)
|
||||
}
|
||||
|
||||
// Validate forces elements to validate themselves before a request.
|
||||
// See https://htmx.org/attributes/hx-validate
|
||||
func Validate(v string) g.Node {
|
||||
return attr("validate", v)
|
||||
}
|
||||
|
||||
func attr(name, value string) g.Node {
|
||||
return g.Attr("hx-"+name, value)
|
||||
}
|
||||
|
||||
// rawAttr is an attribute that doesn't escape its value.
|
||||
type rawAttr struct {
|
||||
name string
|
||||
value string
|
||||
}
|
||||
|
||||
func (r *rawAttr) Render(w io.Writer) error {
|
||||
_, err := w.Write([]byte(" hx-" + r.name + `="` + r.value + `"`))
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *rawAttr) Type() g.NodeType {
|
||||
return g.AttributeType
|
||||
}
|
||||
BIN
vendor/maragu.dev/gomponents-htmx/logo.png
vendored
Normal file
BIN
vendor/maragu.dev/gomponents-htmx/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 238 KiB |
15
vendor/maragu.dev/gomponents/.editorconfig
vendored
Normal file
15
vendor/maragu.dev/gomponents/.editorconfig
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[{*.go,*.md}]
|
||||
indent_style = tab
|
||||
1
vendor/maragu.dev/gomponents/.gitignore
vendored
Normal file
1
vendor/maragu.dev/gomponents/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/cover.out
|
||||
18
vendor/maragu.dev/gomponents/CONTRIBUTING.md
vendored
Normal file
18
vendor/maragu.dev/gomponents/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Contributing
|
||||
|
||||
First of all, thank you for considering a contribution to this project. 😊
|
||||
Whether it's a small fix, an idea, a bug report, or some feature code,
|
||||
actions that impact the project positively are always very welcome.
|
||||
|
||||
## How to contribute
|
||||
|
||||
Feel free to submit a PR directly, if your change is in code and small and isolated.
|
||||
If you're in doubt about whether your contribution is a good idea for the project,
|
||||
feel free to create an issue first discussing the change.
|
||||
This also applies for any larger changes; start with an issue instead of risking
|
||||
a large PR that doesn't get accepted, which would make everyone involved sad.
|
||||
|
||||
## Terms
|
||||
|
||||
By contributing code, you declare that you have the rights to add it,
|
||||
and you accept that it will be published in the project under the existing license.
|
||||
10
vendor/maragu.dev/gomponents/CONTRIBUTORS.md
vendored
Normal file
10
vendor/maragu.dev/gomponents/CONTRIBUTORS.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# Contributors
|
||||
|
||||
A huge thank you to all contributors of code, bug reports, ideas, discussions, and more!
|
||||
|
||||
If you think your name belongs here, add your name and submit a PR. Then Github shows your name and picture
|
||||
in the sidebar, also if you have not contributed code.
|
||||
|
||||
- Markus Wüstenberg, @markuswustenberg / @maragudk
|
||||
- Hans Raaf, @oderwat
|
||||
- Guy-Laurent Subri, @glsubri
|
||||
21
vendor/maragu.dev/gomponents/LICENSE
vendored
Normal file
21
vendor/maragu.dev/gomponents/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Maragu ApS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
16
vendor/maragu.dev/gomponents/Makefile
vendored
Normal file
16
vendor/maragu.dev/gomponents/Makefile
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
.PHONY: benchmark
|
||||
benchmark:
|
||||
go test -bench=.
|
||||
|
||||
.PHONY: cover
|
||||
cover:
|
||||
go tool cover -html=cover.out
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -coverprofile=cover.out -shuffle on ./...
|
||||
|
||||
88
vendor/maragu.dev/gomponents/README.md
vendored
Normal file
88
vendor/maragu.dev/gomponents/README.md
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# Tired of complex template languages?
|
||||
|
||||
<img src="logo.png" alt="Logo" width="300" align="right">
|
||||
|
||||
[](https://pkg.go.dev/maragu.dev/gomponents)
|
||||
[](https://github.com/maragudk/gomponents/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/maragudk/gomponents)
|
||||
[](https://goreportcard.com/report/maragu.dev/gomponents)
|
||||
|
||||
Try HTML components in pure Go.
|
||||
|
||||
_gomponents_ are HTML components written in pure Go.
|
||||
They render to HTML 5, and make it easy for you to build reusable components.
|
||||
So you can focus on building your app instead of learning yet another templating language.
|
||||
|
||||
```shell
|
||||
go get maragu.dev/gomponents
|
||||
```
|
||||
|
||||
Made with ✨sparkles✨ by [maragu](https://www.maragu.dev/).
|
||||
|
||||
Does your company depend on this project? [Contact me at markus@maragu.dk](mailto:markus@maragu.dk?Subject=Supporting%20your%20project) to discuss options for a one-time or recurring invoice to ensure its continued thriving.
|
||||
|
||||
## Features
|
||||
|
||||
Check out [www.gomponents.com](https://www.gomponents.com) for an introduction.
|
||||
|
||||
- Build reusable HTML components
|
||||
- Write declarative HTML 5 in Go without all the strings, so you get
|
||||
- Type safety from the compiler
|
||||
- Auto-completion from the IDE
|
||||
- Easy debugging with the standard Go debugger
|
||||
- Automatic formatting with `gofmt`/`goimports`
|
||||
- Simple API that's easy to learn and use (you know most already if you know HTML)
|
||||
- Useful helpers like
|
||||
- `Text` and `Textf` that insert HTML-escaped text,
|
||||
- `Raw` and `Rawf` for inserting raw strings,
|
||||
- `Map` for mapping data to components and `Group` for grouping components,
|
||||
- and `If`/`Iff` for conditional rendering.
|
||||
- No external dependencies
|
||||
- Mature and stable, no breaking changes
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
go get maragu.dev/gomponents
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
. "maragu.dev/gomponents"
|
||||
. "maragu.dev/gomponents/components"
|
||||
. "maragu.dev/gomponents/html"
|
||||
)
|
||||
|
||||
func Navbar(authenticated bool, currentPath string) Node {
|
||||
return Nav(
|
||||
NavbarLink("/", "Home", currentPath),
|
||||
NavbarLink("/about", "About", currentPath),
|
||||
If(authenticated, NavbarLink("/profile", "Profile", currentPath)),
|
||||
)
|
||||
}
|
||||
|
||||
func NavbarLink(href, name, currentPath string) Node {
|
||||
return A(Href(href), Classes{"is-active": currentPath == href}, g.Text(name))
|
||||
}
|
||||
```
|
||||
|
||||
(Some people don't like dot-imports, and luckily it's completely optional.)
|
||||
|
||||
For a more complete example, see [the examples directory](internal/examples/).
|
||||
|
||||
### What's up with the specially named elements and attributes?
|
||||
|
||||
Unfortunately, there are some name clashes in HTML elements and attributes, so they need an `El` or `Attr` suffix,
|
||||
to be able to co-exist in the same package in Go.
|
||||
|
||||
I've chosen one or the other based on what I think is the common usage.
|
||||
In either case, the less-used variant also exists in the codebase:
|
||||
|
||||
- `cite` (`Cite`/`CiteAttr`, `CiteEl` also exists)
|
||||
- `data` (`DataEl`/`Data`, `DataAttr` also exists)
|
||||
- `form` (`Form`/`FormAttr`, `FormEl` also exists)
|
||||
- `label` (`Label`/`LabelAttr`, `LabelEl` also exists)
|
||||
- `style` (`StyleEl`/`Style`, `StyleAttr` also exists)
|
||||
- `title` (`TitleEl`/`Title`, `TitleAttr` also exists)
|
||||
3
vendor/maragu.dev/gomponents/codecov.yml
vendored
Normal file
3
vendor/maragu.dev/gomponents/codecov.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
ignore:
|
||||
- "examples"
|
||||
- "internal/assert"
|
||||
297
vendor/maragu.dev/gomponents/gomponents.go
vendored
Normal file
297
vendor/maragu.dev/gomponents/gomponents.go
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
// Package gomponents provides HTML components in Go, that render to HTML 5.
|
||||
//
|
||||
// The primary interface is a [Node]. It defines a function Render, which should render the [Node]
|
||||
// to the given writer as a string.
|
||||
//
|
||||
// All DOM elements and attributes can be created by using the [El] and [Attr] functions.
|
||||
//
|
||||
// The functions [Text], [Textf], [Raw], and [Rawf] can be used to create text nodes, either HTML-escaped or unescaped.
|
||||
//
|
||||
// See also helper functions [Map], [If], and [Iff] for mapping data to nodes and inserting them conditionally.
|
||||
//
|
||||
// There's also the [Group] type, which is a slice of [Node]-s that can be rendered as one [Node].
|
||||
//
|
||||
// For basic HTML elements and attributes, see the package html.
|
||||
//
|
||||
// For higher-level HTML components, see the package components.
|
||||
//
|
||||
// For HTTP helpers, see the package http.
|
||||
package gomponents
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Node is a DOM node that can Render itself to a [io.Writer].
|
||||
type Node interface {
|
||||
Render(w io.Writer) error
|
||||
}
|
||||
|
||||
// NodeType describes what type of [Node] it is, currently either an [ElementType] or an [AttributeType].
|
||||
// This decides where a [Node] should be rendered.
|
||||
// Nodes default to being [ElementType].
|
||||
type NodeType int
|
||||
|
||||
const (
|
||||
ElementType = NodeType(iota)
|
||||
AttributeType
|
||||
)
|
||||
|
||||
// nodeTypeDescriber can be implemented by Nodes to let callers know whether the [Node] is
|
||||
// an [ElementType] or an [AttributeType].
|
||||
// See [NodeType].
|
||||
type nodeTypeDescriber interface {
|
||||
Type() NodeType
|
||||
}
|
||||
|
||||
// NodeFunc is a render function that is also a [Node] of [ElementType].
|
||||
type NodeFunc func(io.Writer) error
|
||||
|
||||
// Render satisfies [Node].
|
||||
func (n NodeFunc) Render(w io.Writer) error {
|
||||
return n(w)
|
||||
}
|
||||
|
||||
// Type satisfies nodeTypeDescriber.
|
||||
func (n NodeFunc) Type() NodeType {
|
||||
return ElementType
|
||||
}
|
||||
|
||||
// String satisfies [fmt.Stringer].
|
||||
func (n NodeFunc) String() string {
|
||||
var b strings.Builder
|
||||
_ = n.Render(&b)
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// El creates an element DOM [Node] with a name and child Nodes.
|
||||
// See https://dev.w3.org/html5/spec-LC/syntax.html#elements-0 for how elements are rendered.
|
||||
// No tags are ever omitted from normal tags, even though it's allowed for elements given at
|
||||
// https://dev.w3.org/html5/spec-LC/syntax.html#optional-tags
|
||||
// If an element is a void element, non-attribute children nodes are ignored.
|
||||
// Use this if no convenience creator exists in the html package.
|
||||
func El(name string, children ...Node) Node {
|
||||
return NodeFunc(func(w io.Writer) error {
|
||||
return render(w, &name, children...)
|
||||
})
|
||||
}
|
||||
|
||||
func render(w2 io.Writer, name *string, children ...Node) error {
|
||||
w := &statefulWriter{w: w2}
|
||||
|
||||
if name != nil {
|
||||
w.Write([]byte("<" + *name))
|
||||
|
||||
for _, c := range children {
|
||||
renderChild(w, c, AttributeType)
|
||||
}
|
||||
|
||||
w.Write([]byte(">"))
|
||||
|
||||
if isVoidElement(*name) {
|
||||
return w.err
|
||||
}
|
||||
}
|
||||
|
||||
for _, c := range children {
|
||||
renderChild(w, c, ElementType)
|
||||
}
|
||||
|
||||
if name != nil {
|
||||
w.Write([]byte("</" + *name + ">"))
|
||||
}
|
||||
|
||||
return w.err
|
||||
}
|
||||
|
||||
// renderChild c to the given writer w if the node type is t.
|
||||
func renderChild(w *statefulWriter, c Node, t NodeType) {
|
||||
if w.err != nil || c == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Rendering groups like this is still important even though a group can render itself,
|
||||
// since otherwise attributes will sometimes be ignored.
|
||||
if g, ok := c.(Group); ok {
|
||||
for _, groupC := range g {
|
||||
renderChild(w, groupC, t)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
switch t {
|
||||
case ElementType:
|
||||
if p, ok := c.(nodeTypeDescriber); !ok || p.Type() == ElementType {
|
||||
w.err = c.Render(w.w)
|
||||
}
|
||||
case AttributeType:
|
||||
if p, ok := c.(nodeTypeDescriber); ok && p.Type() == AttributeType {
|
||||
w.err = c.Render(w.w)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// statefulWriter only writes if no errors have occurred earlier in its lifetime.
|
||||
type statefulWriter struct {
|
||||
w io.Writer
|
||||
err error
|
||||
}
|
||||
|
||||
func (w *statefulWriter) Write(p []byte) {
|
||||
if w.err != nil {
|
||||
return
|
||||
}
|
||||
_, w.err = w.w.Write(p)
|
||||
}
|
||||
|
||||
// voidElements don't have end tags and must be treated differently in the rendering.
|
||||
// See https://dev.w3.org/html5/spec-LC/syntax.html#void-elements
|
||||
var voidElements = map[string]struct{}{
|
||||
"area": {},
|
||||
"base": {},
|
||||
"br": {},
|
||||
"col": {},
|
||||
"command": {},
|
||||
"embed": {},
|
||||
"hr": {},
|
||||
"img": {},
|
||||
"input": {},
|
||||
"keygen": {},
|
||||
"link": {},
|
||||
"meta": {},
|
||||
"param": {},
|
||||
"source": {},
|
||||
"track": {},
|
||||
"wbr": {},
|
||||
}
|
||||
|
||||
func isVoidElement(name string) bool {
|
||||
_, ok := voidElements[name]
|
||||
return ok
|
||||
}
|
||||
|
||||
// Attr creates an attribute DOM [Node] with a name and optional value.
|
||||
// If only a name is passed, it's a name-only (boolean) attribute (like "required").
|
||||
// If a name and value are passed, it's a name-value attribute (like `class="header"`).
|
||||
// More than one value make [Attr] panic.
|
||||
// Use this if no convenience creator exists in the html package.
|
||||
func Attr(name string, value ...string) Node {
|
||||
switch len(value) {
|
||||
case 0:
|
||||
return &attr{name: name}
|
||||
case 1:
|
||||
return &attr{name: name, value: &value[0]}
|
||||
default:
|
||||
panic("attribute must be just name or name and value pair")
|
||||
}
|
||||
}
|
||||
|
||||
type attr struct {
|
||||
name string
|
||||
value *string
|
||||
}
|
||||
|
||||
// Render satisfies [Node].
|
||||
func (a *attr) Render(w io.Writer) error {
|
||||
if a.value == nil {
|
||||
_, err := w.Write([]byte(" " + a.name))
|
||||
return err
|
||||
}
|
||||
_, err := w.Write([]byte(" " + a.name + `="` + template.HTMLEscapeString(*a.value) + `"`))
|
||||
return err
|
||||
}
|
||||
|
||||
// Type satisfies [nodeTypeDescriber].
|
||||
func (a *attr) Type() NodeType {
|
||||
return AttributeType
|
||||
}
|
||||
|
||||
// String satisfies [fmt.Stringer].
|
||||
func (a *attr) String() string {
|
||||
var b strings.Builder
|
||||
_ = a.Render(&b)
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// Text creates a text DOM [Node] that Renders the escaped string t.
|
||||
func Text(t string) Node {
|
||||
return NodeFunc(func(w io.Writer) error {
|
||||
_, err := w.Write([]byte(template.HTMLEscapeString(t)))
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
// Textf creates a text DOM [Node] that Renders the interpolated and escaped string format.
|
||||
func Textf(format string, a ...interface{}) Node {
|
||||
return NodeFunc(func(w io.Writer) error {
|
||||
_, err := w.Write([]byte(template.HTMLEscapeString(fmt.Sprintf(format, a...))))
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
// Raw creates a text DOM [Node] that just Renders the unescaped string t.
|
||||
func Raw(t string) Node {
|
||||
return NodeFunc(func(w io.Writer) error {
|
||||
_, err := w.Write([]byte(t))
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
// Rawf creates a text DOM [Node] that just Renders the interpolated and unescaped string format.
|
||||
func Rawf(format string, a ...interface{}) Node {
|
||||
return NodeFunc(func(w io.Writer) error {
|
||||
_, err := w.Write([]byte(fmt.Sprintf(format, a...)))
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
// 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
|
||||
for _, t := range ts {
|
||||
nodes = append(nodes, cb(t))
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// Group a slice of [Node]-s into one Node, while still being usable like a regular slice of [Node]-s.
|
||||
// A [Group] can render directly, but if any of the direct children are [AttributeType], they will be ignored,
|
||||
// to not produce invalid HTML.
|
||||
type Group []Node
|
||||
|
||||
// String satisfies [fmt.Stringer].
|
||||
func (g Group) String() string {
|
||||
var b strings.Builder
|
||||
_ = g.Render(&b)
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// Render satisfies [Node].
|
||||
func (g Group) Render(w io.Writer) error {
|
||||
return render(w, nil, g...)
|
||||
}
|
||||
|
||||
// If condition is true, return the given [Node]. Otherwise, return nil.
|
||||
// This helper function is good for inlining elements conditionally.
|
||||
// If it's important that the given [Node] is only evaluated if condition is true
|
||||
// (for example, when using nilable variables), use [Iff] instead.
|
||||
func If(condition bool, n Node) Node {
|
||||
if condition {
|
||||
return n
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Iff condition is true, call the given function. Otherwise, return nil.
|
||||
// This helper function is good for inlining elements conditionally when the node depends on nilable data,
|
||||
// or some other code that could potentially panic.
|
||||
// If you just need simple conditional rendering, see [If].
|
||||
func Iff(condition bool, f func() Node) Node {
|
||||
if condition {
|
||||
return f()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
292
vendor/maragu.dev/gomponents/html/attributes.go
vendored
Normal file
292
vendor/maragu.dev/gomponents/html/attributes.go
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
package html
|
||||
|
||||
import (
|
||||
g "maragu.dev/gomponents"
|
||||
)
|
||||
|
||||
func Async() g.Node {
|
||||
return g.Attr("async")
|
||||
}
|
||||
|
||||
func AutoFocus() g.Node {
|
||||
return g.Attr("autofocus")
|
||||
}
|
||||
|
||||
func AutoPlay() g.Node {
|
||||
return g.Attr("autoplay")
|
||||
}
|
||||
|
||||
func Checked() g.Node {
|
||||
return g.Attr("checked")
|
||||
}
|
||||
|
||||
func Controls() g.Node {
|
||||
return g.Attr("controls")
|
||||
}
|
||||
|
||||
func CrossOrigin(v string) g.Node {
|
||||
return g.Attr("crossorigin", v)
|
||||
}
|
||||
|
||||
func DateTime(v string) g.Node {
|
||||
return g.Attr("datetime", v)
|
||||
}
|
||||
|
||||
func Defer() g.Node {
|
||||
return g.Attr("defer")
|
||||
}
|
||||
|
||||
func Disabled() g.Node {
|
||||
return g.Attr("disabled")
|
||||
}
|
||||
|
||||
func Draggable(v string) g.Node {
|
||||
return g.Attr("draggable", v)
|
||||
}
|
||||
|
||||
func Loop() g.Node {
|
||||
return g.Attr("loop")
|
||||
}
|
||||
|
||||
func Multiple() g.Node {
|
||||
return g.Attr("multiple")
|
||||
}
|
||||
|
||||
func Muted() g.Node {
|
||||
return g.Attr("muted")
|
||||
}
|
||||
|
||||
func PlaysInline() g.Node {
|
||||
return g.Attr("playsinline")
|
||||
}
|
||||
|
||||
func ReadOnly() g.Node {
|
||||
return g.Attr("readonly")
|
||||
}
|
||||
|
||||
func Required() g.Node {
|
||||
return g.Attr("required")
|
||||
}
|
||||
|
||||
func Selected() g.Node {
|
||||
return g.Attr("selected")
|
||||
}
|
||||
|
||||
func Accept(v string) g.Node {
|
||||
return g.Attr("accept", v)
|
||||
}
|
||||
|
||||
func Action(v string) g.Node {
|
||||
return g.Attr("action", v)
|
||||
}
|
||||
|
||||
func Alt(v string) g.Node {
|
||||
return g.Attr("alt", v)
|
||||
}
|
||||
|
||||
// Aria attributes automatically have their name prefixed with "aria-".
|
||||
func Aria(name, v string) g.Node {
|
||||
return g.Attr("aria-"+name, v)
|
||||
}
|
||||
|
||||
func As(v string) g.Node {
|
||||
return g.Attr("as", v)
|
||||
}
|
||||
|
||||
func AutoComplete(v string) g.Node {
|
||||
return g.Attr("autocomplete", v)
|
||||
}
|
||||
|
||||
func Charset(v string) g.Node {
|
||||
return g.Attr("charset", v)
|
||||
}
|
||||
|
||||
func CiteAttr(v string) g.Node {
|
||||
return g.Attr("cite", v)
|
||||
}
|
||||
|
||||
func Class(v string) g.Node {
|
||||
return g.Attr("class", v)
|
||||
}
|
||||
|
||||
func Cols(v string) g.Node {
|
||||
return g.Attr("cols", v)
|
||||
}
|
||||
|
||||
func ColSpan(v string) g.Node {
|
||||
return g.Attr("colspan", v)
|
||||
}
|
||||
|
||||
func Content(v string) g.Node {
|
||||
return g.Attr("content", v)
|
||||
}
|
||||
|
||||
// Data attributes automatically have their name prefixed with "data-".
|
||||
func Data(name, v string) g.Node {
|
||||
return g.Attr("data-"+name, v)
|
||||
}
|
||||
|
||||
// DataAttr attributes automatically have their name prefixed with "data-".
|
||||
//
|
||||
// Deprecated: Use [Data] instead.
|
||||
func DataAttr(name, v string) g.Node {
|
||||
return Data(name, v)
|
||||
}
|
||||
|
||||
func For(v string) g.Node {
|
||||
return g.Attr("for", v)
|
||||
}
|
||||
|
||||
func FormAttr(v string) g.Node {
|
||||
return g.Attr("form", v)
|
||||
}
|
||||
|
||||
func Height(v string) g.Node {
|
||||
return g.Attr("height", v)
|
||||
}
|
||||
|
||||
func Hidden(v string) g.Node {
|
||||
return g.Attr("hidden", v)
|
||||
}
|
||||
|
||||
func Href(v string) g.Node {
|
||||
return g.Attr("href", v)
|
||||
}
|
||||
|
||||
func ID(v string) g.Node {
|
||||
return g.Attr("id", v)
|
||||
}
|
||||
|
||||
func Integrity(v string) g.Node {
|
||||
return g.Attr("integrity", v)
|
||||
}
|
||||
|
||||
func LabelAttr(v string) g.Node {
|
||||
return g.Attr("label", v)
|
||||
}
|
||||
|
||||
func Lang(v string) g.Node {
|
||||
return g.Attr("lang", v)
|
||||
}
|
||||
|
||||
func List(v string) g.Node {
|
||||
return g.Attr("list", v)
|
||||
}
|
||||
|
||||
func Loading(v string) g.Node {
|
||||
return g.Attr("loading", v)
|
||||
}
|
||||
|
||||
func Max(v string) g.Node {
|
||||
return g.Attr("max", v)
|
||||
}
|
||||
|
||||
func MaxLength(v string) g.Node {
|
||||
return g.Attr("maxlength", v)
|
||||
}
|
||||
|
||||
func Method(v string) g.Node {
|
||||
return g.Attr("method", v)
|
||||
}
|
||||
|
||||
func Min(v string) g.Node {
|
||||
return g.Attr("min", v)
|
||||
}
|
||||
|
||||
func MinLength(v string) g.Node {
|
||||
return g.Attr("minlength", v)
|
||||
}
|
||||
|
||||
func Name(v string) g.Node {
|
||||
return g.Attr("name", v)
|
||||
}
|
||||
|
||||
func Pattern(v string) g.Node {
|
||||
return g.Attr("pattern", v)
|
||||
}
|
||||
|
||||
func Placeholder(v string) g.Node {
|
||||
return g.Attr("placeholder", v)
|
||||
}
|
||||
|
||||
func Poster(v string) g.Node {
|
||||
return g.Attr("poster", v)
|
||||
}
|
||||
|
||||
func Preload(v string) g.Node {
|
||||
return g.Attr("preload", v)
|
||||
}
|
||||
|
||||
func Rel(v string) g.Node {
|
||||
return g.Attr("rel", v)
|
||||
}
|
||||
|
||||
func Role(v string) g.Node {
|
||||
return g.Attr("role", v)
|
||||
}
|
||||
|
||||
func Rows(v string) g.Node {
|
||||
return g.Attr("rows", v)
|
||||
}
|
||||
|
||||
func RowSpan(v string) g.Node {
|
||||
return g.Attr("rowspan", v)
|
||||
}
|
||||
|
||||
func Src(v string) g.Node {
|
||||
return g.Attr("src", v)
|
||||
}
|
||||
|
||||
func SrcSet(v string) g.Node {
|
||||
return g.Attr("srcset", v)
|
||||
}
|
||||
|
||||
func Step(v string) g.Node {
|
||||
return g.Attr("step", v)
|
||||
}
|
||||
|
||||
func Style(v string) g.Node {
|
||||
return g.Attr("style", v)
|
||||
}
|
||||
|
||||
// Deprecated: Use [Style] instead.
|
||||
func StyleAttr(v string) g.Node {
|
||||
return Style(v)
|
||||
}
|
||||
|
||||
func TabIndex(v string) g.Node {
|
||||
return g.Attr("tabindex", v)
|
||||
}
|
||||
|
||||
func Target(v string) g.Node {
|
||||
return g.Attr("target", v)
|
||||
}
|
||||
|
||||
func Title(v string) g.Node {
|
||||
return g.Attr("title", v)
|
||||
}
|
||||
|
||||
// Deprecated: Use [Title] instead.
|
||||
func TitleAttr(v string) g.Node {
|
||||
return Title(v)
|
||||
}
|
||||
|
||||
func Type(v string) g.Node {
|
||||
return g.Attr("type", v)
|
||||
}
|
||||
|
||||
func Value(v string) g.Node {
|
||||
return g.Attr("value", v)
|
||||
}
|
||||
|
||||
func Width(v string) g.Node {
|
||||
return g.Attr("width", v)
|
||||
}
|
||||
|
||||
func EncType(v string) g.Node {
|
||||
return g.Attr("enctype", v)
|
||||
}
|
||||
|
||||
func Dir(v string) g.Node {
|
||||
return g.Attr("dir", v)
|
||||
}
|
||||
449
vendor/maragu.dev/gomponents/html/elements.go
vendored
Normal file
449
vendor/maragu.dev/gomponents/html/elements.go
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
// Package html provides common HTML elements and attributes.
|
||||
//
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element for a list of elements.
|
||||
//
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes for a list of attributes.
|
||||
package html
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
g "maragu.dev/gomponents"
|
||||
)
|
||||
|
||||
// Doctype returns a special kind of [g.Node] that prefixes its sibling with the string "<!doctype html>".
|
||||
func Doctype(sibling g.Node) g.Node {
|
||||
return g.NodeFunc(func(w io.Writer) error {
|
||||
if _, err := w.Write([]byte("<!doctype html>")); err != nil {
|
||||
return err
|
||||
}
|
||||
return sibling.Render(w)
|
||||
})
|
||||
}
|
||||
|
||||
func A(children ...g.Node) g.Node {
|
||||
return g.El("a", children...)
|
||||
}
|
||||
|
||||
func Address(children ...g.Node) g.Node {
|
||||
return g.El("address", children...)
|
||||
}
|
||||
|
||||
func Area(children ...g.Node) g.Node {
|
||||
return g.El("area", children...)
|
||||
}
|
||||
|
||||
func Article(children ...g.Node) g.Node {
|
||||
return g.El("article", children...)
|
||||
}
|
||||
|
||||
func Aside(children ...g.Node) g.Node {
|
||||
return g.El("aside", children...)
|
||||
}
|
||||
|
||||
func Audio(children ...g.Node) g.Node {
|
||||
return g.El("audio", children...)
|
||||
}
|
||||
|
||||
func Base(children ...g.Node) g.Node {
|
||||
return g.El("base", children...)
|
||||
}
|
||||
|
||||
func BlockQuote(children ...g.Node) g.Node {
|
||||
return g.El("blockquote", children...)
|
||||
}
|
||||
|
||||
func Body(children ...g.Node) g.Node {
|
||||
return g.El("body", children...)
|
||||
}
|
||||
|
||||
func Br(children ...g.Node) g.Node {
|
||||
return g.El("br", children...)
|
||||
}
|
||||
|
||||
func Button(children ...g.Node) g.Node {
|
||||
return g.El("button", children...)
|
||||
}
|
||||
|
||||
func Canvas(children ...g.Node) g.Node {
|
||||
return g.El("canvas", children...)
|
||||
}
|
||||
|
||||
func Cite(children ...g.Node) g.Node {
|
||||
return g.El("cite", children...)
|
||||
}
|
||||
|
||||
// Deprecated: Use [Cite] instead.
|
||||
func CiteEl(children ...g.Node) g.Node {
|
||||
return Cite(children...)
|
||||
}
|
||||
|
||||
func Code(children ...g.Node) g.Node {
|
||||
return g.El("code", children...)
|
||||
}
|
||||
|
||||
func Col(children ...g.Node) g.Node {
|
||||
return g.El("col", children...)
|
||||
}
|
||||
|
||||
func ColGroup(children ...g.Node) g.Node {
|
||||
return g.El("colgroup", children...)
|
||||
}
|
||||
|
||||
func DataEl(children ...g.Node) g.Node {
|
||||
return g.El("data", children...)
|
||||
}
|
||||
|
||||
func DataList(children ...g.Node) g.Node {
|
||||
return g.El("datalist", children...)
|
||||
}
|
||||
|
||||
func Details(children ...g.Node) g.Node {
|
||||
return g.El("details", children...)
|
||||
}
|
||||
|
||||
func Dialog(children ...g.Node) g.Node {
|
||||
return g.El("dialog", children...)
|
||||
}
|
||||
|
||||
func Div(children ...g.Node) g.Node {
|
||||
return g.El("div", children...)
|
||||
}
|
||||
|
||||
func Dl(children ...g.Node) g.Node {
|
||||
return g.El("dl", children...)
|
||||
}
|
||||
|
||||
func Embed(children ...g.Node) g.Node {
|
||||
return g.El("embed", children...)
|
||||
}
|
||||
|
||||
func Form(children ...g.Node) g.Node {
|
||||
return g.El("form", children...)
|
||||
}
|
||||
|
||||
// Deprecated: Use [Form] instead.
|
||||
func FormEl(children ...g.Node) g.Node {
|
||||
return Form(children...)
|
||||
}
|
||||
|
||||
func FieldSet(children ...g.Node) g.Node {
|
||||
return g.El("fieldset", children...)
|
||||
}
|
||||
|
||||
func Figure(children ...g.Node) g.Node {
|
||||
return g.El("figure", children...)
|
||||
}
|
||||
|
||||
func Footer(children ...g.Node) g.Node {
|
||||
return g.El("footer", children...)
|
||||
}
|
||||
|
||||
func Head(children ...g.Node) g.Node {
|
||||
return g.El("head", children...)
|
||||
}
|
||||
|
||||
func Header(children ...g.Node) g.Node {
|
||||
return g.El("header", children...)
|
||||
}
|
||||
|
||||
func HGroup(children ...g.Node) g.Node {
|
||||
return g.El("hgroup", children...)
|
||||
}
|
||||
|
||||
func Hr(children ...g.Node) g.Node {
|
||||
return g.El("hr", children...)
|
||||
}
|
||||
|
||||
func HTML(children ...g.Node) g.Node {
|
||||
return g.El("html", children...)
|
||||
}
|
||||
|
||||
func IFrame(children ...g.Node) g.Node {
|
||||
return g.El("iframe", children...)
|
||||
}
|
||||
|
||||
func Img(children ...g.Node) g.Node {
|
||||
return g.El("img", children...)
|
||||
}
|
||||
|
||||
func Input(children ...g.Node) g.Node {
|
||||
return g.El("input", children...)
|
||||
}
|
||||
|
||||
func Label(children ...g.Node) g.Node {
|
||||
return g.El("label", children...)
|
||||
}
|
||||
|
||||
// Deprecated: Use [Label] instead.
|
||||
func LabelEl(children ...g.Node) g.Node {
|
||||
return Label(children...)
|
||||
}
|
||||
|
||||
func Legend(children ...g.Node) g.Node {
|
||||
return g.El("legend", children...)
|
||||
}
|
||||
|
||||
func Li(children ...g.Node) g.Node {
|
||||
return g.El("li", children...)
|
||||
}
|
||||
|
||||
func Link(children ...g.Node) g.Node {
|
||||
return g.El("link", children...)
|
||||
}
|
||||
|
||||
func Main(children ...g.Node) g.Node {
|
||||
return g.El("main", children...)
|
||||
}
|
||||
|
||||
func Menu(children ...g.Node) g.Node {
|
||||
return g.El("menu", children...)
|
||||
}
|
||||
|
||||
func Meta(children ...g.Node) g.Node {
|
||||
return g.El("meta", children...)
|
||||
}
|
||||
|
||||
func Meter(children ...g.Node) g.Node {
|
||||
return g.El("meter", children...)
|
||||
}
|
||||
|
||||
func Nav(children ...g.Node) g.Node {
|
||||
return g.El("nav", children...)
|
||||
}
|
||||
|
||||
func NoScript(children ...g.Node) g.Node {
|
||||
return g.El("noscript", children...)
|
||||
}
|
||||
|
||||
func Object(children ...g.Node) g.Node {
|
||||
return g.El("object", children...)
|
||||
}
|
||||
|
||||
func Ol(children ...g.Node) g.Node {
|
||||
return g.El("ol", children...)
|
||||
}
|
||||
|
||||
func OptGroup(children ...g.Node) g.Node {
|
||||
return g.El("optgroup", children...)
|
||||
}
|
||||
|
||||
func Option(children ...g.Node) g.Node {
|
||||
return g.El("option", children...)
|
||||
}
|
||||
|
||||
func P(children ...g.Node) g.Node {
|
||||
return g.El("p", children...)
|
||||
}
|
||||
|
||||
func Param(children ...g.Node) g.Node {
|
||||
return g.El("param", children...)
|
||||
}
|
||||
|
||||
func Picture(children ...g.Node) g.Node {
|
||||
return g.El("picture", children...)
|
||||
}
|
||||
|
||||
func Pre(children ...g.Node) g.Node {
|
||||
return g.El("pre", children...)
|
||||
}
|
||||
|
||||
func Progress(children ...g.Node) g.Node {
|
||||
return g.El("progress", children...)
|
||||
}
|
||||
|
||||
func Script(children ...g.Node) g.Node {
|
||||
return g.El("script", children...)
|
||||
}
|
||||
|
||||
func Section(children ...g.Node) g.Node {
|
||||
return g.El("section", children...)
|
||||
}
|
||||
|
||||
func Select(children ...g.Node) g.Node {
|
||||
return g.El("select", children...)
|
||||
}
|
||||
|
||||
func Source(children ...g.Node) g.Node {
|
||||
return g.El("source", children...)
|
||||
}
|
||||
|
||||
func Span(children ...g.Node) g.Node {
|
||||
return g.El("span", children...)
|
||||
}
|
||||
|
||||
func StyleEl(children ...g.Node) g.Node {
|
||||
return g.El("style", children...)
|
||||
}
|
||||
|
||||
func Summary(children ...g.Node) g.Node {
|
||||
return g.El("summary", children...)
|
||||
}
|
||||
|
||||
func SVG(children ...g.Node) g.Node {
|
||||
return g.El("svg", children...)
|
||||
}
|
||||
|
||||
func Table(children ...g.Node) g.Node {
|
||||
return g.El("table", children...)
|
||||
}
|
||||
|
||||
func TBody(children ...g.Node) g.Node {
|
||||
return g.El("tbody", children...)
|
||||
}
|
||||
|
||||
func Td(children ...g.Node) g.Node {
|
||||
return g.El("td", children...)
|
||||
}
|
||||
|
||||
func Textarea(children ...g.Node) g.Node {
|
||||
return g.El("textarea", children...)
|
||||
}
|
||||
|
||||
func TFoot(children ...g.Node) g.Node {
|
||||
return g.El("tfoot", children...)
|
||||
}
|
||||
|
||||
func Th(children ...g.Node) g.Node {
|
||||
return g.El("th", children...)
|
||||
}
|
||||
|
||||
func THead(children ...g.Node) g.Node {
|
||||
return g.El("thead", children...)
|
||||
}
|
||||
|
||||
func Tr(children ...g.Node) g.Node {
|
||||
return g.El("tr", children...)
|
||||
}
|
||||
|
||||
func Ul(children ...g.Node) g.Node {
|
||||
return g.El("ul", children...)
|
||||
}
|
||||
|
||||
func Wbr(children ...g.Node) g.Node {
|
||||
return g.El("wbr", children...)
|
||||
}
|
||||
|
||||
func Abbr(children ...g.Node) g.Node {
|
||||
return g.El("abbr", g.Group(children))
|
||||
}
|
||||
|
||||
func B(children ...g.Node) g.Node {
|
||||
return g.El("b", g.Group(children))
|
||||
}
|
||||
|
||||
func Caption(children ...g.Node) g.Node {
|
||||
return g.El("caption", g.Group(children))
|
||||
}
|
||||
|
||||
func Dd(children ...g.Node) g.Node {
|
||||
return g.El("dd", g.Group(children))
|
||||
}
|
||||
|
||||
func Del(children ...g.Node) g.Node {
|
||||
return g.El("del", g.Group(children))
|
||||
}
|
||||
|
||||
func Dfn(children ...g.Node) g.Node {
|
||||
return g.El("dfn", g.Group(children))
|
||||
}
|
||||
|
||||
func Dt(children ...g.Node) g.Node {
|
||||
return g.El("dt", g.Group(children))
|
||||
}
|
||||
|
||||
func Em(children ...g.Node) g.Node {
|
||||
return g.El("em", g.Group(children))
|
||||
}
|
||||
|
||||
func FigCaption(children ...g.Node) g.Node {
|
||||
return g.El("figcaption", g.Group(children))
|
||||
}
|
||||
|
||||
func H1(children ...g.Node) g.Node {
|
||||
return g.El("h1", g.Group(children))
|
||||
}
|
||||
|
||||
func H2(children ...g.Node) g.Node {
|
||||
return g.El("h2", g.Group(children))
|
||||
}
|
||||
|
||||
func H3(children ...g.Node) g.Node {
|
||||
return g.El("h3", g.Group(children))
|
||||
}
|
||||
|
||||
func H4(children ...g.Node) g.Node {
|
||||
return g.El("h4", g.Group(children))
|
||||
}
|
||||
|
||||
func H5(children ...g.Node) g.Node {
|
||||
return g.El("h5", g.Group(children))
|
||||
}
|
||||
|
||||
func H6(children ...g.Node) g.Node {
|
||||
return g.El("h6", g.Group(children))
|
||||
}
|
||||
|
||||
func I(children ...g.Node) g.Node {
|
||||
return g.El("i", g.Group(children))
|
||||
}
|
||||
|
||||
func Ins(children ...g.Node) g.Node {
|
||||
return g.El("ins", g.Group(children))
|
||||
}
|
||||
|
||||
func Kbd(children ...g.Node) g.Node {
|
||||
return g.El("kbd", g.Group(children))
|
||||
}
|
||||
|
||||
func Mark(children ...g.Node) g.Node {
|
||||
return g.El("mark", g.Group(children))
|
||||
}
|
||||
|
||||
func Q(children ...g.Node) g.Node {
|
||||
return g.El("q", g.Group(children))
|
||||
}
|
||||
|
||||
func S(children ...g.Node) g.Node {
|
||||
return g.El("s", g.Group(children))
|
||||
}
|
||||
|
||||
func Samp(children ...g.Node) g.Node {
|
||||
return g.El("samp", g.Group(children))
|
||||
}
|
||||
|
||||
func Small(children ...g.Node) g.Node {
|
||||
return g.El("small", g.Group(children))
|
||||
}
|
||||
|
||||
func Strong(children ...g.Node) g.Node {
|
||||
return g.El("strong", g.Group(children))
|
||||
}
|
||||
|
||||
func Sub(children ...g.Node) g.Node {
|
||||
return g.El("sub", g.Group(children))
|
||||
}
|
||||
|
||||
func Sup(children ...g.Node) g.Node {
|
||||
return g.El("sup", g.Group(children))
|
||||
}
|
||||
|
||||
func Time(children ...g.Node) g.Node {
|
||||
return g.El("time", g.Group(children))
|
||||
}
|
||||
|
||||
func TitleEl(children ...g.Node) g.Node {
|
||||
return g.El("title", g.Group(children))
|
||||
}
|
||||
|
||||
func U(children ...g.Node) g.Node {
|
||||
return g.El("u", g.Group(children))
|
||||
}
|
||||
|
||||
func Var(children ...g.Node) g.Node {
|
||||
return g.El("var", g.Group(children))
|
||||
}
|
||||
|
||||
func Video(children ...g.Node) g.Node {
|
||||
return g.El("video", g.Group(children))
|
||||
}
|
||||
BIN
vendor/maragu.dev/gomponents/logo.png
vendored
Normal file
BIN
vendor/maragu.dev/gomponents/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 238 KiB |
Reference in New Issue
Block a user