@effect-tui/core 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/anim.d.ts +4 -0
- package/dist/anim.d.ts.map +1 -0
- package/dist/anim.js +5 -0
- package/dist/anim.js.map +1 -0
- package/dist/ansi.d.ts +69 -0
- package/dist/ansi.d.ts.map +1 -0
- package/dist/ansi.js +72 -0
- package/dist/ansi.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +18 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +247 -0
- package/dist/keys.js.map +1 -0
- package/dist/layout/linearStack.d.ts +17 -0
- package/dist/layout/linearStack.d.ts.map +1 -0
- package/dist/layout/linearStack.js +86 -0
- package/dist/layout/linearStack.js.map +1 -0
- package/dist/motion-value.d.ts +58 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +250 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/present/display.d.ts +58 -0
- package/dist/present/display.d.ts.map +1 -0
- package/dist/present/display.js +168 -0
- package/dist/present/display.js.map +1 -0
- package/dist/present/writers/fullscreen.d.ts +19 -0
- package/dist/present/writers/fullscreen.d.ts.map +1 -0
- package/dist/present/writers/fullscreen.js +55 -0
- package/dist/present/writers/fullscreen.js.map +1 -0
- package/dist/present/writers/inline.d.ts +20 -0
- package/dist/present/writers/inline.d.ts.map +1 -0
- package/dist/present/writers/inline.js +92 -0
- package/dist/present/writers/inline.js.map +1 -0
- package/dist/render/buffer.d.ts +31 -0
- package/dist/render/buffer.d.ts.map +1 -0
- package/dist/render/buffer.js +183 -0
- package/dist/render/buffer.js.map +1 -0
- package/dist/render/color-utils.d.ts +18 -0
- package/dist/render/color-utils.d.ts.map +1 -0
- package/dist/render/color-utils.js +58 -0
- package/dist/render/color-utils.js.map +1 -0
- package/dist/render/diff.d.ts +30 -0
- package/dist/render/diff.d.ts.map +1 -0
- package/dist/render/diff.js +83 -0
- package/dist/render/diff.js.map +1 -0
- package/dist/render/measure.d.ts +15 -0
- package/dist/render/measure.d.ts.map +1 -0
- package/dist/render/measure.js +65 -0
- package/dist/render/measure.js.map +1 -0
- package/dist/render/palette.d.ts +46 -0
- package/dist/render/palette.d.ts.map +1 -0
- package/dist/render/palette.js +108 -0
- package/dist/render/palette.js.map +1 -0
- package/dist/render/surface.d.ts +77 -0
- package/dist/render/surface.d.ts.map +1 -0
- package/dist/render/surface.js +198 -0
- package/dist/render/surface.js.map +1 -0
- package/dist/runtime/backend_node.d.ts +36 -0
- package/dist/runtime/backend_node.d.ts.map +1 -0
- package/dist/runtime/backend_node.js +66 -0
- package/dist/runtime/backend_node.js.map +1 -0
- package/dist/spring-physics.d.ts +36 -0
- package/dist/spring-physics.d.ts.map +1 -0
- package/dist/spring-physics.js +113 -0
- package/dist/spring-physics.js.map +1 -0
- package/dist/spring.d.ts +73 -0
- package/dist/spring.d.ts.map +1 -0
- package/dist/spring.js +136 -0
- package/dist/spring.js.map +1 -0
- package/dist/ui/containers/canvas.d.ts +13 -0
- package/dist/ui/containers/canvas.d.ts.map +1 -0
- package/dist/ui/containers/canvas.js +16 -0
- package/dist/ui/containers/canvas.js.map +1 -0
- package/dist/ui/containers/geometry-reader.d.ts +17 -0
- package/dist/ui/containers/geometry-reader.d.ts.map +1 -0
- package/dist/ui/containers/geometry-reader.js +24 -0
- package/dist/ui/containers/geometry-reader.js.map +1 -0
- package/dist/ui/containers/hstack.d.ts +12 -0
- package/dist/ui/containers/hstack.d.ts.map +1 -0
- package/dist/ui/containers/hstack.js +28 -0
- package/dist/ui/containers/hstack.js.map +1 -0
- package/dist/ui/containers/scroll.d.ts +28 -0
- package/dist/ui/containers/scroll.d.ts.map +1 -0
- package/dist/ui/containers/scroll.js +97 -0
- package/dist/ui/containers/scroll.js.map +1 -0
- package/dist/ui/containers/shared.d.ts +12 -0
- package/dist/ui/containers/shared.d.ts.map +1 -0
- package/dist/ui/containers/shared.js +19 -0
- package/dist/ui/containers/shared.js.map +1 -0
- package/dist/ui/containers/vstack.d.ts +12 -0
- package/dist/ui/containers/vstack.d.ts.map +1 -0
- package/dist/ui/containers/vstack.js +28 -0
- package/dist/ui/containers/vstack.js.map +1 -0
- package/dist/ui/containers/zstack.d.ts +14 -0
- package/dist/ui/containers/zstack.d.ts.map +1 -0
- package/dist/ui/containers/zstack.js +36 -0
- package/dist/ui/containers/zstack.js.map +1 -0
- package/dist/ui/core/geometry-store.d.ts +22 -0
- package/dist/ui/core/geometry-store.d.ts.map +1 -0
- package/dist/ui/core/geometry-store.js +29 -0
- package/dist/ui/core/geometry-store.js.map +1 -0
- package/dist/ui/core/geometry.d.ts +34 -0
- package/dist/ui/core/geometry.d.ts.map +1 -0
- package/dist/ui/core/geometry.js +14 -0
- package/dist/ui/core/geometry.js.map +1 -0
- package/dist/ui/core/view.d.ts +25 -0
- package/dist/ui/core/view.d.ts.map +1 -0
- package/dist/ui/core/view.js +34 -0
- package/dist/ui/core/view.js.map +1 -0
- package/dist/ui/index.d.ts +44 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +39 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/inlinetext.d.ts +24 -0
- package/dist/ui/inlinetext.d.ts.map +1 -0
- package/dist/ui/inlinetext.js +131 -0
- package/dist/ui/inlinetext.js.map +1 -0
- package/dist/ui/install.d.ts +22 -0
- package/dist/ui/install.d.ts.map +1 -0
- package/dist/ui/install.js +66 -0
- package/dist/ui/install.js.map +1 -0
- package/dist/ui/markdown.d.ts +40 -0
- package/dist/ui/markdown.d.ts.map +1 -0
- package/dist/ui/markdown.js +351 -0
- package/dist/ui/markdown.js.map +1 -0
- package/dist/ui/modifiers/border.d.ts +33 -0
- package/dist/ui/modifiers/border.d.ts.map +1 -0
- package/dist/ui/modifiers/border.js +82 -0
- package/dist/ui/modifiers/border.js.map +1 -0
- package/dist/ui/modifiers/fill.d.ts +14 -0
- package/dist/ui/modifiers/fill.d.ts.map +1 -0
- package/dist/ui/modifiers/fill.js +25 -0
- package/dist/ui/modifiers/fill.js.map +1 -0
- package/dist/ui/modifiers/frame.d.ts +23 -0
- package/dist/ui/modifiers/frame.d.ts.map +1 -0
- package/dist/ui/modifiers/frame.js +54 -0
- package/dist/ui/modifiers/frame.js.map +1 -0
- package/dist/ui/modifiers/offset.d.ts +15 -0
- package/dist/ui/modifiers/offset.d.ts.map +1 -0
- package/dist/ui/modifiers/offset.js +21 -0
- package/dist/ui/modifiers/offset.js.map +1 -0
- package/dist/ui/modifiers/opacity.d.ts +15 -0
- package/dist/ui/modifiers/opacity.d.ts.map +1 -0
- package/dist/ui/modifiers/opacity.js +95 -0
- package/dist/ui/modifiers/opacity.js.map +1 -0
- package/dist/ui/modifiers/padding.d.ts +20 -0
- package/dist/ui/modifiers/padding.d.ts.map +1 -0
- package/dist/ui/modifiers/padding.js +36 -0
- package/dist/ui/modifiers/padding.js.map +1 -0
- package/dist/ui/modifiers/styled.d.ts +14 -0
- package/dist/ui/modifiers/styled.d.ts.map +1 -0
- package/dist/ui/modifiers/styled.js +26 -0
- package/dist/ui/modifiers/styled.js.map +1 -0
- package/dist/ui/primitives/rectangle.d.ts +15 -0
- package/dist/ui/primitives/rectangle.d.ts.map +1 -0
- package/dist/ui/primitives/rectangle.js +23 -0
- package/dist/ui/primitives/rectangle.js.map +1 -0
- package/dist/ui/primitives/spacer.d.ts +13 -0
- package/dist/ui/primitives/spacer.d.ts.map +1 -0
- package/dist/ui/primitives/spacer.js +16 -0
- package/dist/ui/primitives/spacer.js.map +1 -0
- package/dist/ui/primitives/text.d.ts +15 -0
- package/dist/ui/primitives/text.d.ts.map +1 -0
- package/dist/ui/primitives/text.js +79 -0
- package/dist/ui/primitives/text.js.map +1 -0
- package/dist/ui/primitives/wrapped-text.d.ts +30 -0
- package/dist/ui/primitives/wrapped-text.d.ts.map +1 -0
- package/dist/ui/primitives/wrapped-text.js +117 -0
- package/dist/ui/primitives/wrapped-text.js.map +1 -0
- package/dist/ui/shinytext.d.ts +66 -0
- package/dist/ui/shinytext.d.ts.map +1 -0
- package/dist/ui/shinytext.js +99 -0
- package/dist/ui/shinytext.js.map +1 -0
- package/dist/ui/text/layout.d.ts +35 -0
- package/dist/ui/text/layout.d.ts.map +1 -0
- package/dist/ui/text/layout.js +102 -0
- package/dist/ui/text/layout.js.map +1 -0
- package/dist/ui/textinput.d.ts +140 -0
- package/dist/ui/textinput.d.ts.map +1 -0
- package/dist/ui/textinput.js +402 -0
- package/dist/ui/textinput.js.map +1 -0
- package/dist/ui/view-constructors.d.ts +72 -0
- package/dist/ui/view-constructors.d.ts.map +1 -0
- package/dist/ui/view-constructors.js +74 -0
- package/dist/ui/view-constructors.js.map +1 -0
- package/package.json +57 -0
- package/src/anim.ts +5 -0
- package/src/ansi.ts +83 -0
- package/src/index.ts +21 -0
- package/src/keys.ts +302 -0
- package/src/layout/linearStack.ts +115 -0
- package/src/motion-value.ts +335 -0
- package/src/present/display.ts +206 -0
- package/src/present/writers/fullscreen.ts +58 -0
- package/src/present/writers/inline.ts +101 -0
- package/src/render/buffer.ts +200 -0
- package/src/render/color-utils.ts +60 -0
- package/src/render/diff.ts +95 -0
- package/src/render/measure.ts +74 -0
- package/src/render/palette.ts +113 -0
- package/src/render/surface.ts +238 -0
- package/src/runtime/backend_node.ts +80 -0
- package/src/spring-physics.ts +151 -0
- package/src/spring.ts +234 -0
- package/src/ui/__snapshots__/wrappedtext.test.ts.snap +57 -0
- package/src/ui/containers/canvas.ts +18 -0
- package/src/ui/containers/geometry-reader.ts +32 -0
- package/src/ui/containers/hstack.ts +33 -0
- package/src/ui/containers/scroll.ts +106 -0
- package/src/ui/containers/shared.ts +27 -0
- package/src/ui/containers/vstack.ts +34 -0
- package/src/ui/containers/zstack.ts +37 -0
- package/src/ui/core/geometry-store.ts +42 -0
- package/src/ui/core/geometry.ts +30 -0
- package/src/ui/core/view.ts +49 -0
- package/src/ui/index.ts +84 -0
- package/src/ui/inlinetext.ts +135 -0
- package/src/ui/install.ts +110 -0
- package/src/ui/markdown.test.ts +74 -0
- package/src/ui/markdown.ts +388 -0
- package/src/ui/modifiers/border.ts +100 -0
- package/src/ui/modifiers/fill.ts +28 -0
- package/src/ui/modifiers/frame.ts +74 -0
- package/src/ui/modifiers/offset.ts +23 -0
- package/src/ui/modifiers/opacity.ts +93 -0
- package/src/ui/modifiers/padding.ts +53 -0
- package/src/ui/modifiers/styled.ts +31 -0
- package/src/ui/primitives/rectangle.ts +25 -0
- package/src/ui/primitives/spacer.ts +18 -0
- package/src/ui/primitives/text.ts +85 -0
- package/src/ui/primitives/wrapped-text.ts +131 -0
- package/src/ui/shinytext.ts +159 -0
- package/src/ui/text/layout.ts +119 -0
- package/src/ui/textinput.ts +496 -0
- package/src/ui/view-constructors.ts +96 -0
- package/src/ui/wrappedtext.test.ts +138 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/present/display.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAA+B,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAS5D,MAAe,YAAY;IAKH;IAJZ,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;IACvB,IAAI,CAAc;IAClB,IAAI,CAAc;IAE5B,YAAsB,OAAwB;QAAxB,YAAO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AC7D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YAC3G,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YAC7C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,UAAU,CAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;YAC/C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;QACzC,CAAC;QAED,kEAAkE;QAClE,IAAI,CAAC,IAAI,EAAE,CAAA;QACX,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AAID,MAAM,OAAO,gBAAgB;IAC3B,gBAAuB,CAAC;IACxB,MAAM,CAAC,IAAI,CAAC,IAAkB,EAAE,OAAwB;QACtD,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC5F,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RunWriter } from "../../render/diff.js";
|
|
2
|
+
import type { Palette } from "../../render/surface.js";
|
|
3
|
+
export declare class FullscreenWriter implements RunWriter {
|
|
4
|
+
private palette;
|
|
5
|
+
private out;
|
|
6
|
+
private curRow;
|
|
7
|
+
private curCol;
|
|
8
|
+
private curStyle;
|
|
9
|
+
private rows;
|
|
10
|
+
constructor(palette: Palette);
|
|
11
|
+
begin(vp: {
|
|
12
|
+
cols: number;
|
|
13
|
+
rows: number;
|
|
14
|
+
}): void;
|
|
15
|
+
run(row: number, col: number, styleId: number, text: string): void;
|
|
16
|
+
end(): void;
|
|
17
|
+
flush(): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fullscreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullscreen.d.ts","sourceRoot":"","sources":["../../../src/present/writers/fullscreen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAgBtD,qBAAa,gBAAiB,YAAW,SAAS;IAOpC,OAAO,CAAC,OAAO;IAN3B,OAAO,CAAC,GAAG,CAAqB;IAChC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,IAAI,CAAI;gBAEI,OAAO,EAAE,OAAO;IAEpC,KAAK,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAclE,GAAG,IAAI,IAAI;IAMX,KAAK,IAAI,MAAM;CAOhB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { displayWidth } from "../../render/measure.js";
|
|
2
|
+
import { ANSI } from "../../ansi.js";
|
|
3
|
+
class ChunkBuilder {
|
|
4
|
+
parts = [];
|
|
5
|
+
push(s) {
|
|
6
|
+
if (s)
|
|
7
|
+
this.parts.push(s);
|
|
8
|
+
}
|
|
9
|
+
concat() {
|
|
10
|
+
const out = this.parts.join("");
|
|
11
|
+
this.parts = [];
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class FullscreenWriter {
|
|
16
|
+
palette;
|
|
17
|
+
out = new ChunkBuilder();
|
|
18
|
+
curRow = -1;
|
|
19
|
+
curCol = -1;
|
|
20
|
+
curStyle = -1;
|
|
21
|
+
rows = 0;
|
|
22
|
+
constructor(palette) {
|
|
23
|
+
this.palette = palette;
|
|
24
|
+
}
|
|
25
|
+
begin(vp) {
|
|
26
|
+
this.rows = vp.rows;
|
|
27
|
+
}
|
|
28
|
+
run(row, col, styleId, text) {
|
|
29
|
+
if (row !== this.curRow || col !== this.curCol) {
|
|
30
|
+
this.out.push(ANSI.cursor.to(row + 1, col + 1));
|
|
31
|
+
this.curRow = row;
|
|
32
|
+
this.curCol = col;
|
|
33
|
+
}
|
|
34
|
+
if (this.curStyle !== styleId) {
|
|
35
|
+
this.out.push(this.palette.sgr(styleId));
|
|
36
|
+
this.curStyle = styleId;
|
|
37
|
+
}
|
|
38
|
+
this.out.push(text);
|
|
39
|
+
this.curCol += displayWidth(text); // fix for wide glyphs
|
|
40
|
+
}
|
|
41
|
+
end() {
|
|
42
|
+
if (this.curStyle !== -1)
|
|
43
|
+
this.out.push(ANSI.reset);
|
|
44
|
+
// park cursor bottom-left (optional)
|
|
45
|
+
this.out.push(ANSI.cursor.to(this.rows, 1));
|
|
46
|
+
}
|
|
47
|
+
flush() {
|
|
48
|
+
const s = this.out.concat();
|
|
49
|
+
// reset tracked cursor/style to unknown so next frame emits properly
|
|
50
|
+
this.curRow = this.curCol = -1;
|
|
51
|
+
this.curStyle = -1;
|
|
52
|
+
return s;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=fullscreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullscreen.js","sourceRoot":"","sources":["../../../src/present/writers/fullscreen.ts"],"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AK,OAAO,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;YACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACzB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnB,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAA,CAAC,sBAAsB;IAC1D,CAAC;IAED,GAAG;QACD,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnD,qCAAqC;QACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7C,CAAC;IAED,KAAK;QACH,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;QAC3B,qEAAqE;QACrE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;QAClB,OAAO,CAAC,CAAA;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RunWriter } from "../../render/diff.js";
|
|
2
|
+
import type { Palette } from "../../render/surface.js";
|
|
3
|
+
export declare class LineDiffWriter implements RunWriter {
|
|
4
|
+
private palette;
|
|
5
|
+
private shadow;
|
|
6
|
+
private printed;
|
|
7
|
+
private rows;
|
|
8
|
+
private baseRow;
|
|
9
|
+
constructor(palette: Palette);
|
|
10
|
+
begin(vp: {
|
|
11
|
+
cols: number;
|
|
12
|
+
rows: number;
|
|
13
|
+
}): void;
|
|
14
|
+
setBaseRow(n: number): void;
|
|
15
|
+
run(row: number, col: number, style: number, text: string): void;
|
|
16
|
+
end(): void;
|
|
17
|
+
private sameRow;
|
|
18
|
+
flush(): string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../src/present/writers/inline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAKtD,qBAAa,cAAe,YAAW,SAAS;IAMlC,OAAO,CAAC,OAAO;IAL3B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,IAAI,CAAI;IAChB,OAAO,CAAC,OAAO,CAAI;gBAEC,OAAO,EAAE,OAAO;IAEpC,KAAK,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAKxC,UAAU,CAAC,CAAC,EAAE,MAAM;IAIpB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAOzD,GAAG;IAIH,OAAO,CAAC,OAAO;IAWf,KAAK,IAAI,MAAM;CAuDhB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ANSI } from "../../ansi.js";
|
|
2
|
+
export class LineDiffWriter {
|
|
3
|
+
palette;
|
|
4
|
+
shadow = new Map();
|
|
5
|
+
printed = new Map(); // canonical content per row
|
|
6
|
+
rows = 0;
|
|
7
|
+
baseRow = 0;
|
|
8
|
+
constructor(palette) {
|
|
9
|
+
this.palette = palette;
|
|
10
|
+
}
|
|
11
|
+
begin(vp) {
|
|
12
|
+
this.rows = vp.rows;
|
|
13
|
+
this.shadow.clear();
|
|
14
|
+
}
|
|
15
|
+
setBaseRow(n) {
|
|
16
|
+
this.baseRow = Math.max(0, n | 0);
|
|
17
|
+
}
|
|
18
|
+
run(row, col, style, text) {
|
|
19
|
+
if (!text)
|
|
20
|
+
return;
|
|
21
|
+
const list = this.shadow.get(row) ?? [];
|
|
22
|
+
list.push({ col, style, text });
|
|
23
|
+
this.shadow.set(row, list);
|
|
24
|
+
}
|
|
25
|
+
end() {
|
|
26
|
+
/* no-op */
|
|
27
|
+
}
|
|
28
|
+
sameRow(a, b) {
|
|
29
|
+
if (!a && !b)
|
|
30
|
+
return true;
|
|
31
|
+
if (!a || !b || a.length !== b.length)
|
|
32
|
+
return false;
|
|
33
|
+
for (let i = 0; i < a.length; i++) {
|
|
34
|
+
const A = a[i], B = b[i];
|
|
35
|
+
if (A.col !== B.col || A.style !== B.style || A.text !== B.text)
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
flush() {
|
|
41
|
+
// Only process rows that the diff reported as changed.
|
|
42
|
+
// Unchanged rows are left intact to avoid accidental clearing.
|
|
43
|
+
const rowsToProcess = Array.from(this.shadow.keys()).sort((a, b) => a - b);
|
|
44
|
+
let out = "";
|
|
45
|
+
for (const row of rowsToProcess) {
|
|
46
|
+
const segs = (this.shadow.get(row) ?? []).sort((a, b) => a.col - b.col);
|
|
47
|
+
const prev = this.printed.get(row);
|
|
48
|
+
if (this.sameRow(prev, segs))
|
|
49
|
+
continue; // nothing changed effectively
|
|
50
|
+
// coalesce adjacent segments with same style (keep this optimization)
|
|
51
|
+
const merged = [];
|
|
52
|
+
for (const s of segs) {
|
|
53
|
+
const last = merged[merged.length - 1];
|
|
54
|
+
if (last && last.style === s.style && last.col + last.text.length === s.col) {
|
|
55
|
+
last.text += s.text;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
merged.push({ ...s });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Move to absolute row (1-based) and place segments in-place.
|
|
62
|
+
// Avoid clearing the entire line; we only overwrite changed cells.
|
|
63
|
+
const termRow1 = this.baseRow + row + 1;
|
|
64
|
+
out += ANSI.cursor.to(termRow1, 1);
|
|
65
|
+
let curStyle = -1;
|
|
66
|
+
for (const s of merged) {
|
|
67
|
+
// Move to column (1-based) within the current row
|
|
68
|
+
out += ANSI.cursor.toCol(s.col + 1);
|
|
69
|
+
if (curStyle !== s.style) {
|
|
70
|
+
out += this.palette.sgr(s.style);
|
|
71
|
+
curStyle = s.style;
|
|
72
|
+
}
|
|
73
|
+
out += s.text;
|
|
74
|
+
}
|
|
75
|
+
if (curStyle !== -1)
|
|
76
|
+
out += ANSI.reset;
|
|
77
|
+
this.printed.set(row, merged);
|
|
78
|
+
}
|
|
79
|
+
// Determine printed height (last row index with any segments + 1)
|
|
80
|
+
let lastRow = -1;
|
|
81
|
+
for (const [r, segs] of this.printed) {
|
|
82
|
+
if (segs.length > 0 && r > lastRow)
|
|
83
|
+
lastRow = r;
|
|
84
|
+
}
|
|
85
|
+
const printedHeight = lastRow + 1;
|
|
86
|
+
// Park cursor at bottom-left of our region (clamped to viewport)
|
|
87
|
+
const parkRow = Math.min(this.rows, Math.max(1, this.baseRow + (printedHeight > 0 ? printedHeight : 1)));
|
|
88
|
+
out += ANSI.cursor.to(parkRow, 1);
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=inline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../../src/present/writers/inline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAIpC,MAAM,OAAO,cAAc;IAML;IALZ,MAAM,GAAG,IAAI,GAAG,EAAiB,CAAA;IACjC,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAA,CAAC,4BAA4B;IAC/D,IAAI,GAAG,CAAC,CAAA;IACR,OAAO,GAAG,C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E,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACxG,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QAEjC,OAAO,GAAG,CAAA;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type Wcwidth = (cp: number) => 0 | 1 | 2;
|
|
2
|
+
export declare const defaultWcwidth: Wcwidth;
|
|
3
|
+
export declare class CellBuffer {
|
|
4
|
+
readonly w: number;
|
|
5
|
+
readonly h: number;
|
|
6
|
+
readonly g: Uint32Array;
|
|
7
|
+
readonly s: Uint32Array;
|
|
8
|
+
readonly cw: Uint8Array;
|
|
9
|
+
private wcwidth;
|
|
10
|
+
private clip;
|
|
11
|
+
private clipStack;
|
|
12
|
+
private offX;
|
|
13
|
+
private offY;
|
|
14
|
+
private offStack;
|
|
15
|
+
constructor(width: number, height: number, wcwidth?: Wcwidth);
|
|
16
|
+
/** Clear the buffer to spaces in the given style. */
|
|
17
|
+
clear(styleId?: number): void;
|
|
18
|
+
/** Draw a single code point at (x,y). If width=2, marks following cell as continuation. */
|
|
19
|
+
drawCP(x: number, y: number, cp: number, styleId?: number): void;
|
|
20
|
+
/** Draw plain text (no wrapping) clipped to width. Uses Intl.Segmenter if available. */
|
|
21
|
+
drawText(x: number, y: number, text: string, styleId?: number, maxWidth?: number): void;
|
|
22
|
+
/** Fill a rectangle with a code point + style. */
|
|
23
|
+
fillRect(x: number, y: number, w: number, h: number, cp?: number, styleId?: number): void;
|
|
24
|
+
pushClip(x: number, y: number, w: number, h: number): void;
|
|
25
|
+
popClip(): void;
|
|
26
|
+
withClip(x: number, y: number, w: number, h: number, fn: () => void): void;
|
|
27
|
+
pushOffset(dx: number, dy: number): void;
|
|
28
|
+
popOffset(): void;
|
|
29
|
+
withOffset(dx: number, dy: number, fn: () => void): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/render/buffer.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAG/C,eAAO,MAAM,cAAc,EAAE,OAAoE,CAAA;AAKjG,qBAAa,UAAU;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAGlB,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAA;IACvB,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAA;IACvB,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAA;IAEvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,IAAI,CAAI;IAChB,OAAO,CAAC,IAAI,CAAI;IAChB,OAAO,CAAC,QAAQ,CAAiC;gBAErC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,OAAwB;IAY5E,qDAAqD;IACrD,KAAK,CAAC,OAAO,SAAI,GAAG,IAAI;IAMxB,2FAA2F;IAC3F,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,IAAI;IAuB3D,wFAAwF;IACxF,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,SAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IA+ClF,kDAAkD;IAClD,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,SAAK,EAAE,OAAO,SAAI,GAAG,IAAI;IAuBhF,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAc1D,OAAO,IAAI,IAAI;IASf,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAU1E,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAMxC,SAAS,IAAI,IAAI;IAWjB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;CAQzD"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/* buffer.ts — 2D cell buffer with drawing, clipping, and offsets */
|
|
2
|
+
// basic ASCII/Latin fallback; plug a real wcwidth for CJK/emoji later
|
|
3
|
+
export const defaultWcwidth = (cp) => (cp === 0 ? 0 : cp < 32 ? 0 : cp === 0x7f ? 0 : 1);
|
|
4
|
+
// Represents a single frame of cells (glyph + style + cell width)
|
|
5
|
+
export class CellBuffer {
|
|
6
|
+
w;
|
|
7
|
+
h;
|
|
8
|
+
// cell data
|
|
9
|
+
g; // glyph code points
|
|
10
|
+
s; // style ids
|
|
11
|
+
cw; // cell width: 0 (continuation), 1, 2
|
|
12
|
+
wcwidth;
|
|
13
|
+
clip;
|
|
14
|
+
clipStack = [];
|
|
15
|
+
offX = 0;
|
|
16
|
+
offY = 0;
|
|
17
|
+
offStack = [];
|
|
18
|
+
constructor(width, height, wcwidth = defaultWcwidth) {
|
|
19
|
+
this.w = Math.max(1, width | 0);
|
|
20
|
+
this.h = Math.max(1, height | 0);
|
|
21
|
+
const n = this.w * this.h;
|
|
22
|
+
this.g = new Uint32Array(n);
|
|
23
|
+
this.s = new Uint32Array(n);
|
|
24
|
+
this.cw = new Uint8Array(n);
|
|
25
|
+
this.wcwidth = wcwidth;
|
|
26
|
+
this.clip = { x: 0, y: 0, w: this.w, h: this.h };
|
|
27
|
+
this.clear(0);
|
|
28
|
+
}
|
|
29
|
+
/** Clear the buffer to spaces in the given style. */
|
|
30
|
+
clear(styleId = 0) {
|
|
31
|
+
this.g.fill(32);
|
|
32
|
+
this.s.fill(styleId);
|
|
33
|
+
this.cw.fill(1);
|
|
34
|
+
}
|
|
35
|
+
/** Draw a single code point at (x,y). If width=2, marks following cell as continuation. */
|
|
36
|
+
drawCP(x, y, cp, styleId = 0) {
|
|
37
|
+
const ax = x + this.offX;
|
|
38
|
+
const ay = y + this.offY;
|
|
39
|
+
if (ax < 0 || ay < 0 || ax >= this.w || ay >= this.h)
|
|
40
|
+
return;
|
|
41
|
+
if (ax < this.clip.x || ay < this.clip.y || ax >= this.clip.x + this.clip.w || ay >= this.clip.y + this.clip.h)
|
|
42
|
+
return;
|
|
43
|
+
const idx = ay * this.w + ax;
|
|
44
|
+
const w = this.wcwidth(cp);
|
|
45
|
+
this.g[idx] = cp;
|
|
46
|
+
this.s[idx] = styleId;
|
|
47
|
+
this.cw[idx] = w === 0 ? 1 : w; // treat nonspacing as width 1 here
|
|
48
|
+
if (w === 2) {
|
|
49
|
+
// mark the continuation cell
|
|
50
|
+
if (x + 1 < this.w) {
|
|
51
|
+
const cidx = idx + 1;
|
|
52
|
+
this.g[cidx] = 0; // not printed
|
|
53
|
+
this.s[cidx] = styleId;
|
|
54
|
+
this.cw[cidx] = 0; // continuation slot
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Draw plain text (no wrapping) clipped to width. Uses Intl.Segmenter if available. */
|
|
59
|
+
drawText(x, y, text, styleId = 0, maxWidth) {
|
|
60
|
+
const ax = x + this.offX;
|
|
61
|
+
const ay = y + this.offY;
|
|
62
|
+
if (ay < 0 || ay >= this.h)
|
|
63
|
+
return;
|
|
64
|
+
// vertical clip
|
|
65
|
+
if (ay < this.clip.y || ay >= this.clip.y + this.clip.h)
|
|
66
|
+
return;
|
|
67
|
+
const limit = Math.min(this.w - ax, maxWidth ?? this.w, this.clip.x + this.clip.w - ax);
|
|
68
|
+
if (limit <= 0)
|
|
69
|
+
return;
|
|
70
|
+
const SegCtor = globalThis.Intl?.Segmenter;
|
|
71
|
+
const seg = typeof SegCtor === "function"
|
|
72
|
+
? new SegCtor(undefined, {
|
|
73
|
+
granularity: "grapheme",
|
|
74
|
+
})
|
|
75
|
+
: null;
|
|
76
|
+
let col = 0;
|
|
77
|
+
if (seg) {
|
|
78
|
+
for (const { segment } of seg.segment(text)) {
|
|
79
|
+
const cp = segment.codePointAt(0) ?? 32; // first code point of grapheme
|
|
80
|
+
const w = this.wcwidth(cp) || 1; // nonspacing combining: treat as 1 (simple path)
|
|
81
|
+
if (col + w > limit)
|
|
82
|
+
break;
|
|
83
|
+
this.drawCP(x + col, y, cp, styleId);
|
|
84
|
+
col += w;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
for (const ch of text) {
|
|
89
|
+
const cp = ch.codePointAt(0) ?? 32;
|
|
90
|
+
const w = this.wcwidth(cp) || 1;
|
|
91
|
+
if (col + w > limit)
|
|
92
|
+
break;
|
|
93
|
+
this.drawCP(x + col, y, cp, styleId);
|
|
94
|
+
col += w;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// pad remainder within the visible limit with spaces in the same style (erases leftovers)
|
|
98
|
+
for (; col < limit; col++) {
|
|
99
|
+
this.drawCP(x + col, y, 32, styleId);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Fill a rectangle with a code point + style. */
|
|
103
|
+
fillRect(x, y, w, h, cp = 32, styleId = 0) {
|
|
104
|
+
const ax = x + this.offX;
|
|
105
|
+
const ay = y + this.offY;
|
|
106
|
+
let x0 = Math.max(0, ax | 0), y0 = Math.max(0, ay | 0);
|
|
107
|
+
let x1 = Math.min(this.w, x0 + Math.max(0, w | 0));
|
|
108
|
+
let y1 = Math.min(this.h, y0 + Math.max(0, h | 0));
|
|
109
|
+
// intersect with current clip
|
|
110
|
+
x0 = Math.max(x0, this.clip.x);
|
|
111
|
+
y0 = Math.max(y0, this.clip.y);
|
|
112
|
+
x1 = Math.min(x1, this.clip.x + this.clip.w);
|
|
113
|
+
y1 = Math.min(y1, this.clip.y + this.clip.h);
|
|
114
|
+
const width = x1 - x0;
|
|
115
|
+
if (width <= 0 || y1 <= y0)
|
|
116
|
+
return;
|
|
117
|
+
for (let yy = y0; yy < y1; yy++) {
|
|
118
|
+
const base = yy * this.w + x0;
|
|
119
|
+
this.g.fill(cp, base, base + width);
|
|
120
|
+
this.s.fill(styleId, base, base + width);
|
|
121
|
+
this.cw.fill(1, base, base + width);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Clipping API
|
|
125
|
+
pushClip(x, y, w, h) {
|
|
126
|
+
const nx = Math.max(0, x | 0);
|
|
127
|
+
const ny = Math.max(0, y | 0);
|
|
128
|
+
const nw = Math.max(0, w | 0);
|
|
129
|
+
const nh = Math.max(0, h | 0);
|
|
130
|
+
const cur = this.clip;
|
|
131
|
+
const ix = Math.max(cur.x, nx);
|
|
132
|
+
const iy = Math.max(cur.y, ny);
|
|
133
|
+
const ix2 = Math.min(cur.x + cur.w, nx + nw);
|
|
134
|
+
const iy2 = Math.min(cur.y + cur.h, ny + nh);
|
|
135
|
+
this.clipStack.push(cur);
|
|
136
|
+
this.clip = { x: ix, y: iy, w: Math.max(0, ix2 - ix), h: Math.max(0, iy2 - iy) };
|
|
137
|
+
}
|
|
138
|
+
popClip() {
|
|
139
|
+
if (this.clipStack.length > 0) {
|
|
140
|
+
const prev = this.clipStack.pop();
|
|
141
|
+
this.clip = prev;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.clip = { x: 0, y: 0, w: this.w, h: this.h };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
withClip(x, y, w, h, fn) {
|
|
148
|
+
this.pushClip(x, y, w, h);
|
|
149
|
+
try {
|
|
150
|
+
fn();
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
this.popClip();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Translation API
|
|
157
|
+
pushOffset(dx, dy) {
|
|
158
|
+
this.offStack.push({ x: this.offX, y: this.offY });
|
|
159
|
+
this.offX += dx | 0;
|
|
160
|
+
this.offY += dy | 0;
|
|
161
|
+
}
|
|
162
|
+
popOffset() {
|
|
163
|
+
if (this.offStack.length > 0) {
|
|
164
|
+
const prev = this.offStack.pop();
|
|
165
|
+
this.offX = prev.x;
|
|
166
|
+
this.offY = prev.y;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.offX = 0;
|
|
170
|
+
this.offY = 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
withOffset(dx, dy, fn) {
|
|
174
|
+
this.pushOffset(dx, dy);
|
|
175
|
+
try {
|
|
176
|
+
fn();
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
this.popOffset();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../src/render/buffer.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAIpE,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAAY,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAA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): number;
|
|
5
|
+
/**
|
|
6
|
+
* Convert a 256-color index to RGB values (approximate xterm palette).
|
|
7
|
+
*
|
|
8
|
+
* The 256-color palette is divided into:
|
|
9
|
+
* - 0-15: Standard ANSI colors (system colors)
|
|
10
|
+
* - 16-231: 6x6x6 RGB cube
|
|
11
|
+
* - 232-255: Grayscale ramp (24 shades)
|
|
12
|
+
*/
|
|
13
|
+
export declare function idxToRGB(idx: number): {
|
|
14
|
+
r: number;
|
|
15
|
+
g: number;
|
|
16
|
+
b: number;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=color-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../src/render/color-utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CA0CzE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// color-utils.ts - Shared color conversion utilities
|
|
2
|
+
/**
|
|
3
|
+
* Clamp a number to the 0-255 range and convert to integer.
|
|
4
|
+
*/
|
|
5
|
+
export function clamp255(n) {
|
|
6
|
+
return n < 0 ? 0 : n > 255 ? 255 : n | 0;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Convert a 256-color index to RGB values (approximate xterm palette).
|
|
10
|
+
*
|
|
11
|
+
* The 256-color palette is divided into:
|
|
12
|
+
* - 0-15: Standard ANSI colors (system colors)
|
|
13
|
+
* - 16-231: 6x6x6 RGB cube
|
|
14
|
+
* - 232-255: Grayscale ramp (24 shades)
|
|
15
|
+
*/
|
|
16
|
+
export function idxToRGB(idx) {
|
|
17
|
+
if (idx < 0)
|
|
18
|
+
idx = 0;
|
|
19
|
+
if (idx > 255)
|
|
20
|
+
idx = 255;
|
|
21
|
+
// Standard ANSI colors (0-15)
|
|
22
|
+
if (idx < 16) {
|
|
23
|
+
const base = [
|
|
24
|
+
[0x00, 0x00, 0x00], // 0: black
|
|
25
|
+
[0x80, 0x00, 0x00], // 1: red
|
|
26
|
+
[0x00, 0x80, 0x00], // 2: green
|
|
27
|
+
[0x80, 0x80, 0x00], // 3: yellow
|
|
28
|
+
[0x00, 0x00, 0x80], // 4: blue
|
|
29
|
+
[0x80, 0x00, 0x80], // 5: magenta
|
|
30
|
+
[0x00, 0x80, 0x80], // 6: cyan
|
|
31
|
+
[0xc0, 0xc0, 0xc0], // 7: white
|
|
32
|
+
[0x80, 0x80, 0x80], // 8: bright black (gray)
|
|
33
|
+
[0xff, 0x00, 0x00], // 9: bright red
|
|
34
|
+
[0x00, 0xff, 0x00], // 10: bright green
|
|
35
|
+
[0xff, 0xff, 0x00], // 11: bright yellow
|
|
36
|
+
[0x00, 0x00, 0xff], // 12: bright blue
|
|
37
|
+
[0xff, 0x00, 0xff], // 13: bright magenta
|
|
38
|
+
[0x00, 0xff, 0xff], // 14: bright cyan
|
|
39
|
+
[0xff, 0xff, 0xff], // 15: bright white
|
|
40
|
+
];
|
|
41
|
+
const [r, g, b] = base[idx] ?? [0, 0, 0];
|
|
42
|
+
return { r, g, b };
|
|
43
|
+
}
|
|
44
|
+
// Grayscale ramp (232-255)
|
|
45
|
+
if (idx >= 232) {
|
|
46
|
+
const n = idx - 232; // 0..23
|
|
47
|
+
const v = 8 + n * 10;
|
|
48
|
+
return { r: v, g: v, b: v };
|
|
49
|
+
}
|
|
50
|
+
// 6x6x6 RGB cube (16-231)
|
|
51
|
+
const n = idx - 16; // 0..215
|
|
52
|
+
const r = Math.floor(n / 36) % 6;
|
|
53
|
+
const g = Math.floor(n / 6) % 6;
|
|
54
|
+
const b = n % 6;
|
|
55
|
+
const steps = [0, 95, 135, 175, 215, 255];
|
|
56
|
+
return { r: steps[r] ?? 0, g: steps[g] ?? 0, b: steps[b] ?? 0 };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=color-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../src/render/color-utils.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAS;IACjC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW;IACnC,IAAI,GAAG,GAAG,CAAC;QAAE,GAAG,GAAG,CAAC,CAAA;IACpB,IAAI,GAAG,GAAG,GAAG;QAAE,GAAG,GAAG,GAAG,CAAA;IAExB,8BAA8B;IAC9B,IAAI,GAAG,GAAG,EAAE,EAAE,CAAC;QACd,MAAM,IAAI,GAAoC;YAC7C,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,WAAW;YAC/B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,SAAS;YAC7B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,WAAW;YAC/B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,YAAY;YAChC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,UAAU;YAC9B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,aAAa;YACjC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,UAAU;YAC9B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,WAAW;YAC/B,CAAC,IAAI,EAAE,IAAI,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CAAA;IAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACf,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACzC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAA;AAChE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Surface } from "./surface.js";
|
|
2
|
+
/**
|
|
3
|
+
* Writer that consumes style runs produced by diffing two frames.
|
|
4
|
+
* - Coordinates are 0-based: `row` in [0..rows), `col` in [0..cols).
|
|
5
|
+
* - `begin` is called once with the viewport size, then `run` zero or more times,
|
|
6
|
+
* then `end`. Implementations may buffer and expose the result via `flush`.
|
|
7
|
+
*/
|
|
8
|
+
export interface RunWriter {
|
|
9
|
+
begin(viewport: {
|
|
10
|
+
cols: number;
|
|
11
|
+
rows: number;
|
|
12
|
+
}): void;
|
|
13
|
+
run(row: number, col: number, styleId: number, text: string): void;
|
|
14
|
+
end(): void;
|
|
15
|
+
flush(): string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Stream a minimal set of style-runs for changes from prev → next.
|
|
19
|
+
*
|
|
20
|
+
* Algorithm (row-wise):
|
|
21
|
+
* - For each row, compute a tight change window [left, right]. Skip entirely if equal.
|
|
22
|
+
* - Within the window, emit contiguous runs grouped by style. A new run begins when:
|
|
23
|
+
* - A cell changes, and
|
|
24
|
+
* - Its style differs from the current run (or the run just started).
|
|
25
|
+
* - Wide glyph continuation cells (cw=0) are skipped so they are not reprinted.
|
|
26
|
+
*
|
|
27
|
+
* Assumes both Surfaces are same size and compares their back buffers (B).
|
|
28
|
+
*/
|
|
29
|
+
export declare function diffFrames(prev: Surface, next: Surface, w: RunWriter): void;
|
|
30
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/render/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACrD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAClE,GAAG,IAAI,IAAI,CAAA;IACX,KAAK,IAAI,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,CAmE3E"}
|