@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,902 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { hiddenHost } from '../../primitives/hidden.js';
|
|
3
|
+
import { AvailabilityController, FollowController, SHORTCUT_UPDATE, SystemWatchController, anchorGone, choiceAttribute as choiceConverter, chordsConverter, chordsOf, compChoice, crossOffsetAttribute as crossNumeric, findInteractive, numericAttribute as numeric, registerOverlay, report, shadeFilter, shadowLayers, styleQueries, usableLength as usable, } from '../../primitives/index.js';
|
|
4
|
+
// TIP-27: a plain tooltip draws its shortcut with the keyboard shortcut, which the tooltip defines wherever it is imported.
|
|
5
|
+
import '../keyboard-shortcut/keyboard-shortcut.js';
|
|
6
|
+
import { ARROW_PROPERTY, CHOICE, INVERSE_PROPERTY, styles } from './tooltip.styles.js';
|
|
7
|
+
import { PLACEMENTS, placeTooltip } from './tooltip-placement.js';
|
|
8
|
+
export { placeTooltip } from './tooltip-placement.js';
|
|
9
|
+
/** TIP-17: each prop, its attribute and the token it falls back to. */
|
|
10
|
+
const WAITS = [
|
|
11
|
+
{ prop: 'showDelay', attribute: 'show-delay', token: 'comp.tooltip.motion.show-delay' },
|
|
12
|
+
{ prop: 'hideDelay', attribute: 'hide-delay', token: 'comp.tooltip.motion.hide-delay' },
|
|
13
|
+
{ prop: 'touchTimeout', attribute: 'touch-timeout', token: 'comp.tooltip.timeout.touch' },
|
|
14
|
+
];
|
|
15
|
+
/** TIP-27: the element that takes focus inside `element`: itself, or the native control a component draws in its shadow root. */
|
|
16
|
+
function focusableOf(element) {
|
|
17
|
+
for (let current = element;;) {
|
|
18
|
+
const inner = [...(current.shadowRoot?.children ?? [])].map((child) => findInteractive(child)).find((found) => found !== null);
|
|
19
|
+
if (!inner)
|
|
20
|
+
return current;
|
|
21
|
+
current = inner;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** TIP-8: the tooltip showing in this window, if any — at most one. */
|
|
25
|
+
let showing = null;
|
|
26
|
+
/** TIP-28: the tooltip still fading out after the pointer or the focus left its anchor, if any. */
|
|
27
|
+
let fading = null;
|
|
28
|
+
/** TIP-28: whether tooltips are warm in this window — one closed, a moment ago, because the pointer or the focus left its anchor. */
|
|
29
|
+
let warm = false;
|
|
30
|
+
let warmTimer;
|
|
31
|
+
/** TIP-28: the next tooltip of this window, for `duration` ms, appears at once and whole. */
|
|
32
|
+
function warmFor(duration) {
|
|
33
|
+
clearTimeout(warmTimer);
|
|
34
|
+
warm = duration > 0;
|
|
35
|
+
if (warm)
|
|
36
|
+
warmTimer = setTimeout(() => (warm = false), duration);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Describes an element in a few words when a person points at it, focuses it with the keyboard or long-presses it,
|
|
40
|
+
* without taking focus or blocking anything.
|
|
41
|
+
*
|
|
42
|
+
* Contract: specs/tooltip.spec.json. Wraps its anchor (the default slot). The drawn tooltip is a `popover="manual"`
|
|
43
|
+
* element in the shadow root, in the top layer — above an open modal `<dialog>` — placed against the anchor by script:
|
|
44
|
+
* on the side and with the alignment `placement` names, `offset` away and moved along the side by `crossOffset`, flipped
|
|
45
|
+
* to the opposite side, shifted along it and, in a window smaller than itself, held inside it; it keeps the side it is on
|
|
46
|
+
* while that side has room, follows the anchor while open and closes when nothing of the anchor can be seen. It is a
|
|
47
|
+
* read overlay: it never takes focus and holds nothing focusable.
|
|
48
|
+
*
|
|
49
|
+
* It opens after a fine pointer rests on the anchor for the show delay (at once while tooltips are warm: another is open
|
|
50
|
+
* or fading, or one closed a moment ago), at once on keyboard focus, and on a touch long-press; it stays while the pointer
|
|
51
|
+
* is over the anchor, the gap between the anchor and the tooltip, or the tooltip, or the anchor has keyboard focus, and
|
|
52
|
+
* closes on Escape, an activation of the anchor, a press on it, the hide delay after the pointer left, or the touch
|
|
53
|
+
* timeout after the finger lifted. The show delay, hide delay and touch timeout are `showDelay`, `hideDelay` and
|
|
54
|
+
* `touchTimeout` in milliseconds (0 is at once), or the tokens `motion.show-delay`, `motion.hide-delay` and
|
|
55
|
+
* `timeout.touch` while unset. Opening and closing by itself fires `toggle`; setting `open` does not.
|
|
56
|
+
*
|
|
57
|
+
* It comes out of the anchor's side: it fades in while it grows from `motion.enter-scale` and travels
|
|
58
|
+
* `motion.enter-offset`, the growth fixed where an arrow points or would point, and goes back the same way; a motion that
|
|
59
|
+
* is interrupted turns round from where it is, a warm tooltip appears whole at once, and where motion is reduced it
|
|
60
|
+
* fades alone. Its place is never animated.
|
|
61
|
+
*
|
|
62
|
+
* `arrow` draws a triangle that points at the anchor, one shape with the container; `inverse` draws it in the opposite
|
|
63
|
+
* scheme's colors (true) or on a surface of the scheme (false). Left unset, each takes the system's choice:
|
|
64
|
+
* `--tanrei-comp-tooltip-arrow-visible` (off in the default system) and its form's `-plain-container-inverse` (on) or
|
|
65
|
+
* `-rich-container-inverse` (off). `shortcut` writes the keys of the anchor's command after a plain tooltip's text and
|
|
66
|
+
* gives them to the anchor as `aria-keyshortcuts`.
|
|
67
|
+
*
|
|
68
|
+
* While `describes` is true (the default; the attribute `no-describe` turns it off) the text — after the title, for a
|
|
69
|
+
* rich tooltip — is the anchor's `aria-description`, set on the first focusable element slotted in (a Tanrei component
|
|
70
|
+
* forwards it from its host to its native element), whether or not the tooltip is open.
|
|
71
|
+
*
|
|
72
|
+
* Every visual value comes from `--tanrei-comp-tooltip-*` tokens.
|
|
73
|
+
*
|
|
74
|
+
* @tag tanrei-tooltip
|
|
75
|
+
* @slot - The anchor: the element the tooltip describes.
|
|
76
|
+
* @csspart container - The drawn tooltip: its color, corners, elevation and padding.
|
|
77
|
+
* @csspart arrow - The triangle that points at the anchor, while one is drawn.
|
|
78
|
+
* @csspart title - The heading of a rich tooltip.
|
|
79
|
+
* @csspart supporting-text - The description.
|
|
80
|
+
* @csspart shortcut - The `<tanrei-keyboard-shortcut>` that writes a plain tooltip's shortcut after its text.
|
|
81
|
+
* @fires {CustomEvent<TanreiTooltipToggleDetail>} toggle - The tooltip opened or closed by itself (hover, focus, long-press, Escape, the touch timeout, another tooltip opening): `detail.open` (and the element's `open`) is the new value.
|
|
82
|
+
*/
|
|
83
|
+
export class TanreiTooltip extends LitElement {
|
|
84
|
+
static { this.styles = [styles, hiddenHost]; }
|
|
85
|
+
static { this.properties = {
|
|
86
|
+
variant: { type: String, reflect: true },
|
|
87
|
+
text: { type: String },
|
|
88
|
+
title: { type: String },
|
|
89
|
+
shortcut: { converter: chordsConverter },
|
|
90
|
+
placement: { type: String, reflect: true },
|
|
91
|
+
offset: { converter: numeric },
|
|
92
|
+
crossOffset: { attribute: 'cross-offset', converter: crossNumeric },
|
|
93
|
+
arrow: { reflect: true, converter: choiceConverter },
|
|
94
|
+
inverse: { reflect: true, converter: choiceConverter },
|
|
95
|
+
describes: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
attribute: 'no-describe',
|
|
98
|
+
reflect: true,
|
|
99
|
+
converter: { fromAttribute: (value) => value === null, toAttribute: (value) => (value ? null : '') },
|
|
100
|
+
},
|
|
101
|
+
open: { type: Boolean, reflect: true },
|
|
102
|
+
showDelay: { attribute: 'show-delay', converter: numeric },
|
|
103
|
+
hideDelay: { attribute: 'hide-delay', converter: numeric },
|
|
104
|
+
touchTimeout: { attribute: 'touch-timeout', converter: numeric },
|
|
105
|
+
layers: { state: true },
|
|
106
|
+
}; }
|
|
107
|
+
constructor() {
|
|
108
|
+
super();
|
|
109
|
+
this.availability = new AvailabilityController(this, 'tooltip');
|
|
110
|
+
/** Plain is one short phrase, by default on the inverse surface; rich an optional title and a few sentences, by default on a raised surface. */
|
|
111
|
+
this.variant = 'plain';
|
|
112
|
+
/** The description. Required. */
|
|
113
|
+
this.text = '';
|
|
114
|
+
/**
|
|
115
|
+
* A heading for a rich tooltip; a plain one ignores it. The attribute is read once and removed from the element, so the
|
|
116
|
+
* browser does not also draw its own `title` tooltip over the anchor.
|
|
117
|
+
*/
|
|
118
|
+
this.title = '';
|
|
119
|
+
/**
|
|
120
|
+
* The keyboard shortcut of the anchor's command, in the keyboard shortcut's key names: one chord per string, pressed
|
|
121
|
+
* in order (`["mod+b"]`); the attribute holds the chords separated by spaces. A plain tooltip writes it after its text
|
|
122
|
+
* for the keyboard the person uses and gives it to the anchor as `aria-keyshortcuts`; a rich one ignores it. It does
|
|
123
|
+
* not make the keys work.
|
|
124
|
+
*/
|
|
125
|
+
this.shortcut = [];
|
|
126
|
+
/**
|
|
127
|
+
* Where it prefers to stand: a side of the anchor (`top`, `bottom`, `start`, `end`), alone to centre it there or with
|
|
128
|
+
* the edge it lines up with (`top-start`, `end-bottom`), or `auto` for the first side with room. It flips to the
|
|
129
|
+
* opposite side when that one has no room, keeping the alignment.
|
|
130
|
+
*/
|
|
131
|
+
this.placement = 'top';
|
|
132
|
+
/** The distance from the anchor's edge, in CSS pixels; 0 lets them touch. Null takes `offset`, the token. */
|
|
133
|
+
this.offset = null;
|
|
134
|
+
/**
|
|
135
|
+
* How far it moves along the side it stands on, in CSS pixels: positive towards the end above or below the anchor,
|
|
136
|
+
* towards the bottom beside it. It never moves the tooltip off the anchor's side. The attribute is `cross-offset`.
|
|
137
|
+
*/
|
|
138
|
+
this.crossOffset = 0;
|
|
139
|
+
/**
|
|
140
|
+
* Whether it draws an arrow that points at the anchor. Null, the default, takes the system's choice
|
|
141
|
+
* (`arrow.visible`, off in the default system). The attribute: absent is null, `arrow` is true, `arrow="false"` is false.
|
|
142
|
+
*/
|
|
143
|
+
this.arrow = null;
|
|
144
|
+
/**
|
|
145
|
+
* Whether it is drawn inverse — in the opposite scheme's colors. False draws it on a surface of the scheme; null, the
|
|
146
|
+
* default, takes its form's choice (`plain.container.inverse`, on in the default system, or `rich.container.inverse`,
|
|
147
|
+
* off). The attribute: absent is null, `inverse` is true, `inverse="false"` is false. Colors and elevation only.
|
|
148
|
+
*/
|
|
149
|
+
this.inverse = null;
|
|
150
|
+
/** Whether the text is the anchor's accessible description. Set `no-describe` when the text repeats the anchor's name. */
|
|
151
|
+
this.describes = true;
|
|
152
|
+
/** Whether the tooltip is showing. It opens and closes itself and fires `toggle`; set it to show a tooltip on your own. */
|
|
153
|
+
this.open = false;
|
|
154
|
+
/**
|
|
155
|
+
* How long, in ms, a fine pointer rests on the anchor before it opens; 0 opens it at once. Null takes
|
|
156
|
+
* `motion.show-delay`. Hover alone: keyboard focus still opens it at once. Not scaled by the motion dial.
|
|
157
|
+
*/
|
|
158
|
+
this.showDelay = null;
|
|
159
|
+
/**
|
|
160
|
+
* How long, in ms, it waits after the pointer has left the anchor, the gap and the tooltip; 0 closes it at once. Null
|
|
161
|
+
* takes `motion.hide-delay`. It stays hoverable at 0, because the gap counts as hover.
|
|
162
|
+
*/
|
|
163
|
+
this.hideDelay = null;
|
|
164
|
+
/**
|
|
165
|
+
* How long, in ms, a tooltip opened by a long-press stays after the finger lifts; 0 closes it as the finger lifts. Null
|
|
166
|
+
* takes `timeout.touch`.
|
|
167
|
+
*/
|
|
168
|
+
this.touchTimeout = null;
|
|
169
|
+
this.hovering = false;
|
|
170
|
+
this.keyboard = false;
|
|
171
|
+
/** TIP-4, TIP-6: closed by Escape, an activation or a press on it: it stays closed until the pointer comes back or focus does. */
|
|
172
|
+
this.dismissed = false;
|
|
173
|
+
/** TIP-28: it is closing because the pointer or the focus left its anchor, which keeps tooltips warm. */
|
|
174
|
+
this.left = false;
|
|
175
|
+
/** TIP-28: it opened by itself while tooltips were warm, so it appears whole — noted as it opens, before the other one goes. */
|
|
176
|
+
this.tookOver = false;
|
|
177
|
+
this.touchShown = false;
|
|
178
|
+
this.shown = false;
|
|
179
|
+
this.lastLayout = '';
|
|
180
|
+
/** TIP-9: the side it stands on, kept while that side has room; and the placement and direction it was taken for. */
|
|
181
|
+
this.side = null;
|
|
182
|
+
this.placedFor = '';
|
|
183
|
+
/** TIP-29: which closing motion is running; an earlier one that ends late changes nothing. */
|
|
184
|
+
this.motionRun = 0;
|
|
185
|
+
/** TIP-25: the elevation's layers, drawn round the container and its arrow as one shape; and what they were read from. */
|
|
186
|
+
this.layers = [];
|
|
187
|
+
this.shade = '';
|
|
188
|
+
/** The element this tooltip put `aria-description` on, and what it wrote. */
|
|
189
|
+
this.described = null;
|
|
190
|
+
/** TIP-27: the element this tooltip put `aria-keyshortcuts` on, and what it wrote. */
|
|
191
|
+
this.keyed = null;
|
|
192
|
+
this.removingTitle = false;
|
|
193
|
+
this.unregister = null;
|
|
194
|
+
// ── Pointer (TIP-1, TIP-5, TIP-6) ─────────────────────────────────────────────────────────────────────────────────
|
|
195
|
+
this.onPointerEnter = (event) => {
|
|
196
|
+
// A second enter without a leave (a browser re-sending boundary events) is the same hover (TIP-6).
|
|
197
|
+
if (event.pointerType === 'touch' || this.hovering)
|
|
198
|
+
return;
|
|
199
|
+
this.hovering = true;
|
|
200
|
+
this.dismissed = false;
|
|
201
|
+
document.addEventListener('pointermove', this.onPointerMove, true);
|
|
202
|
+
clearTimeout(this.hideTimer);
|
|
203
|
+
if (this.open)
|
|
204
|
+
return;
|
|
205
|
+
// TIP-8, TIP-28: a person already reading tooltips gets this one at once.
|
|
206
|
+
if (this.takesOver) {
|
|
207
|
+
this.setBySelf(true);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
clearTimeout(this.showTimer);
|
|
211
|
+
const { show } = this.timing();
|
|
212
|
+
if (show === 0) {
|
|
213
|
+
this.setBySelf(true);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this.showTimer = setTimeout(() => {
|
|
217
|
+
if (this.hovering && !this.dismissed)
|
|
218
|
+
this.setBySelf(true);
|
|
219
|
+
}, show);
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* The pointer moved somewhere that is not the anchor, the gap or the tooltip: it left, even if the browser sent no
|
|
223
|
+
* pointerleave.
|
|
224
|
+
*/
|
|
225
|
+
this.onPointerMove = (event) => {
|
|
226
|
+
if (event.pointerType !== 'touch' && !event.composedPath().includes(this))
|
|
227
|
+
this.onPointerLeave(event);
|
|
228
|
+
};
|
|
229
|
+
this.onPointerLeave = (event) => {
|
|
230
|
+
if (event.pointerType === 'touch')
|
|
231
|
+
return;
|
|
232
|
+
// TIP-1: in the gap it is still hovering; the pointer-move listener stays to see it leave the gap.
|
|
233
|
+
if (this.hovering && this.inGap(event.clientX, event.clientY))
|
|
234
|
+
return;
|
|
235
|
+
document.removeEventListener('pointermove', this.onPointerMove, true);
|
|
236
|
+
if (!this.hovering)
|
|
237
|
+
return;
|
|
238
|
+
this.hovering = false;
|
|
239
|
+
clearTimeout(this.showTimer);
|
|
240
|
+
if (!this.open || this.keyboard || this.touchShown)
|
|
241
|
+
return;
|
|
242
|
+
clearTimeout(this.hideTimer);
|
|
243
|
+
const { hide } = this.timing();
|
|
244
|
+
if (hide === 0) {
|
|
245
|
+
this.leave();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.hideTimer = setTimeout(() => {
|
|
249
|
+
if (!this.hovering && !this.keyboard)
|
|
250
|
+
this.leave();
|
|
251
|
+
}, hide);
|
|
252
|
+
};
|
|
253
|
+
/** TIP-6: an activation of the anchor closes the tooltip, which stays closed until the pointer comes back. */
|
|
254
|
+
this.onActivate = (event) => {
|
|
255
|
+
if (this.surface && event.composedPath().includes(this.surface))
|
|
256
|
+
return;
|
|
257
|
+
this.dismiss();
|
|
258
|
+
};
|
|
259
|
+
// ── Keyboard (TIP-2, TIP-4) ───────────────────────────────────────────────────────────────────────────────────────
|
|
260
|
+
this.onFocusIn = (event) => {
|
|
261
|
+
const target = event.composedPath()[0];
|
|
262
|
+
if (!(target instanceof Element) || !target.matches(':focus-visible'))
|
|
263
|
+
return;
|
|
264
|
+
this.keyboard = true;
|
|
265
|
+
this.dismissed = false;
|
|
266
|
+
this.clearTimers();
|
|
267
|
+
this.setBySelf(true);
|
|
268
|
+
};
|
|
269
|
+
this.onFocusOut = (event) => {
|
|
270
|
+
const to = event.relatedTarget;
|
|
271
|
+
if (to && (this.contains(to) || this.renderRoot.contains(to)))
|
|
272
|
+
return;
|
|
273
|
+
this.keyboard = false;
|
|
274
|
+
if (!this.hovering && !this.touchShown) {
|
|
275
|
+
clearTimeout(this.showTimer);
|
|
276
|
+
this.leave();
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
this.onKeyDown = (event) => {
|
|
280
|
+
if (event.key === 'Enter' || event.key === ' ')
|
|
281
|
+
this.dismiss();
|
|
282
|
+
};
|
|
283
|
+
/** TIP-4: Escape closes an open tooltip without moving focus, and goes no further (an enclosing dialog stays open). */
|
|
284
|
+
this.onEscape = (event) => {
|
|
285
|
+
if (event.key !== 'Escape' || !this.open)
|
|
286
|
+
return;
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
event.stopImmediatePropagation();
|
|
289
|
+
this.dismiss();
|
|
290
|
+
};
|
|
291
|
+
// ── Touch (TIP-3) ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
292
|
+
/** A touch long-press is the platform's `contextmenu`: the tooltip opens instead of a menu, and the anchor is not activated. */
|
|
293
|
+
this.onContextMenu = (event) => {
|
|
294
|
+
if (event.pointerType !== 'touch' || !this.hasText)
|
|
295
|
+
return;
|
|
296
|
+
event.preventDefault();
|
|
297
|
+
this.clearTimers();
|
|
298
|
+
this.dismissed = false;
|
|
299
|
+
this.touchShown = true;
|
|
300
|
+
this.setBySelf(true);
|
|
301
|
+
document.addEventListener('pointerup', this.onTouchEnd, true);
|
|
302
|
+
document.addEventListener('pointercancel', this.onTouchEnd, true);
|
|
303
|
+
};
|
|
304
|
+
/** The finger lifted: it stays for the touch timeout (TIP-17: 0 closes it now, having shown for the whole press). */
|
|
305
|
+
this.onTouchEnd = (event) => {
|
|
306
|
+
if (event.pointerType !== 'touch')
|
|
307
|
+
return;
|
|
308
|
+
document.removeEventListener('pointerup', this.onTouchEnd, true);
|
|
309
|
+
document.removeEventListener('pointercancel', this.onTouchEnd, true);
|
|
310
|
+
clearTimeout(this.touchTimer);
|
|
311
|
+
const close = () => {
|
|
312
|
+
this.touchShown = false;
|
|
313
|
+
if (!this.keyboard && !this.hovering)
|
|
314
|
+
this.setBySelf(false);
|
|
315
|
+
};
|
|
316
|
+
const { touch } = this.timing();
|
|
317
|
+
if (touch === 0)
|
|
318
|
+
close();
|
|
319
|
+
else
|
|
320
|
+
this.touchTimer = setTimeout(close, touch);
|
|
321
|
+
};
|
|
322
|
+
/** TIP-3, TIP-13: a touch anywhere else closes it sooner; a press on the tooltip closes it and goes no further. */
|
|
323
|
+
this.onDocumentPress = (event) => {
|
|
324
|
+
const path = event.composedPath();
|
|
325
|
+
if (this.surface && path.includes(this.surface)) {
|
|
326
|
+
event.preventDefault();
|
|
327
|
+
event.stopPropagation();
|
|
328
|
+
this.touchShown = false;
|
|
329
|
+
this.swallowRelease();
|
|
330
|
+
this.dismiss();
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (event.pointerType === 'touch' && this.touchShown && !path.includes(this)) {
|
|
334
|
+
this.touchShown = false;
|
|
335
|
+
this.dismiss();
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
/** TIP-13: nothing of a press on the tooltip reaches what lies under it, nor the tooltip's ancestors. */
|
|
339
|
+
this.swallow = (event) => {
|
|
340
|
+
event.stopPropagation();
|
|
341
|
+
if (event.type === 'click' || event.type === 'mousedown')
|
|
342
|
+
event.preventDefault();
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* TIP-9: follows the anchor while it moves (scrolling, layout, the viewport) for as long as it is shown — asked by
|
|
346
|
+
* FollowController when something can have moved, frame by frame only while something does.
|
|
347
|
+
*/
|
|
348
|
+
this.follow = () => {
|
|
349
|
+
const box = (this.anchor ?? this).getBoundingClientRect();
|
|
350
|
+
const surface = this.surface;
|
|
351
|
+
// The surface's own size too, unrounded: its text reflowing (a web font arriving after it opened) moves the centre.
|
|
352
|
+
const size = surface?.getBoundingClientRect();
|
|
353
|
+
// TIP-19: the layout direction too — `start` and `end` are sides of it (TIP-20), so a change of it places the container again.
|
|
354
|
+
const layout = `${box.x},${box.y},${box.width},${box.height},${document.documentElement.clientWidth},${document.documentElement.clientHeight},${size?.width},${size?.height},${this.drawnAs}`;
|
|
355
|
+
if (layout === this.lastLayout)
|
|
356
|
+
return false;
|
|
357
|
+
this.lastLayout = layout;
|
|
358
|
+
this.place();
|
|
359
|
+
return true;
|
|
360
|
+
};
|
|
361
|
+
this.following = new FollowController(this, {
|
|
362
|
+
followed: () => [this.anchor ?? this],
|
|
363
|
+
sized: () => [this.surface],
|
|
364
|
+
check: this.follow,
|
|
365
|
+
});
|
|
366
|
+
this.addEventListener('pointerenter', this.onPointerEnter);
|
|
367
|
+
this.addEventListener('pointerleave', this.onPointerLeave);
|
|
368
|
+
this.addEventListener('focusin', this.onFocusIn);
|
|
369
|
+
this.addEventListener('focusout', this.onFocusOut);
|
|
370
|
+
this.addEventListener('click', this.onActivate);
|
|
371
|
+
this.addEventListener('keydown', this.onKeyDown);
|
|
372
|
+
this.addEventListener('contextmenu', this.onContextMenu);
|
|
373
|
+
}
|
|
374
|
+
createRenderRoot() {
|
|
375
|
+
const root = super.createRenderRoot();
|
|
376
|
+
// TIP-27: the keys it writes changed without it (the keyboard convention of an ancestor): the anchor's shortcut follows.
|
|
377
|
+
root.addEventListener(SHORTCUT_UPDATE, () => this.sync());
|
|
378
|
+
return root;
|
|
379
|
+
}
|
|
380
|
+
attributeChangedCallback(name, old, value) {
|
|
381
|
+
if (name === 'title' && this.removingTitle)
|
|
382
|
+
return;
|
|
383
|
+
super.attributeChangedCallback(name, old, value);
|
|
384
|
+
if (name === 'title' && value !== null) {
|
|
385
|
+
this.removingTitle = true;
|
|
386
|
+
this.removeAttribute('title');
|
|
387
|
+
this.removingTitle = false;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
disconnectedCallback() {
|
|
391
|
+
super.disconnectedCallback();
|
|
392
|
+
document.removeEventListener('pointermove', this.onPointerMove, true);
|
|
393
|
+
this.unregister?.();
|
|
394
|
+
this.unregister = null;
|
|
395
|
+
this.hovering = false;
|
|
396
|
+
this.left = false;
|
|
397
|
+
this.clearTimers();
|
|
398
|
+
this.stopFollowing();
|
|
399
|
+
if (showing === this)
|
|
400
|
+
showing = null;
|
|
401
|
+
if (fading === this)
|
|
402
|
+
fading = null;
|
|
403
|
+
this.shown = false;
|
|
404
|
+
this.side = null;
|
|
405
|
+
this.surface?.classList.remove('open');
|
|
406
|
+
this.describe(null);
|
|
407
|
+
this.key(null, null);
|
|
408
|
+
}
|
|
409
|
+
connectedCallback() {
|
|
410
|
+
super.connectedCallback();
|
|
411
|
+
// POP-24: what it describes is what opened it; a popover that closes takes the tooltips of its controls with it, at
|
|
412
|
+
// once — each closing by itself, as when another tooltip opens (src/primitives/dismiss.ts).
|
|
413
|
+
this.unregister = registerOverlay(this, { openers: () => [this.anchor], open: () => this.open, close: () => this.giveWay() });
|
|
414
|
+
if (this.hasUpdated)
|
|
415
|
+
this.sync();
|
|
416
|
+
}
|
|
417
|
+
/** The placed box: the popover in the top layer. It is never transformed, so its box is the tooltip's at rest (TIP-15). */
|
|
418
|
+
get surface() {
|
|
419
|
+
return this.renderRoot?.querySelector('.surface') ?? null;
|
|
420
|
+
}
|
|
421
|
+
/** TIP-15: what fades, grows and travels: the container and its arrow, inside the placed box. */
|
|
422
|
+
get motion() {
|
|
423
|
+
return this.renderRoot?.querySelector('.motion') ?? null;
|
|
424
|
+
}
|
|
425
|
+
/** The anchor: the first element slotted in. */
|
|
426
|
+
get anchor() {
|
|
427
|
+
const slot = this.renderRoot?.querySelector('slot');
|
|
428
|
+
return slot?.assignedElements({ flatten: true })[0] ?? null;
|
|
429
|
+
}
|
|
430
|
+
get hasText() {
|
|
431
|
+
return this.text.trim() !== '';
|
|
432
|
+
}
|
|
433
|
+
/** TIP-27: the chords a plain tooltip draws; a rich one draws none. */
|
|
434
|
+
get keys() {
|
|
435
|
+
return this.variant === 'rich' ? [] : chordsOf(this.shortcut).filter((chord) => chord.trim() !== '');
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* @internal Whether it is drawn inverse right now (TIP-26): `inverse` when it is true or false, else its form's choice
|
|
439
|
+
* as the cascade gives it at this moment — never cached, and an unknown name is the first value (off).
|
|
440
|
+
*/
|
|
441
|
+
get drawnInverse() {
|
|
442
|
+
return compChoice(this, INVERSE_PROPERTY, CHOICE) === 'on';
|
|
443
|
+
}
|
|
444
|
+
/** TIP-25: whether an arrow is asked for right now: `arrow` when it is true or false, else the system's choice. */
|
|
445
|
+
get wantsArrow() {
|
|
446
|
+
return compChoice(this, ARROW_PROPERTY, CHOICE) === 'on';
|
|
447
|
+
}
|
|
448
|
+
/** TIP-1, TIP-3, TIP-28: the show and hide delays, the touch timeout and the warm time, in ms, as the tokens resolve now. */
|
|
449
|
+
tokenTiming() {
|
|
450
|
+
const probe = this.renderRoot?.querySelector('.timing');
|
|
451
|
+
if (!probe)
|
|
452
|
+
return { show: 0, hide: 0, touch: 0, warm: 0 };
|
|
453
|
+
const style = getComputedStyle(probe);
|
|
454
|
+
const ms = (value) => (Number.parseFloat(value) || 0) * 1000;
|
|
455
|
+
return { show: ms(style.transitionDelay), hide: ms(style.transitionDuration), touch: ms(style.animationDuration), warm: ms(style.animationDelay) };
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* TIP-17, TIP-18: the waits, in ms, read as each one starts (a change mid-wait applies the next time): a usable prop as
|
|
459
|
+
* given, the token otherwise.
|
|
460
|
+
*/
|
|
461
|
+
timing() {
|
|
462
|
+
const tokens = this.tokenTiming();
|
|
463
|
+
return {
|
|
464
|
+
show: usable(this.showDelay) ? this.showDelay : tokens.show,
|
|
465
|
+
hide: usable(this.hideDelay) ? this.hideDelay : tokens.hide,
|
|
466
|
+
touch: usable(this.touchTimeout) ? this.touchTimeout : tokens.touch,
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
clearTimers() {
|
|
470
|
+
clearTimeout(this.showTimer);
|
|
471
|
+
clearTimeout(this.hideTimer);
|
|
472
|
+
clearTimeout(this.touchTimer);
|
|
473
|
+
}
|
|
474
|
+
/** TIP-7: opens or closes by itself, and says so. */
|
|
475
|
+
setBySelf(open) {
|
|
476
|
+
if (open && !this.hasText)
|
|
477
|
+
return;
|
|
478
|
+
if (this.open === open)
|
|
479
|
+
return;
|
|
480
|
+
if (open)
|
|
481
|
+
this.tookOver = this.takesOver;
|
|
482
|
+
// TIP-8: the other tooltip closes first, at once.
|
|
483
|
+
if (open && showing && showing !== this)
|
|
484
|
+
showing.giveWay();
|
|
485
|
+
this.open = open;
|
|
486
|
+
this.dispatchEvent(new CustomEvent('toggle', { detail: { open } }));
|
|
487
|
+
}
|
|
488
|
+
/** TIP-28: closes because the pointer or the keyboard focus left the anchor: the next tooltip finds this window warm. */
|
|
489
|
+
leave() {
|
|
490
|
+
if (!this.open)
|
|
491
|
+
return;
|
|
492
|
+
this.left = true;
|
|
493
|
+
this.setBySelf(false);
|
|
494
|
+
}
|
|
495
|
+
/** @internal TIP-8, TIP-28: another tooltip opened; this one disappears at once, without its motion. */
|
|
496
|
+
giveWay() {
|
|
497
|
+
this.clearTimers();
|
|
498
|
+
this.left = false;
|
|
499
|
+
this.setBySelf(false);
|
|
500
|
+
this.hide(false);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* TIP-8, TIP-28: whether this tooltip takes over from another — one is open, one is still fading out after its anchor
|
|
504
|
+
* was left, or one closed that way within the warm time. It then waits for no show delay and makes no motion.
|
|
505
|
+
*/
|
|
506
|
+
get takesOver() {
|
|
507
|
+
return (showing !== null && showing !== this) || (fading !== null && fading !== this) || warm;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* TIP-1: whether a point (viewport coordinates) is in the gap between the anchor and the shown container — as deep as
|
|
511
|
+
* the space between them (the offset, and the arrow's height while one is drawn), as wide as the container along that
|
|
512
|
+
* side. Measured, not drawn, so it takes no press. A tooltip that is closed or leaving has none (TIP-29).
|
|
513
|
+
*/
|
|
514
|
+
inGap(x, y) {
|
|
515
|
+
const surface = this.surface;
|
|
516
|
+
if (!surface || !this.shown)
|
|
517
|
+
return false;
|
|
518
|
+
const a = (this.anchor ?? this).getBoundingClientRect();
|
|
519
|
+
const s = surface.getBoundingClientRect();
|
|
520
|
+
const across = (from, to, at) => at >= from && at <= to;
|
|
521
|
+
switch (surface.dataset.side) {
|
|
522
|
+
case 'top':
|
|
523
|
+
return across(s.left, s.right, x) && across(s.bottom, a.top, y);
|
|
524
|
+
case 'bottom':
|
|
525
|
+
return across(s.left, s.right, x) && across(a.bottom, s.top, y);
|
|
526
|
+
case 'left':
|
|
527
|
+
return across(s.top, s.bottom, y) && across(s.right, a.left, x);
|
|
528
|
+
case 'right':
|
|
529
|
+
return across(s.top, s.bottom, y) && across(a.right, s.left, x);
|
|
530
|
+
default:
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
/** TIP-4, TIP-6, TIP-13: closed on purpose. TIP-28: the person is done with tooltips, so the next one waits and moves as a first one does. */
|
|
535
|
+
dismiss() {
|
|
536
|
+
this.dismissed = true;
|
|
537
|
+
this.clearTimers();
|
|
538
|
+
if (this.open)
|
|
539
|
+
warmFor(0);
|
|
540
|
+
this.setBySelf(false);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* TIP-13, TIP-29: the press that closed the tooltip ends over what lies under it, because a leaving tooltip takes no
|
|
544
|
+
* pointer: the rest of that one press — its release and the click it makes — goes no further either. The next press is
|
|
545
|
+
* a press on what is there.
|
|
546
|
+
*/
|
|
547
|
+
swallowRelease() {
|
|
548
|
+
const types = ['pointerup', 'mouseup', 'click'];
|
|
549
|
+
const stop = (event) => {
|
|
550
|
+
event.stopPropagation();
|
|
551
|
+
if (event.type !== 'pointerup')
|
|
552
|
+
event.preventDefault();
|
|
553
|
+
if (event.type === 'click')
|
|
554
|
+
done();
|
|
555
|
+
};
|
|
556
|
+
const done = () => {
|
|
557
|
+
for (const type of types)
|
|
558
|
+
window.removeEventListener(type, stop, true);
|
|
559
|
+
window.removeEventListener('pointerdown', done, true);
|
|
560
|
+
};
|
|
561
|
+
for (const type of types)
|
|
562
|
+
window.addEventListener(type, stop, true);
|
|
563
|
+
// Registered after this press's own pointerdown has passed the window: the next one ends it.
|
|
564
|
+
window.addEventListener('pointerdown', done, true);
|
|
565
|
+
}
|
|
566
|
+
// ── Presentation (TIP-9, TIP-13, TIP-15, TIP-22 to TIP-29) ────────────────────────────────────────────────────────
|
|
567
|
+
/** TIP-9: places the container against the anchor, in viewport coordinates; closes when the anchor has gone. */
|
|
568
|
+
place() {
|
|
569
|
+
const surface = this.surface;
|
|
570
|
+
const motion = this.motion;
|
|
571
|
+
const container = this.renderRoot?.querySelector('.bubble');
|
|
572
|
+
if (!surface || !motion || !container || !this.shown)
|
|
573
|
+
return;
|
|
574
|
+
const element = this.anchor ?? this;
|
|
575
|
+
const anchor = element.getBoundingClientRect();
|
|
576
|
+
const viewport = { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };
|
|
577
|
+
// Removed, hidden (display: none, visibility: hidden, a closed <details>) or out of sight (src/primitives/placement.ts).
|
|
578
|
+
const gone = !this.isConnected || anchorGone(element, anchor, viewport);
|
|
579
|
+
if (gone) {
|
|
580
|
+
this.clearTimers();
|
|
581
|
+
this.setBySelf(false);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const style = getComputedStyle(surface);
|
|
585
|
+
const px = (value) => Number.parseFloat(value) || 0;
|
|
586
|
+
const margin = px(style.scrollMarginBlockEnd);
|
|
587
|
+
// Its drawn size, not `offsetWidth` / `offsetHeight`: those are rounded to whole pixels, which puts the centre up to
|
|
588
|
+
// half a pixel off the anchor's (the surface is never transformed, so this is its layout box, whatever its motion).
|
|
589
|
+
const drawn = surface.getBoundingClientRect();
|
|
590
|
+
const size = { width: drawn.width, height: drawn.height };
|
|
591
|
+
const rtl = getComputedStyle(this).direction === 'rtl';
|
|
592
|
+
const placement = PLACEMENTS.includes(this.placement) ? this.placement : 'top';
|
|
593
|
+
// TIP-19, TIP-22: another placement or direction is another place, taken at once: the side it was on says nothing.
|
|
594
|
+
if (this.placedFor !== `${placement} ${rtl}`)
|
|
595
|
+
this.side = null;
|
|
596
|
+
this.placedFor = `${placement} ${rtl}`;
|
|
597
|
+
const arrow = {
|
|
598
|
+
width: px(style.scrollMarginInlineStart),
|
|
599
|
+
height: px(style.scrollMarginInlineEnd),
|
|
600
|
+
inset: px(style.scrollPaddingBlockStart),
|
|
601
|
+
radius: Math.min(px(getComputedStyle(container).borderTopLeftRadius), size.width / 2, size.height / 2),
|
|
602
|
+
drawn: this.wantsArrow,
|
|
603
|
+
};
|
|
604
|
+
const at = placeTooltip({
|
|
605
|
+
anchor,
|
|
606
|
+
surface: size,
|
|
607
|
+
viewport,
|
|
608
|
+
placement,
|
|
609
|
+
// TIP-24: the prop as given, or the token.
|
|
610
|
+
offset: usable(this.offset) ? this.offset : px(style.scrollMarginBlockStart),
|
|
611
|
+
crossOffset: this.crossOffset,
|
|
612
|
+
margin,
|
|
613
|
+
rtl,
|
|
614
|
+
arrow,
|
|
615
|
+
keep: this.side,
|
|
616
|
+
});
|
|
617
|
+
this.side = at.side;
|
|
618
|
+
surface.style.top = `${at.top}px`;
|
|
619
|
+
surface.style.left = `${at.left}px`;
|
|
620
|
+
surface.dataset.side = at.side;
|
|
621
|
+
// TIP-15: it grows from the point of its edge where an arrow points or would point; over the anchor, from its middle.
|
|
622
|
+
const edge = { top: `${at.point}px 100%`, bottom: `${at.point}px 0`, left: `100% ${at.point}px`, right: `0 ${at.point}px` };
|
|
623
|
+
motion.style.transformOrigin = at.held ? '' : edge[at.side];
|
|
624
|
+
// TIP-25: the arrow on the edge that faces the anchor, and the elevation round the container and the arrow together.
|
|
625
|
+
if (at.arrow) {
|
|
626
|
+
surface.style.setProperty('--_arrow-at', `${at.point}px`);
|
|
627
|
+
const shade = getComputedStyle(this.renderRoot.querySelector('.shade')).boxShadow;
|
|
628
|
+
if (shade !== this.shade) {
|
|
629
|
+
this.shade = shade;
|
|
630
|
+
this.layers = shadowLayers(shade);
|
|
631
|
+
}
|
|
632
|
+
surface.dataset.arrow = this.layers.length ? 'shaded' : 'flat';
|
|
633
|
+
}
|
|
634
|
+
else
|
|
635
|
+
delete surface.dataset.arrow;
|
|
636
|
+
// The filter is named from the element's own style, so that the name is looked up in this shadow root.
|
|
637
|
+
motion.style.filter = surface.dataset.arrow === 'shaded' ? 'url(#shade)' : '';
|
|
638
|
+
}
|
|
639
|
+
/** What a frame can change besides the boxes: the direction, whether an arrow is asked for, and the look. */
|
|
640
|
+
get drawnAs() {
|
|
641
|
+
const style = getComputedStyle(this);
|
|
642
|
+
// TIP-25: and the elevation the filter round an arrow was made from (a theme switched while it shows).
|
|
643
|
+
const shade = this.surface?.dataset.arrow ? getComputedStyle(this.renderRoot.querySelector('.shade')).boxShadow : '';
|
|
644
|
+
return `${style.direction},${style.getPropertyValue(ARROW_PROPERTY).trim()},${style.getPropertyValue(INVERSE_PROPERTY).trim()},${shade}`;
|
|
645
|
+
}
|
|
646
|
+
stopFollowing() {
|
|
647
|
+
this.following.stop();
|
|
648
|
+
this.lastLayout = '';
|
|
649
|
+
document.removeEventListener('pointerdown', this.onDocumentPress, true);
|
|
650
|
+
window.removeEventListener('keydown', this.onEscape, true);
|
|
651
|
+
document.removeEventListener('pointerup', this.onTouchEnd, true);
|
|
652
|
+
document.removeEventListener('pointercancel', this.onTouchEnd, true);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Into the top layer (above an open dialog, which is there already), placed, and coming out of the anchor's side
|
|
656
|
+
* (TIP-15) — from where it had got to if it was still leaving (TIP-29), or whole at once if it takes over from another
|
|
657
|
+
* tooltip (TIP-28).
|
|
658
|
+
*/
|
|
659
|
+
show() {
|
|
660
|
+
const surface = this.surface;
|
|
661
|
+
const motion = this.motion;
|
|
662
|
+
if (!surface || !motion || !this.isConnected)
|
|
663
|
+
return;
|
|
664
|
+
const leaving = !this.shown && surface.matches(':popover-open');
|
|
665
|
+
const whole = !leaving && (this.tookOver || this.takesOver);
|
|
666
|
+
this.tookOver = false;
|
|
667
|
+
// TIP-8, TIP-28: at most one tooltip in a window, and the one before disappears at once.
|
|
668
|
+
if (showing && showing !== this)
|
|
669
|
+
showing.giveWay();
|
|
670
|
+
if (fading && fading !== this)
|
|
671
|
+
fading.hide(false);
|
|
672
|
+
if (fading === this)
|
|
673
|
+
fading = null;
|
|
674
|
+
showing = this;
|
|
675
|
+
this.motionRun++;
|
|
676
|
+
// TIP-29: where the closing motion has got to, before the popover is taken out and put back.
|
|
677
|
+
const reached = leaving ? getComputedStyle(motion) : null;
|
|
678
|
+
const from = reached ? { opacity: reached.opacity, transform: reached.transform } : null;
|
|
679
|
+
// Shown again even when still open, so it is the newest in the top layer: above a dialog opened since.
|
|
680
|
+
if (surface.matches(':popover-open'))
|
|
681
|
+
surface.hidePopover();
|
|
682
|
+
surface.showPopover();
|
|
683
|
+
this.shown = true;
|
|
684
|
+
if (!leaving)
|
|
685
|
+
this.side = null;
|
|
686
|
+
this.place();
|
|
687
|
+
if (!this.open)
|
|
688
|
+
return; // its anchor is out of sight: it closes again, never having been drawn
|
|
689
|
+
this.following.start();
|
|
690
|
+
document.addEventListener('pointerdown', this.onDocumentPress, true);
|
|
691
|
+
window.addEventListener('keydown', this.onEscape, true);
|
|
692
|
+
// The first frame, without a transition: closed (the start of the entering motion), where it had got to, or whole.
|
|
693
|
+
motion.style.transition = 'none';
|
|
694
|
+
if (from)
|
|
695
|
+
Object.assign(motion.style, from);
|
|
696
|
+
if (whole)
|
|
697
|
+
surface.classList.add('open');
|
|
698
|
+
void motion.offsetWidth;
|
|
699
|
+
// …and from there to open, over the entering motion.
|
|
700
|
+
motion.style.transition = '';
|
|
701
|
+
motion.style.opacity = '';
|
|
702
|
+
motion.style.transform = '';
|
|
703
|
+
surface.classList.add('open');
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Going back the way it came (TIP-15) — from where it had got to if it was still entering (TIP-29) — or at once, then
|
|
707
|
+
* out of the top layer. Leaving, it is already closed for the pointer (TIP-29).
|
|
708
|
+
*/
|
|
709
|
+
hide(fade = true) {
|
|
710
|
+
const surface = this.surface;
|
|
711
|
+
const motion = this.motion;
|
|
712
|
+
const left = this.left;
|
|
713
|
+
this.left = false;
|
|
714
|
+
this.stopFollowing();
|
|
715
|
+
if (showing === this)
|
|
716
|
+
showing = null;
|
|
717
|
+
if (!surface || !motion)
|
|
718
|
+
return;
|
|
719
|
+
const finish = () => {
|
|
720
|
+
if (this.shown)
|
|
721
|
+
return;
|
|
722
|
+
if (fading === this)
|
|
723
|
+
fading = null;
|
|
724
|
+
this.side = null;
|
|
725
|
+
if (surface.matches(':popover-open'))
|
|
726
|
+
surface.hidePopover();
|
|
727
|
+
};
|
|
728
|
+
if (!this.shown) {
|
|
729
|
+
// Already leaving: told to go at once, it goes (TIP-28).
|
|
730
|
+
if (!fade)
|
|
731
|
+
finish();
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
this.shown = false;
|
|
735
|
+
const run = ++this.motionRun;
|
|
736
|
+
if (!fade) {
|
|
737
|
+
motion.style.transition = 'none';
|
|
738
|
+
surface.classList.remove('open');
|
|
739
|
+
finish();
|
|
740
|
+
motion.style.transition = '';
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
// TIP-28: tooltips stay warm from now, for the warm time.
|
|
744
|
+
if (left) {
|
|
745
|
+
warmFor(this.tokenTiming().warm);
|
|
746
|
+
fading = this;
|
|
747
|
+
}
|
|
748
|
+
surface.classList.remove('open');
|
|
749
|
+
const running = motion.getAnimations();
|
|
750
|
+
if (running.length === 0)
|
|
751
|
+
finish();
|
|
752
|
+
else
|
|
753
|
+
void Promise.allSettled(running.map((animation) => animation.finished)).then(() => run === this.motionRun && finish());
|
|
754
|
+
}
|
|
755
|
+
/** TIP-14: the text (after the title, for a rich tooltip) as the anchor's description, or nothing. */
|
|
756
|
+
describe(text) {
|
|
757
|
+
const target = text ? this.describedElement() : null;
|
|
758
|
+
const now = this.described;
|
|
759
|
+
if (now && (now.element !== target || now.text !== text)) {
|
|
760
|
+
if (now.element.getAttribute('aria-description') === now.text)
|
|
761
|
+
now.element.removeAttribute('aria-description');
|
|
762
|
+
this.described = null;
|
|
763
|
+
}
|
|
764
|
+
if (target && text && !this.described) {
|
|
765
|
+
target.setAttribute('aria-description', text);
|
|
766
|
+
this.described = { element: target, text };
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/** TIP-27: the shortcut as `aria-keyshortcuts` on the anchor's focusable element, or nothing. What it wrote, it takes back. */
|
|
770
|
+
key(target, keys) {
|
|
771
|
+
const now = this.keyed;
|
|
772
|
+
if (now && (now.element !== target || now.keys !== keys)) {
|
|
773
|
+
if (now.element.getAttribute('aria-keyshortcuts') === now.keys)
|
|
774
|
+
now.element.removeAttribute('aria-keyshortcuts');
|
|
775
|
+
this.keyed = null;
|
|
776
|
+
}
|
|
777
|
+
if (target && keys && !this.keyed) {
|
|
778
|
+
target.setAttribute('aria-keyshortcuts', keys);
|
|
779
|
+
this.keyed = { element: target, keys };
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
/** The anchor's focusable element: the first slotted element that is (or holds, or draws in its shadow root) one. */
|
|
783
|
+
describedElement() {
|
|
784
|
+
const slot = this.renderRoot?.querySelector('slot');
|
|
785
|
+
const assigned = slot?.assignedElements({ flatten: true }) ?? [];
|
|
786
|
+
for (const element of assigned) {
|
|
787
|
+
const found = findInteractive(element);
|
|
788
|
+
if (found)
|
|
789
|
+
return found;
|
|
790
|
+
}
|
|
791
|
+
return assigned[0] ?? null;
|
|
792
|
+
}
|
|
793
|
+
description() {
|
|
794
|
+
const title = this.variant === 'rich' ? this.title.trim() : '';
|
|
795
|
+
return [title, this.text.trim()].filter(Boolean).join(', ');
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* TIP-14, TIP-27: what the anchor carries for assistive technology. The shortcut is its `aria-keyshortcuts`, on the
|
|
799
|
+
* element that takes focus; where the anchor states one itself, the text KBS-10 gives — the label, else that notation — ends its description
|
|
800
|
+
* instead.
|
|
801
|
+
*/
|
|
802
|
+
sync() {
|
|
803
|
+
const drawn = this.hasText ? this.renderRoot?.querySelector('tanrei-keyboard-shortcut') : null;
|
|
804
|
+
const keys = drawn?.ariaKeyShortcuts ?? null;
|
|
805
|
+
const element = keys ? this.describedElement() : null;
|
|
806
|
+
const target = element ? focusableOf(element) : null;
|
|
807
|
+
const ours = (each) => this.keyed?.element === each && each.getAttribute('aria-keyshortcuts') === this.keyed.keys;
|
|
808
|
+
const stated = [element, target].some((each) => !!each && each.hasAttribute('aria-keyshortcuts') && !ours(each));
|
|
809
|
+
this.key(stated ? null : target, stated ? null : keys);
|
|
810
|
+
const spoken = stated && drawn ? drawn.spokenKeys : '';
|
|
811
|
+
this.describe(this.describes && this.hasText ? [this.description(), spoken].filter(Boolean).join(', ') : null);
|
|
812
|
+
}
|
|
813
|
+
willUpdate(changed) {
|
|
814
|
+
// TIP-16: without text it never opens.
|
|
815
|
+
if (changed.has('open') && this.open && !this.hasText)
|
|
816
|
+
this.open = false;
|
|
817
|
+
}
|
|
818
|
+
updated(changed) {
|
|
819
|
+
this.sync();
|
|
820
|
+
if (changed.has('text') && !this.hasText)
|
|
821
|
+
report(this, 'TIP-16', 'text is empty, so the tooltip never opens and describes nothing; give it text');
|
|
822
|
+
if ((changed.has('title') || changed.has('variant')) && this.variant !== 'rich' && this.title.trim()) {
|
|
823
|
+
report(this, 'TIP-16', `a plain tooltip ignores its title "${this.title}"; use variant="rich" to draw it`);
|
|
824
|
+
}
|
|
825
|
+
for (const { prop, attribute, token } of WAITS) {
|
|
826
|
+
const value = this[prop];
|
|
827
|
+
if (!changed.has(prop) || value === null || value === undefined || usable(value))
|
|
828
|
+
continue;
|
|
829
|
+
const why = typeof value === 'number' && Number.isFinite(value) ? 'is negative' : 'is not a finite number';
|
|
830
|
+
report(this, 'TIP-17', `${attribute} ${JSON.stringify(String(value))} ${why}; ${token} is used in its place`);
|
|
831
|
+
}
|
|
832
|
+
if (changed.has('placement') && !PLACEMENTS.includes(this.placement)) {
|
|
833
|
+
report(this, 'TIP-22', `placement "${String(this.placement)}" is not one of ${PLACEMENTS.join(', ')}; the tooltip is placed as "top"`);
|
|
834
|
+
}
|
|
835
|
+
const offset = this.offset;
|
|
836
|
+
if (changed.has('offset') && offset !== null && offset !== undefined && !usable(offset)) {
|
|
837
|
+
const why = typeof offset === 'number' && Number.isFinite(offset) ? 'is negative' : 'is not a finite number';
|
|
838
|
+
report(this, 'TIP-24', `offset ${JSON.stringify(String(offset))} ${why}; comp.tooltip.offset is used in its place`);
|
|
839
|
+
}
|
|
840
|
+
const cross = this.crossOffset;
|
|
841
|
+
if (changed.has('crossOffset') && cross !== null && cross !== undefined && !Number.isFinite(cross)) {
|
|
842
|
+
report(this, 'TIP-24', `cross-offset ${JSON.stringify(String(cross))} is not a finite number; 0 is used in its place`);
|
|
843
|
+
}
|
|
844
|
+
if ((changed.has('shortcut') || changed.has('variant')) && this.variant === 'rich' && chordsOf(this.shortcut).length) {
|
|
845
|
+
report(this, 'TIP-27', `a rich tooltip ignores its shortcut "${chordsOf(this.shortcut).join(' ')}"; a plain tooltip draws it`);
|
|
846
|
+
}
|
|
847
|
+
// TIP-26: where a browser has no style queries, the look the cascade names now is written for the same rules.
|
|
848
|
+
const surface = this.surface;
|
|
849
|
+
if (surface && !styleQueries()) {
|
|
850
|
+
surface.dataset.inverse = this.drawnInverse ? 'on' : 'off';
|
|
851
|
+
// A style query follows a system switched on the root by itself; here the choice is read again when it is.
|
|
852
|
+
this.systemWatch ??= new SystemWatchController(this);
|
|
853
|
+
}
|
|
854
|
+
if (changed.has('open')) {
|
|
855
|
+
if (this.open)
|
|
856
|
+
this.show();
|
|
857
|
+
else {
|
|
858
|
+
this.touchShown = false;
|
|
859
|
+
this.hide();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
else if (this.open && this.shown)
|
|
863
|
+
this.place();
|
|
864
|
+
}
|
|
865
|
+
render() {
|
|
866
|
+
const rich = this.variant === 'rich';
|
|
867
|
+
const title = rich && this.title.trim() ? this.title : '';
|
|
868
|
+
const keys = this.keys;
|
|
869
|
+
// TIP-13, TIP-14: role tooltip; hidden from assistive technology while the anchor carries its text as a description.
|
|
870
|
+
// TIP-15: the popover is the placed box; what moves is the wrapper inside it, which holds the container and its arrow.
|
|
871
|
+
return html `
|
|
872
|
+
<slot @slotchange=${() => this.sync()}></slot>
|
|
873
|
+
<div
|
|
874
|
+
class="surface"
|
|
875
|
+
popover="manual"
|
|
876
|
+
role="tooltip"
|
|
877
|
+
aria-hidden=${this.describes && this.hasText ? 'true' : nothing}
|
|
878
|
+
@pointerenter=${() => clearTimeout(this.hideTimer)}
|
|
879
|
+
@click=${this.swallow}
|
|
880
|
+
@mousedown=${this.swallow}
|
|
881
|
+
@pointerup=${this.swallow}
|
|
882
|
+
>
|
|
883
|
+
<div class="motion">
|
|
884
|
+
<span part="arrow" class="arrow" aria-hidden="true"></span>
|
|
885
|
+
<div part="container" class=${keys.length ? 'bubble keyed' : 'bubble'} data-tanrei-shape>
|
|
886
|
+
${title ? html `<span part="title" class="title">${title}</span>` : nothing}
|
|
887
|
+
<span part="supporting-text" class="text">${this.text}</span>
|
|
888
|
+
${keys.length
|
|
889
|
+
? html `<tanrei-keyboard-shortcut part="shortcut" class="shortcut" .keys=${keys} .hosted=${true} size="small" variant="plain"></tanrei-keyboard-shortcut>`
|
|
890
|
+
: nothing}
|
|
891
|
+
</div>
|
|
892
|
+
</div>
|
|
893
|
+
<span class="shade" aria-hidden="true"></span>
|
|
894
|
+
${shadeFilter(this.layers)}
|
|
895
|
+
</div>
|
|
896
|
+
<span class="timing" aria-hidden="true"></span>
|
|
897
|
+
`;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
if (!customElements.get('tanrei-tooltip'))
|
|
901
|
+
customElements.define('tanrei-tooltip', TanreiTooltip);
|
|
902
|
+
//# sourceMappingURL=tooltip.js.map
|