dumi 2.2.0-alpha.2 → 2.2.0-rc.0

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.
Files changed (38) hide show
  1. package/README.md +2 -6
  2. package/compiled/_internal/searchWorker.min.js +1 -1
  3. package/compiled/crates/swc_plugin_react_demo.wasm +0 -0
  4. package/dist/assetParsers/atom.d.ts +2 -0
  5. package/dist/assetParsers/atom.js +19 -12
  6. package/dist/client/theme-api/DumiDemoGrid.js +2 -1
  7. package/dist/client/theme-api/DumiPage.js +2 -0
  8. package/dist/client/theme-api/types.d.ts +4 -1
  9. package/dist/client/theme-api/useNavData.js +77 -15
  10. package/dist/client/theme-api/useSidebarData.js +31 -7
  11. package/dist/client/theme-api/useSiteSearch/index.d.ts +1 -0
  12. package/dist/client/theme-api/utils.d.ts +3 -3
  13. package/dist/client/theme-api/utils.js +1 -1
  14. package/dist/features/autoAlias.js +20 -23
  15. package/dist/features/configPlugins/index.js +2 -1
  16. package/dist/features/configPlugins/schema.js +0 -1
  17. package/dist/features/derivative.js +0 -1
  18. package/dist/features/locales.js +2 -1
  19. package/dist/features/routes.js +25 -12
  20. package/dist/features/theme/index.js +77 -4
  21. package/dist/loaders/markdown/transformer/rehypeDemo.js +35 -9
  22. package/dist/loaders/markdown/transformer/rehypeEnhancedTag.js +1 -0
  23. package/dist/types.d.ts +2 -8
  24. package/dist/utils.d.ts +0 -4
  25. package/dist/utils.js +0 -14
  26. package/package.json +8 -3
  27. package/theme-default/builtins/API/index.js +1 -1
  28. package/theme-default/builtins/SourceCode/index.js +27 -13
  29. package/theme-default/builtins/SourceCode/index.less +53 -3
  30. package/theme-default/builtins/Tree/index.d.ts +4 -0
  31. package/theme-default/builtins/Tree/index.js +206 -0
  32. package/theme-default/builtins/Tree/index.less +186 -0
  33. package/theme-default/slots/ColorSwitch/index.less +4 -2
  34. package/theme-default/slots/Navbar/index.js +80 -13
  35. package/theme-default/slots/Navbar/index.less +128 -4
  36. package/theme-default/slots/RtlSwitch/index.less +2 -1
  37. package/theme-default/slots/SocialIcon/index.less +2 -1
  38. package/theme-default/slots/Toc/index.js +8 -2
@@ -13,14 +13,15 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
15
  import { Scrollspy as ScrollSpy } from '@makotot/ghostui/src/Scrollspy';
16
- import { Link, useLocation, useRouteMeta, useSiteData, useTabMeta } from 'dumi';
16
+ import { history, Link, useLocation, useRouteMeta, useSiteData, useTabMeta } from 'dumi';
17
17
  import React, { useEffect, useRef, useState } from 'react';
18
18
  import "./index.less";
19
19
 
20
20
  var Toc = function Toc() {
21
21
  var _useLocation = useLocation(),
22
22
  pathname = _useLocation.pathname,
23
- search = _useLocation.search;
23
+ search = _useLocation.search,
24
+ hash = _useLocation.hash;
24
25
 
25
26
  var meta = useRouteMeta();
26
27
  var tabMeta = useTabMeta();
@@ -80,6 +81,11 @@ var Toc = function Toc() {
80
81
  "data-depth": item.depth
81
82
  }, /*#__PURE__*/React.createElement(Link, _extends({
82
83
  to: link,
84
+ onClickCapture: function onClickCapture() {
85
+ if (decodeURIComponent(hash).slice(1) === item.id) {
86
+ history.replace(search);
87
+ }
88
+ },
83
89
  title: item.title
84
90
  }, activeIndex === i ? {
85
91
  className: 'active'