about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeLines
* Set slice capacity based on input in `Map` and `Classes.Render` (#243)Gabe Cook2025-03-03-2/+2
| | | | | | | | | Hey! I just discovered this repo and I love being able to write templates while still having compile-time checks. I was looking through the code and noticed slices aren't currently preallocated in `Map()` and `Classes.Render()`. Preallocating will improve performance since the resulting slice won't have to be grown dynamically during the append loop.
* Add 'download' and 'referrerpolicy' attributes for anchor <a> element (#242)Stéphane Legrand2025-02-06-0/+10
| | | | | | | | | Hello, A patch to add [`download`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download) and [`referrerpolicy`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy) for the anchor `<a>` element.
* Add formxxx attributes (for <input type="submit"> element) (#241)Stéphane Legrand2025-02-03-0/+25
| | | | | | | | | | | | | | Hello, A small patch to add the following attributes: - formaction - formenctype - formmethod - formnovalidate - formtarget These attributes are useful in `<input type="submit">` element: [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/submit#additional_attributes)
* Add support for additional HTML attributes in HTML5 template (#238)Winni Neessen2024-11-06-1/+15
| | | | | This PR updates the HTML5 function to accept and render additional HTML attributes. An additional test case to validate this enhancement has been added as well.
* Upgrade codecov Github action in CI workflow (#231)Markus Wüstenberg2024-10-30-3/+4
|
* Add popover attributes (#236)Ken Powers2024-10-30-0/+45
| | | | | | | | This PR adds popover attributes as detailed here: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using --------- Co-authored-by: Markus Wüstenberg <markus@maragu.dk>
* Add web component elements and slot attribute (#235)Ken Powers2024-10-25-0/+15
| | | | The slot attribute is a standard attribute for use with web components: https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots
* Add gomponents-starter-kit link to readmeMarkus Wüstenberg2024-10-15-0/+1
|
* Release v1 (#226)Markus Wüstenberg2024-10-11-11/+10
| | | | | | v1.0.0-beta1 gave no problems with my other gomponents libraries, that of others, and some of my large projects, so releasing v1! No more breaking changes! 😁
* Add test for dot imports (#225)Markus Wüstenberg2024-10-11-2/+21
| | | So we can be sure all dot imports work at the same time.
* Add missing 'hidden' attribute (#224)Guy-Laurent Subri2024-10-10-0/+6
|
* Upgrade CI workflow (#223)Markus Wüstenberg2024-10-09-5/+11
| | | Mainly the linter action is easier to use.
* Add version to go get command in readmeMarkus Wüstenberg2024-10-09-2/+2
| | | | Until we're out of beta.
* Fix attr panic test (#222)Markus Wüstenberg2024-10-09-6/+2
| | | It didn't actually work the way it was written.
* Remove mention of SVG package in doc commentsMarkus Wüstenberg2024-10-03-2/+3
|
* Fix example app to use maragu.dev/gomponents module path (#216)Markus Wüstenberg2024-10-03-16/+16
|
* Move module to maragu.dev/gomponents namespace (#215)Markus Wüstenberg2024-10-03-28/+30
| | | | | | | | | | This is a breaking change to move gomponents to my own import namespace. I will obviously be careful with this, test it out in all kinds of scenarios, release betas, etc. But otherwise, because the `Node` interface is so simple and has basically never changed, I don't think this will break much. 🤞 Fixes #200
* Remove SVG package (#214)Markus Wüstenberg2024-10-03-106/+0
| | | | | | | | | | | Because the added value of having this was very small, and I don't want to confuse people about what's properly supported, I've removed the SVG package. As #196 showed, there can easily be conflicts between HTML and SVG, and the rendering isn't really set up for anything else than HTML. It's still easy to create SVG elements: `html.SVG` exists in this repo, and the rest is often just a string that can be included using `g.Raw`. Fixes #206
* Fix `mailto:` in FUNDING.yml not workingMarkus Wüstenberg2024-10-03-1/+1
|
* Add invoicing contact option to readmeMarkus Wüstenberg2024-10-03-3/+5
|
* Add ExampleMap_indexMarkus Wüstenberg2024-09-26-0/+12
| | | | For getting the slice index using a counter outside the closure.
* Fix links in package documentationMarkus Wüstenberg2024-09-24-3/+3
| | | | Apparently, [Node]s doesn't link in Godoc, while [Node]-s does.
* Use go workspace in example app (#211)Markus Wüstenberg2024-09-24-2/+8
|
* Fix doc comments regarding `Group`Markus Wüstenberg2024-09-24-2/+3
|
* Make `Group` a type (#202)Markus Wüstenberg2024-09-24-30/+37
| | | | | | | | | | | | This changes `Group` to be a type instead of a function, which means it can support both grouping `[]Node` as well as doing variadic-ish slice things like `Group{n1, n2}`. This also means that `Map` can just return a `Group`. Special thanks to @deitrix for this simple and elegant solution that, for some reason or another, has had me perplexed for a long time. Fixes #201.
* Revert "Add Github Pages website deployment workflow (#207)"Markus Wüstenberg2024-09-23-45/+0
| | | | This reverts commit a4327a0fb6bd02a3d8fb7677ba118b3b5dd1b3e8.
* Add Github Pages website deployment workflow (#207)Markus Wüstenberg2024-09-20-0/+45
|
* Remove redundant sentence from readmeMarkus Wüstenberg2024-09-19-2/+0
|
* Reword readme slightlyMarkus Wüstenberg2024-09-19-7/+13
|
* Add full example app (#204)Markus Wüstenberg2024-09-19-280/+177
| | | Also, remove the other examples and simplify the readme.
* Drop support for Go 1.16 and Go 1.17 (#203)Markus Wüstenberg2024-09-19-107/+31
| | | Fixes #184
* Make Groups renderable (#181)Markus Wüstenberg2024-09-19-38/+56
| | | | | | | | | | | | | | This change makes the result of `Group` renderable directly, instead of panicking, with the important caveat that root-level attributes are _ignored_. I don't think this will give problems in practice, as the main use case for rendering `Group` is basically to return root-level elements to the client using something like HTMX. I tried adding a `Fragment`, but it was weird and confusing having two functions (`Group` and `Fragment`) do essentially the same thing, the only difference being whether the argument was a slice of `Node`s or varargs. Fixes #162
* Reduce code duplication by reusing the correct function in deprecated ↵Yarden Shoham2024-08-20-5/+5
| | | | functions (#194)
* Fix `cite` name clash example in readmeMarkus Wüstenberg2024-08-19-1/+1
|
* Add `cite` attribute (#192)Yarden Shoham2024-08-19-1/+13
| | | | | | | It can appear in a `<blockquote>`. - Closes https://github.com/maragudk/gomponents/issues/189 Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Test on Go 1.23 in CI (#193)Yarden Shoham2024-08-18-0/+1
|
* Add draggable attribute (#185)Leonardo Silveira2024-07-08-0/+5
|
* Add links to godoc (#183)Markus Wüstenberg2024-06-26-39/+54
| | | | | Also add an example for `http.Adapt`. Fixes #182
* Add LabelEl (#180)Markus Wüstenberg2024-06-25-1/+8
| | | | | | For consistency with the other name clashes. Also, adjust the readme. I know it's a bit weird to add a pre-deprecated function, but know it's the same as the other functions.
* Adjust documentation on Iff (#179)Markus Wüstenberg2024-06-25-9/+17
|
* Add datetime attribute (#177)Julien Tant2024-06-21-0/+5
| | | | | `<time>`, `<del>` and `<ins>` can receive a [`datetime`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime) attribute
* Add an `Iff` helper (#172)Julien Tant2024-06-19-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I ran into some situation where I want to conditionally render a node if some variable is not nil and obviously I got a panic ```go // package viewmodels type SomePage struct { s *string } // package views func SomePage (vm viewmodels.SomePage) g,Node { return Div( If(vm.s == nil, Text("s is nil"), If(vm.s !- nil, Text("s is " + vm.s), // this will panic when `s` is nil ) } ``` In this situation, go will interpret the code of the second `if` regardless of the condition because the code itself is not in a condition. This PR introduces a new `Iff` helper that accepts a callback. The callback content is only interpreted when it's called, making the code safe: ```go // package viewmodels type SomePage struct { s *string } // package views func SomePage (vm viewmodels.SomePage) g,Node { return Div( Iff(vm.s == nil, func () g.Node { return Text("s is nil") }, Iff(vm.s !- nil, func () g.Node { return Text("s is " + vm.s) }, ) } ``` I'm aware of the `Lazy` effort on the side, but I guess this is no a breaking change and can still exist in addition to the `Lazy` effort. Co-authored-by: Markus Wüstenberg <markus@maragu.dk>
* Add dir (#176)Amr Ojjeh2024-06-19-0/+5
| | | | | | | `dir` is a global attribute that lets you specify whether text is RTL or LTR or if it should be determined by the browser. Documentation: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
* Add LabelAttr and List attributes (#175)Markus Wüstenberg2024-06-06-0/+10
| | | Fixes #168 and fixes #169.
* Deprecate DataAttr, StyleAttr, TitleAttr, FormEl (#174)Markus Wüstenberg2024-06-06-188/+229
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change addresses #170 by deprecating some HTML helpers in favor of using one of the styles as a main one, selected based on what I think is the main use case. - For `Data`, it's the attribute. I don't see much use of the `<data>` element in the wild. - For `Style`, it's the attribute. The `style` attribute is everywhere, the `<style>` element is perhaps less so (but not much). This was the hardest one to decide. - For `Title`, it's the attribute. The `<title>` element only shows up once per document. - For `Form`, it's the element. I haven't seen much use of the `form` attribute in the wild. I know this is arguably not a "consistent" approach, but I think it makes for a much nicer API, simply because the most-used option will not be a suffixed version.
| * Fix readmeMarkus Wüstenberg2024-06-06-5/+6
| |
| * Deprecate DataAttr, StyleAttr, TitleAttr, FormElMarkus Wüstenberg2024-06-06-183/+223
|/ | | | | | | | | | | | This change addresses #170 by deprecating some HTML helpers in favor of using one of the styles as a main one, selected based on what I think is the main use case. - For `Data`, it's the attribute. I don't see much use of the `<data>` element in the wild. - For `Style`, it's the attribute. The `style` attribute is everywhere, the `<style>` element is perhaps less so (but not much). This was the hardest one to decide. - For `Title`, it's the attribute. The `<title>` element only shows up once per document. - For `Form`, it's the element. I haven't seen much use of the `data` attribute in the wild. I know this is arguably not a "consistent" approach, but I think it makes for a much nicer API, simply because the most-used option will not be a suffixed version.
* Add script's `integrity` and `crossorigin` attributes (#173)Markus Wüstenberg2024-06-06-0/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using `<script>` to pull a library from a CDN, it's usually a good idea to attach an integrity check so that if they get hacked and someone changes all the script, malicious scripts don't get executed on your website. To achieve this, you need to attach `integrity` and `crossorigin` to your `<script/>` tag ```go Script( Scr("https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"), Integrity("sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"), CrossOrigin("anonymous"), ) ``` Turns into ```html <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script> ``` Hint for whoever likes unpkg.com, adding `?meta` at the end of any script you import form them will give you the current `integrity` for the file. Example: https://unpkg.com/three@0.165.0/build/three.cjs?meta
| * add script's integrity and crossorigin attributesJulien Tant2024-06-05-0/+10
|/
* Revert "Add Marquee element promotion to readme"Markus Wüstenberg2024-04-29-2/+0
| | | | This reverts commit b33f84310916b238af0006fb151a4b980721bc33.