@webtides/element-library 0.3.1 → 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 (195) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/README.md +72 -56
  3. package/all.js +16 -0
  4. package/catalog.js +17 -1
  5. package/custom-elements.json +14723 -10220
  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 +15 -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 +161 -7
  27. package/src/components/description-list/description-list.changelog.md +25 -0
  28. package/src/components/description-list/description-list.define.js +3 -0
  29. package/src/components/description-list/description-list.js +44 -0
  30. package/src/components/description-list/description-list.readme.md +135 -0
  31. package/src/components/description-list/description-list.style.js +140 -0
  32. package/src/components/dialog/dialog.changelog.md +7 -0
  33. package/src/components/dialog/dialog.readme.md +5 -0
  34. package/src/components/dialog/dialog.style.js +17 -2
  35. package/src/components/drawer/drawer.changelog.md +7 -0
  36. package/src/components/drawer/drawer.readme.md +7 -6
  37. package/src/components/drawer/drawer.style.js +35 -2
  38. package/src/components/dropdown/dropdown.readme.md +6 -1
  39. package/src/components/list/list.changelog.md +24 -0
  40. package/src/components/list/list.define.js +3 -0
  41. package/src/components/list/list.js +66 -0
  42. package/src/components/list/list.readme.md +122 -0
  43. package/src/components/list/list.style.js +56 -0
  44. package/src/components/list-item/list-item.changelog.md +24 -0
  45. package/src/components/list-item/list-item.define.js +3 -0
  46. package/src/components/list-item/list-item.js +128 -0
  47. package/src/components/list-item/list-item.readme.md +126 -0
  48. package/src/components/list-item/list-item.style.js +234 -0
  49. package/src/components/menu/menu.changelog.md +27 -0
  50. package/src/components/menu/menu.define.js +3 -0
  51. package/src/components/menu/menu.events.js +5 -0
  52. package/src/components/menu/menu.js +570 -0
  53. package/src/components/menu/menu.readme.md +272 -0
  54. package/src/components/menu/menu.style.js +55 -0
  55. package/src/components/menu-group/menu-group.changelog.md +20 -0
  56. package/src/components/menu-group/menu-group.define.js +3 -0
  57. package/src/components/menu-group/menu-group.js +44 -0
  58. package/src/components/menu-group/menu-group.readme.md +74 -0
  59. package/src/components/menu-group/menu-group.style.js +38 -0
  60. package/src/components/menu-item/menu-item.changelog.md +24 -0
  61. package/src/components/menu-item/menu-item.define.js +3 -0
  62. package/src/components/menu-item/menu-item.js +130 -0
  63. package/src/components/menu-item/menu-item.readme.md +94 -0
  64. package/src/components/menu-item/menu-item.style.js +87 -0
  65. package/src/components/nav/nav.changelog.md +35 -0
  66. package/src/components/nav/nav.define.js +3 -0
  67. package/src/components/nav/nav.js +212 -0
  68. package/src/components/nav/nav.readme.md +248 -0
  69. package/src/components/nav/nav.style.js +269 -0
  70. package/src/components/nav-item/nav-item.changelog.md +25 -0
  71. package/src/components/nav-item/nav-item.define.js +3 -0
  72. package/src/components/nav-item/nav-item.js +75 -0
  73. package/src/components/nav-item/nav-item.readme.md +111 -0
  74. package/src/components/nav-item/nav-item.style.js +159 -0
  75. package/src/components/pagination/pagination.changelog.md +8 -0
  76. package/src/components/pagination/pagination.js +123 -49
  77. package/src/components/pagination/pagination.readme.md +24 -6
  78. package/src/components/pagination/pagination.style.js +11 -1
  79. package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
  80. package/src/components/scroll-to-top/scroll-to-top.js +16 -12
  81. package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
  82. package/src/components/segmented-field/segmented-field.changelog.md +27 -0
  83. package/src/components/segmented-field/segmented-field.define.js +3 -0
  84. package/src/components/segmented-field/segmented-field.js +175 -0
  85. package/src/components/segmented-field/segmented-field.readme.md +140 -0
  86. package/src/components/segmented-field/segmented-field.style.js +193 -0
  87. package/src/components/splitter/splitter.changelog.md +24 -0
  88. package/src/components/splitter/splitter.define.js +3 -0
  89. package/src/components/splitter/splitter.events.js +4 -0
  90. package/src/components/splitter/splitter.js +237 -0
  91. package/src/components/splitter/splitter.readme.md +164 -0
  92. package/src/components/splitter/splitter.style.js +100 -0
  93. package/src/components/status-bar/status-bar.changelog.md +25 -0
  94. package/src/components/status-bar/status-bar.define.js +3 -0
  95. package/src/components/status-bar/status-bar.js +74 -0
  96. package/src/components/status-bar/status-bar.readme.md +139 -0
  97. package/src/components/status-bar/status-bar.style.js +122 -0
  98. package/src/components/tab-group/tab-group.changelog.md +7 -0
  99. package/src/components/tab-group/tab-group.js +30 -9
  100. package/src/components/tab-group/tab-group.readme.md +14 -0
  101. package/src/components/toast/toast.changelog.md +6 -0
  102. package/src/components/toast/toast.readme.md +5 -3
  103. package/src/components/toast/toast.style.js +22 -6
  104. package/src/components/toolbar/toolbar.changelog.md +24 -0
  105. package/src/components/toolbar/toolbar.define.js +3 -0
  106. package/src/components/toolbar/toolbar.js +233 -0
  107. package/src/components/toolbar/toolbar.readme.md +156 -0
  108. package/src/components/toolbar/toolbar.style.js +49 -0
  109. package/src/components/tooltip/tooltip.changelog.md +11 -0
  110. package/src/components/tooltip/tooltip.js +51 -4
  111. package/src/components/tooltip/tooltip.readme.md +26 -1
  112. package/src/components/tree/tree.changelog.md +23 -0
  113. package/src/components/tree/tree.define.js +3 -0
  114. package/src/components/tree/tree.js +138 -0
  115. package/src/components/tree/tree.readme.md +119 -0
  116. package/src/components/tree/tree.style.js +16 -0
  117. package/src/components/tree-item/tree-item.changelog.md +23 -0
  118. package/src/components/tree-item/tree-item.define.js +3 -0
  119. package/src/components/tree-item/tree-item.events.js +3 -0
  120. package/src/components/tree-item/tree-item.js +246 -0
  121. package/src/components/tree-item/tree-item.readme.md +128 -0
  122. package/src/components/tree-item/tree-item.style.js +226 -0
  123. package/src/styles/appearance.style.js +47 -0
  124. package/src/styles/choice-group.style.js +1 -1
  125. package/src/styles/modal.style.js +14 -1
  126. package/src/styles/size.style.js +41 -0
  127. package/src/utils/focus.js +69 -0
  128. package/src/utils/scroll.js +24 -0
  129. package/types/all.d.ts +16 -0
  130. package/types/src/components/accordion/accordion.d.ts +3 -1
  131. package/types/src/components/app-bar/app-bar.d.ts +43 -0
  132. package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
  133. package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
  134. package/types/src/components/app-frame/app-frame.d.ts +491 -0
  135. package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
  136. package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
  137. package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
  138. package/types/src/components/button/button.d.ts +61 -0
  139. package/types/src/components/button/button.events.d.ts +4 -0
  140. package/types/src/components/description-list/description-list.d.ts +29 -0
  141. package/types/src/components/description-list/description-list.define.d.ts +1 -0
  142. package/types/src/components/description-list/description-list.style.d.ts +2 -0
  143. package/types/src/components/list/list.d.ts +39 -0
  144. package/types/src/components/list/list.define.d.ts +1 -0
  145. package/types/src/components/list/list.style.d.ts +2 -0
  146. package/types/src/components/list-item/list-item.d.ts +62 -0
  147. package/types/src/components/list-item/list-item.define.d.ts +1 -0
  148. package/types/src/components/list-item/list-item.style.d.ts +2 -0
  149. package/types/src/components/menu/menu.d.ts +266 -0
  150. package/types/src/components/menu/menu.define.d.ts +1 -0
  151. package/types/src/components/menu/menu.events.d.ts +6 -0
  152. package/types/src/components/menu/menu.style.d.ts +2 -0
  153. package/types/src/components/menu-group/menu-group.d.ts +24 -0
  154. package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
  155. package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
  156. package/types/src/components/menu-item/menu-item.d.ts +59 -0
  157. package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
  158. package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
  159. package/types/src/components/nav/nav.d.ts +103 -0
  160. package/types/src/components/nav/nav.define.d.ts +1 -0
  161. package/types/src/components/nav/nav.style.d.ts +2 -0
  162. package/types/src/components/nav-item/nav-item.d.ts +39 -0
  163. package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
  164. package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
  165. package/types/src/components/pagination/pagination.d.ts +31 -2
  166. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
  167. package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
  168. package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
  169. package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
  170. package/types/src/components/splitter/splitter.d.ts +127 -0
  171. package/types/src/components/splitter/splitter.define.d.ts +1 -0
  172. package/types/src/components/splitter/splitter.events.d.ts +5 -0
  173. package/types/src/components/splitter/splitter.style.d.ts +2 -0
  174. package/types/src/components/status-bar/status-bar.d.ts +44 -0
  175. package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
  176. package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
  177. package/types/src/components/tab-group/tab-group.d.ts +17 -0
  178. package/types/src/components/toolbar/toolbar.d.ts +96 -0
  179. package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
  180. package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
  181. package/types/src/components/tooltip/tooltip.d.ts +26 -0
  182. package/types/src/components/tree/tree.d.ts +62 -0
  183. package/types/src/components/tree/tree.define.d.ts +1 -0
  184. package/types/src/components/tree/tree.style.d.ts +2 -0
  185. package/types/src/components/tree-item/tree-item.d.ts +106 -0
  186. package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
  187. package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
  188. package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
  189. package/types/src/styles/appearance.style.d.ts +31 -0
  190. package/types/src/styles/choice-group.style.d.ts +1 -1
  191. package/types/src/styles/modal.style.d.ts +5 -0
  192. package/types/src/styles/size.style.d.ts +24 -0
  193. package/types/src/utils/focus.d.ts +25 -0
  194. package/types/src/utils/scroll.d.ts +11 -0
  195. package/web-types.json +2530 -393
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ TOGGLE: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * Rows of a name and its value, for a settings page or the page of an entry: the address, the
4
+ * plan, the day it was created. The element is the native `<dl>`; the page writes the names as
5
+ * `<dt>` and the values as `<dd>` into it, as it would into a `<dl>`.
6
+ *
7
+ * In a narrow place a name stands above its value. From a width of 30rem, which the list measures
8
+ * on itself, the two stand side by side, and the values of all rows begin on one line. A row can
9
+ * end in an action: a `<dd data-action>` with a link or a button in it.
10
+ *
11
+ * Pure presentation: the list runs no script of its own, so a server-rendered list is complete
12
+ * before the element takes over.
13
+ *
14
+ * @element el-description-list
15
+ *
16
+ * @slot - The rows: for each one a `<dt>` with the name, a `<dd>` with the value (or several),
17
+ * and, to end the row in an action, a `<dd data-action>` with a link or a button.
18
+ *
19
+ * @csspart base - The `<dl>`.
20
+ *
21
+ * @cssproperty --el-description-list-term-width - The width of the column of the names while
22
+ * names and values stand side by side. Unset, the column is as wide as the longest name, and
23
+ * 40% of the list at most.
24
+ */
25
+ export default class DescriptionList extends TemplateElement {
26
+ constructor();
27
+ template(): any;
28
+ }
29
+ export declare function define(): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * A list of rows: messages, articles, files, the entries of a settings page. The list is the
4
+ * surface and the list for assistive technology; every `el-list-item` slotted into it is one row.
5
+ * It gives its rows one density, one line between two of them and one place where their texts
6
+ * begin, whatever stands at the start of a row.
7
+ *
8
+ * Pure presentation: the list runs no script of its own, so a server-rendered list is complete
9
+ * before the element takes over.
10
+ *
11
+ * @element el-list
12
+ *
13
+ * @slot - The rows: `el-list-item` elements.
14
+ *
15
+ * @csspart base - The list (`role="list"`) and its surface.
16
+ *
17
+ * @cssproperty --el-list-padding-inline - The padding of a row at its start and its end. Unset, it
18
+ * is `--el-space-4`, and `1rem` without a theme. Read by the rows, so it can be set on the list
19
+ * or for the page.
20
+ *
21
+ * @property {string} label - The name of the list for assistive technology. Unset, the list has
22
+ * none.
23
+ * @property {'default'|'compact'} density - How much room a row has above and below its texts.
24
+ * Default `'default'`. Reflected to the `density` attribute.
25
+ * @property {'plain'|'outlined'|'filled'} appearance - How the surface is painted: not at all, so
26
+ * the list reaches from edge to edge of its place, or as a card with the background of the page
27
+ * or a muted fill, a border and round corners. Default `'plain'`. Reflected to the `appearance`
28
+ * attribute.
29
+ */
30
+ export default class List extends TemplateElement {
31
+ constructor();
32
+ properties(): {
33
+ label: string;
34
+ density: string;
35
+ appearance: string;
36
+ };
37
+ template(): any;
38
+ }
39
+ export declare function define(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,62 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * One row of an `el-list`. It has the parts a row has everywhere: something at the start (an icon,
4
+ * an avatar), a title, a line under it, something at the end (a value, a count, a chevron), and a
5
+ * control of its own after that.
6
+ *
7
+ * With `href` the row is a link as a whole: the title is the link, and its target is the whole
8
+ * row. What is slotted into `action` stays a target of its own.
9
+ *
10
+ * Pure presentation: the row runs no script of its own.
11
+ *
12
+ * @element el-list-item
13
+ *
14
+ * @slot - The title of the row.
15
+ * @slot description - The line under the title.
16
+ * @slot start - What stands in front of the texts: an icon, an avatar. The texts of all rows of a
17
+ * list begin after the widest start.
18
+ * @slot end - What stands at the end of the row and belongs to it: a value, a count, a chevron. In
19
+ * a row that is a link it is part of the target of the link.
20
+ * @slot action - A control at the very end: a button, a switch, a menu. In a row that is a link it
21
+ * lies on top of the link and is a target of its own.
22
+ *
23
+ * @csspart base - The row: an item of the list.
24
+ * @csspart mark - The dot of `mark`, in the padding at the start of the row.
25
+ * @csspart start - The region of the `start` slot.
26
+ * @csspart text - The title and the line under it.
27
+ * @csspart title - The title: an `<a>` with `href`, a `<span>` without.
28
+ * @csspart description - The region of the `description` slot.
29
+ * @csspart end - The region of the `end` slot.
30
+ * @csspart action - The region of the `action` slot.
31
+ *
32
+ * @cssproperty --el-list-padding-inline - The padding of the row at its start and its end. Unset,
33
+ * it is `--el-space-4`, and `1rem` without a theme.
34
+ *
35
+ * @property {string} href - The address the row leads to. Unset, the row is no link.
36
+ * @property {string} target - Where to open the address (only with `href`).
37
+ * @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
38
+ * `'noreferrer noopener'`.
39
+ * @property {boolean} current - The row is the current or the chosen one: it gets `aria-current`
40
+ * (`"page"` on the link of a row with `href`, `"true"` on a row without), a bar at its start
41
+ * and a heavier title. Default `false`.
42
+ * @property {string} mark - Marks the row with a dot in the padding at its start, which does not
43
+ * move the texts: an unread message, for example. The text is what assistive technology reads
44
+ * in front of the title ("Unread"). Unset, the row has no mark.
45
+ * @property {boolean} truncate - Cuts the title and the line under it after one line, with an
46
+ * ellipsis. Unset, a long text breaks into more lines. Default `false`.
47
+ */
48
+ export default class ListItem extends TemplateElement {
49
+ constructor();
50
+ properties(): {
51
+ href: string;
52
+ target: string;
53
+ rel: string;
54
+ current: boolean;
55
+ mark: string;
56
+ truncate: boolean;
57
+ };
58
+ /** @private */
59
+ private titleTemplate;
60
+ template(): any;
61
+ }
62
+ export declare function define(): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,266 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ import Events from './menu.events.js';
3
+ /**
4
+ * A menu button: a button that opens a list of actions. "Edit, Duplicate, Delete" for a row of a
5
+ * table, the account in a header, "More" at the end of a toolbar. The button is what the page
6
+ * puts into the `trigger` slot, the actions are `el-menu-item` elements.
7
+ *
8
+ * To assistive technology it is a menu (`role="menu"`) of menu items, and the button says that it
9
+ * opens one and whether it is open. The keyboard moves through the entries with the arrow keys,
10
+ * `Home`, `End` and the first letter of an entry. `Escape` closes the menu and gives the focus
11
+ * back to the button, the Tab key closes it and moves on.
12
+ *
13
+ * The panel is a native popover: it is in the top layer, so nothing clips it and it moves nothing
14
+ * on the page. It is placed at the button, at the side that `placement` names, on the other side
15
+ * without room there, and never outside of the viewport. A press beside it closes it.
16
+ *
17
+ * Choosing an entry closes the menu and fires `menu-select`.
18
+ *
19
+ * One menu can serve many things, the rows of a list: `showAt()` opens it at a point of the
20
+ * viewport, for a right click or a long press, or at an element of the page, a button of a row.
21
+ * What it was opened for is the `opener`, which gets the focus back and which `menu-select`
22
+ * names.
23
+ *
24
+ * @element el-menu
25
+ *
26
+ * @fires {CustomEvent} menu-show - Fired when the menu has opened.
27
+ * @fires {CustomEvent} menu-hide - Fired when the menu has closed.
28
+ * @fires {CustomEvent<{ item: HTMLElement, value: string, opener: Element | undefined }>} menu-select -
29
+ * Fired when the user has chosen an entry: the `el-menu-item` is in `detail.item`, its `value`
30
+ * in `detail.value`, and what the menu was opened for in `detail.opener`. The menu closes after
31
+ * it.
32
+ *
33
+ * @slot - The entries: `el-menu-item` elements, in `el-menu-group` elements where they are
34
+ * divided into groups. An `el-divider` is a line between two of them.
35
+ * @slot trigger - The button that opens the menu. It gets `aria-haspopup="menu"` and
36
+ * `aria-expanded`.
37
+ *
38
+ * @csspart trigger - Forwarded onto the `trigger` slot.
39
+ * @csspart panel - The floating panel, which is the menu (`role="menu"`): background, border,
40
+ * radius, elevation, width.
41
+ *
42
+ * @cssstate open - Set while the menu is shown.
43
+ *
44
+ * @property {boolean} open - Whether the menu is shown. Reflected to the `open` attribute.
45
+ * @property {string} label - The name of the menu for assistive technology. Without one the menu
46
+ * has the name of its button.
47
+ * @property {'top'|'top-start'|'top-end'|'bottom'|'bottom-start'|'bottom-end'|'left'|'left-start'|'left-end'|'right'|'right-start'|'right-end'} placement -
48
+ * The side of the button the menu is placed at, and with `-start` or `-end` the edge of the
49
+ * button it is aligned with. Without room there, the menu goes to the opposite side. Default
50
+ * `'bottom-start'`.
51
+ * @property {number} distance - The gap between the button and the menu, in pixels. Default `4`.
52
+ */
53
+ export default class Menu extends TemplateElement {
54
+ open: any;
55
+ _openAtPointerDown: any;
56
+ _stopAutoUpdate: () => void;
57
+ /**
58
+ * Which entry gets the focus when the menu opens: the first one, or the last one for
59
+ * `ArrowUp` on the button.
60
+ * @private
61
+ * @type {'first'|'last'}
62
+ */
63
+ private _enterAt;
64
+ /**
65
+ * Whether the focus goes back to the button when the menu closes. It does after a choice and
66
+ * after `Escape`, and not where the user has moved it on.
67
+ * @private
68
+ */
69
+ private _restoreFocus;
70
+ /**
71
+ * Where the menu is placed while it is open somewhere else than at its own button: an element
72
+ * of the page, or a point of the viewport.
73
+ * @private
74
+ * @type {Element | { x: number, y: number } | undefined}
75
+ */
76
+ private _place;
77
+ /**
78
+ * What the menu was opened for with `showAt()`.
79
+ * @private
80
+ * @type {Element | undefined}
81
+ */
82
+ private _opener;
83
+ /**
84
+ * The button of the page that was told that the menu is open.
85
+ * @private
86
+ * @type {Element | undefined}
87
+ */
88
+ private _expanded;
89
+ /**
90
+ * Where the menu opens next, and what for: what `showAt()` was given. It is taken when the
91
+ * menu opens, which is after the element has rendered.
92
+ * @private
93
+ * @type {{ place: Element | { x: number, y: number }, opener: Element | undefined } | undefined}
94
+ */
95
+ private _next;
96
+ /**
97
+ * Whether the Tab key was pressed in the menu, and the focus is about to leave it.
98
+ * @private
99
+ */
100
+ private _leaving;
101
+ /**
102
+ * A pointer that goes down beside the open menu closes it. The panel is a popover the menu
103
+ * opens and closes itself (`popover="manual"`): the platform would close one of its own
104
+ * (`auto`) when the pointer that opened it is let go, the finger after a long press.
105
+ * @private
106
+ * @param {PointerEvent} event
107
+ */
108
+ private _onPressOutside;
109
+ constructor();
110
+ properties(): {
111
+ open: boolean;
112
+ label: string;
113
+ placement: string;
114
+ distance: number;
115
+ };
116
+ connected(): void;
117
+ disconnected(): void;
118
+ afterUpdate(): void;
119
+ watch(): {
120
+ open: (open: any) => void;
121
+ };
122
+ events(): {
123
+ '[data-trigger]': {
124
+ pointerdown: () => void;
125
+ click: (event: any) => void;
126
+ keydown: (event: any) => void;
127
+ slotchange: () => void;
128
+ };
129
+ "[part~='panel']": {
130
+ keydown: (event: any) => void;
131
+ click: (event: any) => void;
132
+ focusout: (event: any) => void;
133
+ };
134
+ };
135
+ /**
136
+ * Opens the menu, with the focus on its first entry.
137
+ * @returns {void}
138
+ */
139
+ show(): void;
140
+ /**
141
+ * Opens the menu somewhere else than at its own button: one menu for the rows of a list.
142
+ *
143
+ * At a point of the viewport, from a `contextmenu` event or a long press: the corner of the
144
+ * menu is at the point, and the menu stays inside of the viewport. Or at an element of the
145
+ * page, the button of a row: the menu is placed at it as at its own button.
146
+ *
147
+ * `opener` is what the menu is opened for. It gets the focus back when the menu closes, and
148
+ * `menu-select` names it (`detail.opener`). Without one it is the element the menu is placed
149
+ * at.
150
+ * @param {Element | { x: number, y: number }} place - The element, or the point in the
151
+ * coordinates of the viewport (`clientX`, `clientY`).
152
+ * @param {Element} [opener] - The row or the button the menu is opened for.
153
+ * @returns {void}
154
+ */
155
+ showAt(place: Element | {
156
+ x: number;
157
+ y: number;
158
+ }, opener?: Element): void;
159
+ /**
160
+ * Closes the menu.
161
+ * @returns {void}
162
+ */
163
+ hide(): void;
164
+ /**
165
+ * What the menu is open for: the row or the button it was opened for with `showAt()`, or its
166
+ * own button. Nothing while it is closed.
167
+ * @returns {Element | undefined}
168
+ */
169
+ get opener(): Element | undefined;
170
+ /**
171
+ * Opens the menu when it is closed, and closes it when it is open.
172
+ * @returns {void}
173
+ */
174
+ toggle(): void;
175
+ /**
176
+ * The button of the menu: what is in the `trigger` slot.
177
+ * @private
178
+ * @returns {HTMLElement | undefined}
179
+ */
180
+ private _trigger;
181
+ /**
182
+ * The entries the user can reach, in the order of the page. An entry that is disabled is one
183
+ * of them: the keyboard gets to it, so a screen reader finds it, and it cannot be chosen.
184
+ * @private
185
+ * @returns {HTMLElement[]}
186
+ */
187
+ private _items;
188
+ /**
189
+ * The text of an entry, without its icon: what a letter of the keyboard is compared with.
190
+ * @private
191
+ * @param {Element} item
192
+ * @returns {string}
193
+ */
194
+ private _textOf;
195
+ /**
196
+ * The button says that it opens a menu, and whether the menu is open. An `el-button` passes
197
+ * both on to the control inside of it.
198
+ * @private
199
+ */
200
+ private _syncTrigger;
201
+ /**
202
+ * Whether the focus is on an entry of the menu.
203
+ * @private
204
+ * @returns {boolean}
205
+ */
206
+ private _hasFocusInPanel;
207
+ /**
208
+ * The arrow keys on the button open the menu: down at its first entry, up at its last one.
209
+ * `Enter` and `Space` are a click of the button.
210
+ * @private
211
+ * @param {KeyboardEvent} event
212
+ */
213
+ private _onTriggerKeyDown;
214
+ /**
215
+ * The keys of a menu, while the focus is on one of its entries.
216
+ * @private
217
+ * @param {KeyboardEvent} event
218
+ */
219
+ private _onKeyDown;
220
+ /**
221
+ * A click in the panel: the user has chosen the entry it is on, unless that one is disabled.
222
+ * @private
223
+ * @param {MouseEvent} event
224
+ */
225
+ private _onClick;
226
+ /**
227
+ * The focus has left the menu with the Tab key, which closes it and moves on. The focus is
228
+ * where the user has put it, and stays there.
229
+ *
230
+ * Only the key closes it this way. A pointer that goes down beside the menu closes it by
231
+ * itself, and the finger of a long press gives the focus to the row it is on when it is
232
+ * lifted: the menu it has just opened stays open.
233
+ * @private
234
+ * @param {FocusEvent} event
235
+ */
236
+ private _onFocusOut;
237
+ /**
238
+ * Puts the focus on the entry the menu is entered at.
239
+ * @private
240
+ */
241
+ private _focusEntry;
242
+ /** @private */
243
+ private _applyOpen;
244
+ /** @private */
245
+ private _applyClose;
246
+ /**
247
+ * What the panel is placed at: its own button, the element of `showAt()`, or its point. A
248
+ * point is an element for the placing that has no size and does not move.
249
+ * @private
250
+ * @returns {Element | { getBoundingClientRect: () => DOMRect }}
251
+ */
252
+ private _anchor;
253
+ /**
254
+ * Places the panel now, and again whenever the button moves: on scroll, on resize, when the
255
+ * button or the panel changes its size.
256
+ * @private
257
+ */
258
+ private _startPositioning;
259
+ /** @private */
260
+ private _stopPositioning;
261
+ /** @private */
262
+ private _position;
263
+ template(): any;
264
+ }
265
+ export declare function define(): void;
266
+ export { Events };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ SHOW: string;
3
+ HIDE: string;
4
+ SELECT: string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * A group of entries in an `el-menu`, with a heading where it has a `label`. A group to assistive
4
+ * technology (`role="group"`), which has the heading as its name. A line divides it from what is
5
+ * before it in the menu.
6
+ *
7
+ * @element el-menu-group
8
+ *
9
+ * @slot - The entries of the group: `el-menu-item` elements.
10
+ *
11
+ * @csspart base - The group, with the line over it.
12
+ * @csspart label - The heading of the group.
13
+ *
14
+ * @property {string} label - The heading of the group, and its name for assistive technology.
15
+ * Default `''`.
16
+ */
17
+ export default class MenuGroup extends TemplateElement {
18
+ constructor();
19
+ properties(): {
20
+ label: string;
21
+ };
22
+ template(): any;
23
+ }
24
+ export declare function define(): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,59 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * One entry of an `el-menu`: an action, or a link with an address. A menu item to assistive
4
+ * technology (`role="menuitem"`). The menu moves the focus of the keyboard to it, so it is no stop
5
+ * of the Tab key itself.
6
+ *
7
+ * Choosing an entry is a click on it: listen for `click` on the entry, or for `menu-select` on the
8
+ * menu, which names the entry and its `value`.
9
+ *
10
+ * @element el-menu-item
11
+ *
12
+ * @slot - The text of the entry.
13
+ * @slot icon - An icon in front of the text: a decoration, the text is the name.
14
+ *
15
+ * @csspart base - The entry: a `<button>`, or an `<a>` with `href`.
16
+ * @csspart icon - The place of the icon.
17
+ * @csspart label - The text of the entry.
18
+ *
19
+ * @property {string} href - The address the entry leads to. With one it is a link.
20
+ * @property {string} target - Where to open the address.
21
+ * @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
22
+ * `'noreferrer noopener'`.
23
+ * @property {string} value - What the entry stands for, for the listener of `menu-select`:
24
+ * `'delete'`. Default `''`.
25
+ * @property {boolean} disabled - Whether the entry cannot be chosen. The keyboard still gets to
26
+ * it. Default `false`.
27
+ * @property {'neutral'|'brand'|'success'|'warning'|'danger'} variant - The variant of the entry:
28
+ * `danger` for something that cannot be undone. Default `'neutral'`. Reflected to the `variant`
29
+ * attribute.
30
+ */
31
+ export default class MenuItem extends TemplateElement {
32
+ constructor();
33
+ properties(): {
34
+ href: string;
35
+ target: string;
36
+ rel: string;
37
+ value: string;
38
+ disabled: boolean;
39
+ variant: string;
40
+ };
41
+ events(): {
42
+ "[part~='base']": {
43
+ slotchange: () => any;
44
+ click: (event: any) => void;
45
+ };
46
+ };
47
+ /**
48
+ * Puts the focus on the entry: on the control inside of it.
49
+ * @param {FocusOptions} [options]
50
+ */
51
+ focus(options?: FocusOptions): void;
52
+ /**
53
+ * @private
54
+ * @returns {boolean}
55
+ */
56
+ private _disabled;
57
+ template(): any;
58
+ }
59
+ export declare function define(): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,103 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * The destinations of an application: the places the user goes to all the time. Each destination
4
+ * is an `el-nav-item`: a link with an icon and a short text, and the one of the current view is
5
+ * marked. The element is a navigation landmark, named by `label`.
6
+ *
7
+ * Three layouts. A **bar** for the lower edge of a phone, in which three to five destinations share
8
+ * the width in equal parts. A **rail** for the side of a wider screen: a narrow column of icons
9
+ * with a word under each. A **list** for a sidebar: an icon and its text in one row, as wide as
10
+ * its place. A rail and a list have a group at their top and one at their lower end, and scroll
11
+ * where they have more destinations than height.
12
+ *
13
+ * `layout="auto"`, the default, is a bar, and where an `el-app-frame` has the element in the
14
+ * column at its side it is what `column` names, a rail or a list: the page writes the
15
+ * destinations once.
16
+ *
17
+ * A second group takes the destinations that have no room among the five of a bar (the
18
+ * `secondary` slot, with `secondary-label` as its heading). A bar leaves it out.
19
+ *
20
+ * In a region of an `el-app-frame` the surface reaches the edge of the screen, and the
21
+ * destinations stay clear of the home indicator and the notch. Alone it keeps them clear itself.
22
+ *
23
+ * The look is the stylesheet alone, so server-rendered destinations do not change when the
24
+ * element takes over. The script adds the tooltips of destinations that show an icon alone.
25
+ *
26
+ * @element el-nav
27
+ *
28
+ * @slot - The destinations: `el-nav-item` elements.
29
+ * @slot secondary - A second group of destinations, below the first: the pages that have no room
30
+ * in a bar, which leaves them out.
31
+ * @slot end - The destinations at the lower end of a rail or a list: the settings, the account. A
32
+ * bar has no room for them, and leaves them out.
33
+ *
34
+ * @csspart base - The navigation landmark (`<nav>`): the surface and its line to the content.
35
+ * @csspart groups - The two groups at the top, which scroll where a rail or a list has more
36
+ * destinations than height.
37
+ * @csspart list - The list of the destinations.
38
+ * @csspart secondary - The second group: its heading and its list.
39
+ * @csspart secondary-label - The heading of the second group, which a list shows.
40
+ * @csspart secondary-list - The list of the destinations of the second group.
41
+ * @csspart end - The list of the destinations at the lower end of a rail or a list.
42
+ * @csspart tooltip - The tooltip of a destination that shows an icon alone: an `el-tooltip`.
43
+ *
44
+ * @cssproperty --el-nav-rail-size - The width of a rail. Default `5rem`.
45
+ * @cssproperty --el-nav-list-size - The width of a list where its place is as wide as what is in
46
+ * it. Default `16rem`.
47
+ *
48
+ * @property {string} label - The name of the navigation for assistive technology, "Main". A page
49
+ * with more than one navigation needs it to tell them apart.
50
+ * @property {'auto'|'bar'|'rail'|'list'} layout - How the destinations lie: `bar`, a row in which
51
+ * they share the width in equal parts; `rail`, a narrow column; `list`, rows of an icon and its
52
+ * text; `auto`, a bar, and in the column at the side of an `el-app-frame` what `column` names.
53
+ * Default `'auto'`.
54
+ * @property {'rail'|'list'} column - What the destinations are in the column at the side of an
55
+ * `el-app-frame`, with `layout="auto"`. Default `'rail'`.
56
+ * @property {string} secondaryLabel - The heading of the second group, and its name for assistive
57
+ * technology: "More". Default `''`.
58
+ * @property {boolean} labels - Whether the destinations show their texts. With `false` they show
59
+ * an icon alone: the text stays the name of the link, and shows as a tooltip. Default `true`.
60
+ */
61
+ export default class Nav extends TemplateElement {
62
+ /**
63
+ * Whether the element has started in a browser, see `connected()`.
64
+ * @private
65
+ */
66
+ private _started;
67
+ constructor();
68
+ properties(): {
69
+ label: string;
70
+ layout: string;
71
+ column: string;
72
+ secondaryLabel: string;
73
+ labels: boolean;
74
+ };
75
+ connected(): void;
76
+ events(): {
77
+ "[part~='base']": {
78
+ slotchange: () => any;
79
+ };
80
+ };
81
+ /**
82
+ * @private
83
+ * @returns {boolean}
84
+ */
85
+ private _showsLabels;
86
+ /**
87
+ * The destinations with their texts: what is in a destination and in none of its named slots.
88
+ * None before the element has started, and none while the texts show: a tooltip is for an
89
+ * icon alone, and on a server there is no pointer to show one to.
90
+ * @private
91
+ * @returns {Array<[Element, string]>}
92
+ */
93
+ private _named;
94
+ /**
95
+ * Where the tooltip of a destination goes: beside a rail, on the side of the content, and
96
+ * above a bar. The stylesheet decides what the destinations are; this reads what it decided.
97
+ * @private
98
+ * @returns {string}
99
+ */
100
+ private _tooltipPlacement;
101
+ template(): any;
102
+ }
103
+ export declare function define(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;