@tanrei/web 0.0.0-stage → 0.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +58 -0
- package/README.md +9743 -2
- package/custom-elements.json +86072 -0
- package/dist/THIRD_PARTY_LICENSES.md +136 -0
- package/dist/accordion.css +812 -0
- package/dist/app-shell.css +493 -0
- package/dist/avatar.css +80 -0
- package/dist/breadcrumbs.css +511 -0
- package/dist/callout.css +65 -0
- package/dist/code.css +595 -0
- package/dist/components/accordion/accordion.d.ts +197 -0
- package/dist/components/accordion/accordion.js +763 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/app-bar/app-bar.d.ts +107 -0
- package/dist/components/app-bar/app-bar.js +295 -0
- package/dist/components/app-bar/app-bar.js.map +1 -0
- package/dist/components/app-bar/app-bar.styles.d.ts +12 -0
- package/dist/components/app-bar/app-bar.styles.js +223 -0
- package/dist/components/app-bar/app-bar.styles.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +220 -0
- package/dist/components/app-shell/app-shell.js +677 -0
- package/dist/components/app-shell/app-shell.js.map +1 -0
- package/dist/components/avatar/avatar.d.ts +162 -0
- package/dist/components/avatar/avatar.js +390 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/avatar.styles.d.ts +9 -0
- package/dist/components/avatar/avatar.styles.js +258 -0
- package/dist/components/avatar/avatar.styles.js.map +1 -0
- package/dist/components/badge/badge.d.ts +59 -0
- package/dist/components/badge/badge.js +176 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/badge.styles.d.ts +1 -0
- package/dist/components/badge/badge.styles.js +106 -0
- package/dist/components/badge/badge.styles.js.map +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +207 -0
- package/dist/components/bottom-sheet/bottom-sheet.js +724 -0
- package/dist/components/bottom-sheet/bottom-sheet.js.map +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.styles.d.ts +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.styles.js +393 -0
- package/dist/components/bottom-sheet/bottom-sheet.styles.js.map +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +176 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +638 -0
- package/dist/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.d.ts +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.js +225 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.js.map +1 -0
- package/dist/components/button/button.d.ts +280 -0
- package/dist/components/button/button.js +530 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/button.styles.d.ts +20 -0
- package/dist/components/button/button.styles.js +328 -0
- package/dist/components/button/button.styles.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +124 -0
- package/dist/components/button-group/button-group.js +287 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/button-group/button-group.styles.d.ts +1 -0
- package/dist/components/button-group/button-group.styles.js +220 -0
- package/dist/components/button-group/button-group.styles.js.map +1 -0
- package/dist/components/button-with-menu/button-with-menu.d.ts +224 -0
- package/dist/components/button-with-menu/button-with-menu.js +635 -0
- package/dist/components/button-with-menu/button-with-menu.js.map +1 -0
- package/dist/components/button-with-menu/button-with-menu.styles.d.ts +15 -0
- package/dist/components/button-with-menu/button-with-menu.styles.js +418 -0
- package/dist/components/button-with-menu/button-with-menu.styles.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +380 -0
- package/dist/components/calendar/calendar.js +1619 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/calendar.styles.d.ts +11 -0
- package/dist/components/calendar/calendar.styles.js +412 -0
- package/dist/components/calendar/calendar.styles.js.map +1 -0
- package/dist/components/callout/callout.d.ts +157 -0
- package/dist/components/callout/callout.js +436 -0
- package/dist/components/callout/callout.js.map +1 -0
- package/dist/components/callout/callout.styles.d.ts +13 -0
- package/dist/components/callout/callout.styles.js +383 -0
- package/dist/components/callout/callout.styles.js.map +1 -0
- package/dist/components/card/card.d.ts +108 -0
- package/dist/components/card/card.js +235 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/card/card.styles.d.ts +9 -0
- package/dist/components/card/card.styles.js +170 -0
- package/dist/components/card/card.styles.js.map +1 -0
- package/dist/components/carousel/carousel-geometry.d.ts +178 -0
- package/dist/components/carousel/carousel-geometry.js +356 -0
- package/dist/components/carousel/carousel-geometry.js.map +1 -0
- package/dist/components/carousel/carousel.d.ts +401 -0
- package/dist/components/carousel/carousel.js +1352 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/carousel/carousel.styles.d.ts +4 -0
- package/dist/components/carousel/carousel.styles.js +475 -0
- package/dist/components/carousel/carousel.styles.js.map +1 -0
- package/dist/components/chat-composer/chat-composer.d.ts +482 -0
- package/dist/components/chat-composer/chat-composer.js +1374 -0
- package/dist/components/chat-composer/chat-composer.js.map +1 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +9 -0
- package/dist/components/chat-composer/chat-composer.styles.js +308 -0
- package/dist/components/chat-composer/chat-composer.styles.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +135 -0
- package/dist/components/checkbox/checkbox.js +296 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +13 -0
- package/dist/components/checkbox/checkbox.styles.js +226 -0
- package/dist/components/checkbox/checkbox.styles.js.map +1 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +199 -0
- package/dist/components/checkbox-group/checkbox-group.js +500 -0
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/components/chip/chip.d.ts +176 -0
- package/dist/components/chip/chip.js +376 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/chip/chip.styles.d.ts +10 -0
- package/dist/components/chip/chip.styles.js +465 -0
- package/dist/components/chip/chip.styles.js.map +1 -0
- package/dist/components/chip-field/chip-field.d.ts +315 -0
- package/dist/components/chip-field/chip-field.js +887 -0
- package/dist/components/chip-field/chip-field.js.map +1 -0
- package/dist/components/code-block/code-block.before.d.ts +2 -0
- package/dist/components/code-block/code-block.before.js +193 -0
- package/dist/components/code-block/code-block.before.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +268 -0
- package/dist/components/code-block/code-block.js +1009 -0
- package/dist/components/code-block/code-block.js.map +1 -0
- package/dist/components/code-block/code-block.light.d.ts +50 -0
- package/dist/components/code-block/code-block.light.js +287 -0
- package/dist/components/code-block/code-block.light.js.map +1 -0
- package/dist/components/code-block/code-block.lines.d.ts +49 -0
- package/dist/components/code-block/code-block.lines.js +75 -0
- package/dist/components/code-block/code-block.lines.js.map +1 -0
- package/dist/components/code-block/code-block.styles.d.ts +8 -0
- package/dist/components/code-block/code-block.styles.js +212 -0
- package/dist/components/code-block/code-block.styles.js.map +1 -0
- package/dist/components/color-field/color-field.d.ts +120 -0
- package/dist/components/color-field/color-field.js +182 -0
- package/dist/components/color-field/color-field.js.map +1 -0
- package/dist/components/color-input/color-input.d.ts +302 -0
- package/dist/components/color-input/color-input.js +748 -0
- package/dist/components/color-input/color-input.js.map +1 -0
- package/dist/components/color-input/color-input.styles.d.ts +22 -0
- package/dist/components/color-input/color-input.styles.js +373 -0
- package/dist/components/color-input/color-input.styles.js.map +1 -0
- package/dist/components/color-input/color-text.d.ts +48 -0
- package/dist/components/color-input/color-text.js +77 -0
- package/dist/components/color-input/color-text.js.map +1 -0
- package/dist/components/combobox/combobox.d.ts +387 -0
- package/dist/components/combobox/combobox.js +1108 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/combobox/combobox.styles.d.ts +26 -0
- package/dist/components/combobox/combobox.styles.js +497 -0
- package/dist/components/combobox/combobox.styles.js.map +1 -0
- package/dist/components/combobox-field/combobox-field.d.ts +159 -0
- package/dist/components/combobox-field/combobox-field.js +280 -0
- package/dist/components/combobox-field/combobox-field.js.map +1 -0
- package/dist/components/copy-button/copy-button.d.ts +112 -0
- package/dist/components/copy-button/copy-button.js +237 -0
- package/dist/components/copy-button/copy-button.js.map +1 -0
- package/dist/components/copy-button/copy-button.styles.d.ts +1 -0
- package/dist/components/copy-button/copy-button.styles.js +62 -0
- package/dist/components/copy-button/copy-button.styles.js.map +1 -0
- package/dist/components/date-time-picker/date-time-picker.d.ts +603 -0
- package/dist/components/date-time-picker/date-time-picker.js +2537 -0
- package/dist/components/date-time-picker/date-time-picker.js.map +1 -0
- package/dist/components/date-time-picker/date-time-picker.styles.d.ts +1 -0
- package/dist/components/date-time-picker/date-time-picker.styles.js +842 -0
- package/dist/components/date-time-picker/date-time-picker.styles.js.map +1 -0
- package/dist/components/description-list/description-list.d.ts +133 -0
- package/dist/components/description-list/description-list.js +395 -0
- package/dist/components/description-list/description-list.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +140 -0
- package/dist/components/dialog/dialog.js +440 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +306 -0
- package/dist/components/dialog/dialog.styles.js.map +1 -0
- package/dist/components/divider/divider.d.ts +112 -0
- package/dist/components/divider/divider.js +331 -0
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/divider/divider.styles.d.ts +6 -0
- package/dist/components/divider/divider.styles.js +183 -0
- package/dist/components/divider/divider.styles.js.map +1 -0
- package/dist/components/embedded-text-input/embedded-text-input.d.ts +246 -0
- package/dist/components/embedded-text-input/embedded-text-input.js +673 -0
- package/dist/components/embedded-text-input/embedded-text-input.js.map +1 -0
- package/dist/components/embedded-text-input/embedded-text-input.styles.d.ts +1 -0
- package/dist/components/embedded-text-input/embedded-text-input.styles.js +204 -0
- package/dist/components/embedded-text-input/embedded-text-input.styles.js.map +1 -0
- package/dist/components/empty-state/empty-state.d.ts +132 -0
- package/dist/components/empty-state/empty-state.js +333 -0
- package/dist/components/empty-state/empty-state.js.map +1 -0
- package/dist/components/empty-state/empty-state.styles.d.ts +11 -0
- package/dist/components/empty-state/empty-state.styles.js +218 -0
- package/dist/components/empty-state/empty-state.styles.js.map +1 -0
- package/dist/components/fab-menu/fab-menu.d.ts +240 -0
- package/dist/components/fab-menu/fab-menu.js +605 -0
- package/dist/components/fab-menu/fab-menu.js.map +1 -0
- package/dist/components/fab-menu/fab-menu.styles.d.ts +21 -0
- package/dist/components/fab-menu/fab-menu.styles.js +427 -0
- package/dist/components/fab-menu/fab-menu.styles.js.map +1 -0
- package/dist/components/field/field.d.ts +165 -0
- package/dist/components/field/field.js +399 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/field/field.styles.d.ts +2 -0
- package/dist/components/field/field.styles.js +177 -0
- package/dist/components/field/field.styles.js.map +1 -0
- package/dist/components/field-group/field-group.d.ts +122 -0
- package/dist/components/field-group/field-group.js +246 -0
- package/dist/components/field-group/field-group.js.map +1 -0
- package/dist/components/field-group/field-group.styles.d.ts +7 -0
- package/dist/components/field-group/field-group.styles.js +28 -0
- package/dist/components/field-group/field-group.styles.js.map +1 -0
- package/dist/components/figure/figure.d.ts +152 -0
- package/dist/components/figure/figure.js +435 -0
- package/dist/components/figure/figure.js.map +1 -0
- package/dist/components/file-item/file-item.d.ts +232 -0
- package/dist/components/file-item/file-item.js +665 -0
- package/dist/components/file-item/file-item.js.map +1 -0
- package/dist/components/file-item/file-item.styles.d.ts +2 -0
- package/dist/components/file-item/file-item.styles.js +582 -0
- package/dist/components/file-item/file-item.styles.js.map +1 -0
- package/dist/components/file-picker/file-picker.d.ts +221 -0
- package/dist/components/file-picker/file-picker.js +588 -0
- package/dist/components/file-picker/file-picker.js.map +1 -0
- package/dist/components/file-picker/file-picker.styles.d.ts +2 -0
- package/dist/components/file-picker/file-picker.styles.js +303 -0
- package/dist/components/file-picker/file-picker.styles.js.map +1 -0
- package/dist/components/file-upload/file-upload.d.ts +353 -0
- package/dist/components/file-upload/file-upload.js +939 -0
- package/dist/components/file-upload/file-upload.js.map +1 -0
- package/dist/components/file-upload/file-upload.styles.d.ts +1 -0
- package/dist/components/file-upload/file-upload.styles.js +91 -0
- package/dist/components/file-upload/file-upload.styles.js.map +1 -0
- package/dist/components/image-preview/image-preview.d.ts +336 -0
- package/dist/components/image-preview/image-preview.js +1510 -0
- package/dist/components/image-preview/image-preview.js.map +1 -0
- package/dist/components/image-preview/image-preview.styles.d.ts +1 -0
- package/dist/components/image-preview/image-preview.styles.js +418 -0
- package/dist/components/image-preview/image-preview.styles.js.map +1 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.d.ts +94 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.js +285 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.d.ts +11 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js +155 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js.map +1 -0
- package/dist/components/link-card/link-card.d.ts +156 -0
- package/dist/components/link-card/link-card.js +713 -0
- package/dist/components/link-card/link-card.js.map +1 -0
- package/dist/components/list/list.d.ts +430 -0
- package/dist/components/list/list.js +1230 -0
- package/dist/components/list/list.js.map +1 -0
- package/dist/components/list/list.styles.d.ts +3 -0
- package/dist/components/list/list.styles.js +334 -0
- package/dist/components/list/list.styles.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts +83 -0
- package/dist/components/loading-indicator/loading-indicator.js +195 -0
- package/dist/components/loading-indicator/loading-indicator.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator.styles.d.ts +6 -0
- package/dist/components/loading-indicator/loading-indicator.styles.js +124 -0
- package/dist/components/loading-indicator/loading-indicator.styles.js.map +1 -0
- package/dist/components/main-action-button/main-action-button.d.ts +95 -0
- package/dist/components/main-action-button/main-action-button.js +202 -0
- package/dist/components/main-action-button/main-action-button.js.map +1 -0
- package/dist/components/main-action-button/main-action-button.styles.d.ts +10 -0
- package/dist/components/main-action-button/main-action-button.styles.js +285 -0
- package/dist/components/main-action-button/main-action-button.styles.js.map +1 -0
- package/dist/components/menu/menu.d.ts +813 -0
- package/dist/components/menu/menu.js +2061 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/menu/menu.styles.d.ts +18 -0
- package/dist/components/menu/menu.styles.js +587 -0
- package/dist/components/menu/menu.styles.js.map +1 -0
- package/dist/components/menubar/menubar.d.ts +477 -0
- package/dist/components/menubar/menubar.js +1677 -0
- package/dist/components/menubar/menubar.js.map +1 -0
- package/dist/components/menubar/menubar.styles.d.ts +43 -0
- package/dist/components/menubar/menubar.styles.js +379 -0
- package/dist/components/menubar/menubar.styles.js.map +1 -0
- package/dist/components/navigation-bar/navigation-bar.d.ts +239 -0
- package/dist/components/navigation-bar/navigation-bar.js +544 -0
- package/dist/components/navigation-bar/navigation-bar.js.map +1 -0
- package/dist/components/navigation-bar/navigation-bar.styles.d.ts +21 -0
- package/dist/components/navigation-bar/navigation-bar.styles.js +320 -0
- package/dist/components/navigation-bar/navigation-bar.styles.js.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts +627 -0
- package/dist/components/navigation-drawer/navigation-drawer.js +1917 -0
- package/dist/components/navigation-drawer/navigation-drawer.js.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.styles.d.ts +40 -0
- package/dist/components/navigation-drawer/navigation-drawer.styles.js +934 -0
- package/dist/components/navigation-drawer/navigation-drawer.styles.js.map +1 -0
- package/dist/components/number-field/number-field.d.ts +147 -0
- package/dist/components/number-field/number-field.js +252 -0
- package/dist/components/number-field/number-field.js.map +1 -0
- package/dist/components/number-input/number-input.d.ts +347 -0
- package/dist/components/number-input/number-input.js +929 -0
- package/dist/components/number-input/number-input.js.map +1 -0
- package/dist/components/number-input/number-input.styles.d.ts +22 -0
- package/dist/components/number-input/number-input.styles.js +395 -0
- package/dist/components/number-input/number-input.styles.js.map +1 -0
- package/dist/components/number-input/number-text.d.ts +74 -0
- package/dist/components/number-input/number-text.js +230 -0
- package/dist/components/number-input/number-text.js.map +1 -0
- package/dist/components/one-time-code-field/one-time-code-field.d.ts +94 -0
- package/dist/components/one-time-code-field/one-time-code-field.js +135 -0
- package/dist/components/one-time-code-field/one-time-code-field.js.map +1 -0
- package/dist/components/one-time-code-input/code-text.d.ts +51 -0
- package/dist/components/one-time-code-input/code-text.js +145 -0
- package/dist/components/one-time-code-input/code-text.js.map +1 -0
- package/dist/components/one-time-code-input/one-time-code-input.d.ts +219 -0
- package/dist/components/one-time-code-input/one-time-code-input.js +710 -0
- package/dist/components/one-time-code-input/one-time-code-input.js.map +1 -0
- package/dist/components/one-time-code-input/one-time-code-input.styles.d.ts +8 -0
- package/dist/components/one-time-code-input/one-time-code-input.styles.js +323 -0
- package/dist/components/one-time-code-input/one-time-code-input.styles.js.map +1 -0
- package/dist/components/option/option.d.ts +51 -0
- package/dist/components/option/option.js +75 -0
- package/dist/components/option/option.js.map +1 -0
- package/dist/components/page-header/page-header.d.ts +97 -0
- package/dist/components/page-header/page-header.js +258 -0
- package/dist/components/page-header/page-header.js.map +1 -0
- package/dist/components/popover/popover.d.ts +217 -0
- package/dist/components/popover/popover.js +616 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/popover/popover.styles.d.ts +8 -0
- package/dist/components/popover/popover.styles.js +299 -0
- package/dist/components/popover/popover.styles.js.map +1 -0
- package/dist/components/progress-indicator/progress-indicator.d.ts +76 -0
- package/dist/components/progress-indicator/progress-indicator.js +165 -0
- package/dist/components/progress-indicator/progress-indicator.js.map +1 -0
- package/dist/components/progress-indicator/progress-indicator.styles.d.ts +7 -0
- package/dist/components/progress-indicator/progress-indicator.styles.js +271 -0
- package/dist/components/progress-indicator/progress-indicator.styles.js.map +1 -0
- package/dist/components/radio-button/radio-button.d.ts +149 -0
- package/dist/components/radio-button/radio-button.js +370 -0
- package/dist/components/radio-button/radio-button.js.map +1 -0
- package/dist/components/radio-button/radio-button.styles.d.ts +8 -0
- package/dist/components/radio-button/radio-button.styles.js +190 -0
- package/dist/components/radio-button/radio-button.styles.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +188 -0
- package/dist/components/radio-group/radio-group.js +380 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/search/search.d.ts +569 -0
- package/dist/components/search/search.js +1801 -0
- package/dist/components/search/search.js.map +1 -0
- package/dist/components/search/search.styles.d.ts +15 -0
- package/dist/components/search/search.styles.js +967 -0
- package/dist/components/search/search.styles.js.map +1 -0
- package/dist/components/segmented-button/segmented-button.d.ts +183 -0
- package/dist/components/segmented-button/segmented-button.js +483 -0
- package/dist/components/segmented-button/segmented-button.js.map +1 -0
- package/dist/components/segmented-button/segmented-button.styles.d.ts +19 -0
- package/dist/components/segmented-button/segmented-button.styles.js +400 -0
- package/dist/components/segmented-button/segmented-button.styles.js.map +1 -0
- package/dist/components/select/select.d.ts +259 -0
- package/dist/components/select/select.js +702 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/select/select.styles.d.ts +27 -0
- package/dist/components/select/select.styles.js +359 -0
- package/dist/components/select/select.styles.js.map +1 -0
- package/dist/components/select-field/select-field.d.ts +141 -0
- package/dist/components/select-field/select-field.js +234 -0
- package/dist/components/select-field/select-field.js.map +1 -0
- package/dist/components/side-sheet/side-sheet.d.ts +190 -0
- package/dist/components/side-sheet/side-sheet.js +592 -0
- package/dist/components/side-sheet/side-sheet.js.map +1 -0
- package/dist/components/side-sheet/side-sheet.styles.d.ts +9 -0
- package/dist/components/side-sheet/side-sheet.styles.js +352 -0
- package/dist/components/side-sheet/side-sheet.styles.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +157 -0
- package/dist/components/skeleton/skeleton.js +550 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/slider/slider.d.ts +235 -0
- package/dist/components/slider/slider.js +792 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/slider/slider.styles.d.ts +6 -0
- package/dist/components/slider/slider.styles.js +492 -0
- package/dist/components/slider/slider.styles.js.map +1 -0
- package/dist/components/slider-field/slider-field.d.ts +150 -0
- package/dist/components/slider-field/slider-field.js +269 -0
- package/dist/components/slider-field/slider-field.js.map +1 -0
- package/dist/components/snackbar/snackbar.d.ts +237 -0
- package/dist/components/snackbar/snackbar.js +607 -0
- package/dist/components/snackbar/snackbar.js.map +1 -0
- package/dist/components/snackbar/snackbar.styles.d.ts +10 -0
- package/dist/components/snackbar/snackbar.styles.js +510 -0
- package/dist/components/snackbar/snackbar.styles.js.map +1 -0
- package/dist/components/switch/switch.d.ts +161 -0
- package/dist/components/switch/switch.js +470 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/switch/switch.styles.d.ts +3 -0
- package/dist/components/switch/switch.styles.js +440 -0
- package/dist/components/switch/switch.styles.js.map +1 -0
- package/dist/components/tab-view/tab-view.d.ts +303 -0
- package/dist/components/tab-view/tab-view.js +917 -0
- package/dist/components/tab-view/tab-view.js.map +1 -0
- package/dist/components/tab-view/tab-view.styles.d.ts +19 -0
- package/dist/components/tab-view/tab-view.styles.js +85 -0
- package/dist/components/tab-view/tab-view.styles.js.map +1 -0
- package/dist/components/table/table.d.ts +386 -0
- package/dist/components/table/table.js +1320 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +227 -0
- package/dist/components/table-of-contents/table-of-contents.js +963 -0
- package/dist/components/table-of-contents/table-of-contents.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.styles.d.ts +1 -0
- package/dist/components/table-of-contents/table-of-contents.styles.js +243 -0
- package/dist/components/table-of-contents/table-of-contents.styles.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +800 -0
- package/dist/components/tabs/tabs.js +2183 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/tabs/tabs.styles.d.ts +47 -0
- package/dist/components/tabs/tabs.styles.js +595 -0
- package/dist/components/tabs/tabs.styles.js.map +1 -0
- package/dist/components/tag/tag.d.ts +77 -0
- package/dist/components/tag/tag.js +143 -0
- package/dist/components/tag/tag.js.map +1 -0
- package/dist/components/tag/tag.styles.d.ts +13 -0
- package/dist/components/tag/tag.styles.js +215 -0
- package/dist/components/tag/tag.styles.js.map +1 -0
- package/dist/components/tag-group/tag-group.d.ts +110 -0
- package/dist/components/tag-group/tag-group.js +298 -0
- package/dist/components/tag-group/tag-group.js.map +1 -0
- package/dist/components/tag-group/tag-group.styles.d.ts +8 -0
- package/dist/components/tag-group/tag-group.styles.js +66 -0
- package/dist/components/tag-group/tag-group.styles.js.map +1 -0
- package/dist/components/text-field/text-field.d.ts +159 -0
- package/dist/components/text-field/text-field.js +272 -0
- package/dist/components/text-field/text-field.js.map +1 -0
- package/dist/components/text-input/text-input-segments.d.ts +93 -0
- package/dist/components/text-input/text-input-segments.js +233 -0
- package/dist/components/text-input/text-input-segments.js.map +1 -0
- package/dist/components/text-input/text-input.d.ts +683 -0
- package/dist/components/text-input/text-input.js +2120 -0
- package/dist/components/text-input/text-input.js.map +1 -0
- package/dist/components/text-input/text-input.styles.d.ts +27 -0
- package/dist/components/text-input/text-input.styles.js +1071 -0
- package/dist/components/text-input/text-input.styles.js.map +1 -0
- package/dist/components/toolbar/toolbar.d.ts +123 -0
- package/dist/components/toolbar/toolbar.js +336 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/toolbar/toolbar.styles.d.ts +10 -0
- package/dist/components/toolbar/toolbar.styles.js +156 -0
- package/dist/components/toolbar/toolbar.styles.js.map +1 -0
- package/dist/components/tooltip/tooltip-placement.d.ts +22 -0
- package/dist/components/tooltip/tooltip-placement.js +15 -0
- package/dist/components/tooltip/tooltip-placement.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +267 -0
- package/dist/components/tooltip/tooltip.js +902 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +7 -0
- package/dist/components/tooltip/tooltip.styles.js +240 -0
- package/dist/components/tooltip/tooltip.styles.js.map +1 -0
- package/dist/components/tree-view/tree-view.d.ts +264 -0
- package/dist/components/tree-view/tree-view.js +1228 -0
- package/dist/components/tree-view/tree-view.js.map +1 -0
- package/dist/description-list.css +337 -0
- package/dist/empty-state.css +70 -0
- package/dist/figure.css +381 -0
- package/dist/generated/icon-sets.d.ts +9 -0
- package/dist/generated/icon-sets.js +18 -0
- package/dist/generated/icon-sets.js.map +1 -0
- package/dist/generated/words.d.ts +161 -0
- package/dist/generated/words.js +91 -0
- package/dist/generated/words.js.map +1 -0
- package/dist/highlight/grammars/css.d.ts +3 -0
- package/dist/highlight/grammars/css.js +56 -0
- package/dist/highlight/grammars/css.js.map +1 -0
- package/dist/highlight/grammars/dart.d.ts +3 -0
- package/dist/highlight/grammars/dart.js +53 -0
- package/dist/highlight/grammars/dart.js.map +1 -0
- package/dist/highlight/grammars/javascript.d.ts +4 -0
- package/dist/highlight/grammars/javascript.js +119 -0
- package/dist/highlight/grammars/javascript.js.map +1 -0
- package/dist/highlight/grammars/json.d.ts +3 -0
- package/dist/highlight/grammars/json.js +19 -0
- package/dist/highlight/grammars/json.js.map +1 -0
- package/dist/highlight/grammars/kotlin.d.ts +3 -0
- package/dist/highlight/grammars/kotlin.js +46 -0
- package/dist/highlight/grammars/kotlin.js.map +1 -0
- package/dist/highlight/grammars/markup.d.ts +3 -0
- package/dist/highlight/grammars/markup.js +45 -0
- package/dist/highlight/grammars/markup.js.map +1 -0
- package/dist/highlight/grammars/shared.d.ts +25 -0
- package/dist/highlight/grammars/shared.js +37 -0
- package/dist/highlight/grammars/shared.js.map +1 -0
- package/dist/highlight/grammars/shell.d.ts +3 -0
- package/dist/highlight/grammars/shell.js +48 -0
- package/dist/highlight/grammars/shell.js.map +1 -0
- package/dist/highlight/grammars/swift.d.ts +3 -0
- package/dist/highlight/grammars/swift.js +46 -0
- package/dist/highlight/grammars/swift.js.map +1 -0
- package/dist/highlight/grammars/typescript.d.ts +2 -0
- package/dist/highlight/grammars/typescript.js +5 -0
- package/dist/highlight/grammars/typescript.js.map +1 -0
- package/dist/highlight/index.d.ts +104 -0
- package/dist/highlight/index.js +331 -0
- package/dist/highlight/index.js.map +1 -0
- package/dist/icons.css +107 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +10 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/link-card.css +678 -0
- package/dist/link.css +728 -0
- package/dist/link.d.ts +21 -0
- package/dist/link.js +594 -0
- package/dist/link.js.map +1 -0
- package/dist/links/index.d.ts +136 -0
- package/dist/links/index.js +404 -0
- package/dist/links/index.js.map +1 -0
- package/dist/links/node/address.js +154 -0
- package/dist/links/node/cli.js +102 -0
- package/dist/links/node/fetcher.js +267 -0
- package/dist/links/node/head.js +278 -0
- package/dist/links/node/index.d.ts +164 -0
- package/dist/links/node/index.js +26 -0
- package/dist/links/node/links.js +275 -0
- package/dist/links/node/lock.js +86 -0
- package/dist/links/node/mark.js +71 -0
- package/dist/links/node/options.js +120 -0
- package/dist/links/node/pictures.js +265 -0
- package/dist/links/node/refresh.js +28 -0
- package/dist/menu.css +97 -0
- package/dist/menubar.css +69 -0
- package/dist/page-header.css +324 -0
- package/dist/pagination.css +410 -0
- package/dist/pagination.d.ts +6 -0
- package/dist/pagination.js +256 -0
- package/dist/pagination.js.map +1 -0
- package/dist/primitives/actions.d.ts +75 -0
- package/dist/primitives/actions.js +142 -0
- package/dist/primitives/actions.js.map +1 -0
- package/dist/primitives/after-click.d.ts +8 -0
- package/dist/primitives/after-click.js +21 -0
- package/dist/primitives/after-click.js.map +1 -0
- package/dist/primitives/anchored.d.ts +134 -0
- package/dist/primitives/anchored.js +425 -0
- package/dist/primitives/anchored.js.map +1 -0
- package/dist/primitives/arc.d.ts +13 -0
- package/dist/primitives/arc.js +49 -0
- package/dist/primitives/arc.js.map +1 -0
- package/dist/primitives/arrow.d.ts +47 -0
- package/dist/primitives/arrow.js +159 -0
- package/dist/primitives/arrow.js.map +1 -0
- package/dist/primitives/auto-height.d.ts +56 -0
- package/dist/primitives/auto-height.js +150 -0
- package/dist/primitives/auto-height.js.map +1 -0
- package/dist/primitives/autofocus.d.ts +11 -0
- package/dist/primitives/autofocus.js +26 -0
- package/dist/primitives/autofocus.js.map +1 -0
- package/dist/primitives/availability.d.ts +32 -0
- package/dist/primitives/availability.js +122 -0
- package/dist/primitives/availability.js.map +1 -0
- package/dist/primitives/axes.d.ts +45 -0
- package/dist/primitives/axes.js +72 -0
- package/dist/primitives/axes.js.map +1 -0
- package/dist/primitives/behavior.d.ts +14 -0
- package/dist/primitives/behavior.js +19 -0
- package/dist/primitives/behavior.js.map +1 -0
- package/dist/primitives/calendar-date.d.ts +79 -0
- package/dist/primitives/calendar-date.js +135 -0
- package/dist/primitives/calendar-date.js.map +1 -0
- package/dist/primitives/composed.d.ts +144 -0
- package/dist/primitives/composed.js +303 -0
- package/dist/primitives/composed.js.map +1 -0
- package/dist/primitives/default-button.d.ts +49 -0
- package/dist/primitives/default-button.js +270 -0
- package/dist/primitives/default-button.js.map +1 -0
- package/dist/primitives/description.d.ts +18 -0
- package/dist/primitives/description.js +18 -0
- package/dist/primitives/description.js.map +1 -0
- package/dist/primitives/destination.d.ts +259 -0
- package/dist/primitives/destination.js +651 -0
- package/dist/primitives/destination.js.map +1 -0
- package/dist/primitives/direction.d.ts +23 -0
- package/dist/primitives/direction.js +90 -0
- package/dist/primitives/direction.js.map +1 -0
- package/dist/primitives/disabled-while-focused.d.ts +46 -0
- package/dist/primitives/disabled-while-focused.js +126 -0
- package/dist/primitives/disabled-while-focused.js.map +1 -0
- package/dist/primitives/disclosure.d.ts +9 -0
- package/dist/primitives/disclosure.js +15 -0
- package/dist/primitives/disclosure.js.map +1 -0
- package/dist/primitives/dismiss.d.ts +88 -0
- package/dist/primitives/dismiss.js +232 -0
- package/dist/primitives/dismiss.js.map +1 -0
- package/dist/primitives/field-frame.d.ts +166 -0
- package/dist/primitives/field-frame.js +358 -0
- package/dist/primitives/field-frame.js.map +1 -0
- package/dist/primitives/field-group-frame.d.ts +59 -0
- package/dist/primitives/field-group-frame.js +174 -0
- package/dist/primitives/field-group-frame.js.map +1 -0
- package/dist/primitives/field-trigger.d.ts +117 -0
- package/dist/primitives/field-trigger.js +387 -0
- package/dist/primitives/field-trigger.js.map +1 -0
- package/dist/primitives/field.d.ts +186 -0
- package/dist/primitives/field.js +349 -0
- package/dist/primitives/field.js.map +1 -0
- package/dist/primitives/file-format.d.ts +23 -0
- package/dist/primitives/file-format.js +185 -0
- package/dist/primitives/file-format.js.map +1 -0
- package/dist/primitives/file-item-holder.d.ts +45 -0
- package/dist/primitives/file-item-holder.js +39 -0
- package/dist/primitives/file-item-holder.js.map +1 -0
- package/dist/primitives/focus-order.d.ts +11 -0
- package/dist/primitives/focus-order.js +11 -0
- package/dist/primitives/focus-order.js.map +1 -0
- package/dist/primitives/focus-ring.d.ts +76 -0
- package/dist/primitives/focus-ring.js +230 -0
- package/dist/primitives/focus-ring.js.map +1 -0
- package/dist/primitives/follow.d.ts +65 -0
- package/dist/primitives/follow.js +283 -0
- package/dist/primitives/follow.js.map +1 -0
- package/dist/primitives/form-disabled.d.ts +20 -0
- package/dist/primitives/form-disabled.js +46 -0
- package/dist/primitives/form-disabled.js.map +1 -0
- package/dist/primitives/form-says.d.ts +33 -0
- package/dist/primitives/form-says.js +45 -0
- package/dist/primitives/form-says.js.map +1 -0
- package/dist/primitives/forward.d.ts +13 -0
- package/dist/primitives/forward.js +28 -0
- package/dist/primitives/forward.js.map +1 -0
- package/dist/primitives/glyph-mirror.d.ts +77 -0
- package/dist/primitives/glyph-mirror.js +211 -0
- package/dist/primitives/glyph-mirror.js.map +1 -0
- package/dist/primitives/glyph-pending.d.ts +17 -0
- package/dist/primitives/glyph-pending.js +91 -0
- package/dist/primitives/glyph-pending.js.map +1 -0
- package/dist/primitives/glyph.d.ts +53 -0
- package/dist/primitives/glyph.js +161 -0
- package/dist/primitives/glyph.js.map +1 -0
- package/dist/primitives/group-item.d.ts +128 -0
- package/dist/primitives/group-item.js +334 -0
- package/dist/primitives/group-item.js.map +1 -0
- package/dist/primitives/hidden.d.ts +2 -0
- package/dist/primitives/hidden.js +23 -0
- package/dist/primitives/hidden.js.map +1 -0
- package/dist/primitives/host-aria.d.ts +8 -0
- package/dist/primitives/host-aria.js +18 -0
- package/dist/primitives/host-aria.js.map +1 -0
- package/dist/primitives/index.d.ts +59 -0
- package/dist/primitives/index.js +189 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/indicator-drag.d.ts +90 -0
- package/dist/primitives/indicator-drag.js +207 -0
- package/dist/primitives/indicator-drag.js.map +1 -0
- package/dist/primitives/interactive.d.ts +13 -0
- package/dist/primitives/interactive.js +67 -0
- package/dist/primitives/interactive.js.map +1 -0
- package/dist/primitives/item-row.d.ts +34 -0
- package/dist/primitives/item-row.js +76 -0
- package/dist/primitives/item-row.js.map +1 -0
- package/dist/primitives/item-update.d.ts +2 -0
- package/dist/primitives/item-update.js +12 -0
- package/dist/primitives/item-update.js.map +1 -0
- package/dist/primitives/kept-length.d.ts +34 -0
- package/dist/primitives/kept-length.js +154 -0
- package/dist/primitives/kept-length.js.map +1 -0
- package/dist/primitives/keyboard-convention.d.ts +30 -0
- package/dist/primitives/keyboard-convention.js +88 -0
- package/dist/primitives/keyboard-convention.js.map +1 -0
- package/dist/primitives/label-lines.d.ts +12 -0
- package/dist/primitives/label-lines.js +34 -0
- package/dist/primitives/label-lines.js.map +1 -0
- package/dist/primitives/layout-scale.d.ts +18 -0
- package/dist/primitives/layout-scale.js +35 -0
- package/dist/primitives/layout-scale.js.map +1 -0
- package/dist/primitives/link.d.ts +147 -0
- package/dist/primitives/link.js +204 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/locale-date.d.ts +132 -0
- package/dist/primitives/locale-date.js +508 -0
- package/dist/primitives/locale-date.js.map +1 -0
- package/dist/primitives/missing-value.d.ts +16 -0
- package/dist/primitives/missing-value.js +31 -0
- package/dist/primitives/missing-value.js.map +1 -0
- package/dist/primitives/modal.d.ts +38 -0
- package/dist/primitives/modal.js +175 -0
- package/dist/primitives/modal.js.map +1 -0
- package/dist/primitives/native-text.d.ts +51 -0
- package/dist/primitives/native-text.js +77 -0
- package/dist/primitives/native-text.js.map +1 -0
- package/dist/primitives/natural-height.d.ts +21 -0
- package/dist/primitives/natural-height.js +36 -0
- package/dist/primitives/natural-height.js.map +1 -0
- package/dist/primitives/option-list.d.ts +314 -0
- package/dist/primitives/option-list.js +1098 -0
- package/dist/primitives/option-list.js.map +1 -0
- package/dist/primitives/overlay-focus.d.ts +48 -0
- package/dist/primitives/overlay-focus.js +152 -0
- package/dist/primitives/overlay-focus.js.map +1 -0
- package/dist/primitives/placement.d.ts +131 -0
- package/dist/primitives/placement.js +144 -0
- package/dist/primitives/placement.js.map +1 -0
- package/dist/primitives/places.d.ts +44 -0
- package/dist/primitives/places.js +98 -0
- package/dist/primitives/places.js.map +1 -0
- package/dist/primitives/press.d.ts +90 -0
- package/dist/primitives/press.js +153 -0
- package/dist/primitives/press.js.map +1 -0
- package/dist/primitives/report.d.ts +17 -0
- package/dist/primitives/report.js +34 -0
- package/dist/primitives/report.js.map +1 -0
- package/dist/primitives/ripple.d.ts +40 -0
- package/dist/primitives/ripple.js +70 -0
- package/dist/primitives/ripple.js.map +1 -0
- package/dist/primitives/roving.d.ts +41 -0
- package/dist/primitives/roving.js +71 -0
- package/dist/primitives/roving.js.map +1 -0
- package/dist/primitives/selection.d.ts +134 -0
- package/dist/primitives/selection.js +287 -0
- package/dist/primitives/selection.js.map +1 -0
- package/dist/primitives/separation.d.ts +28 -0
- package/dist/primitives/separation.js +96 -0
- package/dist/primitives/separation.js.map +1 -0
- package/dist/primitives/shared-choice.d.ts +33 -0
- package/dist/primitives/shared-choice.js +110 -0
- package/dist/primitives/shared-choice.js.map +1 -0
- package/dist/primitives/sheet.d.ts +63 -0
- package/dist/primitives/sheet.js +139 -0
- package/dist/primitives/sheet.js.map +1 -0
- package/dist/primitives/sheets.d.ts +8 -0
- package/dist/primitives/sheets.js +96 -0
- package/dist/primitives/sheets.js.map +1 -0
- package/dist/primitives/states.d.ts +33 -0
- package/dist/primitives/states.js +30 -0
- package/dist/primitives/states.js.map +1 -0
- package/dist/primitives/system-watch.d.ts +9 -0
- package/dist/primitives/system-watch.js +29 -0
- package/dist/primitives/system-watch.js.map +1 -0
- package/dist/primitives/target.d.ts +21 -0
- package/dist/primitives/target.js +79 -0
- package/dist/primitives/target.js.map +1 -0
- package/dist/primitives/values.d.ts +6 -0
- package/dist/primitives/values.js +22 -0
- package/dist/primitives/values.js.map +1 -0
- package/dist/primitives/visibility.d.ts +12 -0
- package/dist/primitives/visibility.js +50 -0
- package/dist/primitives/visibility.js.map +1 -0
- package/dist/primitives/words.d.ts +81 -0
- package/dist/primitives/words.js +236 -0
- package/dist/primitives/words.js.map +1 -0
- package/dist/prose.css +1917 -0
- package/dist/registry.d.ts +182 -0
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -0
- package/dist/shape.css +21 -0
- package/dist/skeleton.css +428 -0
- package/dist/steps.css +231 -0
- package/dist/steps.d.ts +6 -0
- package/dist/steps.js +156 -0
- package/dist/steps.js.map +1 -0
- package/dist/styles/icons.d.ts +62 -0
- package/dist/styles/icons.js +237 -0
- package/dist/styles/icons.js.map +1 -0
- package/dist/styles/product-text.d.ts +66 -0
- package/dist/styles/product-text.js +114 -0
- package/dist/styles/product-text.js.map +1 -0
- package/dist/styles/registered-properties.d.ts +6 -0
- package/dist/styles/registered-properties.js +68 -0
- package/dist/styles/registered-properties.js.map +1 -0
- package/dist/styles/shape.d.ts +59 -0
- package/dist/styles/shape.js +95 -0
- package/dist/styles/shape.js.map +1 -0
- package/dist/systems/cupertino.css +8793 -0
- package/dist/systems/m3-expressive-like.css +8786 -0
- package/dist/systems/m3-like.css +8748 -0
- package/dist/table-of-contents.css +482 -0
- package/dist/table.css +902 -0
- package/dist/tanrei.bundle.js +26644 -0
- package/dist/tanrei.bundle.js.map +7 -0
- package/dist/text.css +104 -0
- package/dist/timeline.css +410 -0
- package/dist/timeline.d.ts +6 -0
- package/dist/timeline.js +176 -0
- package/dist/timeline.js.map +1 -0
- package/dist/tokens.css +8801 -0
- package/dist/tree-view.css +797 -0
- package/dist/words.d.ts +2 -0
- package/dist/words.js +6 -0
- package/dist/words.js.map +1 -0
- package/package.json +132 -3
|
@@ -0,0 +1,1320 @@
|
|
|
1
|
+
import { ReactiveElement } from 'lit';
|
|
2
|
+
import { AvailabilityController, PendingGlyphs, PressController, SEPARATIONS, SEPARATION_VALUES, compChoice, isGlyphProbe, report, styleQueries, syncFocusStyle, } from '../../primitives/index.js';
|
|
3
|
+
import { debugBuild } from '../../primitives/report.js';
|
|
4
|
+
import { WordsController } from '../../primitives/words.js';
|
|
5
|
+
import { adopt, adoptUnlessDrawn } from '../../primitives/sheets.js';
|
|
6
|
+
const TABLE_CSS = (() => {
|
|
7
|
+
try {
|
|
8
|
+
return "@layer tanrei.components {\n:where(tanrei-table) {\n--_table-pad-block: var(--tanrei-comp-table-cell-padding-block-regular);\n--_table-pad-inline: var(--tanrei-comp-table-cell-padding-inline-regular);\n--_table-cell-font: var(--tanrei-comp-table-cell-text-typescale-regular-font);\n--_table-cell-tracking: var(--tanrei-comp-table-cell-text-typescale-regular-letter-spacing);\n--_table-cell-emphasized: var(--tanrei-comp-table-cell-text-typescale-regular-font-weight-emphasized);\n--_table-header-font: var(--tanrei-comp-table-header-text-typescale-regular-font);\n--_table-header-tracking: var(--tanrei-comp-table-header-text-typescale-regular-letter-spacing);\n--_table-header-leading: calc(var(--tanrei-comp-table-header-text-typescale-regular-line-height) * var(--tanrei-comp-table-header-text-typescale-regular-font-size));\n--_table-sort-target: var(--tanrei-sys-target-pointer);\n--_table-separation: var(--tanrei-comp-table-separation);\n--_table-line: var(--tanrei-comp-table-divider-thickness);\n--_table-line-color: var(--tanrei-comp-table-divider-color);\n--_table-column-line: 0px;\n--_table-start: left;\n--_table-end: right;\ndisplay: grid;\ngrid-template-columns: minmax(min-content, 1fr);\nbox-sizing: border-box;\ninline-size: 100%;\nmax-inline-size: 100%;\noverflow: auto;\ncontainer-type: inline-size;\nisolation: isolate;\noverflow-wrap: normal;\nword-break: normal;\ntext-indent: 0;\n}\n:where(tanrei-table[hidden]) {\ndisplay: none;\n}\n:where(tanrei-table):dir(rtl) {\n--_table-start: right;\n--_table-end: left;\n}\n:where(tanrei-table[density='compact']) {\n--_table-pad-block: var(--tanrei-comp-table-cell-padding-block-compact);\n--_table-pad-inline: var(--tanrei-comp-table-cell-padding-inline-compact);\n--_table-cell-font: var(--tanrei-comp-table-cell-text-typescale-compact-font);\n--_table-cell-tracking: var(--tanrei-comp-table-cell-text-typescale-compact-letter-spacing);\n--_table-cell-emphasized: var(--tanrei-comp-table-cell-text-typescale-compact-font-weight-emphasized);\n--_table-header-font: var(--tanrei-comp-table-header-text-typescale-compact-font);\n--_table-header-tracking: var(--tanrei-comp-table-header-text-typescale-compact-letter-spacing);\n--_table-header-leading: calc(var(--tanrei-comp-table-header-text-typescale-compact-line-height) * var(--tanrei-comp-table-header-text-typescale-compact-font-size));\n--_table-sort-target: 0px;\n}\n@media (pointer: coarse) {\n:where(tanrei-table) {\n--_table-sort-target: var(--tanrei-sys-target-touch);\n}\n}\n:where(tanrei-table[separation='divider']) {\n--_table-separation: divider;\n}\n:where(tanrei-table[separation='gap']) {\n--_table-separation: gap;\n}\n:where(tanrei-table[sticky-first-column][data-more-start]:not([data-first-column-released])) {\n--_table-column-line: var(--_table-line);\n}\n:where(tanrei-table):focus-visible {\noutline: var(--tanrei-sys-focus-outer-width) solid var(--tanrei-sys-color-focus-ring);\noutline-offset: calc((var(--tanrei-sys-focus-offset) + var(--tanrei-sys-focus-outer-width)) * -1);\n}\n:where(tanrei-table)::before,\n:where(tanrei-table)::after {\ncontent: '';\ngrid-area: 1 / 1;\nposition: sticky;\nz-index: 4;\ninline-size: 0;\nborder: 0 solid var(--_table-line-color);\npointer-events: none;\n}\n:where(tanrei-table)::before {\njustify-self: start;\ninset-inline-start: 0;\n}\n:where(tanrei-table)::after {\njustify-self: end;\ninset-inline-end: 0;\n}\n:where(tanrei-table[data-more-start]:not([sticky-first-column]))::before,\n:where(tanrei-table[data-more-start][data-first-column-released])::before {\nborder-inline-start-width: var(--_table-line);\n}\n:where(tanrei-table[data-more-end])::after {\nborder-inline-end-width: var(--_table-line);\n}\n:where(tanrei-table) > :where(table) {\n--_table-row-line: var(--_table-line);\n--_table-row-gap: 0px;\n--_table-header-line: var(--_table-line);\n--_table-last-body-line: 0px;\n--_table-last-body-gap: 0px;\n--_table-row-fill: initial;\n--_table-row-text: initial;\ngrid-area: 1 / 1;\nz-index: -1;\nbox-sizing: border-box;\nmin-inline-size: 100%;\nmargin: 0;\nborder-collapse: separate;\nborder-spacing: 0;\ntable-layout: auto;\n& > :where(caption) {\ncaption-side: top;\nposition: sticky;\ninset-inline: 0;\nbox-sizing: border-box;\nmax-inline-size: 100cqi;\nmargin: 0;\npadding: 0;\npadding-block-end: var(--tanrei-comp-table-caption-gap);\nfont: var(--tanrei-comp-table-caption-text-typescale-font);\nletter-spacing: var(--tanrei-comp-table-caption-text-typescale-letter-spacing);\ncolor: var(--tanrei-comp-table-caption-text-color);\ntext-align: var(--_table-start);\nunicode-bidi: plaintext;\n}\n& > :where(thead:not(:has(> tr > :not(:empty)))) {\ndisplay: none;\n}\n&:where(:has(> tfoot > tr)) {\n--_table-last-body-line: var(--_table-row-line);\n--_table-last-body-gap: var(--_table-row-gap);\n}\n& > :where(tfoot) > :where(tr:last-child) {\n--_table-row-line: 0px;\n--_table-row-gap: 0px;\n}\n& > :where(tbody:last-of-type) > :where(tr:last-child) {\n--_table-row-line: var(--_table-last-body-line);\n--_table-row-gap: var(--_table-last-body-gap);\n}\n& > :where(thead, tbody, tfoot) > :where(tr) > :where(th, td) {\npadding-block: var(--_table-pad-block) calc(var(--_table-pad-block) + var(--_table-row-gap) - var(--_table-row-line));\npadding-inline: var(--_table-pad-inline);\nborder: 0 solid var(--_table-line-color);\nborder-block-end-width: var(--_table-row-line);\nfont: var(--_table-cell-font);\nletter-spacing: var(--_table-cell-tracking);\nfont-variant-numeric: tabular-nums;\ncolor: var(--tanrei-comp-table-cell-text-color);\ntext-align: var(--_table-start);\nunicode-bidi: plaintext;\nvertical-align: top;\nwhite-space: normal;\n}\n& > :where(thead, tbody, tfoot) > :where(tr) > :where([data-align='center'], [align='center']) {\ntext-align: center;\n}\n& > :where(thead, tbody, tfoot) > :where(tr) > :where([data-align='end'], [align='right']) {\ntext-align: var(--_table-end);\n}\n& > :where(thead, tbody, tfoot) > :where(tr) > :where([data-wrap='false']) {\nwhite-space: nowrap;\n}\n& > :where(thead, tbody, tfoot) > :where(tr) > :where(:lang(ja), :lang(zh)) {\nline-break: strict;\n}\n& > :where(thead) > :where(tr) > :where(th, td) {\npadding-block-end: calc(var(--_table-pad-block) + var(--_table-row-gap) - var(--_table-header-line));\nborder-block-end-width: var(--_table-header-line);\nfont: var(--_table-header-font);\nletter-spacing: var(--_table-header-tracking);\nfont-variant-numeric: tabular-nums;\ncolor: var(--tanrei-comp-table-header-text-color);\nvertical-align: bottom;\nbackground-image: linear-gradient(var(--tanrei-comp-table-header-container-color), var(--tanrei-comp-table-header-container-color));\nbackground-repeat: no-repeat;\nbackground-size: 100% calc(100% - var(--_table-row-gap));\n}\n& > :where(tbody, tfoot) > :where(tr) > :where(th),\n& > :where(tfoot) > :where(tr) > :where(td) {\nfont-weight: var(--_table-cell-emphasized);\n}\n}\n:where(tanrei-table[row-headers]) > :where(table) > :where(tbody, tfoot) > :where(tr) > :where(td:first-child) {\nfont-weight: var(--_table-cell-emphasized);\n}\n:where(tanrei-table[row-headers][selection='multiple']) > :where(table) > :where(tbody, tfoot) > :where(tr) > :where([data-part='selection']:first-child) {\nfont-weight: inherit;\n}\n:where(tanrei-table[row-headers][selection='multiple']) > :where(table) > :where(tbody, tfoot) > :where(tr) > :where([data-part='selection']:first-child + td) {\nfont-weight: var(--_table-cell-emphasized);\n}\n@container style(--_table-separation: gap) {\n:where(tanrei-table) > :where(table) {\n--_table-row-line: 0px;\n--_table-row-gap: var(--tanrei-comp-table-row-gap);\n--_table-header-line: 0px;\n}\n}\n:where(tanrei-table) > :where(table[data-separation='gap']) {\n--_table-row-line: 0px;\n--_table-row-gap: var(--tanrei-comp-table-row-gap);\n--_table-header-line: 0px;\n}\n:where(tanrei-table[striped]) > :where(table) > :where(tbody) > :where(tr:nth-child(even of :not([hidden]))) > :where(th, td) {\nbackground-image: linear-gradient(var(--tanrei-comp-table-stripe-container-color), var(--tanrei-comp-table-stripe-container-color));\nbackground-repeat: no-repeat;\nbackground-size: 100% calc(100% - var(--_table-row-gap));\n}\n:where(tanrei-table:not([selection='multiple'])) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where([data-part='selection']) {\ndisplay: none;\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where([data-part='selection']) {\nbox-sizing: border-box;\ninline-size: 0;\nwhite-space: nowrap;\noverflow-y: clip;\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(thead) > :where(tr) > :where([data-part='selection']),\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tbody) > :where(tr[data-value]:not([data-value=''], [data-placeholder])) > :where([data-part='selection']) {\nblock-size: calc(var(--_table-sort-target) + var(--_table-row-gap));\n}\n@media (pointer: coarse) {\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where([data-part='selection']) {\ninline-size: var(--tanrei-sys-target-touch);\n}\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(thead, tbody) > :where(tr) > :where([data-part='selection']) > :where(tanrei-checkbox) {\ndisplay: inline-flex;\nalign-items: center;\nblock-size: 1lh;\nvertical-align: top;\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(thead, tbody) > :where(tr) > :where([data-part='selection']) > :where(input) {\nmargin: 0;\nvertical-align: middle;\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tbody) > :where(tr:not([data-value]), tr[data-value=''], tr[data-placeholder]) > :where([data-part='selection']) > :where(*),\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tfoot) > :where(tr) > :where([data-part='selection']) > :where(*) {\ndisplay: none;\n}\n:where(tanrei-table[selection='multiple'][striped]) > :where(table) > :where(tbody) > :where(tr:nth-child(even of :not([hidden]))) {\n--_table-row-fill: var(--tanrei-comp-table-stripe-container-color);\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tbody) > :where(tr[data-value]:not([data-value=''], [data-placeholder])):where([data-selected], :has(> [data-part='selection'] > input:checked)) {\n--_table-row-fill: var(--tanrei-comp-table-row-selected-container-color);\n--_table-row-text: var(--tanrei-comp-table-row-selected-text-color);\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tbody) > :where(tr) > :where(th, td) {\nbackground-image: linear-gradient(var(--_table-row-fill, transparent), var(--_table-row-fill, transparent));\nbackground-repeat: no-repeat;\nbackground-size: 100% calc(100% - var(--_table-row-gap));\ncolor: var(--_table-row-text, var(--tanrei-comp-table-cell-text-color));\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tbody) > :where(tr[data-value]:not([data-value=''], [data-placeholder])) > :where([data-part='selection']) {\ncursor: pointer;\n}\n:where(tanrei-table) > :where(table) > :where(tbody) > :where(tr[data-placeholder]) > :where(th, td) {\nbox-sizing: content-box;\nblock-size: 1lh;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) {\n--_table-sort-container: var(--tanrei-comp-table-sort-container-color);\n--_table-sort-label: var(--tanrei-comp-table-sort-label-color);\n--_table-sort-icon: var(--tanrei-comp-table-sort-icon-color);\n--_table-sort-hovered-container: var(--tanrei-comp-table-sort-hovered-container-color);\n--_table-sort-hovered-label: var(--tanrei-comp-table-sort-hovered-label-color);\n--_table-sort-hovered-icon: var(--tanrei-comp-table-sort-hovered-icon-color);\n--_table-sort-focused-container: var(--tanrei-comp-table-sort-focused-container-color);\n--_table-sort-focused-label: var(--tanrei-comp-table-sort-focused-label-color);\n--_table-sort-focused-icon: var(--tanrei-comp-table-sort-focused-icon-color);\n--_table-sort-pressed-container: var(--tanrei-comp-table-sort-pressed-container-color);\n--_table-sort-pressed-label: var(--tanrei-comp-table-sort-pressed-label-color);\n--_table-sort-pressed-icon: var(--tanrei-comp-table-sort-pressed-icon-color);\nposition: relative;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]):where([aria-sort='ascending'], [aria-sort='descending']) {\n--_table-sort-container: var(--tanrei-comp-table-sorted-container-color);\n--_table-sort-label: var(--tanrei-comp-table-sorted-label-color);\n--_table-sort-icon: var(--tanrei-comp-table-sorted-icon-color);\n--_table-sort-hovered-container: var(--tanrei-comp-table-sorted-hovered-container-color);\n--_table-sort-hovered-label: var(--tanrei-comp-table-sorted-hovered-label-color);\n--_table-sort-hovered-icon: var(--tanrei-comp-table-sorted-hovered-icon-color);\n--_table-sort-focused-container: var(--tanrei-comp-table-sorted-focused-container-color);\n--_table-sort-focused-label: var(--tanrei-comp-table-sorted-focused-label-color);\n--_table-sort-focused-icon: var(--tanrei-comp-table-sorted-focused-icon-color);\n--_table-sort-pressed-container: var(--tanrei-comp-table-sorted-pressed-container-color);\n--_table-sort-pressed-label: var(--tanrei-comp-table-sorted-pressed-label-color);\n--_table-sort-pressed-icon: var(--tanrei-comp-table-sorted-pressed-icon-color);\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]) {\n--_table-now-container: var(--_table-sort-container);\n--_table-now-label: var(--_table-sort-label);\n--_table-now-icon: var(--_table-sort-icon);\n--_table-fill: var(--_table-now-container);\ndisplay: inline-flex;\nalign-items: end;\ncolumn-gap: var(--tanrei-comp-table-header-gap);\nisolation: isolate;\nbox-sizing: border-box;\nmax-inline-size: 100%;\nmin-block-size: calc(var(--_table-sort-target) - var(--_table-pad-block) * 2);\nmargin: 0;\npadding: 0;\nborder: 0;\nborder-radius: 0;\nappearance: none;\nbackground: none;\nfont: inherit;\nletter-spacing: inherit;\nfont-variant-numeric: inherit;\ncolor: var(--_table-now-label);\ntext-align: inherit;\ntext-decoration: none;\nwhite-space: inherit;\nunicode-bidi: plaintext;\nvertical-align: bottom;\ncursor: pointer;\n-webkit-user-select: none;\nuser-select: none;\n-webkit-tap-highlight-color: transparent;\n--_table-held-image: none;\n--_table-held-clip: border-box;\ntransition:\n--_table-held-image 0s linear var(--tanrei-sys-motion-duration-press-hold),\n--_table-held-clip 0s linear var(--tanrei-sys-motion-duration-press-hold),\ncolor var(--tanrei-comp-table-motion-state-duration) var(--tanrei-comp-table-motion-state-easing),\nopacity var(--tanrei-comp-table-motion-state-duration) var(--tanrei-comp-table-motion-state-easing);\ntransition-behavior: allow-discrete;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:empty) {\ndisplay: none;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]):where([data-align='end'], [align='right']) > :where(button, a[href]) {\nflex-direction: row-reverse;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::before {\ncontent: '';\nposition: absolute;\nz-index: -1;\ninset: 0;\ninset-block-end: var(--_table-row-gap);\nbox-sizing: border-box;\nbackground-color: var(--_table-fill);\nbackground-image: var(--_table-held-image);\nbackground-clip: var(--_table-held-clip);\ntransition: background-color var(--tanrei-comp-table-motion-state-duration) var(--tanrei-comp-table-motion-state-easing);\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::after {\ncontent: 'swap_vert';\ncontent: 'swap_vert' / '';\nflex: none;\ndisplay: block;\noverflow: hidden;\ninline-size: var(--tanrei-comp-table-header-icon-size);\nblock-size: var(--tanrei-comp-table-header-icon-size);\nmargin-block-end: calc((var(--_table-header-leading) - var(--tanrei-comp-table-header-icon-size)) / 2);\nfont-family: var(--tanrei-sys-icon-family-unselected);\nfont-size: var(--tanrei-comp-table-header-icon-size);\nfont-style: normal;\nfont-weight: normal;\nline-height: 1;\nletter-spacing: normal;\ntext-transform: none;\nwhite-space: nowrap;\nword-wrap: normal;\ndirection: ltr;\ncolor: var(--_table-now-icon);\npointer-events: none;\nfont-feature-settings: 'liga';\n-webkit-font-smoothing: antialiased;\nfont-optical-sizing: auto;\nfont-variation-settings: 'FILL' var(--tanrei-sys-icon-fill-unselected), 'wght' var(--tanrei-comp-table-header-icon-weight), 'GRAD' 0;\nopacity: var(--tanrei-icons, 0);\ntransition: color var(--tanrei-comp-table-motion-state-duration) var(--tanrei-comp-table-motion-state-easing);\n}\n@supports (font-variation-settings: 'opsz' tan(atan2(1em, 1px))) {\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::after {\nfont-variation-settings: 'FILL' var(--tanrei-sys-icon-fill-unselected), 'wght' var(--tanrei-comp-table-header-icon-weight), 'GRAD' 0, 'opsz' clamp(var(--tanrei-sys-icon-optical-size-min), tan(atan2(var(--tanrei-comp-table-header-icon-size), 1px)), var(--tanrei-sys-icon-optical-size-max));\n}\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]):where([aria-sort='ascending']) > :where(button, a[href])::after {\ncontent: 'arrow_upward';\ncontent: 'arrow_upward' / '';\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]):where([aria-sort='descending']) > :where(button, a[href])::after {\ncontent: 'arrow_downward';\ncontent: 'arrow_downward' / '';\n}\n:where(tanrei-table[data-glyphs='pending']) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::after {\nvisibility: hidden;\n}\n@media (hover: hover) {\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:hover) {\n--_table-now-container: var(--_table-sort-hovered-container);\n--_table-now-label: var(--_table-sort-hovered-label);\n--_table-now-icon: var(--_table-sort-hovered-icon);\nopacity: var(--tanrei-comp-table-hovered-opacity);\n}\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:focus-visible) {\n--_table-now-container: var(--_table-sort-focused-container);\n--_table-now-label: var(--_table-sort-focused-label);\n--_table-now-icon: var(--_table-sort-focused-icon);\nopacity: var(--tanrei-comp-table-focused-opacity);\noutline: none;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:focus-visible)::before {\nborder: var(--tanrei-sys-focus-offset) solid transparent;\noutline: var(--tanrei-sys-focus-outer-width) solid var(--tanrei-sys-color-focus-ring);\noutline-offset: calc((var(--tanrei-sys-focus-offset) + var(--tanrei-sys-focus-outer-width)) * -1);\nbox-shadow: inset 0 0 0 calc(var(--tanrei-sys-focus-outer-width) + var(--tanrei-sys-focus-inner-width)) var(--tanrei-sys-color-focus-ring-inner);\n}\n@container style(--tanrei-sys-behavior-focus-style: glow) {\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:focus-visible)::before {\n--_table-glow: calc((var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) * 2);\ninset: var(--_table-glow);\ninset-block-end: calc(var(--_table-glow) + var(--_table-row-gap));\nborder: 0;\noutline-color: transparent;\nbox-shadow:\n0 0 var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-color-focus-ring-inner),\n0 0 var(--tanrei-sys-focus-outer-width) calc(var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) var(--tanrei-sys-color-focus-ring),\n0 0 0 var(--_table-glow) var(--_table-fill);\n}\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where([data-focus-style='glow']:focus-visible)::before {\n--_table-glow: calc((var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) * 2);\ninset: var(--_table-glow);\ninset-block-end: calc(var(--_table-glow) + var(--_table-row-gap));\nborder: 0;\noutline-color: transparent;\nbox-shadow:\n0 0 var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-color-focus-ring-inner),\n0 0 var(--tanrei-sys-focus-outer-width) calc(var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) var(--tanrei-sys-color-focus-ring),\n0 0 0 var(--_table-glow) var(--_table-fill);\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:active:not([data-pressed])) {\n--_table-held-image: linear-gradient(var(--_table-sort-pressed-container), var(--_table-sort-pressed-container)), none;\n--_table-held-clip: border-box, text;\n--_table-now-label: var(--_table-sort-pressed-label);\n--_table-now-icon: var(--_table-sort-pressed-icon);\nopacity: var(--tanrei-comp-table-pressed-opacity);\ntransition-duration: 0s;\ntransition-delay: 0s;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where([data-pressed]:not([data-pressed='none'])),\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where([data-pressed]:not([data-pressed='none']))::before,\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where([data-pressed]:not([data-pressed='none']))::after {\ntransition-duration: 0s;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where([data-pressed='overlay']) {\n--_table-now-container: var(--_table-sort-pressed-container);\n--_table-now-label: var(--_table-sort-pressed-label);\n--_table-now-icon: var(--_table-sort-pressed-icon);\nopacity: var(--tanrei-comp-table-pressed-opacity);\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where([data-pressed='ripple'], [data-pressed='dim']) {\n--_table-now-label: var(--_table-sort-pressed-label);\n--_table-now-icon: var(--_table-sort-pressed-icon);\nopacity: var(--tanrei-comp-table-pressed-opacity);\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]) > :where(.ripple) {\nposition: absolute;\nz-index: -1;\ninset: 0;\ninset-block-end: var(--_table-row-gap);\nbackground: var(--_table-sort-pressed-container);\npointer-events: none;\nclip-path: circle(var(--_r) at var(--_x) var(--_y));\nanimation: tanrei-table-ripple var(--tanrei-comp-table-motion-feedback-duration) var(--tanrei-comp-table-motion-state-easing) both;\ntransition: opacity var(--tanrei-comp-table-motion-state-duration) var(--tanrei-comp-table-motion-state-easing);\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]) > :where(.ripple.leaving) {\nopacity: 0;\n}\n@keyframes tanrei-table-ripple {\nfrom {\nclip-path: circle(0 at var(--_x) var(--_y));\n}\n}\n@media (prefers-reduced-motion: reduce) {\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]) {\ntransition:\n--_table-held-image 0s linear var(--tanrei-sys-motion-duration-press-hold),\n--_table-held-clip 0s linear var(--tanrei-sys-motion-duration-press-hold);\ntransition-behavior: allow-discrete;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::before,\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::after {\ntransition: none;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]) > :where(.ripple) {\nanimation: none;\ntransition: none;\n}\n}\n:where(tanrei-table) > :where(table) > :where(tbody) > :where(tr[data-part='empty']) > :where(th, td) {\npadding-block: var(--tanrei-comp-table-empty-padding-block) calc(var(--tanrei-comp-table-empty-padding-block) + var(--_table-row-gap) - var(--_table-row-line));\nbackground-image: none;\n}\n:where(tanrei-table) > :where(table) > :where(tbody) > :where(tr[data-part='empty']) > :where(th, td) > :where(*) {\nposition: sticky;\ninset-inline-start: var(--_table-pad-inline);\nbox-sizing: border-box;\nmax-inline-size: calc(100cqi - var(--_table-pad-inline) * 2);\n}\n:where(tanrei-table) > :where(table) > :where(tbody) > :where(tr[data-part='empty']:not(:nth-child(1 of :not([data-placeholder])):nth-last-child(1 of :not([data-placeholder])))) {\ndisplay: none;\n}\n:where(tanrei-table[loading]) > :where(table) > :where(tbody) > :where(tr[data-part='empty']),\n:where(tanrei-table) > :where(table[aria-busy='true']) > :where(tbody) > :where(tr[data-part='empty']) {\ndisplay: none;\n}\n:where(tanrei-table) > :where([data-part='status']) {\n--_table-status-line: var(--_table-line);\ngrid-area: 2 / 1;\njustify-self: start;\nposition: sticky;\nz-index: -1;\ninset-inline-start: 0;\ninset-block-end: 0;\ndisplay: flex;\nflex-wrap: wrap;\nalign-items: center;\njustify-content: space-between;\ngap: var(--tanrei-comp-table-status-gap);\nbox-sizing: border-box;\ninline-size: 100cqi;\nmargin: 0;\npadding-block: calc(var(--tanrei-comp-table-status-padding-block) - var(--_table-status-line)) var(--tanrei-comp-table-status-padding-block);\npadding-inline: var(--_table-pad-inline);\nborder: 0 solid var(--_table-line-color);\nborder-block-start-width: var(--_table-status-line);\nbackground-color: var(--tanrei-comp-table-sticky-container-color);\nfont: var(--tanrei-comp-table-status-text-typescale-font);\nletter-spacing: var(--tanrei-comp-table-status-text-typescale-letter-spacing);\ncolor: var(--tanrei-comp-table-status-text-color);\ntext-align: var(--_table-start);\n}\n@container style(--_table-separation: gap) {\n:where(tanrei-table) > :where([data-part='status']) {\n--_table-status-line: 0px;\n}\n}\n:where(tanrei-table) > :where(table[data-separation='gap']) ~ :where([data-part='status']) {\n--_table-status-line: 0px;\n}\n:where(tanrei-table[data-more-below]) > :where([data-part='status']) {\n--_table-status-line: var(--_table-line);\n}\n:where(tanrei-table) > :where([data-part='status']:not(:has(> :not(:empty)))) {\npadding-block: 0;\nborder-block-start-width: 0;\n}\n:where(tanrei-table) > :where([data-part='status']) > :where([role='status']) {\nmin-inline-size: 0;\nmargin: 0;\npadding: 0;\nfont: inherit;\nletter-spacing: inherit;\ncolor: inherit;\noverflow-wrap: break-word;\nunicode-bidi: plaintext;\n}\n:where(tanrei-table) > :where([data-part='status']) > :where(:only-child:not([role='status'])) {\nmargin-inline-start: auto;\n}\n:where(tanrei-table[sticky-header]) > :where(table) > :where(thead) > :where(tr) > :where(th, td) {\nposition: sticky;\ninset-block-start: 0;\nz-index: 2;\nbackground-color: var(--tanrei-comp-table-sticky-container-color);\n}\n:where(tanrei-table[sticky-header][data-more-above]) > :where(table) {\n--_table-header-line: var(--_table-line);\n}\n:where(tanrei-table[sticky-first-column]:not([data-first-column-released])) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where(:first-child) {\nposition: sticky;\ninset-inline-start: 0;\nz-index: 1;\npadding-inline-end: calc(var(--_table-pad-inline) - var(--_table-column-line));\nborder-inline-end-width: var(--_table-column-line);\nbackground-color: var(--tanrei-comp-table-sticky-container-color);\n}\n:where(tanrei-table[sticky-first-column]:not([data-first-column-released])) > :where(table) > :where(thead) > :where(tr) > :where(:first-child) {\nz-index: 3;\n}\n:where(tanrei-table[sticky-first-column]:not([data-first-column-released])) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where([data-part='selection']:first-child) {\npadding-inline-end: var(--_table-pad-inline);\nborder-inline-end-width: 0;\n}\n:where(tanrei-table[sticky-first-column]:not([data-first-column-released], [data-selection-kept])) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where([data-part='selection']:first-child) {\nposition: static;\nbackground-color: transparent;\n}\n:where(tanrei-table[sticky-first-column]:not([data-first-column-released])) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where([data-part='selection']:first-child + *) {\nposition: sticky;\ninset-inline-start: var(--_table-selection-size, 0px);\nz-index: 1;\npadding-inline-end: calc(var(--_table-pad-inline) - var(--_table-column-line));\nborder-inline-end-width: var(--_table-column-line);\nbackground-color: var(--tanrei-comp-table-sticky-container-color);\n}\n:where(tanrei-table[sticky-first-column]:not([data-first-column-released])) > :where(table) > :where(thead) > :where(tr) > :where([data-part='selection']:first-child + *) {\nz-index: 3;\n}\n@media (forced-colors: active) {\n:where(tanrei-table) {\n--_table-line-color: CanvasText;\n}\n:where(tanrei-table):focus-visible {\noutline-color: Highlight;\n}\n:where(tanrei-table[striped]) > :where(table) {\n--_table-row-line: var(--_table-line);\n--_table-header-line: var(--_table-line);\n}\n:where(tanrei-table[selection='multiple']) > :where(table) > :where(tbody) > :where(tr) > :where(th, td) {\nbackground-image: none;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]),\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::after {\ncolor: ButtonText;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href]):where(:focus-visible)::before {\ninset: 0;\ninset-block-end: var(--_table-row-gap);\nborder: 0;\noutline-color: Highlight;\nbox-shadow: none;\n}\n:where(tanrei-table) > :where(table) > :where(thead) > :where(tr) > :where(th[aria-sort]) > :where(button, a[href])::before {\nbackground-image: none;\nbackground-clip: border-box;\n}\n}\n}";
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
})();
|
|
14
|
+
const TAG = 'tanrei-table';
|
|
15
|
+
const PREFIX = '--tanrei-comp-table';
|
|
16
|
+
const CORE_DENSITIES = ['regular', 'compact'];
|
|
17
|
+
const DEFAULT_DENSITY = 'regular';
|
|
18
|
+
/** The members of the density axis (`dev.tanrei.axes.density.members`) as table.css names them. */
|
|
19
|
+
const DENSITY_MEMBERS = [
|
|
20
|
+
['--_table-pad-block', 'cell-padding-block-*'],
|
|
21
|
+
['--_table-pad-inline', 'cell-padding-inline-*'],
|
|
22
|
+
['--_table-cell-font', 'cell-text-typescale-*-font'],
|
|
23
|
+
['--_table-cell-tracking', 'cell-text-typescale-*-letter-spacing'],
|
|
24
|
+
['--_table-cell-emphasized', 'cell-text-typescale-*-font-weight-emphasized'],
|
|
25
|
+
['--_table-header-font', 'header-text-typescale-*-font'],
|
|
26
|
+
['--_table-header-tracking', 'header-text-typescale-*-letter-spacing'],
|
|
27
|
+
];
|
|
28
|
+
/** The height of a line of a header's label at a density a design system added: its two tokens, multiplied (table.css). */
|
|
29
|
+
const DENSITY_LEADING = (density) => `--_table-header-leading: calc(var(${PREFIX}-header-text-typescale-${density}-line-height, var(${PREFIX}-header-text-typescale-${DEFAULT_DENSITY}-line-height)) * var(${PREFIX}-header-text-typescale-${density}-font-size, var(${PREFIX}-header-text-typescale-${DEFAULT_DENSITY}-font-size)));`;
|
|
30
|
+
/** The control of a sortable column's header, from anything inside it (TBL-32): the product's button, or its anchor. */
|
|
31
|
+
const SORT_CONTROL = 'th[aria-sort] > button, th[aria-sort] > a[href]';
|
|
32
|
+
/** The same, from its header cell. */
|
|
33
|
+
const OWN_CONTROL = ':scope > button, :scope > a[href]';
|
|
34
|
+
/** What this element, or a primitive it uses, puts into the table for a moment: a ripple's layer, the box a glyph is measured in. Its coming and going is no change of the table. */
|
|
35
|
+
const passing = (node) => isGlyphProbe(node) || (node instanceof Element && node.classList.contains('ripple'));
|
|
36
|
+
const passes = (record) => record.type === 'childList' && [...record.addedNodes, ...record.removedNodes].every(passing);
|
|
37
|
+
/** The glyph whose drawing says that the icon set can draw a sort mark (TBL-56). */
|
|
38
|
+
const SORT_GLYPH = 'swap_vert';
|
|
39
|
+
/** Attribute values are interpolated into CSS: only token-name characters are accepted. */
|
|
40
|
+
const KEY = /^[a-z0-9][a-z0-9-]*$/;
|
|
41
|
+
/** The sections of a table and their rows, as table.css reaches them. */
|
|
42
|
+
const ROWS = ':where(tanrei-table) > :where(table) > :where(thead, tbody, tfoot) > :where(tr)';
|
|
43
|
+
/** What the observer re-reads the table for, besides its children. */
|
|
44
|
+
const ATTRIBUTES = ['data-align', 'data-wrap', 'align', 'colspan', 'id', 'aria-label', 'aria-labelledby', 'aria-sort', 'data-part', 'data-value', 'data-selected', 'data-placeholder'];
|
|
45
|
+
/** The cell that holds a row's checkbox (TBL-42), and the checkbox in it: Tanrei's, or the browser's own. */
|
|
46
|
+
const SELECTION_CELL = '[data-part="selection"]';
|
|
47
|
+
const CHECKBOX = ':scope > tanrei-checkbox, :scope > input[type="checkbox"]';
|
|
48
|
+
const isNative = (box) => box.localName === 'input';
|
|
49
|
+
/** Whether a checkbox is checked: its property, or — for an element that is not defined yet — its attribute. */
|
|
50
|
+
const checkedOf = (box) => box.checked ?? box.hasAttribute('checked');
|
|
51
|
+
/** A Markdown renderer's `align`, read by the layout direction: left and right are start and end. */
|
|
52
|
+
const RENDERED_ALIGN = { left: 'start', center: 'center', right: 'end' };
|
|
53
|
+
/** A scroll offset, or what is left to scroll, below this is none: boxes are laid out on fractions of a pixel. */
|
|
54
|
+
const SLACK = 1;
|
|
55
|
+
/** TBL-36: for how long after keyboard focus came to a sort button a scroll is taken for the engine's own, in ms. */
|
|
56
|
+
const REVEAL_AGAIN = 250;
|
|
57
|
+
const sheets = new Map();
|
|
58
|
+
/** A stylesheet of the page, made once and shared by every root that needs it. */
|
|
59
|
+
function sheet(id, text) {
|
|
60
|
+
if (typeof CSSStyleSheet === 'undefined')
|
|
61
|
+
return null;
|
|
62
|
+
let made = sheets.get(id);
|
|
63
|
+
if (!made) {
|
|
64
|
+
made = new CSSStyleSheet();
|
|
65
|
+
try {
|
|
66
|
+
made.replaceSync(text());
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// A browser that cannot construct it: the page's own copy of table.css draws the table.
|
|
70
|
+
}
|
|
71
|
+
sheets.set(id, made);
|
|
72
|
+
}
|
|
73
|
+
return made;
|
|
74
|
+
}
|
|
75
|
+
// The rules the element writes — a density a design system added, a column's alignment by position, the surplus cells
|
|
76
|
+
// — are in NO cascade layer: a page may load a copy of table.css into a layer of its own that comes after
|
|
77
|
+
// `tanrei.components` (a site whose framework's reset is layered does), and a later layer wins whatever the order of
|
|
78
|
+
// the rules, so the copy's `text-align: start` on every cell would undo a column's alignment. They keep no
|
|
79
|
+
// specificity, so one class of the product's, outside any layer, still wins. (The description list and the figure
|
|
80
|
+
// write theirs the same way.) Each names the cells it styles (`th, td`), so that an engine restyles the cells when the
|
|
81
|
+
// wrapper's attribute changes, not everything inside them.
|
|
82
|
+
/** TBL-31: a density a design system added — the default's rules, read from that density's tokens. */
|
|
83
|
+
const densityRules = (density) => `:where(${TAG}[density='${density}']) { ${DENSITY_MEMBERS.map(([name, token]) => `${name}: var(${PREFIX}-${token.replace('*', density)}, var(${PREFIX}-${token.replace('*', DEFAULT_DENSITY)}));`).join(' ')} ${DENSITY_LEADING(density)} }`;
|
|
84
|
+
/**
|
|
85
|
+
* The rules of one column position (TBL-3, TBL-7): its cells take the alignment and the wrapping the column's header
|
|
86
|
+
* cell names — which the element writes on the wrapper as lists of positions — unless a cell names its own.
|
|
87
|
+
*/
|
|
88
|
+
const columnRules = (position) => [
|
|
89
|
+
`:where(${TAG}[data-columns-center~='${position}']) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where(th, td):where(:nth-child(${position}):not([data-align], [align])) { text-align: center; }`,
|
|
90
|
+
`:where(${TAG}[data-columns-end~='${position}']) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where(th, td):where(:nth-child(${position}):not([data-align], [align])) { text-align: var(--_table-end); }`,
|
|
91
|
+
`:where(${TAG}[data-columns-nowrap~='${position}']) > :where(table) > :where(thead, tbody, tfoot) > :where(tr) > :where(th, td):where(:nth-child(${position}):not([data-wrap])) { white-space: nowrap; }`,
|
|
92
|
+
];
|
|
93
|
+
/** TBL-14: a row draws only as many cells as the table has columns. */
|
|
94
|
+
const surplusRule = (columns) => `${ROWS.replace(TAG, `${TAG}[data-columns='${columns}']`)} > :where(th, td):where(:nth-child(n + ${columns + 1})) { display: none; }`;
|
|
95
|
+
/** The sheet of the rules by position: one per page, grown as tables need a position it does not have yet. */
|
|
96
|
+
const positions = { columns: 0, surplus: new Set() };
|
|
97
|
+
function positionSheet(columns, count) {
|
|
98
|
+
const made = sheet('positions', () => '');
|
|
99
|
+
if (!made)
|
|
100
|
+
return null;
|
|
101
|
+
try {
|
|
102
|
+
for (; positions.columns < columns; positions.columns++)
|
|
103
|
+
for (const rule of columnRules(positions.columns + 1))
|
|
104
|
+
made.insertRule(rule, made.cssRules.length);
|
|
105
|
+
if (count > 0 && !positions.surplus.has(count)) {
|
|
106
|
+
made.insertRule(surplusRule(count), made.cssRules.length);
|
|
107
|
+
positions.surplus.add(count);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// A browser that cannot read a rule draws every cell at the start, as a page without the script does.
|
|
112
|
+
}
|
|
113
|
+
return made;
|
|
114
|
+
}
|
|
115
|
+
let captions = 0;
|
|
116
|
+
/**
|
|
117
|
+
* TBL-26: nothing tells a script that the layout direction it inherits changed, and no engine agrees on what becomes
|
|
118
|
+
* of a scroll offset when it does. The direction comes from a `dir` on an ancestor, so each root a table
|
|
119
|
+
* is in — the document, and every shadow root between it and the document — is watched for that one attribute, by one
|
|
120
|
+
* observer for all its tables.
|
|
121
|
+
*/
|
|
122
|
+
const turns = new Map();
|
|
123
|
+
function rootsOf(element) {
|
|
124
|
+
const roots = [];
|
|
125
|
+
for (let root = element.getRootNode();;) {
|
|
126
|
+
roots.push(root);
|
|
127
|
+
if (!(root instanceof ShadowRoot))
|
|
128
|
+
break;
|
|
129
|
+
root = root.host.getRootNode();
|
|
130
|
+
}
|
|
131
|
+
return roots;
|
|
132
|
+
}
|
|
133
|
+
function watchTurns(table, roots) {
|
|
134
|
+
if (typeof MutationObserver === 'undefined')
|
|
135
|
+
return;
|
|
136
|
+
for (const root of roots) {
|
|
137
|
+
let watch = turns.get(root);
|
|
138
|
+
if (!watch) {
|
|
139
|
+
const tables = new Set();
|
|
140
|
+
const observer = new MutationObserver(() => {
|
|
141
|
+
for (const each of tables)
|
|
142
|
+
each.turned();
|
|
143
|
+
});
|
|
144
|
+
observer.observe(root, { attributes: true, attributeFilter: ['dir'], subtree: true });
|
|
145
|
+
turns.set(root, (watch = { observer, tables }));
|
|
146
|
+
}
|
|
147
|
+
watch.tables.add(table);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function unwatchTurns(table, roots) {
|
|
151
|
+
for (const root of roots) {
|
|
152
|
+
const watch = turns.get(root);
|
|
153
|
+
if (!watch)
|
|
154
|
+
continue;
|
|
155
|
+
watch.tables.delete(table);
|
|
156
|
+
if (!watch.tables.size) {
|
|
157
|
+
watch.observer.disconnect();
|
|
158
|
+
turns.delete(root);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* What the sizes say is read for every table at once and written for every table after (TBL-19 to TBL-22). A table
|
|
164
|
+
* that measured as soon as it had written made the browser style and lay out the page once per table — and, with the
|
|
165
|
+
* rules by position added to the page's sheet in between, restyle every cell of every table each time: a page of
|
|
166
|
+
* forty tables, forty times. So a table that has written asks for a measure, and the one that asks first starts it:
|
|
167
|
+
* it runs as a microtask, which is after every table that is updated in the same task has written — elements that
|
|
168
|
+
* are defined together, or parsed together, are — and before anything waiting for one of them (`updateComplete`).
|
|
169
|
+
* One observer of sizes serves every table, for the same reason: its entries arrive together.
|
|
170
|
+
*/
|
|
171
|
+
const unmeasured = new Set();
|
|
172
|
+
function measureAll(tables) {
|
|
173
|
+
const read = [...tables].filter((table) => table.isConnected).map((table) => [table, table.sizes()]);
|
|
174
|
+
for (const [table, sizes] of read)
|
|
175
|
+
table.sized(sizes);
|
|
176
|
+
}
|
|
177
|
+
function measureSoon(table) {
|
|
178
|
+
if (!unmeasured.size) {
|
|
179
|
+
queueMicrotask(() => {
|
|
180
|
+
const all = [...unmeasured];
|
|
181
|
+
unmeasured.clear();
|
|
182
|
+
measureAll(all);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
unmeasured.add(table);
|
|
186
|
+
}
|
|
187
|
+
const observed = new WeakMap();
|
|
188
|
+
const resizes = typeof ResizeObserver === 'undefined'
|
|
189
|
+
? null
|
|
190
|
+
: new ResizeObserver((entries) => {
|
|
191
|
+
measureAll(new Set(entries.map((entry) => observed.get(entry.target)).filter((table) => !!table)));
|
|
192
|
+
});
|
|
193
|
+
function observeSize(element, table) {
|
|
194
|
+
observed.set(element, table);
|
|
195
|
+
resizes?.observe(element);
|
|
196
|
+
}
|
|
197
|
+
function unobserveSize(element) {
|
|
198
|
+
observed.delete(element);
|
|
199
|
+
resizes?.unobserve(element);
|
|
200
|
+
}
|
|
201
|
+
const list = (positions) => positions.join(' ');
|
|
202
|
+
/** Writes an attribute only when it differs: what is written here is observed, and must settle. */
|
|
203
|
+
function mark(element, name, value) {
|
|
204
|
+
if (value === null) {
|
|
205
|
+
if (element.hasAttribute(name))
|
|
206
|
+
element.removeAttribute(name);
|
|
207
|
+
}
|
|
208
|
+
else if (element.getAttribute(name) !== value)
|
|
209
|
+
element.setAttribute(name, value);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Presents data that has rows and columns, with named columns, optional row headers, a caption and footer rows.
|
|
213
|
+
* A price list, a comparison, a list of settings, a status of many things. It scrolls in its own box when it does not
|
|
214
|
+
* fit. A column's header can ask for the rows in its order (`sort`); the table itself never sorts, filters, fetches or
|
|
215
|
+
* pages: it draws the rows it is given, in the order it is given them.
|
|
216
|
+
*
|
|
217
|
+
* Contract: specs/table.spec.json. The element has **no shadow root**: it is the scroll box around the product's own
|
|
218
|
+
* native table, which stays in the document and is never given another `display` — its semantics, a crawler's reading,
|
|
219
|
+
* copy and paste as a table and a screen reader's table navigation are the browser's own.
|
|
220
|
+
*
|
|
221
|
+
* ```html
|
|
222
|
+
* <tanrei-table density="compact" row-headers sticky-first-column>
|
|
223
|
+
* <table>
|
|
224
|
+
* <caption>Visits by region</caption>
|
|
225
|
+
* <thead><tr><th scope="col">Region</th><th scope="col" data-align="end" data-wrap="false">January</th></tr></thead>
|
|
226
|
+
* <tbody><tr><th scope="row">Islands</th><td>212</td></tr></tbody>
|
|
227
|
+
* <tfoot><tr><th scope="row">All regions</th><td>6,846</td></tr></tfoot>
|
|
228
|
+
* </table>
|
|
229
|
+
* </tanrei-table>
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* A column is a `<th scope="col">` of the `<thead>` row: its text is the header, `data-align="start | center | end"`
|
|
233
|
+
* says where the column's cells sit and `data-wrap="false"` keeps them on one line. A row is a `<tr>`; a footer row is
|
|
234
|
+
* a `<tr>` in `<tfoot>`. A cell is a `<td>`, or a `<th scope="row">` for the header of its row, and holds text, any
|
|
235
|
+
* view of the product's, or nothing. A cell may name its own `data-align` and `data-wrap`; a Markdown renderer's
|
|
236
|
+
* `align` is read as well (left and right as start and end).
|
|
237
|
+
*
|
|
238
|
+
* Everything drawn is `@tanrei/web/table.css` — every value a `--tanrei-comp-table-*` token — which draws the table
|
|
239
|
+
* before and without this script; the element adds the same sheet to the root it is connected to, so it also works
|
|
240
|
+
* inside another component's shadow root. The script adds what a stylesheet cannot: while the box scrolls it is a
|
|
241
|
+
* focus stop and a region with the table's name (`tabindex`, `role`, `aria-labelledby` or `aria-label`), and the
|
|
242
|
+
* arrow keys, Page Up, Page Down, Home and End scroll it as the browser scrolls a region; a hairline along an inline
|
|
243
|
+
* edge of the box says that columns lie beyond it; a column's alignment reaches its cells; a first column that is kept
|
|
244
|
+
* in view lets go where it would take more than half of the box.
|
|
245
|
+
*
|
|
246
|
+
* A column that can be sorted: its header cell says the order the rows are in — `aria-sort="none"`, `"ascending"` or
|
|
247
|
+
* `"descending"` — and holds the product's own `<button type="button">` around the header's text; `data-value` on the
|
|
248
|
+
* cell is the name the event carries. The stylesheet makes the whole cell the button and draws the mark from the
|
|
249
|
+
* attribute. A press emits `sort` with the direction asked for and changes nothing: the product orders its rows and
|
|
250
|
+
* writes `aria-sort`. A table ordered by the server holds an `<a href>` to the same table in the other order in place of
|
|
251
|
+
* the button; it works without script, and `sort` is then cancelable.
|
|
252
|
+
*
|
|
253
|
+
* ```html
|
|
254
|
+
* <th scope="col" aria-sort="ascending" data-value="name"><button type="button">Name</button></th>
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* No rows: `<tbody><tr data-part="empty"><td colspan="3">…</td></tr></tbody>`, holding the product's Empty state (or
|
|
258
|
+
* its sentence, in an element). The status line: `<div data-part="status"><p role="status">1–20 of 132</p>…</div>`
|
|
259
|
+
* after the table, inside the element, holding the product's sentence and its pagination; the `status` attribute is a
|
|
260
|
+
* convenience that writes the paragraph.
|
|
261
|
+
*
|
|
262
|
+
* Rows that can be chosen: `selection="multiple"`, and a first cell `<td data-part="selection">` in every row — in the
|
|
263
|
+
* header row holding the checkbox for every row, in a body row that has a `data-value` holding that row's checkbox
|
|
264
|
+
* (`<tanrei-checkbox label-hidden label="Select Kettle">`, or a native `<input type="checkbox" aria-label="…">`), and
|
|
265
|
+
* empty in a footer row, a placeholder row and a row that cannot be chosen. A chosen row carries `data-selected`. The
|
|
266
|
+
* table holds the selection: a change of a checkbox writes `data-selected` on its row and emits `selectionchange`
|
|
267
|
+
* with the values of the chosen rows; the product writes `data-selected` to choose a row itself, and nothing is
|
|
268
|
+
* emitted for it. The header's checkbox is kept checked, mixed or unchecked, disabled with no row to choose, and named
|
|
269
|
+
* by `select-all-label` or the product's words (`selectAllLabel`). A row's checkbox that has no name of its own is
|
|
270
|
+
* named by the row's header cell. The table stays a table: no grid, no selected state on a row.
|
|
271
|
+
*
|
|
272
|
+
* ```html
|
|
273
|
+
* <tanrei-table selection="multiple" row-headers select-all-label="Select all products">
|
|
274
|
+
* <table>
|
|
275
|
+
* <thead><tr><td data-part="selection"><tanrei-checkbox label-hidden></tanrei-checkbox></td><th scope="col">Name</th></tr></thead>
|
|
276
|
+
* <tbody><tr data-value="kettle" data-selected>
|
|
277
|
+
* <td data-part="selection"><tanrei-checkbox label-hidden checked></tanrei-checkbox></td><th scope="row">Kettle</th>
|
|
278
|
+
* </tr></tbody>
|
|
279
|
+
* </table>
|
|
280
|
+
* </tanrei-table>
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* Loading: `loading` says that the product is fetching rows. The table is exposed as busy (`aria-busy` on the table)
|
|
284
|
+
* and draws what it is given — the rows it had, or rows `<tr data-placeholder aria-hidden="true">` whose cells are empty
|
|
285
|
+
* or hold a Skeleton's placeholder (`<span class="tanrei-skeleton-placeholder"></span>`). Nothing is dimmed or disabled.
|
|
286
|
+
*
|
|
287
|
+
* Without a sortable column and with `selection` none the table takes no input and emits no event.
|
|
288
|
+
*
|
|
289
|
+
* A table inside a cell is the product's content and is not drawn by this one. Cells that span (`colspan`, `rowspan`)
|
|
290
|
+
* and a second header row work as HTML does and take the same cell styles.
|
|
291
|
+
*
|
|
292
|
+
* @tag tanrei-table
|
|
293
|
+
* @fires sort - The user pressed the header of a sortable column. `detail`: `{ column, index, direction }` — the header cell's `data-value`, its place among the columns of data (from 0) and the direction asked for (`ascending`, or `descending` where the rows ascend by it). The table changes nothing. Cancelable where the control is an anchor: cancelled, the link is not followed.
|
|
294
|
+
* @fires selectionchange - The user changed which rows are chosen, by a row's checkbox or by the header's. `detail`: `{ values }` — the `data-value` of every chosen row after the change, in row order. Not emitted for what the product writes.
|
|
295
|
+
* @slot - The native `<table>`: an optional `<caption>`, a `<thead>` of one row of `<th scope="col">`, one or more `<tbody>`, an optional `<tfoot>`. It is a child in the document, not a slotted node: the element has no shadow root.
|
|
296
|
+
* @cssprop --tanrei-comp-table-sticky-container-color - The fill of a header row and a first column that are kept in view: the color of the surface the table sits on. Set it on a table inside a card, a dialog or a sheet.
|
|
297
|
+
*/
|
|
298
|
+
export class TanreiTable extends ReactiveElement {
|
|
299
|
+
constructor() {
|
|
300
|
+
super(...arguments);
|
|
301
|
+
this.availability = new AvailabilityController(this, 'table');
|
|
302
|
+
/** The product's words, read where the instance gives none (src/primitives/words.ts). */
|
|
303
|
+
this.words = new WordsController(this);
|
|
304
|
+
/**
|
|
305
|
+
* The name of the table, drawn above it ("Response times by region"); it is also what assistive technology calls the
|
|
306
|
+
* table and its scroll region. A convenience that writes the table's `<caption>`: a `<caption>` written in the
|
|
307
|
+
* markup is the same thing, and is drawn before the element is defined.
|
|
308
|
+
*/
|
|
309
|
+
this.caption = '';
|
|
310
|
+
/** The table's accessible name where no caption is drawn, because a heading just above it already says what it is. Not drawn; ignored where the table has a caption. */
|
|
311
|
+
this.label = '';
|
|
312
|
+
/** How close the rows are: regular for a table a person reads, compact for one a person scans. A design system may add values. */
|
|
313
|
+
this.density = 'regular';
|
|
314
|
+
/** How a row is told from the row next to it: `divider` is one hairline, `gap` empty space and no line; `auto` takes `comp.table.separation`, the design system's answer. */
|
|
315
|
+
this.separation = 'auto';
|
|
316
|
+
/** Fills every second body row with a quiet color, for a wide table of many similar rows. */
|
|
317
|
+
this.striped = false;
|
|
318
|
+
/** Says that the first column names its rows. Write those cells as `<th scope="row">`; where the rows are plain `<td>` (rendered Markdown) the element draws the first cells as row headers and gives them the role. */
|
|
319
|
+
this.rowHeaders = false;
|
|
320
|
+
/** Keeps the header row at the top of the table's box while its rows scroll under it. It has an effect only where the layout limits the table's height (`max-block-size` on the element). */
|
|
321
|
+
this.stickyHeader = false;
|
|
322
|
+
/** Keeps the first column at the start edge while the other columns scroll sideways under it. Released by itself where the column would take more than half of the box. */
|
|
323
|
+
this.stickyFirstColumn = false;
|
|
324
|
+
/**
|
|
325
|
+
* The product's sentence about what the table shows now ("1–20 of 132"), drawn under the last row and told politely to
|
|
326
|
+
* assistive technology when it changes. A convenience that writes the status line's paragraph: a
|
|
327
|
+
* `<div data-part="status"><p role="status">…</p></div>` written in the markup is the same thing, is drawn before
|
|
328
|
+
* the element is defined, and is then the one that is read.
|
|
329
|
+
*/
|
|
330
|
+
this.status = '';
|
|
331
|
+
/**
|
|
332
|
+
* Whether rows can be chosen. `multiple`: every body row that has a `data-value` and a first cell
|
|
333
|
+
* `<td data-part="selection">` holding a checkbox can be chosen, and the header row's selection cell holds the
|
|
334
|
+
* checkbox for every row. `none` draws no selection column and ignores a row's `data-selected`.
|
|
335
|
+
*/
|
|
336
|
+
this.selection = 'none';
|
|
337
|
+
/** The accessible name of the header row's checkbox ("Select all rows"). Not drawn. From the product's words (`selectAllLabel`) where the instance gives none. */
|
|
338
|
+
this.selectAllLabel = '';
|
|
339
|
+
/**
|
|
340
|
+
* Says that the product is fetching the rows. The table is exposed as busy and draws the rows it is given meanwhile —
|
|
341
|
+
* the ones it had, or placeholder rows (`<tr data-placeholder>`); it does not draw the empty content, dims and
|
|
342
|
+
* disables nothing, and fetches nothing itself.
|
|
343
|
+
*/
|
|
344
|
+
this.loading = false;
|
|
345
|
+
/** What a platform with no sort state says after the name of the column the rows ascend by. Accepted and not read on the web: the header cell's `aria-sort` says it. */
|
|
346
|
+
this.sortedAscendingLabel = '';
|
|
347
|
+
/** What a platform with no sort state says after the name of the column the rows descend by. Accepted and not read on the web: the header cell's `aria-sort` says it. */
|
|
348
|
+
this.sortedDescendingLabel = '';
|
|
349
|
+
this.mutations = typeof MutationObserver === 'undefined'
|
|
350
|
+
? null
|
|
351
|
+
: new MutationObserver((records) => {
|
|
352
|
+
if (!records.every(passes))
|
|
353
|
+
this.read();
|
|
354
|
+
});
|
|
355
|
+
/** The table the box holds now, and the one the observer of sizes watches. */
|
|
356
|
+
this.table = null;
|
|
357
|
+
this.watched = null;
|
|
358
|
+
/** The caption this element wrote for the `caption` property, and the name it wrote on the table for `label`. */
|
|
359
|
+
this.ownCaption = null;
|
|
360
|
+
this.wroteLabel = false;
|
|
361
|
+
/** The first cells this element gave the row header's role (TBL-6). */
|
|
362
|
+
this.rowHeaderCells = new Set();
|
|
363
|
+
/** What this element wrote on itself to be a focus stop and a region (TBL-22): only that is taken off again. */
|
|
364
|
+
this.stop = new Set();
|
|
365
|
+
/** The layout direction and the offset along it when the box last scrolled (TBL-26). */
|
|
366
|
+
this.direction = null;
|
|
367
|
+
this.offset = 0;
|
|
368
|
+
this.roots = [];
|
|
369
|
+
/** The status line the box holds now, and the paragraph this element wrote in it for the `status` property (TBL-51). */
|
|
370
|
+
this.statusLine = null;
|
|
371
|
+
this.ownStatus = null;
|
|
372
|
+
/** Whether the table has a sort button now: only then does the element listen to anything but its scroll (TBL-16). */
|
|
373
|
+
this.sorts = false;
|
|
374
|
+
/** TBL-56: whether the icon set can draw a sort mark. */
|
|
375
|
+
this.glyphs = new PendingGlyphs(this, SORT_GLYPH);
|
|
376
|
+
this.presses = new WeakMap();
|
|
377
|
+
this.pressControllers = new Set();
|
|
378
|
+
this.held = null;
|
|
379
|
+
this.heldControl = null;
|
|
380
|
+
/** The sort button that has focus and its column, to give focus back where a change of rows took the button away (TBL-25, TBL-34). */
|
|
381
|
+
this.focusedSort = null;
|
|
382
|
+
/** Whether rows can be chosen now: only then does the element listen for a checkbox (TBL-16, TBL-42). */
|
|
383
|
+
this.chooses = false;
|
|
384
|
+
/** What each row said of itself when it was last read (TBL-44): a row that says something else was written by the product. */
|
|
385
|
+
this.chosen = new WeakMap();
|
|
386
|
+
/** The checkboxes this element named, with the name it gave: only that is written again or taken away (TBL-46). */
|
|
387
|
+
this.named = new WeakMap();
|
|
388
|
+
/** The rows this element hid from assistive technology (TBL-50), and whether it wrote the busy state (TBL-49). */
|
|
389
|
+
this.hiddenRows = new Set();
|
|
390
|
+
this.busied = null;
|
|
391
|
+
/** The checkbox that has focus and its row's value, to give focus back where a change of rows took it away (TBL-25). */
|
|
392
|
+
this.focusedBox = null;
|
|
393
|
+
/** Whether the element waits for the Checkbox to be defined, to read the checkboxes again. */
|
|
394
|
+
this.awaited = false;
|
|
395
|
+
this.releasePress = () => {
|
|
396
|
+
this.held?.release();
|
|
397
|
+
this.held = null;
|
|
398
|
+
this.heldControl = null;
|
|
399
|
+
};
|
|
400
|
+
this.onPointerDown = (event) => {
|
|
401
|
+
const control = this.controlOf(event.target);
|
|
402
|
+
const pointer = event;
|
|
403
|
+
if (!control || control.matches(':disabled') || (pointer.button !== 0 && pointer.pointerType === 'mouse'))
|
|
404
|
+
return;
|
|
405
|
+
this.answered(control);
|
|
406
|
+
this.held = this.pressOf(control);
|
|
407
|
+
this.heldControl = control;
|
|
408
|
+
this.held.onPointerDown(pointer);
|
|
409
|
+
};
|
|
410
|
+
// `pointerleave` is not seen from here: the press ends when the pointer goes out of the control it holds.
|
|
411
|
+
this.onPointerOut = (event) => {
|
|
412
|
+
const to = event.relatedTarget;
|
|
413
|
+
if (this.heldControl && !(to instanceof Node && this.heldControl.contains(to)))
|
|
414
|
+
this.releasePress();
|
|
415
|
+
};
|
|
416
|
+
this.onKeyDown = (event) => {
|
|
417
|
+
const control = this.controlOf(event.target);
|
|
418
|
+
const key = event;
|
|
419
|
+
if (!control || control.matches(':disabled') || key.repeat)
|
|
420
|
+
return;
|
|
421
|
+
if (key.key === 'Enter' || (key.key === ' ' && control.localName !== 'a')) {
|
|
422
|
+
this.answered(control);
|
|
423
|
+
this.pressOf(control).onKeyDown(key);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
this.onKeyUp = (event) => {
|
|
427
|
+
const control = this.controlOf(event.target);
|
|
428
|
+
if (control)
|
|
429
|
+
this.presses.get(control)?.onKeyUp(event);
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* TBL-34: a sort button was activated — by pointer, touch, Enter or Space, which the browser makes one click. The
|
|
433
|
+
* table asks, once, and changes nothing: the direction is the one asked for, the order is the product's to set.
|
|
434
|
+
* Where the control is an anchor the event can be cancelled, and the link is then not followed.
|
|
435
|
+
*/
|
|
436
|
+
this.onClick = (event) => {
|
|
437
|
+
const control = this.controlOf(event.target);
|
|
438
|
+
if (!control)
|
|
439
|
+
return;
|
|
440
|
+
const cell = control.parentElement;
|
|
441
|
+
let index = 0;
|
|
442
|
+
for (let before = cell.previousElementSibling; before; before = before.previousElementSibling)
|
|
443
|
+
if (before.getAttribute('data-part') !== 'selection')
|
|
444
|
+
index++;
|
|
445
|
+
const link = control.localName === 'a';
|
|
446
|
+
const detail = { column: cell.getAttribute('data-value') ?? '', index, direction: cell.getAttribute('aria-sort') === 'ascending' ? 'descending' : 'ascending' };
|
|
447
|
+
const followed = this.dispatchEvent(new CustomEvent('sort', { detail, bubbles: true, composed: true, cancelable: link }));
|
|
448
|
+
if (link && !followed)
|
|
449
|
+
event.preventDefault();
|
|
450
|
+
};
|
|
451
|
+
this.onFocusIn = (event) => {
|
|
452
|
+
const control = this.controlOf(event.target);
|
|
453
|
+
if (!control)
|
|
454
|
+
return;
|
|
455
|
+
// TBL-39: where the browser has no style queries, the focus style is read when focus arrives.
|
|
456
|
+
if (!styleQueries())
|
|
457
|
+
syncFocusStyle(control, control);
|
|
458
|
+
this.focusedSort = { control, index: control.parentElement.cellIndex };
|
|
459
|
+
this.reveal(control);
|
|
460
|
+
// TBL-36: an engine may scroll the box for the focused button only after this (WebKit does, a few frames later),
|
|
461
|
+
// and so put it back under what is kept. A scroll heard within this time of the focus is taken for that one, and
|
|
462
|
+
// answered the same way; after it a scroll is the person's.
|
|
463
|
+
this.revealing = { control, until: performance.now() + REVEAL_AGAIN };
|
|
464
|
+
};
|
|
465
|
+
this.onFocusOut = (event) => {
|
|
466
|
+
const control = this.controlOf(event.target);
|
|
467
|
+
if (!control)
|
|
468
|
+
return;
|
|
469
|
+
this.presses.get(control)?.onBlur();
|
|
470
|
+
if (this.revealing?.control === control)
|
|
471
|
+
this.revealing = null;
|
|
472
|
+
// Focus that went to something else is no longer the button's. Focus that went nowhere may have been taken away
|
|
473
|
+
// with the button (TBL-25): that is known once the change is over.
|
|
474
|
+
const forget = () => {
|
|
475
|
+
if (this.focusedSort?.control === control)
|
|
476
|
+
this.focusedSort = null;
|
|
477
|
+
};
|
|
478
|
+
if (event.relatedTarget)
|
|
479
|
+
forget();
|
|
480
|
+
else
|
|
481
|
+
queueMicrotask(() => control.isConnected && !control.matches(':focus') && forget());
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* TBL-36: keyboard focus came to a sort button that lies under a first column or a status line kept in view — the
|
|
485
|
+
* browser brought it into the box, not out from under them. The box scrolls by what is covered.
|
|
486
|
+
*/
|
|
487
|
+
this.revealing = null;
|
|
488
|
+
this.listeners = [
|
|
489
|
+
['pointerdown', this.onPointerDown],
|
|
490
|
+
['pointerup', this.releasePress],
|
|
491
|
+
['pointercancel', this.releasePress],
|
|
492
|
+
['pointerout', this.onPointerOut],
|
|
493
|
+
['dragstart', this.releasePress],
|
|
494
|
+
['keydown', this.onKeyDown],
|
|
495
|
+
['keyup', this.onKeyUp],
|
|
496
|
+
['click', this.onClick],
|
|
497
|
+
['focusin', this.onFocusIn],
|
|
498
|
+
['focusout', this.onFocusOut],
|
|
499
|
+
];
|
|
500
|
+
/**
|
|
501
|
+
* TBL-44, TBL-45: the user changed a checkbox — by a press or by Space, which the checkbox makes one `change`. A
|
|
502
|
+
* row's: the row is chosen as its checkbox now says. The header's: every row that can be chosen is chosen, or — where
|
|
503
|
+
* every one was — none is. Then `selectionchange`, exactly once, with the values after the change in row order.
|
|
504
|
+
*/
|
|
505
|
+
this.onChange = (event) => {
|
|
506
|
+
const choice = this.choiceOf(event.target);
|
|
507
|
+
const table = this.table;
|
|
508
|
+
if (!choice || !table || this.mode !== 'multiple')
|
|
509
|
+
return;
|
|
510
|
+
const { box, row } = choice;
|
|
511
|
+
const rows = this.choosable(table);
|
|
512
|
+
if (row.parentElement?.localName === 'thead') {
|
|
513
|
+
const every = rows.length > 0 && rows.every(([each]) => this.chosen.get(each) ?? each.hasAttribute('data-selected'));
|
|
514
|
+
for (const [each, own] of rows) {
|
|
515
|
+
this.chosen.set(each, !every);
|
|
516
|
+
mark(each, 'data-selected', every ? null : '');
|
|
517
|
+
if (checkedOf(own) === every)
|
|
518
|
+
own.checked = !every;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
else if (rows.some(([each]) => each === row)) {
|
|
522
|
+
const now = checkedOf(box);
|
|
523
|
+
this.chosen.set(row, now);
|
|
524
|
+
mark(row, 'data-selected', now ? '' : null);
|
|
525
|
+
}
|
|
526
|
+
else
|
|
527
|
+
return;
|
|
528
|
+
// The header's checkbox follows at once, not when the change of the rows is observed.
|
|
529
|
+
this.readSelection(table);
|
|
530
|
+
const values = rows.filter(([each]) => this.chosen.get(each)).map(([each]) => each.getAttribute('data-value') ?? '');
|
|
531
|
+
this.dispatchEvent(new CustomEvent('selectionchange', { detail: { values }, bubbles: true, composed: true }));
|
|
532
|
+
};
|
|
533
|
+
/** TBL-47: a checkbox's hit area is its whole selection cell — a press on the cell beside the checkbox is the checkbox's. */
|
|
534
|
+
this.onCellClick = (event) => {
|
|
535
|
+
const cell = event.target;
|
|
536
|
+
if (!(cell instanceof HTMLTableCellElement) || !cell.matches(SELECTION_CELL) || cell.parentElement?.parentElement?.parentElement !== this.table)
|
|
537
|
+
return;
|
|
538
|
+
const row = cell.parentElement;
|
|
539
|
+
if (row.cells[0] !== cell || this.mode !== 'multiple')
|
|
540
|
+
return;
|
|
541
|
+
const head = row.parentElement?.localName === 'thead';
|
|
542
|
+
if (!head && (row.parentElement?.localName !== 'tbody' || !row.getAttribute('data-value') || row.hasAttribute('data-placeholder')))
|
|
543
|
+
return;
|
|
544
|
+
const box = this.boxIn(row);
|
|
545
|
+
if (box && !box.disabled)
|
|
546
|
+
box.click();
|
|
547
|
+
};
|
|
548
|
+
this.onBoxFocusIn = (event) => {
|
|
549
|
+
const choice = this.choiceOf(event.target);
|
|
550
|
+
if (!choice)
|
|
551
|
+
return;
|
|
552
|
+
this.focusedBox = { box: choice.box, value: choice.row.parentElement?.localName === 'thead' ? null : choice.row.getAttribute('data-value') };
|
|
553
|
+
this.revealBox(choice.box);
|
|
554
|
+
};
|
|
555
|
+
this.onBoxFocusOut = (event) => {
|
|
556
|
+
const choice = this.choiceOf(event.target);
|
|
557
|
+
if (!choice)
|
|
558
|
+
return;
|
|
559
|
+
const { box } = choice;
|
|
560
|
+
// As a sort button's (TBL-25): focus that went nowhere may have been taken away with the row.
|
|
561
|
+
const forget = () => {
|
|
562
|
+
if (this.focusedBox?.box === box)
|
|
563
|
+
this.focusedBox = null;
|
|
564
|
+
};
|
|
565
|
+
// (After the task, not after the event: a row that is moved is taken out and put back in one task, and the change
|
|
566
|
+
// is read — and focus given back — before this looks.)
|
|
567
|
+
if (event.relatedTarget)
|
|
568
|
+
forget();
|
|
569
|
+
else
|
|
570
|
+
setTimeout(() => box.isConnected && !box.matches(':focus') && forget());
|
|
571
|
+
};
|
|
572
|
+
this.choiceListeners = [
|
|
573
|
+
['change', this.onChange],
|
|
574
|
+
['click', this.onCellClick],
|
|
575
|
+
['focusin', this.onBoxFocusIn],
|
|
576
|
+
['focusout', this.onBoxFocusOut],
|
|
577
|
+
];
|
|
578
|
+
this.readScroll = () => {
|
|
579
|
+
if (this.revealing) {
|
|
580
|
+
if (performance.now() > this.revealing.until)
|
|
581
|
+
this.revealing = null;
|
|
582
|
+
else
|
|
583
|
+
this.reveal(this.revealing.control);
|
|
584
|
+
}
|
|
585
|
+
this.direction ??= getComputedStyle(this).direction;
|
|
586
|
+
this.scrolled({ range: this.scrollWidth - this.clientWidth, offset: Math.abs(this.scrollLeft), top: this.scrollTop, below: this.scrollHeight - this.clientHeight - this.scrollTop });
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
static { this.properties = {
|
|
590
|
+
caption: { type: String },
|
|
591
|
+
label: { type: String },
|
|
592
|
+
// The defaults are not reflected: a table that is defined is the table that was written.
|
|
593
|
+
density: { type: String, reflect: true, useDefault: true },
|
|
594
|
+
separation: { type: String, reflect: true, useDefault: true },
|
|
595
|
+
striped: { type: Boolean, reflect: true },
|
|
596
|
+
rowHeaders: { type: Boolean, reflect: true, attribute: 'row-headers' },
|
|
597
|
+
stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },
|
|
598
|
+
stickyFirstColumn: { type: Boolean, reflect: true, attribute: 'sticky-first-column' },
|
|
599
|
+
status: { type: String },
|
|
600
|
+
selection: { type: String, reflect: true, useDefault: true },
|
|
601
|
+
selectAllLabel: { type: String, attribute: 'select-all-label' },
|
|
602
|
+
loading: { type: Boolean, reflect: true },
|
|
603
|
+
sortedAscendingLabel: { type: String, attribute: 'sorted-ascending-label' },
|
|
604
|
+
sortedDescendingLabel: { type: String, attribute: 'sorted-descending-label' },
|
|
605
|
+
}; }
|
|
606
|
+
/** No shadow root: the table is the document's. */
|
|
607
|
+
createRenderRoot() {
|
|
608
|
+
return this;
|
|
609
|
+
}
|
|
610
|
+
connectedCallback() {
|
|
611
|
+
super.connectedCallback();
|
|
612
|
+
adoptUnlessDrawn(this, sheet('table', () => TABLE_CSS), '--_table-pad-block');
|
|
613
|
+
this.addEventListener('scroll', this.readScroll, { passive: true });
|
|
614
|
+
observeSize(this, this);
|
|
615
|
+
this.mutations?.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ATTRIBUTES });
|
|
616
|
+
this.direction = null;
|
|
617
|
+
this.roots = rootsOf(this);
|
|
618
|
+
watchTurns(this, this.roots);
|
|
619
|
+
if (this.hasUpdated)
|
|
620
|
+
this.read();
|
|
621
|
+
}
|
|
622
|
+
disconnectedCallback() {
|
|
623
|
+
super.disconnectedCallback();
|
|
624
|
+
this.removeEventListener('scroll', this.readScroll);
|
|
625
|
+
unobserveSize(this);
|
|
626
|
+
if (this.watched)
|
|
627
|
+
unobserveSize(this.watched);
|
|
628
|
+
unmeasured.delete(this);
|
|
629
|
+
this.mutations?.disconnect();
|
|
630
|
+
this.listen(false);
|
|
631
|
+
this.listenChoices(false);
|
|
632
|
+
this.focusedSort = null;
|
|
633
|
+
this.focusedBox = null;
|
|
634
|
+
unwatchTurns(this, this.roots);
|
|
635
|
+
this.roots = [];
|
|
636
|
+
this.watched = null;
|
|
637
|
+
}
|
|
638
|
+
updated(changed) {
|
|
639
|
+
// TBL-9: a separation the table does not define is auto (no rule matches the attribute); a debug build says so.
|
|
640
|
+
if (changed.has('separation') && !SEPARATION_VALUES.includes(this.separation)) {
|
|
641
|
+
report(this, 'TBL-9', `separation "${this.separation}" is not a value the table defines; it is drawn as "auto"`);
|
|
642
|
+
}
|
|
643
|
+
if (changed.has('density'))
|
|
644
|
+
this.readDensity();
|
|
645
|
+
// TBL-42: a selection the table does not define is none (no rule matches the attribute); a debug build says so.
|
|
646
|
+
if (changed.has('selection') && this.selection !== 'none' && this.selection !== 'multiple') {
|
|
647
|
+
report(this, 'TBL-42', `selection "${String(this.selection)}" is not a value the table defines; it is drawn as "none"`);
|
|
648
|
+
}
|
|
649
|
+
this.read();
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* TBL-31: a density the core does not have was added by a design system — its rules are added to the root, falling
|
|
653
|
+
* back to the default's tokens — or is unknown to the active one, which a debug build says.
|
|
654
|
+
*/
|
|
655
|
+
readDensity() {
|
|
656
|
+
const density = String(this.density ?? '');
|
|
657
|
+
if (CORE_DENSITIES.includes(density))
|
|
658
|
+
return;
|
|
659
|
+
const known = KEY.test(density);
|
|
660
|
+
if (known)
|
|
661
|
+
adopt(this.getRootNode(), sheet(`density:${density}`, () => densityRules(density)));
|
|
662
|
+
if (!known || getComputedStyle(this).getPropertyValue(`${PREFIX}-cell-padding-block-${density}`).trim() === '') {
|
|
663
|
+
report(this, 'TBL-31', `density "${density}" is not a value of the active design system; it is drawn as "${DEFAULT_DENSITY}"`);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Reads the table the box holds and writes what follows from it: the caption and the name, the columns' alignment,
|
|
668
|
+
* the row headers of a table of plain cells, the separation where the browser cannot query it — then asks for a
|
|
669
|
+
* measure, which every table of the task shares (`measureSoon`). Called when a property changes and when the
|
|
670
|
+
* table's content does (TBL-25); it writes only what differs, so it settles, its cost is the header row's, not the
|
|
671
|
+
* rows', and it reads nothing of the layout: everything it writes is styled once, with what the other tables wrote.
|
|
672
|
+
*/
|
|
673
|
+
read() {
|
|
674
|
+
if (!this.isConnected)
|
|
675
|
+
return;
|
|
676
|
+
const table = this.querySelector(':scope > table');
|
|
677
|
+
this.table = table;
|
|
678
|
+
if (table !== this.watched) {
|
|
679
|
+
if (this.watched)
|
|
680
|
+
unobserveSize(this.watched);
|
|
681
|
+
if (table)
|
|
682
|
+
observeSize(table, this);
|
|
683
|
+
this.watched = table;
|
|
684
|
+
}
|
|
685
|
+
if (!table) {
|
|
686
|
+
this.listen(false);
|
|
687
|
+
this.listenChoices(false);
|
|
688
|
+
measureSoon(this);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
this.readName(table);
|
|
692
|
+
this.readStatus();
|
|
693
|
+
this.readColumns(table);
|
|
694
|
+
this.readSort(table);
|
|
695
|
+
this.readRowHeaders(table);
|
|
696
|
+
this.readLoading(table);
|
|
697
|
+
this.readSelection(table);
|
|
698
|
+
// TBL-9: where the browser answers style queries the stylesheet reads the choice itself, and nothing is written.
|
|
699
|
+
mark(table, 'data-separation', styleQueries() ? null : compChoice(this, '--_table-separation', SEPARATIONS));
|
|
700
|
+
if (debugBuild()) {
|
|
701
|
+
// A table that is still being parsed is read again when it is whole: it may not have its caption yet.
|
|
702
|
+
if (document.readyState === 'loading')
|
|
703
|
+
document.addEventListener('DOMContentLoaded', () => this.read(), { once: true });
|
|
704
|
+
else
|
|
705
|
+
this.check(table);
|
|
706
|
+
}
|
|
707
|
+
measureSoon(this);
|
|
708
|
+
}
|
|
709
|
+
/** TBL-12, TBL-23: the caption the `caption` property asks for, and the name `label` gives a table without one. */
|
|
710
|
+
readName(table) {
|
|
711
|
+
if (this.ownCaption && this.ownCaption.parentNode !== table)
|
|
712
|
+
this.ownCaption = null;
|
|
713
|
+
if (this.caption) {
|
|
714
|
+
const caption = table.caption ?? (this.ownCaption = table.createCaption());
|
|
715
|
+
if (caption === this.ownCaption && caption.textContent !== this.caption)
|
|
716
|
+
caption.textContent = this.caption;
|
|
717
|
+
}
|
|
718
|
+
else if (this.ownCaption) {
|
|
719
|
+
this.ownCaption.remove();
|
|
720
|
+
this.ownCaption = null;
|
|
721
|
+
}
|
|
722
|
+
const captioned = !!table.caption?.textContent?.trim();
|
|
723
|
+
// The caption is the name; `label` is ignored where there is one, and never drawn.
|
|
724
|
+
if (this.label && !captioned) {
|
|
725
|
+
mark(table, 'aria-label', this.label);
|
|
726
|
+
this.wroteLabel = true;
|
|
727
|
+
}
|
|
728
|
+
else if (this.wroteLabel) {
|
|
729
|
+
mark(table, 'aria-label', null);
|
|
730
|
+
this.wroteLabel = false;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* TBL-51, TBL-52: the status line the box holds, and the paragraph the `status` property asks for — a status, so
|
|
735
|
+
* that a change of its text is told politely. A paragraph the product wrote is the one that is read, and is left as
|
|
736
|
+
* it is. Emptied, this element's paragraph stays, empty and with no room (table.css): a status that is there before
|
|
737
|
+
* its text is one whose text is told.
|
|
738
|
+
*/
|
|
739
|
+
readStatus() {
|
|
740
|
+
let line = this.querySelector(':scope > [data-part="status"]');
|
|
741
|
+
if (this.ownStatus && this.ownStatus.parentElement !== line)
|
|
742
|
+
this.ownStatus = null;
|
|
743
|
+
if (this.status && !this.ownStatus && !line?.querySelector(':scope > [role="status"]')) {
|
|
744
|
+
if (!line) {
|
|
745
|
+
line = document.createElement('div');
|
|
746
|
+
line.setAttribute('data-part', 'status');
|
|
747
|
+
this.append(line);
|
|
748
|
+
}
|
|
749
|
+
this.ownStatus = document.createElement('p');
|
|
750
|
+
this.ownStatus.setAttribute('role', 'status');
|
|
751
|
+
line.prepend(this.ownStatus);
|
|
752
|
+
}
|
|
753
|
+
if (this.ownStatus && this.ownStatus.textContent !== this.status)
|
|
754
|
+
this.ownStatus.textContent = this.status;
|
|
755
|
+
this.statusLine = line;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* TBL-32, TBL-16: whether a column can be sorted — its header cell names an order and holds a control. Only then
|
|
759
|
+
* does the element listen for a press, register the press's property and ask whether the icon set can draw the mark.
|
|
760
|
+
*/
|
|
761
|
+
readSort(table) {
|
|
762
|
+
let sorts = false;
|
|
763
|
+
for (const cell of table.tHead?.rows[0]?.cells ?? []) {
|
|
764
|
+
if (cell.hasAttribute('aria-sort') && cell.querySelector(OWN_CONTROL)) {
|
|
765
|
+
sorts = true;
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
this.listen(sorts);
|
|
770
|
+
if (sorts)
|
|
771
|
+
this.keepFocus(table);
|
|
772
|
+
}
|
|
773
|
+
listen(sorts) {
|
|
774
|
+
if (sorts === this.sorts)
|
|
775
|
+
return;
|
|
776
|
+
this.sorts = sorts;
|
|
777
|
+
if (sorts) {
|
|
778
|
+
for (const [type, listener] of this.listeners)
|
|
779
|
+
this.addEventListener(type, listener);
|
|
780
|
+
this.glyphs.connect();
|
|
781
|
+
this.glyphs.read();
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
for (const [type, listener] of this.listeners)
|
|
785
|
+
this.removeEventListener(type, listener);
|
|
786
|
+
this.glyphs.disconnect();
|
|
787
|
+
this.removeAttribute('data-glyphs');
|
|
788
|
+
for (const press of this.pressControllers)
|
|
789
|
+
press.hostDisconnected();
|
|
790
|
+
this.pressControllers.clear();
|
|
791
|
+
this.held = null;
|
|
792
|
+
this.heldControl = null;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
/** The sort control an event came from, in this table's own header row: a table inside a cell is the product's. */
|
|
796
|
+
controlOf(target) {
|
|
797
|
+
const control = target instanceof Element ? target.closest(SORT_CONTROL) : null;
|
|
798
|
+
return control && control.closest('table') === this.table && control.parentElement?.parentElement?.parentElement?.localName === 'thead' ? control : null;
|
|
799
|
+
}
|
|
800
|
+
/** The press of one sort button (the shared primitive), made when it is first pressed. A link takes Enter alone. */
|
|
801
|
+
pressOf(control) {
|
|
802
|
+
let press = this.presses.get(control);
|
|
803
|
+
if (!press) {
|
|
804
|
+
press = new PressController(control, {
|
|
805
|
+
container: () => control,
|
|
806
|
+
// The control's first transition is the hold (table.css), so its delay is press-hold as a time.
|
|
807
|
+
holdCarrier: () => control,
|
|
808
|
+
disabled: () => control.matches(':disabled'),
|
|
809
|
+
keys: () => (control.localName === 'a' ? ['Enter'] : undefined),
|
|
810
|
+
});
|
|
811
|
+
this.presses.set(control, press);
|
|
812
|
+
this.pressControllers.add(press);
|
|
813
|
+
}
|
|
814
|
+
return press;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* The press is this script's from here: the stylesheet's own answer to `:active` stands down for a control that
|
|
818
|
+
* carries `data-pressed`, so the attribute is written before anything reads a style.
|
|
819
|
+
*/
|
|
820
|
+
answered(control) {
|
|
821
|
+
if (!control.hasAttribute('data-pressed'))
|
|
822
|
+
control.dataset.pressed = 'none';
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* TBL-25, TBL-34: the rows were given again, and the header row with them — the button that had focus is gone and
|
|
826
|
+
* focus with it. The button of the same column takes it, where there is one and focus went nowhere else.
|
|
827
|
+
*/
|
|
828
|
+
keepFocus(table) {
|
|
829
|
+
const kept = this.focusedSort;
|
|
830
|
+
if (!kept || kept.control.isConnected)
|
|
831
|
+
return;
|
|
832
|
+
this.focusedSort = null;
|
|
833
|
+
const active = this.getRootNode().activeElement;
|
|
834
|
+
if (active && active !== document.body)
|
|
835
|
+
return;
|
|
836
|
+
table.tHead?.rows[0]?.cells[kept.index]?.querySelector(OWN_CONTROL)?.focus({ preventScroll: true });
|
|
837
|
+
}
|
|
838
|
+
reveal(control) {
|
|
839
|
+
if (!control.matches(':focus-visible'))
|
|
840
|
+
return;
|
|
841
|
+
const cell = control.parentElement;
|
|
842
|
+
const at = cell.getBoundingClientRect();
|
|
843
|
+
let x = 0;
|
|
844
|
+
let y = 0;
|
|
845
|
+
const row = cell.parentElement;
|
|
846
|
+
// TBL-42: what is kept is the first column of data — the one after a selection column that is kept with it.
|
|
847
|
+
const first = this.stickyFirstColumn && !this.hasAttribute('data-first-column-released') ? (row?.cells[0]?.matches(SELECTION_CELL) ? row.cells[1] : row?.cells[0]) : null;
|
|
848
|
+
if (first && first !== cell) {
|
|
849
|
+
const kept = first.getBoundingClientRect();
|
|
850
|
+
if (getComputedStyle(this).direction === 'rtl')
|
|
851
|
+
x = Math.max(0, at.right - kept.left);
|
|
852
|
+
else
|
|
853
|
+
x = Math.min(0, at.left - kept.right);
|
|
854
|
+
}
|
|
855
|
+
const status = this.statusLine?.getBoundingClientRect();
|
|
856
|
+
if (status && status.height > 0)
|
|
857
|
+
y = Math.max(0, at.bottom - status.top);
|
|
858
|
+
if (x || y)
|
|
859
|
+
this.scrollBy(x, y);
|
|
860
|
+
}
|
|
861
|
+
/** How rows are chosen now: a selection the table does not define is none (TBL-42). */
|
|
862
|
+
get mode() {
|
|
863
|
+
return this.selection === 'multiple' ? 'multiple' : 'none';
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* TBL-49: while `loading`, the table is exposed as busy — and only that: what it is given is drawn as it is. A busy
|
|
867
|
+
* state a server wrote is left as it is. TBL-50: a placeholder row is hidden from assistive technology, so that a
|
|
868
|
+
* person hears that the table is busy and not a row of nothing.
|
|
869
|
+
*/
|
|
870
|
+
readLoading(table) {
|
|
871
|
+
if (this.busied && this.busied !== table)
|
|
872
|
+
this.busied = null;
|
|
873
|
+
if (this.loading) {
|
|
874
|
+
if (table.getAttribute('aria-busy') !== 'true') {
|
|
875
|
+
table.setAttribute('aria-busy', 'true');
|
|
876
|
+
this.busied = table;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else if (this.busied) {
|
|
880
|
+
table.removeAttribute('aria-busy');
|
|
881
|
+
this.busied = null;
|
|
882
|
+
}
|
|
883
|
+
for (const row of table.querySelectorAll(':scope > tbody > tr[data-placeholder]')) {
|
|
884
|
+
if (row.getAttribute('aria-hidden') === 'true')
|
|
885
|
+
continue;
|
|
886
|
+
row.setAttribute('aria-hidden', 'true');
|
|
887
|
+
this.hiddenRows.add(row);
|
|
888
|
+
}
|
|
889
|
+
for (const row of this.hiddenRows) {
|
|
890
|
+
if (row.isConnected && row.hasAttribute('data-placeholder'))
|
|
891
|
+
continue;
|
|
892
|
+
// The record arrived in the row that stood for it: the row is a row again.
|
|
893
|
+
if (!row.hasAttribute('data-placeholder'))
|
|
894
|
+
row.removeAttribute('aria-hidden');
|
|
895
|
+
this.hiddenRows.delete(row);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
/** The checkbox a row holds in its selection cell: the product's `<tanrei-checkbox>`, or its native one. */
|
|
899
|
+
boxIn(row) {
|
|
900
|
+
const cell = row?.cells[0];
|
|
901
|
+
return cell?.matches(SELECTION_CELL) ? cell.querySelector(CHECKBOX) : null;
|
|
902
|
+
}
|
|
903
|
+
/** TBL-42, TBL-45, TBL-50: the body rows that can be chosen — each has a value and a checkbox, and is no placeholder — in row order. */
|
|
904
|
+
choosable(table) {
|
|
905
|
+
const rows = [];
|
|
906
|
+
for (const body of table.tBodies) {
|
|
907
|
+
for (const row of body.rows) {
|
|
908
|
+
if (!row.getAttribute('data-value') || row.hasAttribute('data-placeholder'))
|
|
909
|
+
continue;
|
|
910
|
+
const box = this.boxIn(row);
|
|
911
|
+
if (box)
|
|
912
|
+
rows.push([row, box]);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return rows;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* TBL-42 to TBL-46: the rows that can be chosen, each drawn chosen or not by what it says of itself, its checkbox in
|
|
919
|
+
* step with it and named; and the header's checkbox in step with all of them. Nothing is emitted here: what is read
|
|
920
|
+
* is what the product wrote. A row is chosen by its own `data-selected` — the table carries no selection over to a
|
|
921
|
+
* row it is not given (TBL-44) — or, the first time it is read, by a checkbox that is already checked (the form a
|
|
922
|
+
* page has without script, TBL-57). Its cost is the rows', and only while rows can be chosen.
|
|
923
|
+
*/
|
|
924
|
+
readSelection(table) {
|
|
925
|
+
const on = this.mode === 'multiple';
|
|
926
|
+
this.listenChoices(on);
|
|
927
|
+
if (!on)
|
|
928
|
+
return;
|
|
929
|
+
let pending = false;
|
|
930
|
+
let picked = 0;
|
|
931
|
+
const rows = this.choosable(table);
|
|
932
|
+
for (const [row, box] of rows) {
|
|
933
|
+
pending ||= !isNative(box) && !box.matches(':defined');
|
|
934
|
+
const said = row.hasAttribute('data-selected');
|
|
935
|
+
const before = this.chosen.get(row);
|
|
936
|
+
// The row says something else than when it was last read: the product wrote it. Else the checkbox is right.
|
|
937
|
+
const now = before === undefined ? said || checkedOf(box) : said !== before ? said : checkedOf(box);
|
|
938
|
+
this.chosen.set(row, now);
|
|
939
|
+
mark(row, 'data-selected', now ? '' : null);
|
|
940
|
+
if (checkedOf(box) !== now)
|
|
941
|
+
box.checked = now;
|
|
942
|
+
this.fit(box);
|
|
943
|
+
this.nameRow(row, box);
|
|
944
|
+
if (now)
|
|
945
|
+
picked++;
|
|
946
|
+
}
|
|
947
|
+
const all = this.boxIn(table.tHead?.rows[0]);
|
|
948
|
+
if (all) {
|
|
949
|
+
pending ||= !isNative(all) && !all.matches(':defined');
|
|
950
|
+
// TBL-45: checked while every row is chosen, mixed while some are, unchecked while none is; disabled with no row.
|
|
951
|
+
const [checked, mixed, disabled] = [rows.length > 0 && picked === rows.length, picked > 0 && picked < rows.length, rows.length === 0];
|
|
952
|
+
if (checkedOf(all) !== checked)
|
|
953
|
+
all.checked = checked;
|
|
954
|
+
if (!!all.indeterminate !== mixed)
|
|
955
|
+
all.indeterminate = mixed;
|
|
956
|
+
if (!!all.disabled !== disabled)
|
|
957
|
+
all.disabled = disabled;
|
|
958
|
+
this.fit(all);
|
|
959
|
+
this.nameAll(all);
|
|
960
|
+
}
|
|
961
|
+
// A checkbox that is not defined yet is written to all the same (it reads its properties when it is), and read
|
|
962
|
+
// again then.
|
|
963
|
+
if (pending && !this.awaited) {
|
|
964
|
+
this.awaited = true;
|
|
965
|
+
void customElements.whenDefined('tanrei-checkbox').then(() => {
|
|
966
|
+
this.awaited = false;
|
|
967
|
+
this.read();
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
this.keepBoxFocus(table);
|
|
971
|
+
}
|
|
972
|
+
/** TBL-42: a checkbox of the selection column draws no label. */
|
|
973
|
+
fit(box) {
|
|
974
|
+
if (!isNative(box) && !box.hasAttribute('label-hidden'))
|
|
975
|
+
box.setAttribute('label-hidden', '');
|
|
976
|
+
}
|
|
977
|
+
/** A checkbox's own name, as the product gave it: `label` on Tanrei's, `aria-label` on the browser's. */
|
|
978
|
+
nameOf(box) {
|
|
979
|
+
return (isNative(box) ? box.getAttribute('aria-label') : (box.label ?? box.getAttribute('label'))) ?? '';
|
|
980
|
+
}
|
|
981
|
+
/** Whether something else names a native checkbox: an element it points at, or a `<label>` of its own. */
|
|
982
|
+
namedElsewhere(box) {
|
|
983
|
+
return isNative(box) && (!!box.getAttribute('aria-labelledby')?.trim() || !!box.labels?.length);
|
|
984
|
+
}
|
|
985
|
+
/** Writes the name this element gives a checkbox, or takes back the one it gave. */
|
|
986
|
+
rename(box, name) {
|
|
987
|
+
if (name) {
|
|
988
|
+
if (this.nameOf(box) !== name) {
|
|
989
|
+
if (isNative(box))
|
|
990
|
+
box.setAttribute('aria-label', name);
|
|
991
|
+
else
|
|
992
|
+
box.label = name;
|
|
993
|
+
}
|
|
994
|
+
this.named.set(box, name);
|
|
995
|
+
}
|
|
996
|
+
else if (this.named.has(box)) {
|
|
997
|
+
if (this.nameOf(box) === this.named.get(box)) {
|
|
998
|
+
if (isNative(box))
|
|
999
|
+
box.removeAttribute('aria-label');
|
|
1000
|
+
else
|
|
1001
|
+
box.label = '';
|
|
1002
|
+
}
|
|
1003
|
+
this.named.delete(box);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* TBL-46: a row's checkbox is named by its own name (the row's `selectLabel`); where it has none, by the text of the
|
|
1008
|
+
* row's header cell; with neither it has no name, which a debug build says once per table.
|
|
1009
|
+
*/
|
|
1010
|
+
nameRow(row, box) {
|
|
1011
|
+
const own = this.nameOf(box);
|
|
1012
|
+
if ((own && own !== this.named.get(box)) || this.namedElsewhere(box)) {
|
|
1013
|
+
this.named.delete(box);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
const lead = row.cells[1];
|
|
1017
|
+
const header = lead && (lead.localName === 'th' || this.rowHeaders) ? (lead.textContent ?? '').trim().replace(/\s+/g, ' ') : '';
|
|
1018
|
+
this.rename(box, header);
|
|
1019
|
+
if (!header)
|
|
1020
|
+
report(this, 'TBL-46', 'a row that can be chosen has a checkbox without a name; give the checkbox a label, or the row a header cell');
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* TBL-46: the checkbox for every row is named by `select-all-label`, else by the product's words, and by nothing
|
|
1024
|
+
* else of the table's. Where neither gives it, a name the product wrote on the checkbox itself stands; without one
|
|
1025
|
+
* the checkbox is still drawn and the missing word is recorded.
|
|
1026
|
+
*/
|
|
1027
|
+
nameAll(box) {
|
|
1028
|
+
const name = this.words.get('selectAllLabel', this.selectAllLabel);
|
|
1029
|
+
if (name) {
|
|
1030
|
+
this.rename(box, name);
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
this.rename(box, '');
|
|
1034
|
+
if (!this.nameOf(box) && !this.namedElsewhere(box))
|
|
1035
|
+
this.words.missing('selectAllLabel', { id: 'TBL-46', effect: 'the checkbox that chooses every row has no name' });
|
|
1036
|
+
}
|
|
1037
|
+
listenChoices(chooses) {
|
|
1038
|
+
if (chooses === this.chooses)
|
|
1039
|
+
return;
|
|
1040
|
+
this.chooses = chooses;
|
|
1041
|
+
for (const [type, listener] of this.choiceListeners) {
|
|
1042
|
+
if (chooses)
|
|
1043
|
+
this.addEventListener(type, listener);
|
|
1044
|
+
else
|
|
1045
|
+
this.removeEventListener(type, listener);
|
|
1046
|
+
}
|
|
1047
|
+
if (!chooses)
|
|
1048
|
+
this.focusedBox = null;
|
|
1049
|
+
}
|
|
1050
|
+
/** The checkbox an event came from, in a selection cell of this table's own rows, and its row: a table inside a cell is the product's. */
|
|
1051
|
+
choiceOf(target) {
|
|
1052
|
+
const box = target instanceof HTMLElement && (target.localName === 'tanrei-checkbox' || (target.localName === 'input' && target.type === 'checkbox')) ? target : null;
|
|
1053
|
+
const cell = box?.parentElement;
|
|
1054
|
+
const row = cell?.parentElement;
|
|
1055
|
+
if (!box || !cell?.matches(SELECTION_CELL) || !(row instanceof HTMLTableRowElement) || row.cells[0] !== cell || row.parentElement?.parentElement !== this.table)
|
|
1056
|
+
return null;
|
|
1057
|
+
return { box, row };
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* TBL-25: the rows were given again — in another order, or others — and the checkbox that had focus went with its
|
|
1061
|
+
* row, and focus with it. The checkbox of the row with the same value takes it (the header's, where it was the
|
|
1062
|
+
* header's), where there is one and focus went nowhere else.
|
|
1063
|
+
*/
|
|
1064
|
+
keepBoxFocus(table) {
|
|
1065
|
+
const kept = this.focusedBox;
|
|
1066
|
+
if (!kept)
|
|
1067
|
+
return;
|
|
1068
|
+
const active = this.getRootNode().activeElement;
|
|
1069
|
+
if (active === kept.box)
|
|
1070
|
+
return;
|
|
1071
|
+
this.focusedBox = null;
|
|
1072
|
+
if (active && active !== document.body)
|
|
1073
|
+
return;
|
|
1074
|
+
const row = kept.value === null ? table.tHead?.rows[0] : this.choosable(table).find(([each]) => each.getAttribute('data-value') === kept.value)?.[0];
|
|
1075
|
+
const box = this.boxIn(row);
|
|
1076
|
+
if (!box)
|
|
1077
|
+
return;
|
|
1078
|
+
// A checkbox that has just been placed takes focus once it has drawn the control that holds it — if focus is
|
|
1079
|
+
// still nowhere then.
|
|
1080
|
+
const drawn = box.updateComplete;
|
|
1081
|
+
if (!drawn)
|
|
1082
|
+
box.focus({ preventScroll: true });
|
|
1083
|
+
else {
|
|
1084
|
+
void drawn.then(() => {
|
|
1085
|
+
const now = this.getRootNode().activeElement;
|
|
1086
|
+
if (box.isConnected && (!now || now === document.body))
|
|
1087
|
+
box.focus({ preventScroll: true });
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* TBL-36's promise for a checkbox: focus came to one that lies under a header row or a status line kept in view —
|
|
1093
|
+
* the browser brought it into the box, not out from under them. The box scrolls by what is covered.
|
|
1094
|
+
*/
|
|
1095
|
+
revealBox(box) {
|
|
1096
|
+
const cell = box.parentElement;
|
|
1097
|
+
if (cell.parentElement?.parentElement?.localName !== 'tbody')
|
|
1098
|
+
return;
|
|
1099
|
+
const at = cell.getBoundingClientRect();
|
|
1100
|
+
let y = 0;
|
|
1101
|
+
const head = this.stickyHeader ? this.table?.tHead?.rows[0]?.cells[0]?.getBoundingClientRect() : null;
|
|
1102
|
+
if (head && head.height > 0)
|
|
1103
|
+
y = Math.min(0, at.top - head.bottom);
|
|
1104
|
+
const status = this.statusLine?.getBoundingClientRect();
|
|
1105
|
+
if (!y && status && status.height > 0)
|
|
1106
|
+
y = Math.max(0, at.bottom - status.top);
|
|
1107
|
+
if (y)
|
|
1108
|
+
this.scrollBy(0, y);
|
|
1109
|
+
}
|
|
1110
|
+
/** The table's name as its scroll region carries it (TBL-22): the caption, else the name the table itself has. */
|
|
1111
|
+
regionName(table) {
|
|
1112
|
+
const caption = table.caption;
|
|
1113
|
+
if (caption?.textContent?.trim()) {
|
|
1114
|
+
if (!caption.id)
|
|
1115
|
+
caption.id = `tanrei-table-caption-${++captions}`;
|
|
1116
|
+
return ['aria-labelledby', caption.id];
|
|
1117
|
+
}
|
|
1118
|
+
const labelledby = table.getAttribute('aria-labelledby')?.trim();
|
|
1119
|
+
if (labelledby)
|
|
1120
|
+
return ['aria-labelledby', labelledby];
|
|
1121
|
+
const label = table.getAttribute('aria-label')?.trim();
|
|
1122
|
+
return label ? ['aria-label', label] : null;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* TBL-3, TBL-7: a column's alignment and wrapping, named on its header cell, reach its cells through one rule per
|
|
1126
|
+
* position; the positions are written on the wrapper. TBL-14: so is the number of columns, which a row cannot exceed.
|
|
1127
|
+
*/
|
|
1128
|
+
readColumns(table) {
|
|
1129
|
+
const header = table.tHead?.rows[0] ?? null;
|
|
1130
|
+
const [center, end, nowrap] = [[], [], []];
|
|
1131
|
+
let position = 0;
|
|
1132
|
+
let columns = 0;
|
|
1133
|
+
for (const cell of header?.cells ?? []) {
|
|
1134
|
+
position++;
|
|
1135
|
+
columns += cell.colSpan;
|
|
1136
|
+
const align = cell.getAttribute('data-align') ?? RENDERED_ALIGN[cell.getAttribute('align') ?? ''];
|
|
1137
|
+
if (align === 'center')
|
|
1138
|
+
center.push(position);
|
|
1139
|
+
else if (align === 'end')
|
|
1140
|
+
end.push(position);
|
|
1141
|
+
if (cell.getAttribute('data-wrap') === 'false')
|
|
1142
|
+
nowrap.push(position);
|
|
1143
|
+
}
|
|
1144
|
+
// A table with no header row has as many columns as its first row has cells.
|
|
1145
|
+
if (!header)
|
|
1146
|
+
for (const cell of table.rows[0]?.cells ?? [])
|
|
1147
|
+
columns += cell.colSpan;
|
|
1148
|
+
mark(this, 'data-columns-center', center.length ? list(center) : null);
|
|
1149
|
+
mark(this, 'data-columns-end', end.length ? list(end) : null);
|
|
1150
|
+
mark(this, 'data-columns-nowrap', nowrap.length ? list(nowrap) : null);
|
|
1151
|
+
mark(this, 'data-columns', columns ? String(columns) : null);
|
|
1152
|
+
// TBL-48: the one cell of the row that stands for no rows spans every column, whatever the product counted.
|
|
1153
|
+
for (const body of table.tBodies) {
|
|
1154
|
+
const row = body.rows.length === 1 ? body.rows[0] : null;
|
|
1155
|
+
const cell = row?.getAttribute('data-part') === 'empty' && row.cells.length === 1 ? row.cells[0] : null;
|
|
1156
|
+
if (cell && columns && cell.colSpan !== columns)
|
|
1157
|
+
cell.colSpan = columns;
|
|
1158
|
+
}
|
|
1159
|
+
adopt(this.getRootNode(), positionSheet(Math.max(0, ...center, ...end, ...nowrap), columns));
|
|
1160
|
+
}
|
|
1161
|
+
/** TBL-6: where `rowHeaders` is set on a table whose first cells are plain cells, they are exposed as row headers. */
|
|
1162
|
+
readRowHeaders(table) {
|
|
1163
|
+
if (this.rowHeaders) {
|
|
1164
|
+
// TBL-42: the first column is the first column of data — the one after the selection column.
|
|
1165
|
+
for (const cell of table.querySelectorAll(`:scope > :is(tbody, tfoot) > tr > td:first-child:not([role], ${SELECTION_CELL}), :scope > :is(tbody, tfoot) > tr > td${SELECTION_CELL}:first-child + td:not([role])`)) {
|
|
1166
|
+
cell.setAttribute('role', 'rowheader');
|
|
1167
|
+
this.rowHeaderCells.add(cell);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
else if (this.rowHeaderCells.size) {
|
|
1171
|
+
for (const cell of this.rowHeaderCells)
|
|
1172
|
+
if (cell.getAttribute('role') === 'rowheader')
|
|
1173
|
+
cell.removeAttribute('role');
|
|
1174
|
+
this.rowHeaderCells.clear();
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
/** What a debug build says about a table it still draws (TBL-13, TBL-14, TBL-23). */
|
|
1178
|
+
check(table) {
|
|
1179
|
+
if (!this.regionName(table))
|
|
1180
|
+
report(this, 'TBL-23', 'the table has no name; give it a caption, or a label where a heading above it already says what it is');
|
|
1181
|
+
const foot = table.tFoot;
|
|
1182
|
+
if (foot && [...table.tBodies].some((body) => foot.compareDocumentPosition(body) & Node.DOCUMENT_POSITION_FOLLOWING)) {
|
|
1183
|
+
report(this, 'TBL-13', 'a body row is given after a footer row; every body row is still drawn before every footer row');
|
|
1184
|
+
}
|
|
1185
|
+
// TBL-32, TBL-33: a sort button without a label is not drawn; the rows have one order.
|
|
1186
|
+
const header = [...(table.tHead?.rows[0]?.cells ?? [])];
|
|
1187
|
+
const controls = header.filter((cell) => cell.hasAttribute('aria-sort')).map((cell) => cell.querySelector(OWN_CONTROL));
|
|
1188
|
+
if (controls.some((control) => control && !control.textContent?.trim())) {
|
|
1189
|
+
report(this, 'TBL-32', 'a sortable column has no header; it is drawn as a column that is not sortable');
|
|
1190
|
+
}
|
|
1191
|
+
const sorted = header.filter((cell) => ['ascending', 'descending'].includes(cell.getAttribute('aria-sort') ?? '') && cell.querySelector(OWN_CONTROL));
|
|
1192
|
+
if (sorted.length > 1)
|
|
1193
|
+
report(this, 'TBL-33', `${sorted.length} columns say that the rows are in their order; the rows have one order, and each header is drawn as it is given`);
|
|
1194
|
+
// TBL-50: a placeholder row in a table that is not loading is drawn all the same.
|
|
1195
|
+
if (!this.loading && table.getAttribute('aria-busy') !== 'true' && table.querySelector(':scope > tbody > tr[data-placeholder]')) {
|
|
1196
|
+
report(this, 'TBL-50', 'a row is a placeholder while the table is not loading; it is drawn all the same, and hidden from assistive technology');
|
|
1197
|
+
}
|
|
1198
|
+
const columns = Number(this.getAttribute('data-columns') ?? 0);
|
|
1199
|
+
if (!columns)
|
|
1200
|
+
return;
|
|
1201
|
+
// TBL-14: a row with more cells than the table has columns, and one with fewer — counted until a cell spans rows,
|
|
1202
|
+
// after which a row may rightly hold fewer.
|
|
1203
|
+
let [more, fewer, spans] = [false, false, false];
|
|
1204
|
+
for (const row of table.rows) {
|
|
1205
|
+
let held = 0;
|
|
1206
|
+
for (const cell of row.cells) {
|
|
1207
|
+
held += cell.colSpan;
|
|
1208
|
+
spans ||= cell.rowSpan > 1;
|
|
1209
|
+
}
|
|
1210
|
+
if (!more && row.cells.length > columns) {
|
|
1211
|
+
more = true;
|
|
1212
|
+
report(this, 'TBL-14', `a row holds ${row.cells.length} cells and the table has ${columns} columns; the cells after the last column are not drawn`);
|
|
1213
|
+
}
|
|
1214
|
+
else if (!fewer && !spans && held < columns) {
|
|
1215
|
+
fewer = true;
|
|
1216
|
+
report(this, 'TBL-14', `a row holds ${held} cells and the table has ${columns} columns; the places of the missing cells are left empty at the row's end`);
|
|
1217
|
+
}
|
|
1218
|
+
if (more && (fewer || spans))
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* What the sizes say (TBL-19 to TBL-22), read from the layout and written to nothing: whether the table scrolls in
|
|
1224
|
+
* its box — and so is a focus stop and a region — where the scroll is, and whether a first column that stays is
|
|
1225
|
+
* narrow enough to stay. `sized()` writes it.
|
|
1226
|
+
*
|
|
1227
|
+
* @internal
|
|
1228
|
+
*/
|
|
1229
|
+
sizes() {
|
|
1230
|
+
const table = this.table;
|
|
1231
|
+
const range = this.scrollWidth - this.clientWidth;
|
|
1232
|
+
// TBL-20: a first column wider than half of the box scrolls with the others.
|
|
1233
|
+
const first = this.stickyFirstColumn ? (table?.rows[0]?.cells[0] ?? null) : null;
|
|
1234
|
+
// TBL-42: with a selection column the first column is the one after it, and the two are kept — and let go — together.
|
|
1235
|
+
const lead = first?.matches(SELECTION_CELL) ? first.nextElementSibling : first;
|
|
1236
|
+
const select = first && first !== lead && this.mode === 'multiple' ? first : null;
|
|
1237
|
+
const released = !!lead && lead.offsetWidth + (select?.offsetWidth ?? 0) > this.clientWidth / 2;
|
|
1238
|
+
return {
|
|
1239
|
+
scrolls: !!table && (range > SLACK || this.scrollHeight - this.clientHeight > SLACK),
|
|
1240
|
+
released,
|
|
1241
|
+
selection: select && !released ? select.getBoundingClientRect().width : -1,
|
|
1242
|
+
direction: (this.direction ??= getComputedStyle(this).direction),
|
|
1243
|
+
range,
|
|
1244
|
+
offset: Math.abs(this.scrollLeft),
|
|
1245
|
+
top: this.scrollTop,
|
|
1246
|
+
below: this.scrollHeight - this.clientHeight - this.scrollTop,
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Writes what `sizes()` read, as attributes of the wrapper alone. Called for every table of a measure after every
|
|
1251
|
+
* one of them was read, so the layout is computed once for all of them.
|
|
1252
|
+
*
|
|
1253
|
+
* @internal
|
|
1254
|
+
*/
|
|
1255
|
+
sized(sizes) {
|
|
1256
|
+
if (!this.isConnected)
|
|
1257
|
+
return;
|
|
1258
|
+
const table = this.table;
|
|
1259
|
+
mark(this, 'data-first-column-released', sizes.released ? '' : null);
|
|
1260
|
+
// TBL-42: where the selection column ends is where the first column is held (table.css).
|
|
1261
|
+
const kept = sizes.selection >= 0 ? `${sizes.selection}px` : '';
|
|
1262
|
+
mark(this, 'data-selection-kept', kept ? '' : null);
|
|
1263
|
+
if (this.style.getPropertyValue('--_table-selection-size') !== kept) {
|
|
1264
|
+
if (kept)
|
|
1265
|
+
this.style.setProperty('--_table-selection-size', kept);
|
|
1266
|
+
else
|
|
1267
|
+
this.style.removeProperty('--_table-selection-size');
|
|
1268
|
+
}
|
|
1269
|
+
this.scrolled(sizes);
|
|
1270
|
+
// TBL-22: one stop in the focus order and a region with the table's name while it scrolls, and neither otherwise.
|
|
1271
|
+
const name = sizes.scrolls && table ? this.regionName(table) : null;
|
|
1272
|
+
const wanted = {
|
|
1273
|
+
tabindex: sizes.scrolls ? '0' : null,
|
|
1274
|
+
role: sizes.scrolls ? 'region' : null,
|
|
1275
|
+
'aria-labelledby': name?.[0] === 'aria-labelledby' ? name[1] : null,
|
|
1276
|
+
'aria-label': name?.[0] === 'aria-label' ? name[1] : null,
|
|
1277
|
+
};
|
|
1278
|
+
for (const [attribute, value] of Object.entries(wanted)) {
|
|
1279
|
+
if (value === null) {
|
|
1280
|
+
if (this.stop.delete(attribute))
|
|
1281
|
+
this.removeAttribute(attribute);
|
|
1282
|
+
}
|
|
1283
|
+
else if (this.stop.has(attribute) || !this.hasAttribute(attribute)) {
|
|
1284
|
+
// What the product wrote on the element itself is left as it is.
|
|
1285
|
+
mark(this, attribute, value);
|
|
1286
|
+
this.stop.add(attribute);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
/** TBL-19, TBL-21, TBL-51: where the scroll is — rows under the header row or the status line, columns beyond an inline edge of the box. */
|
|
1291
|
+
scrolled({ range, offset, top, below }) {
|
|
1292
|
+
this.offset = offset;
|
|
1293
|
+
mark(this, 'data-more-start', range > SLACK && offset > SLACK ? '' : null);
|
|
1294
|
+
mark(this, 'data-more-end', range > SLACK && offset < range - SLACK ? '' : null);
|
|
1295
|
+
mark(this, 'data-more-above', top > SLACK ? '' : null);
|
|
1296
|
+
// TBL-51: rows lie under a status line — the line above it is drawn whatever the separation is.
|
|
1297
|
+
mark(this, 'data-more-below', this.statusLine && below > SLACK ? '' : null);
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* TBL-26: a `dir` changed somewhere above. Where that turned this table, the column a person was looking at is
|
|
1301
|
+
* brought back: the same distance from the start, in the new direction.
|
|
1302
|
+
*
|
|
1303
|
+
* @internal
|
|
1304
|
+
*/
|
|
1305
|
+
turned() {
|
|
1306
|
+
if (!this.isConnected || this.direction === null)
|
|
1307
|
+
return;
|
|
1308
|
+
const direction = getComputedStyle(this).direction;
|
|
1309
|
+
if (direction === this.direction)
|
|
1310
|
+
return;
|
|
1311
|
+
this.direction = direction;
|
|
1312
|
+
const kept = this.offset;
|
|
1313
|
+
if (kept > SLACK)
|
|
1314
|
+
this.scrollLeft = direction === 'rtl' ? -kept : kept;
|
|
1315
|
+
this.readScroll();
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
if (!customElements.get('tanrei-table'))
|
|
1319
|
+
customElements.define('tanrei-table', TanreiTable);
|
|
1320
|
+
//# sourceMappingURL=table.js.map
|