@deot/docs-playground 1.1.1 → 1.1.3

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
@@ -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;
@@ -36,11 +38,12 @@ files: PlaygroundFiles;
36
38
  views: readonly string[];
37
39
  entry: string;
38
40
  modelValue: string;
41
+ id: string;
39
42
  options: PlaygroundOptions;
43
+ previewScroller: boolean;
44
+ local: boolean;
40
45
  previewInset: PlaygroundPreviewInset;
41
- previewScroller: PlaygroundPreviewScroller;
42
46
  styleless: boolean;
43
- id: string;
44
47
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
45
48
 
46
49
  declare type __VLS_Props = {
@@ -65,6 +68,7 @@ declare type __VLS_Props_2 = {
65
68
  title?: string;
66
69
  id?: string;
67
70
  previewScroller?: PlaygroundPreviewScroller;
71
+ local?: boolean;
68
72
  previewOptions?: PlaygroundPreviewOptions;
69
73
  locale?: Language;
70
74
  };
@@ -187,6 +191,34 @@ export declare type PlaygroundPreviewOptions = SandboxProps['previewOptions'];
187
191
 
188
192
  export declare type PlaygroundPreviewScroller = boolean;
189
193
 
194
+ export declare interface PlaygroundRunOptions {
195
+ visible?: Ref<boolean> | (() => boolean);
196
+ }
197
+
198
+ export declare class PlaygroundService {
199
+ private readonly target;
200
+ private readonly vue;
201
+ private readonly session;
202
+ private sequence;
203
+ private disposed;
204
+ private manual?;
205
+ private readonly requests;
206
+ private readonly owners;
207
+ constructor(target: Window, vue: PreviewVue);
208
+ enable(height: number): Promise<boolean>;
209
+ disable(): void;
210
+ run(height: number): (visible: boolean) => Promise<boolean | undefined>;
211
+ run<Args extends unknown[], Result>(height: number, handler: (...args: Args) => Result): (...args: Args) => Promise<Awaited<Result> | undefined>;
212
+ run<Args extends unknown[], Result>(height: number, options: PlaygroundRunOptions, handler: (...args: Args) => Result): (...args: Args) => Promise<Awaited<Result> | undefined>;
213
+ run(height: number, options: PlaygroundRunOptions & {
214
+ visible: Ref<boolean>;
215
+ }): () => Promise<void | undefined>;
216
+ dispose(): void;
217
+ private validateHeight;
218
+ private post;
219
+ private createRequest;
220
+ }
221
+
190
222
  export declare type PlaygroundView = 'runtime' | 'files';
191
223
 
192
224
  export declare type PlaygroundViewport = 'auto' | number | [width: number, height: number];
@@ -196,12 +228,18 @@ export declare interface PlaygroundViewsProps {
196
228
  activeView: PlaygroundView;
197
229
  }
198
230
 
231
+ export declare interface PlaygroundWindow extends Window {
232
+ $docsPlayground: PlaygroundService;
233
+ }
234
+
199
235
  export declare const PREVIEW_SCROLL_CONTENT_CLASS = "docs-playground-preview-scroll__content";
200
236
 
201
237
  export declare const PREVIEW_SCROLL_HTML_CLASS = "docs-playground-preview-scroll";
202
238
 
203
239
  export declare const PREVIEW_SCROLLER_USE_CODE: string;
204
240
 
241
+ declare type PreviewVue = Pick<vue, 'getCurrentScope' | 'onScopeDispose' | 'watch' | 'toValue' | 'isRef'>;
242
+
205
243
  export declare const registerVueHighlight: (api?: HLJSApi) => HLJSApi;
206
244
 
207
245
  export declare const removePlaygroundImportMapOverride: (alias: string) => {