@glasshome/ui 1.31.0 → 1.31.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.31.0",
3
+ "version": "1.31.1",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "keywords": [
6
6
  "components",
@@ -10,6 +10,15 @@ import {
10
10
  } from "solid-js";
11
11
  import { cn } from "../lib/utils.js";
12
12
 
13
+ function samePos(a: Pos, b: Pos): boolean {
14
+ return (
15
+ a.offset === b.offset &&
16
+ a.size === b.size &&
17
+ a.cross === b.cross &&
18
+ a.crossOffset === b.crossOffset
19
+ );
20
+ }
21
+
13
22
  function readTranslate(el: HTMLElement): [number, number] {
14
23
  const t = getComputedStyle(el).translate;
15
24
  if (!t || t === "none") return [0, 0];
@@ -117,6 +126,7 @@ export function SlidingIndicator(props: SlidingIndicatorProps) {
117
126
  let slideTimer: ReturnType<typeof setTimeout> | undefined;
118
127
  const place = (el: HTMLElement, next: Pos) => {
119
128
  const prev = pos();
129
+ if (prev !== null && measuredEl === el && samePos(prev, next)) return;
120
130
  const moved = measuredEl !== undefined && measuredEl !== el && prev !== null;
121
131
  measuredEl = el;
122
132
  if (moved) {
@@ -250,7 +260,9 @@ export function SlidingIndicator(props: SlidingIndicatorProps) {
250
260
  // Attribute-based selection (e.g. Kobalte's [data-selected]/[data-highlighted]):
251
261
  // re-slide when the active child's marker attribute moves, or when items are
252
262
  // added/removed, so newly-mounted items land under the same observer.
253
- const mo = new MutationObserver(() => {
263
+ const mo = new MutationObserver((records) => {
264
+ // Own style writes land in this subtree; Chromium up to 131 reports same-value custom property writes.
265
+ if (records.every((record) => record.attributeName === "style")) return;
254
266
  syncObservedItems();
255
267
  queueMicrotask(measure);
256
268
  });