@fusion.dev/helix-headless 0.0.0-dev → 0.0.2
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/custom-elements.json +4513 -4483
- package/dist/accordion/item/accordion-item.d.ts +13 -15
- package/dist/accordion/item/accordion-item.js +15 -17
- package/dist/announcement/root/announcement-root.d.ts +7 -25
- package/dist/announcement/root/announcement-root.js +7 -20
- package/dist/app-header/root/app-header-root.d.ts +10 -17
- package/dist/app-header/root/app-header-root.js +9 -18
- package/dist/avatar/group/avatar-group.d.ts +10 -19
- package/dist/avatar/group/avatar-group.js +12 -17
- package/dist/avatar/root/avatar-root.d.ts +8 -8
- package/dist/avatar/root/avatar-root.js +19 -20
- package/dist/badge/root/badge-root.d.ts +6 -6
- package/dist/badge/root/badge-root.js +13 -13
- package/dist/bar-chart/root/bar-chart-root.d.ts +21 -29
- package/dist/bar-chart/root/bar-chart-root.js +42 -57
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +12 -18
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +13 -16
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +9 -28
- package/dist/breadcrumbs/root/breadcrumbs-root.js +9 -28
- package/dist/button/root/button-root.d.ts +84 -94
- package/dist/button/root/button-root.js +82 -92
- package/dist/callout/root/callout-root.d.ts +4 -5
- package/dist/carousel/root/carousel-root.d.ts +59 -71
- package/dist/carousel/root/carousel-root.js +73 -101
- package/dist/chat/composer/chat-composer.d.ts +29 -33
- package/dist/chat/composer/chat-composer.js +40 -44
- package/dist/chat/message/chat-message.d.ts +25 -25
- package/dist/chat/message/chat-message.js +26 -26
- package/dist/chat/root/chat-root.d.ts +28 -41
- package/dist/chat/root/chat-root.js +27 -40
- package/dist/checkbox/root/checkbox-root.d.ts +10 -12
- package/dist/checkbox/root/checkbox-root.js +29 -35
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +32 -45
- package/dist/checkbox-group/root/checkbox-group-root.js +53 -79
- package/dist/code-block/root/code-block-root.d.ts +3 -4
- package/dist/code-block/root/code-block-root.js +8 -12
- package/dist/color-input/root/color-input-root.d.ts +36 -37
- package/dist/color-input/root/color-input-root.js +29 -34
- package/dist/color-picker/color.d.ts +7 -8
- package/dist/color-picker/color.js +7 -8
- package/dist/color-picker/root/color-picker-root.d.ts +55 -57
- package/dist/color-picker/root/color-picker-root.js +60 -64
- package/dist/combobox/root/combobox-root.d.ts +53 -58
- package/dist/combobox/root/combobox-root.js +85 -94
- package/dist/command/root/command-root.d.ts +8 -8
- package/dist/command/root/command-root.js +29 -33
- package/dist/copy-button/root/copy-button-root.d.ts +21 -24
- package/dist/copy-button/root/copy-button-root.js +25 -35
- package/dist/data-table/root/data-table-root.d.ts +77 -76
- package/dist/data-table/root/data-table-root.js +95 -84
- package/dist/data-table/root/order.d.ts +2 -2
- package/dist/data-table/root/order.js +1 -3
- package/dist/date-input/root/date-input-root.d.ts +88 -93
- package/dist/date-input/root/date-input-root.js +147 -158
- package/dist/date-picker/root/date-picker-root.d.ts +75 -83
- package/dist/date-picker/root/date-picker-root.js +120 -143
- package/dist/dialog/root/dialog-root.d.ts +41 -24
- package/dist/dialog/root/dialog-root.js +47 -24
- package/dist/divider/root/divider-root.d.ts +5 -6
- package/dist/divider/root/divider-root.js +4 -5
- package/dist/donut-chart/root/donut-chart-root.d.ts +22 -25
- package/dist/donut-chart/root/donut-chart-root.js +37 -51
- package/dist/drawer/root/drawer-root.d.ts +24 -29
- package/dist/drawer/root/drawer-root.js +15 -22
- package/dist/drilldown/item/drilldown-item.d.ts +14 -14
- package/dist/drilldown/item/drilldown-item.js +24 -26
- package/dist/drilldown/root/drilldown-root.d.ts +8 -10
- package/dist/drilldown/root/drilldown-root.js +6 -7
- package/dist/element-events.generated.js +1 -1
- package/dist/file-input/root/file-input-root.d.ts +20 -24
- package/dist/file-input/root/file-input-root.js +42 -57
- package/dist/format-date/root/format-date-root.js +1 -1
- package/dist/heatmap/root/buckets.d.ts +8 -8
- package/dist/heatmap/root/buckets.js +8 -8
- package/dist/heatmap/root/heatmap-root.d.ts +57 -63
- package/dist/heatmap/root/heatmap-root.js +72 -83
- package/dist/icon/root/icon-root.d.ts +4 -4
- package/dist/icon/root/icon-root.js +9 -9
- package/dist/icon-button/root/icon-button-root.d.ts +4 -6
- package/dist/icon-button/root/icon-button-root.js +4 -6
- package/dist/image/root/image-root.d.ts +49 -59
- package/dist/image/root/image-root.js +55 -65
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/input/root/input-root.d.ts +61 -85
- package/dist/input/root/input-root.js +79 -106
- package/dist/kbd/root/kbd-root.d.ts +8 -7
- package/dist/kbd/root/kbd-root.js +71 -11
- package/dist/legend/root/legend-root.d.ts +1 -1
- package/dist/legend/root/legend-root.js +4 -5
- package/dist/line-chart/root/line-chart-root.d.ts +26 -30
- package/dist/line-chart/root/line-chart-root.js +10 -10
- package/dist/list/item/list-item.d.ts +14 -18
- package/dist/list/item/list-item.js +18 -22
- package/dist/list/root/list-root.d.ts +4 -4
- package/dist/list/root/list-root.js +3 -3
- package/dist/listbox/root/listbox-root.d.ts +31 -58
- package/dist/listbox/root/listbox-root.js +66 -109
- package/dist/megamenu/root/megamenu-root.d.ts +34 -35
- package/dist/megamenu/root/megamenu-root.js +53 -58
- package/dist/menu/item/menu-item.d.ts +39 -53
- package/dist/menu/item/menu-item.js +50 -64
- package/dist/menu/root/menu-root.d.ts +30 -40
- package/dist/menu/root/menu-root.js +49 -82
- package/dist/meter/root/meter-root.d.ts +49 -53
- package/dist/meter/root/meter-root.js +22 -27
- package/dist/navigation/root/navigation-root.js +11 -19
- package/dist/notifications/notification/notification.d.ts +16 -22
- package/dist/notifications/notification/notification.js +21 -27
- package/dist/notifications/root/notifications-root.d.ts +31 -39
- package/dist/notifications/root/notifications-root.js +41 -52
- package/dist/number-input/root/number-input-root.d.ts +31 -33
- package/dist/number-input/root/number-input-root.js +37 -39
- package/dist/option/root/option-root.d.ts +73 -74
- package/dist/option/root/option-root.js +62 -64
- package/dist/outline/root/outline-root.d.ts +38 -44
- package/dist/outline/root/outline-root.js +66 -82
- package/dist/pagination/root/pagination-root.d.ts +87 -92
- package/dist/pagination/root/pagination-root.js +116 -123
- package/dist/pagination/size/pagination-size.d.ts +31 -50
- package/dist/pagination/size/pagination-size.js +35 -55
- package/dist/pagination/summary/pagination-summary.d.ts +12 -12
- package/dist/pagination/summary/pagination-summary.js +18 -18
- package/dist/pin-input/root/pin-input-root.d.ts +53 -70
- package/dist/pin-input/root/pin-input-root.js +74 -94
- package/dist/popover/root/popover-root.d.ts +15 -20
- package/dist/popover/root/popover-root.js +19 -36
- package/dist/progress/root/progress-root.d.ts +12 -14
- package/dist/progress/root/progress-root.js +22 -25
- package/dist/qr-code/root/qr-code-root.d.ts +11 -11
- package/dist/qr-code/root/qr-code-root.js +12 -14
- package/dist/radio/group/radio-group.js +19 -26
- package/dist/radio/root/radio-root.d.ts +12 -13
- package/dist/radio/root/radio-root.js +12 -13
- package/dist/rating/root/rating-root.d.ts +25 -30
- package/dist/rating/root/rating-root.js +43 -50
- package/dist/scroll-area/root/scroll-area-root.d.ts +11 -14
- package/dist/scroll-area/root/scroll-area-root.js +39 -33
- package/dist/select/root/select-root.d.ts +7 -12
- package/dist/select/root/select-root.js +40 -55
- package/dist/slider/root/slider-root.d.ts +53 -60
- package/dist/slider/root/slider-root.js +74 -85
- package/dist/sparkline/root/sparkline-root.d.ts +43 -47
- package/dist/sparkline/root/sparkline-root.js +23 -32
- package/dist/speed-dial/item/speed-dial-item.d.ts +6 -6
- package/dist/speed-dial/item/speed-dial-item.js +9 -9
- package/dist/speed-dial/root/speed-dial-root.d.ts +21 -25
- package/dist/speed-dial/root/speed-dial-root.js +32 -40
- package/dist/splitter/root/splitter-root.d.ts +98 -111
- package/dist/splitter/root/splitter-root.js +96 -123
- package/dist/stat/root/stat-root.d.ts +2 -7
- package/dist/stat/root/stat-root.js +0 -5
- package/dist/steps/step/step.d.ts +19 -24
- package/dist/steps/step/step.js +27 -32
- package/dist/switch/root/switch-root.js +2 -2
- package/dist/table/column/table-column.d.ts +54 -60
- package/dist/table/column/table-column.js +95 -68
- package/dist/table/root/table-root.d.ts +5 -6
- package/dist/table/root/table-root.js +7 -10
- package/dist/tabs/panel/tab-panel.d.ts +21 -25
- package/dist/tabs/panel/tab-panel.js +25 -29
- package/dist/tabs/root/tabs-root.d.ts +25 -34
- package/dist/tabs/root/tabs-root.js +22 -28
- package/dist/tabs/tab/tab.d.ts +12 -12
- package/dist/tabs/tab/tab.js +19 -20
- package/dist/textarea/root/textarea-root.d.ts +36 -36
- package/dist/textarea/root/textarea-root.js +43 -47
- package/dist/time-input/root/time-input-root.d.ts +58 -68
- package/dist/time-input/root/time-input-root.js +62 -77
- package/dist/time-picker/root/time-picker-root.d.ts +73 -79
- package/dist/time-picker/root/time-picker-root.js +72 -84
- package/dist/timeline/item/timeline-item.d.ts +8 -11
- package/dist/timeline/item/timeline-item.js +8 -11
- package/dist/timeline/root/timeline-root.d.ts +5 -7
- package/dist/timeline/root/timeline-root.js +5 -7
- package/dist/toast/item/toast-item.d.ts +9 -27
- package/dist/toast/item/toast-item.js +19 -41
- package/dist/toast/root/toast-root.d.ts +10 -14
- package/dist/toast/root/toast-root.js +4 -5
- package/dist/toggle/group/toggle-group.d.ts +6 -15
- package/dist/toggle/group/toggle-group.js +21 -36
- package/dist/toggle/root/toggle-root.d.ts +26 -27
- package/dist/toggle/root/toggle-root.js +30 -31
- package/dist/toolbar/root/toolbar-root.d.ts +7 -10
- package/dist/toolbar/root/toolbar-root.js +10 -14
- package/dist/tooltip/root/tooltip-root.d.ts +52 -59
- package/dist/tooltip/root/tooltip-root.js +98 -93
- package/dist/tour/root/tour-root.d.ts +19 -23
- package/dist/tour/root/tour-root.js +31 -41
- package/dist/tour/stop/tour-stop.d.ts +14 -15
- package/dist/tour/stop/tour-stop.js +31 -34
- package/dist/tree/item/tree-item.d.ts +30 -35
- package/dist/tree/item/tree-item.js +43 -55
- package/dist/tree/root/tree-root.d.ts +7 -10
- package/dist/tree/root/tree-root.js +33 -42
- package/dist/trend/root/trend-root.d.ts +3 -5
- package/dist/trend/root/trend-root.js +5 -9
- package/dist/video/root/video-root.d.ts +100 -124
- package/dist/video/root/video-root.js +142 -176
- package/dist/video-playlist/item/video-playlist-item.d.ts +16 -16
- package/dist/video-playlist/item/video-playlist-item.js +24 -24
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -8
- package/dist/video-playlist/menu/video-playlist-menu.js +20 -29
- package/dist/video-playlist/root/video-playlist-root.d.ts +16 -11
- package/dist/video-playlist/root/video-playlist-root.js +21 -25
- package/dist/virtual-list/root/virtual-list-root.d.ts +8 -12
- package/dist/virtual-list/root/virtual-list-root.js +11 -16
- package/jsx.d.ts +9797 -12561
- package/package.json +6 -6
- package/vue.d.ts +2684 -3228
|
@@ -11,13 +11,11 @@ import { property, state } from 'lit/decorators.js';
|
|
|
11
11
|
* @summary Links to the headings on this page, marking the one being read.
|
|
12
12
|
*
|
|
13
13
|
* @description
|
|
14
|
-
* A table of contents, named for the job.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `Navigation`, which is the same job at the other scale: one navigates a site, the
|
|
20
|
-
* other navigates a document.
|
|
14
|
+
* A table of contents, named for the job. It sits beside `Navigation`, which is
|
|
15
|
+
* the same job at the other scale: one navigates a site, the other navigates a
|
|
16
|
+
* document. `Contents` and `TableOfContents` are both taken by something else,
|
|
17
|
+
* `display: contents` and the `content` part in one case and the `Table` family
|
|
18
|
+
* in the other.
|
|
21
19
|
*
|
|
22
20
|
* **The links are the consumer's own anchors**, the same as `Navigation`. A router
|
|
23
21
|
* renders its own `<a>` and cannot render one inside this shadow root, and the
|
|
@@ -67,18 +65,6 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
67
65
|
indicator: () => this.renderRoot?.querySelector('[part="indicator"]'),
|
|
68
66
|
surface: () => this.renderRoot?.querySelector('[part="nav"]'),
|
|
69
67
|
});
|
|
70
|
-
/**
|
|
71
|
-
* Accessible name for the navigation.
|
|
72
|
-
*/
|
|
73
|
-
this.label = 'On this page';
|
|
74
|
-
/**
|
|
75
|
-
* How far below the top of the window a heading counts as reached, in pixels.
|
|
76
|
-
*
|
|
77
|
-
* The reading line. A page with a sticky masthead sets this to its height, or
|
|
78
|
-
* a little more: without it the current section changes as a heading slides
|
|
79
|
-
* under the chrome rather than as it reaches the top of what can be seen.
|
|
80
|
-
*/
|
|
81
|
-
this.offset = 0;
|
|
82
68
|
/**
|
|
83
69
|
* How a click on one of these links travels to its section.
|
|
84
70
|
*
|
|
@@ -101,6 +87,18 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
101
87
|
* JavaScript rather than CSS decides.
|
|
102
88
|
*/
|
|
103
89
|
this.behavior = 'auto';
|
|
90
|
+
/**
|
|
91
|
+
* Accessible name for the navigation.
|
|
92
|
+
*/
|
|
93
|
+
this.label = 'On this page';
|
|
94
|
+
/**
|
|
95
|
+
* How far below the top of the window a heading counts as reached, in pixels.
|
|
96
|
+
*
|
|
97
|
+
* The reading line. A page with a sticky masthead sets this to its height, or
|
|
98
|
+
* a little more: without it the current section changes as a heading slides
|
|
99
|
+
* under the chrome rather than as it reaches the top of what can be seen.
|
|
100
|
+
*/
|
|
101
|
+
this.offset = 0;
|
|
104
102
|
/**
|
|
105
103
|
* What `current` reports, which only `mark` writes.
|
|
106
104
|
*/
|
|
@@ -111,9 +109,6 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
111
109
|
* The two things an `IntersectionObserver` cannot see, and one listener for
|
|
112
110
|
* both.
|
|
113
111
|
*
|
|
114
|
-
* This component's own note said the observer keeps the marker honest without
|
|
115
|
-
* a scroll listener. It was wrong twice.
|
|
116
|
-
*
|
|
117
112
|
* *At the bottom*, arriving at the end of a page changes no intersection: a
|
|
118
113
|
* short last section is fully visible long before the final pixel, so its
|
|
119
114
|
* ratio reached 1 and stopped moving. Nothing fires for the scroll that ends
|
|
@@ -128,13 +123,12 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
128
123
|
* heading has not crossed yet, and no callback follows for the rest of the
|
|
129
124
|
* way.
|
|
130
125
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* coalesced to one call per frame however many events arrive.
|
|
126
|
+
* Marking once per animation frame while a scroll is happening covers both,
|
|
127
|
+
* where a listener that marks only when its own comparison changes fixes the
|
|
128
|
+
* bottom and cannot fix the settle. The cost is what `mark()` costs, a
|
|
129
|
+
* `getBoundingClientRect` per section on frames a reader is already scrolling
|
|
130
|
+
* through. Passive, and coalesced to one call per frame however many events
|
|
131
|
+
* arrive.
|
|
138
132
|
*/
|
|
139
133
|
this.handleScroll = () => {
|
|
140
134
|
if (this.frame !== 0) {
|
|
@@ -171,9 +165,7 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
171
165
|
* and wrong when they have said where they are going: traveling to the
|
|
172
166
|
* fifth section passes the second, third and fourth, each became current
|
|
173
167
|
* for a frame or two on the way, and the mark stepped down the list one
|
|
174
|
-
* item at a time instead of making the journey.
|
|
175
|
-
* each item rather than seamlessly moving", which is exactly what it was
|
|
176
|
-
* doing.
|
|
168
|
+
* item at a time instead of making the journey.
|
|
177
169
|
*
|
|
178
170
|
* Suppressed for any click on one of these links, not only the ones this
|
|
179
171
|
* component scrolls itself: a consumer with `scroll-behavior: smooth` on
|
|
@@ -298,10 +290,10 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
298
290
|
* thing being read, and the marker stayed on the second. The last item in a
|
|
299
291
|
* contents list was unreachable by scrolling.
|
|
300
292
|
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
293
|
+
* There is no mirror of it at the top: `passed` is empty there and the first
|
|
294
|
+
* section is already the fallback, and the first heading's top starts *at*
|
|
295
|
+
* the line rather than below it, so there is nothing for it to fail to
|
|
296
|
+
* reach.
|
|
305
297
|
*
|
|
306
298
|
* What this cannot do is tell trailing sections apart. If the last three
|
|
307
299
|
* share the final screenful, none of them can reach the line and the page
|
|
@@ -321,12 +313,10 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
321
313
|
link.removeAttribute('aria-current');
|
|
322
314
|
}
|
|
323
315
|
}
|
|
324
|
-
/* And say so, which
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* the one fact this component computes that nothing else on the page can,
|
|
329
|
-
* and the only way out of it was a `MutationObserver` on the anchors.
|
|
316
|
+
/* And say so. `reading` is derived from scroll position, which is the one
|
|
317
|
+
* fact this component computes that nothing else on the page can, so a
|
|
318
|
+
* consumer syncing a URL hash to it has no other way in short of a
|
|
319
|
+
* `MutationObserver` on the anchors.
|
|
330
320
|
*
|
|
331
321
|
* Only on a change, because this runs from a scroll frame and an event per
|
|
332
322
|
* frame is not a signal, it is a firehose. */
|
|
@@ -343,16 +333,16 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
343
333
|
* leaves the position a hair under the height at the very bottom and an exact
|
|
344
334
|
* comparison never fires.
|
|
345
335
|
*
|
|
346
|
-
* **All three numbers off the same element
|
|
347
|
-
*
|
|
348
|
-
* `documentElement.scrollHeight
|
|
349
|
-
* the viewport is what scrolls, and the body takes that job the
|
|
350
|
-
* becomes a scroll container. Measured on a page whose body is
|
|
336
|
+
* **All three numbers off the same element.** Adding the window's `scrollY`
|
|
337
|
+
* and `innerHeight` and comparing them against
|
|
338
|
+
* `documentElement.scrollHeight` mixes two coordinate systems, which agree
|
|
339
|
+
* only while the viewport is what scrolls, and the body takes that job the
|
|
340
|
+
* moment it becomes a scroll container. Measured on a page whose body is
|
|
351
341
|
* `overflow: clip visible`, which is a pair CSS resolves by making the
|
|
352
342
|
* `visible` axis `auto`: `documentElement.scrollTop` read 1126 at the bottom
|
|
353
343
|
* of the page and `window.scrollY` read 240, so a contents rail never learned
|
|
354
|
-
* it had reached the end and its last item stayed unreachable.
|
|
355
|
-
*
|
|
344
|
+
* it had reached the end and its last item stayed unreachable. This library's
|
|
345
|
+
* own base layer produces exactly that page.
|
|
356
346
|
*
|
|
357
347
|
* `clientHeight` rather than `innerHeight` for the same reason, and because it
|
|
358
348
|
* is the one that excludes a scrollbar, which is what `scrollHeight` is
|
|
@@ -368,15 +358,14 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
368
358
|
/**
|
|
369
359
|
* Gives every section the same reading line the marker uses.
|
|
370
360
|
*
|
|
371
|
-
* `offset`
|
|
372
|
-
*
|
|
373
|
-
* against the very top of the window
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
* it when taking you somewhere, which is the same number meaning two things.
|
|
361
|
+
* `offset` says where the top of the readable area is, so it has to govern
|
|
362
|
+
* where a click lands as much as what the marker calls current. Read by the
|
|
363
|
+
* marker alone, a click puts the heading against the very top of the window
|
|
364
|
+
* and underneath the sticky masthead the consumer measured the offset from,
|
|
365
|
+
* which is the same number meaning two things.
|
|
377
366
|
*
|
|
378
367
|
* `scroll-margin-block-start` rather than an interception, because it is the
|
|
379
|
-
* property the platform provides for exactly this and the UA
|
|
368
|
+
* property the platform provides for exactly this and the UA honors it on
|
|
380
369
|
* ordinary fragment navigation, on `scrollIntoView`, and on a browser
|
|
381
370
|
* restoring a position. Nothing has to be taken over to get it.
|
|
382
371
|
*
|
|
@@ -398,18 +387,17 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
398
387
|
* The thresholds are what make the trigger frequent enough: an observer fires
|
|
399
388
|
* on entering and leaving, and a long section scrolled slowly crosses neither
|
|
400
389
|
* for a long time. Asking for a callback at each quarter of visibility is
|
|
401
|
-
* cheap
|
|
390
|
+
* cheap. It is still only a trigger: see `handleScroll` for the two cases no
|
|
391
|
+
* intersection can see.
|
|
402
392
|
*/
|
|
403
393
|
watch() {
|
|
404
394
|
this.observer?.disconnect();
|
|
405
|
-
/* Nothing to watch yet is not nothing to watch ever.
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
* observer is left disconnected either way, so re-running is the whole of
|
|
412
|
-
* the fix, and `updated` re-runs it while there is nothing to watch. */
|
|
395
|
+
/* Nothing to watch yet is not nothing to watch ever. A page whose sections
|
|
396
|
+
* arrive after the nav does, which is every page rendering its content
|
|
397
|
+
* asynchronously, resolves no href at first update, and returning here
|
|
398
|
+
* without leaving a way back kills the component for the life of the page.
|
|
399
|
+
* `updated` re-runs this while `observer` is undefined, which is why the
|
|
400
|
+
* field is cleared rather than left holding a disconnected observer. */
|
|
413
401
|
if (this.sections.length === 0) {
|
|
414
402
|
this.observer = undefined;
|
|
415
403
|
return;
|
|
@@ -435,11 +423,9 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
435
423
|
this.observer = undefined;
|
|
436
424
|
this.resize?.disconnect();
|
|
437
425
|
this.resize = undefined;
|
|
438
|
-
/* The landing timer
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
looking at. Every other subscription here was already torn down, which is
|
|
442
|
-
what made this one easy to miss. */
|
|
426
|
+
/* The landing timer holds a closure over this element for 1.2 seconds after
|
|
427
|
+
it leaves the document and then touches it, which on a route change is a
|
|
428
|
+
write to a tree nobody is looking at. */
|
|
443
429
|
clearTimeout(this.landed);
|
|
444
430
|
this.landed = undefined;
|
|
445
431
|
}
|
|
@@ -447,15 +433,13 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
447
433
|
super.connectedCallback();
|
|
448
434
|
this.addEventListener('click', this.handleClick);
|
|
449
435
|
globalThis.addEventListener?.('scroll', this.handleScroll, { passive: true });
|
|
450
|
-
/* Both observers are rebuilt on reconnection
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* to say why. Guarded on `hasUpdated`, because the first connection happens
|
|
458
|
-
* before the first render and there is nothing to watch yet. */
|
|
436
|
+
/* Both observers are rebuilt on reconnection. `firstUpdated` runs once for
|
|
437
|
+
* the life of the element and `disconnectedCallback` runs every time it
|
|
438
|
+
* moves, so without this an outline moved in the DOM, which a framework does
|
|
439
|
+
* on any reorder, comes back permanently frozen: `aria-current`, `current`
|
|
440
|
+
* and the traveling mark all stop for the rest of the page's life with
|
|
441
|
+
* nothing to say why. Guarded on `hasUpdated`, because the first connection
|
|
442
|
+
* happens before the first render and there is nothing to watch yet. */
|
|
459
443
|
if (this.hasUpdated) {
|
|
460
444
|
this.watch();
|
|
461
445
|
this.resize = new ResizeObserver(() => this.indicator.place());
|
|
@@ -501,15 +485,15 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
501
485
|
</nav>`;
|
|
502
486
|
}
|
|
503
487
|
};
|
|
488
|
+
__decorate([
|
|
489
|
+
property()
|
|
490
|
+
], HelixHeadlessOutline.prototype, "behavior", void 0);
|
|
504
491
|
__decorate([
|
|
505
492
|
property()
|
|
506
493
|
], HelixHeadlessOutline.prototype, "label", void 0);
|
|
507
494
|
__decorate([
|
|
508
495
|
property({ type: Number })
|
|
509
496
|
], HelixHeadlessOutline.prototype, "offset", void 0);
|
|
510
|
-
__decorate([
|
|
511
|
-
property()
|
|
512
|
-
], HelixHeadlessOutline.prototype, "behavior", void 0);
|
|
513
497
|
__decorate([
|
|
514
498
|
state()
|
|
515
499
|
], HelixHeadlessOutline.prototype, "reading", void 0);
|
|
@@ -40,13 +40,12 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
40
40
|
* result that has not changed. A consumer driving the view has to be able to
|
|
41
41
|
* hear that without being told an answer changed.
|
|
42
42
|
*
|
|
43
|
-
* **The count and the page-size control are their own elements.**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* and
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* else.
|
|
43
|
+
* **The count and the page-size control are their own elements.** A slot can
|
|
44
|
+
* only offer one place: at one end of one row, in one order, on one axis.
|
|
45
|
+
* `Pagination.Summary` and `Pagination.Size` sit beside this one instead, so
|
|
46
|
+
* the direction and the order of a footer are the consumer's, which is what
|
|
47
|
+
* they were always going to want. `total` and `page-size` stay here for the
|
|
48
|
+
* arithmetic below and nothing else.
|
|
50
49
|
*
|
|
51
50
|
* **A single page renders nothing.** A control offering one page offers no
|
|
52
51
|
* navigation, and the row it sits in should close over it rather than hold a
|
|
@@ -56,16 +55,16 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
56
55
|
* framework reports the difference; a custom state carries the same fact to a
|
|
57
56
|
* stylesheet and none of that to the DOM.
|
|
58
57
|
*
|
|
59
|
-
* **And a page change is announced.**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
58
|
+
* **And a page change is announced.** Moving the page moves `aria-current` onto
|
|
59
|
+
* a different element, which a screen reader does not announce, so a reader who
|
|
60
|
+
* pressed 5 hears the word "5" from the button they were on and nothing at all
|
|
61
|
+
* about having arrived. A polite live region says where they now are. It ships
|
|
62
|
+
* empty and is filled only on a change, because a region populated as it enters
|
|
63
|
+
* the document announces itself on arrival.
|
|
65
64
|
*
|
|
66
|
-
* `page` is the
|
|
67
|
-
*
|
|
68
|
-
*
|
|
65
|
+
* `page` is what the element holds and `default-page` seeds it. A consumer
|
|
66
|
+
* paging through a router refuses `helix-navigate` and assigns their own, which
|
|
67
|
+
* is how they take the decision.
|
|
69
68
|
*
|
|
70
69
|
* @since 0.1.0
|
|
71
70
|
* @status experimental
|
|
@@ -94,35 +93,25 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
94
93
|
*/
|
|
95
94
|
export declare class HelixHeadlessPagination extends HelixElement {
|
|
96
95
|
/**
|
|
97
|
-
* How many pages
|
|
98
|
-
*
|
|
99
|
-
* Clamped to at least one wherever it is read, so a result that has not
|
|
100
|
-
* loaded yet renders a single page rather than an empty control that then
|
|
101
|
-
* appears and pushes the layout down.
|
|
102
|
-
*
|
|
103
|
-
* Left unset where `total` and `page-size` are both given, since the two of
|
|
104
|
-
* them already say it. A fallback rather than an override: writing this wins,
|
|
105
|
-
* so there is never a question of which of two sources is current.
|
|
96
|
+
* How many pages to show at each end, whatever the current one is.
|
|
106
97
|
*/
|
|
107
|
-
|
|
98
|
+
boundaries: number;
|
|
108
99
|
/**
|
|
109
|
-
*
|
|
100
|
+
* Where the numbers are replaced by a reading of the two.
|
|
110
101
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
102
|
+
* A different structure rather than a different look, which is why it is
|
|
103
|
+
* here: the run of pages is gone and a single status line stands in its
|
|
104
|
+
* place. This is the shape a narrow screen wants, and the only shape possible
|
|
105
|
+
* where the total is large enough that no window over it is useful.
|
|
113
106
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
107
|
+
* Not reflected, for the reason `ends` is not: it decides what renders, so
|
|
108
|
+
* nothing has to select on it.
|
|
116
109
|
*/
|
|
117
|
-
|
|
110
|
+
compact: boolean;
|
|
118
111
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* Only arithmetic: this does not slice anything, because the component never
|
|
122
|
-
* sees the items. It is what turns `total` into a page count, and nothing
|
|
123
|
-
* else.
|
|
112
|
+
* Page to open on, where nothing declared one.
|
|
124
113
|
*/
|
|
125
|
-
|
|
114
|
+
defaultPage: number;
|
|
126
115
|
/**
|
|
127
116
|
* Whether to offer a jump to the first and last pages.
|
|
128
117
|
*
|
|
@@ -142,34 +131,28 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
142
131
|
* The page on show, one-based.
|
|
143
132
|
*
|
|
144
133
|
* An accessor pair, the same shape as the calendar's `month`. Reading gives
|
|
145
|
-
* the page on show; writing
|
|
146
|
-
*
|
|
134
|
+
* the page on show; writing sets it, and `default-page` seeds one the element
|
|
135
|
+
* keeps until somebody does.
|
|
147
136
|
*
|
|
148
137
|
* **Clamped on the way out, because "the page on show" is what it says it
|
|
149
|
-
* gives.**
|
|
150
|
-
* ten-page result
|
|
151
|
-
*
|
|
152
|
-
* not exist while the control in front of them
|
|
138
|
+
* gives.** Returning whatever was written means `default-page="99"` on a
|
|
139
|
+
* ten-page result renders page 10, marks page 10 with `aria-current`, and
|
|
140
|
+
* reports 99, so a consumer syncing their query from this reads a page that
|
|
141
|
+
* does not exist while the control in front of them says otherwise. Not a
|
|
153
142
|
* far-fetched value: it is a bookmarked link after the result shrank.
|
|
154
143
|
*
|
|
155
144
|
* Rounded here too, so `2.7` reads as the 2 it renders.
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
145
|
*/
|
|
159
146
|
get page(): number;
|
|
160
147
|
set page(next: number);
|
|
161
148
|
/**
|
|
162
|
-
*
|
|
163
|
-
*/
|
|
164
|
-
defaultPage: number;
|
|
165
|
-
/**
|
|
166
|
-
* How many pages to show either side of the current one.
|
|
149
|
+
* Accessible name for the control that jumps to the first page.
|
|
167
150
|
*/
|
|
168
|
-
|
|
151
|
+
firstLabel: string;
|
|
169
152
|
/**
|
|
170
|
-
*
|
|
153
|
+
* Accessible name for a gap, with `{page}` filled in as where it goes.
|
|
171
154
|
*/
|
|
172
|
-
|
|
155
|
+
gapLabel: string;
|
|
173
156
|
/**
|
|
174
157
|
* Address for a page, with `{page}` standing in for its number.
|
|
175
158
|
*
|
|
@@ -178,22 +161,14 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
178
161
|
* one, and the back button works without the consumer wiring anything.
|
|
179
162
|
*/
|
|
180
163
|
href: string;
|
|
181
|
-
/**
|
|
182
|
-
* Where the numbers are replaced by a reading of the two.
|
|
183
|
-
*
|
|
184
|
-
* A different structure rather than a different look, which is why it is
|
|
185
|
-
* here: the run of pages is gone and a single status line stands in its
|
|
186
|
-
* place. This is the shape a narrow screen wants, and the only shape possible
|
|
187
|
-
* where the total is large enough that no window over it is useful.
|
|
188
|
-
*
|
|
189
|
-
* Not reflected, for the reason `ends` is not: it decides what renders, so
|
|
190
|
-
* nothing has to select on it.
|
|
191
|
-
*/
|
|
192
|
-
compact: boolean;
|
|
193
164
|
/**
|
|
194
165
|
* Accessible name for the navigation landmark.
|
|
195
166
|
*/
|
|
196
167
|
label: string;
|
|
168
|
+
/**
|
|
169
|
+
* Accessible name for the control that jumps to the last page.
|
|
170
|
+
*/
|
|
171
|
+
lastLabel: string;
|
|
197
172
|
/**
|
|
198
173
|
* Locale for the page numbers. Absent uses the runtime's own.
|
|
199
174
|
*
|
|
@@ -208,39 +183,61 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
208
183
|
* different address from `?page=1234`.
|
|
209
184
|
*/
|
|
210
185
|
locale: string;
|
|
186
|
+
/**
|
|
187
|
+
* Accessible name for the control that moves forward.
|
|
188
|
+
*/
|
|
189
|
+
nextLabel: string;
|
|
211
190
|
/**
|
|
212
191
|
* Accessible name for one page, with `{page}` and `{pages}` filled in.
|
|
213
192
|
*/
|
|
214
193
|
pageLabel: string;
|
|
215
194
|
/**
|
|
216
|
-
*
|
|
195
|
+
* How many pages there are in total.
|
|
217
196
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* and
|
|
221
|
-
*
|
|
197
|
+
* Clamped to at least one wherever it is read, so a result that has not
|
|
198
|
+
* loaded yet renders a single page rather than an empty control that then
|
|
199
|
+
* appears and pushes the layout down.
|
|
200
|
+
*
|
|
201
|
+
* Left unset where `total` and `page-size` are both given, since the two of
|
|
202
|
+
* them already say it. A fallback rather than an override: writing this wins,
|
|
203
|
+
* so there is never a question of which of two sources is current.
|
|
222
204
|
*/
|
|
223
|
-
|
|
205
|
+
pages: number;
|
|
224
206
|
/**
|
|
225
|
-
*
|
|
207
|
+
* How many items are on a page.
|
|
208
|
+
*
|
|
209
|
+
* Only arithmetic: this does not slice anything, because the component never
|
|
210
|
+
* sees the items. It is what turns `total` into a page count, and nothing
|
|
211
|
+
* else.
|
|
226
212
|
*/
|
|
227
|
-
|
|
213
|
+
pageSize: number;
|
|
228
214
|
/**
|
|
229
|
-
* Accessible name for the control that moves
|
|
215
|
+
* Accessible name for the control that moves back.
|
|
230
216
|
*/
|
|
231
|
-
|
|
217
|
+
previousLabel: string;
|
|
232
218
|
/**
|
|
233
|
-
*
|
|
219
|
+
* How many pages to show either side of the current one.
|
|
234
220
|
*/
|
|
235
|
-
|
|
221
|
+
siblings: number;
|
|
236
222
|
/**
|
|
237
|
-
*
|
|
223
|
+
* The reading shown in `compact`, with `{page}` and `{pages}` filled in.
|
|
224
|
+
*
|
|
225
|
+
* No noun: the landmark this sits in is already named "Pagination", so
|
|
226
|
+
* "Page 7 of 24" says it twice to a screen reader and takes a third of the
|
|
227
|
+
* width from a control whose whole reason for existing is that the row is
|
|
228
|
+
* narrow. The numbers are the reading.
|
|
238
229
|
*/
|
|
239
|
-
|
|
230
|
+
statusLabel: string;
|
|
240
231
|
/**
|
|
241
|
-
*
|
|
232
|
+
* How many items there are across every page.
|
|
233
|
+
*
|
|
234
|
+
* What `pages` falls back to together with `page-size`. Unset is the common
|
|
235
|
+
* case, where a consumer knows the page total and not the item total.
|
|
236
|
+
*
|
|
237
|
+
* Nothing is rendered from it. `Pagination.Summary` is what reads a total out
|
|
238
|
+
* to a reader, and takes its own.
|
|
242
239
|
*/
|
|
243
|
-
|
|
240
|
+
total: number;
|
|
244
241
|
/**
|
|
245
242
|
* What the live region says, and nothing until the page has moved once.
|
|
246
243
|
*
|
|
@@ -265,7 +262,7 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
265
262
|
* later and pushes the layout down.
|
|
266
263
|
*/
|
|
267
264
|
private get count();
|
|
268
|
-
/** The page on show
|
|
265
|
+
/** The page on show, which `page` has already clamped. */
|
|
269
266
|
private get current();
|
|
270
267
|
/**
|
|
271
268
|
* Which pages to show, and where the runs break.
|
|
@@ -285,9 +282,8 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
285
282
|
* Asks to move, and reports whether the request stood.
|
|
286
283
|
*
|
|
287
284
|
* Announced before it is applied, so `preventDefault()` is a refusal and
|
|
288
|
-
* nothing moves.
|
|
289
|
-
*
|
|
290
|
-
* asked for another one.
|
|
285
|
+
* nothing moves. A consumer who holds the page refuses it and assigns their
|
|
286
|
+
* own.
|
|
291
287
|
*/
|
|
292
288
|
private request;
|
|
293
289
|
/**
|
|
@@ -333,17 +329,16 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
333
329
|
* at which it stops being possible. It would also make `Pagination` depend on
|
|
334
330
|
* `Menu` and `Popover` for a case a button already covers.
|
|
335
331
|
*
|
|
336
|
-
* So it is announced rather than hidden
|
|
337
|
-
*
|
|
338
|
-
*
|
|
332
|
+
* So it is announced rather than hidden: a control a reader can reach has to
|
|
333
|
+
* be in the tree, and the label naming its destination is the whole
|
|
334
|
+
* affordance.
|
|
339
335
|
*/
|
|
340
336
|
private renderGap;
|
|
341
337
|
/**
|
|
342
338
|
* Everything a step needs, computed once, so the markup below is only markup.
|
|
343
339
|
*
|
|
344
|
-
* Split out because the part name has to be a literal.
|
|
345
|
-
*
|
|
346
|
-
* cannot see: nothing pairs it with its `@csspart` and a later rename takes
|
|
340
|
+
* Split out because the part name has to be a literal. A part name is read
|
|
341
|
+
* from the source, so a computed one is a part nothing can see: nothing pairs it with its `@csspart` and a later rename takes
|
|
347
342
|
* the promise silently. With four controls and two shapes each that is eight
|
|
348
343
|
* literals, and eight copies of the arithmetic behind them would be the
|
|
349
344
|
* actual duplication. This is the arithmetic, written once.
|