Comparing version
@@ -12,2 +12,3 @@ declare type BlipglossColor = string | { | ||
} | ||
declare type BorderStyle = 'rounded' | 'double' | 'normal' | 'hidden' | 'thick'; | ||
declare class Style { | ||
@@ -26,2 +27,3 @@ #private; | ||
Background(color: BlipglossColor): this; | ||
Padding(...values: number[]): this; | ||
PaddingTop(padding: number): this; | ||
@@ -31,2 +33,3 @@ PaddingBottom(padding: number): this; | ||
PaddingRight(padding: number): this; | ||
Margin(...values: number[]): this; | ||
MarginTop(padding: number): this; | ||
@@ -46,2 +49,3 @@ MarginBottom(padding: number): this; | ||
BorderRightForeground(color: BlipglossColor): this; | ||
BorderStyle(style: BorderStyle): this; | ||
BorderTop(val: boolean): this; | ||
@@ -51,2 +55,3 @@ BorderBottom(val: boolean): this; | ||
BorderRight(val: boolean): this; | ||
BorderForeground(color: BlipglossColor): this; | ||
BorderBackground(color: BlipglossColor): this; | ||
@@ -57,2 +62,3 @@ GetBoolValue(): any; | ||
Reverse(val: boolean): this; | ||
Align(position: Position | number): this; | ||
Render(text: string): string; | ||
@@ -59,0 +65,0 @@ Copy(): Style; |
@@ -112,7 +112,7 @@ "use strict"; | ||
JoinHorizontal: { | ||
args: [import_bun_ffi.FFIType.float, import_bun_ffi.FFIType.ptr], | ||
args: [import_bun_ffi.FFIType.f64, import_bun_ffi.FFIType.ptr], | ||
returns: import_bun_ffi.FFIType.ptr | ||
}, | ||
JoinVertical: { | ||
args: [import_bun_ffi.FFIType.float, import_bun_ffi.FFIType.ptr], | ||
args: [import_bun_ffi.FFIType.f64, import_bun_ffi.FFIType.ptr], | ||
returns: import_bun_ffi.FFIType.ptr | ||
@@ -128,2 +128,18 @@ }, | ||
}, | ||
Align: { | ||
args: [import_bun_ffi.FFIType.float], | ||
returns: import_bun_ffi.FFIType.void | ||
}, | ||
Margin: { | ||
args: [import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr], | ||
returns: import_bun_ffi.FFIType.void | ||
}, | ||
Padding: { | ||
args: [import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr], | ||
returns: import_bun_ffi.FFIType.void | ||
}, | ||
BorderStyle: { | ||
args: [import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr], | ||
returns: import_bun_ffi.FFIType.void | ||
}, | ||
FreeString: { | ||
@@ -192,2 +208,6 @@ args: [import_bun_ffi.FFIType.ptr], | ||
} | ||
Padding(...values) { | ||
symbols.Padding(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(JSON.stringify(values)))); | ||
return this; | ||
} | ||
PaddingTop(padding) { | ||
@@ -205,2 +225,6 @@ return this.SetIntValue("PaddingTop", padding); | ||
} | ||
Margin(...values) { | ||
symbols.Margin(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(JSON.stringify(values)))); | ||
return this; | ||
} | ||
MarginTop(padding) { | ||
@@ -248,2 +272,6 @@ return this.SetIntValue("MarginTop", padding); | ||
} | ||
BorderStyle(style) { | ||
symbols.BorderStyle(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(style))); | ||
return this; | ||
} | ||
BorderTop(val) { | ||
@@ -261,2 +289,5 @@ return this.SetBooleanValue("BorderTop", val); | ||
} | ||
BorderForeground(color) { | ||
return this.SetColorValue("BorderForeground", color); | ||
} | ||
BorderBackground(color) { | ||
@@ -277,2 +308,6 @@ return this.SetColorValue("BorderBackground", color); | ||
} | ||
Align(position) { | ||
symbols.Align(__privateGet(this, _handle), position); | ||
return this; | ||
} | ||
Render(text) { | ||
@@ -279,0 +314,0 @@ const textPtr = symbols.Render(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(text))); |
{ | ||
"name": "blipgloss", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
@@ -113,8 +113,31 @@ # blipgloss | ||
`TODO` | ||
```js | ||
// 2 cells on all sides | ||
NewStyle().Padding(2) | ||
// 2 cells on the top and bottom, 4 cells on the left and right | ||
NewStyle().Margin(2, 4) | ||
// 1 cell on the top, 4 cells on the sides, 2 cells on the bottom | ||
NewStyle().Padding(1, 4, 2) | ||
// Clockwise, starting from the top: 2 cells on the top, 4 on the right, 3 on | ||
// the bottom, and 1 on the left | ||
NewStyle().Margin(2, 4, 3, 1) | ||
``` | ||
## Aligning Text | ||
`TODO` | ||
You can align paragraphs of text to the left, right, or center. | ||
```js | ||
import { Position } from 'blipgloss' | ||
const style = NewStyle() | ||
.Width(24) | ||
.Align(Position.Left) // align it left | ||
.Align(Position.Right) // no wait, align it right | ||
.Align(Position.Center) // just kidding, align it in the center | ||
``` | ||
## Width and Height | ||
@@ -134,4 +157,21 @@ | ||
`TODO` | ||
Adding borders is easy: | ||
```js | ||
// Add a purple, rectangular border | ||
const style = NewStyle() | ||
.BorderStyle(lipgloss.NormalBorder()) | ||
.BorderForeground(lipgloss.Color("63")) | ||
// Set a rounded, yellow-on-purple border to the top and left | ||
const anotherStyle = NewStyle() | ||
.BorderStyle('rounded') | ||
.BorderForeground("228") | ||
.BorderBackground("63") | ||
.BorderTop(true). | ||
.BorderLeft(true) | ||
// TODO: Make own border | ||
``` | ||
## Copying Styles | ||
@@ -138,0 +178,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11392383
0.24%837
9.99%264
17.86%