Update module github.com/charmbracelet/lipgloss to v0.11.0 #27

Merged
abs3nt merged 1 commits from renovate/github.com-charmbracelet-lipgloss-0.x into main 2024-07-07 16:13:09 +00:00
Owner

This PR contains the following updates:

Package Type Update Change
github.com/charmbracelet/lipgloss require minor v0.9.1 -> v0.11.0

Release Notes

charmbracelet/lipgloss (github.com/charmbracelet/lipgloss)

v0.11.0

Compare Source

Immutable Styles and Raw Speed, Baby

So! The big news in this release is:

  • Style methods will now always return new styles
  • Style and ANSI operations under the hood are faster

There are also a handful of great lil' bug fixes. Read on for more.

Immutable Styles

Every Style method now returns a completely new style with its own underlying data structure no matter what. This means working with Styles is a lot easier. No more need for Copy()!

// Before
s := lipgloss.NewStyle().Bold(true)
newStyle := s.Copy()

// After
s := lipgloss.NewStyle().Bold(true)
newStyle := s // this is a true copy

Okay, but why are styles easier to work with now? Consider this:

// Before
baseStyle := lipgloss.NewStyle().Background(lipgloss.Color("59"))
styleAtRuntime := baseStyle.Copy().Width(m.Width)

// After
baseStyle := lipgloss.NewStyle().Padding(1, 2)
styleAtRuntime := baseStyle.Width(m.Width)

It might seem small, but eliminating the risk of mutations in persistent styles in an enormous usability improvement.

How to upgrade

There's nothing to do, however Style.Copy() is now deprecated and only returns itself, so you can just remove Style.Copy() calls. If you need to just copy a style without any changes to it you can simply b := a.

Faster ANSI

Sometimes watch companies brag about their "in-house" watch movement. Well, now we're bragging about our in-house-amazing x/ansi library by our own @​aymanbagabas. It's a fine-tuned, low-level way to manage ANSI sequencing and, because we're pretty nerdy, we’re super excited about it.


What's Changed

New!
Changed
Fixed

New Contributors

Full Changelog: https://github.com/charmbracelet/lipgloss/compare/v0.10.0...v0.11.0


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.

v0.10.0

Compare Source

String Transforms 💄

Lip Gloss v0.10.0 features a brand new Transform function for Styles to alter strings at render time. As well as some bug fixes, like ANSI-aware table cell truncation. 🧹

Simply define a Transform function as func (string) string and apply it to any style:

// Example:
s := NewStyle().Transform(strings.ToUpper)
fmt.Println(s.Render("raow!") // "RAOW!"

Or, if you prefer:

// Example:
reverse := func(s string) string {
    n := 0
    rune := make([]rune, len(s))
    for _, r := range s {
        rune[n] = r
	n++
    }
    rune = rune[0:n]
    for i := 0; i < n/2; i++ {
        rune[i], rune[n-1-i] = rune[n-1-i], rune[i]
    }
    return string(rune)
}

s := NewStyle().Transform(reverse)
fmt.Println(s.Render("The quick brown 狐 jumped over the lazy 犬")
// "犬 yzal eht revo depmuj 狐 nworb kciuq ehT",

What's Changed?

New Contributors

Full Changelog: https://github.com/charmbracelet/lipgloss/compare/v0.9.1...v0.10.0


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/charmbracelet/lipgloss](https://github.com/charmbracelet/lipgloss) | require | minor | `v0.9.1` -> `v0.11.0` | --- ### Release Notes <details> <summary>charmbracelet/lipgloss (github.com/charmbracelet/lipgloss)</summary> ### [`v0.11.0`](https://github.com/charmbracelet/lipgloss/releases/tag/v0.11.0) [Compare Source](https://github.com/charmbracelet/lipgloss/compare/v0.10.0...v0.11.0) ### Immutable Styles and Raw Speed, Baby So! The big news in this release is: - `Style` methods will now *always* return new styles - `Style` and ANSI operations under the hood are faster There are also a handful of great lil' bug fixes. Read on for more. #### Immutable Styles Every `Style` method now returns a completely new style with its own underlying data structure no matter what. This means working with Styles is a lot easier. No more need for `Copy()`! ```go // Before s := lipgloss.NewStyle().Bold(true) newStyle := s.Copy() // After s := lipgloss.NewStyle().Bold(true) newStyle := s // this is a true copy ``` Okay, but why are styles easier to work with now? Consider this: ```go // Before baseStyle := lipgloss.NewStyle().Background(lipgloss.Color("59")) styleAtRuntime := baseStyle.Copy().Width(m.Width) // After baseStyle := lipgloss.NewStyle().Padding(1, 2) styleAtRuntime := baseStyle.Width(m.Width) ``` It might seem small, but eliminating the risk of mutations in persistent styles in an enormous usability improvement. ##### How to upgrade There's nothing to do, however `Style.Copy()` is now deprecated and only returns itself, so you can just remove `Style.Copy()` calls. If you need to *just* copy a style without any changes to it you can simply `b := a`. #### Faster ANSI Sometimes watch companies brag about their "in-house" watch movement. Well, now we're bragging about our in-house-amazing [`x/ansi`](https://github.com/charmbracelet/x/tree/main/ansi) library by our own [@&#8203;aymanbagabas](https://github.com/aymanbagabas). It's a fine-tuned, low-level way to manage ANSI sequencing and, because we're pretty nerdy, we’re *super* excited about it. *** #### What's Changed ##### New! - always return copies of styles by [@&#8203;aymanbagabas](https://github.com/aymanbagabas) in https://github.com/charmbracelet/lipgloss/pull/276 ##### Changed - switch to term/ansi for text manipulation by [@&#8203;aymanbagabas](https://github.com/aymanbagabas) in https://github.com/charmbracelet/lipgloss/pull/268 - replace stripansi with ansi.Strip in table by [@&#8203;aymanbagabas](https://github.com/aymanbagabas) in https://github.com/charmbracelet/lipgloss/pull/271 - test for different GOOS & GOARCH by [@&#8203;aymanbagabas](https://github.com/aymanbagabas) in https://github.com/charmbracelet/lipgloss/pull/292 ##### Fixed - fix combining both conditional and unconditional wrapping by [@&#8203;aymanbagabas](https://github.com/aymanbagabas) in https://github.com/charmbracelet/lipgloss/pull/275 - fix UnderlineSpaces and StrikethroughSpaces by [@&#8203;Taz03](https://github.com/Taz03) in https://github.com/charmbracelet/lipgloss/pull/299 - always render horizontal border edges when enabled by [@&#8203;UnseenBook](https://github.com/UnseenBook) in https://github.com/charmbracelet/lipgloss/pull/211 - fix possible nil panic by [@&#8203;maaslalani](https://github.com/maaslalani) in https://github.com/charmbracelet/lipgloss/pull/245 - fix transform operating on ANSI sequences by [@&#8203;meowgorithm](https://github.com/meowgorithm) in https://github.com/charmbracelet/lipgloss/pull/274 - change propkeys from int to int64 by [@&#8203;hugoleodev](https://github.com/hugoleodev) in https://github.com/charmbracelet/lipgloss/pull/291 #### New Contributors - [@&#8203;benwaffle](https://github.com/benwaffle) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/247 - [@&#8203;UnseenBook](https://github.com/UnseenBook) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/211 - [@&#8203;hugoleodev](https://github.com/hugoleodev) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/291 - [@&#8203;Taz03](https://github.com/Taz03) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/299 **Full Changelog**: https://github.com/charmbracelet/lipgloss/compare/v0.10.0...v0.11.0 *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@&#8203;charm), or [Discord](https://charm.sh/discord). ### [`v0.10.0`](https://github.com/charmbracelet/lipgloss/releases/tag/v0.10.0) [Compare Source](https://github.com/charmbracelet/lipgloss/compare/v0.9.1...v0.10.0) ### String Transforms 💄 Lip Gloss `v0.10.0` features a brand new `Transform` function for Styles to alter strings at render time. As well as some bug fixes, like ANSI-aware table cell truncation. 🧹 Simply define a `Transform` function as `func (string) string` and apply it to any style: ```go // Example: s := NewStyle().Transform(strings.ToUpper) fmt.Println(s.Render("raow!") // "RAOW!" ``` Or, if you prefer: ```go // Example: reverse := func(s string) string { n := 0 rune := make([]rune, len(s)) for _, r := range s { rune[n] = r n++ } rune = rune[0:n] for i := 0; i < n/2; i++ { rune[i], rune[n-1-i] = rune[n-1-i], rune[i] } return string(rune) } s := NewStyle().Transform(reverse) fmt.Println(s.Render("The quick brown 狐 jumped over the lazy 犬") // "犬 yzal eht revo depmuj 狐 nworb kciuq ehT", ``` #### What's Changed? - Corrected border shorthand functions explanation by [@&#8203;ReidMason](https://github.com/ReidMason) in https://github.com/charmbracelet/lipgloss/pull/237 - Align help by [@&#8203;schmurfy](https://github.com/schmurfy) in https://github.com/charmbracelet/lipgloss/pull/239 - `Style.Transform` for altering strings at render time by [@&#8203;meowgorithm](https://github.com/meowgorithm) in https://github.com/charmbracelet/lipgloss/pull/232 - Adding right padding to empty string by [@&#8203;mikelorant](https://github.com/mikelorant) in https://github.com/charmbracelet/lipgloss/pull/253 - Refactor padding functions by [@&#8203;mikelorant](https://github.com/mikelorant) in https://github.com/charmbracelet/lipgloss/pull/254 - Fix truncate of table cells containing ANSI by [@&#8203;mikelorant](https://github.com/mikelorant) in https://github.com/charmbracelet/lipgloss/pull/256 - Improve maximum width of characters in a string by [@&#8203;mikelorant](https://github.com/mikelorant) in https://github.com/charmbracelet/lipgloss/pull/257 #### New Contributors - [@&#8203;ReidMason](https://github.com/ReidMason) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/237 - [@&#8203;schmurfy](https://github.com/schmurfy) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/239 - [@&#8203;mikelorant](https://github.com/mikelorant) made their first contribution in https://github.com/charmbracelet/lipgloss/pull/253 **Full Changelog**: https://github.com/charmbracelet/lipgloss/compare/v0.9.1...v0.10.0 *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@&#8203;charm), or [Discord](https://charm.sh/discord). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjQuMyIsInVwZGF0ZWRJblZlciI6IjM3LjQyNC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
abs3nt added 1 commit 2024-07-06 20:47:16 +00:00
Author
Owner

ℹ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 1 additional dependency was updated

Details:

Package Change
github.com/rivo/uniseg v0.4.6 -> v0.4.7
### ℹ Artifact update notice ##### File name: go.mod In order to perform the update(s) described in the table above, Renovate ran the `go get` command, which resulted in the following additional change(s): - 1 additional dependency was updated Details: | **Package** | **Change** | | :----------------------- | :------------------- | | `github.com/rivo/uniseg` | `v0.4.6` -> `v0.4.7` |
abs3nt force-pushed renovate/github.com-charmbracelet-lipgloss-0.x from 638e9f104f to 18e355d36c 2024-07-06 21:21:50 +00:00 Compare
abs3nt merged commit 302f60ac4f into main 2024-07-07 16:13:09 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: abs3nt/gospt#27
No description provided.