@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.
@@ -56014,6 +56014,7 @@ const TextAnchor = ({
56014
56014
  lineLayout
56015
56015
  }) => {
56016
56016
  import.meta.css = [css$11, "@jsenv/navi/src/text/text_anchor.jsx"];
56017
+ const fontArrival = fontArrivalSignal.value;
56017
56018
  const anchorRef = useRef();
56018
56019
  // The correction reads the layout, with the other reads of the commit (see
56019
56020
  // layout_batch.js) — an anchor per icon, each measured between two writes,
@@ -56083,7 +56084,7 @@ const TextAnchor = ({
56083
56084
  };
56084
56085
  };
56085
56086
  });
56086
- }, [textAnchor, textKey, textSize, lineLayout?.size, lineLayout?.verticalAlign]);
56087
+ }, [textAnchor, textKey, textSize, lineLayout?.size, lineLayout?.verticalAlign, fontArrival]);
56087
56088
  return jsxs(Fragment, {
56088
56089
  children: [children, jsx("span", {
56089
56090
  ref: anchorRef,
@@ -56164,6 +56165,23 @@ const computeTopOffset = ({
56164
56165
  };
56165
56166
  const charTopCanvas = document.createElement("canvas");
56166
56167
 
56168
+ // Bumped each time the document finishes loading fonts. A correction measured
56169
+ // while a web font is still loading is made of the fallback face's line box,
56170
+ // baseline and capitals, and every one of them moves when the font arrives.
56171
+ // One listener for every anchor, held while one is mounted: the anchors re-render
56172
+ // together and their reads join the same layout round.
56173
+ const onFontsLoaded = () => {
56174
+ fontArrivalSignal.value++;
56175
+ };
56176
+ const fontArrivalSignal = /*#__PURE__*/signal(0, {
56177
+ watched: () => {
56178
+ document.fonts.addEventListener("loadingdone", onFontsLoaded);
56179
+ },
56180
+ unwatched: () => {
56181
+ document.fonts.removeEventListener("loadingdone", onFontsLoaded);
56182
+ }
56183
+ });
56184
+
56167
56185
  const useInitialTextSelection = (ref, textSelection) => {
56168
56186
  const deps = [];
56169
56187
  if (Array.isArray(textSelection)) {