@webtides/element-library 0.3.0 → 0.4.0
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/CHANGELOG.md +208 -0
- package/README.md +72 -56
- package/all.js +16 -0
- package/catalog.js +17 -1
- package/custom-elements.json +14731 -10193
- package/package.json +1 -1
- package/src/components/accordion/accordion.changelog.md +11 -0
- package/src/components/accordion/accordion.js +15 -3
- package/src/components/accordion/accordion.readme.md +27 -1
- package/src/components/accordion/accordion.style.js +19 -0
- package/src/components/app-bar/app-bar.changelog.md +24 -0
- package/src/components/app-bar/app-bar.define.js +3 -0
- package/src/components/app-bar/app-bar.js +91 -0
- package/src/components/app-bar/app-bar.readme.md +130 -0
- package/src/components/app-bar/app-bar.style.js +103 -0
- package/src/components/app-frame/app-frame.changelog.md +45 -0
- package/src/components/app-frame/app-frame.define.js +3 -0
- package/src/components/app-frame/app-frame.events.js +6 -0
- package/src/components/app-frame/app-frame.js +1073 -0
- package/src/components/app-frame/app-frame.readme.md +416 -0
- package/src/components/app-frame/app-frame.style.js +527 -0
- package/src/components/button/button.changelog.md +25 -0
- package/src/components/button/button.events.js +3 -0
- package/src/components/button/button.js +209 -14
- package/src/components/button/button.readme.md +82 -6
- package/src/components/button/button.style.js +161 -7
- package/src/components/checkbox-field/checkbox-field.changelog.md +6 -0
- package/src/components/checkbox-field/checkbox-field.js +7 -1
- package/src/components/description-list/description-list.changelog.md +25 -0
- package/src/components/description-list/description-list.define.js +3 -0
- package/src/components/description-list/description-list.js +44 -0
- package/src/components/description-list/description-list.readme.md +135 -0
- package/src/components/description-list/description-list.style.js +140 -0
- package/src/components/dialog/dialog.changelog.md +7 -0
- package/src/components/dialog/dialog.readme.md +5 -0
- package/src/components/dialog/dialog.style.js +17 -2
- package/src/components/drawer/drawer.changelog.md +7 -0
- package/src/components/drawer/drawer.readme.md +7 -6
- package/src/components/drawer/drawer.style.js +35 -2
- package/src/components/dropdown/dropdown.readme.md +6 -1
- package/src/components/list/list.changelog.md +24 -0
- package/src/components/list/list.define.js +3 -0
- package/src/components/list/list.js +66 -0
- package/src/components/list/list.readme.md +122 -0
- package/src/components/list/list.style.js +56 -0
- package/src/components/list-item/list-item.changelog.md +24 -0
- package/src/components/list-item/list-item.define.js +3 -0
- package/src/components/list-item/list-item.js +128 -0
- package/src/components/list-item/list-item.readme.md +126 -0
- package/src/components/list-item/list-item.style.js +234 -0
- package/src/components/menu/menu.changelog.md +27 -0
- package/src/components/menu/menu.define.js +3 -0
- package/src/components/menu/menu.events.js +5 -0
- package/src/components/menu/menu.js +570 -0
- package/src/components/menu/menu.readme.md +272 -0
- package/src/components/menu/menu.style.js +55 -0
- package/src/components/menu-group/menu-group.changelog.md +20 -0
- package/src/components/menu-group/menu-group.define.js +3 -0
- package/src/components/menu-group/menu-group.js +44 -0
- package/src/components/menu-group/menu-group.readme.md +74 -0
- package/src/components/menu-group/menu-group.style.js +38 -0
- package/src/components/menu-item/menu-item.changelog.md +24 -0
- package/src/components/menu-item/menu-item.define.js +3 -0
- package/src/components/menu-item/menu-item.js +130 -0
- package/src/components/menu-item/menu-item.readme.md +94 -0
- package/src/components/menu-item/menu-item.style.js +87 -0
- package/src/components/nav/nav.changelog.md +35 -0
- package/src/components/nav/nav.define.js +3 -0
- package/src/components/nav/nav.js +212 -0
- package/src/components/nav/nav.readme.md +248 -0
- package/src/components/nav/nav.style.js +269 -0
- package/src/components/nav-item/nav-item.changelog.md +25 -0
- package/src/components/nav-item/nav-item.define.js +3 -0
- package/src/components/nav-item/nav-item.js +75 -0
- package/src/components/nav-item/nav-item.readme.md +111 -0
- package/src/components/nav-item/nav-item.style.js +159 -0
- package/src/components/pagination/pagination.changelog.md +8 -0
- package/src/components/pagination/pagination.js +123 -49
- package/src/components/pagination/pagination.readme.md +24 -6
- package/src/components/pagination/pagination.style.js +11 -1
- package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
- package/src/components/scroll-to-top/scroll-to-top.js +16 -12
- package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
- package/src/components/segmented-field/segmented-field.changelog.md +27 -0
- package/src/components/segmented-field/segmented-field.define.js +3 -0
- package/src/components/segmented-field/segmented-field.js +175 -0
- package/src/components/segmented-field/segmented-field.readme.md +140 -0
- package/src/components/segmented-field/segmented-field.style.js +193 -0
- package/src/components/splitter/splitter.changelog.md +24 -0
- package/src/components/splitter/splitter.define.js +3 -0
- package/src/components/splitter/splitter.events.js +4 -0
- package/src/components/splitter/splitter.js +237 -0
- package/src/components/splitter/splitter.readme.md +164 -0
- package/src/components/splitter/splitter.style.js +100 -0
- package/src/components/status-bar/status-bar.changelog.md +25 -0
- package/src/components/status-bar/status-bar.define.js +3 -0
- package/src/components/status-bar/status-bar.js +74 -0
- package/src/components/status-bar/status-bar.readme.md +139 -0
- package/src/components/status-bar/status-bar.style.js +122 -0
- package/src/components/switch-field/switch-field.changelog.md +6 -0
- package/src/components/switch-field/switch-field.js +7 -1
- package/src/components/tab-group/tab-group.changelog.md +7 -0
- package/src/components/tab-group/tab-group.js +30 -9
- package/src/components/tab-group/tab-group.readme.md +14 -0
- package/src/components/toast/toast.changelog.md +6 -0
- package/src/components/toast/toast.readme.md +5 -3
- package/src/components/toast/toast.style.js +22 -6
- package/src/components/toolbar/toolbar.changelog.md +24 -0
- package/src/components/toolbar/toolbar.define.js +3 -0
- package/src/components/toolbar/toolbar.js +233 -0
- package/src/components/toolbar/toolbar.readme.md +156 -0
- package/src/components/toolbar/toolbar.style.js +49 -0
- package/src/components/tooltip/tooltip.changelog.md +11 -0
- package/src/components/tooltip/tooltip.js +51 -4
- package/src/components/tooltip/tooltip.readme.md +26 -1
- package/src/components/tree/tree.changelog.md +23 -0
- package/src/components/tree/tree.define.js +3 -0
- package/src/components/tree/tree.js +138 -0
- package/src/components/tree/tree.readme.md +119 -0
- package/src/components/tree/tree.style.js +16 -0
- package/src/components/tree-item/tree-item.changelog.md +23 -0
- package/src/components/tree-item/tree-item.define.js +3 -0
- package/src/components/tree-item/tree-item.events.js +3 -0
- package/src/components/tree-item/tree-item.js +246 -0
- package/src/components/tree-item/tree-item.readme.md +128 -0
- package/src/components/tree-item/tree-item.style.js +226 -0
- package/src/styles/appearance.style.js +47 -0
- package/src/styles/choice-group.style.js +1 -1
- package/src/styles/modal.style.js +14 -1
- package/src/styles/size.style.js +41 -0
- package/src/utils/focus.js +69 -0
- package/src/utils/scroll.js +24 -0
- package/types/all.d.ts +16 -0
- package/types/src/components/accordion/accordion.d.ts +3 -1
- package/types/src/components/app-bar/app-bar.d.ts +43 -0
- package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
- package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
- package/types/src/components/app-frame/app-frame.d.ts +491 -0
- package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
- package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
- package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
- package/types/src/components/button/button.d.ts +97 -7
- package/types/src/components/button/button.events.d.ts +4 -0
- package/types/src/components/description-list/description-list.d.ts +29 -0
- package/types/src/components/description-list/description-list.define.d.ts +1 -0
- package/types/src/components/description-list/description-list.style.d.ts +2 -0
- package/types/src/components/list/list.d.ts +39 -0
- package/types/src/components/list/list.define.d.ts +1 -0
- package/types/src/components/list/list.style.d.ts +2 -0
- package/types/src/components/list-item/list-item.d.ts +62 -0
- package/types/src/components/list-item/list-item.define.d.ts +1 -0
- package/types/src/components/list-item/list-item.style.d.ts +2 -0
- package/types/src/components/menu/menu.d.ts +266 -0
- package/types/src/components/menu/menu.define.d.ts +1 -0
- package/types/src/components/menu/menu.events.d.ts +6 -0
- package/types/src/components/menu/menu.style.d.ts +2 -0
- package/types/src/components/menu-group/menu-group.d.ts +24 -0
- package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
- package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
- package/types/src/components/menu-item/menu-item.d.ts +59 -0
- package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
- package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
- package/types/src/components/nav/nav.d.ts +103 -0
- package/types/src/components/nav/nav.define.d.ts +1 -0
- package/types/src/components/nav/nav.style.d.ts +2 -0
- package/types/src/components/nav-item/nav-item.d.ts +39 -0
- package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
- package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
- package/types/src/components/pagination/pagination.d.ts +31 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
- package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
- package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
- package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
- package/types/src/components/splitter/splitter.d.ts +127 -0
- package/types/src/components/splitter/splitter.define.d.ts +1 -0
- package/types/src/components/splitter/splitter.events.d.ts +5 -0
- package/types/src/components/splitter/splitter.style.d.ts +2 -0
- package/types/src/components/status-bar/status-bar.d.ts +44 -0
- package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
- package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
- package/types/src/components/tab-group/tab-group.d.ts +17 -0
- package/types/src/components/toolbar/toolbar.d.ts +96 -0
- package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
- package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +26 -0
- package/types/src/components/tree/tree.d.ts +62 -0
- package/types/src/components/tree/tree.define.d.ts +1 -0
- package/types/src/components/tree/tree.style.d.ts +2 -0
- package/types/src/components/tree-item/tree-item.d.ts +106 -0
- package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
- package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
- package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
- package/types/src/styles/appearance.style.d.ts +31 -0
- package/types/src/styles/choice-group.style.d.ts +1 -1
- package/types/src/styles/modal.style.d.ts +5 -0
- package/types/src/styles/size.style.d.ts +24 -0
- package/types/src/utils/focus.d.ts +25 -0
- package/types/src/utils/scroll.d.ts +11 -0
- package/web-types.json +2530 -393
package/package.json
CHANGED
|
@@ -12,6 +12,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.4.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Where scripting is off, a server-rendered accordion without `open="true"` is closed and cannot be opened; it was open before, because nothing had collapsed it. The readme has a rule for a page that wants the content readable there (`@media (scripting: none)` and the `content` part). ([#187](https://github.com/webtides/element-library/issues/187))
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- A closed accordion that was rendered on the server shows its header alone from the first paint. The markup of the server had the content as it is while open, the browser painted it, and the element took it away once it started: everything below the accordion jumped up with every page load, and where scripting is off the accordion was open. The stylesheet of the element now collapses the content unless the host has `open="true"`, which holds before the element starts. An accordion with `open="true"` is server-rendered open, with the line under its header and the turned chevron, and stays that way. ([#187](https://github.com/webtides/element-library/issues/187))
|
|
24
|
+
- A closed accordion that is rendered in the browser starts closed. It was rendered open and collapsed with the transition, in front of the user and with the content below it moving. ([#187](https://github.com/webtides/element-library/issues/187))
|
|
25
|
+
|
|
15
26
|
## [0.3.0] - 2026-11-17
|
|
16
27
|
|
|
17
28
|
### Changed
|
|
@@ -24,7 +24,9 @@ import Events from './accordion.events.js';
|
|
|
24
24
|
* `el-accordion:state(open)` from outside.
|
|
25
25
|
*
|
|
26
26
|
* @property {boolean} open - Controls whether the accordion is expanded (`true`) or collapsed
|
|
27
|
-
* (`false`). Reflected to the `open` attribute.
|
|
27
|
+
* (`false`). Reflected to the `open` attribute. The stylesheet of the element reads that
|
|
28
|
+
* attribute: an accordion without `open="true"` shows its header alone, before the element
|
|
29
|
+
* starts as well.
|
|
28
30
|
*/
|
|
29
31
|
export default class Accordion extends TemplateElement {
|
|
30
32
|
constructor() {
|
|
@@ -32,8 +34,18 @@ export default class Accordion extends TemplateElement {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
connected() {
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
+
if (this.open) {
|
|
38
|
+
this._internals.states.add('open');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// A closed accordion has no height from its stylesheet, which reads the `open` attribute of
|
|
43
|
+
// the host: that holds before the element starts, in markup a server rendered as well. The
|
|
44
|
+
// same height on the content itself is where the first transition starts from. It changes
|
|
45
|
+
// nothing that is painted, so nothing below the accordion moves.
|
|
46
|
+
const content = this.$refs.content;
|
|
47
|
+
content.style.height = '0px';
|
|
48
|
+
content.setAttribute('data-collapsed', 'true');
|
|
37
49
|
}
|
|
38
50
|
|
|
39
51
|
properties() {
|
|
@@ -29,7 +29,7 @@ import '@webtides/element-library/accordion/define';
|
|
|
29
29
|
|
|
30
30
|
| Name | Type | Default | Description |
|
|
31
31
|
| --- | --- | --- | --- |
|
|
32
|
-
| `open` | `boolean` | `false` | Controls whether the accordion is expanded (true) or collapsed (false). This property is reflected to the element's attribute. |
|
|
32
|
+
| `open` | `boolean` | `false` | Controls whether the accordion is expanded (true) or collapsed (false). This property is reflected to the element's attribute, and the stylesheet of the element reads that attribute: without `open="true"` the content is collapsed, before the element starts as well. |
|
|
33
33
|
|
|
34
34
|
#### Methods
|
|
35
35
|
|
|
@@ -71,3 +71,29 @@ On a touch screen (`@media (any-pointer: coarse)`) the header is at least `--el-
|
|
|
71
71
|
| --------- | ------------------------------------------------------------------------------------------------ |
|
|
72
72
|
| `header` | Content to display in the accordion header/title area. Clicking this area toggles the accordion. |
|
|
73
73
|
| `content` | Content to display in the collapsible section of the accordion. |
|
|
74
|
+
|
|
75
|
+
## Server-side rendering
|
|
76
|
+
|
|
77
|
+
An accordion that is rendered on the server (as Declarative Shadow DOM, for example with [`@webtides/element-js-ssr-renderer`](https://github.com/webtides/element-js-ssr-renderer)) is painted the way it will be once the element runs:
|
|
78
|
+
|
|
79
|
+
- Without `open`, or with `open="false"`, it shows its header alone. The stylesheet of the element collapses the content unless the host has `open="true"`, and the attribute of the host is in the markup of the server.
|
|
80
|
+
- With `open="true"` it is open, with the line under its header and the turned chevron.
|
|
81
|
+
|
|
82
|
+
Nothing is painted that goes away again, and nothing below the accordion moves when the element takes over. The same holds for an accordion that is rendered in the browser: a closed one starts closed, it is not collapsed in front of the user.
|
|
83
|
+
|
|
84
|
+
Write `open="true"`, not a bare `open`: element-js reads a bare attribute as not set.
|
|
85
|
+
|
|
86
|
+
## Where scripting is off
|
|
87
|
+
|
|
88
|
+
- A server-rendered accordion stays as it was rendered. A closed one shows its header, and the header does nothing: its content cannot be reached. An open one stays open and cannot be closed.
|
|
89
|
+
- An accordion that is not server-rendered has no shadow root there. The browser shows what the page wrote, the header and the content one below the other.
|
|
90
|
+
|
|
91
|
+
A page that wants the content of its server-rendered accordions to be readable without scripting opens them itself. A rule of the page for the `content` part wins over the rule of the element:
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
@media (scripting: none) {
|
|
95
|
+
el-accordion::part(content) {
|
|
96
|
+
height: auto;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
@@ -23,6 +23,13 @@ export default css`
|
|
|
23
23
|
border-bottom: var(--el-border-width, 0) solid transparent;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/* The open attribute of the host says the same as the state, and is there before the element starts: an
|
|
27
|
+
accordion that a server rendered open looks the same before and after. The two are rules of
|
|
28
|
+
their own, so a browser that does not know one of the selectors keeps the other. */
|
|
29
|
+
:host([open='true']) [part~='title'] {
|
|
30
|
+
border-bottom-color: var(--el-color-border, transparent);
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
:host(:state(open)) [part~='title'] {
|
|
27
34
|
border-bottom-color: var(--el-color-border, transparent);
|
|
28
35
|
}
|
|
@@ -55,6 +62,10 @@ export default css`
|
|
|
55
62
|
display: none;
|
|
56
63
|
}
|
|
57
64
|
|
|
65
|
+
:host([open='true']) .icon {
|
|
66
|
+
transform: rotate(180deg);
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
:host(:state(open)) .icon {
|
|
59
70
|
transform: rotate(180deg);
|
|
60
71
|
}
|
|
@@ -65,6 +76,14 @@ export default css`
|
|
|
65
76
|
height: auto;
|
|
66
77
|
}
|
|
67
78
|
|
|
79
|
+
/* Closed unless the host is open. The rule reads the attribute of the host, which is all there
|
|
80
|
+
is before the element starts: a closed accordion that a server rendered shows its header
|
|
81
|
+
alone from the first paint. Once the element runs, it sets the height on the content itself
|
|
82
|
+
for the transition, and that height wins over this rule. */
|
|
83
|
+
:host(:not([open='true'])) .content {
|
|
84
|
+
height: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
/* Padding lives on the inner wrapper so collapsing .content to height:0 clips it too. */
|
|
69
88
|
.content-inner {
|
|
70
89
|
padding: var(--el-space-3, 0) var(--el-space-3, 0);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.4.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial `el-app-bar`: the bar at the top of a view, with a start (a button back, or the one for the navigation), a title and an end (the actions). Start and end follow the reading direction, and a region the page leaves empty takes no room. ([#178](https://github.com/webtides/element-library/issues/178))
|
|
20
|
+
- The title is one line: what does not fit is cut with an ellipsis, and never pushes the actions out. The whole title stays in the page for assistive technology. `heading-level` (1 to 6) makes it the heading of the view; unset, it is text.
|
|
21
|
+
- The buttons of the bar are plain while they have no appearance of their own; `appearance` names another one. The bar does not write to its buttons: it says the appearance in CSS properties that are inherited.
|
|
22
|
+
- In the header of an `el-app-frame` the surface of the bar reaches as far as the surface of the region: under the status bar and the notch of a phone and to the sides of the screen, while its content stays clear of them. The line to the content is the one of the region there.
|
|
23
|
+
- As high as a control and its padding, with and without a button, and at least `--el-touch-target` high on a touch screen.
|
|
24
|
+
- A surface from `--el-color-bg` and a line to the content from `--el-color-border` and `--el-border-width`. The line is a border, which stays where the user forces colours and is there without a theme then. The bar is no landmark and has no role.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { TemplateElement, defineElement, html } from '@webtides/element-js';
|
|
2
|
+
import { hasSlotted } from '../../utils/slots.js';
|
|
3
|
+
import style from './app-bar.style.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The bar at the top of a view: which view this is, a way back or to the navigation at its start,
|
|
7
|
+
* and a few actions at its end. One row: a title that does not fit is cut with an ellipsis and
|
|
8
|
+
* never pushes the actions out.
|
|
9
|
+
*
|
|
10
|
+
* In the header of an `el-app-frame` the surface of the bar reaches up under the status bar of a
|
|
11
|
+
* phone, and its content stays below it. The bar is no landmark: the `header` of the page is.
|
|
12
|
+
*
|
|
13
|
+
* The look is the stylesheet alone, so a server-rendered bar does not change when the element
|
|
14
|
+
* takes over.
|
|
15
|
+
*
|
|
16
|
+
* @element el-app-bar
|
|
17
|
+
*
|
|
18
|
+
* @slot - The title of the view.
|
|
19
|
+
* @slot start - What is in front of the title: a button back, or the one for the navigation.
|
|
20
|
+
* @slot end - The actions of the view, at the end of the bar.
|
|
21
|
+
*
|
|
22
|
+
* @csspart base - The bar: its surface and the line to the content.
|
|
23
|
+
* @csspart row - The row of the start, the title and the end.
|
|
24
|
+
* @csspart start - The region in front of the title.
|
|
25
|
+
* @csspart title - The title. A heading while `heading-level` is set.
|
|
26
|
+
* @csspart end - The region at the end.
|
|
27
|
+
*
|
|
28
|
+
* @property {number} headingLevel - Makes the title the heading of the view, at this level
|
|
29
|
+
* (1 to 6). Unset, the title is text. Default `0`.
|
|
30
|
+
* @property {'filled'|'outlined'|'plain'} appearance - The appearance of the buttons in the bar
|
|
31
|
+
* that have none of their own. Default `'plain'`. Reflected to the `appearance` attribute.
|
|
32
|
+
*/
|
|
33
|
+
export default class AppBar extends TemplateElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super({
|
|
36
|
+
styles: [style],
|
|
37
|
+
shadowRender: true,
|
|
38
|
+
// The stylesheet selects the host by this attribute.
|
|
39
|
+
propertyOptions: { appearance: { reflect: true } },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
properties() {
|
|
44
|
+
return {
|
|
45
|
+
headingLevel: 0,
|
|
46
|
+
appearance: 'plain',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
events() {
|
|
51
|
+
return {
|
|
52
|
+
// A template element does not render again when a child comes, goes or changes its
|
|
53
|
+
// `slot` attribute. The slot tells of all three, and the event bubbles to the base.
|
|
54
|
+
"[part~='base']": {
|
|
55
|
+
slotchange: () => this.requestUpdate(),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
template() {
|
|
61
|
+
// A plain binding leaves an attribute out while its value is null, on a server as well, and
|
|
62
|
+
// takes it off again when the level goes.
|
|
63
|
+
const level = Number(this.headingLevel);
|
|
64
|
+
const isHeading = level >= 1 && level <= 6;
|
|
65
|
+
|
|
66
|
+
return html`
|
|
67
|
+
<div part="base" class="bar">
|
|
68
|
+
<div part="row" class="row">
|
|
69
|
+
<div part="start" class="start" ?hidden="${!hasSlotted(this, 'start')}">
|
|
70
|
+
<slot name="start"></slot>
|
|
71
|
+
</div>
|
|
72
|
+
<div
|
|
73
|
+
part="title"
|
|
74
|
+
class="title"
|
|
75
|
+
role="${isHeading ? 'heading' : null}"
|
|
76
|
+
aria-level="${isHeading ? level : null}"
|
|
77
|
+
>
|
|
78
|
+
<slot></slot>
|
|
79
|
+
</div>
|
|
80
|
+
<div part="end" class="end" ?hidden="${!hasSlotted(this, 'end')}">
|
|
81
|
+
<slot name="end"></slot>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function define() {
|
|
90
|
+
defineElement('el-app-bar', AppBar);
|
|
91
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# App Bar
|
|
2
|
+
|
|
3
|
+
`app-bar` is the bar at the top of a view: which view this is, a way back or to the navigation at its start, and a few actions at its end. It has one row: a title that does not fit is cut, and never pushes the actions out. In the header of an [`el-app-frame`](../app-frame/app-frame.readme.md) its surface reaches up under the status bar of a phone.
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
#### Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i --save @webtides/element-library
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### Use
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import '@webtides/element-library/app-bar/define';
|
|
17
|
+
import '@webtides/element-library/button/define';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<el-app-bar heading-level="1">
|
|
22
|
+
<el-button slot="start" circle="true" aria-label="Back" href="/tasks"><svg aria-hidden="true">…</svg></el-button>
|
|
23
|
+
Answer the questions about the invoice
|
|
24
|
+
<el-button slot="end" circle="true" aria-label="Search"><svg aria-hidden="true">…</svg></el-button>
|
|
25
|
+
<el-button slot="end" circle="true" aria-label="More"><svg aria-hidden="true">…</svg></el-button>
|
|
26
|
+
</el-app-bar>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> Boolean attributes are passed as strings (`circle="true"`), matching the rest of the library.
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
#### Properties/Attributes
|
|
34
|
+
|
|
35
|
+
| Name | Type | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `heading-level` | `number` | `0` | Makes the title the heading of the view, at this level (1 to 6). Unset, the title is text. |
|
|
38
|
+
| `appearance` | `'filled' \| 'outlined' \| 'plain'` | `'plain'` | The appearance of the buttons in the bar that have none of their own. Reflected to the `appearance` attribute. |
|
|
39
|
+
|
|
40
|
+
#### Methods
|
|
41
|
+
|
|
42
|
+
_None._
|
|
43
|
+
|
|
44
|
+
#### Events
|
|
45
|
+
|
|
46
|
+
_None._
|
|
47
|
+
|
|
48
|
+
#### Slots
|
|
49
|
+
|
|
50
|
+
| Name | Description |
|
|
51
|
+
| --------- | ---------------------------------------------------------------------------- |
|
|
52
|
+
| (default) | The title of the view. |
|
|
53
|
+
| `start` | What is in front of the title: a button back, or the one for the navigation. |
|
|
54
|
+
| `end` | The actions of the view, at the end of the bar. |
|
|
55
|
+
|
|
56
|
+
#### CSS Parts
|
|
57
|
+
|
|
58
|
+
| Name | Description |
|
|
59
|
+
| ------- | -------------------------------------------------- |
|
|
60
|
+
| `base` | The bar: its surface and the line to the content. |
|
|
61
|
+
| `row` | The row of the start, the title and the end. |
|
|
62
|
+
| `start` | The region in front of the title. |
|
|
63
|
+
| `title` | The title. A heading while `heading-level` is set. |
|
|
64
|
+
| `end` | The region at the end. |
|
|
65
|
+
|
|
66
|
+
#### CSS Custom Properties
|
|
67
|
+
|
|
68
|
+
Reads `--el-color-bg` and `--el-color-fg` for its surface and its text, `--el-color-border` and `--el-border-width` for the line to the content, `--el-control-height` and `--el-space-2` for its height, `--el-space-1`, `--el-space-2` and `--el-space-3` for its gaps and its padding, `--el-font-size-lg` and `--el-font-weight-semibold` for the title, and `--el-touch-target` on a touch screen.
|
|
69
|
+
|
|
70
|
+
## The title
|
|
71
|
+
|
|
72
|
+
The title is what the page writes into the bar. It is one line: what does not fit is cut with an ellipsis, and the actions at the end keep their place. The whole title stays in the page, so assistive technology reads all of it.
|
|
73
|
+
|
|
74
|
+
`heading-level` makes the title the heading of the view. A view has one `h1` as a rule, and the title of its bar is that heading:
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<el-app-bar heading-level="1">Inbox</el-app-bar>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Without the attribute the title is text. That is right for a bar whose view has its heading in the content. A heading the page writes itself (`<el-app-bar><h1>Inbox</h1></el-app-bar>`) is cut the same way, and has the size of the title.
|
|
81
|
+
|
|
82
|
+
## The start and the end
|
|
83
|
+
|
|
84
|
+
- `start` is one button as a rule: back to the view above, or the button that opens the navigation.
|
|
85
|
+
- `end` holds a few actions. A button with an icon alone is an `el-button` with `circle="true"` and an `aria-label`, which is its name.
|
|
86
|
+
- A region the page leaves empty takes no room. Start and end follow the reading direction.
|
|
87
|
+
|
|
88
|
+
The buttons of a bar are plain while they have no appearance of their own, as in an [`el-toolbar`](../toolbar/toolbar.readme.md): the bar says its `appearance` in CSS properties that are inherited, and writes nothing onto the buttons. A button that names its own keeps it (`appearance="filled"` for the one action that stands out).
|
|
89
|
+
|
|
90
|
+
The bar does not move actions that do not fit into a menu. Keep to the few a phone has room for.
|
|
91
|
+
|
|
92
|
+
## In the frame of an application
|
|
93
|
+
|
|
94
|
+
In the header of an [`el-app-frame`](../app-frame/app-frame.readme.md) the bar draws its surface as far as the surface of the region reaches: under the status bar and the notch of a phone, and to the sides of the screen. Its content stays clear of them. The region says how far that is, so the bar needs nothing from the page:
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<el-app-frame>
|
|
98
|
+
<header slot="header">
|
|
99
|
+
<el-app-bar heading-level="1">Inbox</el-app-bar>
|
|
100
|
+
</header>
|
|
101
|
+
<main id="main">…</main>
|
|
102
|
+
</el-app-frame>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- The bar is no landmark. The `header` around it is the banner of the page.
|
|
106
|
+
- The line to the content is the one of the region there, and the bar leaves its own out.
|
|
107
|
+
- A colour of its own goes on the part, and reaches under the status bar with it:
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
el-app-bar::part(base) {
|
|
111
|
+
background: var(--el-color-bg-muted);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Outside of a frame the bar is as large as its element. A page that reaches under the notch without a frame keeps the bar clear of it itself.
|
|
116
|
+
|
|
117
|
+
## On a touch screen
|
|
118
|
+
|
|
119
|
+
The bar is at least `--el-touch-target` high where the pointer is a finger (`@media (any-pointer: coarse)`), and an `el-button` in it is at least that wide and high. Without the token nothing changes.
|
|
120
|
+
|
|
121
|
+
## Server-side rendering
|
|
122
|
+
|
|
123
|
+
The bar renders on a server with `@webtides/element-js-ssr-renderer`. Its look is its stylesheet: the row, the cut title, the heading and the surface in a frame are there before the script has run, and nothing moves when the element takes over.
|
|
124
|
+
|
|
125
|
+
## Accessibility
|
|
126
|
+
|
|
127
|
+
- The title is a heading with `heading-level` (`role="heading"` with the level), and text without it.
|
|
128
|
+
- The bar has no role and no name of its own. It is a row in the header of the page.
|
|
129
|
+
- Every button with an icon alone needs a name (`aria-label`).
|
|
130
|
+
- Without a theme the bar paints nothing and reads as the page does, in a light and in a dark scheme. The line to the content is a border: it stays where the user forces colours, and it is there without a theme then.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import hostStyle from '../../styles/host.style.js';
|
|
2
|
+
import { appearanceContextStyle } from '../../styles/appearance.style.js';
|
|
3
|
+
|
|
4
|
+
const css = String.raw;
|
|
5
|
+
|
|
6
|
+
const style = css`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
/* A line to the content, which the region of a frame draws itself where the bar is in one.
|
|
10
|
+
Where the user forces colours it is there without a theme as well. */
|
|
11
|
+
--_el-app-bar-line-width: var(--el-border-width, 0px);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (forced-colors: active) {
|
|
15
|
+
:host {
|
|
16
|
+
--_el-app-bar-line-width: max(var(--el-border-width, 0px), 1px);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* The surface. In a region of an el-app-frame it reaches as far as the surface of the region:
|
|
22
|
+
* under the status bar of a phone and to the sides of the screen. The region says how far, and
|
|
23
|
+
* that room is padding here, so the content of the bar stays clear of it. Outside of a frame
|
|
24
|
+
* the room is nothing.
|
|
25
|
+
*
|
|
26
|
+
* The margins are on the bar and not on the element: a reset of the page (margin: 0 for
|
|
27
|
+
* everything) wins over a rule for the host, and the bar would have the room twice.
|
|
28
|
+
*/
|
|
29
|
+
.bar {
|
|
30
|
+
margin-block: calc(-1 * var(--_el-context-inset-block-start, 0px))
|
|
31
|
+
calc(-1 * var(--_el-context-inset-block-end, 0px));
|
|
32
|
+
margin-inline: calc(-1 * var(--_el-context-inset-inline-start, 0px))
|
|
33
|
+
calc(-1 * var(--_el-context-inset-inline-end, 0px));
|
|
34
|
+
padding-block: var(--_el-context-inset-block-start, 0px) var(--_el-context-inset-block-end, 0px);
|
|
35
|
+
padding-inline: var(--_el-context-inset-inline-start, 0px) var(--_el-context-inset-inline-end, 0px);
|
|
36
|
+
background: var(--el-color-bg, transparent);
|
|
37
|
+
color: var(--el-color-fg, inherit);
|
|
38
|
+
border-block-end: var(--_el-context-line-block-end, var(--_el-app-bar-line-width)) solid
|
|
39
|
+
var(--el-color-border, transparent);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* One row, as high as a control and its padding: a bar with a button and a bar without one
|
|
43
|
+
are the same height. */
|
|
44
|
+
.row {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: var(--el-space-2, 0.5rem);
|
|
48
|
+
min-block-size: calc(var(--el-control-height, 2.5rem) + 2 * var(--el-space-2, 0.5rem));
|
|
49
|
+
padding: var(--el-space-2, 0.5rem) var(--el-space-3, 0.75rem);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* On a touch screen the bar is at least as high as a finger needs. Without the token it stays
|
|
53
|
+
as it is. */
|
|
54
|
+
@media (any-pointer: coarse) {
|
|
55
|
+
.row {
|
|
56
|
+
min-block-size: max(
|
|
57
|
+
calc(var(--el-control-height, 2.5rem) + 2 * var(--el-space-2, 0.5rem)),
|
|
58
|
+
var(--el-touch-target, 0px)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.start,
|
|
64
|
+
.end {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex: none;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: var(--el-space-1, 0.25rem);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* The title takes the room that is left, and gives it up before the actions do: what does not
|
|
72
|
+
fit is cut with an ellipsis. The whole text stays in the page, for assistive technology. */
|
|
73
|
+
.title {
|
|
74
|
+
flex: 1 1 auto;
|
|
75
|
+
min-inline-size: 0;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
font-size: var(--el-font-size-lg, 1.125rem);
|
|
80
|
+
font-weight: var(--el-font-weight-semibold, 600);
|
|
81
|
+
line-height: 1.2;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Without something in front of it, the title starts a little further in: where the text of
|
|
85
|
+
the content below it starts as a rule. */
|
|
86
|
+
.start[hidden] + .title {
|
|
87
|
+
padding-inline-start: var(--el-space-1, 0.25rem);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* An element the page writes as the title, a heading of its own for example, is cut the same
|
|
91
|
+
way and brings no margin and no size. A rule of the page for the element wins over this. */
|
|
92
|
+
::slotted(:not([slot])) {
|
|
93
|
+
display: block;
|
|
94
|
+
margin: 0;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
font: inherit;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
// Plain is the appearance of the buttons in a bar that names none.
|
|
103
|
+
export default [hostStyle(), appearanceContextStyle(':host', 'plain'), style].join('\n');
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.4.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial `el-app-frame`: the frame of an application. It fills what the browser shows and lays out five regions, a header, a footer, a navigation at the start side, an aside at the end side, and the content. A region the page leaves empty takes no room, and start and end follow the reading direction. ([#176](https://github.com/webtides/element-library/issues/176))
|
|
20
|
+
- The frame is fixed to the edges of the viewport, which move with the address bar of a phone: it is as high as what the browser shows, and no higher. The content scrolls between the header and the footer, which stay in view. The window does not scroll in a frame; `scroller` is the element that does, for a page that sets the scroll back after a change of the view.
|
|
21
|
+
- Narrow and wide by its own width: from the width `wide-from` names (`30rem`, `40rem`, `48rem` by default, `64rem` or `80rem`) the navigation and the aside are columns beside the content, and each scrolls on its own. Below it the content and the aside are one column that scrolls, and the navigation is a drawer. The stylesheet decides, with a container query per step, so a server-rendered frame has its layout before the script has run. `wide` reads what the stylesheet has decided.
|
|
22
|
+
- `--el-app-frame-navigation-size` (`16rem`) and `--el-app-frame-aside-size` (`20rem`) are the widths of the two columns.
|
|
23
|
+
- The page writes the landmarks: `<header slot="header">`, `<nav slot="navigation" aria-label="…">`, `<main id="…">`, `<aside slot="aside">` and `<footer slot="footer">`. The frame adds none of its own.
|
|
24
|
+
- The first stop of the Tab key is a link that skips to the content, with the text of `skip-label`. It is a link to the id of the `main` of the page, which works before the script has run. After it the content is in view from its start, the keys scroll it, and the Tab key goes on inside of it.
|
|
25
|
+
- On a phone with `viewport-fit=cover` nothing in a region lies under the notch, the rounded corners or the home indicator. The surface of a region (`::part(header)`, `::part(footer)`, …) reaches the edge of the screen, and what is in it does not. A region tells the components in it how far its surface reaches, and that it draws the line to the content itself, in CSS properties that are inherited.
|
|
26
|
+
- A region that scrolls and has nothing in it that takes the focus is a stop of the Tab key itself, so the keyboard can scroll it in every browser.
|
|
27
|
+
- On paper the frame is as long as its content, which prints whole.
|
|
28
|
+
- Lines between the regions from `--el-color-border` and `--el-border-width`. They are borders, which stay where the user forces colours, and they are there without a theme then. Without a theme the frame paints nothing.
|
|
29
|
+
- `narrow-only` and `wide-only` name the regions that are there at one width only (`header`, `navigation`, `aside`, `footer`, with a space between them): a bar of destinations in the footer of a phone, for example (`narrow-only="footer"`), or an aside for a desktop (`wide-only="aside"`). The stylesheet leaves a region out, without a script, and the frame keeps the edge of the screen clear that the region kept clear. ([#179](https://github.com/webtides/element-library/issues/179))
|
|
30
|
+
- Where the frame is narrow, the navigation does not show and opens as a drawer from the start edge. The page writes the navigation once: the element in the `navigation` slot is the column of the wide frame and the content of the drawer of the narrow one, and no node is moved. ([#177](https://github.com/webtides/element-library/issues/177))
|
|
31
|
+
- Any element with `data-navigation-toggle` in the frame opens and closes that drawer. The frame writes `aria-expanded` onto it, and it is not there where the navigation is a column: an `el-button` by the stylesheet of the frame, before any script has run, another element by the script (`hidden`).
|
|
32
|
+
- The drawer is an `el-drawer`: modal, with the focus kept in it. `Escape`, its close button and a click beside it close it, and the focus goes back to the button that opened it. A link the user follows in it closes it, also where the page takes the click. `navigation-label` is its title and `close-label` the name of its close button; its parts are `drawer`, `drawer-header`, `drawer-title`, `drawer-close-button` and `drawer-body`.
|
|
33
|
+
- A change of the width while the drawer is open leaves nothing behind: no backdrop, no lock on the scroll of the page and no inert page.
|
|
34
|
+
- `navigation-open` opens and closes the drawer from a script, `app-frame-navigation-toggle` tells of both, and `:state(navigation-open)` matches while it is open.
|
|
35
|
+
- `narrow-navigation="bar"`: where the frame is narrow, the navigation lies at the lower edge, over the footer, instead of being a drawer. For an `el-nav` in the `navigation` slot, whose destinations are a bar there and a rail in the column of the wide frame: the page writes them once. The region is a surface of the frame at the lower edge, as the footer is, and the column is as wide as what is in it. ([#181](https://github.com/webtides/element-library/issues/181))
|
|
36
|
+
- The column of the navigation tells an `el-nav` in it to be a column (a rail, or the list its `column` asks for), and that the region draws the line to the content, in CSS properties that are inherited. The drawer of the navigation says the same.
|
|
37
|
+
- `resizable` names the columns whose width the user sets by dragging their edge (`navigation`, `aside`). The edge is an `el-splitter` of the frame at the side of the column that faces the content: dragged with a mouse, a finger or a pen, a stop of the Tab key with the arrow keys, `Home` and `End`, and a separator with the width and the name of the column for assistive technology (`navigation-label`, and the new `aside-label`). Its parts are `navigation-splitter` and `aside-splitter`. ([#182](https://github.com/webtides/element-library/issues/182))
|
|
38
|
+
- `navigation-size` and `aside-size` are the widths of the two columns in pixels. The frame sets them while the user drags, `app-frame-resize` tells of every width and `app-frame-resize-end` of the one that stays (`detail.region`, `detail.size`). The page keeps the width and gives it back in the attribute: the template writes it onto the grid, so a server-rendered frame has it before the script has run.
|
|
39
|
+
- `--el-app-frame-navigation-min-size`, `--el-app-frame-navigation-max-size`, `--el-app-frame-aside-min-size` and `--el-app-frame-aside-max-size` are the limits of a column that is resizable (`10rem`, and `min(30rem, 40cqi)`: two fifths of the width of the frame at most). The stylesheet holds a width that is kept between them.
|
|
40
|
+
- Where the frame is narrow, a column has no edge to drag, and the drawer of the navigation keeps the width of the stylesheet.
|
|
41
|
+
- A view of columns in the content: a list and what is chosen in it beside each other, each scrolling on its own where the frame is wide, and a page that scrolls as a whole where it is narrow. The frame does it as it is: the region of the content has a height where the frame is wide, and the frame is a container for the queries of the page. The readme says what the page writes, and tests and a story hold it. ([#200](https://github.com/webtides/element-library/issues/200))
|
|
42
|
+
- An on-screen keyboard that the browser lays over the page: while it covers a part of the viewport, the frame is as high as the part above it and where that part is (`window.visualViewport`), so the header stays in view and the footer lies above the keyboard, without room for a home indicator. `:state(keyboard)` matches while it is so. A viewport that shows less is a keyboard only while the user types into something (a field, a text they edit or an `iframe` has the focus): Safari on iOS shows less while a finger pulls the page past its top as well. Only a frame that fills the viewport follows, and not while the user has zoomed in. ([#201](https://github.com/webtides/element-library/issues/201))
|
|
43
|
+
- The field the user types into stays in view: the frame scrolls its region to it when the region gets less high, for a keyboard or a window that gets smaller. A field in a dialog or a popover is left to the browser.
|
|
44
|
+
- `status-bar-tap`: a tap on the status bar of an iPhone brings the content to its top, as in an application. iOS scrolls the document for that tap and never a region, so the frame keeps the document one pixel higher than the viewport, lets it snap to that pixel, hears it go to zero, and scrolls what scrolls its content (`scroller`), smoothly unless the user asks for less motion. `app-frame-status-bar-tap` is fired first, and a listener that prevents its default keeps the frame from scrolling. Off by default: the document scrolls by a pixel with it, and the frame writes `scroll-snap-type` onto the `html` element while it listens. ([#201](https://github.com/webtides/element-library/issues/201))
|
|
45
|
+
- Only the tap is taken for one. A script that scrolls the window does not move a document that snaps, so a router that sets the scroll back, or brings a place back, is none; where a script can move the document, the frame takes no scroll for the tap. A finger that drags the page, a wheel or a key, a keyboard that comes or goes and a viewport that changes its size are none, and neither is the moment after them, nor what iOS does to the document until it has arrived at the top. While a dialog or a drawer locks the scroll of the document nothing happens, and the document is on its pixel after. Only on iOS, and only for a frame that fills the viewport.
|