dumi 2.0.0-rc.3 → 2.0.0-rc.5
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/dist/assetParsers/block.js +5 -1
- package/dist/client/pages/404.js +1 -1
- package/dist/client/pages/{Demo.d.ts → Demo/index.d.ts} +1 -0
- package/dist/client/pages/{Demo.js → Demo/index.js} +1 -0
- package/dist/client/pages/Demo/index.less +4 -0
- package/dist/client/theme-api/DumiDemo.js +1 -1
- package/dist/client/theme-api/DumiPage.js +7 -10
- package/dist/features/derivative.js +27 -12
- package/dist/features/routes.js +13 -2
- package/dist/features/theme/index.js +25 -5
- package/dist/loaders/markdown/transformer/remarkEmbed.js +3 -0
- package/package.json +7 -7
- package/theme-default/builtins/Previewer/index.js +1 -1
- package/theme-default/builtins/Table/index.js +10 -2
- package/theme-default/builtins/Table/index.less +9 -9
- package/theme-default/layouts/DocLayout/index.js +7 -7
- package/theme-default/layouts/DocLayout/index.less +2 -1
- package/theme-default/slots/Content/index.less +48 -0
- package/theme-default/slots/ContentTabs/index.less +14 -0
- package/theme-default/slots/Features/index.less +2 -2
- package/theme-default/slots/Header/index.js +4 -4
- package/theme-default/slots/Hero/index.js +1 -1
- package/theme-default/slots/Hero/index.less +1 -1
- package/theme-default/slots/Navbar/index.js +5 -1
- package/theme-default/slots/PreviewerActions/index.js +2 -2
- package/theme-default/slots/SearchBar/index.js +1 -1
- package/theme-default/slots/SearchResult/index.d.ts +2 -2
- package/theme-default/slots/SearchResult/index.js +4 -2
- package/theme-default/slots/Sidebar/index.js +1 -1
- package/theme-default/styles/variables.less +3 -3
|
@@ -43,7 +43,7 @@ async function parseBlockAsset(opts) {
|
|
|
43
43
|
sources: {},
|
|
44
44
|
frontmatter: null
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
const deferrer = (0, import_esbuild.build)({
|
|
47
47
|
write: false,
|
|
48
48
|
bundle: true,
|
|
49
49
|
logLevel: "silent",
|
|
@@ -116,6 +116,10 @@ async function parseBlockAsset(opts) {
|
|
|
116
116
|
}
|
|
117
117
|
]
|
|
118
118
|
});
|
|
119
|
+
try {
|
|
120
|
+
await deferrer;
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
119
123
|
return result;
|
|
120
124
|
}
|
|
121
125
|
var block_default = parseBlockAsset;
|
package/dist/client/pages/404.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// allow customize 404 via theme slots
|
|
2
|
-
export { default } from
|
|
2
|
+
export { default } from "dumi/theme/slots/NotFound";
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
|
|
3
3
|
import { SP_ROUTE_PREFIX } from "../../constants";
|
|
4
4
|
import { useSiteData } from 'dumi';
|
|
5
|
-
import Previewer from
|
|
5
|
+
import Previewer from "dumi/theme/builtins/Previewer";
|
|
6
6
|
import React, { createElement } from 'react';
|
|
7
7
|
export var DumiDemo = function DumiDemo(props) {
|
|
8
8
|
var _useSiteData = useSiteData(),
|
|
@@ -11,13 +11,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
13
|
import { useLocation, useRouteMeta, useSiteData } from 'dumi';
|
|
14
|
-
import ContentTabs from
|
|
14
|
+
import ContentTabs from "dumi/theme/slots/ContentTabs";
|
|
15
15
|
import React, { useEffect, useState } from 'react';
|
|
16
16
|
import { useTabQueryState } from "./useTabMeta";
|
|
17
17
|
export var DumiPage = function DumiPage(props) {
|
|
18
18
|
var _useLocation = useLocation(),
|
|
19
|
-
hash = _useLocation.hash
|
|
20
|
-
pathname = _useLocation.pathname;
|
|
19
|
+
hash = _useLocation.hash;
|
|
21
20
|
|
|
22
21
|
var _useRouteMeta = useRouteMeta(),
|
|
23
22
|
tabs = _useRouteMeta.tabs;
|
|
@@ -47,13 +46,11 @@ export var DumiPage = function DumiPage(props) {
|
|
|
47
46
|
|
|
48
47
|
useEffect(function () {
|
|
49
48
|
var id = hash.replace('#', '');
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
document.documentElement.scrollTo(0, 0);
|
|
56
|
-
}, [pathname]);
|
|
49
|
+
setTimeout(function () {
|
|
50
|
+
var elm = id && document.getElementById(decodeURIComponent(id));
|
|
51
|
+
if (elm) document.documentElement.scrollTo(0, elm.offsetTop - 80);
|
|
52
|
+
}, 1);
|
|
53
|
+
}, [hash]);
|
|
57
54
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContentTabs, {
|
|
58
55
|
tabs: tabs,
|
|
59
56
|
tabKey: tabKey,
|
|
@@ -27,6 +27,7 @@ __export(derivative_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(derivative_exports);
|
|
29
29
|
var import_constants = require("../constants");
|
|
30
|
+
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
30
31
|
var import_assert = __toESM(require("assert"));
|
|
31
32
|
var import_fs = __toESM(require("fs"));
|
|
32
33
|
var import_path = __toESM(require("path"));
|
|
@@ -50,7 +51,20 @@ function getFilesByGlob(globExp, dir) {
|
|
|
50
51
|
var derivative_default = (api) => {
|
|
51
52
|
const dumiAbsDir = import_path.default.join(api.cwd, import_constants.LOCAL_DUMI_DIR);
|
|
52
53
|
const strategies = {
|
|
53
|
-
appJS
|
|
54
|
+
async appJS() {
|
|
55
|
+
const [appJS] = getFilesByGlob("app.{js,jsx,ts,tsx}", dumiAbsDir);
|
|
56
|
+
if (appJS) {
|
|
57
|
+
const [, exports] = await (0, import_bundler_utils.parseModule)({
|
|
58
|
+
path: appJS,
|
|
59
|
+
content: import_fs.default.readFileSync(appJS, "utf-8")
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
path: appJS,
|
|
63
|
+
exports
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
},
|
|
54
68
|
globalCSS: getFilesByGlob.bind(null, "global.{css,less,scss,sass}", dumiAbsDir),
|
|
55
69
|
globalJS: getFilesByGlob.bind(null, "global.{js,jsx,ts,tsx}", dumiAbsDir),
|
|
56
70
|
overridesCSS: getFilesByGlob.bind(null, "overrides.{css,less,scss,sass}", dumiAbsDir)
|
|
@@ -89,19 +103,20 @@ var derivative_default = (api) => {
|
|
|
89
103
|
memo.exportStatic || (memo.exportStatic = {});
|
|
90
104
|
return memo;
|
|
91
105
|
});
|
|
92
|
-
api.modifyAppData((memo) => {
|
|
93
|
-
|
|
94
|
-
memo[key] =
|
|
95
|
-
}
|
|
106
|
+
api.modifyAppData(async (memo) => {
|
|
107
|
+
for (const [key, strategy] of Object.entries(strategies)) {
|
|
108
|
+
memo[key] = await strategy();
|
|
109
|
+
}
|
|
96
110
|
return memo;
|
|
97
111
|
});
|
|
98
|
-
api.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
api.register({
|
|
113
|
+
key: "onGenerateFiles",
|
|
114
|
+
stage: -Infinity,
|
|
115
|
+
async fn() {
|
|
116
|
+
for (const [key, strategy] of Object.entries(strategies)) {
|
|
117
|
+
api.appData[key] = await strategy();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
105
120
|
});
|
|
106
121
|
api.registerPlugins([require.resolve("@umijs/plugins/dist/analytics")]);
|
|
107
122
|
};
|
package/dist/features/routes.js
CHANGED
|
@@ -50,6 +50,16 @@ function flatRoute(route) {
|
|
|
50
50
|
route.path = route.path === "*" ? route.path : route.absPath.slice(1);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
function getClientPageFile(file, cwd) {
|
|
54
|
+
try {
|
|
55
|
+
return import_plugin_utils.resolve.sync(`dumi/dist/${file}`, {
|
|
56
|
+
basedir: cwd,
|
|
57
|
+
preserveSymlinks: false
|
|
58
|
+
});
|
|
59
|
+
} catch {
|
|
60
|
+
return require.resolve(`../${file}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
53
63
|
var routes_default = (api) => {
|
|
54
64
|
var _a, _b, _c;
|
|
55
65
|
const extraWatchPaths = [
|
|
@@ -112,6 +122,7 @@ var routes_default = (api) => {
|
|
|
112
122
|
Object.entries(pages).forEach(([, route]) => {
|
|
113
123
|
route.file = (0, import_plugin_utils.winPath)(import_path.default.resolve(api.config.conventionRoutes.base, route.file));
|
|
114
124
|
flatRoute(route);
|
|
125
|
+
localizeUmiRoute(route, api.config.locales);
|
|
115
126
|
routes[route.id] = route;
|
|
116
127
|
});
|
|
117
128
|
docDirs.map(normalizeDocDir).forEach(({ type, dir }) => {
|
|
@@ -155,7 +166,7 @@ var routes_default = (api) => {
|
|
|
155
166
|
path: "*",
|
|
156
167
|
absPath: "/*",
|
|
157
168
|
parentId: docLayoutId,
|
|
158
|
-
file:
|
|
169
|
+
file: getClientPageFile("client/pages/404", api.cwd)
|
|
159
170
|
};
|
|
160
171
|
}
|
|
161
172
|
routes["demo-render"] = {
|
|
@@ -163,7 +174,7 @@ var routes_default = (api) => {
|
|
|
163
174
|
path: `${import_constants.SP_ROUTE_PREFIX}demos/:id`,
|
|
164
175
|
absPath: `/${import_constants.SP_ROUTE_PREFIX}demos/:id`,
|
|
165
176
|
parentId: demoLayoutId,
|
|
166
|
-
file:
|
|
177
|
+
file: getClientPageFile("client/pages/Demo", api.cwd)
|
|
167
178
|
};
|
|
168
179
|
return routes;
|
|
169
180
|
});
|
|
@@ -26,6 +26,7 @@ __export(theme_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(theme_exports);
|
|
28
28
|
var import_constants = require("../../constants");
|
|
29
|
+
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
29
30
|
var import_fs = __toESM(require("fs"));
|
|
30
31
|
var import_path = __toESM(require("path"));
|
|
31
32
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
@@ -109,18 +110,28 @@ var theme_default = (api) => {
|
|
|
109
110
|
api.onGenerateFiles(() => {
|
|
110
111
|
themeMapKeys.forEach((key) => {
|
|
111
112
|
Object.values(originalThemeData[key] || {}).forEach((item) => {
|
|
113
|
+
let contents = [];
|
|
114
|
+
const [, exports] = (0, import_bundler_utils.parseModuleSync)({
|
|
115
|
+
path: item.source,
|
|
116
|
+
content: import_fs.default.readFileSync(item.source, "utf-8")
|
|
117
|
+
});
|
|
118
|
+
if (exports.includes("default")) {
|
|
119
|
+
contents.push(`export { default } from '${item.source}';`);
|
|
120
|
+
}
|
|
121
|
+
if (exports.some((exp) => exp !== "default")) {
|
|
122
|
+
contents.push(`export * from '${item.source}';`);
|
|
123
|
+
}
|
|
112
124
|
api.writeTmpFile({
|
|
113
125
|
noPluginDir: true,
|
|
114
126
|
path: `dumi/theme/${key}/${item.specifier}.ts`,
|
|
115
|
-
content:
|
|
116
|
-
export { default } from '${item.source}';`
|
|
127
|
+
content: contents.join("\n")
|
|
117
128
|
});
|
|
118
129
|
});
|
|
119
130
|
});
|
|
120
131
|
api.writeTmpFile({
|
|
121
132
|
noPluginDir: true,
|
|
122
133
|
path: "dumi/theme/ContextWrapper.tsx",
|
|
123
|
-
content: `import React, { useState, useEffect } from 'react';
|
|
134
|
+
content: `import React, { useState, useEffect, useRef } from 'react';
|
|
124
135
|
import { useOutlet, history } from 'dumi';
|
|
125
136
|
import { SiteContext } from '${(0, import_plugin_utils.winPath)(require.resolve("../../client/theme-api/context"))}';
|
|
126
137
|
import { demos, components } from '../meta';
|
|
@@ -129,10 +140,19 @@ import { locales } from '../locales/config';
|
|
|
129
140
|
export default function DumiContextWrapper() {
|
|
130
141
|
const outlet = useOutlet();
|
|
131
142
|
const [loading, setLoading] = useState(true);
|
|
143
|
+
const prev = useRef(history.location.pathname);
|
|
132
144
|
|
|
133
|
-
// mark loading when route change, page component will set false when loaded
|
|
134
145
|
useEffect(() => {
|
|
135
|
-
return history.listen(() =>
|
|
146
|
+
return history.listen((next) => {
|
|
147
|
+
// mark loading when route change, page component will set false when loaded
|
|
148
|
+
setLoading(true);
|
|
149
|
+
|
|
150
|
+
// scroll to top when route changed
|
|
151
|
+
if (next.location.pathname !== prev.current) {
|
|
152
|
+
prev.current = next.location.pathname;
|
|
153
|
+
document.documentElement.scrollTo(0, 0);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
136
156
|
}, []);
|
|
137
157
|
|
|
138
158
|
return (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.5",
|
|
4
4
|
"description": "Framework for developing UI components",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"lint": "npm run lint:es && npm run lint:css",
|
|
26
26
|
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
27
27
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
28
|
-
"prepare": "npm run build && node ./bin/dumi.js setup && npm run docs:sync",
|
|
28
|
+
"prepare": "husky install && npm run build && node ./bin/dumi.js setup && npm run docs:sync",
|
|
29
29
|
"prepublishOnly": "npm run build",
|
|
30
30
|
"test": "vitest"
|
|
31
31
|
},
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@swc/core": "^1.2.224",
|
|
58
58
|
"@types/hast": "^2.3.4",
|
|
59
59
|
"@types/mdast": "^3.0.10",
|
|
60
|
-
"@umijs/bundler-utils": "^4.0.
|
|
61
|
-
"@umijs/core": "^4.0.
|
|
62
|
-
"@umijs/plugins": "^4.0.
|
|
60
|
+
"@umijs/bundler-utils": "^4.0.30",
|
|
61
|
+
"@umijs/core": "^4.0.30",
|
|
62
|
+
"@umijs/plugins": "^4.0.30",
|
|
63
63
|
"codesandbox": "^2.2.3",
|
|
64
64
|
"deepmerge": "^4.2.2",
|
|
65
65
|
"dumi-afx-deps": "^1.0.0-alpha.1",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"remark-parse": "^10.0.1",
|
|
97
97
|
"remark-rehype": "^10.1.0",
|
|
98
98
|
"sass": "^1.55.0",
|
|
99
|
-
"umi": "^4.0.
|
|
99
|
+
"umi": "^4.0.30",
|
|
100
100
|
"unified": "^10.1.2",
|
|
101
101
|
"unist-util-visit": "^4.1.0",
|
|
102
102
|
"unist-util-visit-parents": "^5.1.1",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@types/react": "^18.0.16",
|
|
117
117
|
"@types/react-copy-to-clipboard": "^5.0.4",
|
|
118
118
|
"@types/react-helmet": "^6.1.5",
|
|
119
|
-
"@umijs/lint": "^4.0.
|
|
119
|
+
"@umijs/lint": "^4.0.30",
|
|
120
120
|
"eslint": "^8.20.0",
|
|
121
121
|
"father": "^4.1.0",
|
|
122
122
|
"husky": "^8.0.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
|
|
3
3
|
import { useLocation } from 'dumi';
|
|
4
|
-
import PreviewerActions from
|
|
4
|
+
import PreviewerActions from "dumi/theme/slots/PreviewerActions";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import "./index.less";
|
|
7
7
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var _excluded = ["children"];
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
|
|
3
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -10,12 +12,18 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
12
|
|
|
11
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
14
|
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
|
|
13
19
|
import throttle from 'lodash.throttle';
|
|
14
20
|
import React, { useEffect, useRef, useState } from 'react';
|
|
15
21
|
import "./index.less";
|
|
16
22
|
|
|
17
23
|
var Table = function Table(_ref) {
|
|
18
|
-
var children = _ref.children
|
|
24
|
+
var children = _ref.children,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
|
|
19
27
|
var container = useRef(null);
|
|
20
28
|
|
|
21
29
|
var _useState = useState(false),
|
|
@@ -53,7 +61,7 @@ var Table = function Table(_ref) {
|
|
|
53
61
|
ref: container,
|
|
54
62
|
"data-left-folded": leftFolded || undefined,
|
|
55
63
|
"data-right-folded": rightFolded || undefined
|
|
56
|
-
}, /*#__PURE__*/React.createElement("table",
|
|
64
|
+
}, /*#__PURE__*/React.createElement("table", props, children)));
|
|
57
65
|
};
|
|
58
66
|
|
|
59
67
|
export default Table;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import (reference) '../../styles/variables.less';
|
|
2
2
|
|
|
3
3
|
.@{prefix}-table {
|
|
4
|
-
margin:
|
|
4
|
+
margin: 24px 0 32px;
|
|
5
5
|
transform: translate(0, 0);
|
|
6
6
|
|
|
7
7
|
&-content {
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
left: 0;
|
|
24
24
|
background-image: linear-gradient(
|
|
25
25
|
to right,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
rgb(0 0 0 / 10%),
|
|
27
|
+
rgb(0 0 0 / 0%)
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
[data-prefers-color='dark'] & {
|
|
31
31
|
background-image: linear-gradient(
|
|
32
32
|
to right,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
rgb(0 0 0 / 50%),
|
|
34
|
+
rgb(0 0 0 / 0%)
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
right: 0;
|
|
41
41
|
background-image: linear-gradient(
|
|
42
42
|
to left,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
rgb(0 0 0 / 10%),
|
|
44
|
+
rgb(0 0 0 / 0%)
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
[data-prefers-color='dark'] & {
|
|
48
48
|
background-image: linear-gradient(
|
|
49
49
|
to left,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
rgb(0 0 0 / 50%),
|
|
51
|
+
rgb(0 0 0 / 0%)
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -12,13 +12,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
|
|
13
13
|
import { ReactComponent as IconSidebar } from '@ant-design/icons-svg/inline-svg/outlined/align-left.svg';
|
|
14
14
|
import { useIntl, useOutlet, useRouteMeta, useSidebarData } from 'dumi';
|
|
15
|
-
import Content from
|
|
16
|
-
import Features from
|
|
17
|
-
import Footer from
|
|
18
|
-
import Header from
|
|
19
|
-
import Hero from
|
|
20
|
-
import Sidebar from
|
|
21
|
-
import Toc from
|
|
15
|
+
import Content from "dumi/theme/slots/Content";
|
|
16
|
+
import Features from "dumi/theme/slots/Features";
|
|
17
|
+
import Footer from "dumi/theme/slots/Footer";
|
|
18
|
+
import Header from "dumi/theme/slots/Header";
|
|
19
|
+
import Hero from "dumi/theme/slots/Hero";
|
|
20
|
+
import Sidebar from "dumi/theme/slots/Sidebar";
|
|
21
|
+
import Toc from "dumi/theme/slots/Toc";
|
|
22
22
|
import React, { useState } from 'react';
|
|
23
23
|
import Helmet from 'react-helmet';
|
|
24
24
|
import "./index.less";
|
|
@@ -41,6 +41,54 @@
|
|
|
41
41
|
padding-inline-end: 16px;
|
|
42
42
|
border-color: @c-border-light;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
// blockquote
|
|
46
|
+
blockquote {
|
|
47
|
+
font-style: italic;
|
|
48
|
+
margin-inline-start: 0;
|
|
49
|
+
margin-inline-end: 0;
|
|
50
|
+
background-color: tint(@c-site-bg, 50%);
|
|
51
|
+
border-left: 5px solid @c-border-light;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// list
|
|
55
|
+
ul li {
|
|
56
|
+
line-height: 1.8;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// anchor of headings
|
|
60
|
+
h1,
|
|
61
|
+
h2,
|
|
62
|
+
h3,
|
|
63
|
+
h4,
|
|
64
|
+
h5,
|
|
65
|
+
h6 {
|
|
66
|
+
> a[aria-hidden]:first-child {
|
|
67
|
+
float: left;
|
|
68
|
+
width: 20px;
|
|
69
|
+
padding-right: 4px;
|
|
70
|
+
margin-left: -24px;
|
|
71
|
+
color: @c-text;
|
|
72
|
+
// hide phantom blank node
|
|
73
|
+
font-size: 0;
|
|
74
|
+
text-align: right;
|
|
75
|
+
line-height: inherit;
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
border: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
> .icon-link::before {
|
|
82
|
+
content: '#';
|
|
83
|
+
color: @c-text-secondary;
|
|
84
|
+
font-size: 20px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:not(:hover) > a[aria-hidden]:first-child > .icon-link {
|
|
89
|
+
visibility: hidden;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
44
92
|
}
|
|
45
93
|
|
|
46
94
|
.@{prefix}-content {
|
|
@@ -9,9 +9,19 @@
|
|
|
9
9
|
padding: 0 @s-content-padding;
|
|
10
10
|
border-bottom: 1px solid @c-border-light;
|
|
11
11
|
|
|
12
|
+
@media @mobile {
|
|
13
|
+
margin: -24px -24px 24px;
|
|
14
|
+
padding: 0 24px;
|
|
15
|
+
height: 42px;
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
[data-no-sidebar] & {
|
|
13
19
|
margin: 0 0 @s-content-padding;
|
|
14
20
|
padding: 0;
|
|
21
|
+
|
|
22
|
+
@media @mobile {
|
|
23
|
+
margin-bottom: 24px;
|
|
24
|
+
}
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
> li {
|
|
@@ -34,6 +44,10 @@
|
|
|
34
44
|
|
|
35
45
|
&:not(last-child) {
|
|
36
46
|
margin-right: 42px;
|
|
47
|
+
|
|
48
|
+
@media @mobile {
|
|
49
|
+
margin-right: 20px;
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
&[data-active] {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
> h3 {
|
|
50
50
|
margin: 4px 0;
|
|
51
|
-
color:
|
|
51
|
+
color: @c-text;
|
|
52
52
|
font-weight: normal;
|
|
53
53
|
font-size: 20px;
|
|
54
54
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
> p {
|
|
61
61
|
margin: 12px 0;
|
|
62
|
-
color:
|
|
62
|
+
color: @c-text-secondary;
|
|
63
63
|
font-size: 16px;
|
|
64
64
|
line-height: 1.475;
|
|
65
65
|
|
|
@@ -13,10 +13,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import { ReactComponent as IconClose } from '@ant-design/icons-svg/inline-svg/outlined/close.svg';
|
|
14
14
|
import { ReactComponent as IconMenu } from '@ant-design/icons-svg/inline-svg/outlined/menu.svg';
|
|
15
15
|
import { useRouteMeta } from 'dumi';
|
|
16
|
-
import LangSwitch from
|
|
17
|
-
import Logo from
|
|
18
|
-
import Navbar from
|
|
19
|
-
import SearchBar from
|
|
16
|
+
import LangSwitch from "dumi/theme/slots/LangSwitch";
|
|
17
|
+
import Logo from "dumi/theme/slots/Logo";
|
|
18
|
+
import Navbar from "dumi/theme/slots/Navbar";
|
|
19
|
+
import SearchBar from "dumi/theme/slots/SearchBar";
|
|
20
20
|
import React, { useState } from 'react';
|
|
21
21
|
import "./index.less";
|
|
22
22
|
|
|
@@ -15,7 +15,11 @@ var Navbar = function Navbar() {
|
|
|
15
15
|
}, nav.map(function (item) {
|
|
16
16
|
return /*#__PURE__*/React.createElement("li", {
|
|
17
17
|
key: item.link
|
|
18
|
-
}, /*#__PURE__*/React.createElement(
|
|
18
|
+
}, /^(\w+:)\/\/|^(mailto|tel):/.test(item.link) ? /*#__PURE__*/React.createElement("a", {
|
|
19
|
+
href: item.link,
|
|
20
|
+
target: "_blank",
|
|
21
|
+
rel: "noreferrer"
|
|
22
|
+
}, item.title) : /*#__PURE__*/React.createElement(Link, _extends({
|
|
19
23
|
to: item.link
|
|
20
24
|
}, pathname.startsWith(item.activePath || item.link) ? {
|
|
21
25
|
className: 'active'
|
|
@@ -13,8 +13,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import { ReactComponent as IconCodeSandbox } from '@ant-design/icons-svg/inline-svg/outlined/code-sandbox.svg'; // import { ReactComponent as IconCodePen } from '@ant-design/icons-svg/inline-svg/outlined/codepen.svg';
|
|
14
14
|
|
|
15
15
|
import { openCodeSandbox, useIntl } from 'dumi';
|
|
16
|
-
import SourceCode from
|
|
17
|
-
import PreviewerActionsExtra from
|
|
16
|
+
import SourceCode from "dumi/theme/builtins/SourceCode";
|
|
17
|
+
import PreviewerActionsExtra from "dumi/theme/slots/PreviewerActionsExtra";
|
|
18
18
|
import Tabs from 'rc-tabs';
|
|
19
19
|
import React, { useState } from 'react';
|
|
20
20
|
import "./index.less";
|
|
@@ -15,7 +15,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
15
15
|
import { ReactComponent as IconSearch } from '@ant-design/icons-svg/inline-svg/outlined/search.svg';
|
|
16
16
|
import { useIntl, useSiteSearch } from 'dumi';
|
|
17
17
|
import React, { useEffect, useRef, useState } from 'react';
|
|
18
|
-
import
|
|
18
|
+
import SearchResult from "../SearchResult";
|
|
19
19
|
import "./index.less";
|
|
20
20
|
var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(typeof navigator !== 'undefined' ? (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.platform : '');
|
|
21
21
|
|
|
@@ -2,8 +2,8 @@ import { type useSiteSearch } from 'dumi';
|
|
|
2
2
|
import { type FC } from 'react';
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare type ISearchResult = ReturnType<typeof useSiteSearch>['result'];
|
|
5
|
-
|
|
5
|
+
declare const SearchResult: FC<{
|
|
6
6
|
data: ISearchResult;
|
|
7
7
|
loading: boolean;
|
|
8
8
|
}>;
|
|
9
|
-
export
|
|
9
|
+
export default SearchResult;
|
|
@@ -106,7 +106,7 @@ var useFlatSearchData = function useFlatSearchData(data) {
|
|
|
106
106
|
return flatData;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
var SearchResult = function SearchResult(props) {
|
|
110
110
|
var _useFlatSearchData = useFlatSearchData(props.data),
|
|
111
111
|
_useFlatSearchData2 = _slicedToArray(_useFlatSearchData, 2),
|
|
112
112
|
data = _useFlatSearchData2[0],
|
|
@@ -165,4 +165,6 @@ export var SearchResult = function SearchResult(props) {
|
|
|
165
165
|
}, /*#__PURE__*/React.createElement(IconInbox, null), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
166
166
|
id: "search.not.found"
|
|
167
167
|
})));
|
|
168
|
-
};
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export default SearchResult;
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
@s-header-height-m: 52px;
|
|
8
8
|
|
|
9
9
|
@c-primary: #1677ff;
|
|
10
|
-
@c-text: #
|
|
11
|
-
@c-text-secondary: #
|
|
12
|
-
@c-text-note: #
|
|
10
|
+
@c-text: #30363f;
|
|
11
|
+
@c-text-secondary: #4f5866;
|
|
12
|
+
@c-text-note: #8a9099;
|
|
13
13
|
@c-border: #d0d5d8;
|
|
14
14
|
@c-border-light: #e4e9ec;
|
|
15
15
|
@c-site-bg: #f7f9fb;
|