@jsenv/navi 0.30.12 → 0.30.13

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.
@@ -54483,6 +54483,7 @@ const TextAnchor = ({
54483
54483
  lineLayout
54484
54484
  }) => {
54485
54485
  import.meta.css = [css$11, "@jsenv/navi/src/text/text_anchor.jsx"];
54486
+ const fontArrival = fontArrivalSignal.value;
54486
54487
  const anchorRef = useRef();
54487
54488
  // The correction reads the layout, with the other reads of the commit (see
54488
54489
  // layout_batch.js) — an anchor per icon, each measured between two writes,
@@ -54552,7 +54553,7 @@ const TextAnchor = ({
54552
54553
  };
54553
54554
  };
54554
54555
  });
54555
- }, [textAnchor, textKey, textSize, lineLayout?.size, lineLayout?.verticalAlign]);
54556
+ }, [textAnchor, textKey, textSize, lineLayout?.size, lineLayout?.verticalAlign, fontArrival]);
54556
54557
  return jsxs(Fragment, {
54557
54558
  children: [children, jsx("span", {
54558
54559
  ref: anchorRef,
@@ -54633,6 +54634,23 @@ const computeTopOffset = ({
54633
54634
  };
54634
54635
  const charTopCanvas = document.createElement("canvas");
54635
54636
 
54637
+ // Bumped each time the document finishes loading fonts. A correction measured
54638
+ // while a web font is still loading is made of the fallback face's line box,
54639
+ // baseline and capitals, and every one of them moves when the font arrives.
54640
+ // One listener for every anchor, held while one is mounted: the anchors re-render
54641
+ // together and their reads join the same layout round.
54642
+ const onFontsLoaded = () => {
54643
+ fontArrivalSignal.value++;
54644
+ };
54645
+ const fontArrivalSignal = /*#__PURE__*/signal(0, {
54646
+ watched: () => {
54647
+ document.fonts.addEventListener("loadingdone", onFontsLoaded);
54648
+ },
54649
+ unwatched: () => {
54650
+ document.fonts.removeEventListener("loadingdone", onFontsLoaded);
54651
+ }
54652
+ });
54653
+
54636
54654
  const useInitialTextSelection = (ref, textSelection) => {
54637
54655
  const deps = [];
54638
54656
  if (Array.isArray(textSelection)) {