@nuvin/ink 7.5.0-alpha → 7.6.0-alpha
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/build/ansi-tokenizer.js.map +1 -1
- package/build/components/Box.d.ts +95 -0
- package/build/components/Box.js +176 -140
- package/build/components/Box.js.map +1 -1
- package/build/components/Transform.js +1 -1
- package/build/components/Transform.js.map +1 -1
- package/build/components/VLBox.d.ts +87 -0
- package/build/components/VLBox.js +5 -0
- package/build/components/VLBox.js.map +1 -0
- package/build/dom.d.ts +45 -1
- package/build/dom.js +5 -0
- package/build/dom.js.map +1 -1
- package/build/hooks/use-input.js +3 -3
- package/build/hooks/use-input.js.map +1 -1
- package/build/index.d.ts +2 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/ink.d.ts +2 -1
- package/build/ink.js +42 -23
- package/build/ink.js.map +1 -1
- package/build/layout-metadata.d.ts +28 -0
- package/build/layout-metadata.js +302 -0
- package/build/layout-metadata.js.map +1 -0
- package/build/log-update.js +126 -4
- package/build/log-update.js.map +1 -1
- package/build/measure-text.d.ts +1 -1
- package/build/measure-text.js +2 -2
- package/build/measure-text.js.map +1 -1
- package/build/output.d.ts +1 -0
- package/build/output.js +9 -0
- package/build/output.js.map +1 -1
- package/build/reconciler.js +84 -10
- package/build/reconciler.js.map +1 -1
- package/build/render-background.d.ts +2 -2
- package/build/render-background.js +33 -5
- package/build/render-background.js.map +1 -1
- package/build/render-border.d.ts +2 -2
- package/build/render-border.js +78 -34
- package/build/render-border.js.map +1 -1
- package/build/render-node-to-output.d.ts +7 -1
- package/build/render-node-to-output.js +118 -27
- package/build/render-node-to-output.js.map +1 -1
- package/build/render-to-string.js +2 -1
- package/build/render-to-string.js.map +1 -1
- package/build/renderer.d.ts +1 -0
- package/build/renderer.js +10 -2
- package/build/renderer.js.map +1 -1
- package/build/styles.js.map +1 -1
- package/build/wrap-text.d.ts +1 -1
- package/build/wrap-text.js +2 -2
- package/build/wrap-text.js.map +1 -1
- package/package.json +2 -1
- package/readme.md +48 -0
- package/build/reflow.d.ts +0 -12
- package/build/reflow.js +0 -47
- package/build/reflow.js.map +0 -1
package/build/reflow.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import wrapAnsi from 'wrap-ansi';
|
|
2
|
-
/**
|
|
3
|
-
Number of rendered rows a soft-wrapped frame physically occupies on screen.
|
|
4
|
-
|
|
5
|
-
Called on every render whose previous or next frame contains a row wider than
|
|
6
|
-
the terminal (e.g. while a full-width bar is visible), so the count is
|
|
7
|
-
memoized per (row, columns): during a scroll tick almost every row string was
|
|
8
|
-
present in the previous frame at a different position, and wrap-ansi wrapping
|
|
9
|
-
is line-local, making per-row counts composable into the full-frame count.
|
|
10
|
-
*/
|
|
11
|
-
export const REFLOW_ROW_CACHE_MAX = 1024;
|
|
12
|
-
const rowLineCounts = new Map();
|
|
13
|
-
const wrappedRowCount = (row, columns) => {
|
|
14
|
-
const key = `${columns}\u0000${row}`;
|
|
15
|
-
const cached = rowLineCounts.get(key);
|
|
16
|
-
if (cached !== undefined) {
|
|
17
|
-
// LRU touch: re-insert so the key becomes most recently used.
|
|
18
|
-
rowLineCounts.delete(key);
|
|
19
|
-
rowLineCounts.set(key, cached);
|
|
20
|
-
return cached;
|
|
21
|
-
}
|
|
22
|
-
const count = wrapAnsi(row, columns, {
|
|
23
|
-
trim: false,
|
|
24
|
-
hard: true,
|
|
25
|
-
wordWrap: false,
|
|
26
|
-
}).split('\n').length;
|
|
27
|
-
rowLineCounts.set(key, count);
|
|
28
|
-
if (rowLineCounts.size > REFLOW_ROW_CACHE_MAX) {
|
|
29
|
-
const oldestKey = rowLineCounts.keys().next().value;
|
|
30
|
-
if (oldestKey !== undefined) {
|
|
31
|
-
rowLineCounts.delete(oldestKey);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return count;
|
|
35
|
-
};
|
|
36
|
-
export const getReflowedLineCount = (output, columns) => {
|
|
37
|
-
if (output === '') {
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
40
|
-
let lineCount = 0;
|
|
41
|
-
for (const row of output.split('\n')) {
|
|
42
|
-
lineCount += wrappedRowCount(row, columns);
|
|
43
|
-
}
|
|
44
|
-
return lineCount;
|
|
45
|
-
};
|
|
46
|
-
export const getReflowRowCacheSize = () => rowLineCounts.size;
|
|
47
|
-
//# sourceMappingURL=reflow.js.map
|
package/build/reflow.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reflow.js","sourceRoot":"","sources":["../src/reflow.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC;;;;;;;;EAQE;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAEzC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEhD,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,OAAe,EAAU,EAAE;IAChE,MAAM,GAAG,GAAG,GAAG,OAAO,SAAS,GAAG,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,8DAA8D;QAC9D,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE;QACpC,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAEtB,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAE9B,IAAI,aAAa,CAAC,IAAI,GAAG,oBAAoB,EAAE,C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