@deot/docs-playground 1.1.0 → 1.1.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/README.md +61 -0
- package/dist/index.cjs +506 -52
- package/dist/index.d.ts +51 -1
- package/dist/index.js +503 -53
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ import { Language } from '@deot/docs-locale';
|
|
|
7
7
|
import type { LanguageFn } from 'highlight.js';
|
|
8
8
|
import { Portal } from '@deot/vc';
|
|
9
9
|
import { PublicProps } from 'vue';
|
|
10
|
+
import type { Ref } from 'vue';
|
|
10
11
|
import type { SandboxProps } from '@vue/repl';
|
|
11
12
|
import type { StoreState } from '@vue/repl';
|
|
13
|
+
import { vue } from 'vue';
|
|
12
14
|
|
|
13
15
|
declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
14
16
|
language: string;
|
|
@@ -38,6 +40,7 @@ entry: string;
|
|
|
38
40
|
modelValue: string;
|
|
39
41
|
options: PlaygroundOptions;
|
|
40
42
|
previewInset: PlaygroundPreviewInset;
|
|
43
|
+
previewScroller: PlaygroundPreviewScroller;
|
|
41
44
|
styleless: boolean;
|
|
42
45
|
id: string;
|
|
43
46
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
@@ -63,6 +66,7 @@ declare type __VLS_Props_2 = {
|
|
|
63
66
|
expandable?: PlaygroundExpandable;
|
|
64
67
|
title?: string;
|
|
65
68
|
id?: string;
|
|
69
|
+
previewScroller?: PlaygroundPreviewScroller;
|
|
66
70
|
previewOptions?: PlaygroundPreviewOptions;
|
|
67
71
|
locale?: Language;
|
|
68
72
|
};
|
|
@@ -83,7 +87,11 @@ export declare const createBuiltinImports: (cdnURL?: string) => Record<string, s
|
|
|
83
87
|
|
|
84
88
|
export declare const createBuiltinStyles: (cdnURL?: string) => Record<string, string>;
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
declare interface CreateRuntimePreviewOptions {
|
|
91
|
+
previewScroller?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export declare const createRuntimePreviewOptions: (cdnURL?: string, options?: CreateRuntimePreviewOptions) => NonNullable<SandboxProps["previewOptions"]>;
|
|
87
95
|
|
|
88
96
|
export declare const DEFAULT_CDN_URL = "https://cdn.jsdelivr.net/npm";
|
|
89
97
|
|
|
@@ -179,6 +187,36 @@ export declare type PlaygroundPreviewInset = number | [vertical: number, horizon
|
|
|
179
187
|
|
|
180
188
|
export declare type PlaygroundPreviewOptions = SandboxProps['previewOptions'];
|
|
181
189
|
|
|
190
|
+
export declare type PlaygroundPreviewScroller = boolean;
|
|
191
|
+
|
|
192
|
+
export declare interface PlaygroundRunOptions {
|
|
193
|
+
visible?: Ref<boolean> | (() => boolean);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare class PlaygroundService {
|
|
197
|
+
private readonly target;
|
|
198
|
+
private readonly vue;
|
|
199
|
+
private readonly session;
|
|
200
|
+
private sequence;
|
|
201
|
+
private disposed;
|
|
202
|
+
private manual?;
|
|
203
|
+
private readonly requests;
|
|
204
|
+
private readonly owners;
|
|
205
|
+
constructor(target: Window, vue: PreviewVue);
|
|
206
|
+
enable(height: number): Promise<boolean>;
|
|
207
|
+
disable(): void;
|
|
208
|
+
run(height: number): (visible: boolean) => Promise<boolean | undefined>;
|
|
209
|
+
run<Args extends unknown[], Result>(height: number, handler: (...args: Args) => Result): (...args: Args) => Promise<Awaited<Result> | undefined>;
|
|
210
|
+
run<Args extends unknown[], Result>(height: number, options: PlaygroundRunOptions, handler: (...args: Args) => Result): (...args: Args) => Promise<Awaited<Result> | undefined>;
|
|
211
|
+
run(height: number, options: PlaygroundRunOptions & {
|
|
212
|
+
visible: Ref<boolean>;
|
|
213
|
+
}): () => Promise<void | undefined>;
|
|
214
|
+
dispose(): void;
|
|
215
|
+
private validateHeight;
|
|
216
|
+
private post;
|
|
217
|
+
private createRequest;
|
|
218
|
+
}
|
|
219
|
+
|
|
182
220
|
export declare type PlaygroundView = 'runtime' | 'files';
|
|
183
221
|
|
|
184
222
|
export declare type PlaygroundViewport = 'auto' | number | [width: number, height: number];
|
|
@@ -188,6 +226,18 @@ export declare interface PlaygroundViewsProps {
|
|
|
188
226
|
activeView: PlaygroundView;
|
|
189
227
|
}
|
|
190
228
|
|
|
229
|
+
export declare interface PlaygroundWindow extends Window {
|
|
230
|
+
$docsPlayground: PlaygroundService;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export declare const PREVIEW_SCROLL_CONTENT_CLASS = "docs-playground-preview-scroll__content";
|
|
234
|
+
|
|
235
|
+
export declare const PREVIEW_SCROLL_HTML_CLASS = "docs-playground-preview-scroll";
|
|
236
|
+
|
|
237
|
+
export declare const PREVIEW_SCROLLER_USE_CODE: string;
|
|
238
|
+
|
|
239
|
+
declare type PreviewVue = Pick<vue, 'getCurrentScope' | 'onScopeDispose' | 'watch' | 'toValue' | 'isRef'>;
|
|
240
|
+
|
|
191
241
|
export declare const registerVueHighlight: (api?: HLJSApi) => HLJSApi;
|
|
192
242
|
|
|
193
243
|
export declare const removePlaygroundImportMapOverride: (alias: string) => {
|