Skip to content

Releases: chasefleming/elem-go

Version 0.10.0

03 Nov 03:05
Compare
Choose a tag to compare

✨ New Elements Added

With this update, developers can now easily implement a wider range of elements that cover form, interactive, and script-supporting functionalities, enhancing the interactivity and compliance of web applications with HTML standards.

Form-Related Elements

Enhance your web forms with the following newly supported elements:

  • Fieldset(): Create a <fieldset> element to group related items within a form.
  • Legend(): Use the <legend> element to caption your <fieldset> groups.
  • Datalist(): Implement a <datalist> element providing autocomplete suggestions to users.
  • Meter(): Display a <meter> for representing scalar measurements like disk usage.
  • Output(): Incorporate an <output> element to showcase the results of a calculation.
  • Progress(): Utilize a <progress> bar to indicate the completion status of a task.

Interactive Elements

Introducing functions for interactive elements that improve user engagement:

  • Dialog(): Deploy modal <dialog> elements for interactive pop-ups.
  • Menu(): Construct a <menu> element for custom-built, interactive menu controls.

Script-Supporting Element

For enhanced scripting capabilities:

  • NoScript(): Define alternative content with <noscript> for users without script support in their browsers.

Version 0.9.0

02 Nov 00:23
Compare
Choose a tag to compare

🚀 Enhanced Boolean Attribute Handling

Boolean attributes like checked and selected can now be assigned values of "true" or "false". Setting them to true will correctly render these attributes without needing an explicit value. For instance:

// Using boolean attributes
checkbox := elem.Input(elem.Attrs{
    attrs.Type:    "checkbox",
    attrs.Checked: "true",  // This will render as <input type="checkbox" checked>
})

✨ Added Attributes and Style Property Constants For Type-Safety

In the styles subpackage you'll now find constants for the following:

  • font-variant
  • font-stretch
  • word-wrap
  • font-style
  • text-shadow
  • vertical-align
  • word-spacing
  • word-break
  • text-indent
  • background-position
  • background-attachment
  • background-blend-mode
  • backface-visibility
  • perspective
  • transform-origin
  • outline
  • outline-style
  • outline-color
  • outline-width
  • outline-offset

In the attrs subpackage you'll now find constants for the following:

  • colspan
  • rowspan
  • headers
  • scope
  • is-map
  • novalidate
  • selected

🙏 Thanks to Contributors

Version 0.8.0

27 Oct 16:51
Compare
Choose a tag to compare

✨ New Elements Added

Idiomatic Text Element Support

Introduced support for the <i> element. Traditionally, this element is used to represent idiomatic text set off from the normal prose, such as technical terms, foreign language phrases, or thoughts. It's also commonly used for embedding icons, especially with font libraries.

Example for idiomatic text: <i>Example idiomatic phrase</i>.

Table Elements

Introduced a variety of table-related elements to better facilitate the display of tables. The new elements include:

  • <table>: For tabular data.
  • <thead>, <tbody>, and <tfoot>: For grouping header, body, and footer content in a table respectively.
  • <tr>: For table rows.
  • <th> and <td>: To denote header and data cells.

🏎️ Improvements

Performance Enhancement for Style Type

Optimized the String method in the Style type. Instead of using string concatenation, which could lead to multiple memory allocations for styles with numerous properties, we've switched to strings.Builder for enhanced performance.

🙏 Thanks to Contributors

A special shoutout to the contributors who added to this release:

Version 0.7.0

25 Oct 00:23
a8868cb
Compare
Choose a tag to compare

✨ New Elements Added

Added Link Element Support

We've introduced support for the <link> HTML element, making it easier for developers to add stylesheet links and other link-based meta information to their HTML head.

Expanded List Elements Support

We've added functions to easily create <dl>, <dt>, <dd>, and <ol> HTML elements. This will help developers structure their lists and definitions in a more semantic and accessible manner.

Introduced Semantic Sectioning Elements

We've added support for the <article>, <aside>, <footer>, <header>, <main>, <nav>, and section HTML elements. These elements will allow developers to structure their content semantically, improving accessibility and search engine optimization.

🙏 Thanks to Contributors

A special shoutout to the contributors who added to this release:

Version 0.6.0

24 Oct 15:50
d47eef6
Compare
Choose a tag to compare

🚀 New Features

HTMX Attributes

Additional htmx attributes have been incorporated to further improve the versatility of the package. This ensures users can fully harness the power of htmx when developing their applications.

Style Properties

The attrs package has been augmented with an expanded set of style properties. This broadens the scope of design possibilities for the users.

⚠️ Breaking Changes

Show Is Now If

The utility function Show has been deprecated and replaced with a more versatile and clearer generic function, If. This change was introduced to provide better semantics and more flexibility. Users who have implemented Show in their code should replace its usage with If.

🙏 Thanks to Contributors

A special shoutout to the contributors who added to this release:

Version 0.5.0

22 Oct 15:06
Compare
Choose a tag to compare

✨ Enhancements

Improved Type Safety

Replaced the interface{} type for element children with a more specific Node type. The introduction of the Node type aims to reduce ambiguity in the code and ensure type safety, leading to fewer runtime errors. We recommend developers to review their code for direct usages of *Element and refactor them to utilize the Node type.

⚠️ Breaking Changes

*Element Returns Change to Node

Functions that previously returned *Element should now return Node. If you were using such functions, please update your implementations to handle the new return type.

Affected Function Example:

func renderItems(items []Item) []*elem.Element {
    // rest of code...
}

Becomes:

func renderItems(items []Item) []elem.Node {
    // rest of code code...
}

Text() Required for Strings

For elements like option, textarea, and others that previously accepted strings directly, you now need to use the Text() function.

Previously Allowed Usage:

Textarea(Attrs{attrs.Name: "comment", attrs.Rows: "5"}, "Leave a comment...")

Becomes:

Textarea(Attrs{attrs.Name: "comment", attrs.Rows: "5"}, Text("Leave a comment..."))

Version 0.4.0

13 Oct 16:02
a3c2f33
Compare
Choose a tag to compare

🏎️ Improvements

In this release, we've made significant optimizations to the rendering process of HTML elements. These changes offer faster and more efficient HTML generation, especially for larger documents.

  • Optimized String Operations: Transitioned to a more efficient method of string handling, reducing the overhead associated with generating HTML strings.
  • Streamlined Rendering Process: Introduced enhancements that allow for a more direct and efficient rendering flow, minimizing unnecessary operations.
  • Refined Recursion Mechanics: Made changes to the way nested elements are rendered, further improving performance and memory usage.

Impact

Users can expect:

  • Faster rendering times for their HTML documents.
  • Reduced memory usage during the rendering process.
  • High-quality and consistent HTML generation.

Version 0.3.0

08 Oct 20:40
e530f38
Compare
Choose a tag to compare

New Features

✨ Form Elements Support

We've introduced first-class support for HTML form elements, enhancing the capability to create forms programmatically with type safety in Go. Here are the latest additions:

  • Form: Generate <form> elements.
  • Input: Create <input> fields, from text to radio buttons, and more.
  • Label: Attach <label> elements to form fields for accessibility.
  • Select: Construct dropdown <select> menus.
  • Textarea: Define multiline <textarea> fields.
  • Option: Populate dropdowns with <option> values.

These new utilities simplify the process of generating HTML in Go. Now, creating anything from a simple contact form to an intricate multi-step wizard is even more straightforward!

Version 0.2.0

07 Oct 15:40
31b37bb
Compare
Choose a tag to compare

✨ New Additions

We've added new HTML elements to make your Go-based HTML generation even more powerful.

  • Blockquote (Blockquote): Create a <blockquote> element for indicating long quotations in your content.
  • Br (Br): Easily add line breaks with the <br> element.
  • Code (Code): Perfect for inline code snippets, this function generates the <code> element.
  • Em (Em): Add emphasis to your text with the <em> element.
  • Hr (Hr): Create thematic breaks in your content using the <hr> element.
  • Pre (Pre): Preserve both spaces and line breaks with the <pre> element, ideal for displaying code blocks.
  • Strong (Strong): Make your text bold and give it strong importance using the <strong> element.

Version 0.1.0

06 Oct 19:32
Compare
Choose a tag to compare

🚀 Introducing elem-go: A fresh library for creating HTML components programmatically in Go!

Highlights:

  • 🛠 Type-Safe HTML Generation: Leverage the strong typing features of Go. With elem-go, enjoy type safety in defining and manipulating HTML elements, minimizing potential runtime errors and ensuring a smoother development experience.
  • 📦 Common HTML Elements & Attributes: Simplify your codebase! elem-go encapsulates the complexity behind defining HTML attributes and elements, making your code more readable and maintainable.
  • 💡 Integrated htmx Helpers: Craft dynamic web elements effortlessly with the built-in htmx helpers. No need for verbose attribute strings anymore.
  • 📖 Examples to Kickstart: Dive into the examples directory for hands-on usage of elem-go. Start with the htmx-counter demonstration!

New Features:

  • HTML Elements: Comprehensive support for a wide array of HTML elements—from basic divisions (Div) to headers (H1, H2, …) and interactive components.
  • Attributes & Styling: Use the attrs and styles subpackages to define element attributes and styles in a type-safe manner confidently.
  • htmx Integration: The new htmx subpackage provides constants and utility functions tailored for htmx specific attributes.
  • Conditional Rendering: Introducing the utility function Show for conditional rendering of elements.

Getting Started:

  1. Install with go get github.com/chasefleming/elem-go
  2. Explore the detailed documentation to understand the full spectrum of features.
  3. Try out the examples directory to see elem-go in real-world scenarios.