/
convert_index.html
311 lines (306 loc) · 11 KB
/
convert_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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>{{ title|default('Panel Applications', true) }}</title>
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600&Lato|Work+Sans:400,700&display=swap" rel="stylesheet" type='text/css'>
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<style>*:not(:defined){visibility:hidden}</style>
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="apple-touch-icon" sizes="180x180" href="{{ PANEL_CDN }}images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{ PANEL_CDN }}images/favicon.ico">
<link rel="manifest" href="{{ manifest|default('https://panel.holoviz.org/_static/icons/site.webmanifest', true) }}">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
{% if manifest %}
<script type="text/javascript">
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./serviceWorker.js');
}
</script>
{% endif %}
<script type="module" src="{{ PANEL_CDN }}bundled/@microsoft/fast-components@2.30.6/dist/fast-components.js"></script>
<script type="module" src="{{ PANEL_CDN }}bundled/fast/js/fast_design.js"></script>
<script type="text/javascript">
function setParamsFromSearch(text) {
const params = new URLSearchParams(location.search);
if (text===""){
params.delete("search")
} else {
params.set('search', text);
}
window.history.replaceState({}, '', `${location.pathname}?${params}`);
}
function hideCards(text) {
text=text.toLowerCase();
const cards = document.getElementsByTagName("li")
for (const card of cards){
if (text==="" || card.innerHTML.toLowerCase().includes(text)){
card.style.display=""
} else {card.style.display="none"}
}
setParamsFromSearch(text)
}
function toggleLightDarkTheme(update) {
const switchEl = document.getElementById("theme-switch")
const params = new URLSearchParams(location.search);
if (switchEl.checked) {
window.bodyDesign.setLuminance(1)
window.bodyDesign.setBackgroundColor("#ffffff")
params.set('theme', "default");
} else {
window.bodyDesign.setLuminance(0.1)
window.bodyDesign.setBackgroundColor("#000000")
params.set('theme', "dark");
}
if (update) {
window.history.replaceState({}, '', `${location.pathname}?${params}`);
}
}
function setSwitchFromParams(){
const params = new URLSearchParams(window.location.search)
if (params.has('theme')){
const theme = params.get('theme')
const switchEl = document.getElementById("theme-switch")
if (theme==='dark'){
switchEl.checked = false
} else {
switchEl.checked = true
}
toggleLightDarkTheme(true)
} else {
toggleLightDarkTheme(false)
}
}
function setSearchFromParams(){
const params = new URLSearchParams(window.location.search)
if (params.has('search')){
const search = params.get('search')
const searchEl = document.getElementById("search-input")
searchEl.value = search
hideCards(search)
}
}
</script>
<style>
:root {
--background-color: #ffffff;
--header-background: #000000;
}
html, #body-design-provider {
min-height: 100vh;
}
body {
margin: 0px;
padding: 0;
font-style: normal;
font-variant-ligatures: normal;
font-variant-caps: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-weight: normal;
font-stretch: normal;
font-size: 16px;
line-height: normal;
font-family: aktiv-grotesk, "Segoe UI", Arial, Helvetica, sans-serif;
overflow-y: auto;
}
.gallery-item:hover {
box-shadow: 0 1px 5px var(--neutral-fill-strong-focus);
}
.gallery-item {
cursor: pointer;
}
.header {
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) ),url("{{ './' if manifest else PANEL_CDN }}images/index_background.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.header-content {
display: flex;
flex-direction: column;
padding: 2rem;
}
.header article {
margin-right: 1.0em;
padding-left: 1.0em;
padding-right: 1.0em;
opacity: 0.8;
color: white;
}
.article .h2 {
font-size: 2em;
}
#body-design-provider {
color: var(--neutral-foreground-rest);
}
#header-design-provider {
background-color: #000000;
color: var(--neutral-foreground-rest);
}
#title, #divider, #subtitle {
background: transparent;
font-size: 1.5em;
color: white;
}
#subtitle {
color: white;
font-size: 2em;
font-weight: bold;
margin: 1em 0 0 1em;
}
#search-input {
margin-top: 1em;
margin-left: 2em;
margin-bottom: 0em;
width: calc(100% - 4em);
}
.theme-toggle-icon {
height: 25px;
width: 25px;
margin-top: 5px;
fill: #ffffff;
}
/* The grid layout is inspired by
https://css-tricks.com/look-ma-no-media-queries-responsive-layouts-us ing-css-grid/
https://codepen.io/andybelldesign/pen/vMMYKJ */
/*
AUTO GRID
Set the minimum item size with `--cards-grid-min-size` and you'll
get a fully responsive grid with no media queries.
*/
.cards-grid {
--cards-grid-min-size: 16rem;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--cards-grid-min-size), 1fr));
grid-gap: 2rem;
list-style: none;
}
/* Presentational styles */
.card {
padding: 0px;
}
.cards-grid {
margin: 2rem;
padding: 0px;
}
.avatar {
vertical-align: middle;
float: right;
width: 30px;
height: 30px;
margin-top: 5px;
border-radius: 50%;
}
.card-action svg {
vertical-align: middle;
float: right;
height: 20px;
color: white;
margin-top: 10px;
margin-right: 10px;
fill: var(--neutral-foreground-rest);
}
.card-image {
height: 100px;
width: 100%;
margin-top: 25px;
}
.card-content {
padding: 10px 10px 10px;
color: var(--neutral-foreground-rest);
}
.card-text {
height: 100px;
}
.card-header {
height: 2em;
text-align: center;
}
footer {
padding: .50rem;
text-align: center;
font-size: .75rem;
}
#panel-logo {
width: 300px;
}
.card-link {
text-decoration: none;
color: var(--neutral-foreground-rest);
}
</style>
</head>
<body>
<fast-design-system-provider id="body-design-provider" use-defaults>
<fast-design-system-provider id="header-design-provider">
<section class="header">
<fast-switch id="theme-switch" style="float: right; padding-top: 1em; padding-right: 2em;" onChange="toggleLightDarkTheme()" checked>
<span slot="checked-message">
<svg class="theme-toggle-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25"><path d="M0 0h24v24H0z" fill="none"/><path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/></svg>
</span>
<span slot="unchecked-message">
<svg class="theme-toggle-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 2c-1.82 0-3.53.5-5 1.35C7.99 5.08 10 8.3 10 12s-2.01 6.92-5 8.65C6.47 21.5 8.18 22 10 22c5.52 0 10-4.48 10-10S15.52 2 10 2z"/></svg>
</span>
</fast-switch>
<fast-tooltip anchor="theme-switch">Click to toggle the Theme</fast-tooltip>
<div class="header-content">
<div>
<fast-anchor id="title" href="https://panel.holoviz.org" appearance="neutral" target="_self"><img id="panel-logo" src="https://panel.holoviz.org/_static/logo_horizontal.png"/></fast-anchor>
<fast-tooltip anchor="title">Click to visit the Panel web site</fast-tooltip>
</div>
<span id="subtitle">{{ title|default('Panel Applications', true) }}</span>
</div>
</section>
</fast-design-system-provider>
<section class="search">
<fast-text-field id="search-input" placeholder="search" onInput="hideCards(event.target.value)"></fast-text-field>
</section>
<section id="cards">
<ul class="cards-grid">
{% for item_label, item in items.items() %}
<li class="card">
<a class="card-link" href="{{ item }}" id="{{ item }}">
<fast-card class="gallery-item">
<svg class="card-image" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-window" viewBox="0 0 16 16">
<path d="M2.5 4a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zm2-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm1 .5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z"/>
<path d="M2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H2zm13 2v2H1V3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1zM2 14a1 1 0 0 1-1-1V6h14v7a1 1 0 0 1-1 1H2z"/>
</svg>
<div class="card-content">
<h2 class="card-header">{{ item_label }}</h2>
</div>
</fast-card>
<fast-tooltip anchor="{{ item }}">Click to start the application</fast-tooltip>
</a>
</li>
{% endfor %}
</ul>
</section>
<section>
<fast-divider></fast-divider>
<footer>
<p>Made with 🐍, ❤️, <fast-anchor href="https://fast.design" appearance="hypertext" target="_blank">Fast</fast-anchor> and <fast-anchor href="https://panel.holoviz.org" appearance="hypertext" target="_blank">Panel</fast-anchor>.</p>
</footer>
</section>
</fast-design-system-provider>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', (event) => {
const header_design = new window.fastDesignProvider("#header-design-provider");
header_design.setBackgroundColor('#ffffff')
window.bodyDesign = new window.fastDesignProvider("#body-design-provider");
setSwitchFromParams()
setSearchFromParams()
})
</script>
</body>
</html>