dumi 2.0.0-rc.8 → 2.0.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 (58) hide show
  1. package/dist/client/theme-api/DumiDemo.js +27 -4
  2. package/dist/client/theme-api/DumiDemoGrid.js +23 -8
  3. package/dist/client/theme-api/index.d.ts +1 -0
  4. package/dist/client/theme-api/index.js +1 -0
  5. package/dist/client/theme-api/openStackBlitz.d.ts +1 -0
  6. package/dist/client/theme-api/openStackBlitz.js +60 -0
  7. package/dist/client/theme-api/types.d.ts +4 -0
  8. package/dist/client/theme-api/useSiteSearch/index.d.ts +7 -0
  9. package/dist/client/theme-api/useSiteSearch/index.js +108 -0
  10. package/dist/client/theme-api/{useSiteSearch.d.ts → useSiteSearch/worker.d.ts} +1 -7
  11. package/dist/client/theme-api/{useSiteSearch.js → useSiteSearch/worker.js} +36 -69
  12. package/dist/constants.js +0 -1
  13. package/dist/features/exportStatic.js +18 -3
  14. package/dist/features/routes.js +21 -5
  15. package/dist/features/sitemap.d.ts +3 -0
  16. package/dist/features/sitemap.js +64 -0
  17. package/dist/features/tabs.js +7 -4
  18. package/dist/features/theme/loader.js +1 -1
  19. package/dist/loaders/markdown/index.js +7 -6
  20. package/dist/loaders/markdown/transformer/index.d.ts +1 -1
  21. package/dist/loaders/markdown/transformer/rehypeDemo.js +2 -1
  22. package/dist/loaders/markdown/transformer/rehypeEnhancedTag.js +12 -2
  23. package/dist/loaders/markdown/transformer/rehypeSlug.js +2 -1
  24. package/dist/loaders/markdown/transformer/remarkEmbed.js +33 -9
  25. package/dist/loaders/markdown/transformer/remarkMeta.js +1 -1
  26. package/dist/loaders/page/index.js +1 -1
  27. package/dist/preset.js +2 -1
  28. package/dist/service/cli.js +1 -0
  29. package/package.json +9 -8
  30. package/theme-default/builtins/Badge/index.less +1 -1
  31. package/theme-default/builtins/Container/index.js +1 -1
  32. package/theme-default/builtins/Container/index.less +45 -17
  33. package/theme-default/builtins/Previewer/index.less +1 -1
  34. package/theme-default/builtins/SourceCode/index.less +1 -0
  35. package/theme-default/layouts/DocLayout/index.js +1 -2
  36. package/theme-default/layouts/DocLayout/index.less +2 -1
  37. package/theme-default/locales/en-US.json +1 -0
  38. package/theme-default/locales/zh-CN.json +1 -0
  39. package/theme-default/slots/Content/index.less +6 -2
  40. package/theme-default/slots/ContentTabs/index.less +2 -2
  41. package/theme-default/slots/Features/index.less +4 -4
  42. package/theme-default/slots/Header/index.js +2 -1
  43. package/theme-default/slots/Hero/index.less +1 -1
  44. package/theme-default/slots/LangSwitch/index.less +5 -2
  45. package/theme-default/slots/Logo/index.less +1 -1
  46. package/theme-default/slots/Navbar/index.less +2 -2
  47. package/theme-default/slots/PreviewerActions/index.d.ts +1 -1
  48. package/theme-default/slots/PreviewerActions/index.js +13 -3
  49. package/theme-default/slots/PreviewerActions/index.less +147 -148
  50. package/theme-default/slots/RtlSwitch/index.d.ts +4 -0
  51. package/theme-default/slots/RtlSwitch/index.js +50 -0
  52. package/theme-default/slots/RtlSwitch/index.less +5 -0
  53. package/theme-default/slots/SearchBar/index.js +2 -2
  54. package/theme-default/slots/SearchBar/index.less +9 -7
  55. package/theme-default/slots/SearchResult/index.js +7 -0
  56. package/theme-default/slots/SearchResult/index.less +12 -9
  57. package/theme-default/slots/Sidebar/index.less +5 -2
  58. package/theme-default/slots/Toc/index.less +2 -2
@@ -0,0 +1,64 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/features/sitemap.ts
23
+ var sitemap_exports = {};
24
+ __export(sitemap_exports, {
25
+ default: () => sitemap_default
26
+ });
27
+ module.exports = __toCommonJS(sitemap_exports);
28
+ var import_fs = __toESM(require("fs"));
29
+ var import_path = __toESM(require("path"));
30
+ var import_sitemap = require("sitemap");
31
+ var sitemap_default = (api) => {
32
+ api.describe({
33
+ key: "sitemap",
34
+ config: {
35
+ schema(joi) {
36
+ return joi.object({
37
+ hostname: joi.string().required(),
38
+ exclude: joi.array().items(joi.string())
39
+ });
40
+ }
41
+ },
42
+ enableBy: ({ userConfig, env }) => userConfig.sitemap && env === "production"
43
+ });
44
+ api.onBuildComplete(async () => {
45
+ const smis = new import_sitemap.SitemapStream({
46
+ hostname: api.config.sitemap.hostname,
47
+ xmlns: { video: false, image: false, news: false, xhtml: false }
48
+ });
49
+ const exclude = ["/404"].concat(api.config.sitemap.exclude);
50
+ const writeStream = import_fs.default.createWriteStream(import_path.default.join(api.paths.absOutputPath, "sitemap.xml"));
51
+ smis.pipe(writeStream);
52
+ Object.values(api.appData.routes).forEach((route) => {
53
+ if (!exclude.includes(route.path) && ![":", "*"].some((char) => route.path.includes(char))) {
54
+ smis.write({ url: route.path });
55
+ }
56
+ });
57
+ smis.end();
58
+ await new Promise((resolve) => {
59
+ writeStream.on("close", resolve);
60
+ });
61
+ });
62
+ };
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {});
@@ -55,6 +55,7 @@ var tabs_default = (api) => {
55
55
  api.modifyRoutes((routes) => {
56
56
  tabs.length = 0;
57
57
  Object.values(routes).forEach((route) => {
58
+ var _a;
58
59
  if (route.file && isTabRouteFile(route.file)) {
59
60
  delete routes[route.id];
60
61
  const rtlFile = (0, import_plugin_utils.winPath)(import_path.default.relative(api.cwd, route.file));
@@ -67,12 +68,14 @@ var tabs_default = (api) => {
67
68
  id: routeId,
68
69
  file: route.file
69
70
  });
70
- routesTabMapping[parentFile] ?? (routesTabMapping[parentFile] = []);
71
- routesTabMapping[parentFile].push(routeId);
71
+ if (!((_a = routesTabMapping[parentFile]) == null ? void 0 : _a.includes(routeId))) {
72
+ routesTabMapping[parentFile] ?? (routesTabMapping[parentFile] = []);
73
+ routesTabMapping[parentFile].push(routeId);
74
+ }
72
75
  } else {
73
76
  tabsFromPlugins.forEach((tab) => {
74
- var _a, _b;
75
- if ((!tab.test || route.absPath.match(tab.test)) && !((_a = routesTabMapping[route.file]) == null ? void 0 : _a.includes(tab.id))) {
77
+ var _a2, _b;
78
+ if ((!tab.test || route.absPath.match(tab.test)) && !((_a2 = routesTabMapping[route.file]) == null ? void 0 : _a2.includes(tab.id))) {
76
79
  routesTabMapping[_b = route.file] ?? (routesTabMapping[_b] = []);
77
80
  routesTabMapping[route.file].push(tab.id);
78
81
  }
@@ -29,7 +29,7 @@ var import_path = __toESM(require("path"));
29
29
  var import_plugin_utils = require("umi/plugin-utils");
30
30
  function getComponentMapFromDir(globExp, dir) {
31
31
  return import_plugin_utils.glob.sync(globExp, { cwd: dir }).reduce((ret, file) => {
32
- const specifier = import_path.default.basename(file.replace(/(\/index)?\.[a-z]+$/, ""));
32
+ const specifier = import_path.default.basename((0, import_plugin_utils.winPath)(file).replace(/(\/index)?\.[a-z]+$/, ""));
33
33
  if (/^[A-Z\d]/.test(specifier)) {
34
34
  ret[specifier] = {
35
35
  specifier,
@@ -40,10 +40,11 @@ function getDemoSourceFiles(demos = []) {
40
40
  }, []);
41
41
  }
42
42
  function emit(opts, ret) {
43
+ const { demos, embeds } = ret.meta;
44
+ embeds.forEach((file) => this.addDependency(file));
45
+ getDemoSourceFiles(demos).forEach((file) => this.addDependency(file));
43
46
  if (opts.mode === "meta") {
44
- const { demos, frontmatter, toc, texts, embeds = [] } = ret.meta;
45
- embeds.forEach((file) => this.addDependency(file));
46
- getDemoSourceFiles(demos).forEach((file) => this.addDependency(file));
47
+ const { frontmatter, toc, texts } = ret.meta;
47
48
  if (demos && opts.onResolveDemos) {
48
49
  opts.onResolveDemos(demos);
49
50
  }
@@ -121,15 +122,15 @@ function mdLoader(content) {
121
122
  } else if (cacheKey in deferrer) {
122
123
  deferrer[cacheKey].then((res) => {
123
124
  cb(null, emit.call(this, opts, res));
124
- });
125
+ }).catch(cb);
125
126
  return;
126
127
  }
127
128
  deferrer[cacheKey] = (0, import_transformer.default)(content, {
128
129
  ...import_plugin_utils.lodash.omit(opts, ["mode", "builtins", "onResolveDemos"]),
129
- fileAbsPath: this.resourcePath
130
+ fileAbsPath: (0, import_plugin_utils.winPath)(this.resourcePath)
130
131
  });
131
132
  deferrer[cacheKey].then((ret) => {
132
- depsMapping[this.resourcePath] = (ret.meta.embeds || []).concat(getDemoSourceFiles(ret.meta.demos));
133
+ depsMapping[this.resourcePath] = ret.meta.embeds.concat(getDemoSourceFiles(ret.meta.demos));
133
134
  const finalCacheKey = [
134
135
  baseCacheKey,
135
136
  getDepsCacheKey(depsMapping[this.resourcePath])
@@ -29,7 +29,7 @@ declare module 'vfile' {
29
29
  texts: IRouteMeta['texts'];
30
30
  frontmatter: IRouteMeta['frontmatter'];
31
31
  toc: IRouteMeta['toc'];
32
- embeds?: string[];
32
+ embeds: string[];
33
33
  }
34
34
  }
35
35
  export interface IMdTransformerOptions {
@@ -139,9 +139,10 @@ function rehypeDemo(opts) {
139
139
  const previewerProps = {};
140
140
  let component = "";
141
141
  if (codeType === "external") {
142
+ const chunkName = [vFile.data.frontmatter.atomId, "demos"].filter(Boolean).join("__");
142
143
  parseOpts.fileAbsPath = codeNode.properties.src;
143
144
  parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, import_path.default.parse(parseOpts.fileAbsPath).name, vFile.data.frontmatter.atomId);
144
- component = `React.lazy(() => import('${(0, import_plugin_utils.winPath)(parseOpts.fileAbsPath)}?techStack=${techStack.name}'))`;
145
+ component = `React.lazy(() => import( /* webpackChunkName: "${chunkName}" */ '${(0, import_plugin_utils.winPath)(parseOpts.fileAbsPath)}?techStack=${techStack.name}'))`;
145
146
  codeNode.properties.title = codeValue || void 0;
146
147
  (_a2 = codeNode.properties).filename ?? (_a2.filename = (0, import_plugin_utils.winPath)(import_path.default.relative(opts.cwd, parseOpts.fileAbsPath)));
147
148
  } else {
@@ -51,9 +51,19 @@ function rehypeEnhancedTag() {
51
51
  }
52
52
  ]
53
53
  });
54
- }
55
- if (node.tagName === "table") {
54
+ } else if (node.tagName === "table") {
56
55
  node.tagName = "Table";
56
+ } else if (node.tagName === "style") {
57
+ node.JSXAttributes = [
58
+ {
59
+ type: "JSXAttribute",
60
+ name: "dangerouslySetInnerHTML",
61
+ value: JSON.stringify({
62
+ __html: toString(node)
63
+ })
64
+ }
65
+ ];
66
+ node.children = [];
57
67
  }
58
68
  });
59
69
  };
@@ -59,7 +59,8 @@ function rehypeSlug() {
59
59
  vFile.data.toc.push({
60
60
  id: slugger.slug(demo.id),
61
61
  depth: ((_b2 = (_a2 = vFile.data.frontmatter) == null ? void 0 : _a2.demo) == null ? void 0 : _b2.tocDepth) || 3,
62
- title: previewerProps.title
62
+ title: previewerProps.title,
63
+ ...previewerProps.debug ? { _debug_demo: true } : {}
63
64
  });
64
65
  }
65
66
  });
@@ -37,15 +37,16 @@ var remarkParse;
37
37
  var remarkFrontmatter;
38
38
  var visit;
39
39
  (async () => {
40
- ({ visit } = await import("unist-util-visit"));
40
+ ({ visitParents: visit } = await import("unist-util-visit-parents"));
41
41
  ({ unified } = await import("unified"));
42
42
  ({ default: remarkParse } = await import("remark-parse"));
43
43
  ({ default: remarkFrontmatter } = await import("remark-frontmatter"));
44
44
  })();
45
45
  function remarkRawAST() {
46
46
  this.Compiler = function Compiler(ast) {
47
- visit(ast, "yaml", (_node, i, parent) => {
48
- parent.children.splice(i, 1);
47
+ visit(ast, "yaml", (node, ancestors) => {
48
+ const parent = ancestors[ancestors.length - 1];
49
+ ancestors[ancestors.length - 1].children.splice(parent.children.indexOf(node), 1);
49
50
  });
50
51
  return ast;
51
52
  };
@@ -56,10 +57,14 @@ function remarkEmbed(opts) {
56
57
  alias: opts.alias
57
58
  });
58
59
  return (tree, vFile) => {
59
- visit(tree, "html", (node, i, parent) => {
60
- var _a, _b;
60
+ vFile.data.embeds = [];
61
+ visit(tree, "html", (node, ancestors) => {
62
+ var _a;
61
63
  if (node.value.startsWith(EMBED_OPEN_TAG)) {
62
64
  let relatedNodeCount = 1;
65
+ const parent = ancestors[ancestors.length - 1];
66
+ const grandParent = ancestors[ancestors.length - 2];
67
+ const i = parent.children.indexOf(node);
63
68
  const src = (_a = node.value.match(/src=("|')([^"']+)\1/)) == null ? void 0 : _a[2];
64
69
  if (src) {
65
70
  const parsed = import_url.default.parse(src);
@@ -71,7 +76,10 @@ function remarkEmbed(opts) {
71
76
  } else if (hash.startsWith("RE-")) {
72
77
  content = (0, import_utils.getFileContentByRegExp)(content, hash.slice(3), absPath);
73
78
  }
74
- const mdast = unified().use(remarkParse).use(remarkEmbed, { ...opts, fileAbsPath: absPath }).use(remarkFrontmatter).use(remarkRawAST).processSync(content).result;
79
+ const {
80
+ result: mdast,
81
+ data: { embeds }
82
+ } = unified().use(remarkParse).use(remarkEmbed, { ...opts, fileAbsPath: absPath }).use(remarkFrontmatter).use(remarkRawAST).processSync(content);
75
83
  if (!node.value.endsWith(EMBED_CLOSE_TAG)) {
76
84
  for (let j = i; j < parent.children.length; j++) {
77
85
  const sibling = parent.children[j];
@@ -84,9 +92,25 @@ function remarkEmbed(opts) {
84
92
  }
85
93
  }
86
94
  }
87
- parent.children.splice(i, relatedNodeCount, ...mdast.children);
88
- (_b = vFile.data).embeds ?? (_b.embeds = []);
89
- vFile.data.embeds.push(absPath);
95
+ const newParentNodes = [
96
+ ...mdast.children
97
+ ];
98
+ const before = parent.children.slice(0, i);
99
+ const after = parent.children.slice(i + relatedNodeCount);
100
+ if (before.length) {
101
+ newParentNodes.unshift({
102
+ type: "paragraph",
103
+ children: before
104
+ });
105
+ }
106
+ if (after.length) {
107
+ newParentNodes.push({
108
+ type: "paragraph",
109
+ children: after
110
+ });
111
+ }
112
+ grandParent.children.splice(grandParent.children.indexOf(parent), 1, ...newParentNodes);
113
+ vFile.data.embeds.push(...[absPath].concat(embeds));
90
114
  }
91
115
  }
92
116
  });
@@ -43,7 +43,7 @@ function getGuessAtomId(opts) {
43
43
  if (atomFile) {
44
44
  const atomAbsDir = opts.resolve.atomDirs.map(({ dir }) => import_path.default.resolve(opts.cwd, dir)).sort((a, b) => b.split("/").length - a.split("/").length).find((dir) => atomFile.startsWith(dir));
45
45
  if (atomAbsDir) {
46
- return import_path.default.relative(atomAbsDir, atomFile).replace(/((^|\/)index)?\.\w+$/, "");
46
+ return (0, import_plugin_utils.winPath)(import_path.default.relative(atomAbsDir, atomFile)).replace(/((^|\/)index)?\.\w+$/, "");
47
47
  }
48
48
  }
49
49
  }
@@ -29,7 +29,7 @@ var import_utils = require("../../utils");
29
29
  var import_path = __toESM(require("path"));
30
30
  var import_plugin_utils = require("umi/plugin-utils");
31
31
  function pageMetaLoader(raw) {
32
- const pathWithoutIndex = this.resourcePath.replace(/(\/index([^/]+)?)?\.(j|t)sx?$/, "");
32
+ const pathWithoutIndex = (0, import_plugin_utils.winPath)(this.resourcePath).replace(/(\/index([^/]+)?)?\.(j|t)sx?$/, "");
33
33
  let { frontmatter } = (0, import_utils.parseCodeFrontmatter)(raw);
34
34
  frontmatter || (frontmatter = {});
35
35
  frontmatter.title ?? (frontmatter.title = import_plugin_utils.lodash.startCase(import_path.default.basename(pathWithoutIndex)));
package/dist/preset.js CHANGED
@@ -56,7 +56,8 @@ var preset_default = (api) => {
56
56
  require.resolve("./features/locales"),
57
57
  require.resolve("./features/parser"),
58
58
  require.resolve("./features/assets"),
59
- require.resolve("./features/exportStatic")
59
+ require.resolve("./features/exportStatic"),
60
+ require.resolve("./features/sitemap")
60
61
  ]
61
62
  };
62
63
  };
@@ -48,6 +48,7 @@ async function run(opts) {
48
48
  if (opts == null ? void 0 : opts.presets) {
49
49
  process.env.DUMI_PRESETS = opts.presets.join(",");
50
50
  }
51
+ process.env.DID_YOU_KNOW = "none";
51
52
  if (command === import_constants.DEV_COMMAND) {
52
53
  (0, import_dev.dev)();
53
54
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.0",
4
4
  "description": "Framework for developing UI components",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -54,11 +54,12 @@
54
54
  "dependencies": {
55
55
  "@ant-design/icons-svg": "^4.2.1",
56
56
  "@makotot/ghostui": "^2.0.0",
57
+ "@stackblitz/sdk": "^1.8.1",
57
58
  "@swc/core": "^1.2.224",
58
59
  "@types/hast": "^2.3.4",
59
60
  "@types/mdast": "^3.0.10",
60
- "@umijs/bundler-utils": "^4.0.30",
61
- "@umijs/core": "^4.0.30",
61
+ "@umijs/bundler-utils": "^4.0.32",
62
+ "@umijs/core": "^4.0.32",
62
63
  "codesandbox": "^2.2.3",
63
64
  "deepmerge": "^4.2.2",
64
65
  "dumi-afx-deps": "^1.0.0-alpha.1",
@@ -84,7 +85,7 @@
84
85
  "raw-loader": "^4.0.2",
85
86
  "rc-tabs": "12.1.0-alpha.1",
86
87
  "react-copy-to-clipboard": "^5.1.0",
87
- "react-helmet": "^6.1.0",
88
+ "react-error-boundary": "^3.1.4",
88
89
  "react-intl": "^6.1.1",
89
90
  "rehype-autolink-headings": "^6.1.1",
90
91
  "rehype-remove-comments": "^5.0.0",
@@ -96,7 +97,8 @@
96
97
  "remark-parse": "^10.0.1",
97
98
  "remark-rehype": "^10.1.0",
98
99
  "sass": "^1.55.0",
99
- "umi": "^4.0.30",
100
+ "sitemap": "^7.1.1",
101
+ "umi": "^4.0.32",
100
102
  "unified": "^10.1.2",
101
103
  "unist-util-visit": "^4.1.0",
102
104
  "unist-util-visit-parents": "^5.1.1",
@@ -115,9 +117,8 @@
115
117
  "@types/pluralize": "^0.0.29",
116
118
  "@types/react": "^18.0.16",
117
119
  "@types/react-copy-to-clipboard": "^5.0.4",
118
- "@types/react-helmet": "^6.1.5",
119
- "@umijs/lint": "^4.0.30",
120
- "@umijs/plugins": "^4.0.30",
120
+ "@umijs/lint": "^4.0.32",
121
+ "@umijs/plugins": "^4.0.32",
121
122
  "eslint": "^8.20.0",
122
123
  "father": "^4.1.0",
123
124
  "husky": "^8.0.1",
@@ -2,7 +2,7 @@
2
2
 
3
3
  .@{prefix}-badge {
4
4
  display: inline-block;
5
- margin-left: 2px;
5
+ margin-inline-start: 2px;
6
6
  padding: 1px 8px;
7
7
  font-size: 12px;
8
8
  font-weight: 400;
@@ -33,7 +33,7 @@ var Container = function Container(props) {
33
33
  return /*#__PURE__*/React.createElement("div", {
34
34
  className: "dumi-default-container markdown",
35
35
  "data-type": props.type
36
- }, /*#__PURE__*/React.createElement(Icon, null), /*#__PURE__*/React.createElement("h4", null, props.title || props.type.toUpperCase()), props.children);
36
+ }, /*#__PURE__*/React.createElement(Icon, null), /*#__PURE__*/React.createElement("h4", null, props.title || props.type.toUpperCase()), /*#__PURE__*/React.createElement("section", null, props.children));
37
37
  };
38
38
 
39
39
  export default Container;
@@ -1,36 +1,52 @@
1
1
  @import (reference) '../../styles/variables.less';
2
2
 
3
- .@{prefix}-container {
4
- margin: 24px 0 32px;
5
- padding: 18px 16px 18px 44px;
3
+ .@{prefix}-container.markdown {
4
+ padding: 18px 0;
5
+ padding-inline-start: 44px;
6
+ padding-inline-end: 16px;
6
7
  border-radius: 4px;
7
8
 
9
+ &:not(:first-child) {
10
+ margin-bottom: 24px;
11
+ }
12
+
13
+ &:not(:last-child) {
14
+ margin-top: 32px;
15
+ }
16
+
8
17
  > svg {
9
18
  float: left;
10
19
  fill: currentcolor;
11
- margin-left: -26px;
20
+ margin-inline-start: -26px;
12
21
  width: 18px;
22
+
23
+ [data-direction='rtl'] & {
24
+ float: right;
25
+ }
13
26
  }
14
27
 
15
28
  > h4 {
16
- margin: 1px 0 0;
29
+ clear: none;
30
+ margin: 0 0 12px;
17
31
  font-size: 15px;
18
- line-height: 1;
32
+ line-height: 17px;
19
33
  }
20
34
 
21
- > p {
22
- margin: 8px 0 0;
35
+ > section {
23
36
  font-size: 15px;
24
- line-height: 1.2;
25
37
  }
26
38
 
27
39
  &[data-type='info'] {
28
40
  @color: darken(desaturate(@c-primary, 45%), 10%);
29
41
 
30
- color: @color;
31
42
  background: lighten(@c-primary, 42%);
32
43
 
33
- > p {
44
+ > h4,
45
+ > svg {
46
+ color: @color;
47
+ }
48
+
49
+ > section {
34
50
  color: desaturate(@color, 20%);
35
51
  }
36
52
  }
@@ -38,10 +54,14 @@
38
54
  &[data-type='warning'] {
39
55
  @color: darken(desaturate(@c-warning, 20%), 2%);
40
56
 
41
- color: @color;
42
57
  background: lighten(@c-warning, 51%);
43
58
 
44
- > p {
59
+ > h4,
60
+ > svg {
61
+ color: @color;
62
+ }
63
+
64
+ > section {
45
65
  color: desaturate(@color, 24%);
46
66
  }
47
67
  }
@@ -49,10 +69,14 @@
49
69
  &[data-type='success'] {
50
70
  @color: darken(desaturate(@c-success, 5%), 1%);
51
71
 
52
- color: @color;
53
72
  background: lighten(@c-success, 59%);
54
73
 
55
- > p {
74
+ > h4,
75
+ > svg {
76
+ color: @color;
77
+ }
78
+
79
+ > section {
56
80
  color: desaturate(@color, 22%);
57
81
  }
58
82
  }
@@ -60,10 +84,14 @@
60
84
  &[data-type='error'] {
61
85
  @color: darken(desaturate(@c-error, 20%), 1%);
62
86
 
63
- color: @color;
64
87
  background: lighten(@c-error, 51%);
65
88
 
66
- > p {
89
+ > h4,
90
+ > svg {
91
+ color: @color;
92
+ }
93
+
94
+ > section {
67
95
  color: desaturate(@color, 25%);
68
96
  }
69
97
  }
@@ -108,7 +108,7 @@
108
108
  }
109
109
 
110
110
  > strong {
111
- padding-right: 8px;
111
+ padding-inline-end: 8px;
112
112
  color: @c-warning;
113
113
  font-size: 12px;
114
114
  }
@@ -13,6 +13,7 @@
13
13
  margin: 0;
14
14
  padding-left: 24px;
15
15
  padding-right: 24px;
16
+ direction: ltr;
16
17
  background: transparent;
17
18
  }
18
19
 
@@ -11,7 +11,7 @@ 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 { ReactComponent as IconSidebar } from '@ant-design/icons-svg/inline-svg/outlined/align-left.svg';
14
- import { useIntl, useOutlet, useRouteMeta, useSidebarData } from 'dumi';
14
+ import { Helmet, useIntl, useOutlet, useRouteMeta, useSidebarData } from 'dumi';
15
15
  import Content from "dumi/theme/slots/Content";
16
16
  import Features from "dumi/theme/slots/Features";
17
17
  import Footer from "dumi/theme/slots/Footer";
@@ -20,7 +20,6 @@ import Hero from "dumi/theme/slots/Hero";
20
20
  import Sidebar from "dumi/theme/slots/Sidebar";
21
21
  import Toc from "dumi/theme/slots/Toc";
22
22
  import React, { useState } from 'react';
23
- import Helmet from 'react-helmet';
24
23
  import "./index.less";
25
24
 
26
25
  var DocLayout = function DocLayout() {
@@ -6,6 +6,7 @@ body {
6
6
  }
7
7
 
8
8
  .@{prefix}-doc-layout {
9
+ font-family: sans-serif;
9
10
  background-color: @c-site-bg;
10
11
 
11
12
  @media @mobile {
@@ -79,7 +80,7 @@ body {
79
80
  position: sticky;
80
81
  top: @s-header-height + 30px;
81
82
  width: @s-sidebar-width;
82
- margin-left: 24px;
83
+ margin-inline-start: 24px;
83
84
  max-height: 80vh;
84
85
  overflow: auto;
85
86
  overscroll-behavior: contain;
@@ -5,6 +5,7 @@
5
5
  "previewer.actions.code.shrink": "Hide Code",
6
6
  "previewer.actions.codesandbox": "Open in CodeSandbox",
7
7
  "previewer.actions.codepen": "Open in CodePen (Not implemented)",
8
+ "previewer.actions.stackblitz": "Open in StackBlitz",
8
9
  "previewer.actions.separate": "Open in separate page",
9
10
  "404.title": "PAGE NOT FOUND",
10
11
  "404.back": "Back to homepage",
@@ -5,6 +5,7 @@
5
5
  "previewer.actions.code.shrink": "收起代码",
6
6
  "previewer.actions.codesandbox": "在 CodeSandbox 中打开",
7
7
  "previewer.actions.codepen": "在 CodePen 中打开(未实现)",
8
+ "previewer.actions.stackblitz": "在 StackBlitz 中打开",
8
9
  "previewer.actions.separate": "在独立页面中打开",
9
10
  "404.title": "页面未找到",
10
11
  "404.back": "返回首页",
@@ -66,14 +66,18 @@
66
66
  > a[aria-hidden]:first-child {
67
67
  float: left;
68
68
  width: 20px;
69
- padding-right: 4px;
70
- margin-left: -24px;
69
+ padding-inline-end: 4px;
70
+ margin-inline-start: -24px;
71
71
  color: @c-text;
72
72
  // hide phantom blank node
73
73
  font-size: 0;
74
74
  text-align: right;
75
75
  line-height: inherit;
76
76
 
77
+ [data-direction='rtl'] & {
78
+ float: right;
79
+ }
80
+
77
81
  &:hover {
78
82
  border: 0;
79
83
  }
@@ -43,10 +43,10 @@
43
43
  }
44
44
 
45
45
  &:not(last-child) {
46
- margin-right: 42px;
46
+ margin-inline-end: 42px;
47
47
 
48
48
  @media @mobile {
49
- margin-right: 20px;
49
+ margin-inline-end: 20px;
50
50
  }
51
51
  }
52
52
 
@@ -11,12 +11,12 @@
11
11
  width: 46%;
12
12
 
13
13
  &:nth-child(odd) {
14
- margin-right: 8%;
14
+ margin-inline-end: 8%;
15
15
  }
16
16
 
17
17
  @media @mobile {
18
18
  width: 100%;
19
- margin-right: 0;
19
+ margin-inline-end: 0;
20
20
  }
21
21
  }
22
22
 
@@ -24,12 +24,12 @@
24
24
  width: 31.4%;
25
25
 
26
26
  &:not(:nth-child(3n)) {
27
- margin-right: 2.9%;
27
+ margin-inline-end: 2.9%;
28
28
  }
29
29
 
30
30
  @media @mobile {
31
31
  width: 100%;
32
- margin-right: 0;
32
+ margin-inline-end: 0;
33
33
  }
34
34
  }
35
35
 
@@ -16,6 +16,7 @@ import { useRouteMeta } from 'dumi';
16
16
  import LangSwitch from "dumi/theme/slots/LangSwitch";
17
17
  import Logo from "dumi/theme/slots/Logo";
18
18
  import Navbar from "dumi/theme/slots/Navbar";
19
+ import RtlSwitch from "dumi/theme/slots/RtlSwitch";
19
20
  import SearchBar from "dumi/theme/slots/SearchBar";
20
21
  import React, { useState } from 'react';
21
22
  import "./index.less";
@@ -44,7 +45,7 @@ var Header = function Header() {
44
45
  className: "dumi-default-header-right"
45
46
  }, /*#__PURE__*/React.createElement(Navbar, null), /*#__PURE__*/React.createElement("div", {
46
47
  className: "dumi-default-header-right-aside"
47
- }, /*#__PURE__*/React.createElement(SearchBar, null), /*#__PURE__*/React.createElement(LangSwitch, null))), /*#__PURE__*/React.createElement("button", {
48
+ }, /*#__PURE__*/React.createElement(SearchBar, null), /*#__PURE__*/React.createElement(LangSwitch, null), /*#__PURE__*/React.createElement(RtlSwitch, null))), /*#__PURE__*/React.createElement("button", {
48
49
  type: "button",
49
50
  className: "dumi-default-header-menu-btn",
50
51
  onClick: function onClick(ev) {