-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
167 lines (147 loc) · 4.56 KB
/
index.html
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>KV-input</title>
<style>
.column {width: 25%}
body {
font-size: 1rem;
}
@media (max-width: 986px) {
body {font-size: 2em}
button {font-size: 2rem}
}
pre {
background-color: lightgray;
padding: 0.5em;
}
pre input {
border: 0;
line-height: 1rem;
}
hr {
margin: 1.5em 0;
}
</style>
<!-- github link styles -->
<style>
#forkongithub a {
background: #006;
color: #fff;
text-decoration: none;
font-family: arial, sans-serif;
text-align: center;
font-weight: bold;
padding: 5px 40px;
font-size: 2rem;
line-height: 3rem;
position: relative;
transition: 0.5s;
}
#forkongithub a:hover {
background: #11c;
color: #fff;
}
#forkongithub a::before, #forkongithub a::after {
content: "";
width: 100%;
display: block;
position: absolute;
top: 1px;
left: 0;
height: 1px;
background: #fff;
}
#forkongithub a::after {
bottom: 1px;
top: auto;
}
#forkongithub {
position: absolute;
display: block;
top: 0;
right: 0;
width: 170px;
overflow: hidden;
height: 170px;
z-index: 9999;
}
#forkongithub a {
width: 100px;
position: absolute;
top: 30px;
right: -45px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.8);
}
@media screen and (min-width: 800px) {
#forkongithub {
top: 0;
right: 0;
width: 170px;
height: 170px;
}
#forkongithub a {
font-size: 0.7rem;
line-height: 1.2rem;
width: 100px;
top: 30px;
right: -45px;
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.8);
}
}
</style>
</head>
<body>
<!-- github link code -->
<span id="forkongithub">
<a href="https://github.com/Liksu/kv-input">Code on GitHub</a>
</span>
<!-- demo code -->
<h2>Demo usage:</h2>
<div class="column">
<kv-input>
<style slot="style">
.title {color: navy}
</style>
<p slot="json">{"NotEmpty":"some text","Null":null,"Array":["foo","bar",true,42],"BoolTrue":true,"BoolFalse":false,"Number":42}</p>
</kv-input>
</div>
<hr>
<h3>Result object:</h3>
<pre id="mirror"></pre>
<h3>Customization:</h3>
<button onclick="toggleTypes()">Toggle use-types</button>
<button onclick="toggleKeys()">Toggle keys</button>
<button onclick="clearKV()">Clear</button>
<br>
<label>Debounce
<input id="debounce" type="range" min="0" max="500" step="50" style="vertical-align: middle" onchange="updateDebounce(this)" value="300">
<span>300</span>
ms.
</label><br>
<label>Component title: <input alt="title" id="titleInput" placeholder="titleValue" value="Environment variables"></label><br>
<label>Key-column title: <input alt="key-title" id="keyTitleInput" placeholder="keyTitleValue" value="Variable"></label><br>
<label>Value-column title: <input alt="value-title" id="valueTitleInput" placeholder="valueTitleValue" value="Value"></label><br>
<br>
<h3>Example tag:</h3>
<pre id="tag">
<kv-input title="<span id="titleValue"></span>"
key-title="<span id="keyTitleValue"></span>"
value-title="<span id="valueTitleValue"></span>"
debounce="<span id="debounceValue">0</span>"
use-types="<span id="useTypesValue">true</span>">
<code id="metaBlock"><code slot="meta">{
<code id="metaValue"></code>
}</code></code>
</kv-input></pre>
Do not forget to include web-component:
<pre>import 'kv-input.js';</pre>
<script src="example.js" defer type="module"></script>
</body>
</html>