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; the keys of the merge request page
16// show on that page only.
17func OverlayHelp(mr bool) templ.Component {
18 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
19 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
20 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
21 return templ_7745c5c3_CtxErr
22 }
23 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
24 if !templ_7745c5c3_IsBuffer {
25 defer func() {
26 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
27 if templ_7745c5c3_Err == nil {
28 templ_7745c5c3_Err = templ_7745c5c3_BufErr
29 }
30 }()
31 }
32 ctx = templ.InitializeContext(ctx)
33 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
34 if templ_7745c5c3_Var1 == nil {
35 templ_7745c5c3_Var1 = templ.NopComponent
36 }
37 ctx = templ.ClearChildren(ctx)
38 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>l</kbd> <kbd>h</kbd></dt><dd>into the side panel (on a merge request, its files) / back to the content; there j k move between its controls</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>")
39 if templ_7745c5c3_Err != nil {
40 return templ_7745c5c3_Err
41 }
42 var templ_7745c5c3_Var2 string
43 templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs("switch")
44 if templ_7745c5c3_Err != nil {
45 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 20, Col: 43}
46 }
47 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
48 if templ_7745c5c3_Err != nil {
49 return templ_7745c5c3_Err
50 }
51 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>e</kbd> <kbd>E</kbd></dt><dd>diff: the whole file in view / every file, with the lines the hunks hide</dd></div><div><dt><kbd>n</kbd></dt><dd>merge request: next note in the diff</dd></div>")
52 if templ_7745c5c3_Err != nil {
53 return templ_7745c5c3_Err
54 }
55 if mr {
56 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<div><dt><kbd>g f</kbd></dt><dd>merge request: the list of files (j k move, enter opens, esc back)</dd></div><div><dt><kbd>M</kbd></dt><dd>merge request: the merge menu; there 1–3 pick the mode, D deletes the branch, enter merges</dd></div><div><dt><kbd>R</kbd></dt><dd>merge request: mark the head read</dd></div>")
57 if templ_7745c5c3_Err != nil {
58 return templ_7745c5c3_Err
59 }
60 }
61 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<div><dt><kbd>esc</kbd></dt><dd>close a dialog, leave a field</dd></div></dl></dialog>")
62 if templ_7745c5c3_Err != nil {
63 return templ_7745c5c3_Err
64 }
65 return nil
66 })
67}
68
69// OverlayRefs is the ref switcher. It exists only inside a repository.
70func OverlayRefs(l Layout) templ.Component {
71 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
72 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
73 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
74 return templ_7745c5c3_CtxErr
75 }
76 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
77 if !templ_7745c5c3_IsBuffer {
78 defer func() {
79 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
80 if templ_7745c5c3_Err == nil {
81 templ_7745c5c3_Err = templ_7745c5c3_BufErr
82 }
83 }()
84 }
85 ctx = templ.InitializeContext(ctx)
86 templ_7745c5c3_Var3 := templ.GetChildren(ctx)
87 if templ_7745c5c3_Var3 == nil {
88 templ_7745c5c3_Var3 = templ.NopComponent
89 }
90 ctx = templ.ClearChildren(ctx)
91 if l.Ref != "" {
92 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<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=\"#panel-refs li\" hx-on:input=\"ermite.filter(this)\"> <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\">")
93 if templ_7745c5c3_Err != nil {
94 return templ_7745c5c3_Err
95 }
96 var templ_7745c5c3_Var4 string
97 templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(l.Heads)))
98 if templ_7745c5c3_Err != nil {
99 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 55, Col: 58}
100 }
101 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
102 if templ_7745c5c3_Err != nil {
103 return templ_7745c5c3_Err
104 }
105 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</span></h2><ul>")
106 if templ_7745c5c3_Err != nil {
107 return templ_7745c5c3_Err
108 }
109 for _, r := range l.Heads {
110 templ_7745c5c3_Err = refItem(r).Render(ctx, templ_7745c5c3_Buffer)
111 if templ_7745c5c3_Err != nil {
112 return templ_7745c5c3_Err
113 }
114 }
115 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</ul></section><section aria-label=\"Tags\"><h2>Tags <span class=\"count\">")
116 if templ_7745c5c3_Err != nil {
117 return templ_7745c5c3_Err
118 }
119 var templ_7745c5c3_Var5 string
120 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(l.Tags)))
121 if templ_7745c5c3_Err != nil {
122 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 63, Col: 53}
123 }
124 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
125 if templ_7745c5c3_Err != nil {
126 return templ_7745c5c3_Err
127 }
128 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</span></h2><ul>")
129 if templ_7745c5c3_Err != nil {
130 return templ_7745c5c3_Err
131 }
132 for _, r := range l.Tags {
133 templ_7745c5c3_Err = refItem(r).Render(ctx, templ_7745c5c3_Buffer)
134 if templ_7745c5c3_Err != nil {
135 return templ_7745c5c3_Err
136 }
137 }
138 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</ul></section></div></dialog>")
139 if templ_7745c5c3_Err != nil {
140 return templ_7745c5c3_Err
141 }
142 }
143 return nil
144 })
145}
146
147func refItem(r RefItem) templ.Component {
148 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
149 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
150 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
151 return templ_7745c5c3_CtxErr
152 }
153 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
154 if !templ_7745c5c3_IsBuffer {
155 defer func() {
156 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
157 if templ_7745c5c3_Err == nil {
158 templ_7745c5c3_Err = templ_7745c5c3_BufErr
159 }
160 }()
161 }
162 ctx = templ.InitializeContext(ctx)
163 templ_7745c5c3_Var6 := templ.GetChildren(ctx)
164 if templ_7745c5c3_Var6 == nil {
165 templ_7745c5c3_Var6 = templ.NopComponent
166 }
167 ctx = templ.ClearChildren(ctx)
168 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<li><a href=\"")
169 if templ_7745c5c3_Err != nil {
170 return templ_7745c5c3_Err
171 }
172 var templ_7745c5c3_Var7 templ.SafeURL
173 templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(r.Href))
174 if templ_7745c5c3_Err != nil {
175 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 78, Col: 31}
176 }
177 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
178 if templ_7745c5c3_Err != nil {
179 return templ_7745c5c3_Err
180 }
181 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "\"")
182 if templ_7745c5c3_Err != nil {
183 return templ_7745c5c3_Err
184 }
185 if r.Current {
186 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " aria-current=\"true\"")
187 if templ_7745c5c3_Err != nil {
188 return templ_7745c5c3_Err
189 }
190 }
191 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "><span class=\"mark\" aria-hidden=\"true\">")
192 if templ_7745c5c3_Err != nil {
193 return templ_7745c5c3_Err
194 }
195 if r.Current {
196 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "●")
197 if templ_7745c5c3_Err != nil {
198 return templ_7745c5c3_Err
199 }
200 } else {
201 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " ")
202 if templ_7745c5c3_Err != nil {
203 return templ_7745c5c3_Err
204 }
205 }
206 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</span>")
207 if templ_7745c5c3_Err != nil {
208 return templ_7745c5c3_Err
209 }
210 var templ_7745c5c3_Var8 string
211 templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
212 if templ_7745c5c3_Err != nil {
213 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 89, Col: 18}
214 }
215 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
216 if templ_7745c5c3_Err != nil {
217 return templ_7745c5c3_Err
218 }
219 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</a></li>")
220 if templ_7745c5c3_Err != nil {
221 return templ_7745c5c3_Err
222 }
223 return nil
224 })
225}
226
227// OverlayCmd is the ":" command line: one filterable list mixing sections,
228// refs and repos.
229func OverlayCmd(items []CmdItem) templ.Component {
230 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
231 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
232 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
233 return templ_7745c5c3_CtxErr
234 }
235 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
236 if !templ_7745c5c3_IsBuffer {
237 defer func() {
238 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
239 if templ_7745c5c3_Err == nil {
240 templ_7745c5c3_Err = templ_7745c5c3_BufErr
241 }
242 }()
243 }
244 ctx = templ.InitializeContext(ctx)
245 templ_7745c5c3_Var9 := templ.GetChildren(ctx)
246 if templ_7745c5c3_Var9 == nil {
247 templ_7745c5c3_Var9 = templ.NopComponent
248 }
249 ctx = templ.ClearChildren(ctx)
250 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<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=\"ermite.cmdFilter(this); ermiteFinder.palette(this)\" hx-on:keydown=\"ermite.cmdKey(event)\"> <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\">")
251 if templ_7745c5c3_Err != nil {
252 return templ_7745c5c3_Err
253 }
254 for i, c := range items {
255 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<li data-k=\"")
256 if templ_7745c5c3_Err != nil {
257 return templ_7745c5c3_Err
258 }
259 var templ_7745c5c3_Var10 string
260 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(strings.ToLower(c.Kind + " " + c.Label))
261 if templ_7745c5c3_Err != nil {
262 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 114, Col: 56}
263 }
264 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
265 if templ_7745c5c3_Err != nil {
266 return templ_7745c5c3_Err
267 }
268 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\"")
269 if templ_7745c5c3_Err != nil {
270 return templ_7745c5c3_Err
271 }
272 if i == 0 {
273 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " data-cursor")
274 if templ_7745c5c3_Err != nil {
275 return templ_7745c5c3_Err
276 }
277 }
278 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "><a href=\"")
279 if templ_7745c5c3_Err != nil {
280 return templ_7745c5c3_Err
281 }
282 var templ_7745c5c3_Var11 templ.SafeURL
283 templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(c.Href))
284 if templ_7745c5c3_Err != nil {
285 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 114, Col: 114}
286 }
287 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
288 if templ_7745c5c3_Err != nil {
289 return templ_7745c5c3_Err
290 }
291 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\" tabindex=\"-1\"><span class=\"lbl\">")
292 if templ_7745c5c3_Err != nil {
293 return templ_7745c5c3_Err
294 }
295 var templ_7745c5c3_Var12 string
296 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(c.Label)
297 if templ_7745c5c3_Err != nil {
298 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 114, Col: 158}
299 }
300 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
301 if templ_7745c5c3_Err != nil {
302 return templ_7745c5c3_Err
303 }
304 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</span><span class=\"k\">")
305 if templ_7745c5c3_Err != nil {
306 return templ_7745c5c3_Err
307 }
308 var templ_7745c5c3_Var13 string
309 templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(c.Kind)
310 if templ_7745c5c3_Err != nil {
311 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/overlays.templ`, Line: 114, Col: 191}
312 }
313 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
314 if templ_7745c5c3_Err != nil {
315 return templ_7745c5c3_Err
316 }
317 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</span></a></li>")
318 if templ_7745c5c3_Err != nil {
319 return templ_7745c5c3_Err
320 }
321 }
322 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</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>")
323 if templ_7745c5c3_Err != nil {
324 return templ_7745c5c3_Err
325 }
326 return nil
327 })
328}
329
330var _ = templruntime.GeneratedTemplate