@markout-lang/bootstrap-kit 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/parts/alert.htm +1 -1
- package/parts/badge.htm +1 -3
- package/parts/button.htm +5 -7
- package/parts/check.htm +9 -9
- package/parts/collapse.htm +2 -2
- package/parts/input.htm +6 -6
- package/parts/modal.htm +1 -1
- package/parts/nav.htm +1 -1
- package/parts/navbar.htm +1 -1
- package/parts/offcanvas.htm +1 -1
- package/parts/pagination.htm +4 -4
- package/parts/progress.htm +2 -2
- package/parts/scrollspy.htm +1 -1
- package/parts/table.htm +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markout-lang/bootstrap-kit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Bootstrap 5.3 as Markout components: one part per component, with the id wiring, the ARIA attributes and the repetition written once",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/parts/alert.htm
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`role="alert"` so it is announced, and the `fade show` + close button
|
|
8
8
|
combination that a dismissible one needs to animate out.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
`::heading` and the dismiss button are optional REGIONS, and both are
|
|
11
11
|
`:if`: there is something to decide, not something to show. Truthiness
|
|
12
12
|
is what is wanted of a heading — `:heading=""` is a heading nobody
|
|
13
13
|
asked for, and `:for-data`'s `!= null` would have rendered the empty
|
package/parts/badge.htm
CHANGED
package/parts/button.htm
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<!---
|
|
5
5
|
Bootstrap's button, as a real `<button>`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`::toggle`/`::target`/`::dismiss` write the `data-bs-*` triplet every
|
|
8
8
|
JS-driven component in this kit is opened and closed by, so a trigger for
|
|
9
9
|
a modal, an offcanvas or a collapse is this same tag rather than a
|
|
10
10
|
component of its own:
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
|
|
52
52
|
<!---
|
|
53
53
|
The same styling on an `<a>`, for a link that is meant to look like a
|
|
54
|
-
button. Left as it is, it is an ordinary link;
|
|
55
|
-
one, and
|
|
54
|
+
button. Left as it is, it is an ordinary link; `::button` turns it into
|
|
55
|
+
one, and `::variant` then means what it means on `bs-button`.
|
|
56
56
|
-->
|
|
57
57
|
<:define tag="bs-link:a"
|
|
58
58
|
|
|
@@ -83,12 +83,10 @@
|
|
|
83
83
|
aria-disabled=${disabled ? 'true' : null}
|
|
84
84
|
data-bs-toggle=${toggle}
|
|
85
85
|
data-bs-target=${target}
|
|
86
|
-
>
|
|
87
|
-
<:slot />
|
|
88
|
-
</:define>
|
|
86
|
+
><:slot /></:define>
|
|
89
87
|
|
|
90
88
|
<!---
|
|
91
|
-
A button group.
|
|
89
|
+
A button group. `::label` is Bootstrap's requirement, not this kit's: the
|
|
92
90
|
group needs an accessible name of its own, since the buttons inside only
|
|
93
91
|
name themselves.
|
|
94
92
|
-->
|
package/parts/check.htm
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<!---
|
|
5
5
|
Checkbox, radio and switch are one component: in Bootstrap a switch IS a
|
|
6
6
|
checkbox with `.form-switch` on the wrapper, and a radio differs only by
|
|
7
|
-
`type`.
|
|
7
|
+
`type`. `::type` picks between them.
|
|
8
8
|
|
|
9
|
-
A group of radios shares one
|
|
9
|
+
A group of radios shares one `::name`, as it does in plain HTML — that is
|
|
10
10
|
what makes them exclusive, and the kit doesn't hide it.
|
|
11
11
|
-->
|
|
12
12
|
<:define tag="bs-check:div"
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
|
|
55
55
|
<!---
|
|
56
56
|
A whole group of radios or checkboxes from one array, sharing a name and
|
|
57
|
-
reporting the selection back through
|
|
57
|
+
reporting the selection back through `::value`. Entries are strings or
|
|
58
58
|
`{ name, value, disabled }`, as in `bs-select`.
|
|
59
59
|
|
|
60
|
-
What
|
|
60
|
+
What `::value` HOLDS is decided by `::type`, because that is what the two
|
|
61
61
|
controls mean: a radio group submits one value and a checkbox group
|
|
62
62
|
submits every box that is ticked, under the same name. So a radio group's
|
|
63
|
-
|
|
63
|
+
`::value` is the selected value or `null`, and a checkbox or switch
|
|
64
64
|
group's is an ARRAY, in the order the options were given rather than the
|
|
65
65
|
order they were clicked — a summary sentence reading it should not
|
|
66
66
|
reorder itself under the reader.
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
It used to be one value either way, which made a checkbox group behave
|
|
69
69
|
like a radio group that could not make up its mind: ticking a second box
|
|
70
70
|
unticked the first, and unticking a box left it ticked. Not a shape
|
|
71
|
-
guessed from a value —
|
|
71
|
+
guessed from a value — `::type` is declared, and it is the same thing that
|
|
72
72
|
already picks the input's type and the switch class.
|
|
73
73
|
-->
|
|
74
74
|
<:define tag="bs-check-group:div"
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
:_name=${`bs-check-group-${$id}`}
|
|
88
88
|
:_legendId=${`bs-check-group-legend-${$id}`}
|
|
89
89
|
:_multi=${type !== 'radio'}
|
|
90
|
-
// a lone value read as a list of one, the way
|
|
90
|
+
// a lone value read as a list of one, the way `::options` reads a lone
|
|
91
91
|
// string as an entry: passing `:value="Slack"` to a checkbox group says
|
|
92
92
|
// something unambiguous, and spreading a string into characters is not it
|
|
93
93
|
:_selected=${!_multi ? [] : Array.isArray(value) ? value : value == null ? [] : [value]}
|
|
@@ -152,8 +152,8 @@
|
|
|
152
152
|
:_id=${`bs-range-${$id}`}
|
|
153
153
|
>
|
|
154
154
|
<!---
|
|
155
|
-
The label row, which either half can be alone in:
|
|
156
|
-
|
|
155
|
+
The label row, which either half can be alone in: `::showValue` with no
|
|
156
|
+
`::label` used to render nothing at all, since the row was gated on the
|
|
157
157
|
label.
|
|
158
158
|
|
|
159
159
|
A row rather than a `<label>` wrapping both, so the readout stays out
|
package/parts/collapse.htm
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
<!---
|
|
5
5
|
A collapsible region. The trigger is deliberately not part of it —
|
|
6
6
|
anything can open a collapse, and often several things do — so the region
|
|
7
|
-
takes a
|
|
7
|
+
takes a `::name` and a `bs-button` points at it:
|
|
8
8
|
|
|
9
9
|
<bs-button ::toggle="collapse" ::target="#details">Details</bs-button>
|
|
10
10
|
<bs-collapse ::name="details">…</bs-collapse>
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
`::horizontal` collapses width instead of height, in which case Bootstrap
|
|
13
13
|
needs the content to have a width of its own.
|
|
14
14
|
-->
|
|
15
15
|
<:define tag="bs-collapse:div"
|
package/parts/input.htm
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
A form control with its label, help text and validation state wired up
|
|
6
6
|
rather than left to the caller.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
`::value` is read AND written: the component keeps it in step with what is
|
|
9
9
|
typed, so a page can name the instance and read it from anywhere else on
|
|
10
10
|
the page —
|
|
11
11
|
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
special to forms.
|
|
17
17
|
|
|
18
18
|
The validity policy is this component's own, not Bootstrap's: a control is
|
|
19
|
-
invalid once it is non-empty and fails
|
|
20
|
-
form doesn't open covered in errors.
|
|
19
|
+
invalid once it is non-empty and fails `::check`. Empty is neutral, so a
|
|
20
|
+
form doesn't open covered in errors. `::required` extends that to empty.
|
|
21
21
|
|
|
22
22
|
`:valid` is the other side of that, and what a form's own controls read —
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
It is deliberately NOT the negation of the error state, which is the one
|
|
28
28
|
thing about it worth knowing. An untouched field is not wrong — that is
|
|
29
29
|
what keeps the form out of red — and it is also not something to submit.
|
|
30
|
-
So empty answers `false` here while showing nothing, and
|
|
30
|
+
So empty answers `false` here while showing nothing, and `::required` is
|
|
31
31
|
what makes empty an error as well as a gap.
|
|
32
32
|
|
|
33
33
|
Floating labels are the same control with the label after the input
|
|
@@ -166,8 +166,8 @@
|
|
|
166
166
|
</:define>
|
|
167
167
|
|
|
168
168
|
<!---
|
|
169
|
-
An input group: text or markup either side of a control.
|
|
170
|
-
|
|
169
|
+
An input group: text or markup either side of a control. `::prefix` and
|
|
170
|
+
`::suffix` cover the common case; anything richer goes in the slot as
|
|
171
171
|
ordinary `.input-group-text` markup.
|
|
172
172
|
-->
|
|
173
173
|
<:define tag="bs-input-group:div"
|
package/parts/modal.htm
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
optional region: a `<:slot>` can't live inside a `:for-each`, and a
|
|
14
14
|
fallback is the better answer here anyway.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
`::open` is the other way in — a value the page owns, which lets the modal
|
|
17
17
|
be driven by state rather than by a click. `:handle-open` is the door to
|
|
18
18
|
the imperative half of the DOM: `show()` and `hide()` are verbs, so no
|
|
19
19
|
amount of markup expresses them, and a handler is what runs them.
|
package/parts/nav.htm
CHANGED
package/parts/navbar.htm
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
<!---
|
|
5
5
|
Bootstrap's navbar, driven by an array of entries rather than by writing
|
|
6
|
-
`<li><a class="nav-link">` per link.
|
|
6
|
+
`<li><a class="nav-link">` per link. `::items` is this component's API, not
|
|
7
7
|
something from the Bootstrap docs — see the default below for its shape;
|
|
8
8
|
`button: true` turns an entry into a call to action.
|
|
9
9
|
|
package/parts/offcanvas.htm
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<!---
|
|
6
6
|
An offcanvas panel: the same shape as `bs-modal`, opened by a trigger
|
|
7
|
-
naming it or by the
|
|
7
|
+
naming it or by the `::open` value.
|
|
8
8
|
|
|
9
9
|
<bs-button ::toggle="offcanvas" ::target="#menu">Menu</bs-button>
|
|
10
10
|
<bs-offcanvas ::name="menu" ::title="Menu">…</bs-offcanvas>
|
package/parts/pagination.htm
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
<!---
|
|
5
5
|
Pagination driven by a page number rather than by markup: give it the
|
|
6
|
-
|
|
6
|
+
`::current` page and the total `::pages` and it works out which entry is
|
|
7
7
|
active and when the arrows are dead.
|
|
8
8
|
|
|
9
|
-
The current page is
|
|
9
|
+
The current page is `::current` rather than `:page`, because `page` is
|
|
10
10
|
already the name of `<html>`'s own scope — a parameter of that name would
|
|
11
11
|
resolve to the scope instead of to the number.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
`::link` and `::select` are the two ways to answer "what does a click do".
|
|
14
|
+
`::link` builds an href per page for a server-rendered list; `::select` is
|
|
15
15
|
called with the page number for one that stays on the page. Both are
|
|
16
16
|
ordinary function parameters — a callback the component calls, not a DOM
|
|
17
17
|
event, so it is a value and not an `:on-` handler.
|
package/parts/progress.htm
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<!---
|
|
5
5
|
Bootstrap 5.3 moved the ARIA onto the outer `.progress` and left
|
|
6
6
|
`.progress-bar` as the visual fill, so a progress bar is two elements
|
|
7
|
-
whose values have to agree. Here they are derived from one
|
|
7
|
+
whose values have to agree. Here they are derived from one `::value`.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`::label` is the text drawn inside the bar; leave it off for a bare bar.
|
|
10
10
|
-->
|
|
11
11
|
<:define tag="bs-progress:div"
|
|
12
12
|
class="progress"
|
package/parts/scrollspy.htm
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
<!---
|
|
5
5
|
Scrollspy is behaviour rather than appearance: it marks the entry in a
|
|
6
|
-
nav that matches what is currently on screen.
|
|
6
|
+
nav that matches what is currently on screen. `::target` is the selector
|
|
7
7
|
of that nav, and the element this sits on is the thing being scrolled.
|
|
8
8
|
|
|
9
9
|
<bs-nav ::vertical id="toc" ::items=${sections} />
|
package/parts/table.htm
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
<:import src="base.htm" />
|
|
3
3
|
|
|
4
4
|
<!---
|
|
5
|
-
A table from
|
|
5
|
+
A table from `::columns` and `::rows`.
|
|
6
6
|
|
|
7
7
|
A column is `{ key, name, class }`; a row is any object the columns can
|
|
8
8
|
be read out of. That is the one place in this kit where markup is
|
|
9
9
|
generated from data twice over — once per column, once per row — and it
|
|
10
10
|
is the case where writing it by hand hurts most.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
`::responsive` is a class on the same element rather than an extra
|
|
13
13
|
wrapper: `.table-responsive` only sets `overflow-x`, so it costs nothing
|
|
14
14
|
when off.
|
|
15
15
|
-->
|