blob: a467319021dec642ab65bb668ca7bd38ae3e8716 (
plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<script lang="ts">
import data from "../state/data";
import EyeOpenedIcon from "./icons/EyeOpenedIcon.svelte";
import EyeClosedIcon from "./icons/EyeClosedIcon.svelte";
import { isClientShare } from "../state/constant_state";
let hidden = true;
const eyeColor = isClientShare() ? "white" : "black";
function toggle() {
hidden = !hidden;
}
function hideText(text: string): string {
return text
.split("")
.map(c => {
if (c === "\n") {
return "\n";
} else {
return "●";
}
})
.join("");
}
</script>
<div class="data-view">
<div class="textbox">
{hidden ? hideText($data.data) : $data.data}
</div>
<button on:click={toggle} class="icon">
{#if hidden}
<EyeOpenedIcon color={eyeColor} />
{:else}
<EyeClosedIcon color={eyeColor} />
{/if}
</button>
</div>
<style>
.data-view {
font-size: 14px;
width: 100%;
box-sizing: border-box;
display: flex;
align-items: flex-start;
resize: both;
overflow: scroll;
min-height: 40px;
min-width: 300px;
max-width: 500px;
height: 100px;
padding: 10px 0 0 14px;
scrollbar-color: #626262 transparent;
}
.icon {
border: none;
background: none;
position: sticky;
top: 0;
right: 0;
padding-right: 0;
}
.textbox {
font-size: 14px;
font-family: monospace;
flex: 1;
outline: none;
border: none;
resize: none;
overflow: hidden;
width: 100%;
background-color: transparent;
color: inherit;
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
|