[READ-ONLY] Mirror of https://github.com/bombshell-dev/clack. Effortlessly build beautiful command-line apps bomb.sh/docs/clack/basics/getting-started/
cli command-line command-line-app node prompt prompts
5

Configure Feed

Select the types of activity you want to include in your feed.

wip: move resize to component

James Garbutt (Oct 23, 2025, 9:45 AM +0100) d6ececf3 4aaf74e9

+11 -6
+11
packages/core/src/component.ts
··· 121 121 this.#output = output; 122 122 } 123 123 124 + #onResize = (): void => { 125 + this.requestUpdate(); 126 + }; 127 + 124 128 render(): Template { 125 129 const result: TemplateArray = []; 126 130 for (const child of this.children) { ··· 148 152 super.onUnmount(); 149 153 this.#lastFrame = undefined; 150 154 this.#mounted = false; 155 + this.#output.off('resize', this.#onResize); 156 + this.#output.write(cursor.show); 157 + } 158 + 159 + onMount(): void { 160 + super.onMount(); 161 + this.#output.on('resize', this.#onResize); 151 162 } 152 163 153 164 attach(component: Component): void {
-6
packages/core/src/prompts/prompt.ts
··· 1 1 import { stdin, stdout } from 'node:process'; 2 2 import readline, { type Key, type ReadLine } from 'node:readline'; 3 3 import type { Readable, Writable } from 'node:stream'; 4 - import { cursor } from 'sisteransi'; 5 4 import { Component, RenderHost } from '../component.js'; 6 5 import type { ClackEvents, ClackState } from '../types.js'; 7 6 import type { Action } from '../utils/index.js'; ··· 153 152 154 153 this.input.on('keypress', this.onKeypress); 155 154 setRawMode(this.input, true); 156 - this.output.on('resize', this.requestUpdate); 157 155 158 156 this.requestUpdate(); 159 157 160 158 this.once('submit', () => { 161 - this.output.write(cursor.show); 162 - this.output.off('resize', this.requestUpdate); 163 159 setRawMode(this.input, false); 164 160 resolve(this.value); 165 161 }); 166 162 this.once('cancel', () => { 167 - this.output.write(cursor.show); 168 - this.output.off('resize', this.requestUpdate); 169 163 setRawMode(this.input, false); 170 164 resolve(CANCEL_SYMBOL); 171 165 });