@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,165 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* How a column is read out of a row, once the row is data rather than markup.
|
|
5
|
+
*
|
|
6
|
+
* A function rather than a template, because a `<template>` holding one is what
|
|
7
|
+
* a build step produces and a hand-authored page cannot: the type is the escape
|
|
8
|
+
* hatch and `field` is the path that needs no build. Returning anything Lit can
|
|
9
|
+
* render means a cell can hold a badge, a link or a number, and returning
|
|
10
|
+
* `undefined` falls back to the field.
|
|
11
|
+
*/
|
|
12
|
+
export type CellReader = (row: Readonly<Record<string, unknown>>) => unknown;
|
|
13
|
+
/**
|
|
14
|
+
* @summary One column of a table: its heading, how wide it is, and what it reads.
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* A column is a heading and a width, declared together, because they are two
|
|
18
|
+
* facts about one thing and keeping them apart is what went wrong before.
|
|
19
|
+
*
|
|
20
|
+
* **This replaces a `columns` string on the table.** That property took a CSS
|
|
21
|
+
* track list, so the headings lived in a row of cells and the widths lived in
|
|
22
|
+
* an attribute, and nothing tied the two together: a table with three headings
|
|
23
|
+
* and a two-track list rendered without complaint. Worse, handing it the
|
|
24
|
+
* headings instead of a track list produced invalid CSS, which the grid
|
|
25
|
+
* silently ignored, so the whole table collapsed into one column and every cell
|
|
26
|
+
* stacked. That happened, in this library's own example, and the failure said
|
|
27
|
+
* nothing at all.
|
|
28
|
+
*
|
|
29
|
+
* Now the column is the source of both. Add one and the table has another
|
|
30
|
+
* track; remove one and it does not.
|
|
31
|
+
*
|
|
32
|
+
* **It is also where every per-column fact goes**, which is the reason
|
|
33
|
+
* `helix-data-table` needs no column config object. `field` names the key the
|
|
34
|
+
* cell reads, `sortable` says a reader may reorder by it, `align` says which
|
|
35
|
+
* edge the values line up against, and `cell` takes a function for anything the
|
|
36
|
+
* field alone cannot express. The schema is markup and the data is a property:
|
|
37
|
+
* a schema is small, declarative, and something a reader should be able to see
|
|
38
|
+
* in the HTML, and data is large and windowed.
|
|
39
|
+
*
|
|
40
|
+
* **The same element serves both tables**, the markup one and the data one. It
|
|
41
|
+
* is identified by a flag rather than by `instanceof`, so a `helix-table-column`
|
|
42
|
+
* works inside either without the two roots sharing anything else.
|
|
43
|
+
*
|
|
44
|
+
* **It generates no box of its own**, the same as a row: the heading is a grid
|
|
45
|
+
* item of the table, so it lines up with the cells under it rather than sitting
|
|
46
|
+
* in a wrapper that has to be kept the same width.
|
|
47
|
+
*
|
|
48
|
+
* @since 0.1.0
|
|
49
|
+
* @status experimental
|
|
50
|
+
* @aliases Column header, Th
|
|
51
|
+
* @documentation https://helix.fusion.dev/components/table
|
|
52
|
+
*
|
|
53
|
+
* @slot - The heading.
|
|
54
|
+
*
|
|
55
|
+
* @csspart column - The heading cell.
|
|
56
|
+
*/
|
|
57
|
+
export declare class HelixHeadlessTableColumn extends HelixElement {
|
|
58
|
+
/**
|
|
59
|
+
* The track this column takes, as CSS.
|
|
60
|
+
*
|
|
61
|
+
* A single track value, so anything valid in `grid-template-columns` works:
|
|
62
|
+
* `16rem`, `auto`, `minmax(0, 2fr)`. Left unset the column shares what is
|
|
63
|
+
* left over equally, as `minmax(max-content, 1fr)`.
|
|
64
|
+
*
|
|
65
|
+
* **The floor was `0` and that is what broke a narrow table.** A zero floor
|
|
66
|
+
* lets a track shrink under its own content, so at 375 the columns were
|
|
67
|
+
* squeezed to 75px and `eu-central-1` wrapped across lines, which reads as
|
|
68
|
+
* corrupt data rather than as a table that ran out of room. The zero was
|
|
69
|
+
* chosen to stop one long value pushing the table past its container, and
|
|
70
|
+
* that was the right worry with nowhere for the overflow to go.
|
|
71
|
+
*
|
|
72
|
+
* Somewhere now exists: `@fusion.dev/helix` scrolls the table's own box. So a
|
|
73
|
+
* long value pushes past the container as the old comment feared, and the
|
|
74
|
+
* table scrolls instead of the value being destroyed. Measured at 375: tracks
|
|
75
|
+
* of 192, 89 and 102 against a 343 box, so the table scrolls 384 and the page
|
|
76
|
+
* does not move.
|
|
77
|
+
*
|
|
78
|
+
* **`max-content` and not `min-content`, because a hyphen is a wrap
|
|
79
|
+
* opportunity.** A `min-content` floor still broke `eu-central-1` at its
|
|
80
|
+
* hyphens, which is the whole of the reported fault. The cost is that a
|
|
81
|
+
* column of prose asks for its longest paragraph on one line, so a column
|
|
82
|
+
* holding sentences rather than values wants `width="minmax(0, 1fr)"` to opt
|
|
83
|
+
* back into wrapping. A headless consumer owns the overflow either way, that
|
|
84
|
+
* being paint, and gets the honest track list.
|
|
85
|
+
*/
|
|
86
|
+
width: string;
|
|
87
|
+
/**
|
|
88
|
+
* The key this column reads out of a row.
|
|
89
|
+
*
|
|
90
|
+
* Dot paths resolve, so `field="owner.name"` reads a nested value: a result
|
|
91
|
+
* from an API arrives shaped the way the API shaped it, and requiring a flat
|
|
92
|
+
* row would push a mapping pass onto every consumer.
|
|
93
|
+
*
|
|
94
|
+
* **It is also the sort and filter identity**, which is why sorting is by
|
|
95
|
+
* field and not by column index: a reordered or hidden column would otherwise
|
|
96
|
+
* change what `sort="2:asc"` means, and a sort that means something different
|
|
97
|
+
* after a column moves is a sort a consumer cannot store in a URL.
|
|
98
|
+
*
|
|
99
|
+
* Empty on a column that is purely presentational, an actions column say, and
|
|
100
|
+
* such a column is never sortable however it is marked.
|
|
101
|
+
*/
|
|
102
|
+
field: string;
|
|
103
|
+
/**
|
|
104
|
+
* Whether a reader may reorder the set by this column.
|
|
105
|
+
*
|
|
106
|
+
* Ignored without a `field`, and silently: a column with nothing to sort by
|
|
107
|
+
* has no order to offer, and refusing loudly would mean an actions column
|
|
108
|
+
* carrying `sortable` breaks a table rather than doing nothing.
|
|
109
|
+
*/
|
|
110
|
+
sortable: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Which edge the values line up against.
|
|
113
|
+
*
|
|
114
|
+
* `end` is what a column of numbers wants, so digits of the same magnitude sit
|
|
115
|
+
* above each other. Left unset the cell inherits the table's own alignment,
|
|
116
|
+
* which is `start` for text in either writing direction.
|
|
117
|
+
*/
|
|
118
|
+
align: 'center' | 'end' | 'start' | '';
|
|
119
|
+
/**
|
|
120
|
+
* How to read the cell, where the field alone will not do.
|
|
121
|
+
*
|
|
122
|
+
* A property and not an attribute, because it is a function. Set it from a Lit
|
|
123
|
+
* template with `.cell=${...}`, or assign it in script. A column with neither
|
|
124
|
+
* this nor a `field` renders an empty cell rather than the whole row stringified,
|
|
125
|
+
* which is the failure mode of guessing.
|
|
126
|
+
*/
|
|
127
|
+
cell: CellReader | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* How to read the value that gets sorted and filtered, where it is not the cell.
|
|
130
|
+
*
|
|
131
|
+
* **The one that is easy to leave out and expensive to add later.** A cell
|
|
132
|
+
* showing `2.4 MB` sorts as a string unless something says the underlying value
|
|
133
|
+
* is a number, so `12 kB` sorts above `2.4 MB` and the column looks broken
|
|
134
|
+
* while every value in it is right. Left unset this is the field, which is the
|
|
135
|
+
* correct default: the raw value is what an API sorted by.
|
|
136
|
+
*/
|
|
137
|
+
compare: CellReader | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* @internal Read by a parent to identify its children across the light DOM,
|
|
140
|
+
* which is cheaper than `instanceof` and is why this is public rather than
|
|
141
|
+
* protected. Not a consumer's to read or set.
|
|
142
|
+
*/
|
|
143
|
+
readonly isTableColumn = true;
|
|
144
|
+
/** The track this column contributes, resolved. */
|
|
145
|
+
get track(): string;
|
|
146
|
+
/** Whether a reader can actually reorder by this column. */
|
|
147
|
+
get canSort(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* The value this column shows for a row.
|
|
150
|
+
*
|
|
151
|
+
* `cell` first, then the field. An explicit reader that returns `undefined` is
|
|
152
|
+
* treated as declining rather than as an answer, so a formatter can hand the
|
|
153
|
+
* default back for the rows it has nothing to say about.
|
|
154
|
+
*/
|
|
155
|
+
read(row: Readonly<Record<string, unknown>>): unknown;
|
|
156
|
+
/** The value this column sorts and filters by, which is not always what it shows. */
|
|
157
|
+
order(row: Readonly<Record<string, unknown>>): unknown;
|
|
158
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
159
|
+
protected render(): TemplateResult;
|
|
160
|
+
}
|
|
161
|
+
declare global {
|
|
162
|
+
interface HTMLElementTagNameMap {
|
|
163
|
+
'helix-headless-table-column': HelixHeadlessTableColumn;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
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 } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
/**
|
|
11
|
+
* A dot path resolved against a row.
|
|
12
|
+
*
|
|
13
|
+
* Written here rather than taken from a library, because the whole of what is
|
|
14
|
+
* needed is "walk the keys and stop at the first thing that is not an object".
|
|
15
|
+
* Returns `undefined` for a path that does not resolve, which the table renders
|
|
16
|
+
* as an empty cell: a missing key is a hole in the data and drawing `undefined`
|
|
17
|
+
* into a table tells a reader the software is broken rather than the row is.
|
|
18
|
+
*/
|
|
19
|
+
const at = (row, path) => {
|
|
20
|
+
if (path === '') {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
if (!path.includes('.')) {
|
|
24
|
+
return row[path];
|
|
25
|
+
}
|
|
26
|
+
let cursor = row;
|
|
27
|
+
for (const key of path.split('.')) {
|
|
28
|
+
if (cursor === null || typeof cursor !== 'object') {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
cursor = cursor[key];
|
|
32
|
+
}
|
|
33
|
+
return cursor;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @summary One column of a table: its heading, how wide it is, and what it reads.
|
|
37
|
+
*
|
|
38
|
+
* @description
|
|
39
|
+
* A column is a heading and a width, declared together, because they are two
|
|
40
|
+
* facts about one thing and keeping them apart is what went wrong before.
|
|
41
|
+
*
|
|
42
|
+
* **This replaces a `columns` string on the table.** That property took a CSS
|
|
43
|
+
* track list, so the headings lived in a row of cells and the widths lived in
|
|
44
|
+
* an attribute, and nothing tied the two together: a table with three headings
|
|
45
|
+
* and a two-track list rendered without complaint. Worse, handing it the
|
|
46
|
+
* headings instead of a track list produced invalid CSS, which the grid
|
|
47
|
+
* silently ignored, so the whole table collapsed into one column and every cell
|
|
48
|
+
* stacked. That happened, in this library's own example, and the failure said
|
|
49
|
+
* nothing at all.
|
|
50
|
+
*
|
|
51
|
+
* Now the column is the source of both. Add one and the table has another
|
|
52
|
+
* track; remove one and it does not.
|
|
53
|
+
*
|
|
54
|
+
* **It is also where every per-column fact goes**, which is the reason
|
|
55
|
+
* `helix-data-table` needs no column config object. `field` names the key the
|
|
56
|
+
* cell reads, `sortable` says a reader may reorder by it, `align` says which
|
|
57
|
+
* edge the values line up against, and `cell` takes a function for anything the
|
|
58
|
+
* field alone cannot express. The schema is markup and the data is a property:
|
|
59
|
+
* a schema is small, declarative, and something a reader should be able to see
|
|
60
|
+
* in the HTML, and data is large and windowed.
|
|
61
|
+
*
|
|
62
|
+
* **The same element serves both tables**, the markup one and the data one. It
|
|
63
|
+
* is identified by a flag rather than by `instanceof`, so a `helix-table-column`
|
|
64
|
+
* works inside either without the two roots sharing anything else.
|
|
65
|
+
*
|
|
66
|
+
* **It generates no box of its own**, the same as a row: the heading is a grid
|
|
67
|
+
* item of the table, so it lines up with the cells under it rather than sitting
|
|
68
|
+
* in a wrapper that has to be kept the same width.
|
|
69
|
+
*
|
|
70
|
+
* @since 0.1.0
|
|
71
|
+
* @status experimental
|
|
72
|
+
* @aliases Column header, Th
|
|
73
|
+
* @documentation https://helix.fusion.dev/components/table
|
|
74
|
+
*
|
|
75
|
+
* @slot - The heading.
|
|
76
|
+
*
|
|
77
|
+
* @csspart column - The heading cell.
|
|
78
|
+
*/
|
|
79
|
+
let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixElement {
|
|
80
|
+
constructor() {
|
|
81
|
+
super(...arguments);
|
|
82
|
+
/**
|
|
83
|
+
* The track this column takes, as CSS.
|
|
84
|
+
*
|
|
85
|
+
* A single track value, so anything valid in `grid-template-columns` works:
|
|
86
|
+
* `16rem`, `auto`, `minmax(0, 2fr)`. Left unset the column shares what is
|
|
87
|
+
* left over equally, as `minmax(max-content, 1fr)`.
|
|
88
|
+
*
|
|
89
|
+
* **The floor was `0` and that is what broke a narrow table.** A zero floor
|
|
90
|
+
* lets a track shrink under its own content, so at 375 the columns were
|
|
91
|
+
* squeezed to 75px and `eu-central-1` wrapped across lines, which reads as
|
|
92
|
+
* corrupt data rather than as a table that ran out of room. The zero was
|
|
93
|
+
* chosen to stop one long value pushing the table past its container, and
|
|
94
|
+
* that was the right worry with nowhere for the overflow to go.
|
|
95
|
+
*
|
|
96
|
+
* Somewhere now exists: `@fusion.dev/helix` scrolls the table's own box. So a
|
|
97
|
+
* long value pushes past the container as the old comment feared, and the
|
|
98
|
+
* table scrolls instead of the value being destroyed. Measured at 375: tracks
|
|
99
|
+
* of 192, 89 and 102 against a 343 box, so the table scrolls 384 and the page
|
|
100
|
+
* does not move.
|
|
101
|
+
*
|
|
102
|
+
* **`max-content` and not `min-content`, because a hyphen is a wrap
|
|
103
|
+
* opportunity.** A `min-content` floor still broke `eu-central-1` at its
|
|
104
|
+
* hyphens, which is the whole of the reported fault. The cost is that a
|
|
105
|
+
* column of prose asks for its longest paragraph on one line, so a column
|
|
106
|
+
* holding sentences rather than values wants `width="minmax(0, 1fr)"` to opt
|
|
107
|
+
* back into wrapping. A headless consumer owns the overflow either way, that
|
|
108
|
+
* being paint, and gets the honest track list.
|
|
109
|
+
*/
|
|
110
|
+
this.width = '';
|
|
111
|
+
/**
|
|
112
|
+
* The key this column reads out of a row.
|
|
113
|
+
*
|
|
114
|
+
* Dot paths resolve, so `field="owner.name"` reads a nested value: a result
|
|
115
|
+
* from an API arrives shaped the way the API shaped it, and requiring a flat
|
|
116
|
+
* row would push a mapping pass onto every consumer.
|
|
117
|
+
*
|
|
118
|
+
* **It is also the sort and filter identity**, which is why sorting is by
|
|
119
|
+
* field and not by column index: a reordered or hidden column would otherwise
|
|
120
|
+
* change what `sort="2:asc"` means, and a sort that means something different
|
|
121
|
+
* after a column moves is a sort a consumer cannot store in a URL.
|
|
122
|
+
*
|
|
123
|
+
* Empty on a column that is purely presentational, an actions column say, and
|
|
124
|
+
* such a column is never sortable however it is marked.
|
|
125
|
+
*/
|
|
126
|
+
this.field = '';
|
|
127
|
+
/**
|
|
128
|
+
* Whether a reader may reorder the set by this column.
|
|
129
|
+
*
|
|
130
|
+
* Ignored without a `field`, and silently: a column with nothing to sort by
|
|
131
|
+
* has no order to offer, and refusing loudly would mean an actions column
|
|
132
|
+
* carrying `sortable` breaks a table rather than doing nothing.
|
|
133
|
+
*/
|
|
134
|
+
this.sortable = false;
|
|
135
|
+
/**
|
|
136
|
+
* Which edge the values line up against.
|
|
137
|
+
*
|
|
138
|
+
* `end` is what a column of numbers wants, so digits of the same magnitude sit
|
|
139
|
+
* above each other. Left unset the cell inherits the table's own alignment,
|
|
140
|
+
* which is `start` for text in either writing direction.
|
|
141
|
+
*/
|
|
142
|
+
this.align = '';
|
|
143
|
+
/**
|
|
144
|
+
* How to read the cell, where the field alone will not do.
|
|
145
|
+
*
|
|
146
|
+
* A property and not an attribute, because it is a function. Set it from a Lit
|
|
147
|
+
* template with `.cell=${...}`, or assign it in script. A column with neither
|
|
148
|
+
* this nor a `field` renders an empty cell rather than the whole row stringified,
|
|
149
|
+
* which is the failure mode of guessing.
|
|
150
|
+
*/
|
|
151
|
+
this.cell = undefined;
|
|
152
|
+
/**
|
|
153
|
+
* How to read the value that gets sorted and filtered, where it is not the cell.
|
|
154
|
+
*
|
|
155
|
+
* **The one that is easy to leave out and expensive to add later.** A cell
|
|
156
|
+
* showing `2.4 MB` sorts as a string unless something says the underlying value
|
|
157
|
+
* is a number, so `12 kB` sorts above `2.4 MB` and the column looks broken
|
|
158
|
+
* while every value in it is right. Left unset this is the field, which is the
|
|
159
|
+
* correct default: the raw value is what an API sorted by.
|
|
160
|
+
*/
|
|
161
|
+
this.compare = undefined;
|
|
162
|
+
/**
|
|
163
|
+
* @internal Read by a parent to identify its children across the light DOM,
|
|
164
|
+
* which is cheaper than `instanceof` and is why this is public rather than
|
|
165
|
+
* protected. Not a consumer's to read or set.
|
|
166
|
+
*/
|
|
167
|
+
this.isTableColumn = true;
|
|
168
|
+
}
|
|
169
|
+
/** The track this column contributes, resolved. */
|
|
170
|
+
get track() {
|
|
171
|
+
return this.width || 'minmax(max-content, 1fr)';
|
|
172
|
+
}
|
|
173
|
+
/** Whether a reader can actually reorder by this column. */
|
|
174
|
+
get canSort() {
|
|
175
|
+
return this.sortable && this.field !== '';
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The value this column shows for a row.
|
|
179
|
+
*
|
|
180
|
+
* `cell` first, then the field. An explicit reader that returns `undefined` is
|
|
181
|
+
* treated as declining rather than as an answer, so a formatter can hand the
|
|
182
|
+
* default back for the rows it has nothing to say about.
|
|
183
|
+
*/
|
|
184
|
+
read(row) {
|
|
185
|
+
const rendered = this.cell?.(row);
|
|
186
|
+
return rendered === undefined ? at(row, this.field) : rendered;
|
|
187
|
+
}
|
|
188
|
+
/** The value this column sorts and filters by, which is not always what it shows. */
|
|
189
|
+
order(row) {
|
|
190
|
+
const compared = this.compare?.(row);
|
|
191
|
+
return compared === undefined ? at(row, this.field) : compared;
|
|
192
|
+
}
|
|
193
|
+
willUpdate(changed) {
|
|
194
|
+
super.willUpdate(changed);
|
|
195
|
+
hostAria(this.internals, { role: 'columnheader' });
|
|
196
|
+
}
|
|
197
|
+
render() {
|
|
198
|
+
return html `<span part="column"><slot></slot></span>`;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
__decorate([
|
|
202
|
+
property()
|
|
203
|
+
], HelixHeadlessTableColumn.prototype, "width", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property()
|
|
206
|
+
], HelixHeadlessTableColumn.prototype, "field", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: Boolean })
|
|
209
|
+
], HelixHeadlessTableColumn.prototype, "sortable", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property()
|
|
212
|
+
], HelixHeadlessTableColumn.prototype, "align", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ attribute: false })
|
|
215
|
+
], HelixHeadlessTableColumn.prototype, "cell", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ attribute: false })
|
|
218
|
+
], HelixHeadlessTableColumn.prototype, "compare", void 0);
|
|
219
|
+
HelixHeadlessTableColumn = __decorate([
|
|
220
|
+
customElement('helix-headless-table-column')
|
|
221
|
+
], HelixHeadlessTableColumn);
|
|
222
|
+
export { HelixHeadlessTableColumn };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import type { HelixHeadlessTableColumn } from '../column/table-column.js';
|
|
4
|
+
declare const HelixHeadlessTable_base: (new (...args: any[]) => import("@fusion.dev/helix-core").CollectionElement) & typeof HelixElement;
|
|
5
|
+
/**
|
|
6
|
+
* @summary Tabular data laid out on a grid.
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* A grid rather than a `<table>`, so every column lines up across rows while
|
|
10
|
+
* each row stays a real element that can be styled, hidden, or made
|
|
11
|
+
* interactive. Table layout gives column alignment and takes away almost
|
|
12
|
+
* everything else; grid gives both.
|
|
13
|
+
*
|
|
14
|
+
* The cost is that the roles have to be declared, since a grid of divs is not a
|
|
15
|
+
* table to anyone reading it. `table`, `row`, `cell`, and `columnheader` are
|
|
16
|
+
* all set explicitly, and rows are `display: contents` so their cells become
|
|
17
|
+
* items of the one grid that does the aligning.
|
|
18
|
+
*
|
|
19
|
+
* The properties below are written by this component and read by whoever draws
|
|
20
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
21
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
22
|
+
* without measuring anything itself.
|
|
23
|
+
*
|
|
24
|
+
* @since 0.1.0
|
|
25
|
+
* @status experimental
|
|
26
|
+
* @category data
|
|
27
|
+
* @aliases DataTable, Grid table
|
|
28
|
+
* @documentation https://helix.fusion.dev/components/table
|
|
29
|
+
*
|
|
30
|
+
* @slot - The table's rows.
|
|
31
|
+
*
|
|
32
|
+
* @csspart empty - Shown when there are no rows to show.
|
|
33
|
+
* @csspart head - The row the column headings sit in. `display: contents`, so it takes no space.
|
|
34
|
+
* @csspart loading - Shown while the rows are still on their way.
|
|
35
|
+
* @csspart table - The grid.
|
|
36
|
+
*
|
|
37
|
+
* @cssproperty --table-columns - Track list for the columns.
|
|
38
|
+
* @cssproperty --table-template - The column track list this element worked out from the columns declared in it. Written by the component, read by the sheet that paints: a stylesheet takes it to lay the grid out, and setting it does nothing, because the component writes it inline on the very element that reads it and an inline declaration beats any sheet. `--table-columns` is the one to set.
|
|
39
|
+
*/
|
|
40
|
+
export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
41
|
+
/**
|
|
42
|
+
* Column track list, as CSS. Deprecated: declare columns instead.
|
|
43
|
+
*
|
|
44
|
+
* Kept for a table that has no `helix-table-column` children, and ignored the
|
|
45
|
+
* moment it has one. A raw track list is the right shape for the value and
|
|
46
|
+
* the wrong place for it: the headings and the widths were two halves of one
|
|
47
|
+
* fact held in two places, and nothing checked that they agreed. Worse, the
|
|
48
|
+
* value is CSS, so handing it headings by mistake produced an invalid track
|
|
49
|
+
* list, which a grid ignores in silence: the table collapsed to one column
|
|
50
|
+
* and said nothing. Columns carry both halves now.
|
|
51
|
+
*/
|
|
52
|
+
columns: string;
|
|
53
|
+
/**
|
|
54
|
+
* Accessible name for the table.
|
|
55
|
+
*/
|
|
56
|
+
label: string;
|
|
57
|
+
/** The columns declared as children, in the order they are written. */
|
|
58
|
+
get tableColumns(): HelixHeadlessTableColumn[];
|
|
59
|
+
/**
|
|
60
|
+
* The track list, from the columns if there are any.
|
|
61
|
+
*
|
|
62
|
+
* Read from the DOM rather than kept, so adding or removing a column needs
|
|
63
|
+
* nothing else to be told. Falls back to the `columns` string for a table
|
|
64
|
+
* written before columns existed, and to a single track for one that declares
|
|
65
|
+
* neither.
|
|
66
|
+
*/
|
|
67
|
+
private get template();
|
|
68
|
+
private readonly handleSlotChange;
|
|
69
|
+
/**
|
|
70
|
+
* Nothing is assigned by name, so the columns can be put in a row.
|
|
71
|
+
*
|
|
72
|
+
* `role="columnheader"` was landing directly under `role="table"` with no
|
|
73
|
+
* owning `row`, which is invalid: the table pattern is `table > row >
|
|
74
|
+
* columnheader`, and a header cell with no row is a cell belonging to
|
|
75
|
+
* nothing. The columns are ordinary children the consumer writes with no
|
|
76
|
+
* `slot`, so the only way to put a wrapper around them without changing what
|
|
77
|
+
* a consumer writes is to assign them here.
|
|
78
|
+
*
|
|
79
|
+
* Manual rather than a `slot` attribute this element would set on the
|
|
80
|
+
* consumer's own markup, which is the change a React consumer's hydration
|
|
81
|
+
* reports and does not patch up. Assignment writes nothing at all.
|
|
82
|
+
*
|
|
83
|
+
* Safe against the server because this repo ships no declarative shadow DOM:
|
|
84
|
+
* the shadow root exists only after upgrade, and the assignment below runs in
|
|
85
|
+
* that same update. There is no window in which the shadow is present and the
|
|
86
|
+
* assignment has not happened.
|
|
87
|
+
*/
|
|
88
|
+
static shadowRootOptions: ShadowRootInit;
|
|
89
|
+
private assign;
|
|
90
|
+
protected updated(changed: PropertyValues): void;
|
|
91
|
+
protected render(): TemplateResult;
|
|
92
|
+
}
|
|
93
|
+
declare global {
|
|
94
|
+
interface HTMLElementTagNameMap {
|
|
95
|
+
'helix-headless-table': HelixHeadlessTable;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
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, MixinCollection } from '@fusion.dev/helix-core';
|
|
8
|
+
import { html, nothing } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
/**
|
|
11
|
+
* @summary Tabular data laid out on a grid.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* A grid rather than a `<table>`, so every column lines up across rows while
|
|
15
|
+
* each row stays a real element that can be styled, hidden, or made
|
|
16
|
+
* interactive. Table layout gives column alignment and takes away almost
|
|
17
|
+
* everything else; grid gives both.
|
|
18
|
+
*
|
|
19
|
+
* The cost is that the roles have to be declared, since a grid of divs is not a
|
|
20
|
+
* table to anyone reading it. `table`, `row`, `cell`, and `columnheader` are
|
|
21
|
+
* all set explicitly, and rows are `display: contents` so their cells become
|
|
22
|
+
* items of the one grid that does the aligning.
|
|
23
|
+
*
|
|
24
|
+
* The properties below are written by this component and read by whoever draws
|
|
25
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
26
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
27
|
+
* without measuring anything itself.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
* @status experimental
|
|
31
|
+
* @category data
|
|
32
|
+
* @aliases DataTable, Grid table
|
|
33
|
+
* @documentation https://helix.fusion.dev/components/table
|
|
34
|
+
*
|
|
35
|
+
* @slot - The table's rows.
|
|
36
|
+
*
|
|
37
|
+
* @csspart empty - Shown when there are no rows to show.
|
|
38
|
+
* @csspart head - The row the column headings sit in. `display: contents`, so it takes no space.
|
|
39
|
+
* @csspart loading - Shown while the rows are still on their way.
|
|
40
|
+
* @csspart table - The grid.
|
|
41
|
+
*
|
|
42
|
+
* @cssproperty --table-columns - Track list for the columns.
|
|
43
|
+
* @cssproperty --table-template - The column track list this element worked out from the columns declared in it. Written by the component, read by the sheet that paints: a stylesheet takes it to lay the grid out, and setting it does nothing, because the component writes it inline on the very element that reads it and an inline declaration beats any sheet. `--table-columns` is the one to set.
|
|
44
|
+
*/
|
|
45
|
+
let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixElement) {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
/**
|
|
49
|
+
* Column track list, as CSS. Deprecated: declare columns instead.
|
|
50
|
+
*
|
|
51
|
+
* Kept for a table that has no `helix-table-column` children, and ignored the
|
|
52
|
+
* moment it has one. A raw track list is the right shape for the value and
|
|
53
|
+
* the wrong place for it: the headings and the widths were two halves of one
|
|
54
|
+
* fact held in two places, and nothing checked that they agreed. Worse, the
|
|
55
|
+
* value is CSS, so handing it headings by mistake produced an invalid track
|
|
56
|
+
* list, which a grid ignores in silence: the table collapsed to one column
|
|
57
|
+
* and said nothing. Columns carry both halves now.
|
|
58
|
+
*/
|
|
59
|
+
this.columns = '';
|
|
60
|
+
/**
|
|
61
|
+
* Accessible name for the table.
|
|
62
|
+
*/
|
|
63
|
+
this.label = '';
|
|
64
|
+
/* Columns arrive from the light DOM, which changes no property here, so
|
|
65
|
+
nothing would schedule the render that reads them. */
|
|
66
|
+
this.handleSlotChange = () => {
|
|
67
|
+
this.requestUpdate();
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** The columns declared as children, in the order they are written. */
|
|
71
|
+
get tableColumns() {
|
|
72
|
+
/* `?? []` is the server. Lit's element shim carries attributes and not a
|
|
73
|
+
tree, so `children` is undefined there, and this getter is reached from
|
|
74
|
+
`template`, which is read during `render`: spreading it threw and the
|
|
75
|
+
whole SSR suite died on an unhandled error. The same fault the menu item
|
|
76
|
+
had, in code written after it was fixed there, which is the argument for
|
|
77
|
+
the SSR specs existing at all. */
|
|
78
|
+
return [...(this.children ?? [])].filter((child) => 'isTableColumn' in child && child.isTableColumn === true);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The track list, from the columns if there are any.
|
|
82
|
+
*
|
|
83
|
+
* Read from the DOM rather than kept, so adding or removing a column needs
|
|
84
|
+
* nothing else to be told. Falls back to the `columns` string for a table
|
|
85
|
+
* written before columns existed, and to a single track for one that declares
|
|
86
|
+
* neither.
|
|
87
|
+
*/
|
|
88
|
+
get template() {
|
|
89
|
+
const declared = this.tableColumns;
|
|
90
|
+
if (declared.length > 0) {
|
|
91
|
+
return declared.map((column) => column.track).join(' ');
|
|
92
|
+
}
|
|
93
|
+
return this.columns;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Nothing is assigned by name, so the columns can be put in a row.
|
|
97
|
+
*
|
|
98
|
+
* `role="columnheader"` was landing directly under `role="table"` with no
|
|
99
|
+
* owning `row`, which is invalid: the table pattern is `table > row >
|
|
100
|
+
* columnheader`, and a header cell with no row is a cell belonging to
|
|
101
|
+
* nothing. The columns are ordinary children the consumer writes with no
|
|
102
|
+
* `slot`, so the only way to put a wrapper around them without changing what
|
|
103
|
+
* a consumer writes is to assign them here.
|
|
104
|
+
*
|
|
105
|
+
* Manual rather than a `slot` attribute this element would set on the
|
|
106
|
+
* consumer's own markup, which is the change a React consumer's hydration
|
|
107
|
+
* reports and does not patch up. Assignment writes nothing at all.
|
|
108
|
+
*
|
|
109
|
+
* Safe against the server because this repo ships no declarative shadow DOM:
|
|
110
|
+
* the shadow root exists only after upgrade, and the assignment below runs in
|
|
111
|
+
* that same update. There is no window in which the shadow is present and the
|
|
112
|
+
* assignment has not happened.
|
|
113
|
+
*/
|
|
114
|
+
static { this.shadowRootOptions = {
|
|
115
|
+
...HelixElement.shadowRootOptions,
|
|
116
|
+
slotAssignment: 'manual',
|
|
117
|
+
}; }
|
|
118
|
+
assign() {
|
|
119
|
+
const head = this.renderRoot?.querySelector('slot[name="columns"]');
|
|
120
|
+
const body = this.renderRoot?.querySelector('slot:not([name])');
|
|
121
|
+
if (!head || !body) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const columns = new Set(this.tableColumns);
|
|
125
|
+
head.assign(...this.tableColumns);
|
|
126
|
+
body.assign(...[...this.children].filter((child) => !columns.has(child)));
|
|
127
|
+
}
|
|
128
|
+
updated(changed) {
|
|
129
|
+
super.updated(changed);
|
|
130
|
+
this.assign();
|
|
131
|
+
}
|
|
132
|
+
render() {
|
|
133
|
+
const template = this.template;
|
|
134
|
+
return html `<div
|
|
135
|
+
part="table"
|
|
136
|
+
role="table"
|
|
137
|
+
aria-busy=${this.loading ? 'true' : nothing}
|
|
138
|
+
aria-label=${this.label || 'Table'}
|
|
139
|
+
style=${template ? `--table-template: ${template}` : ''}
|
|
140
|
+
>
|
|
141
|
+
<div part="head" role="row"><slot name="columns"></slot></div>
|
|
142
|
+
<slot
|
|
143
|
+
@slotchange=${(event) => {
|
|
144
|
+
this.countRows(event);
|
|
145
|
+
this.handleSlotChange();
|
|
146
|
+
}}
|
|
147
|
+
></slot>
|
|
148
|
+
${this.renderStatus(this.hasRows)}
|
|
149
|
+
</div>`;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
__decorate([
|
|
153
|
+
property()
|
|
154
|
+
], HelixHeadlessTable.prototype, "columns", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
property()
|
|
157
|
+
], HelixHeadlessTable.prototype, "label", void 0);
|
|
158
|
+
HelixHeadlessTable = __decorate([
|
|
159
|
+
customElement('helix-headless-table')
|
|
160
|
+
], HelixHeadlessTable);
|
|
161
|
+
export { HelixHeadlessTable };
|