effective-progress 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,13 +11,13 @@
11
11
 
12
12
  <img alt="Showcase output" src="docs/images/showcase.gif" width="600" />
13
13
 
14
- `effective-progress` is an [Effect](https://effect.website/)-first terminal progress library with:
14
+ `effective-progress` is an [Effect](https://effect.website/)-first terminal progress-bar library with:
15
15
 
16
- - multiple progress bars
17
- - nested child progress bars
18
- - spinner support for indeterminate work
19
- - clean log rendering alongside progress output, allowing you to simply use Effects `Console.log` or `Effect.logInfo`.
20
- - simple to use `.all` and `.forEach` APIs similar to the ones you already know and love from `effect`. Just swap `Effect` for `Progress` and get progress bars for free!
16
+ - multiple nested tree-like progress bars
17
+ - spinner support for “we have no idea how long this takes” work
18
+ - clean log rendering alongside progress output, so you can keep using `Console.log` / `Effect.logInfo` without wrecking the UI
19
+ - familiar `.all` and `.forEach` APIs swap `Effect` for `Progress`, get progress bars basically for free
20
+ - flicker-free rendering (in theory) by drawing everything in a single terminal frame
21
21
 
22
22
  ## Install
23
23
 
@@ -94,6 +94,12 @@ Effect.runPromise(program);
94
94
 
95
95
  Configure global renderer behavior once, and a global base progress bar style:
96
96
 
97
+ Defaults:
98
+
99
+ - determinate layout: `single-line`
100
+ - max task width cap: unset (uses terminal width)
101
+ - bar width: `40`
102
+
97
103
  ```ts
98
104
  import { Effect } from "effect";
99
105
  import * as Progress from "effective-progress";
@@ -168,13 +174,9 @@ const program = Progress.task(
168
174
  );
169
175
  ```
170
176
 
171
- ## Progress bar colors
172
-
173
- Colors are configured through the `Colorizer` service. You can set a global colorizer, or provide per-task overrides using `Effect.provideService`.
174
-
175
- ### Global colorizer
177
+ ## Themes and render stages
176
178
 
177
- Provide a custom `Colorizer` at the top level to change colors for all tasks:
179
+ Coloring is configured through the `Theme` service.
178
180
 
179
181
  ```ts
180
182
  import chalk from "chalk";
@@ -183,51 +185,35 @@ import * as Progress from "effective-progress";
183
185
 
184
186
  const program = Progress.task(myEffect, { description: "Work" }).pipe(
185
187
  Effect.provideService(
186
- Progress.Colorizer,
187
- Progress.Colorizer.of({
188
- fill: chalk.hex("#00b894"),
189
- empty: chalk.white.dim,
190
- brackets: chalk.rgb(180, 190, 210),
191
- percent: chalk.whiteBright.bold,
192
- spinner: chalk.ansi256(214),
193
- done: chalk.greenBright,
194
- failed: chalk.redBright.bold,
188
+ Progress.Theme,
189
+ Progress.Theme.of({
190
+ styles: {
191
+ plain: (text) => text,
192
+ barFill: chalk.hex("#00b894"),
193
+ barEmpty: chalk.white.dim,
194
+ barBracket: chalk.rgb(180, 190, 210),
195
+ spinner: chalk.ansi256(214),
196
+ statusDone: chalk.greenBright,
197
+ statusFailed: chalk.redBright.bold,
198
+ text: chalk.white,
199
+ units: chalk.whiteBright.bold,
200
+ eta: chalk.gray,
201
+ elapsed: chalk.gray,
202
+ treeConnector: chalk.gray,
203
+ },
204
+ depthPalette: (depth, role) => (role === "text" && depth > 0 ? chalk.cyanBright : undefined),
195
205
  }),
196
206
  ),
197
207
  );
198
208
  ```
199
209
 
200
- ### Per-task colorizer
201
-
202
- Wrap any effect with `Effect.provideService(Colorizer, ...)` to override colors for that task (and its children). The colorizer is captured at task-creation time, so each task can have its own colors:
203
-
204
- ```ts
205
- Progress.forEach(
206
- ["fetch", "transform", "persist"],
207
- (stage) => Effect.gen(function* () {
208
- yield* Effect.sleep("500 millis");
209
- return stage;
210
- }),
211
- { description: "Worker pipeline" },
212
- ).pipe(
213
- Effect.provideService(
214
- Progress.Colorizer,
215
- Progress.Colorizer.of({
216
- fill: chalk.red,
217
- empty: chalk.white.dim,
218
- brackets: chalk.white.dim,
219
- percent: chalk.white.bold,
220
- spinner: chalk.magentaBright,
221
- done: chalk.greenBright,
222
- failed: chalk.redBright,
223
- }),
224
- ),
225
- );
226
- ```
210
+ Render internals are split into overrideable stages:
227
211
 
228
- Tasks inherit the colorizer from their parent task.
212
+ - `BuildStage`: logical rows/cells/segments
213
+ - `ShrinkStage`: width fitting/collapse
214
+ - `ColorStage`: role -> styled terminal strings
229
215
 
230
- Each `ColorizerService` slot (`fill`, `empty`, `brackets`, `percent`, `spinner`, `done`, `failed`) is a `(text: string) => string` function. Use any chalk style — named colors, hex, rgb, ansi256, and modifiers like `.bold` or `.dim` all work.
216
+ You can replace any stage with `Effect.provideService(...)` while keeping defaults for the rest.
231
217
 
232
218
  ## Dependencies & package size
233
219
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effective-progress",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Effect-first terminal progress bars with nested multibar support",
5
5
  "homepage": "https://github.com/stromseng/effective-progress#readme",
6
6
  "bugs": {
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./api";
2
- export * from "./colors";
2
+ export * from "./renderer";
3
3
  export { Progress } from "./runtime";
4
4
  export * from "./terminal";
5
+ export * from "./theme";
5
6
  export * from "./types";