@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.
Files changed (199) hide show
  1. package/CHANGELOG.md +208 -0
  2. package/README.md +72 -56
  3. package/all.js +16 -0
  4. package/catalog.js +17 -1
  5. package/custom-elements.json +14731 -10193
  6. package/package.json +1 -1
  7. package/src/components/accordion/accordion.changelog.md +11 -0
  8. package/src/components/accordion/accordion.js +15 -3
  9. package/src/components/accordion/accordion.readme.md +27 -1
  10. package/src/components/accordion/accordion.style.js +19 -0
  11. package/src/components/app-bar/app-bar.changelog.md +24 -0
  12. package/src/components/app-bar/app-bar.define.js +3 -0
  13. package/src/components/app-bar/app-bar.js +91 -0
  14. package/src/components/app-bar/app-bar.readme.md +130 -0
  15. package/src/components/app-bar/app-bar.style.js +103 -0
  16. package/src/components/app-frame/app-frame.changelog.md +45 -0
  17. package/src/components/app-frame/app-frame.define.js +3 -0
  18. package/src/components/app-frame/app-frame.events.js +6 -0
  19. package/src/components/app-frame/app-frame.js +1073 -0
  20. package/src/components/app-frame/app-frame.readme.md +416 -0
  21. package/src/components/app-frame/app-frame.style.js +527 -0
  22. package/src/components/button/button.changelog.md +25 -0
  23. package/src/components/button/button.events.js +3 -0
  24. package/src/components/button/button.js +209 -14
  25. package/src/components/button/button.readme.md +82 -6
  26. package/src/components/button/button.style.js +161 -7
  27. package/src/components/checkbox-field/checkbox-field.changelog.md +6 -0
  28. package/src/components/checkbox-field/checkbox-field.js +7 -1
  29. package/src/components/description-list/description-list.changelog.md +25 -0
  30. package/src/components/description-list/description-list.define.js +3 -0
  31. package/src/components/description-list/description-list.js +44 -0
  32. package/src/components/description-list/description-list.readme.md +135 -0
  33. package/src/components/description-list/description-list.style.js +140 -0
  34. package/src/components/dialog/dialog.changelog.md +7 -0
  35. package/src/components/dialog/dialog.readme.md +5 -0
  36. package/src/components/dialog/dialog.style.js +17 -2
  37. package/src/components/drawer/drawer.changelog.md +7 -0
  38. package/src/components/drawer/drawer.readme.md +7 -6
  39. package/src/components/drawer/drawer.style.js +35 -2
  40. package/src/components/dropdown/dropdown.readme.md +6 -1
  41. package/src/components/list/list.changelog.md +24 -0
  42. package/src/components/list/list.define.js +3 -0
  43. package/src/components/list/list.js +66 -0
  44. package/src/components/list/list.readme.md +122 -0
  45. package/src/components/list/list.style.js +56 -0
  46. package/src/components/list-item/list-item.changelog.md +24 -0
  47. package/src/components/list-item/list-item.define.js +3 -0
  48. package/src/components/list-item/list-item.js +128 -0
  49. package/src/components/list-item/list-item.readme.md +126 -0
  50. package/src/components/list-item/list-item.style.js +234 -0
  51. package/src/components/menu/menu.changelog.md +27 -0
  52. package/src/components/menu/menu.define.js +3 -0
  53. package/src/components/menu/menu.events.js +5 -0
  54. package/src/components/menu/menu.js +570 -0
  55. package/src/components/menu/menu.readme.md +272 -0
  56. package/src/components/menu/menu.style.js +55 -0
  57. package/src/components/menu-group/menu-group.changelog.md +20 -0
  58. package/src/components/menu-group/menu-group.define.js +3 -0
  59. package/src/components/menu-group/menu-group.js +44 -0
  60. package/src/components/menu-group/menu-group.readme.md +74 -0
  61. package/src/components/menu-group/menu-group.style.js +38 -0
  62. package/src/components/menu-item/menu-item.changelog.md +24 -0
  63. package/src/components/menu-item/menu-item.define.js +3 -0
  64. package/src/components/menu-item/menu-item.js +130 -0
  65. package/src/components/menu-item/menu-item.readme.md +94 -0
  66. package/src/components/menu-item/menu-item.style.js +87 -0
  67. package/src/components/nav/nav.changelog.md +35 -0
  68. package/src/components/nav/nav.define.js +3 -0
  69. package/src/components/nav/nav.js +212 -0
  70. package/src/components/nav/nav.readme.md +248 -0
  71. package/src/components/nav/nav.style.js +269 -0
  72. package/src/components/nav-item/nav-item.changelog.md +25 -0
  73. package/src/components/nav-item/nav-item.define.js +3 -0
  74. package/src/components/nav-item/nav-item.js +75 -0
  75. package/src/components/nav-item/nav-item.readme.md +111 -0
  76. package/src/components/nav-item/nav-item.style.js +159 -0
  77. package/src/components/pagination/pagination.changelog.md +8 -0
  78. package/src/components/pagination/pagination.js +123 -49
  79. package/src/components/pagination/pagination.readme.md +24 -6
  80. package/src/components/pagination/pagination.style.js +11 -1
  81. package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
  82. package/src/components/scroll-to-top/scroll-to-top.js +16 -12
  83. package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
  84. package/src/components/segmented-field/segmented-field.changelog.md +27 -0
  85. package/src/components/segmented-field/segmented-field.define.js +3 -0
  86. package/src/components/segmented-field/segmented-field.js +175 -0
  87. package/src/components/segmented-field/segmented-field.readme.md +140 -0
  88. package/src/components/segmented-field/segmented-field.style.js +193 -0
  89. package/src/components/splitter/splitter.changelog.md +24 -0
  90. package/src/components/splitter/splitter.define.js +3 -0
  91. package/src/components/splitter/splitter.events.js +4 -0
  92. package/src/components/splitter/splitter.js +237 -0
  93. package/src/components/splitter/splitter.readme.md +164 -0
  94. package/src/components/splitter/splitter.style.js +100 -0
  95. package/src/components/status-bar/status-bar.changelog.md +25 -0
  96. package/src/components/status-bar/status-bar.define.js +3 -0
  97. package/src/components/status-bar/status-bar.js +74 -0
  98. package/src/components/status-bar/status-bar.readme.md +139 -0
  99. package/src/components/status-bar/status-bar.style.js +122 -0
  100. package/src/components/switch-field/switch-field.changelog.md +6 -0
  101. package/src/components/switch-field/switch-field.js +7 -1
  102. package/src/components/tab-group/tab-group.changelog.md +7 -0
  103. package/src/components/tab-group/tab-group.js +30 -9
  104. package/src/components/tab-group/tab-group.readme.md +14 -0
  105. package/src/components/toast/toast.changelog.md +6 -0
  106. package/src/components/toast/toast.readme.md +5 -3
  107. package/src/components/toast/toast.style.js +22 -6
  108. package/src/components/toolbar/toolbar.changelog.md +24 -0
  109. package/src/components/toolbar/toolbar.define.js +3 -0
  110. package/src/components/toolbar/toolbar.js +233 -0
  111. package/src/components/toolbar/toolbar.readme.md +156 -0
  112. package/src/components/toolbar/toolbar.style.js +49 -0
  113. package/src/components/tooltip/tooltip.changelog.md +11 -0
  114. package/src/components/tooltip/tooltip.js +51 -4
  115. package/src/components/tooltip/tooltip.readme.md +26 -1
  116. package/src/components/tree/tree.changelog.md +23 -0
  117. package/src/components/tree/tree.define.js +3 -0
  118. package/src/components/tree/tree.js +138 -0
  119. package/src/components/tree/tree.readme.md +119 -0
  120. package/src/components/tree/tree.style.js +16 -0
  121. package/src/components/tree-item/tree-item.changelog.md +23 -0
  122. package/src/components/tree-item/tree-item.define.js +3 -0
  123. package/src/components/tree-item/tree-item.events.js +3 -0
  124. package/src/components/tree-item/tree-item.js +246 -0
  125. package/src/components/tree-item/tree-item.readme.md +128 -0
  126. package/src/components/tree-item/tree-item.style.js +226 -0
  127. package/src/styles/appearance.style.js +47 -0
  128. package/src/styles/choice-group.style.js +1 -1
  129. package/src/styles/modal.style.js +14 -1
  130. package/src/styles/size.style.js +41 -0
  131. package/src/utils/focus.js +69 -0
  132. package/src/utils/scroll.js +24 -0
  133. package/types/all.d.ts +16 -0
  134. package/types/src/components/accordion/accordion.d.ts +3 -1
  135. package/types/src/components/app-bar/app-bar.d.ts +43 -0
  136. package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
  137. package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
  138. package/types/src/components/app-frame/app-frame.d.ts +491 -0
  139. package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
  140. package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
  141. package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
  142. package/types/src/components/button/button.d.ts +97 -7
  143. package/types/src/components/button/button.events.d.ts +4 -0
  144. package/types/src/components/description-list/description-list.d.ts +29 -0
  145. package/types/src/components/description-list/description-list.define.d.ts +1 -0
  146. package/types/src/components/description-list/description-list.style.d.ts +2 -0
  147. package/types/src/components/list/list.d.ts +39 -0
  148. package/types/src/components/list/list.define.d.ts +1 -0
  149. package/types/src/components/list/list.style.d.ts +2 -0
  150. package/types/src/components/list-item/list-item.d.ts +62 -0
  151. package/types/src/components/list-item/list-item.define.d.ts +1 -0
  152. package/types/src/components/list-item/list-item.style.d.ts +2 -0
  153. package/types/src/components/menu/menu.d.ts +266 -0
  154. package/types/src/components/menu/menu.define.d.ts +1 -0
  155. package/types/src/components/menu/menu.events.d.ts +6 -0
  156. package/types/src/components/menu/menu.style.d.ts +2 -0
  157. package/types/src/components/menu-group/menu-group.d.ts +24 -0
  158. package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
  159. package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
  160. package/types/src/components/menu-item/menu-item.d.ts +59 -0
  161. package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
  162. package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
  163. package/types/src/components/nav/nav.d.ts +103 -0
  164. package/types/src/components/nav/nav.define.d.ts +1 -0
  165. package/types/src/components/nav/nav.style.d.ts +2 -0
  166. package/types/src/components/nav-item/nav-item.d.ts +39 -0
  167. package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
  168. package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
  169. package/types/src/components/pagination/pagination.d.ts +31 -2
  170. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
  171. package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
  172. package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
  173. package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
  174. package/types/src/components/splitter/splitter.d.ts +127 -0
  175. package/types/src/components/splitter/splitter.define.d.ts +1 -0
  176. package/types/src/components/splitter/splitter.events.d.ts +5 -0
  177. package/types/src/components/splitter/splitter.style.d.ts +2 -0
  178. package/types/src/components/status-bar/status-bar.d.ts +44 -0
  179. package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
  180. package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
  181. package/types/src/components/tab-group/tab-group.d.ts +17 -0
  182. package/types/src/components/toolbar/toolbar.d.ts +96 -0
  183. package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
  184. package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
  185. package/types/src/components/tooltip/tooltip.d.ts +26 -0
  186. package/types/src/components/tree/tree.d.ts +62 -0
  187. package/types/src/components/tree/tree.define.d.ts +1 -0
  188. package/types/src/components/tree/tree.style.d.ts +2 -0
  189. package/types/src/components/tree-item/tree-item.d.ts +106 -0
  190. package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
  191. package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
  192. package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
  193. package/types/src/styles/appearance.style.d.ts +31 -0
  194. package/types/src/styles/choice-group.style.d.ts +1 -1
  195. package/types/src/styles/modal.style.d.ts +5 -0
  196. package/types/src/styles/size.style.d.ts +24 -0
  197. package/types/src/utils/focus.d.ts +25 -0
  198. package/types/src/utils/scroll.d.ts +11 -0
  199. package/web-types.json +2530 -393
@@ -0,0 +1,416 @@
1
+ # App Frame
2
+
3
+ `app-frame` is 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. The header and the footer stay in view, and the content scrolls between them. On a phone the regions stay clear of the notch, the rounded corners and the home indicator.
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-frame/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-app-frame>
21
+ <header slot="header">…</header>
22
+ <nav slot="navigation" aria-label="Main">…</nav>
23
+ <main id="main">…</main>
24
+ <aside slot="aside">…</aside>
25
+ <footer slot="footer">…</footer>
26
+ </el-app-frame>
27
+ ```
28
+
29
+ Every region but the content is optional: a region the page leaves empty takes no room.
30
+
31
+ A page that reaches under the notch and the home indicator of a phone says so in its viewport. Without `viewport-fit=cover` the system keeps the page out of that room, and the frame has nothing to do there.
32
+
33
+ ```html
34
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
35
+ ```
36
+
37
+ ## API
38
+
39
+ #### Properties/Attributes
40
+
41
+ | Name | Type | Default | Description |
42
+ | --- | --- | --- | --- |
43
+ | `skip-label` | `string` | `'Skip to content'` | The text of the link that skips to the content. |
44
+ | `wide-from` | `'30rem' \| '40rem' \| '48rem' \| '64rem' \| '80rem'` | `'48rem'` | The width of the frame from which the navigation and the aside are columns beside the content. Another value is the default. |
45
+ | `narrow-only` | `string` | `''` | The regions that are there only where the frame is narrow: `header`, `navigation`, `aside`, `footer`, with a space between them. |
46
+ | `wide-only` | `string` | `''` | The regions that are there only where the frame is wide, named the same way. |
47
+ | `narrow-navigation` | `'drawer' \| 'bar'` | `'drawer'` | What the navigation is where the frame is narrow: a drawer, or a region at the lower edge for an `el-nav`. |
48
+ | `navigation-open` | `boolean` | `false` | Whether the drawer of the navigation is open. It is one only where the frame is narrow. Reflected to the `navigation-open` attribute. |
49
+ | `navigation-label` | `string` | `'Navigation'` | The title of the drawer of the navigation, and its name for assistive technology. |
50
+ | `close-label` | `string` | `'Close'` | The name of the close button of that drawer. |
51
+ | `resizable` | `string` | `''` | The columns whose width the user sets by dragging their edge: `navigation`, `aside`, with a space between them. |
52
+ | `navigation-size` | `number` | `0` | The width of the navigation where the frame is wide, in pixels: the one the user has set, or the one the page has kept. `0` is the width of the stylesheet. |
53
+ | `aside-size` | `number` | `0` | The width of the aside where the frame is wide, in pixels. `0` is the width of the stylesheet. |
54
+ | `aside-label` | `string` | `'Aside'` | The name of the aside on the edge that sizes it. The edge of the navigation has `navigation-label`. |
55
+ | `status-bar-tap` | `boolean` | `false` | Whether a tap on the status bar of an iPhone brings the content to its top. The document is one pixel higher than the viewport then, and snaps to that pixel. |
56
+
57
+ #### Read-only properties
58
+
59
+ | Name | Type | Description |
60
+ | --- | --- | --- |
61
+ | `wide` | `boolean` | Whether the frame is wide. It reads what the stylesheet has decided. |
62
+ | `scroller` | `HTMLElement` | The element that scrolls the content: the content region where the frame is wide, the column of the content and the aside where it is narrow. |
63
+
64
+ #### Methods
65
+
66
+ _None._
67
+
68
+ #### Events
69
+
70
+ | Name | Detail | Description |
71
+ | --- | --- | --- |
72
+ | `app-frame-navigation-toggle` | `{ open: boolean }` | Fired when the drawer of the navigation opens or closes. |
73
+ | `app-frame-resize` | `{ region: 'navigation' \| 'aside', size: number }` | Fired with every change the user makes to the width of a column: while its edge is dragged, and with every key. |
74
+ | `app-frame-resize-end` | `{ region: 'navigation' \| 'aside', size: number }` | Fired once the user has set a width: when the pointer lets go of the edge, and with every key. The width to keep. |
75
+ | `app-frame-status-bar-tap` | | Fired when the user has tapped the status bar of an iPhone, with `status-bar-tap`. The frame scrolls its content to the top after it, unless a listener calls `preventDefault()`. |
76
+
77
+ #### Slots
78
+
79
+ | Name | Description |
80
+ | ------------ | -------------------------------------------------------------------------------------- |
81
+ | (default) | The content of the view: the `main` of the page, with an id. |
82
+ | `header` | The region at the top, an app bar as a rule. |
83
+ | `navigation` | The region at the start side, and the content of the drawer where the frame is narrow. |
84
+ | `aside` | The region at the end side. |
85
+ | `footer` | The region at the lower edge: a bar of destinations, or a line of state. |
86
+
87
+ #### CSS Parts
88
+
89
+ | Name | Description |
90
+ | --------------------- | -------------------------------------------------------------------------------------- |
91
+ | `base` | The frame: the grid of the regions. |
92
+ | `skip-link` | The link that skips to the content. It shows while it has the focus. |
93
+ | `header` | The region at the top. Its surface reaches under the status bar of a phone. |
94
+ | `navigation` | The region at the start side, where the frame is wide. |
95
+ | `body` | The content and the aside. Where the frame is narrow, it is what scrolls. |
96
+ | `content` | The region of the content. Where the frame is wide, it is what scrolls. |
97
+ | `aside` | The region at the end side. |
98
+ | `footer` | The region at the lower edge. Its surface reaches under the home indicator of a phone. |
99
+ | `drawer` | The surface of the drawer the navigation is in where the frame is narrow. |
100
+ | `drawer-header` | The header of that drawer, with its title and its close button. |
101
+ | `drawer-title` | The title of that drawer. |
102
+ | `drawer-close-button` | The close button of that drawer. |
103
+ | `drawer-body` | The body of that drawer: the navigation of the page is in it. |
104
+ | `navigation-splitter` | The edge of the navigation the user drags, an `el-splitter`. |
105
+ | `aside-splitter` | The edge of the aside the user drags, an `el-splitter`. |
106
+
107
+ #### CSS Custom Properties
108
+
109
+ | Name | Default | Description |
110
+ | --- | --- | --- |
111
+ | `--el-app-frame-navigation-size` | `16rem` | The width of the navigation where the frame is wide, and of its drawer where it is narrow. `auto` is the width of what is in it. |
112
+ | `--el-app-frame-aside-size` | `20rem` | The width of the aside where the frame is wide. |
113
+ | `--el-app-frame-navigation-min-size` | `10rem` | The least width of a navigation that is resizable. |
114
+ | `--el-app-frame-navigation-max-size` | `min(30rem, 40cqi)` | The greatest width of a navigation that is resizable: two fifths of the width of the frame at most. |
115
+ | `--el-app-frame-aside-min-size` | `10rem` | The least width of an aside that is resizable. |
116
+ | `--el-app-frame-aside-max-size` | `min(30rem, 40cqi)` | The greatest width of an aside that is resizable. |
117
+
118
+ Reads `--el-color-bg` and `--el-color-fg` for its surface and its text, `--el-color-border` and `--el-border-width` for the lines between the regions, and `--el-space-2`, `--el-space-3`, `--el-radius-md`, `--el-font-size-sm`, `--el-focus-ring-width` and `--el-color-focus-ring` for the skip link.
119
+
120
+ ## What the page writes, and what the frame does
121
+
122
+ The frame knows regions, not what they mean: the footer is a bar of destinations on a phone ([`el-nav`](../nav/nav.readme.md)) and a line of state on a desktop ([`el-status-bar`](../status-bar/status-bar.readme.md)). So the page writes the element of every region, which says what it is, and the frame lays it out.
123
+
124
+ | Slot | The page writes | Landmark |
125
+ | ------------ | ---------------------------------------- | ----------------------- |
126
+ | `header` | `<header slot="header">` | banner |
127
+ | `navigation` | `<nav slot="navigation" aria-label="…">` | navigation, with a name |
128
+ | (default) | `<main id="…">` | main |
129
+ | `aside` | `<aside slot="aside">` | complementary |
130
+ | `footer` | `<footer slot="footer">` | contentinfo |
131
+
132
+ - The frame adds no landmark of its own. A component that is a navigation itself, an `el-breadcrumb` for example, goes into the slot without a `nav` around it: the landmark would be there twice.
133
+ - A page with two navigations gives each a name (`aria-label`), so a screen reader can tell them apart.
134
+ - The frame cannot make sure of the landmarks. A `<div slot="header">` is laid out as a header and is none.
135
+
136
+ ## What scrolls
137
+
138
+ One thing: the content. The frame is as high as the viewport, the header and the footer are rows of it, and they cannot leave. A navigation or an aside that is longer than the frame scrolls on its own.
139
+
140
+ The window does not scroll in a frame. What follows from it:
141
+
142
+ - **A router** that sets the scroll of the window back after a change of the view does not reach the content. `scroller` is the element that scrolls it:
143
+
144
+ ```js
145
+ const frame = document.querySelector('el-app-frame');
146
+ frame.scroller.scrollTo({ top: 0 });
147
+ ```
148
+
149
+ Ask for it when you need it: it is another element where the frame is narrow.
150
+
151
+ - **[`el-scroll-to-top`](../scroll-to-top/scroll-to-top.readme.md)** in the content scrolls the content to its top. It scrolls the element around it that scrolls, and the window where there is none.
152
+ - **[`el-scroll-to`](../scroll-to/scroll-to.readme.md)** brings its target into view as anywhere.
153
+ - **[`el-sticky`](../sticky/sticky.readme.md)** follows the scroll of the window and has nothing to do in a frame: the header of the frame stays in view by itself.
154
+ - **A phone does not take its address bar in**, because that follows the scroll of the document. The frame is as high as what shows beside the bar, in both of its states.
155
+ - **A tap on the status bar of an iPhone does nothing**, because iOS scrolls the document for it and never a region. `status-bar-tap` makes it work: see [A tap on the status bar](#a-tap-on-the-status-bar). What iOS does not give there, measured on iOS 27 in Safari, in a `WKWebView` and in a web application on the home screen:
156
+ - **The frame hears a scroll, not a tap.** iOS has no event for the tap. Whatever else it does that takes the document to its top without telling the page looks the same: the `Home` key of a hardware keyboard, where Safari takes it and gives the page no `keydown`. The content goes to its top then as well, which is what that key asks for.
157
+ - **The next tap is heard a second and a half after the last one.** iOS is on its way to the top for that long, also for one pixel, and takes the document back there until it has arrived.
158
+ - **While the on-screen keyboard is open a tap is not heard**, and not for up to two seconds after it has gone: the browser moves the document for the keyboard, and the frame leaves the document to it.
159
+ - **For seven tenths of a second after a finger that dragged the page has left the screen** a tap is not heard, and the same after a wheel, a key and a viewport that changed its size. The page swings back for that long.
160
+ - **Where a script can scroll the document to zero, no tap is heard at all.** That is a browser that does not snap where the scroll of a script ends, or a page whose own rule for `scroll-snap-type` wins over the one of the frame. Nothing tells a router from the tap there, and the frame takes no scroll for one.
161
+
162
+ ## A view of columns
163
+
164
+ Some views are a list and what is chosen in it, beside each other: the notes and the open note. Where the frame is wide, each column scrolls on its own, and the view is as high as the region of the content. Where the frame is narrow, the view is a page like any other, which scrolls as a whole.
165
+
166
+ The frame needs nothing for it. The region of the content has a height where the frame is wide, so the view takes that height and lets its columns scroll. The page writes that in a query by the width of the frame, which is a container for the queries of the page:
167
+
168
+ ```html
169
+ <el-app-frame>
170
+ <main id="main" class="view">
171
+ <section aria-label="Notes">…</section>
172
+ <article>…</article>
173
+ </main>
174
+ </el-app-frame>
175
+ ```
176
+
177
+ ```css
178
+ .view {
179
+ box-sizing: border-box;
180
+ }
181
+
182
+ /* The width of wide-from. */
183
+ @container (min-width: 48rem) {
184
+ .view {
185
+ display: flex;
186
+ block-size: 100%;
187
+ }
188
+
189
+ .view > * {
190
+ flex: 1 1 0;
191
+ min-inline-size: 0;
192
+ overflow-y: auto;
193
+ overscroll-behavior: contain;
194
+ }
195
+ }
196
+ ```
197
+
198
+ - **The region of the content does not scroll as well.** The view is as high as the region, with its padding inside of that height (`box-sizing: border-box`). A margin of the view would be on top of it.
199
+ - **Where the frame is narrow** the rules do not apply. The columns are below each other, or one of them is a view of its own on a phone, and the page scrolls between the header and the footer.
200
+ - **The query is the page's**, with the width of `wide-from` written into it. The stylesheet decides: a server-rendered page is right before any script has run, and nothing is to be done when the window gets narrower.
201
+ - **`scroller`** is the region of the content, which has nothing to scroll in such a view. A router that sets the scroll back after a change of the view asks the columns.
202
+ - **The keyboard.** A column that scrolls and has no control in it needs `tabindex="0"`: without a stop of the Tab key the keys cannot scroll it in every browser. The frame does that for its own regions, not for an element of the page.
203
+ - **On paper** the region has no height, so the columns are as high as what is in them, and print whole.
204
+
205
+ The columns are the layout of the page. An edge the user drags between two of them is an [`el-splitter`](../splitter/splitter.readme.md).
206
+
207
+ ## Narrow and wide
208
+
209
+ From the width that `wide-from` names, the navigation and the aside are columns beside the content, and each of the three scrolls on its own. Where the frame is narrow, the content and the aside are below each other, in one column that scrolls between the header and the footer, and the navigation is a drawer.
210
+
211
+ ```html
212
+ <el-app-frame wide-from="64rem">…</el-app-frame>
213
+ ```
214
+
215
+ - The width is one of five steps: `30rem`, `40rem`, `48rem` (the default), `64rem` or `80rem`. A stylesheet cannot read the width of a query from a custom property, so the frame has a query for each step, and another value is the default.
216
+ - The width is the one of the frame itself, not of the window. A frame in a box of the page is narrow in a narrow box.
217
+ - The stylesheet alone decides. A server does not know the width, and the frame has the right layout before the script has run. `wide` reads what the stylesheet has decided.
218
+
219
+ ## The navigation as a drawer
220
+
221
+ Where the frame is narrow, the navigation does not show. It opens as a drawer from the start edge, and the page writes it once: the same element is the column of the wide frame and the content of the drawer of the narrow one.
222
+
223
+ ```html
224
+ <el-app-frame navigation-label="Lists">
225
+ <header slot="header">
226
+ <el-app-bar heading-level="1">
227
+ <el-button slot="start" data-navigation-toggle circle="true" aria-label="Lists">
228
+ <svg aria-hidden="true">…</svg>
229
+ </el-button>
230
+ Inbox
231
+ </el-app-bar>
232
+ </header>
233
+ <nav slot="navigation" aria-label="Lists">…</nav>
234
+ <main id="main">…</main>
235
+ </el-app-frame>
236
+ ```
237
+
238
+ - **The button** is any element with `data-navigation-toggle`, anywhere in the frame: in an app bar as a rule. A click opens the drawer, and the frame writes `aria-expanded` onto the button, which says whether the navigation is open.
239
+ - **Where the navigation is a column, the button is not there.** An `el-button` reads that from the stylesheet of the frame, before any script has run. Another element is hidden by the script of the frame (`hidden`): hide it in your stylesheet where it must not show before that.
240
+ - **The drawer** is an [`el-drawer`](../drawer/drawer.readme.md): 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. `navigation-label` is its title and its name, `close-label` the name of its close button.
241
+ - **A link** the user follows in the drawer closes it, also where the page takes the click and changes the view without loading.
242
+ - **A change of the width** while the drawer is open, a phone that is turned or a window that grows, takes the drawer away: no backdrop, no lock on the scroll and no inert page are left, and the navigation is the column.
243
+ - `navigation-open` opens and closes the drawer from a script, and `app-frame-navigation-toggle` tells of both. `el-app-frame:state(navigation-open)` matches while it is open.
244
+ - A navigation the page has for the wide frame only (`wide-only="navigation"`) has no drawer.
245
+
246
+ Before the script has run, the stylesheet keeps the navigation from showing where the frame is narrow. The button is there and does nothing yet.
247
+
248
+ ## The navigation as a bar
249
+
250
+ Some navigations are a few destinations, not a list of everything: the three to five places the user goes to all the time. On a phone they are a bar at the lower edge, on a wider screen a rail at the side. `narrow-navigation="bar"` is for those, with an [`el-nav`](../nav/nav.readme.md) in the `navigation` slot:
251
+
252
+ ```html
253
+ <el-app-frame narrow-navigation="bar">
254
+ <main id="main">…</main>
255
+ <el-nav slot="navigation" label="Main">…</el-nav>
256
+ </el-app-frame>
257
+ ```
258
+
259
+ - Where the frame is narrow, the navigation lies at the lower edge, over the footer if there is one. There is no drawer, and a button for one is not there.
260
+ - Where the frame is wide, the navigation is the column at the start side, as wide as what is in it.
261
+ - The frame tells the `el-nav` which of the two it is, in a CSS property that is inherited: the destinations are a bar or a column, and the page writes them once. The column is a rail, or a list of rows with `column="list"` on the `el-nav`.
262
+ - The property is inherited, so an `el-nav` in an element of the page that is in the slot is told the same. A sidebar with the name of the application above its destinations and the account below them is such an element: see the readme of [`el-nav`](../nav/nav.readme.md).
263
+
264
+ ## Regions for one width
265
+
266
+ A phone has its destinations in a bar at the lower edge, a desktop in a column at the side. `narrow-only` and `wide-only` name the regions that are there at one width only:
267
+
268
+ ```html
269
+ <el-app-frame narrow-only="footer" wide-only="navigation aside">
270
+ <nav slot="navigation" aria-label="Lists">…</nav>
271
+ <main id="main">…</main>
272
+ <aside slot="aside">…</aside>
273
+ <el-nav slot="footer" label="Main">…</el-nav>
274
+ </el-app-frame>
275
+ ```
276
+
277
+ - The names are `header`, `navigation`, `aside` and `footer`, with a space between them.
278
+ - The stylesheet leaves a region out: no script, and no room, no line and no landmark where the region is not there.
279
+ - The frame keeps the edge of the screen clear that the region kept clear.
280
+
281
+ ## Columns the user sizes
282
+
283
+ In a tool for a desktop the user sets how wide the navigation or the aside is. `resizable` names the columns that have an edge to drag:
284
+
285
+ ```html
286
+ <el-app-frame resizable="navigation aside" navigation-size="320">
287
+ <nav slot="navigation" aria-label="Files">…</nav>
288
+ <main id="main">…</main>
289
+ <aside slot="aside" aria-label="Outline">…</aside>
290
+ </el-app-frame>
291
+ ```
292
+
293
+ - The edge is an [`el-splitter`](../splitter/splitter.readme.md) of the frame, at the side of the column that faces the content. It is dragged with a mouse, a finger or a pen, and it is a stop of the Tab key: the arrow keys move it in steps, `Home` and `End` take it to the limits. Its name is the one of the column: `navigation-label` and `aside-label`.
294
+ - `navigation-size` and `aside-size` are the widths, in pixels. The frame sets them while the user drags, and tells of every one with `app-frame-resize` and of the one that stays with `app-frame-resize-end` (`detail.region`, `detail.size`).
295
+ - The page keeps the width and gives it back in the attribute. A server-rendered frame has it before the script has run, and nothing jumps. `0`, or no attribute, is the width of the stylesheet (`--el-app-frame-navigation-size`, `--el-app-frame-aside-size`).
296
+ - The least and the greatest width are in the stylesheet: `--el-app-frame-navigation-min-size` and `--el-app-frame-navigation-max-size`, and the same two for the aside. They are lengths in any unit. `cqi` is a share of the width of the frame: the default of the greatest width is `min(30rem, 40cqi)`, so the content keeps a part of a frame that gets narrower. The stylesheet holds a width that is kept between them. Write them as lengths and not as percentages: the edge says them to assistive technology in pixels, and cannot read a percentage.
297
+ - A column does not close when its edge is dragged below the least width. It stops there.
298
+ - Where the frame is narrow there is no edge: the navigation is a drawer, as wide as `--el-app-frame-navigation-size`, and the aside is below the content. The width the user has set is kept for the wide frame.
299
+
300
+ ```js
301
+ frame.addEventListener('app-frame-resize-end', ({ detail }) => {
302
+ localStorage.setItem(`frame-${detail.region}`, detail.size);
303
+ });
304
+ ```
305
+
306
+ ## The link that skips to the content
307
+
308
+ The first stop of the Tab key in the frame is a link that skips the header and the navigation. It is off the screen until it has the focus, and shows in the corner at the start then.
309
+
310
+ - Its text is `skip-label`: `<el-app-frame skip-label="Zum Inhalt">`.
311
+ - It leads to the `main` of the page, or to the first element in the default slot. Give that element an **id**: the link is a link to it (`href="#main"`), which works before the script has run. Without an id the link needs the script.
312
+ - After it, the content is in view from its start, the keys scroll it, and the Tab key goes on with the first control in it. The address of the page stays as it is.
313
+
314
+ ## On a phone
315
+
316
+ With `viewport-fit=cover`, and as a web app on the home screen, the page reaches under the notch, the rounded corners and the home indicator. The frame keeps what the user reads and taps clear of them:
317
+
318
+ - The surface of the header reaches up to the edge of the screen, and what is in the header starts below the status bar. The same for the footer and the home indicator, and for the sides while the phone lies on its side.
319
+ - A column keeps the side of the screen clear that it lies at, and the content the sides that have no column.
320
+ - Without a header, or without a footer, the frame keeps that edge clear itself: the content does not scroll under the status bar.
321
+
322
+ An [`el-app-bar`](../app-bar/app-bar.readme.md) in the header draws its own surface into that room: the region tells the components in it how far its surface reaches.
323
+
324
+ For other content the room is padding of the regions, so a background on the element of the page ends where the padding starts. The surface of a region is its part:
325
+
326
+ ```css
327
+ el-app-frame::part(header) {
328
+ background: var(--el-color-bg-muted);
329
+ }
330
+ ```
331
+
332
+ ## The on-screen keyboard
333
+
334
+ A browser on a phone lays its keyboard over the page and leaves the layout as it is. The frame is still as high as the viewport, with its lower part under the keyboard, and the browser moves the page up behind the keyboard to show the field the user types into: the header leaves the screen.
335
+
336
+ The frame takes what shows instead (`window.visualViewport`): while a keyboard covers a part of the viewport, the frame is as high as the part above it, and where that part is.
337
+
338
+ No browser says that a keyboard is there, so the frame reads it from two signs: the visual viewport is lower than the layout by more than 80 pixels, and the user types into something. That is an `input`, a `textarea`, a `select` or a text they edit (`contenteditable`) that has the focus, in the page or in an open shadow root, or an `iframe` that has it. The height alone does not tell: Safari on iOS makes the visual viewport less high while a finger pulls the page past its top as well.
339
+
340
+ - **The header stays in view**, and the footer or the bar of destinations lies above the keyboard. Its lower edge is the keyboard then, so it leaves no room for the home indicator.
341
+ - **The field the user types into stays in view**: the frame scrolls its region to it when the region gets less high. A field in a dialog or a popover is in no region, and the browser shows it.
342
+ - `el-app-frame:state(keyboard)` matches while it is so.
343
+ - This needs the script. A frame in a box of the page does not follow, and neither does a frame while the user has zoomed in: Safari zooms into a field whose text is smaller than `16px`.
344
+
345
+ What the platform does not give:
346
+
347
+ - **Safari on iOS and a `WKWebView` move the page first and tell of it afterwards.** For the fifth of a second the keyboard takes to come in, the regions are on their way to their places. Nothing a page does comes before that.
348
+ - **Safari on iOS does not resize the layout for the keyboard**: it takes no notice of `interactive-widget=resizes-content` in the viewport of the page. Where a browser does resize the layout (Chrome on Android, with that word in the viewport), the frame follows by its stylesheet, and the script has nothing to do.
349
+ - **A field that has the focus without a keyboard looks like one with a keyboard.** With a hardware keyboard, or after the user has put the on-screen keyboard away, a page that is pulled past its top in Safari is taken for a keyboard for as long as the finger pulls: the footer comes to the lower edge of the screen.
350
+ - **A field the frame cannot see is none for it**: one in a closed shadow root. The frame does not follow the keyboard that comes for it.
351
+
352
+ In a web view of an application of your own, let the view end at the keyboard (its lower edge at `keyboardLayoutGuide.topAnchor`). The layout gets less high with the keyboard, the browser moves nothing, and the frame keeps the field in view.
353
+
354
+ ## A tap on the status bar
355
+
356
+ On an iPhone a tap on the status bar brings what scrolls back to its top. iOS does that for the document, in Safari, in a `WKWebView` and in a web application on the home screen, and never for a region of the page. It has no event for the tap either. In a frame the document has nothing to scroll, so the tap does nothing.
357
+
358
+ `status-bar-tap` makes it work:
359
+
360
+ ```html
361
+ <el-app-frame status-bar-tap="true">…</el-app-frame>
362
+ ```
363
+
364
+ - **How.** The frame makes the document one pixel higher than what the browser shows, and the document rests scrolled down by that pixel: it snaps there. The tap takes the document to zero, past the snap. The frame hears that scroll and scrolls its content to the top (`scroller`), smoothly, or at once for a user who asks for less motion. When iOS has arrived, the frame puts the document back on its pixel. The frame is fixed to the viewport and does not move by the pixel, and nothing of it shows: no gap, no scrollbar, nothing that moves while the page loads.
365
+ - **`app-frame-status-bar-tap`** is fired first. A listener that calls `preventDefault()` keeps the frame from scrolling: a [view of columns](#a-view-of-columns) brings its own columns to their tops.
366
+ - **A script is not taken for the tap.** Where a document snaps, the scroll of a script ends there as well: `window.scrollTo(0, 0)` of a router after a change of the view leaves the document on its pixel, and so does the place a router has kept for the way back. The scroll of the content is yours to keep and to bring back, with `scroller`.
367
+ - **Nothing else is taken for it either:** a finger that drags the header, the footer or the content, also past its end, and the page that swings back after it; a wheel or a key over the header; a keyboard that comes or goes; a viewport that changes its size, as a phone that is turned. A finger that scrolls the content moves no document, and a tap right after it counts.
368
+ - **Only on iOS, and only for a frame that fills the viewport.** No other browser has that tap, and there the attribute does nothing: the document is as high as the viewport and does not scroll, as without it.
369
+
370
+ What it costs, and why it is not the default:
371
+
372
+ - **The document scrolls by one pixel, and has that one place.** `window.scrollY` is `1`, not `0`, and a script that scrolls the window moves nothing.
373
+ - **The frame writes a rule onto the `html` element** while it listens, `scroll-snap-type` in its `style` attribute: the browser reads that rule for the viewport from nowhere else. It puts back what the page had there. The element that makes the document higher is a child of the `body`, hidden from assistive technology, and not there on paper.
374
+ - **A finger that drags the header or the footer** pulls the page a little, as on any page whose document scrolls. It goes back to its pixel by itself.
375
+ - **While a dialog or a drawer is open** the page does not scroll, and the tap does nothing: the lock they put on the document holds the pixel too. The document is on its pixel when they have closed. A page that keeps its document from scrolling itself (`overflow: hidden` on `html`) has no tap for the same reason.
376
+
377
+ What iOS does not give is listed under [What scrolls](#what-scrolls).
378
+
379
+ ## Keyboard
380
+
381
+ A region that scrolls and has nothing in it that takes the focus is a stop of the Tab key itself: a text without a link, for example. Without that stop the keyboard could not scroll it. Some browsers do this by themselves, and the frame does it for the others. The stop goes when the region gets a control, or no longer scrolls.
382
+
383
+ ## A frame in a box of the page
384
+
385
+ By default the frame is fixed to the edges of the viewport. For a frame in a box, a preview for example, set a position and a height on the element:
386
+
387
+ ```css
388
+ el-app-frame.preview {
389
+ position: relative;
390
+ height: 40rem;
391
+ }
392
+ ```
393
+
394
+ A frame does not go into a region of another frame: both would fill the viewport.
395
+
396
+ ## The top layer
397
+
398
+ `el-dialog`, `el-drawer`, `el-popover`, `el-tooltip` and `el-toast` are in the top layer of the browser. They show over the frame from any region, and nothing in the frame clips them. A dialog, a drawer and a toast keep clear of the notch and the home indicator themselves, in a frame and without one. The lock a dialog puts on the scroll of the document does no harm: a frame leaves the document nothing to scroll, and a modal makes the frame inert.
399
+
400
+ ## Print
401
+
402
+ On paper the frame is as long as its content: it gives up its height and what scrolls, so the content prints whole.
403
+
404
+ ## Server-side rendering
405
+
406
+ The frame renders on a server with `@webtides/element-js-ssr-renderer`. Its layout is its stylesheet: the regions, the width from which it is wide, and the room for the notch need no script, and nothing moves when the element takes over. The script adds the drawer of the navigation, the stops of the Tab key for regions without a control, what the skip link does beyond a link, and what the frame does for an on-screen keyboard and for a tap on the status bar.
407
+
408
+ Without server rendering, the regions of the page are below each other until the element is defined.
409
+
410
+ ## Accessibility
411
+
412
+ - The landmarks are the elements of the page, see above. The frame has none, and its parts have no role.
413
+ - The skip link is the first stop of the Tab key, and has a surface and a border of its own, without a theme as well.
414
+ - The lines between the regions are borders. They stay where the user forces colours, and they are there without a theme then: nothing else tells two regions apart.
415
+ - Without a theme the frame paints nothing: it reads as the page does, in a light and in a dark scheme.
416
+ - Start and end follow the reading direction: in a text that runs from right to left the navigation is at the right.