@diplodoc/client 3.1.0 → 3.1.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 +10 -0
- package/build/client/app.css +2 -2
- package/build/client/app.css.map +1 -1
- package/build/client/app.js +1 -1
- package/build/client/app.js.map +1 -1
- package/build/client/app.rtl.css +2 -2
- package/build/client/vendor.css +1 -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/client/vendor.rtl.css +1 -1
- package/build/server/app.js +19 -2
- package/build/server/app.js.map +1 -1
- package/build/server/vendor.js +52 -39
- package/build/server/vendor.js.map +1 -1
- package/package.json +2 -2
package/build/server/vendor.js
CHANGED
|
@@ -4649,12 +4649,12 @@ var node_modules_langs = __webpack_require__(96854);
|
|
|
4649
4649
|
var langs_default = /*#__PURE__*/__webpack_require__.n(node_modules_langs);
|
|
4650
4650
|
// EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/constants.js
|
|
4651
4651
|
var constants = __webpack_require__(81836);
|
|
4652
|
-
// EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/models/index.js
|
|
4653
|
-
var esm_models = __webpack_require__(78184);
|
|
4654
4652
|
// EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/components/Controls/ControlsLayout.js
|
|
4655
4653
|
var ControlsLayout = __webpack_require__(26141);
|
|
4656
4654
|
// EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/hooks/useTranslation.js + 2 modules
|
|
4657
4655
|
var useTranslation = __webpack_require__(86395);
|
|
4656
|
+
// EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/models/index.js
|
|
4657
|
+
var esm_models = __webpack_require__(78184);
|
|
4658
4658
|
// EXTERNAL MODULE: ./node_modules/@gravity-ui/icons/esm/ChevronDown.js
|
|
4659
4659
|
var ChevronDown = __webpack_require__(88786);
|
|
4660
4660
|
// EXTERNAL MODULE: ./node_modules/@gravity-ui/uikit/build/esm/components/Button/Button.js + 2 modules
|
|
@@ -5245,6 +5245,8 @@ var MobileControl_default = MobileControl;
|
|
|
5245
5245
|
|
|
5246
5246
|
|
|
5247
5247
|
|
|
5248
|
+
|
|
5249
|
+
|
|
5248
5250
|
var MobileControls_b = (0,lib/* default */.A)("dc-mobile-controls");
|
|
5249
5251
|
var useLangControl = (t, lang, langs, onChangeLang) => {
|
|
5250
5252
|
const langItems = (0,react.useMemo)(() => {
|
|
@@ -10041,6 +10043,8 @@ var Scrollspy = class extends react.Component {
|
|
|
10041
10043
|
Scrollspy_publicField(this, "containerRef", react.createRef());
|
|
10042
10044
|
Scrollspy_publicField(this, "itemRefs", this.props.items.map(() => react.createRef()));
|
|
10043
10045
|
Scrollspy_publicField(this, "scrollByClick");
|
|
10046
|
+
Scrollspy_publicField(this, "prevOffset");
|
|
10047
|
+
Scrollspy_publicField(this, "hasActiveHash");
|
|
10044
10048
|
Scrollspy_publicField(this, "firstItemIndexInView");
|
|
10045
10049
|
Scrollspy_publicField(this, "lastItemIndexInView");
|
|
10046
10050
|
Scrollspy_publicField(this, "overflowChecked");
|
|
@@ -10118,6 +10122,8 @@ var Scrollspy = class extends react.Component {
|
|
|
10118
10122
|
};
|
|
10119
10123
|
this.overflowChecked = false;
|
|
10120
10124
|
this.scrollByClick = false;
|
|
10125
|
+
this.prevOffset = 0;
|
|
10126
|
+
this.hasActiveHash = false;
|
|
10121
10127
|
this.firstItemIndexInView = -1;
|
|
10122
10128
|
this.lastItemIndexInView = -1;
|
|
10123
10129
|
}
|
|
@@ -10239,48 +10245,55 @@ var Scrollspy = class extends react.Component {
|
|
|
10239
10245
|
const { targetItems, inViewState } = this.state;
|
|
10240
10246
|
const { headerHeight } = this.props;
|
|
10241
10247
|
const currentOffset = window.pageYOffset;
|
|
10242
|
-
const
|
|
10243
|
-
|
|
10244
|
-
const pureHash = hash
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
if (
|
|
10253
|
-
|
|
10254
|
-
isOneActive = true;
|
|
10255
|
-
} else {
|
|
10256
|
-
visibleItemOffset.push(false);
|
|
10257
|
-
}
|
|
10258
|
-
} else if (isVisibleItem) {
|
|
10259
|
-
if (visibleItemOffset[index - 1]) {
|
|
10260
|
-
visibleItemOffset[index - 1] = false;
|
|
10248
|
+
const isScrollUp = currentOffset < this.prevOffset;
|
|
10249
|
+
this.prevOffset = currentOffset;
|
|
10250
|
+
const pureHash = (hash == null ? void 0 : hash.startsWith("#")) ? hash.substring(1) : hash;
|
|
10251
|
+
let newActiveIndex;
|
|
10252
|
+
if (pureHash) {
|
|
10253
|
+
newActiveIndex = targetItems.findIndex(
|
|
10254
|
+
(item) => item && item.getAttribute("id") === pureHash
|
|
10255
|
+
);
|
|
10256
|
+
} else {
|
|
10257
|
+
newActiveIndex = targetItems.reduce((res, item, index) => {
|
|
10258
|
+
if (!item) {
|
|
10259
|
+
return res;
|
|
10261
10260
|
}
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
}
|
|
10265
|
-
|
|
10261
|
+
const isScrolledPast = item.getBoundingClientRect().top < headerHeight + 1;
|
|
10262
|
+
return isScrolledPast ? index : res;
|
|
10263
|
+
}, -1);
|
|
10264
|
+
}
|
|
10265
|
+
if (targetItems.length && newActiveIndex === -1) {
|
|
10266
|
+
newActiveIndex = 0;
|
|
10267
|
+
}
|
|
10268
|
+
if (newActiveIndex === -1) {
|
|
10269
|
+
return inViewState;
|
|
10270
|
+
}
|
|
10271
|
+
const prevActiveIndex = inViewState.findIndex(Boolean);
|
|
10272
|
+
const getNewInViewState = () => {
|
|
10273
|
+
if (newActiveIndex === prevActiveIndex) {
|
|
10274
|
+
return inViewState;
|
|
10266
10275
|
}
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10276
|
+
const result = new Array(targetItems.length).fill(false);
|
|
10277
|
+
result[newActiveIndex] = true;
|
|
10278
|
+
return result;
|
|
10279
|
+
};
|
|
10280
|
+
if (pureHash) {
|
|
10281
|
+
this.hasActiveHash = true;
|
|
10282
|
+
return getNewInViewState();
|
|
10283
|
+
}
|
|
10284
|
+
if (this.hasActiveHash) {
|
|
10285
|
+
if (isScrollUp || newActiveIndex > prevActiveIndex) {
|
|
10286
|
+
this.hasActiveHash = false;
|
|
10287
|
+
return getNewInViewState();
|
|
10272
10288
|
}
|
|
10289
|
+
return inViewState;
|
|
10273
10290
|
}
|
|
10274
|
-
return
|
|
10291
|
+
return getNewInViewState();
|
|
10275
10292
|
}
|
|
10276
10293
|
getActiveItemTitle(titles, inViewState) {
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
}
|
|
10281
|
-
return titles[index];
|
|
10282
|
-
}
|
|
10283
|
-
return null;
|
|
10294
|
+
var _a;
|
|
10295
|
+
const activeIndex = inViewState.findIndex(Boolean);
|
|
10296
|
+
return (_a = titles == null ? void 0 : titles[activeIndex]) != null ? _a : null;
|
|
10284
10297
|
}
|
|
10285
10298
|
pauseScrollHandler() {
|
|
10286
10299
|
this.scrollByClick = true;
|
|
@@ -10595,7 +10608,7 @@ var SubNavigation = (0,react.memo)(
|
|
|
10595
10608
|
ref,
|
|
10596
10609
|
className: SubNavigation_b({
|
|
10597
10610
|
invisible: !visible,
|
|
10598
|
-
visible,
|
|
10611
|
+
visible: !hideMiniToc && visible,
|
|
10599
10612
|
hidden: hideMiniToc && hideBurger
|
|
10600
10613
|
})
|
|
10601
10614
|
},
|