Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
ssh_example_ed25519*
/tmp

# MacOs Invisible file
.DS_Store

# WebAssembly files
*.wasm
!bindings/*.wasm

# JavaScript modules
node_modules
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,51 @@ the stylesheet-based Markdown renderer.

[glamour]: https://github.com/charmbracelet/glamour

## JavaScript/WASM Bindings

Lip Gloss is also available for JavaScript through WebAssembly bindings. This allows you to use Lip Gloss styling in Node.js applications and web browsers.

### Installation

```bash
npm install @charmland/lipgloss
```

### Usage

```javascript
const { Table, TableData, Style, Color, normalBorder } = require("@charmland/lipgloss");

// Create styled tables
const data = new TableData(
["Name", "Age", "City"],
["Alice", "25", "New York"],
["Bob", "30", "San Francisco"]
);

const table = new Table()
.data(data)
.border(normalBorder())
.styleFunc((row, col) => {
if (row === -1) {
return new Style().bold(true).foreground(Color("99"));
}
return new Style().padding(0, 1);
})
.render();

console.log(table);
```

The JavaScript bindings support most Lip Gloss features including:
- **Tables** with `TableData` for structured data management
- **Lists** with various enumerators
- **Trees** with nested structures
- **Styles** with colors, borders, padding, and more
- **Layout** functions like `joinHorizontal` and `joinVertical`

For complete documentation and examples, see the [bindings directory](./bindings/).

## Contributing

See [contributing][contribute].
Expand Down
Empty file added bindings/.gitattributes
Empty file.
Loading
Loading