@rspress/plugin-preview 2.0.0-alpha.1 → 2.0.0-alpha.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.
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.2",
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": {
@@ -25,8 +25,8 @@
25
25
  "@rsbuild/plugin-solid": "~1.0.5",
26
26
  "lodash": "4.17.21",
27
27
  "qrcode.react": "^3.2.0",
28
- "@rspress/shared": "2.0.0-alpha.1",
29
- "@rspress/theme-default": "2.0.0-alpha.1"
28
+ "@rspress/shared": "2.0.0-alpha.2",
29
+ "@rspress/theme-default": "2.0.0-alpha.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@rslib/core": "0.5.3",
@@ -45,7 +45,7 @@
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.2",
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: {
@@ -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
- }