feat: composer block fits its content, keeps a height the person dragged to

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:23:06 +01:00
1 parent 360d93f589
commit 406f00f0e4
6 files changed
+260 -14

No files matched your search

+24
View File
@@ -64,6 +64,8 @@ export const KEYS = {
history: "ovis-composer.history",
favorites: "ovis-composer.favorites",
usage: "ovis-composer.usage",
/** The height (layout px) the person dragged the composer to; 0 or none: not set. */
userMin: "ovis-composer.userMin",
/** The queue is per agent: `ovis-composer.queue:<agent>`. */
queue: "ovis-composer.queue",
/** The draft is per agent: `ovis-composer.draft:<agent>`. */
@@ -247,6 +249,28 @@ function toDraft(value) {
};
}
/**
* The height the person dragged the composer block to (layout px). 0 is "not
* set"; anything that is not a positive number is not a height.
*
* @param {Store} store
* @returns {number}
*/
export function loadUserMin(store) {
const value = read(store, KEYS.userMin);
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
}
/**
* @param {Store} store
* @param {number} px - 0 clears it; what is not a number is not written
* @returns {void}
*/
export function saveUserMin(store, px) {
if (typeof px !== "number" || !Number.isFinite(px) || px < 0) return;
write(store, KEYS.userMin, Math.round(px));
}
/**
* How often each command was used - the numbers the ranking of the
* suggestions breaks its ties with (`suggest.rank` reads `item.uses`).