@diplodoc/client 2.0.3 → 2.0.4

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.
@@ -22668,24 +22668,24 @@ bem-cn/lib/index.js:
22668
22668
 
22669
22669
  // node_modules/@diplodoc/tabs-extension/runtime/index.js
22670
22670
  (() => {
22671
- var y = "yfm-tabs", E = "yfm-tab-list", S = "yfm-tab", L = "yfm-tab-panel", I = "active", G = "data-diplodoc-group", x = "data-diplodoc-key", h = "data-diplodoc-id";
22672
- var H = "defaultTabsGroup-", m = Symbol.for("diplodocTabs");
22671
+ var y = "yfm-tabs", E = "yfm-tab-list", S = "yfm-tab", L = "yfm-tab-panel", I = "active", x = "data-diplodoc-group", h = "data-diplodoc-key", G = "data-diplodoc-id";
22672
+ var v = "defaultTabsGroup-", m = Symbol.for("diplodocTabs");
22673
22673
  var T = (n) => {
22674
22674
  let t = n.composedPath();
22675
22675
  return Array.isArray(t) && t.length > 0 ? t[0] : n.target;
22676
- }, _ = (n) => {
22676
+ }, H = (n) => {
22677
22677
  let t = T(n);
22678
22678
  return !t || !t.matches;
22679
22679
  }, p = (n) => Math.abs(n.scrollHeight - n.clientHeight) > 1 ? n : n.parentElement ? p(n.parentElement) : void 0, u = (n, t) => {
22680
22680
  let e = n.getBoundingClientRect(), o = t.getBoundingClientRect();
22681
22681
  return { top: e.top - o.top, left: e.left - o.left };
22682
22682
  };
22683
- var c = { TABS: `.${y}`, TAB_LIST: `.${E}`, TAB: `.${S}`, TAB_PANEL: `.${L}` }, b = class {
22683
+ var s = { TABS: `.${y}`, TAB_LIST: `.${E}`, TAB: `.${S}`, TAB_PANEL: `.${L}` }, A = class {
22684
22684
  constructor(t) {
22685
22685
  this._onSelectTabHandlers = /* @__PURE__ */ new Set();
22686
22686
  this._document = t, this._document.addEventListener("click", (e) => {
22687
22687
  let o = T(e);
22688
- if (_(e) || !this.isValidTabElement(o))
22688
+ if (H(e) || !this.isValidTabElement(o))
22689
22689
  return;
22690
22690
  let l = this.getTabDataFromHTMLElement(o);
22691
22691
  l && this._selectTab(l, o);
@@ -22697,7 +22697,7 @@ bem-cn/lib/index.js:
22697
22697
  };
22698
22698
  }
22699
22699
  selectTabById(t, e) {
22700
- let o = this._document.querySelector(`${c.TAB}[${h}="${t}"]`);
22700
+ let o = this._document.querySelector(`${s.TAB}[${G}="${t}"]`);
22701
22701
  if (!o || !this.isValidTabElement(o))
22702
22702
  return;
22703
22703
  let l = this.getTabDataFromHTMLElement(o);
@@ -22710,44 +22710,44 @@ bem-cn/lib/index.js:
22710
22710
  let { group: o, key: l } = t;
22711
22711
  if (!o)
22712
22712
  return;
22713
- let s = e && p(e), a = s && u(e, s);
22714
- this.updateHTML({ group: o, key: l }) > 0 && (a && this.resetScroll(e, s, a), this.fireSelectTabEvent({ group: o, key: l }, e == null ? void 0 : e.dataset.diplodocId));
22713
+ let a = e && p(e), c = a && u(e, a);
22714
+ this.updateHTML({ group: o, key: l }) > 0 && (c && this.resetScroll(e, a, c), this.fireSelectTabEvent({ group: o, key: l }, e == null ? void 0 : e.dataset.diplodocId));
22715
22715
  }
22716
22716
  updateHTML(t) {
22717
- let { group: e, key: o } = t, l = this._document.querySelectorAll(`${c.TABS}[${G}="${e}"] ${c.TAB}[${x}="${o}"]`), s = 0;
22718
- return l.forEach((a) => {
22719
- let g = a;
22717
+ let { group: e, key: o } = t, l = this._document.querySelectorAll(`${s.TABS}[${x}="${e}"] ${s.TAB}[${h}="${o}"]`), a = 0;
22718
+ return l.forEach((c) => {
22719
+ let g = c;
22720
22720
  if (!this.isValidTabElement(g) || g.dataset.diplodocIsActive === "true")
22721
22721
  return;
22722
- s++;
22723
- let C = a, d = C.parentNode, i = d == null ? void 0 : d.parentNode, f = Array.from((i == null ? void 0 : i.querySelectorAll(c.TAB)) || []), v = Array.from((i == null ? void 0 : i.querySelectorAll(c.TAB_PANEL)) || []), D = f.indexOf(C);
22724
- f.forEach((A, B) => {
22725
- let O = v[B], r = B === D, F = A;
22726
- F.dataset.diplodocIsActive = r ? "true" : "false", A.classList.toggle(I, r), A.setAttribute("aria-selected", r.toString()), A.setAttribute("tabindex", r ? "-1" : "0"), O.classList.toggle(I, r);
22722
+ a++;
22723
+ let C = c, r = C.parentNode, d = r == null ? void 0 : r.parentNode, f = Array.from((r == null ? void 0 : r.querySelectorAll(">" + s.TAB)) || []), _ = Array.from((d == null ? void 0 : d.querySelectorAll(">" + s.TAB_PANEL)) || []), O = f.indexOf(C);
22724
+ f.forEach((b, B) => {
22725
+ let F = _[B], i = B === O, D = b;
22726
+ D.dataset.diplodocIsActive = i ? "true" : "false", b.classList.toggle(I, i), b.setAttribute("aria-selected", i.toString()), b.setAttribute("tabindex", i ? "-1" : "0"), F.classList.toggle(I, i);
22727
22727
  });
22728
- }), s;
22728
+ }), a;
22729
22729
  }
22730
22730
  resetScroll(t, e, o) {
22731
22731
  let l = u(t, e);
22732
22732
  e.scrollTo(l.left + e.scrollLeft - o.left, l.top + e.scrollTop - o.top);
22733
22733
  }
22734
22734
  fireSelectTabEvent(t, e) {
22735
- let { group: o, key: l } = t, s = o.startsWith(H) ? { key: l } : t;
22736
- this._onSelectTabHandlers.forEach((a) => {
22737
- a({ tab: s, currentTabId: e });
22735
+ let { group: o, key: l } = t, a = o.startsWith(v) ? { key: l } : t;
22736
+ this._onSelectTabHandlers.forEach((c) => {
22737
+ c({ tab: a, currentTabId: e });
22738
22738
  });
22739
22739
  }
22740
22740
  isValidTabElement(t) {
22741
- let e = t.matches(c.TAB) && t.dataset.diplodocId ? t.closest(c.TAB_LIST) : null;
22742
- return e == null ? void 0 : e.closest(c.TABS);
22741
+ let e = t.matches(s.TAB) && t.dataset.diplodocId ? t.closest(s.TAB_LIST) : null;
22742
+ return e == null ? void 0 : e.closest(s.TABS);
22743
22743
  }
22744
22744
  getTabDataFromHTMLElement(t) {
22745
22745
  var l;
22746
- let e = t.dataset.diplodocKey, o = (l = t.closest(c.TABS)) == null ? void 0 : l.dataset.diplodocGroup;
22746
+ let e = t.dataset.diplodocKey, o = (l = t.closest(s.TABS)) == null ? void 0 : l.dataset.diplodocGroup;
22747
22747
  return e && o ? { group: o, key: e } : null;
22748
22748
  }
22749
22749
  };
22750
- typeof window != "undefined" && typeof document != "undefined" && !window[m] && (window[m] = new b(document));
22750
+ typeof window != "undefined" && typeof document != "undefined" && !window[m] && (window[m] = new A(document));
22751
22751
  })();
22752
22752
 
22753
22753
  // src/js/polyfill.js
@@ -22933,8 +22933,12 @@ bem-cn/lib/index.js:
22933
22933
  }
22934
22934
  const { width: definitionWidth } = definitionElement.getBoundingClientRect();
22935
22935
  const { left: definitionParentLeft } = definitionParent.getBoundingClientRect();
22936
- const definitionRightCoordinate = definitionWidth + Number(getCoords(termElement).left);
22937
- const fitDefinitionDocument = document.body.clientWidth > definitionRightCoordinate ? 0 : definitionWidth - termWidth;
22936
+ const definitionLeftCoordinate = Number(getCoords(termElement).left);
22937
+ const definitionRightCoordinate = definitionWidth + definitionLeftCoordinate;
22938
+ const definitionOutOfScreenOnLeft = definitionLeftCoordinate - definitionWidth < 0;
22939
+ const definitionOutOfScreenOnRight = definitionRightCoordinate > document.body.clientWidth;
22940
+ const isAlignSwapped = definitionOutOfScreenOnRight || document.dir === "rtl";
22941
+ const fitDefinitionDocument = isAlignSwapped && !definitionOutOfScreenOnLeft ? definitionWidth - termWidth : 0;
22938
22942
  const customHeaderTop = getCoords(definitionParent).top - definitionParent.offsetTop;
22939
22943
  definitionElement.style.top = Number(getCoords(termElement).top + offsetTop - customHeaderTop) + "px";
22940
22944
  definitionElement.style.left = Number(