Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changesets

Hello and welcome! This folder has been automatically generated by
[@changesets/cli](https://github.com/changesets/changesets), a build tool that
Comment thread
natemoo-re marked this conversation as resolved.
works with multi-package repos, or single-package repos to help you version and
publish your code. You can find the full documentation for it
[in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this
project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
16 changes: 16 additions & 0 deletions .changeset/border-reserves-layout-space.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@bomb.sh/tty': minor
---

Changes `border` sides to reserve layout space instead of drawing as an overlay. Each border width is now added to the padding on its side, so content and children are laid out inside the border rather than collapsing behind the border glyphs.

This is a breaking change for callers who compensated for the old behavior by setting `layout.padding` equal to the border width — that padding is now additive and double-counts. Remove the workaround:

```diff
{
border: { color, left: 1, right: 1, top: 1, bottom: 1 },
- layout: { padding: { left: 1, right: 1, top: 1, bottom: 1 } },
}
```

A `border` of 1 with no padding now reserves one cell per bordered side; `border` of 1 plus `padding` of 1 reserves two, measured inward from the border edge.
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "bombshell-dev/tty" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"privatePackages": { "version": true, "tag": false },
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/drop-clay-debug-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bomb.sh/tty': patch
---

Shrinks the bundled WASM ~35% (156 kB → 101 kB raw) by compiling out Clay's unused debug-inspector UI.
5 changes: 5 additions & 0 deletions .changeset/text-caret-cursor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bomb.sh/tty': minor
---

Adds a `caret` property to text elements that positions the terminal's hardware cursor at a code-point offset within the text, resolved through wrapping and wide-character widths. The cursor shows only while a caret is declared; an offset at or past the content length places it one cell past the last character, giving text inputs a real, movable cursor.
5 changes: 5 additions & 0 deletions .changeset/wcwidth-non-printable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bomb.sh/tty': patch
---

Fixes width measurement for non-printable, control, and surrogate code points, which now measure as one `U+FFFD` cell to match what the renderer draws (width data regenerated against Unicode 17).
85 changes: 32 additions & 53 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,56 @@ name: Publish

on:
push:
tags:
- "v*"
branches:
- main

permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

permissions: {}

jobs:
verify-npm:
release:
runs-on: ubuntu-latest
permissions:
contents: write # commit the version bump, push the release tag
pull-requests: write # open the "Version Packages" PR
id-token: write # npm publish via OIDC trusted publishing
Comment thread
natemoo-re marked this conversation as resolved.
steps:
- name: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
persist-credentials: false
fetch-depth: 0

- name: setup deno
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
with:
deno-version: v2.x

- name: build wasm
run: make

- name: Get Version
id: vars
run: echo "version=$(echo "${GITHUB_REF_NAME}" | sed 's/^v//')" >> $GITHUB_OUTPUT
# Pinned to v2.8.3 to avoid https://github.com/denoland/deno/issues/35529
# (v2.9.0 rejects JSR files without a manifest checksum on warm cache).
# Restore to v2.x once v2.9.1 ships.
deno-version: v2.8.3

- name: Setup Node
- name: setup node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
cache: ""

- name: Build NPM
run: deno task build:npm "${STEPS_VARS_OUTPUTS_VERSION}"
env:
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}

- name: dry run publish
run: npm publish --dry-run --tag=verify
working-directory: ./build/npm

- name: upload build
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: npm-build
path: ./build/npm
registry-url: "https://registry.npmjs.org"

publish-npm:
needs: [verify-npm]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
- name: build wasm
run: make

steps:
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
cache: ""
- name: install changesets
run: npm ci

- name: download build
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: changesets
uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1
with:
name: npm-build
path: ./build/npm

- name: Publish NPM
run: npm publish --access=public --tag=latest
working-directory: ./build/npm
version-script: npm run version
publish-script: npm run release
Comment thread
natemoo-re marked this conversation as resolved.
commit-message: "chore: version packages"
pr-title: "chore: version packages"
create-github-releases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137 changes: 137 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# @bomb.sh/tty

## 0.8.0

### Minor Changes

- [#27](https://github.com/bombshell-dev/tty/pull/27) Thanks [@cowboyd](https://github.com/cowboyd)! - Adds frame-to-frame transitions. Visual properties now interpolate between renders, covering the subset of animations Clay supports today.

- [#96](https://github.com/bombshell-dev/tty/pull/96) Thanks [@rauhryan](https://github.com/rauhryan)! - Adds per-side border support, so each edge of an element can be styled independently.

### Patch Changes

- [#85](https://github.com/bombshell-dev/tty/pull/85) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fixes nested clipping so a nested clip restores its parent's region instead of disabling clipping entirely.

## 0.7.0

### Minor Changes

- [#99](https://github.com/bombshell-dev/tty/pull/99) Thanks [@cowboyd](https://github.com/cowboyd)! - Renames the published package to `@bomb.sh/tty`. The internal `clayterm.wasm` binary name is unchanged.

- [#93](https://github.com/bombshell-dev/tty/pull/93) Thanks [@rauhryan](https://github.com/rauhryan)! - Adds glyph-cell text backgrounds, so text can carry a per-glyph background color.

- [#94](https://github.com/bombshell-dev/tty/pull/94) Thanks [@rauhryan](https://github.com/rauhryan)! - Adds border-cell backgrounds, so border cells can carry their own background color.

- [#29](https://github.com/bombshell-dev/tty/pull/29) Thanks [@rauhryan](https://github.com/rauhryan)! - Expands the floating parameters on `open()` to cover more Clay options: `expand`, `attachPoints`, `pointerCaptureMode`, `clipTo`, and `zIndex`, exposed as string-literal enums.

- [#42](https://github.com/bombshell-dev/tty/pull/42) Thanks [@dreyfus92](https://github.com/dreyfus92)! - Switches alignment properties to string literals instead of numeric magic values.

- [#17](https://github.com/bombshell-dev/tty/pull/17) Thanks [@cowboyd](https://github.com/cowboyd)! - Adds `snapshot()` to pre-pack a directive subtree into its binary transfer encoding, so unchanged subtrees are not re-encoded every frame.

- [#22](https://github.com/bombshell-dev/tty/pull/22) Thanks [@cowboyd](https://github.com/cowboyd)! - Adds `RenderResult.info.get(id)` for lazy, computed element bounding-box lookup.

- [#23](https://github.com/bombshell-dev/tty/pull/23) Thanks [@cowboyd](https://github.com/cowboyd)! - Surfaces Clay layout errors per render as `errors: ClayError[]` on `RenderResult`.

- [#14](https://github.com/bombshell-dev/tty/pull/14) Thanks [@cowboyd](https://github.com/cowboyd)! - Decouples alternate-buffer switching from clearing. `alternateBuffer()` accepts `{ clear }`; `clear: false` uses xterm mode 47 to preserve alt-buffer contents.

- [#35](https://github.com/bombshell-dev/tty/pull/35) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Cuts npm install size ~63% (723 kB → 268 kB). Minimum Node is now v22.

- [#50](https://github.com/bombshell-dev/tty/pull/50) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Encodes the bundled WASM with brotli + Z85 instead of base64, cutting install size a further ~57% (270 kB → ~115 kB).

### Patch Changes

- [#20](https://github.com/bombshell-dev/tty/pull/20) Thanks [@cowboyd](https://github.com/cowboyd)! - **Breaking:** Renames the numeric `Op` discriminant to `directive` and `open()`'s `name` argument to `id`. Element IDs are hashed with a constant seed, so ensuring uniqueness is now the caller's responsibility.

- [#33](https://github.com/bombshell-dev/tty/pull/33) Thanks [@rauhryan](https://github.com/rauhryan)! - Improves packed-string overflow errors. Oversized text and element-id payloads now throw a descriptive `RangeError` instead of corrupting the buffer.

- [#87](https://github.com/bombshell-dev/tty/pull/87) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Leaves the terminal default foreground for uncolored text, so uncolored glyphs no longer emit concrete white — fixing appearance on light-background terminals.

- [#24](https://github.com/bombshell-dev/tty/pull/24) Thanks [@cowboyd](https://github.com/cowboyd)! - Adds the MIT `LICENSE` file to match the declared license.

## 0.6.0

### Minor Changes

- [#4](https://github.com/bombshell-dev/tty/pull/4) Thanks [@cowboyd](https://github.com/cowboyd)! - Adds a line rendering mode (`render(ops, { mode: "line" })`) for newline-separated, pipe-friendly output. The `row` option becomes a 1-based render-time option matching DSR/CPR.

- [#9](https://github.com/bombshell-dev/tty/pull/9) Thanks [@cowboyd](https://github.com/cowboyd)! - Inlines the WASM binary into the generated TypeScript module. This drops the `node:fs/promises` read and `--allow-read`, so the module imports from non-`file://` URLs.

- Adds a `termcodes` module and makes `CursorEvent` values 1-based to match the terminal's native DSR/CPR format.

### Patch Changes

- [#7](https://github.com/bombshell-dev/tty/pull/7) Thanks [@cowboyd](https://github.com/cowboyd)! - Accepts signed int32 colors in the validator, so full-alpha `rgba()` colors (which serialize to a negative int32) no longer fail validation.

- Allows cell fill across different initialization types.

## 0.5.0

### Minor Changes

- Parses DSR cursor-position reports and renames the row-offset render option to `top`.

## 0.4.0

### Minor Changes

- Adds a `top` (row offset) option to `createTerm()` for region-mode rendering.

- Adds composable terminal settings that automatically revert when disposed.

## 0.3.0

### Minor Changes

- Adds pointer events and interactive hover to the Clay render pipeline, including the ability to capture mouse events.

- Adds progressive Kitty keyboard protocol support, with `"0"` to reset all progressive enhancements and numpad Enter/Add handling.

## 0.2.0

### Minor Changes

- Adds a Kitty keyboard protocol (CSI u) input parser.

## 0.1.3

### Patch Changes

- Preserves the parent background when a text background is set to default.

## 0.1.2

### Patch Changes

- Fixes WASM memory allocation and adds an ops-buffer overflow check.

## 0.1.1

### Patch Changes

- Exports the `input` module from `mod.ts`.

## 0.1.0

### Minor Changes

- Adds a terminal input parser.

- Adds ops validation backed by TypeBox schemas.

## 0.0.2

### Patch Changes

- Loads the WASM file with `node:fs/promises`.

## 0.0.1

### Patch Changes

- Fixes JSR publish by using token auth for scope authorization.

## 0.0.0

### Initial Release

- Initial release of the terminal rendering backend for Clay, compiled to WebAssembly. `render()` returns a `Uint8Array` of terminal output. Thanks [@cowboyd](https://github.com/cowboyd)!
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"nodeModulesDir": "auto",
"fmt": {
"exclude": ["clay", "build"]
"exclude": ["clay", "build", "CHANGELOG.md", ".changeset"]
},
"lint": {
"rules": { "exclude": ["prefer-const"] },
Expand Down
Loading
Loading