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