dumi 2.0.0-rc.9 → 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 (52) hide show
  1. package/dist/client/theme-api/DumiDemo.js +5 -2
  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/useSiteSearch/index.d.ts +7 -0
  8. package/dist/client/theme-api/useSiteSearch/index.js +108 -0
  9. package/dist/client/theme-api/{useSiteSearch.d.ts → useSiteSearch/worker.d.ts} +1 -7
  10. package/dist/client/theme-api/{useSiteSearch.js → useSiteSearch/worker.js} +36 -69
  11. package/dist/constants.js +0 -1
  12. package/dist/features/exportStatic.js +18 -3
  13. package/dist/features/routes.js +18 -3
  14. package/dist/features/tabs.js +7 -4
  15. package/dist/features/theme/loader.js +1 -1
  16. package/dist/loaders/markdown/index.js +6 -5
  17. package/dist/loaders/markdown/transformer/index.d.ts +1 -1
  18. package/dist/loaders/markdown/transformer/rehypeEnhancedTag.js +12 -2
  19. package/dist/loaders/markdown/transformer/remarkEmbed.js +33 -9
  20. package/dist/loaders/markdown/transformer/remarkMeta.js +1 -1
  21. package/dist/loaders/page/index.js +1 -1
  22. package/dist/service/cli.js +1 -0
  23. package/package.json +7 -8
  24. package/theme-default/builtins/Badge/index.less +1 -1
  25. package/theme-default/builtins/Container/index.js +1 -1
  26. package/theme-default/builtins/Container/index.less +15 -11
  27. package/theme-default/builtins/Previewer/index.less +1 -1
  28. package/theme-default/builtins/SourceCode/index.less +1 -0
  29. package/theme-default/layouts/DocLayout/index.js +1 -2
  30. package/theme-default/layouts/DocLayout/index.less +2 -1
  31. package/theme-default/locales/en-US.json +1 -0
  32. package/theme-default/locales/zh-CN.json +1 -0
  33. package/theme-default/slots/Content/index.less +6 -2
  34. package/theme-default/slots/ContentTabs/index.less +2 -2
  35. package/theme-default/slots/Features/index.less +4 -4
  36. package/theme-default/slots/Header/index.js +2 -1
  37. package/theme-default/slots/Hero/index.less +1 -1
  38. package/theme-default/slots/LangSwitch/index.less +5 -2
  39. package/theme-default/slots/Logo/index.less +1 -1
  40. package/theme-default/slots/Navbar/index.less +2 -2
  41. package/theme-default/slots/PreviewerActions/index.d.ts +1 -1
  42. package/theme-default/slots/PreviewerActions/index.js +13 -3
  43. package/theme-default/slots/PreviewerActions/index.less +147 -148
  44. package/theme-default/slots/RtlSwitch/index.d.ts +4 -0
  45. package/theme-default/slots/RtlSwitch/index.js +50 -0
  46. package/theme-default/slots/RtlSwitch/index.less +5 -0
  47. package/theme-default/slots/SearchBar/index.js +2 -2
  48. package/theme-default/slots/SearchBar/index.less +9 -7
  49. package/theme-default/slots/SearchResult/index.js +7 -0
  50. package/theme-default/slots/SearchResult/index.less +12 -9
  51. package/theme-default/slots/Sidebar/index.less +5 -2
  52. package/theme-default/slots/Toc/index.less +2 -2
@@ -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
  };
@@ -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)));
@@ -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.9",
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.0-canary.20221114.1",
61
- "@umijs/core": "4.0.0-canary.20221114.1",
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",
@@ -85,7 +86,6 @@
85
86
  "rc-tabs": "12.1.0-alpha.1",
86
87
  "react-copy-to-clipboard": "^5.1.0",
87
88
  "react-error-boundary": "^3.1.4",
88
- "react-helmet": "^6.1.0",
89
89
  "react-intl": "^6.1.1",
90
90
  "rehype-autolink-headings": "^6.1.1",
91
91
  "rehype-remove-comments": "^5.0.0",
@@ -98,7 +98,7 @@
98
98
  "remark-rehype": "^10.1.0",
99
99
  "sass": "^1.55.0",
100
100
  "sitemap": "^7.1.1",
101
- "umi": "4.0.0-canary.20221114.1",
101
+ "umi": "^4.0.32",
102
102
  "unified": "^10.1.2",
103
103
  "unist-util-visit": "^4.1.0",
104
104
  "unist-util-visit-parents": "^5.1.1",
@@ -117,9 +117,8 @@
117
117
  "@types/pluralize": "^0.0.29",
118
118
  "@types/react": "^18.0.16",
119
119
  "@types/react-copy-to-clipboard": "^5.0.4",
120
- "@types/react-helmet": "^6.1.5",
121
- "@umijs/lint": "4.0.0-canary.20221114.1",
122
- "@umijs/plugins": "4.0.0-canary.20221114.1",
120
+ "@umijs/lint": "^4.0.32",
121
+ "@umijs/plugins": "^4.0.32",
123
122
  "eslint": "^8.20.0",
124
123
  "father": "^4.1.0",
125
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,11 +1,13 @@
1
1
  @import (reference) '../../styles/variables.less';
2
2
 
3
3
  .@{prefix}-container.markdown {
4
- padding: 18px 16px 18px 44px;
4
+ padding: 18px 0;
5
+ padding-inline-start: 44px;
6
+ padding-inline-end: 16px;
5
7
  border-radius: 4px;
6
8
 
7
9
  &:not(:first-child) {
8
- margin-top: 24px;
10
+ margin-bottom: 24px;
9
11
  }
10
12
 
11
13
  &:not(:last-child) {
@@ -15,21 +17,23 @@
15
17
  > svg {
16
18
  float: left;
17
19
  fill: currentcolor;
18
- margin-left: -26px;
20
+ margin-inline-start: -26px;
19
21
  width: 18px;
22
+
23
+ [data-direction='rtl'] & {
24
+ float: right;
25
+ }
20
26
  }
21
27
 
22
28
  > h4 {
23
29
  clear: none;
24
- margin: 0;
30
+ margin: 0 0 12px;
25
31
  font-size: 15px;
26
32
  line-height: 17px;
27
33
  }
28
34
 
29
- > p {
30
- margin: 8px 0 0;
35
+ > section {
31
36
  font-size: 15px;
32
- line-height: 1.2;
33
37
  }
34
38
 
35
39
  &[data-type='info'] {
@@ -42,7 +46,7 @@
42
46
  color: @color;
43
47
  }
44
48
 
45
- > p {
49
+ > section {
46
50
  color: desaturate(@color, 20%);
47
51
  }
48
52
  }
@@ -57,7 +61,7 @@
57
61
  color: @color;
58
62
  }
59
63
 
60
- > p {
64
+ > section {
61
65
  color: desaturate(@color, 24%);
62
66
  }
63
67
  }
@@ -72,7 +76,7 @@
72
76
  color: @color;
73
77
  }
74
78
 
75
- > p {
79
+ > section {
76
80
  color: desaturate(@color, 22%);
77
81
  }
78
82
  }
@@ -87,7 +91,7 @@
87
91
  color: @color;
88
92
  }
89
93
 
90
- > p {
94
+ > section {
91
95
  color: desaturate(@color, 25%);
92
96
  }
93
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) {
@@ -72,7 +72,7 @@
72
72
  }
73
73
 
74
74
  &:not(:first-child) {
75
- margin-left: 48px;
75
+ margin-inline-start: 48px;
76
76
  color: @c-primary;
77
77
  border: 1px solid @c-primary;
78
78
  }
@@ -6,6 +6,7 @@
6
6
  line-height: 1;
7
7
  text-decoration: none;
8
8
  transition: all 0.3s;
9
+ cursor: pointer;
9
10
 
10
11
  &:hover {
11
12
  color: @c-primary;
@@ -18,7 +19,9 @@
18
19
 
19
20
  > select {
20
21
  appearance: none;
21
- padding: 6px 18px 6px 10px;
22
+ padding: 6px 0;
23
+ padding-inline-start: 10px;
24
+ padding-inline-end: 18px;
22
25
  color: @c-text-secondary;
23
26
  text-align: right;
24
27
  font-size: 14px;
@@ -28,7 +31,7 @@
28
31
  }
29
32
 
30
33
  > svg {
31
- margin-left: -16px;
34
+ margin-inline-start: -16px;
32
35
  width: 12px;
33
36
  fill: darken(@c-border, 10%);
34
37
  pointer-events: none;
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  img {
21
- margin-right: 10px;
21
+ margin-inline-end: 10px;
22
22
  height: 40px;
23
23
 
24
24
  @media @mobile {
@@ -37,10 +37,10 @@
37
37
  }
38
38
 
39
39
  &:not(:last-child) {
40
- margin-right: 48px;
40
+ margin-inline-end: 48px;
41
41
 
42
42
  @media @mobile {
43
- margin-right: 0;
43
+ margin-inline-end: 0;
44
44
  }
45
45
  }
46
46
  }
@@ -5,7 +5,7 @@ export interface IPreviewerActionsProps extends IPreviewerProps {
5
5
  /**
6
6
  * disabled actions
7
7
  */
8
- disabledActions?: ('CSB' | 'CODEPEN' | 'EXTERNAL')[];
8
+ disabledActions?: ('CSB' | 'CODEPEN' | 'STACKBLITZ' | 'EXTERNAL')[];
9
9
  }
10
10
  declare const PreviewerActions: FC<IPreviewerActionsProps>;
11
11
  export default PreviewerActions;
@@ -12,7 +12,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
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
- import { openCodeSandbox, useIntl } from 'dumi';
15
+ import { ReactComponent as IconStackBlitz } from '@ant-design/icons-svg/inline-svg/outlined/thunderbolt.svg';
16
+ import { openCodeSandbox, openStackBlitz, useIntl } from 'dumi';
16
17
  import SourceCode from "dumi/theme/builtins/SourceCode";
17
18
  import PreviewerActionsExtra from "dumi/theme/slots/PreviewerActionsExtra";
18
19
  import Tabs from 'rc-tabs';
@@ -46,7 +47,7 @@ var IconExternalLink = function IconExternalLink() {
46
47
  };
47
48
 
48
49
  var PreviewerActions = function PreviewerActions(props) {
49
- var _files$activeKey$0$ma, _props$disabledAction, _props$disabledAction2;
50
+ var _files$activeKey$0$ma, _props$disabledAction, _props$disabledAction2, _props$disabledAction3;
50
51
 
51
52
  var intl = useIntl();
52
53
  var files = Object.entries(props.asset.dependencies).filter(function (_ref) {
@@ -79,7 +80,16 @@ var PreviewerActions = function PreviewerActions(props) {
79
80
  onClick: function onClick() {
80
81
  return openCodeSandbox(props);
81
82
  }
82
- }, /*#__PURE__*/React.createElement(IconCodeSandbox, null)), !((_props$disabledAction2 = props.disabledActions) !== null && _props$disabledAction2 !== void 0 && _props$disabledAction2.includes('EXTERNAL')) && /*#__PURE__*/React.createElement("a", {
83
+ }, /*#__PURE__*/React.createElement(IconCodeSandbox, null)), !((_props$disabledAction2 = props.disabledActions) !== null && _props$disabledAction2 !== void 0 && _props$disabledAction2.includes('STACKBLITZ')) && /*#__PURE__*/React.createElement("button", {
84
+ className: "dumi-default-previewer-action-btn",
85
+ type: "button",
86
+ "data-dumi-tooltip": intl.formatMessage({
87
+ id: 'previewer.actions.stackblitz'
88
+ }),
89
+ onClick: function onClick() {
90
+ return openStackBlitz(props);
91
+ }
92
+ }, /*#__PURE__*/React.createElement(IconStackBlitz, null)), !((_props$disabledAction3 = props.disabledActions) !== null && _props$disabledAction3 !== void 0 && _props$disabledAction3.includes('EXTERNAL')) && /*#__PURE__*/React.createElement("a", {
83
93
  target: "_blank",
84
94
  rel: "noreferrer",
85
95
  href: props.demoUrl,