@fusion.dev/helix-headless 0.0.0-dev
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/LICENSE +21 -0
- package/custom-elements.json +75202 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +2 -0
- package/dist/accordion/item/accordion-item.d.ts +141 -0
- package/dist/accordion/item/accordion-item.js +214 -0
- package/dist/accordion/root/accordion-root.d.ts +57 -0
- package/dist/accordion/root/accordion-root.js +96 -0
- package/dist/announcement/index.d.ts +1 -0
- package/dist/announcement/index.js +1 -0
- package/dist/announcement/root/announcement-root.d.ts +106 -0
- package/dist/announcement/root/announcement-root.js +144 -0
- package/dist/app-header/index.d.ts +1 -0
- package/dist/app-header/index.js +1 -0
- package/dist/app-header/root/app-header-root.d.ts +113 -0
- package/dist/app-header/root/app-header-root.js +147 -0
- package/dist/avatar/group/avatar-group.d.ts +116 -0
- package/dist/avatar/group/avatar-group.js +136 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +2 -0
- package/dist/avatar/root/avatar-root.d.ts +71 -0
- package/dist/avatar/root/avatar-root.js +147 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +1 -0
- package/dist/badge/root/badge-root.d.ts +61 -0
- package/dist/badge/root/badge-root.js +121 -0
- package/dist/bar-chart/index.d.ts +1 -0
- package/dist/bar-chart/index.js +1 -0
- package/dist/bar-chart/root/bar-chart-root.d.ts +266 -0
- package/dist/bar-chart/root/bar-chart-root.js +515 -0
- package/dist/blockquote/index.d.ts +1 -0
- package/dist/blockquote/index.js +1 -0
- package/dist/blockquote/root/blockquote-root.d.ts +51 -0
- package/dist/blockquote/root/blockquote-root.js +84 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +104 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +137 -0
- package/dist/breadcrumbs/index.d.ts +2 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +77 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +94 -0
- package/dist/button/index.d.ts +1 -0
- package/dist/button/index.js +1 -0
- package/dist/button/root/button-root.d.ts +251 -0
- package/dist/button/root/button-root.js +401 -0
- package/dist/button-group/index.d.ts +1 -0
- package/dist/button-group/index.js +1 -0
- package/dist/button-group/root/button-group-root.d.ts +62 -0
- package/dist/button-group/root/button-group-root.js +62 -0
- package/dist/callout/index.d.ts +1 -0
- package/dist/callout/index.js +1 -0
- package/dist/callout/root/callout-root.d.ts +72 -0
- package/dist/callout/root/callout-root.js +90 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +1 -0
- package/dist/card/root/card-root.d.ts +54 -0
- package/dist/card/root/card-root.js +71 -0
- package/dist/carousel/index.d.ts +1 -0
- package/dist/carousel/index.js +1 -0
- package/dist/carousel/root/carousel-root.d.ts +399 -0
- package/dist/carousel/root/carousel-root.js +723 -0
- package/dist/chat/composer/chat-composer.d.ts +160 -0
- package/dist/chat/composer/chat-composer.js +273 -0
- package/dist/chat/index.d.ts +3 -0
- package/dist/chat/index.js +3 -0
- package/dist/chat/message/chat-message.d.ts +170 -0
- package/dist/chat/message/chat-message.js +271 -0
- package/dist/chat/root/chat-root.d.ts +216 -0
- package/dist/chat/root/chat-root.js +389 -0
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/checkbox/root/checkbox-root.d.ts +108 -0
- package/dist/checkbox/root/checkbox-root.js +207 -0
- package/dist/checkbox-group/index.d.ts +1 -0
- package/dist/checkbox-group/index.js +1 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +155 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +293 -0
- package/dist/code/index.d.ts +1 -0
- package/dist/code/index.js +1 -0
- package/dist/code/root/code-root.d.ts +36 -0
- package/dist/code/root/code-root.js +43 -0
- package/dist/code-block/index.d.ts +1 -0
- package/dist/code-block/index.js +1 -0
- package/dist/code-block/root/code-block-root.d.ts +112 -0
- package/dist/code-block/root/code-block-root.js +155 -0
- package/dist/color-input/index.d.ts +1 -0
- package/dist/color-input/index.js +1 -0
- package/dist/color-input/root/color-input-root.d.ts +227 -0
- package/dist/color-input/root/color-input-root.js +456 -0
- package/dist/color-picker/color.d.ts +74 -0
- package/dist/color-picker/color.js +238 -0
- package/dist/color-picker/index.d.ts +2 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/color-picker/root/color-picker-root.d.ts +303 -0
- package/dist/color-picker/root/color-picker-root.js +576 -0
- package/dist/combobox/index.d.ts +1 -0
- package/dist/combobox/index.js +1 -0
- package/dist/combobox/root/combobox-root.d.ts +396 -0
- package/dist/combobox/root/combobox-root.js +808 -0
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +1 -0
- package/dist/command/root/command-root.d.ts +166 -0
- package/dist/command/root/command-root.js +353 -0
- package/dist/copy-button/index.d.ts +1 -0
- package/dist/copy-button/index.js +1 -0
- package/dist/copy-button/root/copy-button-root.d.ts +154 -0
- package/dist/copy-button/root/copy-button-root.js +225 -0
- package/dist/data-table/index.d.ts +2 -0
- package/dist/data-table/index.js +2 -0
- package/dist/data-table/root/data-table-root.d.ts +392 -0
- package/dist/data-table/root/data-table-root.js +729 -0
- package/dist/data-table/root/order.d.ts +116 -0
- package/dist/data-table/root/order.js +175 -0
- package/dist/date-input/index.d.ts +1 -0
- package/dist/date-input/index.js +1 -0
- package/dist/date-input/root/date-input-root.d.ts +361 -0
- package/dist/date-input/root/date-input-root.js +791 -0
- package/dist/date-picker/index.d.ts +1 -0
- package/dist/date-picker/index.js +1 -0
- package/dist/date-picker/root/date-picker-root.d.ts +361 -0
- package/dist/date-picker/root/date-picker-root.js +837 -0
- package/dist/dialog/index.d.ts +1 -0
- package/dist/dialog/index.js +1 -0
- package/dist/dialog/root/dialog-root.d.ts +185 -0
- package/dist/dialog/root/dialog-root.js +319 -0
- package/dist/divider/index.d.ts +1 -0
- package/dist/divider/index.js +1 -0
- package/dist/divider/root/divider-root.d.ts +68 -0
- package/dist/divider/root/divider-root.js +116 -0
- package/dist/donut-chart/index.d.ts +1 -0
- package/dist/donut-chart/index.js +1 -0
- package/dist/donut-chart/root/donut-chart-root.d.ts +209 -0
- package/dist/donut-chart/root/donut-chart-root.js +395 -0
- package/dist/drawer/index.d.ts +1 -0
- package/dist/drawer/index.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +144 -0
- package/dist/drawer/root/drawer-root.js +222 -0
- package/dist/drilldown/index.d.ts +2 -0
- package/dist/drilldown/index.js +2 -0
- package/dist/drilldown/item/drilldown-item.d.ts +87 -0
- package/dist/drilldown/item/drilldown-item.js +152 -0
- package/dist/drilldown/root/drilldown-root.d.ts +115 -0
- package/dist/drilldown/root/drilldown-root.js +263 -0
- package/dist/element-events.generated.d.ts +1 -0
- package/dist/element-events.generated.js +125 -0
- package/dist/empty/index.d.ts +1 -0
- package/dist/empty/index.js +1 -0
- package/dist/empty/root/empty-root.d.ts +47 -0
- package/dist/empty/root/empty-root.js +68 -0
- package/dist/file-input/index.d.ts +1 -0
- package/dist/file-input/index.js +1 -0
- package/dist/file-input/root/file-input-root.d.ts +196 -0
- package/dist/file-input/root/file-input-root.js +488 -0
- package/dist/format-date/index.d.ts +1 -0
- package/dist/format-date/index.js +1 -0
- package/dist/format-date/root/format-date-root.d.ts +151 -0
- package/dist/format-date/root/format-date-root.js +266 -0
- package/dist/heatmap/index.d.ts +2 -0
- package/dist/heatmap/index.js +2 -0
- package/dist/heatmap/root/buckets.d.ts +62 -0
- package/dist/heatmap/root/buckets.js +85 -0
- package/dist/heatmap/root/heatmap-root.d.ts +330 -0
- package/dist/heatmap/root/heatmap-root.js +526 -0
- package/dist/icon/index.d.ts +1 -0
- package/dist/icon/index.js +1 -0
- package/dist/icon/root/icon-root.d.ts +53 -0
- package/dist/icon/root/icon-root.js +93 -0
- package/dist/icon-button/index.d.ts +1 -0
- package/dist/icon-button/index.js +1 -0
- package/dist/icon-button/root/icon-button-root.d.ts +40 -0
- package/dist/icon-button/root/icon-button-root.js +46 -0
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +1 -0
- package/dist/image/root/image-root.d.ts +213 -0
- package/dist/image/root/image-root.js +335 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +99 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.js +1 -0
- package/dist/input/root/input-root.d.ts +281 -0
- package/dist/input/root/input-root.js +472 -0
- package/dist/kbd/index.d.ts +1 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/root/kbd-root.d.ts +98 -0
- package/dist/kbd/root/kbd-root.js +230 -0
- package/dist/legend/index.d.ts +1 -0
- package/dist/legend/index.js +1 -0
- package/dist/legend/root/legend-root.d.ts +83 -0
- package/dist/legend/root/legend-root.js +125 -0
- package/dist/line-chart/index.d.ts +1 -0
- package/dist/line-chart/index.js +1 -0
- package/dist/line-chart/root/line-chart-root.d.ts +238 -0
- package/dist/line-chart/root/line-chart-root.js +365 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/list/item/list-item.d.ts +95 -0
- package/dist/list/item/list-item.js +148 -0
- package/dist/list/root/list-root.d.ts +72 -0
- package/dist/list/root/list-root.js +61 -0
- package/dist/listbox/index.d.ts +1 -0
- package/dist/listbox/index.js +1 -0
- package/dist/listbox/root/listbox-root.d.ts +357 -0
- package/dist/listbox/root/listbox-root.js +890 -0
- package/dist/loader/index.d.ts +1 -0
- package/dist/loader/index.js +1 -0
- package/dist/loader/root/loader-root.d.ts +52 -0
- package/dist/loader/root/loader-root.js +74 -0
- package/dist/megamenu/index.d.ts +1 -0
- package/dist/megamenu/index.js +1 -0
- package/dist/megamenu/root/megamenu-root.d.ts +254 -0
- package/dist/megamenu/root/megamenu-root.js +526 -0
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.js +2 -0
- package/dist/menu/item/menu-item.d.ts +231 -0
- package/dist/menu/item/menu-item.js +405 -0
- package/dist/menu/root/menu-root.d.ts +158 -0
- package/dist/menu/root/menu-root.js +422 -0
- package/dist/meter/index.d.ts +1 -0
- package/dist/meter/index.js +1 -0
- package/dist/meter/root/meter-root.d.ts +234 -0
- package/dist/meter/root/meter-root.js +316 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/root/navigation-root.d.ts +55 -0
- package/dist/navigation/root/navigation-root.js +130 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/notification/notification.d.ts +181 -0
- package/dist/notifications/notification/notification.js +305 -0
- package/dist/notifications/root/notifications-root.d.ts +168 -0
- package/dist/notifications/root/notifications-root.js +291 -0
- package/dist/number-input/index.d.ts +1 -0
- package/dist/number-input/index.js +1 -0
- package/dist/number-input/root/number-input-root.d.ts +282 -0
- package/dist/number-input/root/number-input-root.js +592 -0
- package/dist/option/group/option-group.d.ts +38 -0
- package/dist/option/group/option-group.js +58 -0
- package/dist/option/index.d.ts +2 -0
- package/dist/option/index.js +2 -0
- package/dist/option/root/option-root.d.ts +194 -0
- package/dist/option/root/option-root.js +247 -0
- package/dist/outline/index.d.ts +1 -0
- package/dist/outline/index.js +1 -0
- package/dist/outline/root/outline-root.d.ts +237 -0
- package/dist/outline/root/outline-root.js +519 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +3 -0
- package/dist/pagination/root/pagination-root.d.ts +390 -0
- package/dist/pagination/root/pagination-root.js +695 -0
- package/dist/pagination/size/pagination-size.d.ts +127 -0
- package/dist/pagination/size/pagination-size.js +232 -0
- package/dist/pagination/summary/pagination-summary.d.ts +90 -0
- package/dist/pagination/summary/pagination-summary.js +145 -0
- package/dist/pin-input/index.d.ts +1 -0
- package/dist/pin-input/index.js +1 -0
- package/dist/pin-input/root/pin-input-root.d.ts +292 -0
- package/dist/pin-input/root/pin-input-root.js +553 -0
- package/dist/popover/index.d.ts +1 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover/root/popover-root.d.ts +108 -0
- package/dist/popover/root/popover-root.js +231 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +1 -0
- package/dist/progress/root/progress-root.d.ts +125 -0
- package/dist/progress/root/progress-root.js +212 -0
- package/dist/qr-code/index.d.ts +1 -0
- package/dist/qr-code/index.js +1 -0
- package/dist/qr-code/root/qr-code-root.d.ts +93 -0
- package/dist/qr-code/root/qr-code-root.js +233 -0
- package/dist/quote/index.d.ts +1 -0
- package/dist/quote/index.js +1 -0
- package/dist/quote/root/quote-root.d.ts +36 -0
- package/dist/quote/root/quote-root.js +50 -0
- package/dist/radio/group/radio-group.d.ts +84 -0
- package/dist/radio/group/radio-group.js +170 -0
- package/dist/radio/index.d.ts +2 -0
- package/dist/radio/index.js +2 -0
- package/dist/radio/root/radio-root.d.ts +102 -0
- package/dist/radio/root/radio-root.js +151 -0
- package/dist/rating/index.d.ts +1 -0
- package/dist/rating/index.js +1 -0
- package/dist/rating/root/rating-root.d.ts +242 -0
- package/dist/rating/root/rating-root.js +484 -0
- package/dist/scroll-area/index.d.ts +1 -0
- package/dist/scroll-area/index.js +1 -0
- package/dist/scroll-area/root/scroll-area-root.d.ts +96 -0
- package/dist/scroll-area/root/scroll-area-root.js +215 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +1 -0
- package/dist/select/root/select-root.d.ts +170 -0
- package/dist/select/root/select-root.js +419 -0
- package/dist/skeleton/index.d.ts +1 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/root/skeleton-root.d.ts +31 -0
- package/dist/skeleton/root/skeleton-root.js +42 -0
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +1 -0
- package/dist/slider/root/slider-root.d.ts +235 -0
- package/dist/slider/root/slider-root.js +488 -0
- package/dist/sparkline/index.d.ts +1 -0
- package/dist/sparkline/index.js +1 -0
- package/dist/sparkline/root/sparkline-root.d.ts +147 -0
- package/dist/sparkline/root/sparkline-root.js +278 -0
- package/dist/speed-dial/index.d.ts +2 -0
- package/dist/speed-dial/index.js +2 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +71 -0
- package/dist/speed-dial/item/speed-dial-item.js +113 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +122 -0
- package/dist/speed-dial/root/speed-dial-root.js +251 -0
- package/dist/splitter/index.d.ts +1 -0
- package/dist/splitter/index.js +1 -0
- package/dist/splitter/root/splitter-root.d.ts +491 -0
- package/dist/splitter/root/splitter-root.js +1030 -0
- package/dist/stat/group/stat-group.d.ts +30 -0
- package/dist/stat/group/stat-group.js +47 -0
- package/dist/stat/index.d.ts +2 -0
- package/dist/stat/index.js +2 -0
- package/dist/stat/root/stat-root.d.ts +62 -0
- package/dist/stat/root/stat-root.js +51 -0
- package/dist/steps/index.d.ts +2 -0
- package/dist/steps/index.js +2 -0
- package/dist/steps/root/steps-root.d.ts +110 -0
- package/dist/steps/root/steps-root.js +130 -0
- package/dist/steps/step/step.d.ts +139 -0
- package/dist/steps/step/step.js +215 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch/root/switch-root.d.ts +74 -0
- package/dist/switch/root/switch-root.js +153 -0
- package/dist/table/cell/table-cell.d.ts +34 -0
- package/dist/table/cell/table-cell.js +52 -0
- package/dist/table/column/table-column.d.ts +165 -0
- package/dist/table/column/table-column.js +222 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +4 -0
- package/dist/table/root/table-root.d.ts +98 -0
- package/dist/table/root/table-root.js +161 -0
- package/dist/table/row/table-row.d.ts +27 -0
- package/dist/table/row/table-row.js +42 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/panel/tab-panel.d.ts +67 -0
- package/dist/tabs/panel/tab-panel.js +98 -0
- package/dist/tabs/root/tabs-root.d.ts +123 -0
- package/dist/tabs/root/tabs-root.js +217 -0
- package/dist/tabs/tab/tab.d.ts +64 -0
- package/dist/tabs/tab/tab.js +116 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +41 -0
- package/dist/tag/root/tag-root.js +67 -0
- package/dist/textarea/index.d.ts +1 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/root/textarea-root.d.ts +215 -0
- package/dist/textarea/root/textarea-root.js +380 -0
- package/dist/time-input/index.d.ts +1 -0
- package/dist/time-input/index.js +1 -0
- package/dist/time-input/root/time-input-root.d.ts +322 -0
- package/dist/time-input/root/time-input-root.js +661 -0
- package/dist/time-picker/index.d.ts +1 -0
- package/dist/time-picker/index.js +1 -0
- package/dist/time-picker/root/time-picker-root.d.ts +380 -0
- package/dist/time-picker/root/time-picker-root.js +669 -0
- package/dist/timeline/index.d.ts +2 -0
- package/dist/timeline/index.js +2 -0
- package/dist/timeline/item/timeline-item.d.ts +81 -0
- package/dist/timeline/item/timeline-item.js +128 -0
- package/dist/timeline/root/timeline-root.d.ts +52 -0
- package/dist/timeline/root/timeline-root.js +72 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/item/toast-item.d.ts +183 -0
- package/dist/toast/item/toast-item.js +345 -0
- package/dist/toast/root/toast-root.d.ts +72 -0
- package/dist/toast/root/toast-root.js +87 -0
- package/dist/toggle/group/toggle-group.d.ts +140 -0
- package/dist/toggle/group/toggle-group.js +278 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +2 -0
- package/dist/toggle/root/toggle-root.d.ts +99 -0
- package/dist/toggle/root/toggle-root.js +146 -0
- package/dist/toolbar/index.d.ts +1 -0
- package/dist/toolbar/index.js +1 -0
- package/dist/toolbar/root/toolbar-root.d.ts +105 -0
- package/dist/toolbar/root/toolbar-root.js +260 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tooltip/root/tooltip-root.d.ts +388 -0
- package/dist/tooltip/root/tooltip-root.js +707 -0
- package/dist/tour/index.d.ts +2 -0
- package/dist/tour/index.js +2 -0
- package/dist/tour/root/tour-root.d.ts +161 -0
- package/dist/tour/root/tour-root.js +351 -0
- package/dist/tour/stop/tour-stop.d.ts +131 -0
- package/dist/tour/stop/tour-stop.js +249 -0
- package/dist/tree/index.d.ts +2 -0
- package/dist/tree/index.js +2 -0
- package/dist/tree/item/tree-item.d.ts +208 -0
- package/dist/tree/item/tree-item.js +381 -0
- package/dist/tree/root/tree-root.d.ts +88 -0
- package/dist/tree/root/tree-root.js +287 -0
- package/dist/trend/index.d.ts +1 -0
- package/dist/trend/index.js +1 -0
- package/dist/trend/root/trend-root.d.ts +67 -0
- package/dist/trend/root/trend-root.js +106 -0
- package/dist/video/index.d.ts +1 -0
- package/dist/video/index.js +1 -0
- package/dist/video/root/video-root.d.ts +711 -0
- package/dist/video/root/video-root.js +1821 -0
- package/dist/video-playlist/index.d.ts +3 -0
- package/dist/video-playlist/index.js +3 -0
- package/dist/video-playlist/item/video-playlist-item.d.ts +101 -0
- package/dist/video-playlist/item/video-playlist-item.js +162 -0
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +121 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +237 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +108 -0
- package/dist/video-playlist/root/video-playlist-root.js +218 -0
- package/dist/virtual-list/index.d.ts +1 -0
- package/dist/virtual-list/index.js +1 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +121 -0
- package/dist/virtual-list/root/virtual-list-root.js +221 -0
- package/jsx.d.ts +49767 -0
- package/package.json +77 -0
- package/svelte.d.ts +129 -0
- package/vue.d.ts +9242 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/** Which band a value falls in, once `optimum` has said which end is good. */
|
|
4
|
+
export type MeterBand = 'fair' | 'good' | 'poor';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A measurement in a known range, and whether it is where you want it.
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* **Not `Progress`, and the difference is the whole component.** A progress bar
|
|
10
|
+
* reports how far along a task is: it starts empty, ends full, and full is
|
|
11
|
+
* always the good end. A meter reports a level in a range that is not going
|
|
12
|
+
* anywhere, and which end is good is a fact about the thing being measured.
|
|
13
|
+
* Disk usage, a battery, a score, a rate limit. So there is no `indeterminate`
|
|
14
|
+
* here: a measurement whose value is unknown is not a measurement.
|
|
15
|
+
*
|
|
16
|
+
* **`low`, `high` and `optimum` are the reason it exists**, and they follow the
|
|
17
|
+
* HTML specification's own rule. The three thresholds cut the range into a low
|
|
18
|
+
* band, a middle and a high band, and `optimum` says which of the three is the
|
|
19
|
+
* one to be in. The band the value falls in is then the good one, the one next
|
|
20
|
+
* to it is fair, and the one two away is poor.
|
|
21
|
+
*
|
|
22
|
+
* **Without thresholds there are no bands, and this is where it parts company
|
|
23
|
+
* with `<meter>`.** The platform defaults `optimum` to the midpoint and both
|
|
24
|
+
* thresholds to the ends, so a bare `<meter value="20" max="100">` computes as
|
|
25
|
+
* optimum and every browser paints it green. A gauge with nothing said about it
|
|
26
|
+
* is not good news; it is a reading. Declared thresholds turn the color on.
|
|
27
|
+
*
|
|
28
|
+
* **And the bands are drawn as well as colored.** A tick sits at `low` and at
|
|
29
|
+
* `high`, so the reading can be placed against them without seeing color at
|
|
30
|
+
* all, which is the same call the carousel's current dot makes by lengthening
|
|
31
|
+
* rather than only changing color.
|
|
32
|
+
*
|
|
33
|
+
* The properties below are written by this component and read by whoever draws
|
|
34
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
35
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
36
|
+
* without measuring anything itself.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
* @status stable
|
|
40
|
+
* @category feedback
|
|
41
|
+
* @aliases Gauge, Level, Capacity
|
|
42
|
+
* @documentation https://helix.fusion.dev/components/meter
|
|
43
|
+
*
|
|
44
|
+
* @csspart groove - The unfilled circle, in `ring` and `arc`.
|
|
45
|
+
* @csspart indicator - The part of it the value fills.
|
|
46
|
+
* @csspart tick - A mark at `low` or at `high`.
|
|
47
|
+
* @csspart track - The whole range, or the drawing in `ring` and `arc`.
|
|
48
|
+
* @csspart value - The reading, under `show-value`.
|
|
49
|
+
*
|
|
50
|
+
* @cssproperty --meter-along - Where a bound sits on the arc, as a length along it.
|
|
51
|
+
* @cssproperty --meter-at - Where a bound sits on a linear track, as a percentage.
|
|
52
|
+
* @cssproperty --meter-fraction - The value as a fraction of the range, 0 to 1.
|
|
53
|
+
* @cssproperty --meter-sweep - How much of the circle the arc covers, as a path length.
|
|
54
|
+
*/
|
|
55
|
+
export declare class HelixHeadlessMeter extends HelixElement {
|
|
56
|
+
/**
|
|
57
|
+
* Accessible name for the reading.
|
|
58
|
+
*/
|
|
59
|
+
label: string;
|
|
60
|
+
/**
|
|
61
|
+
* Bottom of the range.
|
|
62
|
+
*/
|
|
63
|
+
min: number;
|
|
64
|
+
/**
|
|
65
|
+
* Top of the range.
|
|
66
|
+
*
|
|
67
|
+
* A hundred rather than the platform's one, which is what `Progress` already
|
|
68
|
+
* takes and what a consumer writing `value="72"` means. A range of zero to one
|
|
69
|
+
* is a fraction, and a component that reads `value="72"` as seventy-two times
|
|
70
|
+
* over its maximum is a trap that costs nothing to avoid.
|
|
71
|
+
*/
|
|
72
|
+
max: number;
|
|
73
|
+
/**
|
|
74
|
+
* Where the reading sits between `min` and `max`.
|
|
75
|
+
*
|
|
76
|
+
* Outside them, it clamps.
|
|
77
|
+
*/
|
|
78
|
+
value: number;
|
|
79
|
+
/**
|
|
80
|
+
* Top of the low band.
|
|
81
|
+
*
|
|
82
|
+
* Absent leaves the range unbanded.
|
|
83
|
+
*/
|
|
84
|
+
low?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Bottom of the high band.
|
|
87
|
+
*
|
|
88
|
+
* Absent leaves the range unbanded.
|
|
89
|
+
*/
|
|
90
|
+
high?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Where in the range it is best to be.
|
|
93
|
+
*
|
|
94
|
+
* Defaults to the middle of whatever bands are declared, which is the
|
|
95
|
+
* platform's own default and the right one for a score. A meter where low is
|
|
96
|
+
* good, like disk usage, says `optimum="0"`; one where high is good, like a
|
|
97
|
+
* battery, says `optimum="100"`.
|
|
98
|
+
*/
|
|
99
|
+
optimum?: number;
|
|
100
|
+
/**
|
|
101
|
+
* The band, said outright, where the three thresholds cannot say it.
|
|
102
|
+
*
|
|
103
|
+
* **The specification's model has a shape, and it is worth knowing before
|
|
104
|
+
* reaching for this.** Three bands and a point mean it can express a
|
|
105
|
+
* *direction* in three grades, or a *target* in two, and never a target in
|
|
106
|
+
* three. Measured across a grid: with `low="25" high="50" optimum="0"` the
|
|
107
|
+
* readings 5, 28 and 60 come out good, fair and poor; with `low="15"
|
|
108
|
+
* high="25" optimum="20"` the readings 28 and 90 both come out fair, because
|
|
109
|
+
* from a middle band nothing is ever two bands away.
|
|
110
|
+
*
|
|
111
|
+
* So a target you can miss badly in either direction has no expression in
|
|
112
|
+
* `low`, `high` and `optimum`, and neither has a rule that is not about
|
|
113
|
+
* distance at all: 28 against a target of 20 is fine for a room's temperature
|
|
114
|
+
* and is not fine for a dosage, and no arrangement of thresholds knows which
|
|
115
|
+
* one it is looking at.
|
|
116
|
+
*
|
|
117
|
+
* Written, this wins outright and the thresholds are only for drawing the
|
|
118
|
+
* ticks. A consumer whose rule is more than three buckets already knows the
|
|
119
|
+
* answer, and asking them to encode it as thresholds so this can decode it
|
|
120
|
+
* again is a worse API than letting them say it.
|
|
121
|
+
*
|
|
122
|
+
* Not reflected. Nothing selects on it: the band reaches the stylesheet as
|
|
123
|
+
* `data-band` on the fill, because that is the element being colored, so
|
|
124
|
+
* reflecting here would write an attribute onto the host for no reader. Third
|
|
125
|
+
* time this rule has caught something today.
|
|
126
|
+
*/
|
|
127
|
+
band?: MeterBand;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the reading is drawn as a bar, a ring or an arc.
|
|
130
|
+
*
|
|
131
|
+
* A gauge and a meter are the same thing measured: a value in a range, with
|
|
132
|
+
* bands saying which part of it is the good part. What differs between the two
|
|
133
|
+
* words in practice is the drawing, so this is a shape rather than a second
|
|
134
|
+
* component, the same call `Progress` made with its ring and `Skeleton` with
|
|
135
|
+
* its own shapes.
|
|
136
|
+
*
|
|
137
|
+
* A bar is right in a row of them, in a table, or under a label. A ring is
|
|
138
|
+
* right in a tile, where the number goes in the middle. An arc is the shape a
|
|
139
|
+
* dashboard gauge has always had: open at the bottom, so the two ends of the
|
|
140
|
+
* range have somewhere to be that is not each other.
|
|
141
|
+
*
|
|
142
|
+
* There is no needle in any of them. A needle is a picture of an instrument
|
|
143
|
+
* rather than a reading, it costs a rotation and a shape to draw it with, and
|
|
144
|
+
* it says nothing the end of the arc does not already say.
|
|
145
|
+
*/
|
|
146
|
+
shape?: 'arc' | 'ring';
|
|
147
|
+
/**
|
|
148
|
+
* Whether the reading is shown beside the bar.
|
|
149
|
+
*/
|
|
150
|
+
showValue: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* What the reading says, where a number is not the whole story.
|
|
153
|
+
*
|
|
154
|
+
* `value-text="18 GB of 32 GB"` is announced and shown instead of `56%`. The
|
|
155
|
+
* same property `Progress` carries, for the same reason: a percentage is a
|
|
156
|
+
* fair summary of a task and a poor one of a quantity.
|
|
157
|
+
*/
|
|
158
|
+
valueText: string;
|
|
159
|
+
/** The range, clamped so `max` is never at or below `min`. */
|
|
160
|
+
private get span();
|
|
161
|
+
/** The reading, pulled into the range. */
|
|
162
|
+
private get reading();
|
|
163
|
+
/**
|
|
164
|
+
* How much of the track is filled, from zero to one.
|
|
165
|
+
*
|
|
166
|
+
* Clamped, because a bar cannot draw past its own end. What the reading *says*
|
|
167
|
+
* is not clamped: see `ratio`.
|
|
168
|
+
*/
|
|
169
|
+
private get fraction();
|
|
170
|
+
/**
|
|
171
|
+
* Where the value really sits, which is what the words report.
|
|
172
|
+
*
|
|
173
|
+
* **A value past the end used to be swallowed twice.** The bar filled and the
|
|
174
|
+
* reading said "100%", so 110 and 250 were indistinguishable from exactly
|
|
175
|
+
* full, measured. A meter that cannot say "you are over" is worse than no
|
|
176
|
+
* meter for the one case anybody checks it in, and it is the same fault as a
|
|
177
|
+
* pagination reporting a page it is not on: the number shown and the number
|
|
178
|
+
* given disagree, quietly.
|
|
179
|
+
*
|
|
180
|
+
* The bar still stops at its end, because that is what an end is. The words
|
|
181
|
+
* and the accessible reading carry the truth, and `data-over` is on the fill
|
|
182
|
+
* so a consumer can say more about it.
|
|
183
|
+
*/
|
|
184
|
+
private get ratio();
|
|
185
|
+
/** Whether the value is past an end, which the bar itself cannot show. */
|
|
186
|
+
private get beyond();
|
|
187
|
+
/**
|
|
188
|
+
* The thresholds, in order, or nothing where the consumer declared none.
|
|
189
|
+
*
|
|
190
|
+
* Both are clamped into the range and to each other, because a `low` above a
|
|
191
|
+
* `high` describes no bands at all and the spec's own answer is to raise the
|
|
192
|
+
* one that is out of order rather than to give up.
|
|
193
|
+
*/
|
|
194
|
+
private get thresholds();
|
|
195
|
+
/**
|
|
196
|
+
* Which band the reading is in, by the specification's rule.
|
|
197
|
+
*
|
|
198
|
+
* `optimum` names a point, and the band containing it is the good one. A
|
|
199
|
+
* reading in that band is good, one in a band beside it is fair, and one two
|
|
200
|
+
* bands away is poor. Undefined where nothing was declared, which is what
|
|
201
|
+
* keeps an unbanded meter from being painted as good news.
|
|
202
|
+
*/
|
|
203
|
+
private get computedBand();
|
|
204
|
+
/** What the reading says, which is the consumer's words or a percentage. */
|
|
205
|
+
private get text();
|
|
206
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
207
|
+
/**
|
|
208
|
+
* The same reading, drawn round.
|
|
209
|
+
*
|
|
210
|
+
* `pathLength="100"` is what makes every number here a percentage: the path is
|
|
211
|
+
* declared a hundred units long, so nothing computes a circumference, a radius
|
|
212
|
+
* or pi, and a consumer changing the thickness moves the circle that carries
|
|
213
|
+
* it without this element recalculating anything. Progress does the same and
|
|
214
|
+
* for the same reason.
|
|
215
|
+
*
|
|
216
|
+
* The sweep is what separates the two shapes. A ring is the whole circle and
|
|
217
|
+
* an arc is three quarters of it, open at the bottom, which is where a gauge
|
|
218
|
+
* has always had its gap: the two ends need somewhere to be that is not each
|
|
219
|
+
* other, and the opening is where a reading of the value goes.
|
|
220
|
+
*
|
|
221
|
+
* Ticks are segments of the same circle rather than marks placed on it. One
|
|
222
|
+
* unit of a hundred, offset to where the threshold falls, which needs no
|
|
223
|
+
* trigonometry and stays correct at any radius or thickness. Placing them by
|
|
224
|
+
* hand would mean sine and cosine in a template and a second definition of
|
|
225
|
+
* where the arc starts.
|
|
226
|
+
*/
|
|
227
|
+
private renderRound;
|
|
228
|
+
protected render(): TemplateResult;
|
|
229
|
+
}
|
|
230
|
+
declare global {
|
|
231
|
+
interface HTMLElementTagNameMap {
|
|
232
|
+
'helix-headless-meter': HelixHeadlessMeter;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, HelixElement, hostAria } from '@fusion.dev/helix-core';
|
|
8
|
+
import { html, nothing, svg } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
/**
|
|
11
|
+
* @summary A measurement in a known range, and whether it is where you want it.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* **Not `Progress`, and the difference is the whole component.** A progress bar
|
|
15
|
+
* reports how far along a task is: it starts empty, ends full, and full is
|
|
16
|
+
* always the good end. A meter reports a level in a range that is not going
|
|
17
|
+
* anywhere, and which end is good is a fact about the thing being measured.
|
|
18
|
+
* Disk usage, a battery, a score, a rate limit. So there is no `indeterminate`
|
|
19
|
+
* here: a measurement whose value is unknown is not a measurement.
|
|
20
|
+
*
|
|
21
|
+
* **`low`, `high` and `optimum` are the reason it exists**, and they follow the
|
|
22
|
+
* HTML specification's own rule. The three thresholds cut the range into a low
|
|
23
|
+
* band, a middle and a high band, and `optimum` says which of the three is the
|
|
24
|
+
* one to be in. The band the value falls in is then the good one, the one next
|
|
25
|
+
* to it is fair, and the one two away is poor.
|
|
26
|
+
*
|
|
27
|
+
* **Without thresholds there are no bands, and this is where it parts company
|
|
28
|
+
* with `<meter>`.** The platform defaults `optimum` to the midpoint and both
|
|
29
|
+
* thresholds to the ends, so a bare `<meter value="20" max="100">` computes as
|
|
30
|
+
* optimum and every browser paints it green. A gauge with nothing said about it
|
|
31
|
+
* is not good news; it is a reading. Declared thresholds turn the color on.
|
|
32
|
+
*
|
|
33
|
+
* **And the bands are drawn as well as colored.** A tick sits at `low` and at
|
|
34
|
+
* `high`, so the reading can be placed against them without seeing color at
|
|
35
|
+
* all, which is the same call the carousel's current dot makes by lengthening
|
|
36
|
+
* rather than only changing color.
|
|
37
|
+
*
|
|
38
|
+
* The properties below are written by this component and read by whoever draws
|
|
39
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
40
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
41
|
+
* without measuring anything itself.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.1.0
|
|
44
|
+
* @status stable
|
|
45
|
+
* @category feedback
|
|
46
|
+
* @aliases Gauge, Level, Capacity
|
|
47
|
+
* @documentation https://helix.fusion.dev/components/meter
|
|
48
|
+
*
|
|
49
|
+
* @csspart groove - The unfilled circle, in `ring` and `arc`.
|
|
50
|
+
* @csspart indicator - The part of it the value fills.
|
|
51
|
+
* @csspart tick - A mark at `low` or at `high`.
|
|
52
|
+
* @csspart track - The whole range, or the drawing in `ring` and `arc`.
|
|
53
|
+
* @csspart value - The reading, under `show-value`.
|
|
54
|
+
*
|
|
55
|
+
* @cssproperty --meter-along - Where a bound sits on the arc, as a length along it.
|
|
56
|
+
* @cssproperty --meter-at - Where a bound sits on a linear track, as a percentage.
|
|
57
|
+
* @cssproperty --meter-fraction - The value as a fraction of the range, 0 to 1.
|
|
58
|
+
* @cssproperty --meter-sweep - How much of the circle the arc covers, as a path length.
|
|
59
|
+
*/
|
|
60
|
+
let HelixHeadlessMeter = class HelixHeadlessMeter extends HelixElement {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
/**
|
|
64
|
+
* Accessible name for the reading.
|
|
65
|
+
*/
|
|
66
|
+
this.label = 'Meter';
|
|
67
|
+
/**
|
|
68
|
+
* Bottom of the range.
|
|
69
|
+
*/
|
|
70
|
+
this.min = 0;
|
|
71
|
+
/**
|
|
72
|
+
* Top of the range.
|
|
73
|
+
*
|
|
74
|
+
* A hundred rather than the platform's one, which is what `Progress` already
|
|
75
|
+
* takes and what a consumer writing `value="72"` means. A range of zero to one
|
|
76
|
+
* is a fraction, and a component that reads `value="72"` as seventy-two times
|
|
77
|
+
* over its maximum is a trap that costs nothing to avoid.
|
|
78
|
+
*/
|
|
79
|
+
this.max = 100;
|
|
80
|
+
/**
|
|
81
|
+
* Where the reading sits between `min` and `max`.
|
|
82
|
+
*
|
|
83
|
+
* Outside them, it clamps.
|
|
84
|
+
*/
|
|
85
|
+
this.value = 0;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the reading is shown beside the bar.
|
|
88
|
+
*/
|
|
89
|
+
this.showValue = false;
|
|
90
|
+
/**
|
|
91
|
+
* What the reading says, where a number is not the whole story.
|
|
92
|
+
*
|
|
93
|
+
* `value-text="18 GB of 32 GB"` is announced and shown instead of `56%`. The
|
|
94
|
+
* same property `Progress` carries, for the same reason: a percentage is a
|
|
95
|
+
* fair summary of a task and a poor one of a quantity.
|
|
96
|
+
*/
|
|
97
|
+
this.valueText = '';
|
|
98
|
+
}
|
|
99
|
+
/** The range, clamped so `max` is never at or below `min`. */
|
|
100
|
+
get span() {
|
|
101
|
+
const min = Number.isFinite(this.min) ? this.min : 0;
|
|
102
|
+
const max = Number.isFinite(this.max) && this.max > min ? this.max : min + 1;
|
|
103
|
+
return { max, min };
|
|
104
|
+
}
|
|
105
|
+
/** The reading, pulled into the range. */
|
|
106
|
+
get reading() {
|
|
107
|
+
const { max, min } = this.span;
|
|
108
|
+
return Math.min(max, Math.max(min, Number.isFinite(this.value) ? this.value : min));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* How much of the track is filled, from zero to one.
|
|
112
|
+
*
|
|
113
|
+
* Clamped, because a bar cannot draw past its own end. What the reading *says*
|
|
114
|
+
* is not clamped: see `ratio`.
|
|
115
|
+
*/
|
|
116
|
+
get fraction() {
|
|
117
|
+
const { max, min } = this.span;
|
|
118
|
+
return (this.reading - min) / (max - min);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Where the value really sits, which is what the words report.
|
|
122
|
+
*
|
|
123
|
+
* **A value past the end used to be swallowed twice.** The bar filled and the
|
|
124
|
+
* reading said "100%", so 110 and 250 were indistinguishable from exactly
|
|
125
|
+
* full, measured. A meter that cannot say "you are over" is worse than no
|
|
126
|
+
* meter for the one case anybody checks it in, and it is the same fault as a
|
|
127
|
+
* pagination reporting a page it is not on: the number shown and the number
|
|
128
|
+
* given disagree, quietly.
|
|
129
|
+
*
|
|
130
|
+
* The bar still stops at its end, because that is what an end is. The words
|
|
131
|
+
* and the accessible reading carry the truth, and `data-over` is on the fill
|
|
132
|
+
* so a consumer can say more about it.
|
|
133
|
+
*/
|
|
134
|
+
get ratio() {
|
|
135
|
+
const { max, min } = this.span;
|
|
136
|
+
const raw = Number.isFinite(this.value) ? this.value : min;
|
|
137
|
+
return (raw - min) / (max - min);
|
|
138
|
+
}
|
|
139
|
+
/** Whether the value is past an end, which the bar itself cannot show. */
|
|
140
|
+
get beyond() {
|
|
141
|
+
const { max, min } = this.span;
|
|
142
|
+
const raw = Number.isFinite(this.value) ? this.value : min;
|
|
143
|
+
return raw > max ? 'over' : raw < min ? 'under' : undefined;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The thresholds, in order, or nothing where the consumer declared none.
|
|
147
|
+
*
|
|
148
|
+
* Both are clamped into the range and to each other, because a `low` above a
|
|
149
|
+
* `high` describes no bands at all and the spec's own answer is to raise the
|
|
150
|
+
* one that is out of order rather than to give up.
|
|
151
|
+
*/
|
|
152
|
+
get thresholds() {
|
|
153
|
+
const { max, min } = this.span;
|
|
154
|
+
if (this.low === undefined && this.high === undefined) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
const low = Math.min(max, Math.max(min, this.low ?? min));
|
|
158
|
+
const high = Math.min(max, Math.max(low, this.high ?? max));
|
|
159
|
+
return { high, low };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Which band the reading is in, by the specification's rule.
|
|
163
|
+
*
|
|
164
|
+
* `optimum` names a point, and the band containing it is the good one. A
|
|
165
|
+
* reading in that band is good, one in a band beside it is fair, and one two
|
|
166
|
+
* bands away is poor. Undefined where nothing was declared, which is what
|
|
167
|
+
* keeps an unbanded meter from being painted as good news.
|
|
168
|
+
*/
|
|
169
|
+
get computedBand() {
|
|
170
|
+
if (this.band) {
|
|
171
|
+
return this.band;
|
|
172
|
+
}
|
|
173
|
+
const bounds = this.thresholds;
|
|
174
|
+
if (!bounds) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
const { max, min } = this.span;
|
|
178
|
+
const optimum = Math.min(max, Math.max(min, this.optimum ?? (bounds.low + bounds.high) / 2));
|
|
179
|
+
const which = (at) => (at < bounds.low ? 0 : at > bounds.high ? 2 : 1);
|
|
180
|
+
const distance = Math.abs(which(this.reading) - which(optimum));
|
|
181
|
+
return distance === 0 ? 'good' : distance === 1 ? 'fair' : 'poor';
|
|
182
|
+
}
|
|
183
|
+
/** What the reading says, which is the consumer's words or a percentage. */
|
|
184
|
+
get text() {
|
|
185
|
+
return this.valueText || `${Math.round(this.ratio * 100)}%`;
|
|
186
|
+
}
|
|
187
|
+
willUpdate(changed) {
|
|
188
|
+
super.willUpdate(changed);
|
|
189
|
+
const { max, min } = this.span;
|
|
190
|
+
/* On the host through internals, so the reading is the element itself and
|
|
191
|
+
an author's own `aria-label` beats it without anything being written onto
|
|
192
|
+
markup their server never had. `meter` is the ARIA role for exactly this
|
|
193
|
+
and is not `progressbar`: a progress bar promises it is going somewhere. */
|
|
194
|
+
hostAria(this.internals, { label: this.label, role: 'meter' });
|
|
195
|
+
this.internals.ariaValueMin = String(min);
|
|
196
|
+
this.internals.ariaValueMax = String(max);
|
|
197
|
+
this.internals.ariaValueNow = String(this.reading);
|
|
198
|
+
/* Spoken instead of the number wherever the consumer gave words, which is
|
|
199
|
+
what `value-text` is for: "18 GB of 32 GB" rather than "56". */
|
|
200
|
+
/* The consumer's words where they gave any, and otherwise nothing at all
|
|
201
|
+
*unless* the value is past an end. `ariaValueNow` has to sit inside the
|
|
202
|
+
range, so it is the only place a reader can be told that 250 is not 100. */
|
|
203
|
+
this.internals.ariaValueText =
|
|
204
|
+
this.valueText || (this.beyond ? `${Math.round(this.ratio * 100)}%` : null);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The same reading, drawn round.
|
|
208
|
+
*
|
|
209
|
+
* `pathLength="100"` is what makes every number here a percentage: the path is
|
|
210
|
+
* declared a hundred units long, so nothing computes a circumference, a radius
|
|
211
|
+
* or pi, and a consumer changing the thickness moves the circle that carries
|
|
212
|
+
* it without this element recalculating anything. Progress does the same and
|
|
213
|
+
* for the same reason.
|
|
214
|
+
*
|
|
215
|
+
* The sweep is what separates the two shapes. A ring is the whole circle and
|
|
216
|
+
* an arc is three quarters of it, open at the bottom, which is where a gauge
|
|
217
|
+
* has always had its gap: the two ends need somewhere to be that is not each
|
|
218
|
+
* other, and the opening is where a reading of the value goes.
|
|
219
|
+
*
|
|
220
|
+
* Ticks are segments of the same circle rather than marks placed on it. One
|
|
221
|
+
* unit of a hundred, offset to where the threshold falls, which needs no
|
|
222
|
+
* trigonometry and stays correct at any radius or thickness. Placing them by
|
|
223
|
+
* hand would mean sine and cosine in a template and a second definition of
|
|
224
|
+
* where the arc starts.
|
|
225
|
+
*/
|
|
226
|
+
renderRound() {
|
|
227
|
+
const bounds = this.thresholds;
|
|
228
|
+
const { max, min } = this.span;
|
|
229
|
+
const sweep = this.shape === 'arc' ? 75 : 100;
|
|
230
|
+
const along = (value) => ((value - min) / (max - min)) * sweep;
|
|
231
|
+
return html `<svg part="track" viewBox="0 0 100 100" aria-hidden="true">
|
|
232
|
+
<circle part="groove" pathLength="100" style="--meter-sweep: ${sweep}" />
|
|
233
|
+
${
|
|
234
|
+
/* `svg` and not `html`, which is the bug the sparkline records one
|
|
235
|
+
file over. A nested Lit template is parsed on its own, so a
|
|
236
|
+
`<circle>` written in one has no `<svg>` around it and lands in the
|
|
237
|
+
XHTML namespace: it takes the part, takes the style, inherits every
|
|
238
|
+
rule in the stylesheet, and draws nothing, because geometry belongs
|
|
239
|
+
to the namespace and not to the tag name. Both threshold ticks were
|
|
240
|
+
invisible in `shape="ring"` and `shape="arc"`, which is the whole of
|
|
241
|
+
what the round example shows. */
|
|
242
|
+
bounds
|
|
243
|
+
? svg `<circle
|
|
244
|
+
part="tick"
|
|
245
|
+
pathLength="100"
|
|
246
|
+
style="--meter-along: ${along(bounds.low)}"
|
|
247
|
+
/>
|
|
248
|
+
<circle part="tick" pathLength="100" style="--meter-along: ${along(bounds.high)}" />`
|
|
249
|
+
: nothing}
|
|
250
|
+
<circle
|
|
251
|
+
part="indicator"
|
|
252
|
+
pathLength="100"
|
|
253
|
+
data-band=${this.computedBand ?? nothing}
|
|
254
|
+
data-beyond=${this.beyond ?? nothing}
|
|
255
|
+
style="--meter-along: ${this.fraction * sweep}"
|
|
256
|
+
/>
|
|
257
|
+
</svg>`;
|
|
258
|
+
}
|
|
259
|
+
render() {
|
|
260
|
+
const bounds = this.thresholds;
|
|
261
|
+
const { max, min } = this.span;
|
|
262
|
+
const at = (value) => `${((value - min) / (max - min)) * 100}%`;
|
|
263
|
+
return html `${this.shape
|
|
264
|
+
? this.renderRound()
|
|
265
|
+
: html `<div part="track">
|
|
266
|
+
${bounds
|
|
267
|
+
? html `<span part="tick" style="--meter-at: ${at(bounds.low)}"></span>
|
|
268
|
+
<span part="tick" style="--meter-at: ${at(bounds.high)}"></span>`
|
|
269
|
+
: nothing}
|
|
270
|
+
<div
|
|
271
|
+
part="indicator"
|
|
272
|
+
data-band=${this.computedBand ?? nothing}
|
|
273
|
+
data-beyond=${this.beyond ?? nothing}
|
|
274
|
+
style="--meter-fraction: ${this.fraction}"
|
|
275
|
+
></div>
|
|
276
|
+
</div>`}
|
|
277
|
+
${this.showValue ? html `<span part="value">${this.text}</span>` : nothing}`;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
__decorate([
|
|
281
|
+
property()
|
|
282
|
+
], HelixHeadlessMeter.prototype, "label", void 0);
|
|
283
|
+
__decorate([
|
|
284
|
+
property({ type: Number })
|
|
285
|
+
], HelixHeadlessMeter.prototype, "min", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
property({ type: Number })
|
|
288
|
+
], HelixHeadlessMeter.prototype, "max", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
property({ type: Number })
|
|
291
|
+
], HelixHeadlessMeter.prototype, "value", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
property({ type: Number })
|
|
294
|
+
], HelixHeadlessMeter.prototype, "low", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property({ type: Number })
|
|
297
|
+
], HelixHeadlessMeter.prototype, "high", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ type: Number })
|
|
300
|
+
], HelixHeadlessMeter.prototype, "optimum", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property()
|
|
303
|
+
], HelixHeadlessMeter.prototype, "band", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property({ reflect: true })
|
|
306
|
+
], HelixHeadlessMeter.prototype, "shape", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ attribute: 'show-value', reflect: true, type: Boolean })
|
|
309
|
+
], HelixHeadlessMeter.prototype, "showValue", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
property({ attribute: 'value-text' })
|
|
312
|
+
], HelixHeadlessMeter.prototype, "valueText", void 0);
|
|
313
|
+
HelixHeadlessMeter = __decorate([
|
|
314
|
+
customElement('helix-headless-meter')
|
|
315
|
+
], HelixHeadlessMeter);
|
|
316
|
+
export { HelixHeadlessMeter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './root/navigation-root.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './root/navigation-root.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* @summary A set of destinations, with a marker on the current one.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Renders a real `<nav>`, which is the landmark a screen-reader user jumps to.
|
|
8
|
+
* It exists as its own component rather than as a region of `AppHeader` because
|
|
9
|
+
* a header is not inherently navigation, and navigation is not only ever in a
|
|
10
|
+
* header: a footer and a sidebar hold the same thing.
|
|
11
|
+
*
|
|
12
|
+
* **It renders no links.** The consumer brings them, marked with
|
|
13
|
+
* `aria-current="page"` and styled by the `data-navigation-item` recipe, for the same
|
|
14
|
+
* reason nothing else here renders an anchor: a router renders its own, and
|
|
15
|
+
* cannot render it inside this shadow root.
|
|
16
|
+
*
|
|
17
|
+
* What this owns is the marker that travels between them, and that is the whole
|
|
18
|
+
* reason it is a component. A marker that moves needs something that knows
|
|
19
|
+
* where every item is, and reading `aria-current` is how it knows which: the
|
|
20
|
+
* thing that makes the page announce correctly is the same thing that puts the
|
|
21
|
+
* marker in the right place.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.1.0
|
|
24
|
+
* @status experimental
|
|
25
|
+
* @category navigation
|
|
26
|
+
* @aliases Nav, NavList, Tabs
|
|
27
|
+
* @documentation https://helix.fusion.dev/components/navigation
|
|
28
|
+
*
|
|
29
|
+
* @slot - The destinations, as the consumer's own links.
|
|
30
|
+
*
|
|
31
|
+
* @csspart indicator - The marker that travels to the current destination.
|
|
32
|
+
* @csspart nav - The navigation landmark.
|
|
33
|
+
*/
|
|
34
|
+
export declare class HelixHeadlessNavigation extends HelixElement {
|
|
35
|
+
private readonly indicator;
|
|
36
|
+
/**
|
|
37
|
+
* Accessible name for the landmark.
|
|
38
|
+
*/
|
|
39
|
+
label: string;
|
|
40
|
+
private observer;
|
|
41
|
+
private current;
|
|
42
|
+
/** The destinations the consumer slotted. */
|
|
43
|
+
private get items();
|
|
44
|
+
/** Re-measures when the links change, move, or hand over the current page. */
|
|
45
|
+
private watch;
|
|
46
|
+
connectedCallback(): void;
|
|
47
|
+
disconnectedCallback(): void;
|
|
48
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
49
|
+
protected render(): TemplateResult;
|
|
50
|
+
}
|
|
51
|
+
declare global {
|
|
52
|
+
interface HTMLElementTagNameMap {
|
|
53
|
+
'helix-headless-navigation': HelixHeadlessNavigation;
|
|
54
|
+
}
|
|
55
|
+
}
|