@rspress/plugin-preview 1.11.1 → 1.12.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 CHANGED
@@ -1,42 +1,54 @@
1
- import { RouteMeta, RspressPlugin } from '@rspress/shared';
2
-
3
- /**
4
- * remove .html extension and validate
5
- * @param routePath id from pathname
6
- * @returns normalized id
7
- */
8
- declare const normalizeId: (routePath: string) => string;
1
+ import { RspressPlugin } from '@rspress/shared';
9
2
 
10
3
  type Options = {
11
4
  /**
12
- * preview in mobile mode or not
13
- * when isMobile is true, 1. aside will hide. 2. default preview component by iframe
14
- * @default false
5
+ * @deprecated Use previewMode instead.
6
+ * true = 'iframe'
7
+ * false = 'internal'
15
8
  */
16
9
  isMobile?: boolean;
17
10
  /**
18
- * position of the iframe
19
- * @default 'follow'
11
+ * @deprecated Use iframeOptions.position instead.
20
12
  */
21
13
  iframePosition?: 'fixed' | 'follow';
14
+ /**
15
+ * internal mode: component will be rendered inside the documentation, only support react.
16
+ *
17
+ * inframe mode: component will be rendered in iframe, note that aside will hide.
18
+ * @default 'internal'
19
+ */
20
+ previewMode?: 'internal' | 'iframe';
21
+ /**
22
+ * enable when preview mode is iframe.
23
+ */
24
+ iframeOptions?: IframeOptions;
22
25
  /**
23
26
  * determine how to handle a internal code block without meta
24
27
  * @default 'preview'
25
28
  */
26
29
  defaultRenderMode?: 'pure' | 'preview';
27
30
  };
28
- declare let routeMeta: RouteMeta[];
29
- declare const demoRoutes: {
30
- path: string;
31
- }[];
32
- declare const demoMeta: Record<string, {
33
- id: string;
34
- virtualModulePath: string;
35
- title: string;
36
- }[]>;
31
+ type IframeOptions = {
32
+ /**
33
+ * framework in the iframe
34
+ * @default 'react'
35
+ */
36
+ framework?: 'react' | 'solid';
37
+ /**
38
+ * position of the iframe
39
+ * @default 'follow'
40
+ */
41
+ position?: 'fixed' | 'follow';
42
+ /**
43
+ * dev server port for the iframe
44
+ * @default 7890
45
+ */
46
+ devPort?: number;
47
+ };
48
+
37
49
  /**
38
50
  * The plugin is used to preview component.
39
51
  */
40
52
  declare function pluginPreview(options?: Options): RspressPlugin;
41
53
 
42
- export { type Options, demoMeta, demoRoutes, normalizeId, pluginPreview, routeMeta };
54
+ export { type Options, pluginPreview };