@rspress/plugin-preview 2.0.0-alpha.1 → 2.0.0-alpha.3

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/index.js CHANGED
@@ -38,7 +38,7 @@ function __webpack_require__(moduleId) {
38
38
  __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
39
39
  })();
40
40
  (()=>{
41
- __webpack_require__.r = function(exports1) {
41
+ __webpack_require__.r = (exports1)=>{
42
42
  if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
43
43
  value: 'Module'
44
44
  });
package/dist/utils.js CHANGED
@@ -12,7 +12,7 @@ var __webpack_require__ = {};
12
12
  __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
13
  })();
14
14
  (()=>{
15
- __webpack_require__.r = function(exports1) {
15
+ __webpack_require__.r = (exports1)=>{
16
16
  if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
17
  value: 'Module'
18
18
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-preview",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.3",
4
4
  "description": "A plugin for rspress to preview the code block in markdown/mdx file.",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -17,19 +17,19 @@
17
17
  "static"
18
18
  ],
19
19
  "dependencies": {
20
- "@rsbuild/core": "1.2.16",
20
+ "@rsbuild/core": "1.2.19",
21
21
  "@rsbuild/plugin-babel": "~1.0.4",
22
22
  "@rsbuild/plugin-less": "~1.1.1",
23
23
  "@rsbuild/plugin-react": "~1.1.1",
24
24
  "@rsbuild/plugin-sass": "~1.2.2",
25
25
  "@rsbuild/plugin-solid": "~1.0.5",
26
26
  "lodash": "4.17.21",
27
- "qrcode.react": "^3.2.0",
28
- "@rspress/shared": "2.0.0-alpha.1",
29
- "@rspress/theme-default": "2.0.0-alpha.1"
27
+ "qrcode.react": "^4.2.0",
28
+ "@rspress/shared": "2.0.0-alpha.3",
29
+ "@rspress/theme-default": "2.0.0-alpha.3"
30
30
  },
31
31
  "devDependencies": {
32
- "@rslib/core": "0.5.3",
32
+ "@rslib/core": "0.5.4",
33
33
  "@types/lodash": "^4.17.16",
34
34
  "@types/mdast": "^3.0.15",
35
35
  "@types/node": "^18.11.17",
@@ -40,12 +40,12 @@
40
40
  "react": "^18.3.1",
41
41
  "react-dom": "^18.3.1",
42
42
  "react-router-dom": "^6.29.0",
43
- "typescript": "^5.5.3",
43
+ "typescript": "^5.8.2",
44
44
  "unified": "^10.1.2",
45
45
  "unist-util-visit": "^4.1.2"
46
46
  },
47
47
  "peerDependencies": {
48
- "@rspress/core": "^2.0.0-alpha.1",
48
+ "@rspress/core": "^2.0.0-alpha.3",
49
49
  "react": ">=17.0.0",
50
50
  "react-router-dom": "^6.8.1"
51
51
  },
@@ -9,13 +9,15 @@
9
9
  .rspress-demo-block {
10
10
  padding-bottom: 12px;
11
11
  background-color: var(--rp-demo-block-bg);
12
- &-title {
13
- padding: 12px 12px 8px;
14
- color: #697b8c;
15
- font-size: 14px;
16
- }
17
- &-main {
18
- border-right: none;
19
- border-left: none;
20
- }
12
+ }
13
+
14
+ .rspress-demo-block-title {
15
+ padding: 12px 12px 8px;
16
+ color: #697b8c;
17
+ font-size: 14px;
18
+ }
19
+
20
+ .rspress-demo-block-main {
21
+ border-right: none;
22
+ border-left: none;
21
23
  }
@@ -1,4 +1,4 @@
1
- import './DemoBlock.scss';
1
+ import './DemoBlock.css';
2
2
 
3
3
  interface Props {
4
4
  title: string;
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
3
3
  // @ts-ignore
4
4
  import { normalizeId } from '../../dist/utils';
5
5
  import MobileOperation from './common/mobile-operation';
6
- import './Device.scss';
6
+ import './Device.css';
7
7
 
8
8
  export default () => {
9
9
  const { page } = usePageData();
@@ -0,0 +1,103 @@
1
+ :root {
2
+ --rp-preview-button-hover-bg: #e5e6eb;
3
+ --rp-preview-button-bg: #e5e6eb;
4
+ }
5
+
6
+ .dark {
7
+ --rp-preview-button-hover-bg: #c5c5c5;
8
+ --rp-preview-button-bg: #c5c5c5;
9
+ }
10
+
11
+ .rspress-preview {
12
+ padding: 16px 0;
13
+ }
14
+
15
+ .rspress-preview-wrapper {
16
+ border: 1px solid var(--rp-container-details-border);
17
+ border-radius: var(--rp-radius-small);
18
+ }
19
+
20
+ .rspress-preview-card {
21
+ padding: 16px;
22
+ position: relative;
23
+ border: 1px solid var(--rp-container-details-border);
24
+ border-radius: var(--rp-radius-small);
25
+ display: flex;
26
+ }
27
+
28
+ .rspress-preview-qrcode {
29
+ background-color: #fff;
30
+ width: 120px;
31
+ height: 120px;
32
+ position: absolute;
33
+ top: -132px;
34
+ right: -46px;
35
+ padding: 12px;
36
+ }
37
+
38
+ .rspress-preview-code {
39
+ position: relative;
40
+ overflow: hidden;
41
+ flex: 1 1;
42
+ max-height: 700px;
43
+ }
44
+
45
+ .rspress-preview-code-hide {
46
+ position: relative;
47
+ overflow: hidden;
48
+ display: none;
49
+ }
50
+
51
+ .rspress-preview-code-show {
52
+ margin-top: 16px;
53
+ display: block;
54
+ }
55
+
56
+ .rspress-preview-device {
57
+ position: relative;
58
+ flex: 0 0;
59
+ border-left: 1px solid #e6e6e6;
60
+ display: flex;
61
+ flex-direction: column;
62
+ }
63
+
64
+ .rspress-preview-device iframe {
65
+ border-bottom: 1px solid #e6e6e6;
66
+ width: 360px;
67
+ height: 100%;
68
+ flex: auto;
69
+ }
70
+
71
+ .rspress-preview-operations button {
72
+ width: 28px;
73
+ height: 28px;
74
+ padding: 0;
75
+ text-align: center;
76
+ border-radius: 50%;
77
+ border: 1px solid transparent;
78
+ background-color: var(--rp-c-bg-soft);
79
+ margin-left: 14px;
80
+ }
81
+
82
+ .rspress-preview-operations button:hover {
83
+ background-color: var(--rp-preview-button-hover-bg);
84
+ }
85
+
86
+ .rspress-preview-operations svg {
87
+ display: inline-block;
88
+ vertical-align: -2px;
89
+ }
90
+
91
+ .rspress-preview-operations.mobile {
92
+ display: flex;
93
+ justify-content: flex-end;
94
+ width: 100%;
95
+ padding: 6px;
96
+ }
97
+
98
+ .rspress-preview-operations.web {
99
+ display: flex;
100
+ justify-content: center;
101
+ align-items: center;
102
+ flex: none;
103
+ }
@@ -10,7 +10,7 @@ import {
10
10
  import IconLaunch from '../icons/Launch';
11
11
  import IconQrcode from '../icons/Qrcode';
12
12
  import IconRefresh from '../icons/Refresh';
13
- import './index.scss';
13
+ import './index.css';
14
14
 
15
15
  const locales = {
16
16
  zh: {
@@ -23,13 +23,9 @@
23
23
  margin-left: var(--rp-preview-padding);
24
24
  }
25
25
 
26
- .rspress-doc-container {
27
- padding-right: var(--rp-preview-padding);
28
- padding-left: var(--rp-preview-padding);
29
- }
30
-
31
26
  .rspress-doc {
32
27
  width: 100%;
28
+ padding-left: var(--rp-preview-padding);
33
29
  padding-right: var(--rp-preview-padding);
34
30
  }
35
31
  }
@@ -1,104 +0,0 @@
1
- :root {
2
- --rp-preview-button-hover-bg: #e5e6eb;
3
- --rp-preview-button-bg: #e5e6eb;
4
- }
5
-
6
- .dark {
7
- --rp-preview-button-hover-bg: #c5c5c5;
8
- --rp-preview-button-bg: #c5c5c5;
9
- }
10
-
11
- .rspress-preview {
12
- padding: 16px 0;
13
-
14
- &-wrapper {
15
- border: 1px solid var(--rp-container-details-border);
16
- border-radius: var(--rp-radius-small);
17
- }
18
-
19
- &-card {
20
- padding: 16px;
21
- position: relative;
22
- border: 1px solid var(--rp-container-details-border);
23
- border-radius: var(--rp-radius-small);
24
- display: flex;
25
- }
26
-
27
- &-qrcode {
28
- background-color: #fff;
29
- width: 120px;
30
- height: 120px;
31
- position: absolute;
32
- top: -132px;
33
- right: -46px;
34
- padding: 12px;
35
- }
36
-
37
- &-code {
38
- position: relative;
39
- overflow: hidden;
40
- flex: 1 1;
41
- max-height: 700px;
42
- }
43
-
44
- &-code-hide {
45
- position: relative;
46
- overflow: hidden;
47
- display: none;
48
- }
49
-
50
- &-code-show {
51
- margin-top: 16px;
52
- display: block;
53
- }
54
-
55
- &-device {
56
- position: relative;
57
- flex: 0 0;
58
- border-left: 1px solid #e6e6e6;
59
- display: flex;
60
- flex-direction: column;
61
- iframe {
62
- border-bottom: 1px solid #e6e6e6;
63
- width: 360px;
64
- height: 100%;
65
- flex: auto;
66
- }
67
- }
68
-
69
- &-operations {
70
- button {
71
- width: 28px;
72
- height: 28px;
73
- padding: 0;
74
- text-align: center;
75
- border-radius: 50%;
76
- border: 1px solid transparent;
77
- background-color: var(--rp-c-bg-soft);
78
- margin-left: 14px;
79
-
80
- &:hover {
81
- background-color: var(--rp-preview-button-hover-bg);
82
- }
83
- }
84
-
85
- svg {
86
- display: inline-block;
87
- vertical-align: -2px;
88
- }
89
-
90
- &.mobile {
91
- display: flex;
92
- justify-content: flex-end;
93
- width: 100%;
94
- padding: 6px;
95
- }
96
-
97
- &.web {
98
- display: flex;
99
- justify-content: center;
100
- align-items: center;
101
- flex: none;
102
- }
103
- }
104
- }