11<script setup>
22import { createApp , ref , useTemplateRef , onMounted , computed } from ' vue'
3- import { useTextareaAutosize , asyncComputed , useStorage } from ' @vueuse/core'
3+ import { useTextareaAutosize , asyncComputed } from ' @vueuse/core'
44
55function read_table (text , { header = true , sep = ' ,' } = {}) {
66 function parse_value (v ) {
@@ -225,13 +225,15 @@ onMounted(() => { useData('iris') })
225225< / script>
226226
227227< template>
228- < div class = " grid grid-cols-2 grid-rows-3 grid-flow-col overflow-auto flex-1 gap-2 p-2" >
229- < div class = " flex flex-col border" >
230- < h4> 1. data< / h4>
228+ < div
229+ class = " grid grid-cols-2 grid-rows-3 grid-flow-col overflow-auto flex-1 gap-2 p-2 [&>div]:overflow-auto [&>div]:border playground" >
230+ < div class = " flex flex-col" >
231+ < h2> 1. data< / h2>
231232 < label>< input type= " radio" name= " data-input-mode" value= " file" v- model= " dataInputMode" > file< / label>
232233 < div class = " flex flex-row justify-between whitespace-nowrap" >
233234 < input type= " file" ref= " file-input" @change= " fileChanged" class = " cursor-pointer" >
234- < button @click= " previewFile" class = " cursor-pointer" > preview file content< / button>
235+ < button @click= " previewFile" class = " cursor-pointer" v- if = " dataInputMode == 'file'" > preview file
236+ content< / button>
235237 < / div>
236238 < div v- if = " dataInputMode == 'file'" >
237239 presets:
@@ -245,35 +247,35 @@ onMounted(() => { useData('iris') })
245247 < textarea v- model= " textInput" @blur= " textBlur"
246248 class = " border-2 border-[#cccccc] rounded-lg flex-1 resize-none" >< / textarea>
247249 < / div>
248- < div class = " flex flex-col border " >
249- < h4 > 2. preprocess< / h4 >
250+ < div class = " flex flex-col" >
251+ < h2 > 2. preprocess< / h2 >
250252 < pre class = " w-full h-full font-mono leading-none flex-1 flex flex-col" > async function (text ) {
251253< textarea v- model= " preprocessFunc" class = " ml-[4ch] resize-none overflow-x flex-1" >< / textarea> }< / pre>
252254 < div class = " flex flex-row justify-between whitespace-nowrap" >
253255 < span class = " text-red-500 truncate" > {{ dataErrorMessage }}< / span>
254256 < button @click= " previewData" class = " cursor-pointer" > preview processed data< / button>
255257 < / div>
256258 < / div>
257- < div class = " flex flex-col border " >
258- < h4 > 3. plot definition< / h4 >
259- < pre class = " w-full h-full font-mono leading-none flex flex-col" > & lt;VVPlot : data= " data"
259+ < div class = " flex flex-col overflow-none " >
260+ < h2 > 3. plot definition< / h2 >
261+ < pre class = " w-full flex-1 font-mono leading-none flex flex-col" > & lt;VVPlot : data= " data"
260262< textarea ref= " attrsTextarea" v- model= " attrsText" class = " ml-[2ch] resize-none" >< / textarea>
261263< textarea class = " ml-[4ch] flex-1 resize-none overflow-auto" v- model= " templateText" >< / textarea> & lt;/ VVPlot& gt;< / pre>
262264 < / div>
263- < div class = " border overflow-auto row-span-2" >
265+ < div class = " row-span-2" >
264266 < div id= " plot" >< / div>
265267 < / div>
266- < div class = " border flex flex-col" >
268+ < div class = " flex flex-col" >
267269 < div>
268- < button @click= " buildPlot" > refresh plot< / button>
270+ < button @click= " buildPlot" > reset plot< / button>
269271 < button @click= " exportSVG" > download as SVG < / button>
270272 < button @click= " exportPNG" > download as PNG < / button>
271273 < / div>
272274 < / div>
273275 < / div>
274- < dialog ref= " dialog" class = " w-2/3 h-2/3 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" >
276+ < dialog ref= " dialog" class = " w-2/3 h-2/3 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 playground-dialog " >
275277 < div class = " flex flex-col overflow-auto h-full p-4" >
276- < h4 > data< / h4 >
278+ < h2 > data< / h2 >
277279 < div v- if = " dialogContentColumns?.length" class = " overflow-auto font-mono" >
278280 < table
279281 class = " whitespace-nowrap w-full [&_th,&_td]:p-1 [&_th,&_td]:text-center [&_td]:shadow-[-0.5px_-0.5px_0_0_black,_-0.5px_-0.5px_0_0_black_inset] [&_th]:sticky [&_th]:bg-white" >
@@ -302,8 +304,26 @@ onMounted(() => { useData('iris') })
302304 < / div>
303305 < pre v- else class = " overflow-auto flex-1 whitespace-pre-wrap" > {{ dialogContent }}< / pre>
304306 < div>
305- < button @click= " closeDialog" > close< / button>
307+ < button @click= " closeDialog" class = " float-right " > close< / button>
306308 < / div>
307309 < / div>
308310 < / dialog>
309311< / template>
312+ < style>
313+ .playground ,
314+ .playground - dialog {
315+ h2 {
316+ font- weight: bold;
317+ font- size: large;
318+ }
319+
320+ button {
321+ background- color: #f0f0f0;
322+ border: 1px solid #ccc;
323+ padding: 2px 4px ;
324+ border- radius: 4px ;
325+ cursor: pointer;
326+ font- size: small;
327+ }
328+ }
329+ < / style>
0 commit comments