@celestia-island/hikari 0.31.1 → 0.31.2
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/package.json
CHANGED
|
@@ -54,15 +54,20 @@ export default defineComponent({
|
|
|
54
54
|
const listRef = ref<HTMLDivElement | null>(null);
|
|
55
55
|
|
|
56
56
|
/** Measure the widest label text and publish it as the label-column
|
|
57
|
-
* width custom property.
|
|
58
|
-
* while
|
|
59
|
-
*
|
|
57
|
+
* width custom property. Each span is momentarily set to
|
|
58
|
+
* `max-content` while reading: a plain `scrollWidth` on the fixed
|
|
59
|
+
* column would report `max(textWidth, columnWidth)` and the column
|
|
60
|
+
* could never shrink below its fallback. All reads happen inside one
|
|
61
|
+
* synchronous task, so no intermediate paint is observable. */
|
|
60
62
|
function measure() {
|
|
61
63
|
const root = listRef.value;
|
|
62
64
|
if (!root) return;
|
|
63
65
|
let widest = 0;
|
|
64
66
|
for (const label of root.querySelectorAll<HTMLElement>(".s-auth-methods-label")) {
|
|
67
|
+
const previous = label.style.width;
|
|
68
|
+
label.style.width = "max-content";
|
|
65
69
|
widest = Math.max(widest, label.scrollWidth);
|
|
70
|
+
label.style.width = previous;
|
|
66
71
|
}
|
|
67
72
|
if (widest > 0) root.style.setProperty("--auth-methods-label-width", `${widest}px`);
|
|
68
73
|
}
|