@webtides/element-library 0.3.1 → 0.5.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 (252) hide show
  1. package/CHANGELOG.md +300 -0
  2. package/README.md +72 -56
  3. package/all.js +16 -0
  4. package/catalog.js +17 -1
  5. package/custom-elements.json +15912 -10065
  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 +59 -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 +1085 -0
  20. package/src/components/app-frame/app-frame.readme.md +425 -0
  21. package/src/components/app-frame/app-frame.style.js +534 -0
  22. package/src/components/button/button.changelog.md +21 -0
  23. package/src/components/button/button.events.js +3 -0
  24. package/src/components/button/button.js +145 -3
  25. package/src/components/button/button.readme.md +72 -4
  26. package/src/components/button/button.style.js +167 -8
  27. package/src/components/button-group/button-group.changelog.md +10 -0
  28. package/src/components/button-group/button-group.readme.md +2 -0
  29. package/src/components/button-group/button-group.style.js +6 -2
  30. package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +6 -0
  31. package/src/components/checkbox-group-field/checkbox-group-field.js +7 -2
  32. package/src/components/checkbox-group-field/checkbox-group-field.readme.md +23 -1
  33. package/src/components/combobox-field/combobox-field.changelog.md +6 -0
  34. package/src/components/combobox-field/combobox-field.readme.md +8 -0
  35. package/src/components/combobox-field/combobox-field.style.js +2 -0
  36. package/src/components/date-field/date-field.changelog.md +6 -0
  37. package/src/components/date-field/date-field.readme.md +10 -0
  38. package/src/components/date-field/date-field.style.js +8 -3
  39. package/src/components/description-list/description-list.changelog.md +42 -0
  40. package/src/components/description-list/description-list.define.js +3 -0
  41. package/src/components/description-list/description-list.js +49 -0
  42. package/src/components/description-list/description-list.readme.md +161 -0
  43. package/src/components/description-list/description-list.style.js +169 -0
  44. package/src/components/dialog/dialog.changelog.md +7 -0
  45. package/src/components/dialog/dialog.readme.md +5 -0
  46. package/src/components/dialog/dialog.style.js +17 -2
  47. package/src/components/divider/divider.changelog.md +6 -0
  48. package/src/components/divider/divider.readme.md +1 -1
  49. package/src/components/divider/divider.style.js +6 -0
  50. package/src/components/drawer/drawer.changelog.md +7 -0
  51. package/src/components/drawer/drawer.readme.md +7 -6
  52. package/src/components/drawer/drawer.style.js +35 -2
  53. package/src/components/dropdown/dropdown.readme.md +6 -1
  54. package/src/components/file-field/file-field.changelog.md +8 -0
  55. package/src/components/file-field/file-field.js +135 -5
  56. package/src/components/file-field/file-field.readme.md +35 -6
  57. package/src/components/file-field/file-field.style.js +71 -0
  58. package/src/components/form-field/form-field.js +1 -1
  59. package/src/components/input-field/input-field.changelog.md +10 -0
  60. package/src/components/input-field/input-field.js +192 -14
  61. package/src/components/input-field/input-field.readme.md +88 -2
  62. package/src/components/input-field/input-field.style.js +2 -0
  63. package/src/components/list/list.changelog.md +30 -0
  64. package/src/components/list/list.define.js +3 -0
  65. package/src/components/list/list.js +68 -0
  66. package/src/components/list/list.readme.md +123 -0
  67. package/src/components/list/list.style.js +56 -0
  68. package/src/components/list-item/list-item.changelog.md +40 -0
  69. package/src/components/list-item/list-item.define.js +3 -0
  70. package/src/components/list-item/list-item.js +130 -0
  71. package/src/components/list-item/list-item.readme.md +144 -0
  72. package/src/components/list-item/list-item.style.js +246 -0
  73. package/src/components/menu/menu.changelog.md +44 -0
  74. package/src/components/menu/menu.define.js +3 -0
  75. package/src/components/menu/menu.events.js +5 -0
  76. package/src/components/menu/menu.js +793 -0
  77. package/src/components/menu/menu.readme.md +313 -0
  78. package/src/components/menu/menu.style.js +59 -0
  79. package/src/components/menu-group/menu-group.changelog.md +20 -0
  80. package/src/components/menu-group/menu-group.define.js +3 -0
  81. package/src/components/menu-group/menu-group.js +44 -0
  82. package/src/components/menu-group/menu-group.readme.md +74 -0
  83. package/src/components/menu-group/menu-group.style.js +38 -0
  84. package/src/components/menu-item/menu-item.changelog.md +32 -0
  85. package/src/components/menu-item/menu-item.define.js +3 -0
  86. package/src/components/menu-item/menu-item.js +168 -0
  87. package/src/components/menu-item/menu-item.readme.md +132 -0
  88. package/src/components/menu-item/menu-item.style.js +117 -0
  89. package/src/components/nav/nav.changelog.md +35 -0
  90. package/src/components/nav/nav.define.js +3 -0
  91. package/src/components/nav/nav.js +212 -0
  92. package/src/components/nav/nav.readme.md +248 -0
  93. package/src/components/nav/nav.style.js +269 -0
  94. package/src/components/nav-item/nav-item.changelog.md +25 -0
  95. package/src/components/nav-item/nav-item.define.js +3 -0
  96. package/src/components/nav-item/nav-item.js +75 -0
  97. package/src/components/nav-item/nav-item.readme.md +111 -0
  98. package/src/components/nav-item/nav-item.style.js +159 -0
  99. package/src/components/otp-field/otp-field.changelog.md +6 -0
  100. package/src/components/otp-field/otp-field.readme.md +8 -0
  101. package/src/components/otp-field/otp-field.style.js +8 -3
  102. package/src/components/pagination/pagination.changelog.md +8 -0
  103. package/src/components/pagination/pagination.js +123 -49
  104. package/src/components/pagination/pagination.readme.md +24 -6
  105. package/src/components/pagination/pagination.style.js +11 -1
  106. package/src/components/password-field/password-field.changelog.md +7 -0
  107. package/src/components/password-field/password-field.readme.md +11 -1
  108. package/src/components/password-field/password-field.style.js +2 -0
  109. package/src/components/popover/popover.changelog.md +6 -0
  110. package/src/components/popover/popover.style.js +1 -0
  111. package/src/components/radio-field/radio-field.changelog.md +6 -0
  112. package/src/components/radio-field/radio-field.js +7 -2
  113. package/src/components/radio-field/radio-field.readme.md +23 -1
  114. package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
  115. package/src/components/scroll-to-top/scroll-to-top.js +16 -12
  116. package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
  117. package/src/components/segmented-field/segmented-field.changelog.md +27 -0
  118. package/src/components/segmented-field/segmented-field.define.js +3 -0
  119. package/src/components/segmented-field/segmented-field.js +175 -0
  120. package/src/components/segmented-field/segmented-field.readme.md +140 -0
  121. package/src/components/segmented-field/segmented-field.style.js +193 -0
  122. package/src/components/splitter/splitter.changelog.md +24 -0
  123. package/src/components/splitter/splitter.define.js +3 -0
  124. package/src/components/splitter/splitter.events.js +4 -0
  125. package/src/components/splitter/splitter.js +237 -0
  126. package/src/components/splitter/splitter.readme.md +164 -0
  127. package/src/components/splitter/splitter.style.js +100 -0
  128. package/src/components/status-bar/status-bar.changelog.md +25 -0
  129. package/src/components/status-bar/status-bar.define.js +3 -0
  130. package/src/components/status-bar/status-bar.js +74 -0
  131. package/src/components/status-bar/status-bar.readme.md +139 -0
  132. package/src/components/status-bar/status-bar.style.js +122 -0
  133. package/src/components/tab-group/tab-group.changelog.md +7 -0
  134. package/src/components/tab-group/tab-group.js +30 -9
  135. package/src/components/tab-group/tab-group.readme.md +14 -0
  136. package/src/components/textarea-field/textarea-field.changelog.md +6 -0
  137. package/src/components/textarea-field/textarea-field.js +14 -1
  138. package/src/components/textarea-field/textarea-field.readme.md +23 -1
  139. package/src/components/toast/toast.changelog.md +6 -0
  140. package/src/components/toast/toast.readme.md +5 -3
  141. package/src/components/toast/toast.style.js +22 -6
  142. package/src/components/toolbar/toolbar.changelog.md +24 -0
  143. package/src/components/toolbar/toolbar.define.js +3 -0
  144. package/src/components/toolbar/toolbar.js +233 -0
  145. package/src/components/toolbar/toolbar.readme.md +156 -0
  146. package/src/components/toolbar/toolbar.style.js +49 -0
  147. package/src/components/tooltip/tooltip.changelog.md +11 -0
  148. package/src/components/tooltip/tooltip.js +51 -4
  149. package/src/components/tooltip/tooltip.readme.md +26 -1
  150. package/src/components/tree/tree.changelog.md +23 -0
  151. package/src/components/tree/tree.define.js +3 -0
  152. package/src/components/tree/tree.js +138 -0
  153. package/src/components/tree/tree.readme.md +119 -0
  154. package/src/components/tree/tree.style.js +16 -0
  155. package/src/components/tree-item/tree-item.changelog.md +23 -0
  156. package/src/components/tree-item/tree-item.define.js +3 -0
  157. package/src/components/tree-item/tree-item.events.js +3 -0
  158. package/src/components/tree-item/tree-item.js +246 -0
  159. package/src/components/tree-item/tree-item.readme.md +128 -0
  160. package/src/components/tree-item/tree-item.style.js +226 -0
  161. package/src/styles/appearance.style.js +47 -0
  162. package/src/styles/choice-group.style.js +27 -1
  163. package/src/styles/input-control.style.js +87 -0
  164. package/src/styles/modal.style.js +14 -1
  165. package/src/styles/native.css +100 -0
  166. package/src/styles/size.style.js +41 -0
  167. package/src/utils/floating.js +15 -1
  168. package/src/utils/focus.js +69 -0
  169. package/src/utils/options.js +35 -0
  170. package/src/utils/scroll.js +24 -0
  171. package/src/utils/text-entry-attributes.js +13 -0
  172. package/types/all.d.ts +16 -0
  173. package/types/src/components/accordion/accordion.d.ts +3 -1
  174. package/types/src/components/app-bar/app-bar.d.ts +43 -0
  175. package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
  176. package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
  177. package/types/src/components/app-frame/app-frame.d.ts +497 -0
  178. package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
  179. package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
  180. package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
  181. package/types/src/components/button/button.d.ts +61 -0
  182. package/types/src/components/button/button.events.d.ts +4 -0
  183. package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +5 -2
  184. package/types/src/components/combobox-field/combobox-field.d.ts +10 -0
  185. package/types/src/components/date-field/date-field.d.ts +10 -0
  186. package/types/src/components/description-list/description-list.d.ts +34 -0
  187. package/types/src/components/description-list/description-list.define.d.ts +1 -0
  188. package/types/src/components/description-list/description-list.style.d.ts +2 -0
  189. package/types/src/components/file-field/file-field.d.ts +68 -3
  190. package/types/src/components/form-field/form-field.d.ts +1 -1
  191. package/types/src/components/input-field/input-field.d.ts +99 -0
  192. package/types/src/components/list/list.d.ts +41 -0
  193. package/types/src/components/list/list.define.d.ts +1 -0
  194. package/types/src/components/list/list.style.d.ts +2 -0
  195. package/types/src/components/list-item/list-item.d.ts +64 -0
  196. package/types/src/components/list-item/list-item.define.d.ts +1 -0
  197. package/types/src/components/list-item/list-item.style.d.ts +2 -0
  198. package/types/src/components/menu/menu.d.ts +362 -0
  199. package/types/src/components/menu/menu.define.d.ts +1 -0
  200. package/types/src/components/menu/menu.events.d.ts +6 -0
  201. package/types/src/components/menu/menu.style.d.ts +2 -0
  202. package/types/src/components/menu-group/menu-group.d.ts +24 -0
  203. package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
  204. package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
  205. package/types/src/components/menu-item/menu-item.d.ts +80 -0
  206. package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
  207. package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
  208. package/types/src/components/nav/nav.d.ts +103 -0
  209. package/types/src/components/nav/nav.define.d.ts +1 -0
  210. package/types/src/components/nav/nav.style.d.ts +2 -0
  211. package/types/src/components/nav-item/nav-item.d.ts +39 -0
  212. package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
  213. package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
  214. package/types/src/components/otp-field/otp-field.d.ts +10 -0
  215. package/types/src/components/pagination/pagination.d.ts +31 -2
  216. package/types/src/components/password-field/password-field.d.ts +10 -0
  217. package/types/src/components/radio-field/radio-field.d.ts +5 -2
  218. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
  219. package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
  220. package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
  221. package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
  222. package/types/src/components/splitter/splitter.d.ts +127 -0
  223. package/types/src/components/splitter/splitter.define.d.ts +1 -0
  224. package/types/src/components/splitter/splitter.events.d.ts +5 -0
  225. package/types/src/components/splitter/splitter.style.d.ts +2 -0
  226. package/types/src/components/status-bar/status-bar.d.ts +44 -0
  227. package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
  228. package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
  229. package/types/src/components/tab-group/tab-group.d.ts +17 -0
  230. package/types/src/components/textarea-field/textarea-field.d.ts +7 -0
  231. package/types/src/components/toolbar/toolbar.d.ts +96 -0
  232. package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
  233. package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
  234. package/types/src/components/tooltip/tooltip.d.ts +26 -0
  235. package/types/src/components/tree/tree.d.ts +62 -0
  236. package/types/src/components/tree/tree.define.d.ts +1 -0
  237. package/types/src/components/tree/tree.style.d.ts +2 -0
  238. package/types/src/components/tree-item/tree-item.d.ts +106 -0
  239. package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
  240. package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
  241. package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
  242. package/types/src/styles/appearance.style.d.ts +31 -0
  243. package/types/src/styles/choice-group.style.d.ts +1 -1
  244. package/types/src/styles/input-control.style.d.ts +15 -0
  245. package/types/src/styles/modal.style.d.ts +5 -0
  246. package/types/src/styles/size.style.d.ts +24 -0
  247. package/types/src/utils/floating.d.ts +11 -0
  248. package/types/src/utils/focus.d.ts +25 -0
  249. package/types/src/utils/options.d.ts +17 -0
  250. package/types/src/utils/scroll.d.ts +11 -0
  251. package/types/src/utils/text-entry-attributes.d.ts +10 -0
  252. package/web-types.json +2935 -308
@@ -0,0 +1,497 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ import Events from './app-frame.events.js';
3
+ /**
4
+ * The frame of an application: it fills what the browser shows and lays out five regions, a
5
+ * header, a footer, a navigation at the start side, an aside at the end side, and the content.
6
+ * The header and the footer stay in view, and the content scrolls between them.
7
+ *
8
+ * The frame knows regions, not what they mean. The page writes the elements that say so, the
9
+ * landmarks, and slots them: `<header slot="header">`, `<nav slot="navigation" aria-label="…">`,
10
+ * `<main id="…">`, `<aside slot="aside">`, `<footer slot="footer">`. The frame adds the layout,
11
+ * the room for the notch and the home indicator of a phone, and a link that skips to the content
12
+ * as the first stop of the Tab key. That link lies in the one landmark the frame has of its own,
13
+ * a navigation the page names (`skip-landmark-label`): content of a page belongs into a landmark.
14
+ *
15
+ * From the width `wide-from` names, the navigation and the aside are columns beside the content,
16
+ * and each scrolls on its own. Where the frame is narrow, the content and the aside are one
17
+ * column that scrolls, and the navigation does not show: it opens as a drawer from the start
18
+ * edge, from any element with `data-navigation-toggle`. The page writes the navigation once.
19
+ *
20
+ * The width is the one of the frame, and the stylesheet alone decides: a server-rendered frame
21
+ * has its layout before the script has run.
22
+ *
23
+ * `resizable` names the columns whose width the user sets by dragging their edge, an
24
+ * `el-splitter` of the frame. `navigation-size` and `aside-size` are those widths: the frame tells
25
+ * of them, and the page keeps them and gives them back.
26
+ *
27
+ * Where a browser lays its on-screen keyboard over the page, the frame is as high as what shows
28
+ * above the keyboard, and where that part is: the header stays in view, and the field the user
29
+ * types into does. That needs the script.
30
+ *
31
+ * With `status-bar-tap` a tap on the status bar of an iPhone brings the content to its top, as it
32
+ * does in an application. iOS scrolls the document for that tap and never a region, so the frame
33
+ * keeps the document scrolled by one pixel there, and hears it go back. The document snaps to
34
+ * that pixel: a script of the page that scrolls the window does not move it, and is no tap.
35
+ *
36
+ * @element el-app-frame
37
+ *
38
+ * @fires {CustomEvent<{ open: boolean }>} app-frame-navigation-toggle - Fired when the drawer of
39
+ * the navigation opens or closes, with the new state in `detail.open`.
40
+ * @fires {CustomEvent<{ region: 'navigation'|'aside', size: number }>} app-frame-resize - Fired
41
+ * with every change the user makes to the width of a column: while its edge is dragged, and
42
+ * with every key. The new width in pixels is in `detail.size`.
43
+ * @fires {CustomEvent<{ region: 'navigation'|'aside', size: number }>} app-frame-resize-end -
44
+ * Fired once the user has set a width: when the pointer lets go of the edge, and with every
45
+ * key. The width to keep is in `detail.size`.
46
+ * @fires {CustomEvent} app-frame-status-bar-tap - Fired when the user has tapped the status bar of
47
+ * an iPhone, with `status-bar-tap`. The frame scrolls its content to the top after it, unless a
48
+ * listener calls `preventDefault()`: a view whose columns scroll brings those to their tops.
49
+ *
50
+ * @slot - The content of the view: the `main` of the page, with an id for the skip link.
51
+ * @slot header - The region at the top, an app bar as a rule. Left out while it is empty.
52
+ * @slot navigation - The region at the start side, and the content of the drawer where the frame
53
+ * is narrow. Left out while it is empty.
54
+ * @slot aside - The region at the end side. Left out while it is empty.
55
+ * @slot footer - The region at the lower edge. Left out while it is empty.
56
+ *
57
+ * @csspart base - The frame: the grid of the regions.
58
+ * @csspart skip-landmark - The landmark the skip link lies in: a `<nav>`.
59
+ * @csspart skip-link - The link that skips to the content. It shows while it has the focus.
60
+ * @csspart header - The region at the top. Its surface reaches under the status bar of a phone.
61
+ * @csspart navigation - The region at the start side, where the frame is wide.
62
+ * @csspart body - The content and the aside. Where the frame is narrow, it is what scrolls.
63
+ * @csspart content - The region of the content. Where the frame is wide, it is what scrolls.
64
+ * @csspart aside - The region at the end side.
65
+ * @csspart footer - The region at the lower edge. Its surface reaches under the home indicator.
66
+ * @csspart drawer - The surface of the drawer the navigation is in where the frame is narrow.
67
+ * @csspart drawer-header - The header of that drawer, with its title and its close button.
68
+ * @csspart drawer-title - The title of that drawer.
69
+ * @csspart drawer-close-button - The close button of that drawer.
70
+ * @csspart drawer-body - The body of that drawer: the navigation of the page is in it.
71
+ * @csspart navigation-splitter - The edge of the navigation the user drags, an `el-splitter`.
72
+ * @csspart aside-splitter - The edge of the aside the user drags, an `el-splitter`.
73
+ *
74
+ * @cssproperty --el-app-frame-navigation-size - The width of the navigation where the frame is
75
+ * wide, and of its drawer where it is narrow. Default `16rem`. `auto` is the width of what is
76
+ * in it.
77
+ * @cssproperty --el-app-frame-aside-size - The width of the aside where the frame is wide.
78
+ * Default `20rem`.
79
+ * @cssproperty --el-app-frame-navigation-min-size - The least width of a navigation that is
80
+ * resizable. Default `10rem`.
81
+ * @cssproperty --el-app-frame-navigation-max-size - The greatest width of a navigation that is
82
+ * resizable. Default `min(30rem, 40cqi)`: two fifths of the width of the frame at most.
83
+ * @cssproperty --el-app-frame-aside-min-size - The least width of an aside that is resizable.
84
+ * Default `10rem`.
85
+ * @cssproperty --el-app-frame-aside-max-size - The greatest width of an aside that is resizable.
86
+ * Default `min(30rem, 40cqi)`.
87
+ *
88
+ * @cssstate navigation-open - Set while the drawer of the navigation is open.
89
+ * @cssstate keyboard - Set while an on-screen keyboard covers a part of the viewport, and the
90
+ * frame is as high as what shows above it.
91
+ *
92
+ * @property {string} skipLabel - The text of the link that skips to the content. Default
93
+ * `'Skip to content'`.
94
+ * @property {string} skipLandmarkLabel - The name of the landmark that link lies in, a
95
+ * navigation, for assistive technology. It has to differ from the names of the other
96
+ * navigations of the page. Default `'Skip link'`.
97
+ * @property {'30rem'|'40rem'|'48rem'|'64rem'|'80rem'} wideFrom - The width of the frame from
98
+ * which the navigation and the aside are columns beside the content. One of the steps the
99
+ * stylesheet knows, another value is the default. Default `'48rem'`.
100
+ * @property {string} narrowOnly - The regions that are there only where the frame is narrow, as
101
+ * their names with a space between them: `header`, `navigation`, `aside`, `footer`. A bar of
102
+ * destinations in the footer of a phone, for example (`narrow-only="footer"`). Default `''`.
103
+ * @property {string} wideOnly - The regions that are there only where the frame is wide, named
104
+ * the same way. Default `''`.
105
+ * @property {'drawer'|'bar'} narrowNavigation - What the navigation is where the frame is narrow.
106
+ * `drawer`: it does not show, and opens as a drawer. `bar`: its region lies at the lower edge,
107
+ * for an `el-nav` whose destinations are a bar there and a rail in the column of the wide
108
+ * frame. Default `'drawer'`.
109
+ * @property {boolean} navigationOpen - Whether the drawer of the navigation is open. It is one
110
+ * only where the frame is narrow: elsewhere the property is `false`. Reflected to the
111
+ * `navigation-open` attribute.
112
+ * @property {string} navigationLabel - The title of the drawer of the navigation, and its name
113
+ * for assistive technology. Default `'Navigation'`.
114
+ * @property {string} closeLabel - The name of the close button of that drawer. Default
115
+ * `'Close'`.
116
+ * @property {string} resizable - The columns whose width the user sets by dragging their edge,
117
+ * as their names with a space between them: `navigation`, `aside`. Default `''`.
118
+ * @property {number} navigationSize - The width of the navigation where the frame is wide, in
119
+ * pixels: the one the user has set, or the one the page has kept. `0` is the width of the
120
+ * stylesheet (`--el-app-frame-navigation-size`). Default `0`.
121
+ * @property {number} asideSize - The width of the aside where the frame is wide, in pixels. `0`
122
+ * is the width of the stylesheet (`--el-app-frame-aside-size`). Default `0`.
123
+ * @property {string} asideLabel - The name of the aside for assistive technology, on the edge
124
+ * that sizes it. The edge of the navigation has `navigation-label`. Default `'Aside'`.
125
+ * @property {boolean} statusBarTap - Whether a tap on the status bar of an iPhone brings the
126
+ * content to its top. The document of the page is one pixel higher than the viewport then, and
127
+ * snaps to that pixel. Default `false`.
128
+ */
129
+ export default class AppFrame extends TemplateElement {
130
+ navigationOpen: boolean;
131
+ asideSize: number;
132
+ navigationSize: number;
133
+ /**
134
+ * Tells of every change of a size: of the frame, which can make it wide or narrow, and of a
135
+ * region, which can make it scroll or stop it from scrolling.
136
+ * @private
137
+ * @type {ResizeObserver | undefined}
138
+ */
139
+ private _resizeObserver;
140
+ /**
141
+ * Whether the navigation is in a drawer: the frame is narrow, and has a navigation there.
142
+ * Only the script knows, so a server and the first render in the browser have the region.
143
+ * @private
144
+ */
145
+ private _inDrawer;
146
+ /**
147
+ * What the frame has said of its drawer last, so it says a change once.
148
+ * @private
149
+ */
150
+ private _saidOpen;
151
+ /**
152
+ * Whether the script has started. The edges to drag are there from then on: they do nothing
153
+ * before, and a server leaves them out.
154
+ * @private
155
+ */
156
+ private _started;
157
+ /**
158
+ * The height of what scrolls the content, as it was last: a field the user types into is
159
+ * brought back into view when that height gets less.
160
+ * @private
161
+ */
162
+ private _scrollerSize;
163
+ /**
164
+ * Whether an on-screen keyboard covers a part of the viewport, as the frame has said last
165
+ * (`:state(keyboard)`). Kept here, and not read back from the states of the element: WebKit
166
+ * forgets what was added to them a moment later (`states.has()` is `false`), while the state
167
+ * still matches.
168
+ * @private
169
+ */
170
+ private _keyboard;
171
+ /**
172
+ * Tells of a visual viewport that changes: an on-screen keyboard that comes or goes, or the
173
+ * page that the browser moves behind it.
174
+ * @private
175
+ * @param {Event} event
176
+ */
177
+ private _onViewport;
178
+ /**
179
+ * What the frame keeps while it listens for a tap on the status bar: the element that makes
180
+ * the document one pixel higher than the viewport, whether the document snaps to that pixel
181
+ * and what the page had in the place of that rule, whether a script can move the document all
182
+ * the same, how many fingers are on the screen, until when a scroll of the document is
183
+ * somebody else's, whether the document is scrolling and when it was last heard of, when the
184
+ * frame has put it on its pixel last, and the timer that does so.
185
+ * @private
186
+ * @type {{ sentinel: HTMLElement, snaps: boolean, snapBefore: string, held: boolean, touches: number, dragged: boolean, quietUntil: number, scrolling: boolean, scrolledAt: number, armedAt: number, timer: number } | undefined}
187
+ */
188
+ private _statusBar;
189
+ /** @private */
190
+ private _onDocumentScroll;
191
+ /**
192
+ * The scroll of the document is over: it can have its pixel back.
193
+ * @private
194
+ */
195
+ private _onDocumentScrollEnd;
196
+ /**
197
+ * A finger has come or gone. One that has dragged the document, from the header or the
198
+ * footer, leaves a page that swings back: for that moment a scroll is not a tap. One that has
199
+ * scrolled the content has moved no document, and a tap right after it counts.
200
+ * @private
201
+ * @param {TouchEvent} event
202
+ */
203
+ private _onTouch;
204
+ /**
205
+ * A wheel or a key: over the header they scroll the document, as the tap does.
206
+ * @private
207
+ */
208
+ private _onInput;
209
+ constructor();
210
+ properties(): {
211
+ skipLabel: string;
212
+ skipLandmarkLabel: string;
213
+ wideFrom: string;
214
+ narrowOnly: string;
215
+ wideOnly: string;
216
+ narrowNavigation: string;
217
+ navigationOpen: boolean;
218
+ navigationLabel: string;
219
+ closeLabel: string;
220
+ resizable: string;
221
+ navigationSize: number;
222
+ asideSize: number;
223
+ asideLabel: string;
224
+ statusBarTap: boolean;
225
+ };
226
+ connected(): void;
227
+ disconnected(): void;
228
+ afterUpdate(): void;
229
+ watch(): {
230
+ narrowNavigation: () => void;
231
+ wideOnly: () => void;
232
+ statusBarTap: () => void;
233
+ navigationOpen: () => void;
234
+ };
235
+ events(): {
236
+ this: {
237
+ click: (event: any) => void;
238
+ };
239
+ "[part~='base']": {
240
+ slotchange: () => void;
241
+ };
242
+ "[part~='skip-link']": {
243
+ click: (event: any) => void;
244
+ };
245
+ 'el-drawer': {
246
+ 'drawer-show': (event: any) => any;
247
+ 'drawer-after-show': (event: any) => any;
248
+ 'drawer-initial-focus': (event: any) => any;
249
+ 'drawer-request-close': (event: any) => any;
250
+ 'drawer-hide': (event: any) => void;
251
+ 'drawer-after-hide': (event: any) => any;
252
+ };
253
+ 'el-splitter': {
254
+ 'splitter-resize': (event: any) => void;
255
+ 'splitter-resize-end': (event: any) => void;
256
+ };
257
+ };
258
+ /**
259
+ * Whether the frame is wide: the navigation, the content and the aside are beside each other.
260
+ * The stylesheet decides, by the width of the frame and its `wide-from`; this reads what it
261
+ * has decided, so the width is written in one place.
262
+ * @returns {boolean}
263
+ */
264
+ get wide(): boolean;
265
+ /**
266
+ * The element that scrolls the content: the region of the content where the frame is wide,
267
+ * the column of the content and the aside where it is narrow. For a page that sets the scroll
268
+ * back after a change of the view, or brings a position back. The window does not scroll in a
269
+ * frame.
270
+ * @returns {HTMLElement | undefined}
271
+ */
272
+ get scroller(): HTMLElement | undefined;
273
+ /**
274
+ * The element of the page the skip link leads to: its `main`, or the first element that is in
275
+ * no named slot.
276
+ * @private
277
+ * @returns {Element | undefined}
278
+ */
279
+ private _content;
280
+ /**
281
+ * The names of regions in an attribute of the page, and nothing else.
282
+ * @private
283
+ * @param {string} names
284
+ * @returns {string[]}
285
+ */
286
+ private _regionsOf;
287
+ /**
288
+ * The columns the page lets the user size.
289
+ * @private
290
+ * @returns {string[]}
291
+ */
292
+ private _resizable;
293
+ /**
294
+ * An edge says the width of its column, and the least and the greatest one. The stylesheet
295
+ * has them, in any unit, and the edge needs pixels: they are read from the column as it is
296
+ * laid out. A limit that is no length there, a percentage, is none for the edge. The
297
+ * stylesheet keeps it all the same, and the width is read again after every change.
298
+ * @private
299
+ */
300
+ private _syncEdges;
301
+ /**
302
+ * The user has moved an edge: the column takes the width, and the frame tells of it in its
303
+ * own words.
304
+ * @private
305
+ * @param {CustomEvent<{ value: number }>} event
306
+ * @param {string} name - The event of the frame.
307
+ */
308
+ private _onResize;
309
+ /**
310
+ * A browser that lays its on-screen keyboard over the page leaves the layout as it is: the
311
+ * frame is as high as the viewport, and its lower part is under the keyboard. To show the
312
+ * field the user types into, the browser moves the page up behind the keyboard, and the
313
+ * header leaves the screen with it.
314
+ *
315
+ * The visual viewport is what shows. While it is less high than the layout by more than a
316
+ * scrollbar, and the user types into something, the frame takes its place and its height:
317
+ * the header is at the top of what shows, the footer above the keyboard, and the content
318
+ * scrolls between them. The browser tells of the viewport once it has moved it, so for the
319
+ * moment the keyboard comes in the regions are on their way.
320
+ *
321
+ * A viewport that shows less is no keyboard by itself. Safari on iOS makes the visual
322
+ * viewport less high while a finger pulls the page past its top, by the length of the pull
323
+ * and with the numbers of a keyboard. A keyboard is there for a field, so the frame takes
324
+ * one that has the focus for the sign.
325
+ *
326
+ * Only a frame that fills the viewport follows, and not while the user has zoomed in: what
327
+ * shows is a part of the page then, by the will of the user.
328
+ * @private
329
+ */
330
+ private _syncViewport;
331
+ /**
332
+ * Whether the user types into something: a field or a text they edit has the focus, in the
333
+ * page or in a shadow root that is open, or a frame with another page has it, which keeps
334
+ * to itself what has the focus in it. An on-screen keyboard is there for one of these.
335
+ * @private
336
+ * @returns {boolean}
337
+ */
338
+ private _isTyping;
339
+ /**
340
+ * Whether the frame listens for a tap on the status bar: the page asks for it, the frame
341
+ * fills the viewport, and the browser is one of iOS, which has that tap and nothing that
342
+ * tells of it. `-webkit-touch-callout` is a property only its WebKit knows.
343
+ * @private
344
+ * @returns {boolean}
345
+ */
346
+ private _wantsStatusBarTap;
347
+ /**
348
+ * Starts or stops listening for a tap on the status bar.
349
+ *
350
+ * iOS scrolls the document to its top for that tap, and a frame leaves the document nothing
351
+ * to scroll. So an element makes the document one pixel higher than what the browser shows,
352
+ * and the document rests scrolled down by that pixel: it snaps there. The frame is fixed to
353
+ * the viewport and does not move with it. A tap takes the document back to zero, past the
354
+ * snap, which the frame hears.
355
+ * @private
356
+ */
357
+ private _syncStatusBar;
358
+ /**
359
+ * Makes the document snap to its one pixel, or lets it go.
360
+ *
361
+ * What snaps is where a scroll ends, also the one of a script: `window.scrollTo(0, 0)` of a
362
+ * router leaves the document on its pixel. And a finger that has dragged the page lets it go
363
+ * back there. The tap on the status bar is the one scroll iOS does not snap.
364
+ *
365
+ * The rule is one for the element of the document, the only place the browser reads it for
366
+ * the viewport: the frame writes it there, and puts back what the page had.
367
+ * @private
368
+ * @param {boolean} on
369
+ */
370
+ private _snap;
371
+ /**
372
+ * From now on, for a moment, a scroll of the document is not the doing of a tap on the status
373
+ * bar: a finger drags the page, a keyboard moves it, the phone is turned.
374
+ * @private
375
+ */
376
+ private _quiet;
377
+ /**
378
+ * Whether something else than a tap on the status bar is moving the document.
379
+ * @private
380
+ * @returns {boolean}
381
+ */
382
+ private _isMoved;
383
+ /**
384
+ * Whether the document is scrolling: it has scrolled, and the browser has not said that this
385
+ * is over. A browser that never says so is given the time the longest scroll takes.
386
+ * @private
387
+ * @returns {boolean}
388
+ */
389
+ private _isScrolling;
390
+ /**
391
+ * Scrolls the document down by its one pixel, once nothing else moves it and its scroll is
392
+ * over: iOS takes the document back to the top for as long as it is on its way there. Until
393
+ * then it looks again: a finger can stay on the screen for long.
394
+ *
395
+ * And it asks what tells the tap from a script: whether a script can scroll the document to
396
+ * zero. Where the browser snaps the scroll of a script, it cannot. Where it can, the two look
397
+ * the same, and the frame takes no scroll for the tap.
398
+ * @private
399
+ */
400
+ private _arm;
401
+ /**
402
+ * The document has scrolled. At zero, with nothing else that moves it, the user has tapped
403
+ * the status bar: the content goes to its top, as the document of a page would.
404
+ *
405
+ * A script of the page does not get the document there, a router that sets the scroll of the
406
+ * window back after a change of the view for one: the document snaps to its pixel.
407
+ * @private
408
+ */
409
+ private _onStatusBarScroll;
410
+ /**
411
+ * The regions have changed their sizes. Where what scrolls the content got less high, a
412
+ * keyboard has come in or the window got smaller, and the field the user types into may be
413
+ * out of view now.
414
+ * @private
415
+ */
416
+ private _syncFocus;
417
+ /**
418
+ * Brings the field the user types into back into view, in the region that scrolls it. A
419
+ * field in a dialog or a popover is in the top layer and in no region: the browser shows it.
420
+ * @private
421
+ */
422
+ private _showFocus;
423
+ /**
424
+ * Takes what the stylesheet has decided: where the frame is narrow and has a navigation
425
+ * there, the navigation is in a drawer. Where it is wide again, the drawer goes, open or
426
+ * not: the platform takes a dialog that leaves the page out of the top layer, and the drawer
427
+ * gives the scroll of the page back.
428
+ * @private
429
+ */
430
+ private _syncView;
431
+ /**
432
+ * The elements of the page that open and close the navigation.
433
+ * @private
434
+ * @returns {HTMLElement[]}
435
+ */
436
+ private _toggles;
437
+ /**
438
+ * A toggle says whether the navigation is open, and is not there where there is no drawer to
439
+ * open. An `el-button` reads that from the stylesheet of the frame, before the script has
440
+ * run; any other element is hidden here.
441
+ * @private
442
+ */
443
+ private _syncToggles;
444
+ /**
445
+ * A click on a toggle opens or closes the drawer. A click on a link in the open drawer closes
446
+ * it: the user has chosen where to go, also where the page changes the view without loading.
447
+ * @private
448
+ * @param {MouseEvent} event
449
+ */
450
+ private _onClick;
451
+ /**
452
+ * The regions that can scroll, each with the elements of the page that are in it.
453
+ * @private
454
+ * @returns {Array<[HTMLElement, Element[]]>}
455
+ */
456
+ private _regions;
457
+ /**
458
+ * Watches the sizes of the frame, of the regions and of what the page has put into them.
459
+ * @private
460
+ */
461
+ private _observeSizes;
462
+ /**
463
+ * A region that scrolls and has nothing in it that takes the focus is a stop of the Tab key
464
+ * itself: without one the keyboard cannot scroll it. Some browsers do that by themselves, and
465
+ * this does it for the others.
466
+ * @private
467
+ */
468
+ private _syncTabStops;
469
+ /**
470
+ * After the skip link the content is in view from its start, the keys scroll it, and the Tab
471
+ * key goes on inside of it: the region of the content has the focus.
472
+ *
473
+ * The link is a link to the id of the content, which a browser follows before the script has
474
+ * run. From then on the script does the same and leaves the address alone: a page that keeps
475
+ * its route in the fragment would lose it.
476
+ * @private
477
+ * @param {MouseEvent} event
478
+ */
479
+ private _onSkip;
480
+ /**
481
+ * The navigation: a region of the frame, or the content of a drawer where the frame is
482
+ * narrow. One slot either way, so the page writes the navigation once and no node is moved.
483
+ * @private
484
+ */
485
+ private navigationTemplate;
486
+ /**
487
+ * The edge of a column the user drags: an `el-splitter` at the side that faces the content.
488
+ * Only where the page asks for it, the column is there, and the script runs. Where the
489
+ * navigation is a drawer, it has no edge.
490
+ * @private
491
+ * @param {'navigation'|'aside'} region
492
+ */
493
+ private edgeTemplate;
494
+ template(): any;
495
+ }
496
+ export declare function define(): void;
497
+ export { Events };
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ NAVIGATION_TOGGLE: string;
3
+ RESIZE: string;
4
+ RESIZE_END: string;
5
+ STATUS_BAR_TAP: string;
6
+ };
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The widths from which a frame can be wide. A stylesheet cannot read the width of a query from a
3
+ * custom property, so there is a query per step, and the frame names the one that counts.
4
+ */
5
+ export declare const STEPS: string[];
6
+ export declare const DEFAULT_STEP = "48rem";
7
+ declare const _default: string;
8
+ export default _default;
@@ -1,4 +1,5 @@
1
1
  import { TemplateElement } from '@webtides/element-js';
2
+ import Events from './button.events.js';
2
3
  /**
3
4
  * A themeable button that renders a native `<button>` — or an `<a>` when `href` is set — and
4
5
  * decorates it with the `--el-*` design tokens. Speaks the library's shared vocabulary: a semantic
@@ -21,8 +22,18 @@ import { TemplateElement } from '@webtides/element-js';
21
22
  * what they do on a native button. A `click` listener of the page that calls `preventDefault()`
22
23
  * keeps the button from submitting or resetting.
23
24
  *
25
+ * In a container that gives its controls a size and an appearance, an `el-toolbar`, the button
26
+ * takes them from it, while the page has not set `size` or `appearance` on the button itself.
27
+ *
28
+ * With `toggle` the button stays pressed: a click flips `pressed`, the control says so to assistive
29
+ * technology (`aria-pressed`), and the button shows it. A `click` listener of the page that calls
30
+ * `preventDefault()` keeps the button from flipping, as it keeps it from submitting.
31
+ *
24
32
  * @element el-button
25
33
  *
34
+ * @fires {CustomEvent<{ pressed: boolean }>} button-toggle - Fired when a click has flipped a
35
+ * toggle button. `detail.pressed` is the new state. Not fired when `pressed` is set from a script.
36
+ *
26
37
  * @slot - The button's label.
27
38
  * @slot prefix - A presentational prefix icon or similar element.
28
39
  * @slot suffix - A presentational suffix icon or similar element.
@@ -47,6 +58,10 @@ import { TemplateElement } from '@webtides/element-js';
47
58
  * @property {boolean} loading - Shows a spinner and blocks interaction.
48
59
  * @property {boolean} disabled - Disables the button. Reflected to the `disabled` attribute, which is
49
60
  * there while the button is disabled and gone while it is not.
61
+ * @property {boolean} toggle - The button is a toggle button: it stays pressed. A click flips
62
+ * `pressed`, and the control has `aria-pressed`. Ignored when `href` is set. Default `false`.
63
+ * @property {boolean} pressed - Whether a toggle button is pressed. Reflected to the `pressed`
64
+ * attribute of a toggle button. Without `toggle` it does nothing. Default `false`.
50
65
  * @property {'button'|'submit'|'reset'} type - Behaviour when activated. `submit` / `reset` act on
51
66
  * the form of the button: the nearest ancestor `<form>`, or the one its `form` attribute names.
52
67
  * Ignored when `href` is set. Default `'button'`.
@@ -60,6 +75,7 @@ import { TemplateElement } from '@webtides/element-js';
60
75
  */
61
76
  export default class Button extends TemplateElement {
62
77
  disabled: boolean;
78
+ pressed: boolean;
63
79
  /**
64
80
  * The platform tells a form-associated element when a `<fieldset disabled>` around it disables
65
81
  * it, and resolves its `form` attribute.
@@ -78,6 +94,17 @@ export default class Button extends TemplateElement {
78
94
  * @type {Node | undefined}
79
95
  */
80
96
  private _keydownRoot;
97
+ /**
98
+ * Which of `size` and `appearance` the page has set on the button itself, see `_isOwn()`.
99
+ * @private
100
+ * @type {Set<string> | undefined}
101
+ */
102
+ private _ownLook;
103
+ /**
104
+ * Whether the button is writing a property to its attribute right now, see `reflectProperty()`.
105
+ * @private
106
+ */
107
+ private _reflecting;
81
108
  constructor();
82
109
  properties(): {
83
110
  variant: string;
@@ -88,6 +115,8 @@ export default class Button extends TemplateElement {
88
115
  caret: boolean;
89
116
  loading: boolean;
90
117
  disabled: boolean;
118
+ toggle: boolean;
119
+ pressed: boolean;
91
120
  type: string;
92
121
  name: string;
93
122
  value: string;
@@ -96,8 +125,31 @@ export default class Button extends TemplateElement {
96
125
  rel: string;
97
126
  download: string;
98
127
  };
128
+ connectedCallback(): void;
129
+ /**
130
+ * Whether the page has given the button a `size` or an `appearance` of its own. A button
131
+ * without one takes it from a container that gives one to its controls, a toolbar. The
132
+ * template marks the control with the answer, and the stylesheet reads the mark.
133
+ *
134
+ * On the server no attribute has been written by the element: the ones that are there are
135
+ * the ones of the page.
136
+ * @private
137
+ * @param {'size' | 'appearance'} name
138
+ * @returns {boolean}
139
+ */
140
+ private _isOwn;
99
141
  /** Whether the button renders as a link rather than a native button. */
100
142
  get isLink(): boolean;
143
+ /**
144
+ * Whether the button is a toggle button: one that stays pressed. A link leads somewhere, it
145
+ * has no state to stay in.
146
+ */
147
+ get isToggle(): boolean;
148
+ watch(): {
149
+ toggle: () => void;
150
+ size: () => Set<string>;
151
+ appearance: () => Set<string>;
152
+ };
101
153
  /**
102
154
  * An ARIA attribute of the element, or one it shares with a native submit button, was set,
103
155
  * changed or removed. They are no properties of the component: the template and the submit
@@ -124,6 +176,14 @@ export default class Button extends TemplateElement {
124
176
  property: string;
125
177
  newValue: unknown;
126
178
  }): void;
179
+ /**
180
+ * `pressed` is the attribute of a toggle button: `"true"` or `"false"`, so that the page can
181
+ * read the state and select by it. On a button that is no toggle the attribute says nothing,
182
+ * and the element does not write it there.
183
+ * @private
184
+ * @param {unknown} pressed
185
+ */
186
+ private _reflectPressed;
127
187
  afterUpdate(): void;
128
188
  disconnected(): void;
129
189
  /**
@@ -215,3 +275,4 @@ export default class Button extends TemplateElement {
215
275
  template(): any;
216
276
  }
217
277
  export declare function define(): void;
278
+ export { Events };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ TOGGLE: string;
3
+ };
4
+ export default _default;
@@ -18,9 +18,12 @@ import FormField from '../form-field/form-field.js';
18
18
  *
19
19
  * @property {string[]} value - The values of the checked options, in the order of the options. As
20
20
  * an attribute it is JSON: `value='["news", "offers"]'`.
21
- * @property {Array<string | { value: string, label?: string, disabled?: boolean }>} options -
21
+ * @property {Array<string | { value: string, label?: string, disabled?: boolean, color?: string, icon?: string }>} options -
22
22
  * Options to render. Accepts plain strings (`['News', 'Offers']`) or option objects
23
- * (`[{ value, label, disabled? }]`). Strings are used as both value and label.
23
+ * (`[{ value, label, disabled? }]`). Strings are used as both value and label. An object can
24
+ * name a `color`, which is drawn as a dot in front of the label, and an `icon`, the address of
25
+ * an SVG symbol (`'#tag'`, `'/icons.svg#tag'`), which is drawn there as well. Both are
26
+ * decorations: the label stays the name of the option.
24
27
  * @property {boolean} required - Whether at least one option has to be checked.
25
28
  */
26
29
  export default class CheckboxGroupField extends FormField {