gf-components 0.1.163 → 0.1.164

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/dist/index.es.js CHANGED
@@ -41251,12 +41251,12 @@ const za = 12, d1 = 14, Rs = Bt.tspan`
41251
41251
  /* @__PURE__ */ m.jsx(u, {})
41252
41252
  ] });
41253
41253
  }, P7e = Bt.span`
41254
- font: var(--gf-label-md-default);
41255
- font-size: 14px;
41256
- line-height: 22px;
41257
- font-weight: 400;
41258
- color: var(--gf-color-button-primary);
41259
- transition: color 150ms ease, font-weight 150ms ease;
41254
+ font: var(--gf-label-md-default);
41255
+ font-size: 14px;
41256
+ line-height: 22px;
41257
+ font-weight: 400;
41258
+ color: var(--gf-color-button-primary);
41259
+ transition: color 150ms ease, font-weight 150ms ease;
41260
41260
  `, fhe = ({
41261
41261
  items: e,
41262
41262
  width: t = 226,
@@ -41277,29 +41277,41 @@ const za = 12, d1 = 14, Rs = Bt.tspan`
41277
41277
  window.scrollTo({ top: h, behavior: "smooth" });
41278
41278
  };
41279
41279
  return Ne.useEffect(() => {
41280
- const d = (e || []).map((h, p) => {
41281
- var g;
41282
- return { key: p, el: (g = h.href) == null ? void 0 : g.current };
41283
- }).filter((h) => h.el);
41280
+ const d = (e || []).map((p, g) => {
41281
+ var v;
41282
+ return { key: g, el: (v = p.href) == null ? void 0 : v.current };
41283
+ }).filter((p) => p.el);
41284
41284
  if (!d.length) return;
41285
- const f = new IntersectionObserver(
41286
- (h) => {
41285
+ const f = /* @__PURE__ */ new Map(), h = new IntersectionObserver(
41286
+ (p) => {
41287
41287
  if (s.current) return;
41288
- const p = h.filter((v) => v.isIntersecting).sort((v, b) => v.boundingClientRect.top - b.boundingClientRect.top)[0];
41289
- if (!p) return;
41290
- const g = d.find((v) => v.el === p.target);
41291
- g && g.key !== void 0 && a(g.key);
41288
+ for (const b of p)
41289
+ f.set(b.target, {
41290
+ is: b.isIntersecting,
41291
+ top: b.boundingClientRect.top,
41292
+ ratio: b.intersectionRatio
41293
+ });
41294
+ const g = [];
41295
+ for (const { key: b, el: y } of d) {
41296
+ const x = f.get(y);
41297
+ x != null && x.is && g.push({ key: b, el: y, ...x });
41298
+ }
41299
+ if (!g.length) return;
41300
+ const v = g.sort(
41301
+ (b, y) => Math.abs(b.top - n) - Math.abs(y.top - n) || y.ratio - b.ratio
41302
+ )[0];
41303
+ v && v.key !== o && a(v.key);
41292
41304
  },
41293
41305
  {
41294
41306
  root: null,
41295
- threshold: [0.1, 0.2, 0.3],
41307
+ threshold: [0, 0.01, 0.1, 0.2],
41296
41308
  rootMargin: `-${n}px 0px -${r}% 0px`
41297
41309
  }
41298
41310
  );
41299
- return d.forEach(({ el: h }) => f.observe(h)), () => {
41300
- f.disconnect(), l.current && clearTimeout(l.current);
41311
+ return d.forEach(({ el: p }) => h.observe(p)), () => {
41312
+ h.disconnect(), l.current && clearTimeout(l.current);
41301
41313
  };
41302
- }, [e]), /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
41314
+ }, [e, n, o]), /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
41303
41315
  /* @__PURE__ */ m.jsx($n, {}),
41304
41316
  /* @__PURE__ */ m.jsxs(tn, { align: "stretch", children: [
41305
41317
  /* @__PURE__ */ m.jsxs(