dumi 2.1.11 → 2.1.12

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.
@@ -1,4 +1,4 @@
1
- import { useLayoutEffect } from 'react';
1
+ import { useEffect } from 'react';
2
2
  import type { ILocale, INav, INavItem, IRouteMeta, IRoutesById, IUserNavValue } from './types';
3
3
  export declare const useLocaleDocRoutes: () => IRoutesById;
4
4
  /**
@@ -7,7 +7,7 @@ export declare const useLocaleDocRoutes: () => IRoutesById;
7
7
  * @returns code string
8
8
  */
9
9
  export declare const genReactRenderCode: (version: string) => string;
10
- export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
10
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
11
11
  /**
12
12
  * common comparer for sidebar/nav items
13
13
  */
@@ -100,8 +100,6 @@ function rehypeDemo(opts) {
100
100
  if (isFirstChild) {
101
101
  node.data ?? (node.data = {});
102
102
  node.data[DEMO_NODE_CONTAINER] = true;
103
- if (!nextChild)
104
- return SKIP;
105
103
  while (nextChild) {
106
104
  if (isElement(nextChild, "code") && tryMarkDemoNode(nextChild, opts) || isElement(nextChild, "br")) {
107
105
  splitFrom += 1;
@@ -112,6 +110,8 @@ function rehypeDemo(opts) {
112
110
  break;
113
111
  }
114
112
  }
113
+ if (!nextChild)
114
+ return SKIP;
115
115
  }
116
116
  const splitChildren = node.children.splice(splitFrom);
117
117
  parent.children.splice(nodeIndex + 1, 0, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.1.11",
3
+ "version": "2.1.12",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",
@@ -10,14 +10,18 @@
10
10
  display: inline-block;
11
11
  font-family: Alibaba-PuHuiTi, 'Gill Sans', 'Gill Sans MT', Calibri,
12
12
  'Trebuchet MS', sans-serif;
13
- color: #82cdf8;
13
+ color: lighten(desaturate(spin(@c-primary, -13), 10.5), 20);
14
14
  font-size: 180px;
15
15
  line-height: 1;
16
16
 
17
17
  > span {
18
+ // generated via: https://nicothin.pro/lessColourFunctionCalculator/
19
+ @from: lighten(spin(@c-primary, -12.5), 24);
20
+ @to: lighten(@c-primary, 15.5);
21
+
18
22
  color: transparent;
19
- text-shadow: 0 10px 20px rgba(22, 119, 255, 15%);
20
- background: linear-gradient(30deg, #91d6ff 30%, #66a6ff);
23
+ text-shadow: 0 10px 20px fadeout(@c-primary, 85%);
24
+ background: linear-gradient(30deg, @from 30%, @to);
21
25
  background-clip: text;
22
26
  }
23
27
 
@@ -24,6 +24,11 @@ import { Mask } from "./Mask";
24
24
  export { Input as SearchInput } from "./Input";
25
25
  export { Mask as SearchMask } from "./Mask";
26
26
  var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(typeof navigator !== 'undefined' ? (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.platform : '');
27
+ /** Determine if the element that triggered the event is an input element */
28
+
29
+ var isInput = function isInput(target) {
30
+ return ['TEXTAREA', 'INPUT'].includes(target.tagName) || target.contentEditable === 'true';
31
+ };
27
32
 
28
33
  var SearchBar = function SearchBar() {
29
34
  var _useState = useState(false),
@@ -58,7 +63,7 @@ var SearchBar = function SearchBar() {
58
63
  }
59
64
 
60
65
  var handler = function handler(ev) {
61
- if ((isAppleDevice ? ev.metaKey : ev.ctrlKey) && ev.key === 'k' || ev.key === '/') {
66
+ if ((isAppleDevice ? ev.metaKey : ev.ctrlKey) && ev.key === 'k' || ev.key === '/' && !isInput(ev.target)) {
62
67
  ev.preventDefault();
63
68
 
64
69
  if (inputRef.current) {