-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
230 lines (213 loc) · 12.1 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
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
<!doctype html>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" integrity="sha256-3YM6A3pH4QFCl9WbSU8oXF5N6W/2ylvW0o2g+Z6TmLQ=" crossorigin="anonymous" />
<link rel="stylesheet" href="app.css">
<title>RGL Browser</title>
<link rel="icon" href="data:,">
</head>
<body>
<div id="app" style="height: 100vh; overflow-y: hidden;">
<div class="position-absolute" style="top: calc(50vh - 2rem); left: calc(50vw - 2rem); z-index: 100; opacity: 0.7;" v-show="show.loading">
<i class="fas fa-circle-notch fa-spin text-danger fa-4x"></i>
</div>
<!-- Top bar -->
<div class="d-flex bg-light border-bottom p-3 align-items-center">
<img src="https://www.grammaticalframework.org/doc/Logos/gf1.svg" class="mr-2" style="height:2.5rem;">
<div class="navbar-brand">
RGL Browser
<span class="badge badge-pill badge-secondary">v3</span>
</div>
<div class="form-inline flex-grow-1 mr-2">
<div class="input-group flex-grow-1 mr-2">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fas fa-search"></i>
</span>
</div>
<input type="text" class="form-control" v-model="search_term" placeholder="Search for language, module or identifier" @focus="focusInput">
</div>
<button type="button" class="btn btn-secondary" @click="search_term = null">Clear</button>
</div>
<button type="button" class="btn btn-link" @click="show.history = !show.history" :class="{ 'text-secondary' : !show.history }" title="Show/hide history">
<i class="fas fa-history"></i>
</button>
<button type="button" class="btn btn-link" @click="show.scope = !show.scope" :class="{ 'text-secondary' : !show.scope }" title="Show/hide scope">
<i class="fas fa-binoculars"></i>
</button>
<button type="button" class="btn btn-link" @click="show.code = !show.code" :class="{ 'text-secondary' : !show.code }" title="Show/hide code">
<i class="fas fa-code"></i>
</button>
<a v-if="rgl_commit" class="nav-link text-muted" target="_blank"
:href="`https://github.com/GrammaticalFramework/gf-rgl/tree/${rgl_commit}`"
:title="`RGL commit ${rgl_commit_short}`">
RGL<i class="mx-1 fas fa-code-branch"></i>{{ rgl_commit_short }}
</a>
<a class="nav-link text-muted" href="https://github.com/GrammaticalFramework/rgl-source-browser" target="_blank" title="View on GitHub">
<i class="fab fa-github"></i>
</a>
</div>
<!-- Main pane -->
<div class="h-100 px-3">
<!-- Results -->
<div
class="row m-0 position-absolute bg-white border-left border-right border-bottom shadow-lg"
style="width: calc(100% - 6rem); left: 3rem; height: calc(100% - 8rem); z-index: 100;"
v-show="show.results">
<div class="position-absolute mt-3" style="right: 1rem; z-index: 100;">
<button class="btn btn-link bg-white border text-muted" @click="show.results = false">
<i class="fas fa-times mr-1"></i>Close
</button>
</div>
<div class="col-2 h-100 py-3 overflow-y-scroll">
<h4 class="h5">
Matching modules
<div class="mt-1 smaller text-faint font-weight-normal">Case-insensitive, substring, ≥ 2 chars.</div>
</h4>
<a href="" v-for="(r,ix) in module_results" :key="ix" class="d-block" @click.prevent="selectModule(r.language, r.module)">
{{ r.language }}/{{ r.module }}
</a>
<div style="height: 4rem"><!-- spacer --></div>
</div>
<div class="col-4 h-100 py-3 overflow-y-scroll border-left">
<h4 class="h5">
Matches in scope of: <code v-if="current.module">{{ current.module }}</code><em v-else class="text-muted">No module scope loaded</em>
<div class="mt-1 smaller text-faint font-weight-normal">Case-insensitive, substring, ≥ 2 chars.</div>
</h4>
<table class="table table-sm">
<!-- <thead>
<tr>
<th scope="col">Identifier</th>
<th scope="col">Judgement Type</th>
<th scope="col">Module</th>
<th scope="col">Function Type</th>
</tr>
</thead> -->
<tbody>
<tr v-for="(item,ix) in scope_results" :key="ix">
<td><code class="text-nowrap">{{ item.ident }}</code></td>
<td>{{ item.jtype }}</td>
<td>
<a href="" @click.prevent="selectModule(item.language, item.module, item.ident, item.lines)">
{{ item.module }}<span v-if="item.lines">:{{ item.lines }}</span>
</a>
</td>
<td class="text-nowrap"><code>{{ item.ftype }}</code></td>
</tr>
</tbody>
</table>
<div style="height: 3rem"><!-- spacer --></div>
</div>
<div class="col-6 h-100 py-3 overflow-y-scroll border-left">
<h4 class="h5">
Global matches for: <code>{{ search_term }}</code>
<div class="mt-1 smaller text-faint font-weight-normal">Case-sensitive, exact match only, ≥ 3 chars.</div>
</h4>
<table class="table table-sm" v-if="global_results">
<!-- <thead>
<tr>
<th scope="col">Judgement Type</th>
<th scope="col">Module</th>
<th scope="col">Function Type</th>
</tr>
</thead> -->
<tbody>
<tr v-for="(item,ix) in global_results.hits" :key="ix">
<td>{{ item.jtype }}</td>
<td>
<a href="" @click.prevent="selectModule(item.language, item.module, global_results.symbol, item.lines)">
{{ item.language }}/{{ item.module }}<span v-if="item.lines">:{{ item.lines }}</span>
</a>
</td>
<td class="text-nowrap"><code>{{ item.ftype }}</code></td>
</tr>
</tbody>
</table>
<div style="height: 3rem"><!-- spacer --></div>
</div>
</div>
<!-- Scope & Code -->
<div class="row h-100" :style="{ opacity: show.results ? 0.3 : 1.0 }">
<!-- History -->
<div :class="'col-'+cols_history" class="h-100 py-3 overflow-y-scroll" v-show="show.history">
<h4 class="h5">History</h4>
<em class="text-muted" v-show="!history.length">No recent modules</em>
<div v-for="(item,ix) in history_reversed" :key="ix">
<a href="" @click.prevent="selectModule(item.language, item.module)"
class="d-block px-2 py-1 rounded text-truncate"
:class="{ 'bg-primary text-white mb-1' : item.language === current.language && item.module === current.module }">
{{ item.language }}/{{ item.module }}
<span v-if="item.language === current.language && item.module === current.module" class="float-right">→</span>
</a>
<a v-for="(loc,iy) in item.locations" :key="iy"
href="" @click.prevent="selectModule(item.language, item.module, loc.ident, loc.lines)"
class="d-block ml-3 small text-secondary text-truncate">
<code>{{ loc.ident }}</code>:{{ loc.lines }}
</a>
</div>
<div style="height: 3rem"><!-- spacer --></div>
</div>
<!-- Scope -->
<div :class="'col-'+cols_scope" class="h-100 py-3 overflow-y-scroll border-left" v-show="show.scope" id="scope">
<h4 class="h5">Full scope: <code>{{ current.language }}/{{ current.module }}</code></h4>
<em class="text-muted" v-show="!current.scope">No module scope loaded</em>
<div class="alert alert-danger mt-2" v-show="error.scope">{{ error.scope }}</div>
<table class="table table-sm">
<!-- <thead>
<tr>
<th scope="col">Identifier</th>
<th scope="col">Judgement Type</th>
<th scope="col">Module</th>
<th scope="col">Function Type</th>
</tr>
</thead> -->
<tbody>
<tr v-for="(item,ix) in current.scope" :key="ix" :data-ident="item.ident">
<td><code class="text-nowrap">{{ item.ident }}</code></td>
<td>{{ item.jtype }}</td>
<td>
<a href="" @click.prevent="selectModule(item.language, item.module, item.ident, item.lines, false)">
{{ item.module }}<span v-if="item.lines">:{{ item.lines }}</span>
</a>
</td>
<td class="text-nowrap"><code>{{ item.ftype }}</code></td>
</tr>
</tbody>
</table>
<div style="height: 3rem"><!-- spacer --></div>
</div>
<!-- Code -->
<div :class="'col-'+cols_code" class="h-100 py-3 overflow-y-scroll border-left" v-show="show.code" id="code">
<h4 class="h5">
Code: <code>{{ current.language }}/{{ current.module }}</code>
<a target="_blank" v-if="current.module" class="float-right"
:href="`https://github.com/GrammaticalFramework/gf-rgl/tree/${rgl_commit}/src/${current.language}/${current.module}.gf`"
:title="`View ${current.module}.gf@${rgl_commit_short} on GitHub`">
<i class="far fa-file-code"></i>
</a>
<div class="mt-1 smaller text-faint font-weight-normal">
<span class="badge badge-danger">New</span>
Use ⌘/⊞-click to jump to a defintion.
</div>
</h4>
<pre class="bg-light p-2"><em class="text-muted" v-show="!current.code">No module code loaded</em><code class="haskell" v-html="_.escape(current.code)" @click.meta="codeClick"></code></pre>
<div class="alert alert-danger mt-2" v-show="error.code">{{ error.code }}</div>
<div style="height: 3rem"><!-- spacer --></div>
</div>
</div>
</div>
</div><!-- app -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js" integrity="sha256-T/f7Sju1ZfNNfBh7skWn0idlCBcI3RwdLSS4/I7NQKQ=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.core.js" integrity="sha512-sT/ulbbWqYAlCH/Q1IwC+ME/TuOFnLI0EW0jALbAVaNAXCvjkg1eZoAVwt1s6odpzq/je9gOS+oueB2myLisLQ==" crossorigin="anonymous"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/haskell.min.js" integrity="sha256-WxYLWg8NFyyEq+Zs9pVsDQmlFpJt+733DecPx5+hrQw=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.5.0/highlightjs-line-numbers.min.js"></script>
<script src="app.js"></script>
</body>
</html>