@rspress/core 2.0.0-beta.2 → 2.0.0-beta.21
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/README.md +1 -1
- package/dist/208.js +39 -0
- package/dist/309.js +27 -0
- package/dist/94.js +1787 -0
- package/dist/index.d.ts +105 -19
- package/dist/index.js +1217 -561
- package/dist/loader.d.ts +38 -34
- package/dist/loader.js +30 -525
- package/dist/processor.d.ts +95 -0
- package/dist/processor.js +740 -0
- package/dist/runtime/App.d.ts +1 -4
- package/dist/runtime/App.js +17 -20
- package/dist/runtime/ClientApp.js +24 -13
- package/dist/runtime/csrClientEntry.js +5 -13
- package/dist/runtime/initPageData.d.ts +0 -1
- package/dist/runtime/initPageData.js +18 -18
- package/dist/runtime/ssrClientEntry.js +14 -14
- package/dist/runtime/ssrServerEntry.d.ts +3 -2
- package/dist/runtime/ssrServerEntry.js +41 -17
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.js +3 -0
- package/dist/shiki-transformers.d.ts +38 -0
- package/dist/shiki-transformers.js +77 -0
- package/dist/shiki-transformers.js.LICENSE.txt +5 -0
- package/dist/theme.d.ts +4 -0
- package/dist/theme.js +1 -0
- package/package.json +40 -33
- package/static/MediumZoom.css +5 -0
- package/static/MediumZoom.tsx +29 -0
- package/dist/runtime/tsconfig.js +0 -4
- package/runtime.ts +0 -1
- package/theme.ts +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useLocation } from '@rspress/runtime';
|
|
2
|
+
import mediumZoom, { type Zoom, type ZoomOptions } from 'medium-zoom';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import './MediumZoom.css';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
selector?: string;
|
|
8
|
+
options?: ZoomOptions;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function MediumZoom(props: Props) {
|
|
12
|
+
const { pathname } = useLocation();
|
|
13
|
+
const { selector = '.rspress-doc img', options = {} } = props;
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
let zoom: Zoom | undefined;
|
|
17
|
+
const timeout = setTimeout(() => {
|
|
18
|
+
const images = document.querySelectorAll(selector);
|
|
19
|
+
zoom = mediumZoom(images, { ...options, background: 'var(--rp-c-bg)' });
|
|
20
|
+
}, 100);
|
|
21
|
+
return () => {
|
|
22
|
+
clearTimeout(timeout);
|
|
23
|
+
zoom?.detach();
|
|
24
|
+
zoom?.close();
|
|
25
|
+
};
|
|
26
|
+
}, [pathname]);
|
|
27
|
+
|
|
28
|
+
return null;
|
|
29
|
+
}
|
package/dist/runtime/tsconfig.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var tsconfig_namespaceObject = JSON.parse('{"compilerOptions":{"rootDir":".","baseUrl":".","skipLibCheck":true,"jsx":"react-jsx","esModuleInterop":true},"include":["./**/*"]}');
|
|
2
|
-
var __webpack_exports__compilerOptions = tsconfig_namespaceObject.compilerOptions;
|
|
3
|
-
var __webpack_exports__include = tsconfig_namespaceObject.include;
|
|
4
|
-
export { __webpack_exports__compilerOptions as compilerOptions, __webpack_exports__include as include };
|
package/runtime.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@rspress/runtime';
|
package/theme.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@rspress/theme-default';
|