@human-kit/ui 1.2.0 → 1.2.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.
@@ -208,6 +208,27 @@ export function createTableContext(options = {}) {
208
208
  });
209
209
  }
210
210
  }
211
+ /**
212
+ * The body's rows changed (one added, one removed, the order of the items), and nothing about
213
+ * the columns did. Only the caches built from the rows go, so their aria indexes and the
214
+ * navigation are worked out again; the column layout and the widths stay.
215
+ *
216
+ * `notifyLayout` threw those away too, and the next read of a width re-measured the table:
217
+ * a `getBoundingClientRect` that forced a synchronous layout of every row on each line added
218
+ * to an editable sheet, which grew with the sheet. The container's own size still reaches the
219
+ * widths through `refreshMeasuredLayout`, which the root's `ResizeObserver` calls — including
220
+ * when a vertical scrollbar appears because the rows outgrew the box.
221
+ */
222
+ function notifyBodyLayout() {
223
+ invalidateBodyStructureCaches();
224
+ if (!layoutNotifyScheduled) {
225
+ layoutNotifyScheduled = true;
226
+ queueMicrotask(() => {
227
+ layoutNotifyScheduled = false;
228
+ layoutEpoch += 1;
229
+ });
230
+ }
231
+ }
211
232
  function notifySelection() {
212
233
  if (!selectionNotifyScheduled) {
213
234
  selectionNotifyScheduled = true;
@@ -1277,7 +1298,7 @@ export function createTableContext(options = {}) {
1277
1298
  logicalBodyRowIds = nextIds;
1278
1299
  logicalBodyRowIndexCache = null;
1279
1300
  pruneRegisteredSectionRowKeys();
1280
- notifyLayout();
1301
+ notifyBodyLayout();
1281
1302
  notifySelection();
1282
1303
  }
1283
1304
  /**
@@ -1400,7 +1421,10 @@ export function createTableContext(options = {}) {
1400
1421
  if (!logicalBodyRowIds)
1401
1422
  return -1;
1402
1423
  if (!logicalBodyRowIndexCache) {
1403
- logicalBodyRowIndexCache = new SvelteMap();
1424
+ // A plain map: a cache rebuilt when the rows change and read through `layoutEpoch`,
1425
+ // like the other layout caches. Reactive, it set up a signal per row on every rebuild.
1426
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity -- epoch-driven cache, not state.
1427
+ logicalBodyRowIndexCache = new Map();
1404
1428
  for (let index = 0; index < logicalBodyRowIds.length; index += 1) {
1405
1429
  const rowId = logicalBodyRowIds[index];
1406
1430
  if (!logicalBodyRowIndexCache.has(rowId)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@human-kit/ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Accessible, typed UI components for Svelte 5 — shipped as native ESM with per-component subpath exports so bundlers only include what you import.",
5
5
  "license": "MIT",
6
6
  "author": "Agustin Delgado <agustindariodelgado@gmail.com>",