@celestia-island/hikari 0.55.521 → 0.55.523

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.
@@ -72,11 +72,12 @@
72
72
  * the un-stretched read — the read returns the pin, and a pin at the
73
73
  * row is the no-op again (see `readUnstretchedHeight`); hosts size
74
74
  * the pane, the item's child. (b) The host is BORDER-BOX with no
75
- * padding or border of its own: `offsetHeight` is a border-box figure
76
- * and is written into `height`, which under `box-sizing: content-box`
77
- * is the content box — a padded or bordered `.hk-dswap` would offset
78
- * the tween by its box extra (the docs shell's host is border-box with
79
- * neither, so the target path is exact).
75
+ * padding or border of its own: the reads are `getBoundingClientRect`
76
+ * figures (border-box, fractional) and are written into `height`,
77
+ * which under `box-sizing: content-box` is the content box — a padded
78
+ * or bordered `.hk-dswap` would offset the tween by its box extra
79
+ * (the docs shell's host is border-box with neither, so the target
80
+ * path is exact).
80
81
  */
81
82
 
82
83
  import { defineComponent, onBeforeUnmount, ref, Transition, watch, type PropType, type VNode } from "vue";
@@ -141,13 +142,16 @@ export function resolveSwapDirection(
141
142
  * 240px, stretched and un-stretched both read 240 while the content is
142
143
  * 100). Hosts size the PANE (the item's child); that is where the docs
143
144
  * shell's band-fill lives, and this read runs before its attribute
144
- * exists.
145
+ * exists. The read is the FRACTIONAL layout height
146
+ * (`getBoundingClientRect`), not the integer-rounded `offsetHeight` —
147
+ * the tween then ends exactly where the released `auto` lands, with no
148
+ * sub-pixel step at the release frame.
145
149
  */
146
150
  export function readUnstretchedHeight(item: HTMLElement): number {
147
151
  const prior = item.style.getPropertyValue("align-self");
148
152
  const priority = item.style.getPropertyPriority("align-self");
149
153
  item.style.alignSelf = "start";
150
- const height = item.offsetHeight;
154
+ const height = item.getBoundingClientRect().height;
151
155
  if (prior) item.style.setProperty("align-self", prior, priority);
152
156
  else item.style.removeProperty("align-self");
153
157
  return height;
@@ -244,7 +248,7 @@ export default defineComponent({
244
248
  * the enter hook it is too late: the insertion has already grown
245
249
  * the row to the taller generation (measured live: the host reads
246
250
  * 189 at rest and 200 the instant the taller copy lands). With a
247
- * leaving copy still in the cell the host's `offsetHeight` is the
251
+ * leaving copy still in the cell the host's rect height is the
248
252
  * ROW (the taller copy), not the rendered height — so this read is
249
253
  * only true while the tween is still ARMED (an interrupted exchange
250
254
  * reads its animated mid-state here) or while the cell holds one
@@ -291,16 +295,29 @@ export default defineComponent({
291
295
  // alignment does not move the row (content-sized), so the host
292
296
  // read below is unaffected.
293
297
  const target = readUnstretchedHeight(item);
294
- const from = start ?? host.offsetHeight;
298
+ const from = start ?? host.getBoundingClientRect().height;
295
299
  if (from === 0 || target === 0) return;
296
300
  host.style.height = `${from}px`;
297
301
  // Flush so the frozen height is the transition's computed start
298
302
  // (a same-frame change from auto would jump instead of tween).
299
- void host.offsetHeight;
303
+ void host.getBoundingClientRect().height;
300
304
  armedHost = host;
301
- armedHeight = `${target}px`;
302
305
  host.setAttribute("data-height-anim", "");
303
- host.style.height = armedHeight;
306
+ host.style.height = `${target}px`;
307
+ // Remember what the STORE says our own write is, not what we passed
308
+ // it: a style declaration parses and re-serialises at set time, so
309
+ // `${target}px` need not come back byte-identical (`188.7265625px`
310
+ // reads back as `188.726563px` under happy-dom; a browser's own
311
+ // re-serialisation is whatever it is — the point of reading the
312
+ // value BACK is that this code does not have to know which).
313
+ // The read is SYNCHRONOUS — a declaration list, not a computed
314
+ // style — so no layout or frame is involved. Comparing the release
315
+ // against the read-back puts BOTH sides through the same serialiser:
316
+ // exact, with no tolerance window a host write could hide in. (The
317
+ // synchronous read-back is an engine property, not something a
318
+ // happy-dom pin can prove; the pin below covers the CONSEQUENCE —
319
+ // that our own write is cleared and a host write is not.)
320
+ armedHeight = host.style.height;
304
321
  }
305
322
 
306
323
  /** Release the explicit height back to auto and disarm the
@@ -322,11 +339,26 @@ export default defineComponent({
322
339
  const host = hostRef.value ?? armedHost;
323
340
  if (!host) return;
324
341
  if (!host.hasAttribute("data-height-anim")) return;
342
+ // ORDER IS LOAD-BEARING: the height comes off BEFORE the armed
343
+ // attribute does. `data-height-anim` is what the stylesheet keys the
344
+ // height transition on, and it is also what a host would query to
345
+ // ask "is the tween running?" — leaving the attribute on for one
346
+ // extra statement keeps "armed" and "carries our explicit height"
347
+ // true together, instead of opening a window where the host reads
348
+ // armed=false while the explicit height is still set (R7).
349
+ // Exact compare, against the value the STORE itself reported for our
350
+ // write at arm time (`armedHeight` is read back, not the string we
351
+ // passed): both sides come out of the same serialiser, so whatever
352
+ // the store does to our string cancels instead of making our own
353
+ // write look foreign. (The exact re-serialisation is engine-specific
354
+ // and unmeasured here by design — this code does not depend on it.) Equality is therefore
355
+ // the right test — a tolerance would silently swallow a host's own
356
+ // sub-pixel write. (An unreadable value — `""`, NaN — compares false
357
+ // and the explicit height stays; that branch is unreachable through
358
+ // this component's own hooks, since arming requires both ends
359
+ // non-zero and nothing here writes `height` again.)
360
+ if (host.style.height === armedHeight) host.style.height = "";
325
361
  host.removeAttribute("data-height-anim");
326
- // Compared by value: this component writes integer px (offsetHeight
327
- // is an integer), and a numeric compare is immune to how a browser
328
- // re-serialises either side on read-back.
329
- if (parseFloat(host.style.height) === parseFloat(armedHeight)) host.style.height = "";
330
362
  armedHost = null;
331
363
  armedHeight = "";
332
364
  }
@@ -527,7 +559,7 @@ export default defineComponent({
527
559
  // The last read before the row changes (see `restHeight`):
528
560
  // the rendered height — at rest, or the animated mid-state
529
561
  // of an interrupted tween that is still armed.
530
- if (props.animateHeight && hostRef.value) restHeight = hostRef.value.offsetHeight;
562
+ if (props.animateHeight && hostRef.value) restHeight = hostRef.value.getBoundingClientRect().height;
531
563
  }}
532
564
  onAfterLeave={() => {
533
565
  // Vue removes the leaving copy BEFORE this hook runs, so
@@ -108,9 +108,12 @@ const PROBE_CSS = sass.compileString("@media (min-width: 600px) { .hk-probe { co
108
108
  // happy-dom reports an unset cursor as "" (a browser reports "auto").
109
109
  const isAuto = (value: string): boolean => value === "" || value === "auto";
110
110
 
111
+ // Flush the copy write to a settled state instead of counting microtasks:
112
+ // the copy path now runs through the shared clipboard hub (user direction
113
+ // 2026-12-01), which adds promise hops between the click and the toast —
114
+ // still zero-milliseconds in real time, but more than the old two ticks.
111
115
  async function settle() {
112
- await Promise.resolve();
113
- await Promise.resolve();
116
+ for (let i = 0; i < 10; i++) await Promise.resolve();
114
117
  }
115
118
 
116
119
  function bodyCells(c: HTMLElement): HTMLElement[] {