1// Code generated by templ - DO NOT EDIT.
2
3// templ: version: v0.3.1020
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6package web
7
8//lint:file-ignore SA4006 This context is only used if a nested component is present.
9
10import "github.com/a-h/templ"
11import templruntime "github.com/a-h/templ/runtime"
12
13import "strings"
14
15// OverlayHelp is the keyboard map panel.
16func OverlayHelp() templ.Component {
17 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
18 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
19 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
20 return templ_7745c5c3_CtxErr
21 }
22 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
23 if !templ_7745c5c3_IsBuffer {
24 defer func() {
25 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
26 if templ_7745c5c3_Err == nil {
27 templ_7745c5c3_Err = templ_7745c5c3_BufErr
28 }
29 }()
30 }
31 ctx = templ.InitializeContext(ctx)
32 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
33 if templ_7745c5c3_Var1 == nil {
34 templ_7745c5c3_Var1 = templ.NopComponent
35 }
36 ctx = templ.ClearChildren(ctx)
37 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<dialog id=\"panel-help\" class=\"panel modal\" aria-label=\"Keyboard shortcuts\" hx-on:keydown=\"event.key === 'Escape' && (event.preventDefault(), this.close())\" hx-on:click=\"event.target === this && this.close()\"><div class=\"panel-head\"><h2>Keyboard shortcuts</h2><button type=\"button\" class=\"panel-x\" aria-label=\"Close\" hx-on:click=\"closest('dialog').close()\"><kbd>esc</kbd> close</button></div><dl class=\"keys\"><div><dt><kbd>ctrl k</kbd> <kbd>:</kbd></dt><dd>go to a section, branch, tag, file or repository</dd></div><div><dt><kbd>?</kbd></dt><dd>this list</dd></div><div><dt><kbd>j</kbd> <kbd>k</kbd></dt><dd>move the row cursor down / up</dd></div><div><dt><kbd>enter</kbd></dt><dd>open the row under the cursor</dd></div><div><dt><kbd>g g</kbd> <kbd>G</kbd></dt><dd>first / last row</dd></div><div><dt><kbd>/</kbd></dt><dd>filter the list; on Files, find a file in the repository</dd></div><div><dt><kbd>b</kbd></dt><dd>")
38 if templ_7745c5c3_Err != nil {
39 return templ_7745c5c3_Err
40 }
41 var templ_7745c5c3_Var2 string
42 templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs("switch")
43 if templ_7745c5c3_Err != nil {
44 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 18, Col: 43}
45 }
46 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
47 if templ_7745c5c3_Err != nil {
48 return templ_7745c5c3_Err
49 }
50 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " branch or tag</dd></div><div><dt><kbd>s</kbd> <kbd>t</kbd> <kbd>c</kbd> <kbd>r</kbd> <kbd>m</kbd></dt><dd>tabs: summary, files, commits, branches & tags, merge requests</dd></div><div><dt><kbd>g h</kbd></dt><dd>home</dd></div><div><dt><kbd>y</kbd></dt><dd>copy a permalink pinned to the commit</dd></div><div><dt><kbd>d</kbd> <kbd>u</kbd> <kbd>x</kbd></dt><dd>diff: split / unified / collapse or expand all</dd></div><div><dt><kbd>n</kbd></dt><dd>merge request: next note in the diff</dd></div><div><dt><kbd>esc</kbd></dt><dd>close a dialog, leave a field</dd></div></dl></dialog>")
51 if templ_7745c5c3_Err != nil {
52 return templ_7745c5c3_Err
53 }
54 return nil
55 })
56}
57
58// OverlayRefs is the ref switcher. It exists only inside a repository.
59func OverlayRefs(l Layout) templ.Component {
60 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
61 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
62 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
63 return templ_7745c5c3_CtxErr
64 }
65 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
66 if !templ_7745c5c3_IsBuffer {
67 defer func() {
68 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
69 if templ_7745c5c3_Err == nil {
70 templ_7745c5c3_Err = templ_7745c5c3_BufErr
71 }
72 }()
73 }
74 ctx = templ.InitializeContext(ctx)
75 templ_7745c5c3_Var3 := templ.GetChildren(ctx)
76 if templ_7745c5c3_Var3 == nil {
77 templ_7745c5c3_Var3 = templ.NopComponent
78 }
79 ctx = templ.ClearChildren(ctx)
80 if l.Ref != "" {
81 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<dialog id=\"panel-refs\" class=\"panel modal\" aria-label=\"Switch ref\" hx-on:keydown=\"event.key === 'Escape' && (event.preventDefault(), this.close())\" hx-on:click=\"event.target === this && this.close()\"><div class=\"panel-head\"><label for=\"refs-filter\" class=\"sr\">filter branches and tags</label> <input id=\"refs-filter\" type=\"search\" placeholder=\"Switch branch or tag…\" autocomplete=\"off\" data-pick hx-on:input=\"let t = this.value.toLowerCase(); q('#panel-refs li').arr().forEach(li => li.hidden = !li.textContent.toLowerCase().includes(t))\"> <button type=\"button\" class=\"panel-x\" aria-label=\"Close\" hx-on:click=\"closest('dialog').close()\"><kbd>esc</kbd></button></div><div class=\"panel-cols\" data-picklist><section aria-label=\"Branches\"><h2>Branches <span class=\"count\">")
82 if templ_7745c5c3_Err != nil {
83 return templ_7745c5c3_Err
84 }
85 var templ_7745c5c3_Var4 string
86 templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(l.Heads)))
87 if templ_7745c5c3_Err != nil {
88 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 47, Col: 58}
89 }
90 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
91 if templ_7745c5c3_Err != nil {
92 return templ_7745c5c3_Err
93 }
94 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</span></h2><ul>")
95 if templ_7745c5c3_Err != nil {
96 return templ_7745c5c3_Err
97 }
98 for _, r := range l.Heads {
99 templ_7745c5c3_Err = refItem(r).Render(ctx, templ_7745c5c3_Buffer)
100 if templ_7745c5c3_Err != nil {
101 return templ_7745c5c3_Err
102 }
103 }
104 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</ul></section><section aria-label=\"Tags\"><h2>Tags <span class=\"count\">")
105 if templ_7745c5c3_Err != nil {
106 return templ_7745c5c3_Err
107 }
108 var templ_7745c5c3_Var5 string
109 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(l.Tags)))
110 if templ_7745c5c3_Err != nil {
111 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 55, Col: 53}
112 }
113 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
114 if templ_7745c5c3_Err != nil {
115 return templ_7745c5c3_Err
116 }
117 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</span></h2><ul>")
118 if templ_7745c5c3_Err != nil {
119 return templ_7745c5c3_Err
120 }
121 for _, r := range l.Tags {
122 templ_7745c5c3_Err = refItem(r).Render(ctx, templ_7745c5c3_Buffer)
123 if templ_7745c5c3_Err != nil {
124 return templ_7745c5c3_Err
125 }
126 }
127 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</ul></section></div></dialog>")
128 if templ_7745c5c3_Err != nil {
129 return templ_7745c5c3_Err
130 }
131 }
132 return nil
133 })
134}
135
136func refItem(r RefItem) templ.Component {
137 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
138 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
139 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
140 return templ_7745c5c3_CtxErr
141 }
142 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
143 if !templ_7745c5c3_IsBuffer {
144 defer func() {
145 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
146 if templ_7745c5c3_Err == nil {
147 templ_7745c5c3_Err = templ_7745c5c3_BufErr
148 }
149 }()
150 }
151 ctx = templ.InitializeContext(ctx)
152 templ_7745c5c3_Var6 := templ.GetChildren(ctx)
153 if templ_7745c5c3_Var6 == nil {
154 templ_7745c5c3_Var6 = templ.NopComponent
155 }
156 ctx = templ.ClearChildren(ctx)
157 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<li><a href=\"")
158 if templ_7745c5c3_Err != nil {
159 return templ_7745c5c3_Err
160 }
161 var templ_7745c5c3_Var7 templ.SafeURL
162 templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(r.Href))
163 if templ_7745c5c3_Err != nil {
164 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 70, Col: 31}
165 }
166 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
167 if templ_7745c5c3_Err != nil {
168 return templ_7745c5c3_Err
169 }
170 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\"")
171 if templ_7745c5c3_Err != nil {
172 return templ_7745c5c3_Err
173 }
174 if r.Current {
175 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " aria-current=\"true\"")
176 if templ_7745c5c3_Err != nil {
177 return templ_7745c5c3_Err
178 }
179 }
180 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "><span class=\"mark\" aria-hidden=\"true\">")
181 if templ_7745c5c3_Err != nil {
182 return templ_7745c5c3_Err
183 }
184 if r.Current {
185 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "●")
186 if templ_7745c5c3_Err != nil {
187 return templ_7745c5c3_Err
188 }
189 } else {
190 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " ")
191 if templ_7745c5c3_Err != nil {
192 return templ_7745c5c3_Err
193 }
194 }
195 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</span>")
196 if templ_7745c5c3_Err != nil {
197 return templ_7745c5c3_Err
198 }
199 var templ_7745c5c3_Var8 string
200 templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
201 if templ_7745c5c3_Err != nil {
202 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 81, Col: 18}
203 }
204 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
205 if templ_7745c5c3_Err != nil {
206 return templ_7745c5c3_Err
207 }
208 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</a></li>")
209 if templ_7745c5c3_Err != nil {
210 return templ_7745c5c3_Err
211 }
212 return nil
213 })
214}
215
216// OverlayCmd is the ":" command line: one filterable list mixing sections,
217// refs and repos.
218func OverlayCmd(items []CmdItem) templ.Component {
219 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
220 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
221 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
222 return templ_7745c5c3_CtxErr
223 }
224 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
225 if !templ_7745c5c3_IsBuffer {
226 defer func() {
227 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
228 if templ_7745c5c3_Err == nil {
229 templ_7745c5c3_Err = templ_7745c5c3_BufErr
230 }
231 }()
232 }
233 ctx = templ.InitializeContext(ctx)
234 templ_7745c5c3_Var9 := templ.GetChildren(ctx)
235 if templ_7745c5c3_Var9 == nil {
236 templ_7745c5c3_Var9 = templ.NopComponent
237 }
238 ctx = templ.ClearChildren(ctx)
239 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<dialog id=\"panel-cmd\" class=\"panel modal\" aria-label=\"Go to\" hx-on:close=\"ermiteFinder.paletteClose()\" hx-on:keydown=\"event.key === 'Escape' && (event.preventDefault(), this.close())\" hx-on:click=\"event.target === this && this.close()\"><div class=\"panel-head\"><label for=\"cmd-q\" class=\"sr\">go to</label> <input id=\"cmd-q\" type=\"search\" placeholder=\"Go to a section, branch, tag, file or repository…\" autocomplete=\"off\" spellcheck=\"false\" aria-controls=\"cmd-list\" hx-on:input=\"let t = this.value.toLowerCase().trim();\n q('#cmd-list > li[data-k]').arr().forEach(li => li.hidden = !li.dataset.k.includes(t));\n let first = q('#cmd-list > li[data-k]:not([hidden])').arr()[0]; first && q(first).take('data-cursor', '#cmd-list > li'); ermiteFinder.palette(this)\" hx-on:keydown=\"let vis = q('#cmd-list > li:not([hidden])').arr();\n let i = vis.findIndex(li => li.hasAttribute('data-cursor'));\n let step = event.key === 'ArrowDown' ? 1 : event.key === 'ArrowUp' ? -1 : 0;\n if (step) { event.preventDefault(); let n = vis[Math.max(0, Math.min(vis.length - 1, i + step))]; n && (q(n).take('data-cursor', '#cmd-list > li'), n.scrollIntoView({ block: 'nearest' })) }\n else if (event.key === 'Enter') { event.preventDefault(); vis[Math.max(i, 0)]?.querySelector('a').click() }\"> <button type=\"button\" class=\"panel-x\" aria-label=\"Close\" hx-on:click=\"closest('dialog').close()\"><kbd>esc</kbd></button></div><ul id=\"cmd-list\" class=\"cmd-list\" aria-label=\"Targets\">")
240 if templ_7745c5c3_Err != nil {
241 return templ_7745c5c3_Err
242 }
243 for i, c := range items {
244 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<li data-k=\"")
245 if templ_7745c5c3_Err != nil {
246 return templ_7745c5c3_Err
247 }
248 var templ_7745c5c3_Var10 string
249 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(strings.ToLower(c.Kind + " " + c.Label))
250 if templ_7745c5c3_Err != nil {
251 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 112, Col: 56}
252 }
253 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
254 if templ_7745c5c3_Err != nil {
255 return templ_7745c5c3_Err
256 }
257 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\"")
258 if templ_7745c5c3_Err != nil {
259 return templ_7745c5c3_Err
260 }
261 if i == 0 {
262 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " data-cursor")
263 if templ_7745c5c3_Err != nil {
264 return templ_7745c5c3_Err
265 }
266 }
267 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "><a href=\"")
268 if templ_7745c5c3_Err != nil {
269 return templ_7745c5c3_Err
270 }
271 var templ_7745c5c3_Var11 templ.SafeURL
272 templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(c.Href))
273 if templ_7745c5c3_Err != nil {
274 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 112, Col: 114}
275 }
276 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
277 if templ_7745c5c3_Err != nil {
278 return templ_7745c5c3_Err
279 }
280 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "\" tabindex=\"-1\"><span class=\"lbl\">")
281 if templ_7745c5c3_Err != nil {
282 return templ_7745c5c3_Err
283 }
284 var templ_7745c5c3_Var12 string
285 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(c.Label)
286 if templ_7745c5c3_Err != nil {
287 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 112, Col: 158}
288 }
289 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
290 if templ_7745c5c3_Err != nil {
291 return templ_7745c5c3_Err
292 }
293 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</span><span class=\"k\">")
294 if templ_7745c5c3_Err != nil {
295 return templ_7745c5c3_Err
296 }
297 var templ_7745c5c3_Var13 string
298 templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(c.Kind)
299 if templ_7745c5c3_Err != nil {
300 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 112, Col: 191}
301 }
302 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
303 if templ_7745c5c3_Err != nil {
304 return templ_7745c5c3_Err
305 }
306 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</span></a></li>")
307 if templ_7745c5c3_Err != nil {
308 return templ_7745c5c3_Err
309 }
310 }
311 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</ul><p class=\"panel-foot\"><span><kbd>↑</kbd><kbd>↓</kbd> move</span><span><kbd>enter</kbd> open</span><span><kbd>esc</kbd> close</span></p></dialog>")
312 if templ_7745c5c3_Err != nil {
313 return templ_7745c5c3_Err
314 }
315 return nil
316 })
317}
318
319var _ = templruntime.GeneratedTemplate