@antv/dumi-theme-antv 0.7.3-beta.1 → 0.7.3-beta.2

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,12 +1,14 @@
1
- import { Helmet, useLocation, useOutlet, useSiteData } from 'dumi';
2
- import React, { useEffect } from 'react';
1
+ import { Helmet, useLocation, useOutlet, useServerInsertedHTML, useSiteData } from 'dumi';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { default as React, useEffect } from 'react';
3
5
  import { getPurePathname } from "../utils/location";
4
6
  import IndexLayout from "./IndexLayout";
5
7
  import ManualLayout from "./ManualLayout";
6
8
 
7
9
  // 用户手动添加自己的
8
- import "../slots/_.less";
9
10
  import "../slots/global";
11
+ import "../slots/_.less";
10
12
 
11
13
  /**
12
14
  * DocLayout 是 dumi2 的内置 layout 入口,在这里使用页面路径进行区分成自己不同的 Layout。
@@ -57,6 +59,25 @@ export default (function () {
57
59
  }
58
60
  return outlet;
59
61
  }, [purePathname]);
62
+
63
+ // 在服务端渲染时注入 CSS 样式
64
+ useServerInsertedHTML(function () {
65
+ var manifestPath = path.resolve(process.cwd(), 'dist/asset-manifest.json');
66
+ var cssContent = '';
67
+ if (fs.existsSync(manifestPath)) {
68
+ var manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
69
+ var cssFile = manifest['umi.css'];
70
+ if (cssFile) {
71
+ var cssPath = path.resolve(process.cwd(), "dist/".concat(cssFile));
72
+ cssContent = fs.existsSync(cssPath) ? fs.readFileSync(cssPath, 'utf-8') : '';
73
+ }
74
+ }
75
+ return /*#__PURE__*/React.createElement("style", {
76
+ dangerouslySetInnerHTML: {
77
+ __html: cssContent
78
+ }
79
+ });
80
+ });
60
81
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("link", {
61
82
  rel: "shortcut icon",
62
83
  href: "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"
@@ -1,10 +1,18 @@
1
1
  import React from 'react';
2
- import "./index.less";
2
+ import styles from "./index.module.less";
3
+
4
+ /**
5
+ * Loading
6
+ */
3
7
  var Loading = function Loading() {
4
8
  return /*#__PURE__*/React.createElement("div", {
5
- className: "loading-container"
9
+ style: {
10
+ position: 'relative',
11
+ height: '100%',
12
+ width: '100%'
13
+ }
6
14
  }, /*#__PURE__*/React.createElement("div", {
7
- className: "loading-wrapper"
15
+ className: styles.loading
8
16
  }, /*#__PURE__*/React.createElement("div", {
9
17
  className: "container"
10
18
  }, /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.7.3-beta.1",
3
+ "version": "0.7.3-beta.2",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "keywords": [
6
6
  "dumi",
@@ -67,7 +67,6 @@
67
67
  "leancloud-storage": "^4.15.2",
68
68
  "lodash-es": "^4.17.21",
69
69
  "lodash.merge": "^4.6.2",
70
- "mini-css-extract-plugin": "^2.9.2",
71
70
  "monaco-editor": "^0.25.2",
72
71
  "nprogress": "^0.2.0",
73
72
  "p-limit": "^3.1.0",
@@ -1,168 +0,0 @@
1
- .loading-container {
2
- position: relative;
3
- height: 100%;
4
- width: 100%;
5
- }
6
-
7
- .loading-wrapper {
8
- position: absolute;
9
- left: 0;
10
- top: 0;
11
- z-index: 9999;
12
- width: 100%;
13
- height: 100%;
14
- background-color: #fff;
15
- border: 1px solid #f0f0f0;
16
- }
17
-
18
- .container {
19
- display: inline-block;
20
- position: absolute;
21
- left: 50%;
22
- top: 50%;
23
- margin: -50px 0 0 -120px;
24
- }
25
-
26
- .loader {
27
- --duration: 3s;
28
- width: 44px;
29
- height: 44px;
30
- position: relative;
31
- display: inline-block;
32
- margin: 0 16px;
33
- }
34
-
35
- .loader:before {
36
- content: ' ';
37
- width: 6px;
38
- height: 6px;
39
- border-radius: 50%;
40
- position: absolute;
41
- display: block;
42
- background: #ff700a;
43
- top: 37px;
44
- left: 19px;
45
- transform: translate(-18px, -18px);
46
- animation: dotRect var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
47
- }
48
-
49
- .loader svg {
50
- display: block;
51
- width: 100%;
52
- height: 100%;
53
- }
54
-
55
- .loader svg rect,
56
- .loader svg polygon,
57
- .loader svg circle {
58
- fill: none;
59
- stroke-width: 10px;
60
- stroke-linejoin: round;
61
- stroke-linecap: round;
62
- }
63
-
64
- .loader svg polygon {
65
- stroke-dasharray: 145 76 145 76;
66
- stroke-dashoffset: 0;
67
- animation: pathTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
68
- }
69
-
70
- .loader svg rect {
71
- stroke-dasharray: 192 64 192 64;
72
- stroke-dashoffset: 0;
73
- animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
74
- }
75
-
76
- .loader svg circle {
77
- stroke-dasharray: 150 50 150 50;
78
- stroke-dashoffset: 75;
79
- animation: pathCircle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
80
- }
81
-
82
- .loader.triangle {
83
- width: 48px;
84
- }
85
-
86
- .loader.triangle:before {
87
- left: 21px;
88
- transform: translate(-10px, -18px);
89
- animation: dotTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
90
- }
91
-
92
- .loading-text {
93
- text-align: center;
94
- height: 40px;
95
- line-height: 40px;
96
- font-size: 12px;
97
- letter-spacing: 0.1em;
98
- color: #666;
99
- }
100
-
101
- @keyframes pathTriangle {
102
- 33% {
103
- stroke-dashoffset: 74;
104
- }
105
- 66% {
106
- stroke-dashoffset: 147;
107
- }
108
- 100% {
109
- stroke-dashoffset: 221;
110
- }
111
- }
112
-
113
- @keyframes dotTriangle {
114
- 33% {
115
- transform: translate(0, 0);
116
- }
117
- 66% {
118
- transform: translate(10px, -18px);
119
- }
120
- 100% {
121
- transform: translate(-10px, -18px);
122
- }
123
- }
124
-
125
- @keyframes pathRect {
126
- 25% {
127
- stroke-dashoffset: 64;
128
- }
129
- 50% {
130
- stroke-dashoffset: 128;
131
- }
132
- 75% {
133
- stroke-dashoffset: 192;
134
- }
135
- 100% {
136
- stroke-dashoffset: 256;
137
- }
138
- }
139
-
140
- @keyframes dotRect {
141
- 25% {
142
- transform: translate(0, 0);
143
- }
144
- 50% {
145
- transform: translate(18px, -18px);
146
- }
147
- 75% {
148
- transform: translate(0, -36px);
149
- }
150
- 100% {
151
- transform: translate(-18px, -18px);
152
- }
153
- }
154
-
155
- @keyframes pathCircle {
156
- 25% {
157
- stroke-dashoffset: 125;
158
- }
159
- 50% {
160
- stroke-dashoffset: 175;
161
- }
162
- 75% {
163
- stroke-dashoffset: 225;
164
- }
165
- 100% {
166
- stroke-dashoffset: 275;
167
- }
168
- }