1
-
Removed:
(** Generic site building blocks.
2
-
Removed:
3
-
Removed:
This module is the only place in the view layer that names HTML elements. It
4
-
Removed:
knows nothing about the application domain — no Git, repositories, or ogit
5
-
Removed:
routes — so the same vocabulary would serve any static-first web
6
-
Removed:
application: every function takes plain strings and already-built nodes.
7
-
Removed:
8
-
Removed:
{2 Conventions}
9
-
Removed:
10
-
Removed:
- {b Semantic first.} Each block picks the most meaningful element available
11
-
Removed:
([nav], [header], [time], [dl], [details]) rather than a [div] with a
12
-
Removed:
class. Callers choose blocks by meaning, not by appearance.
13
-
Removed:
- {b Classes are a contract.} Blocks emit a fixed vocabulary of class names
14
-
Removed:
— [tree-dir], [tree-toggle], [line-anchor], [pagination-btn] and so on —
15
-
Removed:
which a stylesheet is expected to implement. Those names are structural,
16
-
Removed:
never domain-specific: a "tree" here is any hierarchical list, not a file
17
-
Removed:
tree in particular. Optional [?class_] arguments add a modifier
18
-
Removed:
{i alongside} the base class rather than replacing it.
19
-
Removed:
- {b No scripting.} Interactive blocks ({!val-disclosure},
20
-
Removed:
{!val-css_toggle}) rely on native HTML and CSS, so pages stay usable with
21
-
Removed:
JavaScript disabled.
22
-
Removed:
- {b Accessibility is not optional.} Where a block can only be used
23
-
Removed:
correctly with an accessible name, that name is a required argument rather
24
-
Removed:
than an optional one — see {!val-navigation} and {!val-dismissible}.
25
-
Removed:
26
-
Removed:
Nothing here performs I/O. The attribute plumbing that assembles these
27
-
Removed:
blocks is deliberately not exported: callers compose blocks, they do not
28
-
Removed:
assemble attributes. *)
29
-
Removed:
30
-
Removed:
type node = Dream_html.node
31
-
Removed:
(** A rendered fragment. Exposed so callers can annotate lists of children
32
-
Removed:
without opening [Dream_html] themselves. *)
33
-
Removed:
34
-
Removed:
val classes : string list -> string
35
-
Removed:
(** Join class names, dropping empty ones. Lets callers pass a modifier without
36
-
Removed:
having to manage separators or risk a stray leading space. *)
37
-
Removed:
38
-
Removed:
(** {1 Text and grouping} *)
39
-
Removed:
40
-
Removed:
val nothing : node
41
-
Removed:
(** Renders no markup. Use for absent optional content. *)
42
-
Removed:
43
-
Removed:
val text : string -> node
44
-
Removed:
(** Escaped text. *)
45
-
Removed:
46
-
Removed:
val group : node list -> node
47
-
Removed:
(** Several nodes where one is expected, without introducing a wrapper element.
48
-
Removed:
*)
49
-
Removed:
50
-
Removed:
(** {1 Inline} *)
51
-
Removed:
52
-
Removed:
val inline : ?class_:string -> ?decorative:bool -> node list -> node
53
-
Removed:
(** An inline run of text or nodes.
54
-
Removed:
55
-
Removed:
@param decorative
56
-
Removed:
hides the span from assistive technology, for glyphs that repeat
57
-
Removed:
information already available as text. *)
58
-
Removed:
59
-
Removed:
val inline_text : ?class_:string -> ?decorative:bool -> string -> node
60
-
Removed:
(** {!val-inline} around a single string. *)
61
-
Removed:
62
-
Removed:
(** {1 Links} *)
63
-
Removed:
64
-
Removed:
val link :
65
-
Removed:
?id:string ->
66
-
Removed:
?class_:string ->
67
-
Removed:
?label:string ->
68
-
Removed:
href:string ->
69
-
Removed:
node list ->
70
-
Removed:
node
71
-
Removed:
(** A hyperlink.
72
-
Removed:
73
-
Removed:
@param label
74
-
Removed:
an accessible name, for links whose visible text is not descriptive on its
75
-
Removed:
own. *)
76
-
Removed:
77
-
Removed:
val text_link :
78
-
Removed:
?id:string -> ?class_:string -> ?label:string -> href:string -> string -> node
79
-
Removed:
(** {!link} around a single string. *)
80
-
Removed:
81
-
Removed:
(** {1 Images} *)
82
-
Removed:
83
-
Removed:
val image : ?class_:string -> ?alt:string -> src:string -> unit -> node
84
-
Removed:
(** @param alt
85
-
Removed:
omit for decorative images; the block then marks itself presentational so
86
-
Removed:
screen readers skip it. *)
87
-
Removed:
88
-
Removed:
(** {1 Blocks} *)
89
-
Removed:
90
-
Removed:
val block : ?id:string -> ?class_:string -> node list -> node
91
-
Removed:
(** A generic grouping box. Reach for {!region} or one of the page landmarks
92
-
Removed:
first; this is for layout wrappers that carry no meaning of their own. *)
93
-
Removed:
94
-
Removed:
val region : ?id:string -> ?class_:string -> node list -> node
95
-
Removed:
(** A self-contained part of a page. *)
96
-
Removed:
97
-
Removed:
val paragraph : ?class_:string -> node list -> node
98
-
Removed:
val paragraph_text : ?class_:string -> string -> node
99
-
Removed:
100
-
Removed:
val heading : ?id:string -> ?level:int -> ?class_:string -> node list -> node
101
-
Removed:
(** A heading. [level] follows the document outline: 1 for the page's subject, 2
102
-
Removed:
and 3 for nested sections. Skipping levels breaks screen-reader navigation,
103
-
Removed:
so pass the level that matches the structure rather than the one that looks
104
-
Removed:
right. Levels outside 1–6 clamp to 6. [id] provides a local fragment target.
105
-
Removed:
*)
106
-
Removed:
107
-
Removed:
val code_block : ?class_:string -> node list -> node
108
-
Removed:
(** A preformatted code block without line numbers. The children can be escaped
109
-
Removed:
text or server-rendered syntax-highlight spans. *)
110
-
Removed:
111
-
Removed:
(** {1 Lists} *)
112
-
Removed:
113
-
Removed:
val items : ?id:string -> ?class_:string -> node list -> node
114
-
Removed:
(** An unordered list wrapping already-built {!item} nodes. *)
115
-
Removed:
116
-
Removed:
val ordered_items : ?id:string -> ?class_:string -> node list -> node
117
-
Removed:
(** An ordered list wrapping already-built {!item} nodes. *)
118
-
Removed:
119
-
Removed:
val item : ?class_:string -> ?current:bool -> node list -> node
120
-
Removed:
(** A list entry.
121
-
Removed:
122
-
Removed:
@param current
123
-
Removed:
marks the entry as the one matching the current page, for navigation
124
-
Removed:
lists. *)
125
-
Removed:
126
-
Removed:
val items_of : ?id:string -> ?class_:string -> ('a -> node) -> 'a list -> node
127
-
Removed:
(** A list built from values, saving callers a [List.map]. *)
128
-
Removed:
129
-
Removed:
val code_inline : ?class_:string -> string -> node
130
-
Removed:
(** An inline code fragment. *)
131
-
Removed:
132
-
Removed:
(** {1 Badges} *)
133
-
Removed:
134
-
Removed:
val badge :
135
-
Removed:
?base_class:string -> ?variant:string -> ?href:string -> string -> node
136
-
Removed:
(** A small rounded label. [variant] is appended to the base class as
137
-
Removed:
[<base> <base>-<variant>] so a stylesheet can colour each kind. [href] turns
138
-
Removed:
the label's text into a link while leaving the badge itself inert. *)
139
-
Removed:
140
-
Removed:
(** {1 Time} *)
141
-
Removed:
142
-
Removed:
val timestamp : machine:string -> string -> node
143
-
Removed:
(** A machine-readable timestamp: [machine] fills the [datetime] attribute, the
144
-
Removed:
positional argument is the visible text. *)
145
-
Removed:
146
-
Removed:
(** {1 Definition lists} *)
147
-
Removed:
148
-
Removed:
val definitions : ?class_:string -> (string * node list) list -> node
149
-
Removed:
(** Term/description pairs, for metadata panels. *)
150
-
Removed:
151
-
Removed:
(** {1 Disclosure} *)
152
-
Removed:
153
-
Removed:
val chevron : ?class_:string -> unit -> node
154
-
Removed:
(** Decorative open/close indicator, rotated by CSS from the enclosing
155
-
Removed:
[details]. It carries no textual meaning, so it is hidden from assistive
156
-
Removed:
technology. *)
157
-
Removed:
158
-
Removed:
val disclosure :
159
-
Removed:
?id:string ->
160
-
Removed:
?class_:string ->
161
-
Removed:
?expanded:bool ->
162
-
Removed:
?summary_class:string ->
163
-
Removed:
summary:node list ->
164
-
Removed:
node list ->
165
-
Removed:
node
166
-
Removed:
(** A native disclosure widget: [details] wrapping a clickable [summary] and its
167
-
Removed:
panel. No JavaScript involved.
168
-
Removed:
169
-
Removed:
@param expanded renders the panel open on load.
170
-
Removed:
@param summary the always-visible header contents. *)
171
-
Removed:
172
-
Removed:
val css_toggle :
173
-
Removed:
id:string ->
174
-
Removed:
toggle_class:string ->
175
-
Removed:
control_class:string ->
176
-
Removed:
label:string ->
177
-
Removed:
glyph:string ->
178
-
Removed:
unit ->
179
-
Removed:
node
180
-
Removed:
(** A CSS-only toggle: a visually hidden checkbox paired with a [label] acting
181
-
Removed:
as its control. Lets stylesheets reveal and collapse content without
182
-
Removed:
scripting.
183
-
Removed:
184
-
Removed:
@param label the accessible name of the control, whose [glyph] has none. *)
185
-
Removed:
186
-
Removed:
(** {1 Table of contents} *)
187
-
Removed:
188
-
Removed:
type toc_entry
189
-
Removed:
(** One entry in a table of contents. Build with {!val-toc_entry}. Entries may
190
-
Removed:
contain nested children to represent subheading hierarchy. *)
191
-
Removed:
192
-
Removed:
val toc_entry : ?children:toc_entry list -> href:string -> string -> toc_entry
193
-
Removed:
(** A TOC entry linking to a fragment.
194
-
Removed:
195
-
Removed:
@param children
196
-
Removed:
nested sub-entries displayed as an indented list beneath this entry. *)
197
-
Removed:
198
-
Removed:
val toc : ?class_:string -> title:string -> toc_entry list -> node
199
-
Removed:
(** A collapsible table of contents with support for nested sub-entries. Renders
200
-
Removed:
as a disclosure widget with classes [toc], [toc-summary], and [toc-list].
201
-
Removed:
Nested children produce nested [toc-list] elements for semantic indentation.
202
-
Removed:
Returns {!nothing} when the list has fewer than two entries.
203
-
Removed:
204
-
Removed:
@param class_ an additional modifier alongside the base [toc] class. *)
205
-
Removed:
206
-
Removed:
(** {1 Trees}
207
-
Removed:
208
-
Removed:
A "tree" is any hierarchical list: rows that either stand alone or expand to
209
-
Removed:
reveal nested rows. Compose these into {!items}. *)
210
-
Removed:
211
-
Removed:
val tree_leaf : ?modifier:string -> href:string -> string -> node
212
-
Removed:
(** A leaf row.
213
-
Removed:
214
-
Removed:
@param modifier a class added alongside the base [tree-file] class. *)
215
-
Removed:
216
-
Removed:
val tree_branch :
217
-
Removed:
?modifier:string ->
218
-
Removed:
?expanded:bool ->
219
-
Removed:
href:string ->
220
-
Removed:
string ->
221
-
Removed:
node list ->
222
-
Removed:
node
223
-
Removed:
(** A branch row.
224
-
Removed:
225
-
Removed:
Renders a disclosure inside the list item: the summary holds a chevron and a
226
-
Removed:
link, the panel holds the nested list. Clicking the summary padding or the
227
-
Removed:
chevron toggles; clicking the link navigates. Every nested collection on a
228
-
Removed:
site therefore gets the same keyboard and pointer behaviour.
229
-
Removed:
230
-
Removed:
@param modifier a class added alongside the base [tree-dir] class.
231
-
Removed:
@param expanded renders the nested list open on load. *)
232
-
Removed:
233
-
Removed:
val tree_overflow : ?class_:string -> href:string -> string -> node
234
-
Removed:
(** A row standing in for entries omitted from a truncated list. *)
235
-
Removed:
236
-
Removed:
(** {1 Breadcrumbs} *)
237
-
Removed:
238
-
Removed:
type crumb
239
-
Removed:
(** One step in a trail. Build with {!val-crumb}. *)
240
-
Removed:
241
-
Removed:
val crumb : ?href:string -> string -> crumb
242
-
Removed:
(** A trail step. Without an href it renders as plain text, which is how the
243
-
Removed:
current location should be shown. *)
244
-
Removed:
245
-
Removed:
val breadcrumb :
246
-
Removed:
?id:string ->
247
-
Removed:
?class_:string ->
248
-
Removed:
?link_class:string ->
249
-
Removed:
?separator_class:string ->
250
-
Removed:
?separator_decorative:bool ->
251
-
Removed:
separator:string ->
252
-
Removed:
crumb list ->
253
-
Removed:
node
254
-
Removed:
(** A trail of links joined by a separator.
255
-
Removed:
256
-
Removed:
@param separator_decorative
257
-
Removed:
hides the separators from assistive technology. Appropriate when the trail
258
-
Removed:
already reads as a list of links; leave it off when the separator carries
259
-
Removed:
meaning, such as a path delimiter worth reading aloud. *)
260
-
Removed:
261
-
Removed:
(** {1 Navigation} *)
262
-
Removed:
263
-
Removed:
type nav_link
264
-
Removed:
(** A destination in a navigation list. Build with {!val-nav_link}. *)
265
-
Removed:
266
-
Removed:
val nav_link : ?current:bool -> href:string -> string -> nav_link
267
-
Removed:
268
-
Removed:
val navigation :
269
-
Removed:
?id:string -> ?class_:string -> label:string -> node list -> node
270
-
Removed:
(** A navigation landmark. [label] is required because it names the landmark for
271
-
Removed:
assistive technology, which matters as soon as a page has more than one. *)
272
-
Removed:
273
-
Removed:
val nav_links :
274
-
Removed:
?id:string -> ?class_:string -> ?item_class:string -> nav_link list -> node
275
-
Removed:
(** A list of navigation links; the current page's item carries
276
-
Removed:
[aria-current="page"]. *)
277
-
Removed:
278
-
Removed:
(** {1 Toolbars} *)
279
-
Removed:
280
-
Removed:
val toolbar : ?id:string -> ?class_:string -> ?label:string -> node list -> node
281
-
Removed:
(** A bar of controls acting on the current page. An empty toolbar renders
282
-
Removed:
nothing, so layout offsets that depend on its presence stay consistent. *)
283
-
Removed:
284
-
Removed:
val button_link :
285
-
Removed:
?class_:string -> ?label:string -> href:string -> string -> node
286
-
Removed:
(** A link styled as a toolbar button. Still a link, not a [button], because it
287
-
Removed:
navigates rather than acting on the current page — which keeps middle-click
288
-
Removed:
and "open in new tab" working. *)
289
-
Removed:
290
-
Removed:
val dismissible :
291
-
Removed:
?class_:string ->
292
-
Removed:
?dismiss_class:string ->
293
-
Removed:
value_class:string ->
294
-
Removed:
dismiss_href:string ->
295
-
Removed:
dismiss_label:string ->
296
-
Removed:
string ->
297
-
Removed:
node
298
-
Removed:
(** An active filter together with a control that removes it.
299
-
Removed:
300
-
Removed:
@param value_class styles the displayed value.
301
-
Removed:
@param dismiss_label
302
-
Removed:
accessible name of the remove control, required because its glyph conveys
303
-
Removed:
nothing on its own. *)
304
-
Removed:
305
-
Removed:
(** {1 Pagination} *)
306
-
Removed:
307
-
Removed:
val pagination :
308
-
Removed:
?label:string ->
309
-
Removed:
?previous_text:string ->
310
-
Removed:
?next_text:string ->
311
-
Removed:
?previous_label:string ->
312
-
Removed:
?next_label:string ->
313
-
Removed:
?previous_href:string ->
314
-
Removed:
?next_href:string ->
315
-
Removed:
int ->
316
-
Removed:
node
317
-
Removed:
(** Previous/next controls around a page number.
318
-
Removed:
319
-
Removed:
A missing neighbour — an absent [previous_href] or [next_href] — renders as
320
-
Removed:
an inert, aria-hidden placeholder rather than disappearing, so the controls
321
-
Removed:
keep their position between pages.
322
-
Removed:
323
-
Removed:
The glyphs are decorative; [previous_label] and [next_label] carry the
324
-
Removed:
accessible names. *)
325
-
Removed:
326
-
Removed:
(** {1 Code} *)
327
-
Removed:
328
-
Removed:
val code_listing :
329
-
Removed:
?id:string -> ?class_:string -> ?anchor_prefix:string -> string -> node
330
-
Removed:
(** A line-numbered listing of source text.
331
-
Removed:
332
-
Removed:
Every line gets a stable anchor so single lines can be linked and
333
-
Removed:
highlighted. [anchor_prefix] namespaces those anchors, which is required
334
-
Removed:
when one page shows more than one listing.
335
-
Removed:
336
-
Removed:
Content is emitted verbatim as plain text with no syntax colouring. For
337
-
Removed:
highlighted output, use {!highlighted_code_listing} instead. *)
338
-
Removed:
339
-
Removed:
val highlighted_code_listing :
340
-
Removed:
?id:string ->
341
-
Removed:
?class_:string ->
342
-
Removed:
?anchor_prefix:string ->
343
-
Removed:
node list list ->
344
-
Removed:
node
345
-
Removed:
(** A line-numbered listing of pre-highlighted source code.
346
-
Removed:
347
-
Removed:
Like {!code_listing} but accepts lines already tokenized into styled spans
348
-
Removed:
(e.g. from {!Highlight.highlight}). Each inner list represents one line's
349
-
Removed:
worth of nodes; the function adds line numbers and anchors in the same grid
350
-
Removed:
layout as [code_listing]. *)
351
-
Removed:
352
-
Removed:
(** {1 Diffs} *)
353
-
Removed:
354
-
Removed:
(** A viewer for line-oriented change sets. The data types are deliberately
355
-
Removed:
plain so any producer of diffs can feed them. *)
356
-
Removed:
module Diff : sig
357
-
Removed:
type change = Unchanged | Added | Removed
358
-
Removed:
359
-
Removed:
type line = {
360
-
Removed:
before : string; (** line number in the old revision, or [""] *)
361
-
Removed:
after : string; (** line number in the new revision, or [""] *)
362
-
Removed:
change : change;
363
-
Removed:
content : string;
364
-
Removed:
}
365
-
Removed:
366
-
Removed:
type section = { section_heading : string; lines : line list }
367
-
Removed:
368
-
Removed:
type file = {
369
-
Removed:
path : string;
370
-
Removed:
detail : string; (** provenance line, e.g. revision identifiers *)
371
-
Removed:
sections : section list;
372
-
Removed:
note : string option; (** shown instead of sections, e.g. binary files *)
373
-
Removed:
}
374
-
Removed:
375
-
Removed:
val view : empty_message:string -> file list -> node list
376
-
Removed:
(** Render a change set, or a single paragraph carrying [empty_message] when
377
-
Removed:
there is nothing to show. *)
378
-
Removed:
end
379
-
Removed:
380
-
Removed:
(** {1 Document scaffolding}
381
-
Removed:
382
-
Removed:
Two families, kept apart by prefix. The [document_] functions build the
383
-
Removed:
envelope a browser reads — [html], [head], [body] — and the [page_]
384
-
Removed:
functions build the landmarks a reader sees inside it. [document_head] and
385
-
Removed:
[page_banner] are the pair most easily confused: the first is metadata, the
386
-
Removed:
second is the visible masthead. *)
387
-
Removed:
388
-
Removed:
val meta_viewport : node
389
-
Removed:
(** Opts the page into responsive layout. Without it mobile browsers assume a
390
-
Removed:
desktop-width viewport and scale the page down. *)
391
-
Removed:
392
-
Removed:
val stylesheet : string -> node
393
-
Removed:
val icon : ?media_type:string -> string -> node
394
-
Removed:
395
-
Removed:
val deferred_script : string -> node
396
-
Removed:
(** An external script that does not block rendering. *)
397
-
Removed:
398
-
Removed:
val inline_script : string -> node
399
-
Removed:
(** Inline behaviour. Reserved for progressive enhancement: pages must stay
400
-
Removed:
usable when it does not run. *)
401
-
Removed:
402
-
Removed:
val skip_link : href:string -> string -> node
403
-
Removed:
(** A link that jumps past repeated navigation, revealed on focus. Expected on
404
-
Removed:
every page for keyboard users. *)
405
-
Removed:
406
-
Removed:
(** {2 The document envelope} *)
407
-
Removed:
408
-
Removed:
val document_head : title:string -> node list -> node
409
-
Removed:
(** The [head] element: title, metadata and asset links. [title] comes first so
410
-
Removed:
it cannot be forgotten. *)
411
-
Removed:
412
-
Removed:
val document_body : ?class_:string -> node list -> node
413
-
Removed:
(** The [body] element. *)
414
-
Removed:
415
-
Removed:
val document : ?lang:string -> head:node -> body:node -> unit -> node
416
-
Removed:
(** A complete document. [lang] defaults to ["en"]; set it so screen readers
417
-
Removed:
pick the right pronunciation. *)
418
-
Removed:
419
-
Removed:
(** {2 Landmarks within the page} *)
420
-
Removed:
421
-
Removed:
val page_banner : ?id:string -> ?class_:string -> node list -> node
422
-
Removed:
(** The [header] element introducing the page — its masthead. Named for the ARIA
423
-
Removed:
landmark it maps to, and to keep it distinct from {!val-document_head}. *)
424
-
Removed:
425
-
Removed:
val page_content : ?id:string -> ?class_:string -> node list -> node
426
-
Removed:
(** The [main] element: the content unique to this page, which the skip link
427
-
Removed:
targets. At most one per document. *)
428
-
Removed:
429
-
Removed:
val page_footer : ?class_:string -> node list -> node
430
-
Removed:
(** The [footer] element closing the page. *)
431
-
Removed:
432
-
Removed:
(** {1 Responses} *)
433
-
Removed:
434
-
Removed:
val respond : ?status:[< Dream.status ] -> node -> Dream.response Dream.promise
435
-
Removed:
(** Send a rendered document as an HTTP response. *)