@diplodoc/client 3.7.3 → 3.8.1
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 +20 -0
- package/build/client/app.js +1 -1
- package/build/client/app.js.map +1 -1
- package/build/client/react.js +1 -1
- package/build/client/react.js.LICENSE.txt +0 -20
- package/build/client/react.js.map +1 -1
- package/build/client/search.js +1 -1
- package/build/client/search.js.map +1 -1
- package/build/client/vendor.js +1 -1
- package/build/client/vendor.js.map +1 -1
- package/build/components/App/index.d.ts +3 -2
- package/build/server/app.js +59 -5
- package/build/server/app.js.map +1 -1
- package/build/server/vendor.js +316 -917
- package/build/server/vendor.js.map +1 -1
- package/build/utils.d.ts +12 -1
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { NavigationData, PageContent } from '@gravity-ui/page-constructor';
|
|
2
2
|
import type { SearchConfig } from '../Search';
|
|
3
3
|
import type { RouterConfig } from '../Router';
|
|
4
|
-
import { ReactElement } from 'react';
|
|
5
|
-
import { DocContentPageData as DocContentPageDataBase, DocLeadingPageData, DocPageData
|
|
4
|
+
import type { ReactElement } from 'react';
|
|
5
|
+
import type { DocContentPageData as DocContentPageDataBase, DocLeadingPageData, DocPageData } from '@diplodoc/components';
|
|
6
|
+
import { Lang } from '@diplodoc/components';
|
|
6
7
|
import '@diplodoc/transform/dist/js/yfm';
|
|
7
8
|
import '../../interceptors/leading-page-links';
|
|
8
9
|
import './App.scss';
|
package/build/server/app.js
CHANGED
|
@@ -918,6 +918,7 @@ var LINK_KEYS = toConsumableArray_default()(new Set([].concat(LINK_KEYS_LEADING_
|
|
|
918
918
|
;// ./src/utils.ts
|
|
919
919
|
|
|
920
920
|
|
|
921
|
+
|
|
921
922
|
function isBrowser() {
|
|
922
923
|
return typeof document !== 'undefined';
|
|
923
924
|
}
|
|
@@ -1012,6 +1013,58 @@ function setSetting(name, value) {
|
|
|
1012
1013
|
sessionStorage.setItem(name, String(value));
|
|
1013
1014
|
} catch (_unused2) {}
|
|
1014
1015
|
}
|
|
1016
|
+
function isHeaderTag(el) {
|
|
1017
|
+
if (!el) return false;
|
|
1018
|
+
return ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'].indexOf(el.tagName) !== -1;
|
|
1019
|
+
}
|
|
1020
|
+
function isCutTag(el) {
|
|
1021
|
+
if (!el) return false;
|
|
1022
|
+
return el.matches('.yfm-cut');
|
|
1023
|
+
}
|
|
1024
|
+
function focusActiveTab(cutNode) {
|
|
1025
|
+
cutNode.classList.toggle('open');
|
|
1026
|
+
cutNode.setAttribute('open', 'true');
|
|
1027
|
+
cutNode.classList.add('cut-highlight');
|
|
1028
|
+
cutNode.scrollIntoView(true);
|
|
1029
|
+
window.scrollBy(0, -100);
|
|
1030
|
+
setTimeout(function () {
|
|
1031
|
+
cutNode.classList.remove('cut-highlight');
|
|
1032
|
+
}, 1000);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Scrolls to the element.
|
|
1037
|
+
* If the element is a heading - simply scrolls to it, since needed offset is already in css.
|
|
1038
|
+
* If the element is of any other type - calculate the offset form the element position in heading and scroll to it.
|
|
1039
|
+
* @param {HTMLElement} el
|
|
1040
|
+
*/
|
|
1041
|
+
|
|
1042
|
+
function scrollToElement(el) {
|
|
1043
|
+
if (!el) return;
|
|
1044
|
+
if (isHeaderTag(el)) {
|
|
1045
|
+
// Header already includes the offset in css
|
|
1046
|
+
// That puts it where we want it when it's scrolled to
|
|
1047
|
+
el.scrollIntoView();
|
|
1048
|
+
} else if (isCutTag(el)) {
|
|
1049
|
+
focusActiveTab(el);
|
|
1050
|
+
} else {
|
|
1051
|
+
var _header$clientHeight;
|
|
1052
|
+
// For elements other than headers calculate the offset
|
|
1053
|
+
var _ref2 = Array.from(document.getElementsByClassName('Layout__header')),
|
|
1054
|
+
_ref3 = slicedToArray_default()(_ref2, 1),
|
|
1055
|
+
header = _ref3[0];
|
|
1056
|
+
var headerOffset = (_header$clientHeight = header === null || header === void 0 ? void 0 : header.clientHeight) !== null && _header$clientHeight !== void 0 ? _header$clientHeight : 0;
|
|
1057
|
+
var anchorPosition = el.offsetTop;
|
|
1058
|
+
window.scrollTo(0, anchorPosition - headerOffset);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function scrollToHash() {
|
|
1062
|
+
var hash = window.location.hash.substring(1);
|
|
1063
|
+
if (hash) {
|
|
1064
|
+
var element = document.getElementById(hash);
|
|
1065
|
+
scrollToElement(element);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1015
1068
|
// EXTERNAL MODULE: ./src/interceptors/leading-page-links.js
|
|
1016
1069
|
var leading_page_links = __webpack_require__(44186);
|
|
1017
1070
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
@@ -1561,8 +1614,8 @@ function useMobile() {
|
|
|
1561
1614
|
}, [onResizeHandler]);
|
|
1562
1615
|
return mobileView;
|
|
1563
1616
|
}
|
|
1564
|
-
// EXTERNAL MODULE: ./node_modules/@diplodoc/mdx-extension/build/esm/
|
|
1565
|
-
var
|
|
1617
|
+
// EXTERNAL MODULE: ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/useMdxSsr.js + 8 modules
|
|
1618
|
+
var useMdxSsr = __webpack_require__(91353);
|
|
1566
1619
|
;// ./src/components/App/withMdxInit.tsx
|
|
1567
1620
|
|
|
1568
1621
|
function withMdxInit_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -1583,16 +1636,16 @@ var withMdxInit = function withMdxInit(_ref) {
|
|
|
1583
1636
|
refCtr.current = v;
|
|
1584
1637
|
return forwardRef(v);
|
|
1585
1638
|
}, [forwardRef]);
|
|
1586
|
-
(0,
|
|
1639
|
+
var node = (0,useMdxSsr/* default */.A)({
|
|
1587
1640
|
refCtr: refCtr,
|
|
1588
1641
|
components: components,
|
|
1589
1642
|
pureComponents: pureComponents,
|
|
1590
1643
|
mdxArtifacts: mdxArtifacts,
|
|
1591
1644
|
html: html
|
|
1592
1645
|
});
|
|
1593
|
-
return /*#__PURE__*/react.createElement(Component, withMdxInit_objectSpread(withMdxInit_objectSpread({}, props), {}, {
|
|
1646
|
+
return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(Component, withMdxInit_objectSpread(withMdxInit_objectSpread({}, props), {}, {
|
|
1594
1647
|
forwardRef: forwardRefWrap
|
|
1595
|
-
}));
|
|
1648
|
+
})), node);
|
|
1596
1649
|
};
|
|
1597
1650
|
};
|
|
1598
1651
|
return withMdx;
|
|
@@ -1681,6 +1734,7 @@ function App(props) {
|
|
|
1681
1734
|
updateThemeClassName({
|
|
1682
1735
|
theme: theme
|
|
1683
1736
|
});
|
|
1737
|
+
scrollToHash();
|
|
1684
1738
|
}, [theme, mobileView, wideFormat, fullScreen, landingPage]);
|
|
1685
1739
|
return /*#__PURE__*/react.createElement("div", {
|
|
1686
1740
|
className: "App"
|