File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 22 "name" : " @pdanpdan/vue-repl" ,
33 "version" : " 1.0.19" ,
44 "description" : " Vue component for editing Vue components" ,
5- "packageManager" : " pnpm@8.12.1 " ,
5+ "packageManager" : " pnpm@8.14.0 " ,
66 "type" : " module" ,
77 "main" : " dist/ssr-stub.js" ,
88 "module" : " dist/vue-repl.js" ,
9696 "lint-staged" : " ^15.2.0" ,
9797 "monaco-editor-core" : " ^0.45.0" ,
9898 "prettier" : " ^3.1.1" ,
99- "simple-git-hooks" : " ^2.9.0" ,
10099 "shikiji" : " ^0.9.17" ,
101100 "shikiji-monaco" : " ^0.9.17" ,
101+ "simple-git-hooks" : " ^2.9.0" ,
102102 "sucrase" : " ^3.35.0" ,
103103 "typescript" : " ^5.3.3" ,
104104 "vite" : " ^5.0.10" ,
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export interface ReplProps {
2929 customCodeSSR ?: {
3030 importCode ?: string
3131 useCode ?: string
32- } ,
32+ }
3333 customCode ?: {
3434 importCode ?: string
3535 useCode ?: string
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const props = defineProps<{ show: boolean; ssr: boolean }>()
2020
2121const store = inject (' store' ) as Store
2222const clearConsole = inject (' clear-console' ) as Ref <boolean >
23+ const theme = inject (' theme' ) as Ref <' dark' | ' light' >
2324
2425const previewOptions = inject (' preview-options' ) as ReplProps [' previewOptions' ]
2526
@@ -85,6 +86,7 @@ function createSandbox() {
8586 importMap .imports .vue = store .state .vueRuntimeURL
8687 }
8788 const sandboxSrc = srcdoc
89+ .replace (/ <html>/ , ` <html class="${theme .value }"> ` )
8890 .replace (/ <!--IMPORT_MAP-->/ , JSON .stringify (importMap ))
8991 .replace (
9092 / <!-- PREVIEW-OPTIONS-HEAD-HTML -->/ ,
@@ -280,7 +282,12 @@ defineExpose({ reload })
280282 </script >
281283
282284<template >
283- <div class =" iframe-container" v-show =" show" ref =" container" ></div >
285+ <div
286+ class =" iframe-container"
287+ :class =" theme"
288+ v-show =" show"
289+ ref =" container"
290+ ></div >
284291 <Message :err =" runtimeError" />
285292 <Message v-if =" !runtimeError" :warn =" runtimeWarning" />
286293</template >
@@ -293,4 +300,7 @@ defineExpose({ reload })
293300 border : none ;
294301 background-color : #fff ;
295302}
303+ .iframe-container.dark :deep(iframe ) {
304+ background-color : #1e1e1e ;
305+ }
296306 </style >
You can’t perform that action at this time.
0 commit comments