import { Component } from 'vue'; import { ComponentOptionsMixin } from 'vue'; import { ComponentProvideOptions } from 'vue'; import { ComputedRef } from 'vue'; import { CreateComponentPublicInstanceWithMixins } from 'vue'; import { default as default_2 } from 'codemirror'; import * as defaultCompiler from 'vue/compiler-sfc'; import { DefineComponent } from 'vue'; import { editor } from 'monaco-editor-core'; import { GlobalComponents } from 'vue'; import { GlobalDirectives } from 'vue'; import { version as languageToolsVersion } from '@vue/language-service/package.json'; import type * as monaco from 'monaco-editor-core'; import { PublicProps } from 'vue'; import { Ref } from 'vue'; import { SFCAsyncStyleCompileOptions } from 'vue/compiler-sfc'; import { SFCScriptCompileOptions } from 'vue/compiler-sfc'; import { SFCTemplateCompileOptions } from 'vue/compiler-sfc'; import { ShallowRef } from 'vue'; import { ToRefs } from 'vue'; import { UnwrapRef } from 'vue'; declare type __VLS_Props = ReplProps; declare type __VLS_Props_2 = { show: boolean; ssr: boolean; }; declare type __VLS_PublicProps = { modelValue?: boolean; } & __VLS_Props; export declare function compileFile(store: Store, { filename, code, compiled }: File_2): Promise<(string | Error)[]>; declare type EditorComponentType = Component; declare interface EditorMethods { getEditorIns(): (T extends 'codemirror' ? default_2.Editor : monaco.editor.IStandaloneCodeEditor) | undefined; getMonacoEditor?(): typeof monaco.editor | undefined; } declare type EditorMode = 'js' | 'css' | 'ssr'; declare interface EditorProps { value: string; filename: string; readonly?: boolean; mode?: EditorMode; } declare class File_2 { filename: string; code: string; hidden: boolean; compiled: { js: string; css: string; ssr: string; clientMap: string; ssrMap: string; }; editorViewState: editor.ICodeEditorViewState | null; constructor(filename: string, code?: string, hidden?: boolean); get language(): "css" | "vue" | "typescript" | "html" | "javascript"; } export { File_2 as File } export declare interface ImportMap { imports?: Record; scopes?: Record>; } export { languageToolsVersion } export declare function mergeImportMap(a: ImportMap, b: ImportMap): ImportMap; export declare type OutputModes = 'preview' | 'ssr output' | EditorMode; export declare const Preview: DefineComponent<__VLS_Props_2, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, { sandbox: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }, false, {}, {}, GlobalComponents, GlobalDirectives, string, { container: HTMLDivElement; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }> | null; }, any>; /** * Reload the preview iframe */ declare function reload(): void; /** * Reload the preview iframe */ declare function reload_2(): void; export declare const Repl: DefineComponent<__VLS_PublicProps, { reload: typeof reload; getEditorInstance: EditorMethods["getEditorIns"]; getMonacoEditor: () => typeof monaco.editor | undefined; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, { "update:modelValue": (value: boolean) => any; }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined; }>, { ssr: boolean; layout: "horizontal" | "vertical"; store: Store; layoutReverse: boolean; splitPaneOptions: { codeTogglerText?: string; outputTogglerText?: string; }; theme: "dark" | "light"; previewTheme: boolean; autoResize: boolean; showCompileOutput: boolean; showOpenSourceMap: boolean; showImportMap: boolean; showSsrOutput: boolean; showTsConfig: boolean; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; editorOptions: { showErrorText?: string | false; autoSaveText?: string | false; monacoOptions?: monaco.editor.IStandaloneEditorConstructionOptions; }; }, {}, {}, {}, string, ComponentProvideOptions, false, { editorContainer: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { getEditorIns: EditorMethods["getEditorIns"]; getMonacoEditor: () => typeof monaco.editor | undefined; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, { editor: unknown; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<{ editorComponent: EditorComponentType; }> & Readonly<{}>, { getEditorIns: EditorMethods["getEditorIns"]; getMonacoEditor: () => typeof monaco.editor | undefined; }, {}, {}, {}, {}> | null; output: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { reload: () => void; previewRef: Readonly & Readonly<{}>, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, { sandbox: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }, false, {}, {}, GlobalComponents, GlobalDirectives, string, { container: HTMLDivElement; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }> | null; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<{ show: boolean; ssr: boolean; }> & Readonly<{}>, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, {}> | null>>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, { preview: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, { sandbox: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }, false, {}, {}, GlobalComponents, GlobalDirectives, string, { container: HTMLDivElement; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }> | null; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<{ show: boolean; ssr: boolean; }> & Readonly<{}>, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, {}> | null; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<{ editorComponent: EditorComponentType; showCompileOutput?: boolean; showOpenSourceMap?: boolean; showSsrOutput?: boolean; ssr: boolean; }> & Readonly<{}>, { reload: () => void; previewRef: Readonly & Readonly<{}>, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, { sandbox: CreateComponentPublicInstanceWithMixins & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }, false, {}, {}, GlobalComponents, GlobalDirectives, string, { container: HTMLDivElement; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly & Readonly<{}>, { reload: () => void; container: Readonly>; }, {}, {}, {}, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }> | null; }, any, ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<{ show: boolean; ssr: boolean; }> & Readonly<{}>, { reload: () => void | undefined; container: ComputedRef; }, {}, {}, {}, {}> | null>>; }, {}, {}, {}, {}> | null; }, HTMLDivElement>; export declare interface ReplProps { theme?: 'dark' | 'light'; previewTheme?: boolean; editor: EditorComponentType; store?: Store; autoResize?: boolean; showCompileOutput?: boolean; showOpenSourceMap?: boolean; showImportMap?: boolean; showSsrOutput?: boolean; showTsConfig?: boolean; clearConsole?: boolean; layout?: 'horizontal' | 'vertical'; layoutReverse?: boolean; ssr?: boolean; previewOptions?: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; editorOptions?: { showErrorText?: string | false; autoSaveText?: string | false; monacoOptions?: monaco.editor.IStandaloneEditorConstructionOptions; }; splitPaneOptions?: { codeTogglerText?: string; outputTogglerText?: string; }; } export declare interface ReplStore extends UnwrapRef { activeFile: File_2; /** Loading compiler */ loading: boolean; init(): void; setActive(filename: string): void; addFile(filename: string | File_2): void; deleteFile(filename: string): void; renameFile(oldFilename: string, newFilename: string): void; getImportMap(): ImportMap; setImportMap(map: ImportMap, merge?: boolean): void; getTsConfig(): Record; serialize(): string; /** * Deserializes the given string to restore the REPL store state. * @param serializedState - The serialized state string. * @param checkBuiltinImportMap - Whether to check the built-in import map. Default to true */ deserialize(serializedState: string, checkBuiltinImportMap?: boolean): void; getFiles(): Record; setFiles(newFiles: Record, mainFile?: string): Promise; /** Custom online resources */ resourceLinks?: ResourceLinkConfigs; } declare type ResourceLinkConfigs = { esModuleShims?: string; vueCompilerUrl?: (version: string) => string; typescriptLib?: (version: string) => string; pkgLatestVersionUrl?: (pkgName: string) => string; pkgDirUrl?: (pkgName: string, pkgVersion: string, pkgPath: string) => string; pkgFileTextUrl?: (pkgName: string, pkgVersion: string | undefined, pkgPath: string) => string; }; export declare const Sandbox: DefineComponent>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly & Readonly<{}>, { ssr: boolean; theme: "dark" | "light"; clearConsole: boolean; previewOptions: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; show: boolean; autoStoreInit: boolean; }, {}, {}, {}, string, ComponentProvideOptions, false, { container: HTMLDivElement; }, any>; export declare interface SandboxProps { store: Store; show?: boolean; ssr?: boolean; clearConsole?: boolean; theme?: 'dark' | 'light'; previewOptions?: { headHTML?: string; bodyHTML?: string; placeholderHTML?: string; customCode?: { importCode?: string; useCode?: string; }; showRuntimeError?: boolean; showRuntimeWarning?: boolean; }; /** @default true */ autoStoreInit?: boolean; } export declare interface SFCOptions { script?: Partial; style?: Partial; template?: Partial; } export declare type Store = Pick; export declare type StoreState = ToRefs<{ files: Record; activeFilename: string; mainFile: string; template: { welcomeSFC?: string; newSFC?: string; }; builtinImportMap: ImportMap; errors: (string | Error)[]; showOutput: boolean; outputMode: OutputModes; sfcOptions: SFCOptions; ssrOutput: { html: string; context: unknown; }; /** `@vue/compiler-sfc` */ compiler: typeof defaultCompiler; vueVersion: string | null; locale: string | undefined; typescriptVersion: string; /** \{ dependencyName: version \} */ dependencyVersion: Record; reloadLanguageTools?: (() => void) | undefined; /** Custom online resources */ resourceLinks?: ResourceLinkConfigs; }>; export declare function useStore({ files, activeFilename, // set later mainFile, template, builtinImportMap, // set later errors, showOutput, outputMode, sfcOptions, compiler, vueVersion, locale, typescriptVersion, dependencyVersion, reloadLanguageTools, resourceLinks, }?: Partial, serializedState?: string): ReplStore; export declare function useVueImportMap(defaults?: { runtimeDev?: string | (() => string); runtimeProd?: string | (() => string); serverRenderer?: string | (() => string); vueVersion?: string | null; }): { productionMode: Ref; importMap: ComputedRef; vueVersion: Ref; defaultVersion: string; }; export { }