@diplodoc/client 2.0.3 → 2.0.5
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/CHANGELOG.md +14 -0
- package/build/client/vendor.css +16 -1
- package/build/client/vendor.css.map +1 -1
- package/build/client/vendor.js +1 -1
- package/build/client/vendor.js.map +1 -1
- package/build/server/vendor.js +33 -29
- package/build/server/vendor.js.map +1 -1
- package/package.json +2 -2
package/build/server/vendor.js
CHANGED
|
@@ -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
|
|
22672
|
-
var
|
|
22673
|
-
var
|
|
22671
|
+
var E = "yfm-tabs", S = "yfm-tab-list", L = "yfm-tab", I = "yfm-tab-panel", m = "active", x = "data-diplodoc-group", h = "data-diplodoc-key", G = "data-diplodoc-id";
|
|
22672
|
+
var v = "defaultTabsGroup-", T = Symbol.for("diplodocTabs");
|
|
22673
|
+
var p = (n) => {
|
|
22674
22674
|
let t = n.composedPath();
|
|
22675
22675
|
return Array.isArray(t) && t.length > 0 ? t[0] : n.target;
|
|
22676
|
-
},
|
|
22677
|
-
let t =
|
|
22676
|
+
}, H = (n) => {
|
|
22677
|
+
let t = p(n);
|
|
22678
22678
|
return !t || !t.matches;
|
|
22679
|
-
},
|
|
22679
|
+
}, u = (n) => Math.abs(n.scrollHeight - n.clientHeight) > 1 ? n : n.parentElement ? u(n.parentElement) : void 0, C = (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
|
|
22683
|
+
var a = { TABS: `.${E}`, TAB_LIST: `.${S}`, TAB: `.${L}`, TAB_PANEL: `.${I}` }, A = class {
|
|
22684
22684
|
constructor(t) {
|
|
22685
22685
|
this._onSelectTabHandlers = /* @__PURE__ */ new Set();
|
|
22686
22686
|
this._document = t, this._document.addEventListener("click", (e) => {
|
|
22687
|
-
let o =
|
|
22688
|
-
if (
|
|
22687
|
+
let o = p(e);
|
|
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(`${
|
|
22700
|
+
let o = this._document.querySelector(`${a.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 &&
|
|
22714
|
-
this.updateHTML({ group: o, key: l }) > 0 && (
|
|
22713
|
+
let s = e && u(e), c = s && C(e, s);
|
|
22714
|
+
this.updateHTML({ group: o, key: l }) > 0 && (c && this.resetScroll(e, s, 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(`${
|
|
22718
|
-
return l.forEach((
|
|
22719
|
-
let g =
|
|
22717
|
+
let { group: e, key: o } = t, l = this._document.querySelectorAll(`${a.TABS}[${x}="${e}"] ${a.TAB}[${h}="${o}"]`), s = 0;
|
|
22718
|
+
return l.forEach((c) => {
|
|
22719
|
+
let g = c;
|
|
22720
22720
|
if (!this.isValidTabElement(g) || g.dataset.diplodocIsActive === "true")
|
|
22721
22721
|
return;
|
|
22722
22722
|
s++;
|
|
22723
|
-
let
|
|
22724
|
-
|
|
22725
|
-
let
|
|
22726
|
-
|
|
22723
|
+
let f = c, i = f.parentNode, d = i == null ? void 0 : i.parentNode, B = Array.from((i == null ? void 0 : i.querySelectorAll(a.TAB)) || []), O = Array.from((d == null ? void 0 : d.children) || []).filter((r) => r.classList.contains(I)), _ = B.indexOf(f);
|
|
22724
|
+
B.forEach((r, y) => {
|
|
22725
|
+
let F = O[y], b = y === _, D = r;
|
|
22726
|
+
D.dataset.diplodocIsActive = b ? "true" : "false", r.classList.toggle(m, b), r.setAttribute("aria-selected", b.toString()), r.setAttribute("tabindex", b ? "-1" : "0"), F.classList.toggle(m, b);
|
|
22727
22727
|
});
|
|
22728
22728
|
}), s;
|
|
22729
22729
|
}
|
|
22730
22730
|
resetScroll(t, e, o) {
|
|
22731
|
-
let l =
|
|
22731
|
+
let l = C(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(
|
|
22736
|
-
this._onSelectTabHandlers.forEach((
|
|
22737
|
-
|
|
22735
|
+
let { group: o, key: l } = t, s = o.startsWith(v) ? { key: l } : t;
|
|
22736
|
+
this._onSelectTabHandlers.forEach((c) => {
|
|
22737
|
+
c({ tab: s, currentTabId: e });
|
|
22738
22738
|
});
|
|
22739
22739
|
}
|
|
22740
22740
|
isValidTabElement(t) {
|
|
22741
|
-
let e = t.matches(
|
|
22742
|
-
return e == null ? void 0 : e.closest(
|
|
22741
|
+
let e = t.matches(a.TAB) && t.dataset.diplodocId ? t.closest(a.TAB_LIST) : null;
|
|
22742
|
+
return e == null ? void 0 : e.closest(a.TABS);
|
|
22743
22743
|
}
|
|
22744
22744
|
getTabDataFromHTMLElement(t) {
|
|
22745
22745
|
var l;
|
|
22746
|
-
let e = t.dataset.diplodocKey, o = (l = t.closest(
|
|
22746
|
+
let e = t.dataset.diplodocKey, o = (l = t.closest(a.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[
|
|
22750
|
+
typeof window != "undefined" && typeof document != "undefined" && !window[T] && (window[T] = 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
|
|
22937
|
-
const
|
|
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(
|