@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,39 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * One destination of an `el-nav`: a link with an icon and a short text under it. The destination
4
+ * of the current view is marked: for assistive technology (`aria-current="page"`), and for the
5
+ * eye by more than its colour.
6
+ *
7
+ * A count or a dot goes into the `badge` slot, an `el-badge` as a rule. It is part of the link and
8
+ * comes after the text, so a screen reader reads it with the name of the destination: "Inbox 12".
9
+ *
10
+ * @element el-nav-item
11
+ *
12
+ * @slot - The short text of the destination. One line: a text that does not fit is cut.
13
+ * @slot icon - The icon of the destination: a decoration, the text is the name.
14
+ * @slot badge - A count or a dot at the corner of the icon, an `el-badge` as a rule.
15
+ *
16
+ * @csspart base - The entry of the list (`role="listitem"`).
17
+ * @csspart link - The link: the whole destination is its target.
18
+ * @csspart icon - The icon, with the shape behind it that marks the current destination.
19
+ * @csspart badge - The place of the badge, at the corner of the icon.
20
+ * @csspart label - The text of the destination.
21
+ *
22
+ * @property {string} href - The address the destination leads to.
23
+ * @property {string} target - Where to open the address.
24
+ * @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
25
+ * `'noreferrer noopener'`.
26
+ * @property {boolean} current - The destination of the current view: the link gets
27
+ * `aria-current="page"`, a heavier text and a shape behind its icon.
28
+ */
29
+ export default class NavItem extends TemplateElement {
30
+ constructor();
31
+ properties(): {
32
+ href: string;
33
+ target: string;
34
+ rel: string;
35
+ current: boolean;
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;
@@ -8,17 +8,24 @@ import Events from './pagination.events.js';
8
8
  * The pagination does not load anything. A button sets `page` and fires `pagination-change`, and
9
9
  * the page shows the entries that belong to it.
10
10
  *
11
+ * A list that a server renders a page at a time has the page in its address. With `href`, the
12
+ * address of a page with `{page}` in the place of its number, the pages are links: they are in
13
+ * the server-rendered markup, lead to their page without a script, open in a new tab and can be
14
+ * copied. A link fires nothing and changes nothing: the address it leads to brings the next page.
15
+ *
11
16
  * @element el-pagination
12
17
  *
13
18
  * @fires {CustomEvent<{ page: number }>} pagination-change - Fired when a button has changed the
14
- * page. `detail.page` is the new page. Not fired when `page` is set from a script.
19
+ * page. `detail.page` is the new page. Not fired when `page` is set from a script, and not by
20
+ * a link.
15
21
  *
16
22
  * @slot previous-icon - The icon of the button for the page before. Unset, an arrow head.
17
23
  * @slot next-icon - The icon of the button for the page after. Unset, an arrow head.
18
24
  *
19
25
  * @csspart base - The `nav` landmark.
20
26
  * @csspart list - The row of the buttons.
21
- * @csspart button - Every button: the pages, the page before and the page after.
27
+ * @csspart button - Every button: the pages, the page before and the page after. With `href`
28
+ * they are links, and keep their parts.
22
29
  * @csspart page - The button of a page.
23
30
  * @csspart current - The button of the current page.
24
31
  * @csspart previous - The button for the page before.
@@ -27,6 +34,9 @@ import Events from './pagination.events.js';
27
34
  *
28
35
  * @property {number} page - The current page, counted from 1. A page that does not exist is shown
29
36
  * as the nearest one that does. Default `1`. Reflected to the `page` attribute.
37
+ * @property {string} href - The address of a page, with `{page}` in the place of its number:
38
+ * `/notes?page={page}`. With it the pages, the page before and the page after are links.
39
+ * Default `''`: buttons.
30
40
  * @property {number} total - The number of entries in the whole list. Default `0`.
31
41
  * @property {number} perPage - The number of entries on one page. Default `10`.
32
42
  * @property {number} siblings - How many pages are shown on each side of the current page.
@@ -50,6 +60,7 @@ export default class Pagination extends TemplateElement {
50
60
  constructor();
51
61
  properties(): {
52
62
  page: number;
63
+ href: string;
53
64
  total: number;
54
65
  perPage: number;
55
66
  siblings: number;
@@ -109,8 +120,26 @@ export default class Pagination extends TemplateElement {
109
120
  * @returns {Array<number | null>}
110
121
  */
111
122
  private _items;
123
+ /**
124
+ * The address of a page: `href` with the number in the place of its mark.
125
+ * @private
126
+ * @param {number} page
127
+ * @returns {string}
128
+ */
129
+ private _address;
112
130
  /** @private */
113
131
  private _pageTemplate;
132
+ /**
133
+ * The way to the page before or after, as a link. Where there is no such page, at the first
134
+ * page and at the last one, it is a link without an address: no stop of the Tab key, and one
135
+ * that says to assistive technology that it leads nowhere now.
136
+ * @private
137
+ * @param {'previous'|'next'} name
138
+ * @param {number} page - The page it leads to.
139
+ * @param {string} label
140
+ * @param {*} icon - The slot of its icon.
141
+ */
142
+ private _stepLinkTemplate;
114
143
  template(): any;
115
144
  }
116
145
  export declare function define(): void;
@@ -1,15 +1,16 @@
1
1
  import { StyledElement } from '@webtides/element-js';
2
2
  /**
3
- * Wraps any click-emitting child (`<a>`, `<button>`, …) and smoothly scrolls the window
4
- * to the top when the child is clicked.
3
+ * Wraps any click-emitting child (`<a>`, `<button>`, …) and smoothly scrolls to the top when the
4
+ * child is clicked: the window, or the element around it that scrolls, the content of an
5
+ * `el-app-frame` for example.
5
6
  *
6
7
  * @element el-scroll-to-top
7
8
  *
8
9
  * @slot - Default slot. Any child that emits a `click` event will trigger the scroll.
9
10
  *
10
11
  * @property {number} duration - Duration of the easing animation in milliseconds. Ignored
11
- * when the page's `html` element has `scroll-behavior: smooth` (the browser drives the
12
- * scroll in that case).
12
+ * when what scrolls has `scroll-behavior: smooth`, the `html` element for the window (the
13
+ * browser drives the scroll in that case).
13
14
  * @property {boolean} preventDefault - When `true`, the captured click's default action is
14
15
  * suppressed.
15
16
  */
@@ -26,7 +27,7 @@ export default class ScrollToTop extends StyledElement {
26
27
  };
27
28
  };
28
29
  /**
29
- * Scroll the window to the top.
30
+ * Scroll to the top: the element around this one that scrolls, or the window.
30
31
  * @returns {void}
31
32
  */
32
33
  scrollToTop(): void;
@@ -0,0 +1,85 @@
1
+ import RadioField from '../radio-field/radio-field.js';
2
+ /**
3
+ * One choice of a few options, shown as a row of joined buttons: "List | Grid",
4
+ * "Day | Week | Month". It looks like an `el-button-group` and behaves like a group of radios,
5
+ * because it is one: a native `<fieldset>`/`<legend>` with an `<input type="radio">` per option
6
+ * (it extends `el-radio-field`). So the one tab stop, the arrow keys, the value in the form, its
7
+ * reset and `required` are native, and the label, the help message and the error message are the
8
+ * ones of every field.
9
+ *
10
+ * In a container that gives its controls a size, an `el-toolbar`, the field takes it from there,
11
+ * while the page has not set `size` on the field itself.
12
+ *
13
+ * @element el-segmented-field
14
+ *
15
+ * @fires {CustomEvent<string>} input-change - Fired when the chosen option changes. `detail` is
16
+ * its value. Bubbles.
17
+ *
18
+ * @cssstate touched - Set once the user has left the group, or the browser has refused a submit
19
+ * because of it. Inherits `valid` and `invalid` from `FormField`.
20
+ *
21
+ * @property {string | null} value - The value of the chosen option.
22
+ * @property {Array<string | { value: string, label?: string, icon?: string, disabled?: boolean }>} options -
23
+ * The options. Plain strings (`['Day', 'Week']`) are value and label at once; an object has a
24
+ * `value`, a `label`, and can be `disabled`. With `icon`, the address of an SVG symbol
25
+ * (`'#grid'`, `'/icons.svg#grid'`), the option shows that icon in the place of its label: the
26
+ * label is then its name for assistive technology and its tooltip.
27
+ * @property {'small'|'medium'|'large'} size - The size of the options: their height, their padding
28
+ * and their font size. Default `'medium'`. Reflected to the `size` attribute.
29
+ */
30
+ export default class SegmentedField extends RadioField {
31
+ constructor(options: any);
32
+ /**
33
+ * Whether the page has given the field a size of its own, see `_hasOwnSize()`.
34
+ * @private
35
+ * @type {boolean | undefined}
36
+ */
37
+ private _ownSize;
38
+ properties(): {
39
+ name: string;
40
+ value: any;
41
+ required: boolean;
42
+ disabled: boolean;
43
+ label: string;
44
+ labelScreenReaderOnly: boolean;
45
+ errorMessage: string;
46
+ helpMessage: string;
47
+ valid: boolean;
48
+ touched: boolean;
49
+ options: any[];
50
+ size: string;
51
+ };
52
+ static observedAttributes: string[];
53
+ /**
54
+ * Whether the field is writing a property to its attribute right now, see `reflectProperty()`.
55
+ * @private
56
+ */
57
+ private _reflecting;
58
+ connectedCallback(): void;
59
+ /**
60
+ * The page has written the `size` attribute, after the field was connected: the size is the
61
+ * field's own from now on, also when it is the default. The field writes the attribute itself
62
+ * as well, which says nothing.
63
+ */
64
+ attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
65
+ reflectProperty(options: any): void;
66
+ watch(): {
67
+ value: (value: any) => void;
68
+ valid: () => void;
69
+ touched: () => void;
70
+ size: () => void;
71
+ };
72
+ /**
73
+ * Whether the page has given the field a size of its own. A field without one takes the size
74
+ * of a container that gives one to its controls, a toolbar. The template marks the row with
75
+ * the answer, and the stylesheet reads the mark. On the server no attribute has been written
76
+ * by the element: one that is there is the one of the page.
77
+ * @private
78
+ * @returns {boolean}
79
+ */
80
+ private _hasOwnSize;
81
+ template(): any;
82
+ /** @private */
83
+ private fieldTemplate;
84
+ }
85
+ export declare function define(): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,127 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ import Events from './splitter.events.js';
3
+ /**
4
+ * The edge between two panes that are beside each other, which the user drags to set the width of
5
+ * one of them: with a mouse, a finger or a pen, and with the arrow keys. To assistive technology
6
+ * it is a separator with a value, the width in pixels, and with the name of what it sizes.
7
+ *
8
+ * The splitter is the control and sizes nothing itself, as a range does: it has a `value` between
9
+ * `min` and `max`, and tells of every change. The layout around it takes the value. An
10
+ * `el-app-frame` renders one at the edge of its navigation and of its aside (`resizable`); a page
11
+ * with two panes of its own writes one between them and sets the width of the pane from the
12
+ * event.
13
+ *
14
+ * @element el-splitter
15
+ *
16
+ * @fires {CustomEvent<{ value: number }>} splitter-resize - Fired with every change the user
17
+ * makes: while the edge is dragged, and with every key. The new width is in `detail.value`.
18
+ * @fires {CustomEvent<{ value: number }>} splitter-resize-end - Fired once the user has set a
19
+ * width: when the pointer lets go of the edge, and with every key. The width to keep is in
20
+ * `detail.value`.
21
+ *
22
+ * @csspart base - The separator: what takes the pointer and the focus. It is wider than the line.
23
+ * @csspart line - The line that shows, and the mark it becomes under the pointer and with the
24
+ * focus.
25
+ *
26
+ * @cssproperty --el-splitter-line-width - The width of the line. Default `--el-border-width`.
27
+ *
28
+ * @cssstate dragging - Set while a pointer drags the edge.
29
+ *
30
+ * @property {number} value - The width of the pane the splitter sizes, in pixels. Default `0`.
31
+ * @property {number} min - The least width. Default `0`.
32
+ * @property {number} max - The greatest width. Default `100`.
33
+ * @property {number} step - How far an arrow key moves the edge, in pixels. Default `16`.
34
+ * @property {string} label - The name of what the splitter sizes, for assistive technology.
35
+ * Default `''`.
36
+ * @property {'start'|'end'} placement - The edge of its pane the splitter is. `end`: the pane is
37
+ * in front of it, and grows when the edge moves away from the start. `start`: the pane is after
38
+ * it. Default `'end'`.
39
+ */
40
+ export default class Splitter extends TemplateElement {
41
+ value: number;
42
+ /**
43
+ * The drag that is going on: the pointer, where it took the edge, the width then, and the
44
+ * direction in which the width grows.
45
+ * @private
46
+ * @type {{ pointerId: number, x: number, value: number, sign: number } | undefined}
47
+ */
48
+ private _drag;
49
+ constructor();
50
+ properties(): {
51
+ value: number;
52
+ min: number;
53
+ max: number;
54
+ step: number;
55
+ label: string;
56
+ placement: string;
57
+ };
58
+ events(): {
59
+ "[part~='base']": {
60
+ pointerdown: (event: any) => void;
61
+ pointermove: (event: any) => void;
62
+ pointerup: (event: any) => void;
63
+ pointercancel: (event: any) => void;
64
+ lostpointercapture: (event: any) => void;
65
+ keydown: (event: any) => void;
66
+ };
67
+ };
68
+ disconnected(): void;
69
+ /**
70
+ * A width between the least and the greatest one, in whole pixels.
71
+ * @private
72
+ * @param {number} value
73
+ * @returns {number}
74
+ */
75
+ private _clamp;
76
+ /**
77
+ * The direction in which the width grows: 1 where it grows as the edge moves to the right.
78
+ * The pane is in front of the edge or after it, and the page runs from the left or from the
79
+ * right.
80
+ * @private
81
+ * @returns {number}
82
+ */
83
+ private _sign;
84
+ /**
85
+ * Takes a width from the user and tells of it. A width that is the same as before is none.
86
+ * @private
87
+ * @param {number} value
88
+ * @returns {boolean} Whether the width has changed.
89
+ */
90
+ private _resize;
91
+ /**
92
+ * The edge follows the pointer that took it, wherever that goes. The separator captures the
93
+ * pointer, so a move outside of the window still arrives here. A page in the page takes a pen
94
+ * that is over it all the same: while the edge is dragged, the separator covers the viewport
95
+ * (see the stylesheet), and the pointer is over nothing else.
96
+ * @private
97
+ * @param {PointerEvent} event
98
+ */
99
+ private _onPointerDown;
100
+ /**
101
+ * @private
102
+ * @param {PointerEvent} event
103
+ */
104
+ private _onPointerMove;
105
+ /**
106
+ * The pointer has let go, or the system has taken it away: the width stays as it is now.
107
+ * @private
108
+ * @param {PointerEvent} event
109
+ */
110
+ private _onPointerEnd;
111
+ /**
112
+ * Ends the drag that is going on, and tells of the width that stays if it is another one than
113
+ * before the drag.
114
+ * @private
115
+ */
116
+ private _endDrag;
117
+ /**
118
+ * The arrow keys move the edge a step, in the direction of the arrow. `Home` and `End` take
119
+ * it to the least and to the greatest width.
120
+ * @private
121
+ * @param {KeyboardEvent} event
122
+ */
123
+ private _onKeyDown;
124
+ template(): any;
125
+ }
126
+ export declare function define(): void;
127
+ export { Events };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ RESIZE: string;
3
+ RESIZE_END: string;
4
+ };
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * A narrow line of state at the lower edge of a tool for a desktop: whether the connection is
4
+ * there, what is selected, how many entries there are, a task that runs in the background, the
5
+ * version. Entries at its start and at its end, in one row that keeps its height.
6
+ *
7
+ * An entry is what the page writes: a text, an icon with a name, an `el-button`, or a small
8
+ * component (`el-spinner`, `el-progress-bar`). The bar is no live region. An entry whose change
9
+ * is to be announced is one the page marks itself (`role="status"`).
10
+ *
11
+ * In the footer of an `el-app-frame` the surface of the bar reaches as far as the surface of the
12
+ * region. The look is the stylesheet alone, so a server-rendered bar does not change when the
13
+ * element takes over.
14
+ *
15
+ * @element el-status-bar
16
+ *
17
+ * @slot - The entries at the start of the bar. They give way first where the bar is too narrow.
18
+ * @slot end - The entries at the end of the bar.
19
+ *
20
+ * @csspart base - The bar: its surface and the line to the content.
21
+ * @csspart row - The row of the entries, which keeps its height.
22
+ * @csspart start - The entries at the start.
23
+ * @csspart end - The entries at the end.
24
+ */
25
+ export default class StatusBar extends TemplateElement {
26
+ constructor();
27
+ events(): {
28
+ "[part~='base']": {
29
+ slotchange: () => any;
30
+ };
31
+ this: {
32
+ focusout: () => void;
33
+ };
34
+ };
35
+ /**
36
+ * Entries that do not fit are cut off, and the browser moves a group to show a button in the
37
+ * part that is cut when the keyboard gets to it. With the focus gone, the group shows its
38
+ * first entries again.
39
+ * @private
40
+ */
41
+ private _showStart;
42
+ template(): any;
43
+ }
44
+ export declare function define(): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -13,6 +13,9 @@ import { StyledElement } from '@webtides/element-js';
13
13
  * The links and panels need not be defined, or be there, when the group connects: it marks the
14
14
  * selection with attributes and styles, and takes in parts that are added later.
15
15
  *
16
+ * The group finds a panel by its `name` and a link by its `for`. It reads the property and falls
17
+ * back to the attribute, so it makes no difference which of the two a framework has set.
18
+ *
16
19
  * @element el-tab-group
17
20
  *
18
21
  * @slot - Default slot containing `<el-tab-link>` and `<el-tab-panel>` children.
@@ -65,6 +68,20 @@ export default class TabGroup extends StyledElement {
65
68
  * @returns {void}
66
69
  */
67
70
  selectTab(name: string): void;
71
+ /**
72
+ * What a link (`for`) or a panel (`name`) is found by, as a text: the property, and the
73
+ * attribute when the property has no value.
74
+ *
75
+ * A framework that creates the elements in the browser hands the value over as a property
76
+ * when the element has one, and then there is no attribute. An element whose tag is not
77
+ * defined yet has the attribute alone. Both sides of a comparison are texts: element-js
78
+ * parses the attribute `name="1"` to a number, and `getAttribute()` gives a text.
79
+ * @private
80
+ * @param {Element} element
81
+ * @param {'for' | 'name'} key
82
+ * @returns {string | null}
83
+ */
84
+ private _keyOf;
68
85
  /** @private */
69
86
  private updateSelection;
70
87
  /**
@@ -0,0 +1,96 @@
1
+ import { TemplateElement } from '@webtides/element-js';
2
+ /**
3
+ * A toolbar: the row of controls over a list or a view. It gives them one size and one
4
+ * appearance, lays them out with a gap, in lines where they do not fit into one, and with a group
5
+ * at the end, and makes them one stop of the Tab key: the arrow keys move between them.
6
+ *
7
+ * The controls are what the page writes into it: `el-button` (also as a toggle, and with an icon
8
+ * alone), `el-button-group`, `el-segmented-field`, and `el-divider` between two groups.
9
+ *
10
+ * The look is the stylesheet alone, so a server-rendered toolbar does not change when the element
11
+ * takes over. The script adds the keyboard, and the tooltips of the buttons with an icon alone.
12
+ *
13
+ * @element el-toolbar
14
+ *
15
+ * @slot - The controls of the toolbar, and `el-divider` elements between two groups of them.
16
+ * @slot end - The controls at the end of the toolbar.
17
+ *
18
+ * @csspart base - The toolbar (`role="toolbar"`): the row of the controls.
19
+ * @csspart end - The group at the end.
20
+ * @csspart tooltip - The tooltip of a button with an icon alone: an `el-tooltip`.
21
+ *
22
+ * @property {string} label - The name of the toolbar for assistive technology, "Formatting".
23
+ * Unset, the toolbar has none.
24
+ * @property {'small'|'medium'|'large'} size - The size of the controls that have none of their
25
+ * own. Default `'medium'`. Reflected to the `size` attribute.
26
+ * @property {'filled'|'outlined'|'plain'} appearance - The appearance of the buttons that have
27
+ * none of their own. Default `'plain'`. Reflected to the `appearance` attribute.
28
+ */
29
+ export default class Toolbar extends TemplateElement {
30
+ /**
31
+ * The control that had the focus last: where the Tab key comes back to.
32
+ * @private
33
+ * @type {HTMLElement | undefined}
34
+ */
35
+ private _current;
36
+ /**
37
+ * Whether the toolbar has started in a browser, see `connected()`.
38
+ * @private
39
+ */
40
+ private _started;
41
+ constructor();
42
+ properties(): {
43
+ label: string;
44
+ size: string;
45
+ appearance: string;
46
+ };
47
+ connected(): void;
48
+ events(): {
49
+ this: {
50
+ keydown: (event: any) => void;
51
+ focusin: (event: any) => void;
52
+ };
53
+ "[part~='base']": {
54
+ slotchange: () => any;
55
+ };
56
+ };
57
+ /**
58
+ * The controls of the toolbar that the user can move the focus to, in their order: the ones
59
+ * at the end last, as they are shown.
60
+ * @private
61
+ * @returns {HTMLElement[]}
62
+ */
63
+ private _controls;
64
+ /**
65
+ * The arrow keys move the focus from control to control and around the ends, Home and End go
66
+ * to the first and the last one. The Tab key leaves the toolbar.
67
+ * @private
68
+ * @param {KeyboardEvent} event
69
+ */
70
+ private _onKeydown;
71
+ /**
72
+ * Lets the Tab key leave the toolbar: the browser takes the key once every listener has had
73
+ * it, and goes to the next stop. Until then the other controls of the toolbar are none.
74
+ * @private
75
+ * @param {HTMLElement[]} controls
76
+ * @param {Element} current
77
+ */
78
+ private _letTabLeave;
79
+ /**
80
+ * The Tab key comes into the toolbar at the control that had the focus last, and at the first
81
+ * one before any had it. A pointer puts the focus where it is pressed.
82
+ * @private
83
+ * @param {FocusEvent} event
84
+ */
85
+ private _onFocusIn;
86
+ /**
87
+ * The buttons that show an icon alone: they have a name of their own for assistive technology
88
+ * (`aria-label`), which their content does not show. None before the toolbar has started: on
89
+ * a server there is no pointer to show a tooltip to.
90
+ * @private
91
+ * @returns {Element[]}
92
+ */
93
+ private _namedButtons;
94
+ template(): any;
95
+ }
96
+ export declare function define(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -26,6 +26,14 @@ import Events from './tooltip.events.js';
26
26
  *
27
27
  * @property {string} for - The id of the anchor: the element the tooltip explains and opens from.
28
28
  * It is looked up in the document or the shadow root the tooltip is in.
29
+ * @property {Element | null} anchor - The anchor as an element, for one that an id cannot name: an
30
+ * element in another tree than the tooltip. A property only, and it comes before `for`. Default
31
+ * `null`.
32
+ * @property {'description'|'label'} type - What the tooltip is to its anchor. `'description'`
33
+ * (the default): it explains the anchor, and is its description for a screen reader.
34
+ * `'label'`: it shows the name the anchor already has, of a button with an icon alone for
35
+ * example. The anchor is not described by it then, and the tooltip is hidden from assistive
36
+ * technology, which would read the name twice.
29
37
  * @property {boolean} open - Whether the tooltip is shown. Reflected to the `open` attribute.
30
38
  * @property {'top'|'top-start'|'top-end'|'bottom'|'bottom-start'|'bottom-end'|'left'|'left-start'|'left-end'|'right'|'right-start'|'right-end'} placement -
31
39
  * The side of the anchor the tooltip is placed at, and with `-start` or `-end` the edge of the
@@ -51,9 +59,18 @@ export default class Tooltip extends TemplateElement {
51
59
  * @type {Set<'anchor' | 'tooltip' | 'focus'>}
52
60
  */
53
61
  _reasons;
62
+ /**
63
+ * Whether the tooltip is shown, as it has said last (`:state(open)`). Kept here, and not
64
+ * read back from the states of the element: WebKit forgets what was added to them a
65
+ * moment later (`states.has()` is `false`), while the state still matches.
66
+ * @private
67
+ */
68
+ _shown;
69
+ _givenAnchor: any;
54
70
  open: any;
55
71
  id: string;
56
72
  _anchor: any;
73
+ _describes: boolean;
57
74
  _anchorListeners: AbortController;
58
75
  _timer: number;
59
76
  _openListeners: AbortController;
@@ -69,7 +86,15 @@ export default class Tooltip extends TemplateElement {
69
86
  hideDelay: number;
70
87
  arrow: boolean;
71
88
  disabled: boolean;
89
+ type: string;
72
90
  };
91
+ /**
92
+ * The anchor as an element. No property of element-js: an element is nothing to compare or to
93
+ * keep as state.
94
+ * @returns {Element | null}
95
+ */
96
+ get anchor(): Element | null;
97
+ set anchor(anchor: Element | null);
73
98
  connected(): void;
74
99
  disconnected(): void;
75
100
  afterUpdate(): void;
@@ -77,6 +102,7 @@ export default class Tooltip extends TemplateElement {
77
102
  open: (open: any) => void;
78
103
  for: () => void;
79
104
  disabled: (disabled: any) => void;
105
+ type: () => void;
80
106
  };
81
107
  /**
82
108
  * Opens the tooltip. A tooltip without an anchor in the page stays closed.