-
-
Notifications
You must be signed in to change notification settings - Fork 780
/
ReplPlayground.vue
52 lines (48 loc) · 1.37 KB
/
ReplPlayground.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<script setup lang="ts">
import { fetchRepl } from '../composables/fetch'
import { useScrollStyle } from '../composables/useScrollStyle'
const status = ref(null)
const style = useScrollStyle(status, 'rpel-scrolls')
const input = useLocalStorage(
'unocss:inspector:repl',
'<div class="text-sm hover:text-red">\nHello World\n</div>',
)
const isSafelistIncluded = useStorage('unocss-inspector-safelist', false)
const { data: result } = fetchRepl(input, isSafelistIncluded)
</script>
<template>
<div h-full grid="~ rows-[max-content_1fr]" of-hidden>
<StatusBar ref="status">
<div>
REPL Playground
</div>
<div op60>
Edit your code below to test and play UnoCSS's matching and generating.
</div>
</StatusBar>
<TitleBar border="b gray-400/20" title="">
<label>
<input v-model="isSafelistIncluded" type="checkbox">
Include safelist
</label>
</TitleBar>
<div h-full of-hidden grid grid-cols-2>
<CodeMirror
v-model="input"
mode="html"
:matched="result?.matched || []"
class="scrolls rpel-scrolls"
:style="style"
/>
<CodeMirror
b-l
b-main
:model-value="result?.css || '/* empty */'"
:read-only="true"
mode="css"
class="scrolls rpel-scrolls"
:style="style"
/>
</div>
</div>
</template>