ink 6.1.0 → 6.1.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/build/measure-text.js +5 -4
- package/build/measure-text.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +2 -0
package/build/measure-text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import widestLine from 'widest-line';
|
|
2
|
-
const cache =
|
|
2
|
+
const cache = new Map();
|
|
3
3
|
const measureText = (text) => {
|
|
4
4
|
if (text.length === 0) {
|
|
5
5
|
return {
|
|
@@ -7,14 +7,15 @@ const measureText = (text) => {
|
|
|
7
7
|
height: 0,
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
const cachedDimensions = cache
|
|
10
|
+
const cachedDimensions = cache.get(text);
|
|
11
11
|
if (cachedDimensions) {
|
|
12
12
|
return cachedDimensions;
|
|
13
13
|
}
|
|
14
14
|
const width = widestLine(text);
|
|
15
15
|
const height = text.split('\n').length;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const dimensions = { width, height };
|
|
17
|
+
cache.set(text, dimensions);
|
|
18
|
+
return dimensions;
|
|
18
19
|
};
|
|
19
20
|
export default measureText;
|
|
20
21
|
//# sourceMappingURL=measure-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure-text.js","sourceRoot":"","sources":["../src/measure-text.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"measure-text.js","sourceRoot":"","sources":["../src/measure-text.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AAOxC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE;IAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;YACN,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;SACT,CAAC;IACH,CAAC;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,gBAAgB,EAAE,CAAC;QACtB,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC;IACnC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAE5B,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -120,6 +120,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
|
|
|
120
120
|
- [Sudoku](https://github.com/mrozio13pl/sudoku-in-terminal) - Sudoku game.
|
|
121
121
|
- [Sea Trader](https://github.com/zyishai/sea-trader) - Taipan! inspired trading simulator game.
|
|
122
122
|
- [srtd](https://github.com/t1mmen/srtd) - Live-reloading SQL templates for Supabase projects.
|
|
123
|
+
- [tweakcc](https://github.com/Piebald-AI/tweakcc) - Customize your Claude Code styling.
|
|
123
124
|
|
|
124
125
|
## Contents
|
|
125
126
|
|
|
@@ -2174,6 +2175,7 @@ You can even inspect and change the props of components, and see the results imm
|
|
|
2174
2175
|
- [ink-form](https://github.com/lukasbach/ink-form) - Form.
|
|
2175
2176
|
- [ink-task-list](https://github.com/privatenumber/ink-task-list) - Task list.
|
|
2176
2177
|
- [ink-spawn](https://github.com/kraenhansen/ink-spawn) - Spawn child processes.
|
|
2178
|
+
- [ink-titled-box](https://github.com/mishieck/ink-titled-box) - Box with title.
|
|
2177
2179
|
|
|
2178
2180
|
## Useful Hooks
|
|
2179
2181
|
|