@diplodoc/client 3.0.4 → 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.
@@ -5,7 +5,6 @@ import type { RouterConfig } from '../Router';
5
5
  import { DocContentPageData as DocContentPageDataBase, DocLeadingPageData, DocPageData, Lang } from '@diplodoc/components';
6
6
  import '@diplodoc/transform/dist/js/yfm';
7
7
  import '../../interceptors/leading-page-links';
8
- import '../../interceptors/fast-class-applier';
9
8
  import './App.scss';
10
9
  export type DocAnalytics = {
11
10
  gtm?: {
@@ -1 +1,2 @@
1
- export {};
1
+ import type { DocInnerProps } from '../components/App';
2
+ export declare function setRootClasses(data: DocInnerProps): void;
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 60204:
4
+ /***/ 31890:
5
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6
6
 
7
7
  "use strict";
@@ -54,6 +54,8 @@ const RouterProvider = RouterContext.Provider;
54
54
  function useRouter() {
55
55
  return (0,react.useContext)(RouterContext);
56
56
  }
57
+ // EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/utils/index.js + 59 modules
58
+ var utils = __webpack_require__(54878);
57
59
  // EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/models/index.js
58
60
  var models = __webpack_require__(78184);
59
61
  ;// CONCATENATED MODULE: ./src/constants.ts
@@ -78,6 +80,7 @@ const LINK_KEYS_PAGE_CONSTRUCTOR_CONFIG = ['src', 'url', 'href', 'icon', 'image'
78
80
  const LINK_KEYS = [...new Set([...LINK_KEYS_LEADING_CONFIG, ...LINK_KEYS_PAGE_CONSTRUCTOR_CONFIG])];
79
81
  ;// CONCATENATED MODULE: ./src/utils.ts
80
82
 
83
+
81
84
  function isBrowser() {
82
85
  return typeof document !== 'undefined';
83
86
  }
@@ -109,6 +112,10 @@ function updateRootClassName(states) {
109
112
  case 'fullScreen':
110
113
  toggle('dc-root_full-screen', states[state]);
111
114
  break;
115
+ case 'landingPage':
116
+ toggle('dc-root_document-page', !states[state]);
117
+ toggle('dc-root_landing-page', states[state]);
118
+ break;
112
119
  case 'mobileView':
113
120
  toggle('mobile', states[state]);
114
121
  toggle('desktop', !states[state]);
@@ -140,6 +147,9 @@ function getSettings() {
140
147
  fullScreen: toBoolean(fullScreen)
141
148
  };
142
149
  }
150
+ function getLandingPage(data) {
151
+ return (0,utils/* getPageType */.M5)(data) === 'PAGE_CONSTRUCTOR';
152
+ }
143
153
  function getMobileView() {
144
154
  if (!isBrowser()) {
145
155
  return false;
@@ -175,30 +185,10 @@ function useLang() {
175
185
  }
176
186
  // EXTERNAL MODULE: ./src/interceptors/leading-page-links.js
177
187
  var leading_page_links = __webpack_require__(44186);
178
- ;// CONCATENATED MODULE: ./src/interceptors/fast-class-applier.ts
179
-
180
- if (typeof document !== 'undefined') {
181
- const {
182
- theme,
183
- wideFormat,
184
- fullScreen
185
- } = getSettings();
186
- const mobileView = getMobileView();
187
- updateRootClassName({
188
- mobileView,
189
- wideFormat,
190
- fullScreen
191
- });
192
- updateThemeClassName({
193
- theme
194
- });
195
- }
196
188
  // EXTERNAL MODULE: ./node_modules/@gravity-ui/page-constructor/build/esm/containers/PageConstructor/Provider.js
197
189
  var Provider = __webpack_require__(47658);
198
190
  // EXTERNAL MODULE: ./node_modules/@gravity-ui/page-constructor/build/esm/containers/PageConstructor/PageConstructor.js + 10 modules
199
191
  var PageConstructor = __webpack_require__(95168);
200
- // EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/utils/index.js + 59 modules
201
- var utils = __webpack_require__(54878);
202
192
  // EXTERNAL MODULE: ./node_modules/bem-cn-lite/lib/index.js
203
193
  var lib = __webpack_require__(23614);
204
194
  ;// CONCATENATED MODULE: ./src/components/Layout/index.tsx
@@ -324,6 +314,10 @@ const useContent = (data, CustomPage) => {
324
314
  };
325
315
  // EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/components/SearchSuggest/index.js + 8 modules
326
316
  var SearchSuggest = __webpack_require__(9400);
317
+ // EXTERNAL MODULE: ./node_modules/@gravity-ui/uikit/build/esm/components/Icon/Icon.js + 3 modules
318
+ var Icon = __webpack_require__(29504);
319
+ // EXTERNAL MODULE: ./node_modules/@gravity-ui/icons/esm/Magnifier.js
320
+ var Magnifier = __webpack_require__(84941);
327
321
  ;// CONCATENATED MODULE: ./src/components/index.ts
328
322
 
329
323
 
@@ -447,6 +441,17 @@ function useProvider() {
447
441
 
448
442
 
449
443
 
444
+
445
+
446
+
447
+ const Suggest_b = (0,lib/* default */.A)('Suggest');
448
+ function SearchButton() {
449
+ return /*#__PURE__*/react.createElement(Icon/* Icon */.I, {
450
+ data: Magnifier/* default */.A,
451
+ className: Suggest_b('end'),
452
+ size: 24
453
+ });
454
+ }
450
455
  function Suggest() {
451
456
  const provider = useProvider();
452
457
  const suggest = (0,react.useRef)(null);
@@ -473,7 +478,10 @@ function Suggest() {
473
478
  provider: provider,
474
479
  onFocus: onFocus,
475
480
  onBlur: onBlur,
476
- classNameContainer: 'Suggest'
481
+ endContent: /*#__PURE__*/react.createElement(SearchButton, null),
482
+ className: Suggest_b('input'),
483
+ classNameContainer: Suggest_b(),
484
+ closeButton: true
477
485
  });
478
486
  }
479
487
  // EXTERNAL MODULE: ./node_modules/@diplodoc/components/build/esm/components/Controls/ControlsLayout.js
@@ -560,7 +568,10 @@ const useNavigation = (data, controls, CustomControls, CustomSuggest) => {
560
568
  const navigationData = (0,react.useMemo)(() => ({
561
569
  withBorder: true,
562
570
  leftItems: leftItems,
563
- rightItems: rightItems
571
+ rightItems: rightItems,
572
+ customMobileHeaderItems: [{
573
+ type: 'search'
574
+ }]
564
575
  }), [leftItems, rightItems]);
565
576
  const navigationTocData = (0,react.useMemo)(() => ({
566
577
  toc,
@@ -614,7 +625,6 @@ function Page({
614
625
  headerHeight: pageProps.headerHeight
615
626
  }, /*#__PURE__*/react.createElement(Layout.Content, null, /*#__PURE__*/react.createElement(Page, Object.assign({}, data, pageProps))));
616
627
  }
617
- const EMPTY = {};
618
628
  function LegacyNavPage({
619
629
  data,
620
630
  props,
@@ -653,7 +663,7 @@ function RichNavPage({
653
663
  const CustomPage = (0,react.useCallback)(() => /*#__PURE__*/react.createElement(Page, Object.assign({
654
664
  data: data,
655
665
  headerHeight: fullScreen ? 0 : 64
656
- }, props, navigation.withControls ? EMPTY : controls), /*#__PURE__*/react.createElement(ConstructorPage, data.data)), [data, navigation, props, controls, fullScreen]);
666
+ }, props, filterControls(controls, navigation.withControls)), /*#__PURE__*/react.createElement(ConstructorPage, data.data)), [data, navigation, props, controls, fullScreen]);
657
667
  const content = useContent(data, CustomPage);
658
668
  const custom = (0,react.useMemo)(() => ({
659
669
  navigation: navigation.custom,
@@ -667,6 +677,24 @@ function RichNavPage({
667
677
  navigation: fullScreen ? undefined : navigation.layout
668
678
  }));
669
679
  }
680
+ function filterControls(controls, skipNavigationControls) {
681
+ if (!skipNavigationControls) {
682
+ return controls;
683
+ }
684
+ return {
685
+ ...controls,
686
+ theme: undefined,
687
+ onChangeTheme: undefined,
688
+ textSize: undefined,
689
+ onChangeTextSize: undefined,
690
+ wideFormat: undefined,
691
+ onChangeWideFormat: undefined,
692
+ showMiniToc: undefined,
693
+ onChangeShowMiniToc: undefined,
694
+ langs: undefined,
695
+ onChangeLang: undefined
696
+ };
697
+ }
670
698
  // EXTERNAL MODULE: ./node_modules/@diplodoc/mermaid-extension/react/index.js
671
699
  var mermaid_extension_react = __webpack_require__(85905);
672
700
  // EXTERNAL MODULE: ./node_modules/@diplodoc/latex-extension/react/index.js
@@ -775,7 +803,6 @@ function useMobile() {
775
803
 
776
804
 
777
805
 
778
-
779
806
  function hasNavigation(data) {
780
807
  return Boolean(data.toc.navigation);
781
808
  }
@@ -814,16 +841,18 @@ function App(props) {
814
841
  mobileView
815
842
  }), [langs, settings, mobileView]);
816
843
  const direction = getDirection(lang);
844
+ const landingPage = getLandingPage(data);
817
845
  (0,react.useEffect)(() => {
818
846
  updateRootClassName({
819
847
  mobileView,
820
848
  wideFormat,
821
- fullScreen
849
+ fullScreen,
850
+ landingPage
822
851
  });
823
852
  updateThemeClassName({
824
853
  theme
825
854
  });
826
- }, [theme, mobileView, wideFormat, fullScreen]);
855
+ }, [theme, mobileView, wideFormat, fullScreen, landingPage]);
827
856
  return /*#__PURE__*/react.createElement("div", {
828
857
  className: "App"
829
858
  }, /*#__PURE__*/react.createElement(ThemeProvider/* ThemeProvider */.N, {
@@ -1276,7 +1305,7 @@ module.exports = require("util");
1276
1305
  /******/ __webpack_require__.x = () => {
1277
1306
  /******/ // Load entry module and return exports
1278
1307
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
1279
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, [644,121], () => (__webpack_require__(60204)))
1308
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, [644,121], () => (__webpack_require__(31890)))
1280
1309
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
1281
1310
  /******/ return __webpack_exports__;
1282
1311
  /******/ };