@rspress/plugin-preview 1.43.13 → 1.44.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +91 -70
- package/dist/utils.js +14 -8
- package/package.json +6 -6
- package/static/global-components/Container.tsx +1 -1
- package/static/global-components/ContainerFixedPerComp.tsx +46 -0
- package/static/global-components/Device.scss +5 -5
- package/static/global-components/Device.tsx +3 -3
- package/static/global-components/common/index.scss +1 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __webpack_modules__ = {
|
3
3
|
"@rsbuild/plugin-less": function(module) {
|
4
|
-
module.exports = import("@rsbuild/plugin-less")
|
4
|
+
module.exports = import("@rsbuild/plugin-less").then(function(module) {
|
5
|
+
return module;
|
6
|
+
});
|
5
7
|
},
|
6
8
|
"@rsbuild/plugin-sass": function(module) {
|
7
|
-
module.exports = import("@rsbuild/plugin-sass")
|
9
|
+
module.exports = import("@rsbuild/plugin-sass").then(function(module) {
|
10
|
+
return module;
|
11
|
+
});
|
8
12
|
}
|
9
13
|
};
|
10
14
|
var __webpack_module_cache__ = {};
|
@@ -18,12 +22,8 @@ function __webpack_require__(moduleId) {
|
|
18
22
|
return module.exports;
|
19
23
|
}
|
20
24
|
(()=>{
|
21
|
-
__webpack_require__.n =
|
22
|
-
var getter = module && module.__esModule ?
|
23
|
-
return module['default'];
|
24
|
-
} : function() {
|
25
|
-
return module;
|
26
|
-
};
|
25
|
+
__webpack_require__.n = (module)=>{
|
26
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
27
27
|
__webpack_require__.d(getter, {
|
28
28
|
a: getter
|
29
29
|
});
|
@@ -31,7 +31,7 @@ function __webpack_require__(moduleId) {
|
|
31
31
|
};
|
32
32
|
})();
|
33
33
|
(()=>{
|
34
|
-
__webpack_require__.d =
|
34
|
+
__webpack_require__.d = (exports1, definition)=>{
|
35
35
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
36
36
|
enumerable: true,
|
37
37
|
get: definition[key]
|
@@ -39,12 +39,10 @@ function __webpack_require__(moduleId) {
|
|
39
39
|
};
|
40
40
|
})();
|
41
41
|
(()=>{
|
42
|
-
__webpack_require__.o =
|
43
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
44
|
-
};
|
42
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
45
43
|
})();
|
46
44
|
(()=>{
|
47
|
-
__webpack_require__.r =
|
45
|
+
__webpack_require__.r = (exports1)=>{
|
48
46
|
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
49
47
|
value: 'Module'
|
50
48
|
});
|
@@ -83,60 +81,63 @@ var __webpack_exports__ = {};
|
|
83
81
|
import DemoBlock from ${JSON.stringify(path)};
|
84
82
|
${str}
|
85
83
|
`;
|
86
|
-
function
|
84
|
+
function generateEntryForPerComponent(demos, entryCssPath, framework) {
|
87
85
|
const sourceEntry = {};
|
88
|
-
|
89
|
-
if ('follow' === position) Object.values(demos).forEach((routes)=>{
|
86
|
+
Object.values(demos).forEach((routes)=>{
|
90
87
|
routes.forEach((route)=>{
|
91
88
|
const { id, path: demoPath } = route;
|
92
89
|
const entry = (0, external_node_path_namespaceObject.join)(virtualDir, `${id}.entry.tsx`);
|
93
90
|
const solidEntry = `
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
91
|
+
import { render } from 'solid-js/web';
|
92
|
+
import ${JSON.stringify(entryCssPath)};
|
93
|
+
import Demo from ${JSON.stringify(demoPath)};
|
94
|
+
render(() => <Demo />, document.getElementById('root'));
|
95
|
+
`;
|
99
96
|
const reactEntry = `
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
97
|
+
import { render } from 'react-dom';
|
98
|
+
import ${JSON.stringify(entryCssPath)};
|
99
|
+
import Demo from ${JSON.stringify(demoPath)};
|
100
|
+
render(<Demo />, document.getElementById('root'));
|
101
|
+
`;
|
105
102
|
const entryContent = 'react' === framework ? reactEntry : solidEntry;
|
106
103
|
(0, external_node_fs_namespaceObject.writeFileSync)(entry, entryContent);
|
107
104
|
sourceEntry[id] = entry;
|
108
105
|
});
|
109
106
|
});
|
110
|
-
|
107
|
+
return sourceEntry;
|
108
|
+
}
|
109
|
+
function generateEntryForPage(demos, entryCssPath, framework) {
|
110
|
+
const sourceEntry = {};
|
111
|
+
Object.entries(demos).forEach(([key, routes])=>{
|
111
112
|
if (0 === routes.length) return;
|
112
113
|
const reactContent = `
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
114
|
+
import { render } from 'react-dom';
|
115
|
+
import ${JSON.stringify(entryCssPath)};
|
116
|
+
${routes.map((demo, index)=>`import Demo_${index} from ${JSON.stringify(demo.path)}`).join('\n')}
|
117
|
+
function App() {
|
118
|
+
return (
|
119
|
+
<div className="preview-container">
|
120
|
+
<div className="preview-nav">{"${routes[0].title}"}</div>
|
121
|
+
${routes.map((_demo, index)=>`<Demo_${index} />`).join('\n')}
|
122
|
+
</div>
|
123
|
+
)
|
124
|
+
}
|
125
|
+
render(<App /> , document.getElementById('root'));
|
126
|
+
`;
|
126
127
|
const solidContent = `
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
128
|
+
import { render } from 'solid-js/web';
|
129
|
+
import ${JSON.stringify(entryCssPath)};
|
130
|
+
${routes.map((demo, index)=>`import Demo_${index} from ${JSON.stringify(demo.path)}`).join('\n')}
|
131
|
+
function App() {
|
132
|
+
return (
|
133
|
+
<div class="preview-container">
|
134
|
+
<div class="preview-nav">{"${routes[0].title}"}</div>
|
135
|
+
${routes.map((_, index)=>`<Demo_${index} />`).join('\n')}
|
136
|
+
</div>
|
137
|
+
)
|
138
|
+
}
|
139
|
+
render(() => <App /> , document.getElementById('root'));
|
140
|
+
`;
|
140
141
|
const renderContent = 'solid' === framework ? solidContent : reactContent;
|
141
142
|
const id = `_${toValidVarName(key)}`;
|
142
143
|
const entry = (0, external_node_path_namespaceObject.join)(virtualDir, `${id}.entry.tsx`);
|
@@ -145,6 +146,23 @@ var __webpack_exports__ = {};
|
|
145
146
|
});
|
146
147
|
return sourceEntry;
|
147
148
|
}
|
149
|
+
function generateEntry(demos, framework, position) {
|
150
|
+
const sourceEntry = {};
|
151
|
+
const entryCssPath = (0, external_node_path_namespaceObject.join)(staticPath, 'global-styles', 'entry.css');
|
152
|
+
if ('follow' === position) {
|
153
|
+
const entries = generateEntryForPerComponent(demos, entryCssPath, framework);
|
154
|
+
Object.assign(sourceEntry, entries);
|
155
|
+
} else if ('fixed' === position) {
|
156
|
+
const entries = generateEntryForPage(demos, entryCssPath, framework);
|
157
|
+
Object.assign(sourceEntry, entries);
|
158
|
+
} else if ('fixed-with-per-comp' === position) {
|
159
|
+
const entries = generateEntryForPerComponent(demos, entryCssPath, framework);
|
160
|
+
Object.assign(sourceEntry, entries);
|
161
|
+
const perPageEntries = generateEntryForPage(demos, entryCssPath, framework);
|
162
|
+
Object.assign(sourceEntry, perPageEntries);
|
163
|
+
}
|
164
|
+
return sourceEntry;
|
165
|
+
}
|
148
166
|
const node_utils_namespaceObject = require("@rspress/shared/node-utils");
|
149
167
|
const convert = function(test) {
|
150
168
|
if (null == test) return ok;
|
@@ -361,7 +379,7 @@ var __webpack_exports__ = {};
|
|
361
379
|
if (isMobileMode && 'fixed' === position) void 0 !== externalDemoIndex && Object.assign(currentNode, getExternalDemoContent(tempVar));
|
362
380
|
else Object.assign(currentNode, {
|
363
381
|
type: 'mdxJsxFlowElement',
|
364
|
-
name: 'Container',
|
382
|
+
name: 'fixed-with-per-comp' === position ? 'ContainerFixedPerComp' : 'Container',
|
365
383
|
attributes: [
|
366
384
|
{
|
367
385
|
type: 'mdxJsxAttribute',
|
@@ -411,12 +429,12 @@ var __webpack_exports__ = {};
|
|
411
429
|
if ('hasVisited' in node) return;
|
412
430
|
if (node.lang && previewLanguages.includes(node.lang)) {
|
413
431
|
var _node_meta, _node_meta1, _node_meta2, _node_meta3, _node_meta4, _node_meta5;
|
414
|
-
if ((null
|
432
|
+
if ((null == (_node_meta = node.meta) ? void 0 : _node_meta.includes('pure')) || !(null == (_node_meta1 = node.meta) ? void 0 : _node_meta1.includes('preview')) && 'pure' === defaultRenderMode) return;
|
415
433
|
const value = injectDemoBlockImport(previewCodeTransform({
|
416
434
|
language: node.lang,
|
417
435
|
code: node.value
|
418
436
|
}), demoBlockComponentPath);
|
419
|
-
const isMobileMode = (null
|
437
|
+
const isMobileMode = (null == (_node_meta2 = node.meta) ? void 0 : _node_meta2.includes('mobile')) || (null == (_node_meta3 = node.meta) ? void 0 : _node_meta3.includes('iframe')) || !(null == (_node_meta4 = node.meta) ? void 0 : _node_meta4.includes('web')) && !(null == (_node_meta5 = node.meta) ? void 0 : _node_meta5.includes('internal')) && 'iframe' === previewMode;
|
420
438
|
const id = generateId(pageName, index++);
|
421
439
|
const virtualModulePath = (0, external_node_path_namespaceObject.join)(virtualDir, `${id}.tsx`);
|
422
440
|
constructDemoNode(id, virtualModulePath, node, isMobileMode);
|
@@ -431,7 +449,7 @@ var __webpack_exports__ = {};
|
|
431
449
|
if (remarkPlugin_demos[pageName].length > 0) data.pageMeta.haveDemos = true;
|
432
450
|
};
|
433
451
|
};
|
434
|
-
let
|
452
|
+
let src_routeMeta;
|
435
453
|
const DEFAULT_PREVIEW_LANGUAGES = [
|
436
454
|
'jsx',
|
437
455
|
'tsx'
|
@@ -440,10 +458,7 @@ var __webpack_exports__ = {};
|
|
440
458
|
const { isMobile = false, iframeOptions = {}, iframePosition = 'follow', defaultRenderMode = 'preview', previewLanguages = DEFAULT_PREVIEW_LANGUAGES, previewCodeTransform = ({ code })=>code } = options ?? {};
|
441
459
|
const previewMode = (null == options ? void 0 : options.previewMode) ?? (isMobile ? 'iframe' : 'internal');
|
442
460
|
const { devPort = 7890, framework = 'react', position = iframePosition, builderConfig = {} } = iframeOptions;
|
443
|
-
const
|
444
|
-
(0, external_node_path_namespaceObject.join)(staticPath, 'global-components', 'Device.tsx')
|
445
|
-
] : [];
|
446
|
-
const getRouteMeta = ()=>src_rslib_entry_routeMeta;
|
461
|
+
const getRouteMeta = ()=>src_routeMeta;
|
447
462
|
let lastDemos;
|
448
463
|
let devServer;
|
449
464
|
let clientConfig;
|
@@ -456,7 +471,7 @@ var __webpack_exports__ = {};
|
|
456
471
|
return config;
|
457
472
|
},
|
458
473
|
routeGenerated (routes) {
|
459
|
-
|
474
|
+
src_routeMeta = routes;
|
460
475
|
},
|
461
476
|
async beforeBuild (_, isProd) {
|
462
477
|
if (!isProd) try {
|
@@ -480,7 +495,7 @@ var __webpack_exports__ = {};
|
|
480
495
|
var _devServer_server;
|
481
496
|
if ((0, external_lodash_namespaceObject.isEqual)(remarkPlugin_demos, lastDemos)) return;
|
482
497
|
lastDemos = (0, external_lodash_namespaceObject.cloneDeep)(remarkPlugin_demos);
|
483
|
-
await (null == devServer ? void 0 : null
|
498
|
+
await (null == devServer ? void 0 : null == (_devServer_server = devServer.server) ? void 0 : _devServer_server.close());
|
484
499
|
devServer = void 0;
|
485
500
|
const sourceEntry = generateEntry(remarkPlugin_demos, framework, position);
|
486
501
|
const outDir = (0, external_node_path_namespaceObject.join)(config.outDir ?? 'doc_build', '~demo');
|
@@ -515,6 +530,7 @@ var __webpack_exports__ = {};
|
|
515
530
|
plugins: null == config ? void 0 : config.builderPlugins
|
516
531
|
}, builderConfig);
|
517
532
|
const rsbuildInstance = await (0, core_namespaceObject.createRsbuild)({
|
533
|
+
callerName: 'rspress',
|
518
534
|
rsbuildConfig
|
519
535
|
});
|
520
536
|
const { pluginSass } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@rsbuild/plugin-sass"));
|
@@ -558,11 +574,11 @@ var __webpack_exports__ = {};
|
|
558
574
|
setup: (api)=>{
|
559
575
|
api.modifyRsbuildConfig((config)=>{
|
560
576
|
var _config_output;
|
561
|
-
if ((null
|
577
|
+
if ((null == (_config_output = config.output) ? void 0 : _config_output.target) === 'web') clientConfig = config;
|
562
578
|
});
|
563
579
|
api.onCloseDevServer(async ()=>{
|
564
580
|
var _devServer_server;
|
565
|
-
await (null == devServer ? void 0 : null
|
581
|
+
await (null == devServer ? void 0 : null == (_devServer_server = devServer.server) ? void 0 : _devServer_server.close());
|
566
582
|
devServer = void 0;
|
567
583
|
});
|
568
584
|
}
|
@@ -588,16 +604,21 @@ var __webpack_exports__ = {};
|
|
588
604
|
]
|
589
605
|
],
|
590
606
|
globalComponents: [
|
591
|
-
(0, external_node_path_namespaceObject.join)(staticPath, 'global-components', 'Container.tsx')
|
607
|
+
(0, external_node_path_namespaceObject.join)(staticPath, 'global-components', 'Container.tsx'),
|
608
|
+
(0, external_node_path_namespaceObject.join)(staticPath, 'global-components', 'ContainerFixedPerComp.tsx')
|
592
609
|
]
|
593
610
|
},
|
594
|
-
globalUIComponents
|
611
|
+
globalUIComponents: 'fixed-with-per-comp' === position || 'fixed' === position ? [
|
612
|
+
(0, external_node_path_namespaceObject.join)(staticPath, 'global-components', 'Device.tsx')
|
613
|
+
] : [],
|
595
614
|
globalStyles: (0, external_node_path_namespaceObject.join)(staticPath, 'global-styles', `${previewMode}.css`)
|
596
615
|
};
|
597
616
|
}
|
598
617
|
})();
|
599
|
-
|
600
|
-
for(var __webpack_i__ in __webpack_exports__)
|
601
|
-
|
618
|
+
exports.pluginPreview = __webpack_exports__.pluginPreview;
|
619
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
620
|
+
"pluginPreview"
|
621
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
622
|
+
Object.defineProperty(exports, '__esModule', {
|
602
623
|
value: true
|
603
624
|
});
|
package/dist/utils.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __webpack_require__ = {};
|
3
3
|
(()=>{
|
4
|
-
__webpack_require__.d =
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
5
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
6
6
|
enumerable: true,
|
7
7
|
get: definition[key]
|
@@ -9,12 +9,10 @@ var __webpack_require__ = {};
|
|
9
9
|
};
|
10
10
|
})();
|
11
11
|
(()=>{
|
12
|
-
__webpack_require__.o =
|
13
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
14
|
-
};
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
15
13
|
})();
|
16
14
|
(()=>{
|
17
|
-
__webpack_require__.r =
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
18
16
|
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
19
17
|
value: 'Module'
|
20
18
|
});
|
@@ -44,8 +42,16 @@ const injectDemoBlockImport = (str, path)=>`
|
|
44
42
|
import DemoBlock from ${JSON.stringify(path)};
|
45
43
|
${str}
|
46
44
|
`;
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
exports.generateId = __webpack_exports__.generateId;
|
46
|
+
exports.injectDemoBlockImport = __webpack_exports__.injectDemoBlockImport;
|
47
|
+
exports.normalizeId = __webpack_exports__.normalizeId;
|
48
|
+
exports.toValidVarName = __webpack_exports__.toValidVarName;
|
49
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
50
|
+
"generateId",
|
51
|
+
"injectDemoBlockImport",
|
52
|
+
"normalizeId",
|
53
|
+
"toValidVarName"
|
54
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
55
|
+
Object.defineProperty(exports, '__esModule', {
|
50
56
|
value: true
|
51
57
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/plugin-preview",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.44.0",
|
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,7 +17,7 @@
|
|
17
17
|
"static"
|
18
18
|
],
|
19
19
|
"dependencies": {
|
20
|
-
"@rsbuild/core": "1.3.
|
20
|
+
"@rsbuild/core": "~1.3.18",
|
21
21
|
"@rsbuild/plugin-babel": "~1.0.5",
|
22
22
|
"@rsbuild/plugin-less": "~1.2.4",
|
23
23
|
"@rsbuild/plugin-react": "~1.3.1",
|
@@ -25,11 +25,11 @@
|
|
25
25
|
"@rsbuild/plugin-solid": "~1.0.5",
|
26
26
|
"lodash": "4.17.21",
|
27
27
|
"qrcode.react": "^3.2.0",
|
28
|
-
"@rspress/shared": "1.
|
29
|
-
"@rspress/theme-default": "1.
|
28
|
+
"@rspress/shared": "1.44.0",
|
29
|
+
"@rspress/theme-default": "1.44.0"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
|
-
"@rslib/core": "0.
|
32
|
+
"@rslib/core": "~0.6.9",
|
33
33
|
"@types/lodash": "^4.17.15",
|
34
34
|
"@types/mdast": "^3.0.15",
|
35
35
|
"@types/node": "^18.11.17",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"unist-util-visit": "^4.1.2"
|
46
46
|
},
|
47
47
|
"peerDependencies": {
|
48
|
-
"@rspress/core": "^1.
|
48
|
+
"@rspress/core": "^1.44.0",
|
49
49
|
"react": ">=17.0.0",
|
50
50
|
"react-router-dom": "^6.8.1"
|
51
51
|
},
|
@@ -45,7 +45,7 @@ const Container: React.FC<ContainerProps> = props => {
|
|
45
45
|
<NoSSR>
|
46
46
|
<div className="rspress-preview">
|
47
47
|
{isMobile === 'true' ? (
|
48
|
-
<div className="rspress-preview-wrapper
|
48
|
+
<div className="rspress-preview-wrapper">
|
49
49
|
<div className="rspress-preview-code">{children?.[0]}</div>
|
50
50
|
<div className="rspress-preview-device">
|
51
51
|
<iframe src={getPageUrl()} key={iframeKey}></iframe>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { NoSSR, usePageData, withBase } from '@rspress/core/runtime';
|
2
|
+
|
3
|
+
type ContainerProps = {
|
4
|
+
children: React.ReactNode[];
|
5
|
+
isMobile: 'true' | 'false';
|
6
|
+
demoId: string;
|
7
|
+
};
|
8
|
+
|
9
|
+
const ContainerFixedPerComp: React.FC<ContainerProps> = props => {
|
10
|
+
const { children, demoId } = props;
|
11
|
+
const { page } = usePageData();
|
12
|
+
const url = `/~demo/${demoId}`;
|
13
|
+
|
14
|
+
const getPageUrl = () => {
|
15
|
+
if (page?.devPort) {
|
16
|
+
return `http://localhost:${page.devPort}/${demoId}`;
|
17
|
+
}
|
18
|
+
if (typeof window !== 'undefined') {
|
19
|
+
return `${window.location.origin}${withBase(url)}`;
|
20
|
+
}
|
21
|
+
// Do nothing in ssr
|
22
|
+
return '';
|
23
|
+
};
|
24
|
+
|
25
|
+
return (
|
26
|
+
<NoSSR>
|
27
|
+
<div className="rspress-preview">
|
28
|
+
<div className="rspress-preview-wrapper">
|
29
|
+
<div
|
30
|
+
className="rspress-preview-code"
|
31
|
+
onClick={() => {
|
32
|
+
const fixedIframe = document.querySelector(
|
33
|
+
'.rspress-fixed-iframe',
|
34
|
+
);
|
35
|
+
fixedIframe?.setAttribute('src', getPageUrl());
|
36
|
+
}}
|
37
|
+
>
|
38
|
+
{children?.[0]}
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</NoSSR>
|
43
|
+
);
|
44
|
+
};
|
45
|
+
|
46
|
+
export default ContainerFixedPerComp;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
.fixed-device {
|
1
|
+
.rspress-fixed-device {
|
2
2
|
display: none;
|
3
3
|
position: fixed;
|
4
4
|
top: calc(var(--rp-nav-height) + var(--rp-preview-padding));
|
5
5
|
overflow: hidden;
|
6
6
|
}
|
7
7
|
|
8
|
-
.fixed-iframe {
|
8
|
+
.rspress-fixed-iframe {
|
9
9
|
height: var(--rp-device-height);
|
10
10
|
max-height: calc(
|
11
11
|
100vh - var(--rp-preview-padding) * 2 - var(--rp-nav-height)
|
@@ -17,7 +17,7 @@
|
|
17
17
|
border: var(--rp-device-border);
|
18
18
|
}
|
19
19
|
|
20
|
-
.fixed-operation {
|
20
|
+
.rspress-fixed-operation {
|
21
21
|
border: var(--rp-device-border);
|
22
22
|
border-top: 0;
|
23
23
|
border-radius: 0 0 var(--rp-device-border-radius)
|
@@ -32,7 +32,7 @@
|
|
32
32
|
}
|
33
33
|
|
34
34
|
@media (min-width: 960px) {
|
35
|
-
.fixed-device {
|
35
|
+
.rspress-fixed-device {
|
36
36
|
display: inline;
|
37
37
|
left: calc(1280px - var(--rp-device-width) - var(--rp-preview-padding));
|
38
38
|
right: auto;
|
@@ -40,7 +40,7 @@
|
|
40
40
|
}
|
41
41
|
|
42
42
|
@media (min-width: 1280px) {
|
43
|
-
.fixed-device {
|
43
|
+
.rspress-fixed-device {
|
44
44
|
display: inline;
|
45
45
|
right: var(--rp-preview-padding);
|
46
46
|
left: auto;
|
@@ -72,18 +72,18 @@ export default () => {
|
|
72
72
|
}, [haveDemos, asideWidth, innerWidth]);
|
73
73
|
|
74
74
|
return haveDemos ? (
|
75
|
-
<div className="fixed-device">
|
75
|
+
<div className="rspress-fixed-device">
|
76
76
|
<NoSSR>
|
77
77
|
<iframe
|
78
78
|
// refresh when load the iframe, then remove NoSSR
|
79
79
|
src={getPageUrl(url)}
|
80
|
-
className="fixed-iframe"
|
80
|
+
className="rspress-fixed-iframe"
|
81
81
|
key={iframeKey}
|
82
82
|
></iframe>
|
83
83
|
</NoSSR>
|
84
84
|
<MobileOperation
|
85
85
|
url={getPageUrl(url)}
|
86
|
-
className="fixed-operation"
|
86
|
+
className="rspress-fixed-operation"
|
87
87
|
refresh={refresh}
|
88
88
|
/>
|
89
89
|
</div>
|