@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
package/dist/link.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declares the origins that are the product's own site, beside the page's (LNK-30): a link to one of them is not
|
|
3
|
+
* external. An origin (`https://docs.example.com`), a host name, or a host with a leading `*.` for its subdomains —
|
|
4
|
+
* the same list the build step takes as `site`. Every link the script has marked is read again; a `data-external`
|
|
5
|
+
* the page was given where it was made is never changed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setSiteOrigins(origins: readonly string[]): void;
|
|
8
|
+
/**
|
|
9
|
+
* Sets, once for the page, the words read after the name of a link that leaves the site and opens where the person is
|
|
10
|
+
* ("external link", in the product's language — LNK-34). They are written as `aria-description` on every such link
|
|
11
|
+
* that carries none of its own; an empty string takes back what was written. Tanrei ships no words: until the product
|
|
12
|
+
* gives some, here or on each link, nothing is said, and a debug build says so once.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setExternalLabel(words: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Adds the script side of the Link to every `a.tanrei-link` and every anchor of a `.tanrei-prose` under `root`, now
|
|
17
|
+
* and as the page changes. `@tanrei/web` and `@tanrei/web/link` call it for the document when they load; call it
|
|
18
|
+
* yourself for a shadow root of your own, which the document's listeners cannot see into. Calling it twice for one root
|
|
19
|
+
* observes once. Returns a function that stops (what was already written on an anchor stays).
|
|
20
|
+
*/
|
|
21
|
+
export declare function observeLinks(root?: Document | ShadowRoot): () => void;
|
package/dist/link.js
ADDED
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
// `@tanrei/web/link` — the script side of `@tanrei/web/link.css` (specs/link.spec.json), for a page that
|
|
2
|
+
// uses `class="tanrei-link"` or `.tanrei-prose` without the components. `@tanrei/web` loads it too.
|
|
3
|
+
//
|
|
4
|
+
// The Link is a class on the product's own anchor, and the stylesheet alone draws it in every state. This adds what a
|
|
5
|
+
// stylesheet cannot, through listeners on the document — no anchor is wrapped, replaced or given a listener of its own:
|
|
6
|
+
//
|
|
7
|
+
// - the shared press primitive (LNK-8, LNK-9): `data-pressed` named after `sys.behavior.pressed-feedback` (overlay,
|
|
8
|
+
// ripple, dim, none), on pointer down and on Enter — never Space (LNK-12) — held for press-hold;
|
|
9
|
+
// - `noopener` on a link that opens a new context (LNK-13);
|
|
10
|
+
// - the refusals of LNK-21: an address that is empty, names a script or cannot be read is taken off the anchor, which
|
|
11
|
+
// is then no link at all (no role, no focus); a `target` that is not HTML's `_blank` or `_self` is taken off;
|
|
12
|
+
// - `data-focus-style`, where the browser has no style queries to read `sys.behavior.focus-style` with (LNK-10);
|
|
13
|
+
// - a disabled link that still carries an address opens nothing (LNK-19);
|
|
14
|
+
// - what leaves the site (LNK-30): an anchor that carries no `data-external` and whose address is of another origin
|
|
15
|
+
// than the page's and the ones given to `setSiteOrigins()` is marked `data-external="detected"`, re-read when its
|
|
16
|
+
// address changes; only a value this script wrote is ever changed by it. The stylesheet draws the arrow for it —
|
|
17
|
+
// after the first paint, where the page was not marked when it was made (README, "Link");
|
|
18
|
+
// - the words of an external link (LNK-34): `setExternalLabel()` gives them once for the page, and they are written
|
|
19
|
+
// as `aria-description` on an external link that has none and opens where the person is. Tanrei ships no words;
|
|
20
|
+
// - the site's picture (LNK-32, LNK-35): `alt=""` and `referrerpolicy="no-referrer"` where the markup left them out,
|
|
21
|
+
// and `data-failed` on a picture that could not be loaded, so that nothing is drawn in its room. It asks for
|
|
22
|
+
// nothing itself: no address is derived from `href`, and no request is made;
|
|
23
|
+
// - `data-underline-system` and `data-external-marks-system` on the document's root, where the browser has no style
|
|
24
|
+
// queries to read `comp.link.underline.visibility` and `comp.link.external.marks` with (LNK-27, LNK-33);
|
|
25
|
+
// - every debug report (LNK-13, LNK-15, LNK-19, LNK-21, LNK-29, LNK-32, LNK-34, LNK-35).
|
|
26
|
+
//
|
|
27
|
+
// What the browser gives an anchor stays the browser's (LNK-1, LNK-12): Enter fires `click` and then follows the
|
|
28
|
+
// address unless the product cancelled the click; a modified or a middle click opens a tab. Nothing here follows a link.
|
|
29
|
+
import { isExternal } from './links/index.js';
|
|
30
|
+
import { syncFocusStyle } from './primitives/focus-ring.js';
|
|
31
|
+
import { LINK_KEYS, linkRel, readDestination } from './primitives/link.js';
|
|
32
|
+
import { PressController } from './primitives/press.js';
|
|
33
|
+
import { debugBuild, report } from './primitives/report.js';
|
|
34
|
+
import { styleQueries } from './primitives/separation.js';
|
|
35
|
+
import { setWords, watchWords, wordFor, wordLacking } from './primitives/words.js';
|
|
36
|
+
const LINK = 'tanrei-link';
|
|
37
|
+
const PROSE = 'tanrei-prose';
|
|
38
|
+
const NOT_PROSE = 'tanrei-not-prose';
|
|
39
|
+
/** A pagination's landmark (pagination.css): a component of classes, whose anchors are its own as an element's are. */
|
|
40
|
+
const PAGINATION = 'tanrei-pagination';
|
|
41
|
+
/** The variants the spec defines; a design system may add one, which is known by its tokens. */
|
|
42
|
+
const VARIANTS = ['standard', 'inverse'];
|
|
43
|
+
/** `comp.link.underline.visibility` and the `data-underline` of one link (LNK-27): the first is the fallback. */
|
|
44
|
+
const UNDERLINES = ['always', 'hover', 'never'];
|
|
45
|
+
/** `comp.link.external.marks` (LNK-33): the first is the fallback. */
|
|
46
|
+
const MARKS = ['all', 'arrow', 'none'];
|
|
47
|
+
/** What `data-external` may hold: the product's word (`true`, or the bare attribute; `false`) and this script's. */
|
|
48
|
+
const DETECTED = 'detected';
|
|
49
|
+
const EXTERNALS = ['', 'true', 'false', DETECTED];
|
|
50
|
+
const SITE_ICON = 'tanrei-link-site-icon';
|
|
51
|
+
const UNDERLINE_TOKEN = '--tanrei-comp-link-underline-visibility';
|
|
52
|
+
const MARKS_TOKEN = '--tanrei-comp-link-external-marks';
|
|
53
|
+
/** What the observer re-reads an anchor for. */
|
|
54
|
+
const ATTRIBUTES = ['href', 'target', 'rel', 'download', 'class', 'role', 'aria-disabled', 'aria-current', 'aria-label', 'aria-labelledby', 'aria-description', 'aria-describedby', 'data-variant', 'data-underline', 'data-external', 'data-standalone'];
|
|
55
|
+
const SETTINGS = Symbol.for('tanrei.link-settings');
|
|
56
|
+
function settings() {
|
|
57
|
+
const holder = globalThis;
|
|
58
|
+
return (holder[SETTINGS] ??= { site: [], reread: new Set() });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Declares the origins that are the product's own site, beside the page's (LNK-30): a link to one of them is not
|
|
62
|
+
* external. An origin (`https://docs.example.com`), a host name, or a host with a leading `*.` for its subdomains —
|
|
63
|
+
* the same list the build step takes as `site`. Every link the script has marked is read again; a `data-external`
|
|
64
|
+
* the page was given where it was made is never changed.
|
|
65
|
+
*/
|
|
66
|
+
export function setSiteOrigins(origins) {
|
|
67
|
+
settings().site = [...origins];
|
|
68
|
+
for (const reread of settings().reread)
|
|
69
|
+
reread();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets, once for the page, the words read after the name of a link that leaves the site and opens where the person is
|
|
73
|
+
* ("external link", in the product's language — LNK-34). They are written as `aria-description` on every such link
|
|
74
|
+
* that carries none of its own; an empty string takes back what was written. Tanrei ships no words: until the product
|
|
75
|
+
* gives some, here or on each link, nothing is said, and a debug build says so once.
|
|
76
|
+
*/
|
|
77
|
+
export function setExternalLabel(words) {
|
|
78
|
+
// One store: the words of an external link are the key `externalLabel` of the product's
|
|
79
|
+
// words. This is `setWords({ externalLabel: words })`, kept under its first name; every observed root reads its
|
|
80
|
+
// anchors again because a set of words changed (below).
|
|
81
|
+
setWords({ externalLabel: words });
|
|
82
|
+
}
|
|
83
|
+
/** The words of an external link for `anchor`: the product's words for its language, else the document's (`setWords()`). */
|
|
84
|
+
const externalWords = (anchor) => wordFor(anchor, 'externalLabel').trim();
|
|
85
|
+
// A changed set of words — by `setWords()` or by `setExternalLabel()` — is read again by every observed root. Once for
|
|
86
|
+
// the page's copies of this module: the listener is kept with the settings.
|
|
87
|
+
{
|
|
88
|
+
const held = settings();
|
|
89
|
+
if (!held.watching) {
|
|
90
|
+
held.watching = true;
|
|
91
|
+
watchWords(() => {
|
|
92
|
+
for (const reread of settings().reread)
|
|
93
|
+
reread();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether `anchor` is one of prose's own (PRS-16): inside a `.tanrei-prose` and not inside an island of it — a part
|
|
99
|
+
* marked `tanrei-not-prose`, a pagination's landmark, or one of Tanrei's elements, whose content is that component's.
|
|
100
|
+
* The nearest of them decides, as in prose.css (a prose inside an island is prose again).
|
|
101
|
+
*/
|
|
102
|
+
function inProse(anchor) {
|
|
103
|
+
for (let parent = anchor.parentElement; parent; parent = parent.parentElement) {
|
|
104
|
+
if (parent.classList.contains(NOT_PROSE) || parent.classList.contains(PAGINATION) || parent.localName.startsWith('tanrei-'))
|
|
105
|
+
return false;
|
|
106
|
+
if (parent.classList.contains(PROSE))
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
/** The anchor a node is in, when it is a Link: an anchor with the class, or one of prose's own. */
|
|
112
|
+
function linkOf(node) {
|
|
113
|
+
const anchor = node instanceof Element ? node.closest('a') : null;
|
|
114
|
+
return anchor instanceof HTMLAnchorElement && (anchor.classList.contains(LINK) || inProse(anchor)) ? anchor : null;
|
|
115
|
+
}
|
|
116
|
+
const disabled = (anchor) => anchor.getAttribute('aria-disabled') === 'true';
|
|
117
|
+
/** A link that can be followed now: it has an address and is not disabled. */
|
|
118
|
+
const live = (anchor) => anchor.hasAttribute('href') && !disabled(anchor);
|
|
119
|
+
/**
|
|
120
|
+
* What an anchor carries is read once it is seen and again when it changes (LNK-13, LNK-15, LNK-19, LNK-21): the
|
|
121
|
+
* refusals are made and a debug build is told what the link survived.
|
|
122
|
+
*/
|
|
123
|
+
function read(anchor) {
|
|
124
|
+
const own = anchor.classList.contains(LINK);
|
|
125
|
+
// LNK-21: what is not a place to go is not a destination, and a link without one is not a link.
|
|
126
|
+
const given = anchor.getAttribute('href');
|
|
127
|
+
if (given === null) {
|
|
128
|
+
// In prose an anchor without an address is the content's own (a named place in the text), not a broken link.
|
|
129
|
+
if (own && !disabled(anchor) && !refused.has(anchor))
|
|
130
|
+
report(anchor, 'LNK-21', 'it has no href, so it is not a link and is drawn as text; a press that does something on the page is a button’s');
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const { href, refusal } = readDestination(given);
|
|
134
|
+
if (href === null) {
|
|
135
|
+
refused.add(anchor);
|
|
136
|
+
anchor.removeAttribute('href');
|
|
137
|
+
report(anchor, 'LNK-21', refusal === 'script'
|
|
138
|
+
? 'href names a script to run, not a place to go; it is taken off and the anchor is not a link'
|
|
139
|
+
: refusal === 'unreadable'
|
|
140
|
+
? `href "${given}" cannot be read as an address; it is taken off and the anchor is not a link`
|
|
141
|
+
: 'href is empty; it is taken off and the anchor is not a link');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// LNK-19: a disabled link is the anchor without an address, with the link role.
|
|
145
|
+
if (disabled(anchor)) {
|
|
146
|
+
if (anchor.hasAttribute('href'))
|
|
147
|
+
report(anchor, 'LNK-19', 'it is disabled and still carries href: a disabled link has no destination (write the anchor without href); the address is not opened');
|
|
148
|
+
if (anchor.getAttribute('role') !== 'link')
|
|
149
|
+
report(anchor, 'LNK-19', 'it is disabled and has no role: an anchor without href is not a link to assistive technology; give it role="link"');
|
|
150
|
+
}
|
|
151
|
+
// LNK-13, LNK-21: where it opens, in HTML's spelling.
|
|
152
|
+
const target = (anchor.getAttribute('target') ?? '').trim().toLowerCase();
|
|
153
|
+
if (target === '_blank') {
|
|
154
|
+
const rel = linkRel(anchor.getAttribute('rel'), 'new');
|
|
155
|
+
if (rel !== null && rel !== anchor.getAttribute('rel'))
|
|
156
|
+
anchor.setAttribute('rel', rel);
|
|
157
|
+
if (live(anchor) && !(anchor.getAttribute('aria-description') ?? '').trim() && !anchor.hasAttribute('aria-describedby')) {
|
|
158
|
+
report(anchor, 'LNK-13', 'it opens a new context and aria-description is empty, so nothing says so to people who cannot see the mark; give it the words ("opens in a new tab")');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else if (target !== '' && target !== '_self') {
|
|
162
|
+
report(anchor, 'LNK-21', `target "${anchor.getAttribute('target')}" is not a value it defines ("_blank" for a new context, or none); it is taken off and the link opens where the person is`);
|
|
163
|
+
anchor.removeAttribute('target');
|
|
164
|
+
}
|
|
165
|
+
// LNK-21: a variant neither the spec nor the active design system has is drawn as the default one.
|
|
166
|
+
const variant = anchor.getAttribute('data-variant');
|
|
167
|
+
if (variant !== null && !VARIANTS.includes(variant) && !getComputedStyle(anchor).getPropertyValue(`--tanrei-comp-link-${variant}-label-color`).trim()) {
|
|
168
|
+
report(anchor, 'LNK-21', `data-variant "${variant}" is not a variant it or the active design system defines; it is drawn as "standard"`);
|
|
169
|
+
}
|
|
170
|
+
// LNK-15: a glyph alone is named by aria-label; a link with a label of text is named by that text.
|
|
171
|
+
const glyph = anchor.querySelector(':scope > .tanrei-icon');
|
|
172
|
+
if (glyph) {
|
|
173
|
+
const text = [...anchor.childNodes].some((node) => node.nodeType === Node.TEXT_NODE && !!node.textContent?.trim());
|
|
174
|
+
const named = !!(anchor.getAttribute('aria-label') ?? '').trim() || anchor.hasAttribute('aria-labelledby');
|
|
175
|
+
if (!text && !named)
|
|
176
|
+
report(anchor, 'LNK-15', 'it is a glyph alone and has no accessible name; give it aria-label, which also draws it as the glyph-alone form');
|
|
177
|
+
if (text && anchor.hasAttribute('aria-label'))
|
|
178
|
+
report(anchor, 'LNK-15', 'it has a label of text and aria-label: the text names a link, and aria-label is for a glyph alone (it replaces the name and draws the link as a glyph alone); take it off');
|
|
179
|
+
}
|
|
180
|
+
// LNK-21, LNK-27: an underline that is none of the three is auto — no rule of the stylesheet names it.
|
|
181
|
+
const underline = anchor.getAttribute('data-underline');
|
|
182
|
+
if (underline !== null && underline !== 'auto' && !UNDERLINES.includes(underline)) {
|
|
183
|
+
report(anchor, 'LNK-21', `data-underline "${underline}" is not a value it defines ("always", "hover" or "never", or none for the design system’s choice); it is underlined as the design system chooses`);
|
|
184
|
+
}
|
|
185
|
+
readExternal(anchor);
|
|
186
|
+
readSiteIcon(anchor);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* LNK-30: whether the link leaves the site. The product's word stands (`data-external` that is `true`, bare, or
|
|
190
|
+
* `false`); an anchor without one is read — its address against the page's origin and the origins the product
|
|
191
|
+
* declared — and marked `detected`, the one value this script writes, changes and takes back.
|
|
192
|
+
*/
|
|
193
|
+
function readExternal(anchor) {
|
|
194
|
+
let given = anchor.getAttribute('data-external');
|
|
195
|
+
if (given !== null && !EXTERNALS.includes(given)) {
|
|
196
|
+
// LNK-21: a value it does not define is auto. The stylesheet draws the marks for anything but "false", so the
|
|
197
|
+
// value is taken off, as an unknown target is.
|
|
198
|
+
report(anchor, 'LNK-21', `data-external "${given}" is not a value it defines ("true" or "false", or none for the address to decide); it is taken off and the address decides`);
|
|
199
|
+
anchor.removeAttribute('data-external');
|
|
200
|
+
given = null;
|
|
201
|
+
}
|
|
202
|
+
if (given !== null && given !== DETECTED)
|
|
203
|
+
return;
|
|
204
|
+
// A disabled link has no address to read (LNK-19): what was found while it had one stands.
|
|
205
|
+
if (!anchor.hasAttribute('href')) {
|
|
206
|
+
if (given === DETECTED && !disabled(anchor))
|
|
207
|
+
anchor.removeAttribute('data-external');
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const page = anchor.ownerDocument.location?.href;
|
|
211
|
+
// `anchor.href` is the address as the browser will follow it, read against the document's base.
|
|
212
|
+
const found = isExternal(anchor.href, { ...(page ? { base: page } : {}), site: settings().site, download: anchor.hasAttribute('download') });
|
|
213
|
+
if (found && given === null)
|
|
214
|
+
anchor.setAttribute('data-external', DETECTED);
|
|
215
|
+
else if (!found && given === DETECTED)
|
|
216
|
+
anchor.removeAttribute('data-external');
|
|
217
|
+
}
|
|
218
|
+
/** Whether the link is external by what it carries now (the stylesheet's own condition). */
|
|
219
|
+
const external = (anchor) => anchor.hasAttribute('data-external') && anchor.getAttribute('data-external') !== 'false';
|
|
220
|
+
/** Whether the link has a label: text of its own, outside a glyph — and not the glyph-alone form, which `aria-label` draws. */
|
|
221
|
+
function labelled(anchor) {
|
|
222
|
+
if (anchor.hasAttribute('aria-label') && anchor.querySelector(':scope > .tanrei-icon'))
|
|
223
|
+
return false;
|
|
224
|
+
return [...anchor.childNodes].some((node) => (node.nodeType === Node.TEXT_NODE || (node instanceof Element && !node.classList.contains('tanrei-icon'))) && !!node.textContent?.trim());
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* LNK-32, LNK-35: the site's picture is the product's own `<img class="tanrei-link-site-icon">`, the anchor's first
|
|
228
|
+
* child. It is decoration, loaded exactly as given and without the page's address — what the markup left out is
|
|
229
|
+
* written here, and a debug build is told, because the first request may have left before this script ran.
|
|
230
|
+
*/
|
|
231
|
+
function readSiteIcon(anchor) {
|
|
232
|
+
const picture = anchor.querySelector(`:scope > img.${SITE_ICON}`);
|
|
233
|
+
if (!(picture instanceof HTMLImageElement))
|
|
234
|
+
return;
|
|
235
|
+
let before = picture.previousSibling;
|
|
236
|
+
while (before && before.nodeType !== Node.ELEMENT_NODE && !before.textContent?.trim())
|
|
237
|
+
before = before.previousSibling;
|
|
238
|
+
if (before)
|
|
239
|
+
report(anchor, 'LNK-32', 'its site icon is not its first child: the picture stands before the label, so write the <img class="tanrei-link-site-icon"> first, against the label’s text');
|
|
240
|
+
if (picture.getAttribute('alt') !== '') {
|
|
241
|
+
report(anchor, 'LNK-32', 'its site icon has no empty alt: the picture is decoration and the label names the link (LNK-15); alt="" is written for it — write it in the markup');
|
|
242
|
+
picture.setAttribute('alt', '');
|
|
243
|
+
}
|
|
244
|
+
const policy = picture.getAttribute('referrerpolicy');
|
|
245
|
+
if (policy === null) {
|
|
246
|
+
report(anchor, 'LNK-35', 'its site icon has no referrerpolicy: a picture is loaded without the page’s address; referrerpolicy="no-referrer" is written for it, but the first request may already have carried the address — write it in the markup');
|
|
247
|
+
picture.setAttribute('referrerpolicy', 'no-referrer');
|
|
248
|
+
}
|
|
249
|
+
else if (policy.trim().toLowerCase() !== 'no-referrer') {
|
|
250
|
+
report(anchor, 'LNK-35', `its site icon has referrerpolicy="${policy}": a picture is loaded without the page’s address — write referrerpolicy="no-referrer"`);
|
|
251
|
+
}
|
|
252
|
+
const given = picture.getAttribute('src');
|
|
253
|
+
if (!given?.trim())
|
|
254
|
+
return;
|
|
255
|
+
try {
|
|
256
|
+
const src = new URL(picture.currentSrc || picture.src, anchor.baseURI);
|
|
257
|
+
const page = anchor.ownerDocument.location;
|
|
258
|
+
if (['http:', 'https:'].includes(src.protocol) && page && src.origin !== page.origin) {
|
|
259
|
+
report(anchor, 'LNK-35', `its site icon is loaded from ${src.origin}, not from this site: every reader’s browser then tells that party which page is being read. Give a picture the product serves itself (resolveSiteIcons() of @tanrei/web/links makes one when the site is built), or a data: URL`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
// An address that cannot be read loads nothing, and fails below.
|
|
264
|
+
}
|
|
265
|
+
// A picture that failed before this script could hear it.
|
|
266
|
+
if (picture.complete && picture.naturalWidth === 0)
|
|
267
|
+
failed(anchor, picture);
|
|
268
|
+
}
|
|
269
|
+
/** LNK-32: a picture that cannot be loaded or decoded keeps its room and draws nothing. */
|
|
270
|
+
function failed(anchor, picture) {
|
|
271
|
+
if (!picture.hasAttribute('data-failed'))
|
|
272
|
+
picture.setAttribute('data-failed', '');
|
|
273
|
+
const src = picture.getAttribute('src') ?? '';
|
|
274
|
+
report(anchor, 'LNK-32', `its site icon "${src.length > 96 ? `${src.slice(0, 96)}…` : src}" cannot be loaded or decoded: its room is kept and nothing is drawn in it`);
|
|
275
|
+
}
|
|
276
|
+
/** A link that leaves the site, opens where the person is and has a label: the one that is described as external (LNK-34). */
|
|
277
|
+
const describedAsExternal = (anchor) => live(anchor) && external(anchor) && (anchor.getAttribute('target') ?? '').trim().toLowerCase() !== '_blank' && labelled(anchor);
|
|
278
|
+
function look(anchor) {
|
|
279
|
+
const parent = anchor.parentElement ?? anchor;
|
|
280
|
+
// The two choices are read where the stylesheet reads them: from the link's parent by a style query, and from the
|
|
281
|
+
// document's root where the browser has none (`syncSystem`) — so what is said agrees with what is drawn.
|
|
282
|
+
const chooser = styleQueries() ? parent : anchor.ownerDocument.documentElement;
|
|
283
|
+
const debug = debugBuild();
|
|
284
|
+
let marks = null;
|
|
285
|
+
// Read only where something follows from it: words to write or to take back, or a report to make.
|
|
286
|
+
if (describedAsExternal(anchor) && (debug || externalWords(anchor) || written.has(anchor))) {
|
|
287
|
+
const named = getComputedStyle(chooser).getPropertyValue(MARKS_TOKEN).trim();
|
|
288
|
+
marks = MARKS.includes(named) ? named : MARKS[0];
|
|
289
|
+
}
|
|
290
|
+
let contrast = null;
|
|
291
|
+
// LNK-29: a phrase in running text that is not underlined at rest is told from the words beside it by color alone.
|
|
292
|
+
if (debug && live(anchor) && anchor.parentElement && !standalone(anchor) && !current(anchor) && labelled(anchor)) {
|
|
293
|
+
const own = anchor.getAttribute('data-underline') ?? '';
|
|
294
|
+
const named = UNDERLINES.includes(own) ? own : getComputedStyle(chooser).getPropertyValue(UNDERLINE_TOKEN).trim();
|
|
295
|
+
if (named === 'hover' || named === 'never')
|
|
296
|
+
contrast = contrastOf(getComputedStyle(anchor).color, getComputedStyle(parent).color);
|
|
297
|
+
}
|
|
298
|
+
return { marks, contrast };
|
|
299
|
+
}
|
|
300
|
+
const standalone = (anchor) => anchor.hasAttribute('data-standalone') && anchor.getAttribute('data-standalone') !== 'false';
|
|
301
|
+
const current = (anchor) => anchor.hasAttribute('aria-current') && anchor.getAttribute('aria-current') !== 'false';
|
|
302
|
+
/** The anchors whose `aria-description` is this script's, and the words it wrote. */
|
|
303
|
+
const written = new WeakMap();
|
|
304
|
+
/** LNK-29, LNK-34: what follows from what the cascade said. */
|
|
305
|
+
function say(anchor, { marks, contrast }) {
|
|
306
|
+
if (contrast !== null && contrast < 3) {
|
|
307
|
+
report(anchor, 'LNK-29', `it is not underlined at rest and its color stands ${contrast.toFixed(2)}:1 from the text it sits in, under 3:1: people who do not see that difference cannot tell it is a link (WCAG 1.4.1). Underline it (data-underline="always"), or keep unlined links to those that stand by themselves`);
|
|
308
|
+
}
|
|
309
|
+
// LNK-34: one description. The product's own stands; the words set for the page are written where there is none.
|
|
310
|
+
let ours = written.get(anchor);
|
|
311
|
+
const now = anchor.getAttribute('aria-description');
|
|
312
|
+
if (ours !== undefined && now !== ours) {
|
|
313
|
+
// The product wrote over it: it is the product's from here.
|
|
314
|
+
written.delete(anchor);
|
|
315
|
+
ours = undefined;
|
|
316
|
+
}
|
|
317
|
+
const wanted = describedAsExternal(anchor) && marks !== null && marks !== 'none' && !anchor.hasAttribute('aria-describedby');
|
|
318
|
+
const words = externalWords(anchor);
|
|
319
|
+
if (wanted && words && (ours !== undefined || !now?.trim())) {
|
|
320
|
+
if (now !== words)
|
|
321
|
+
anchor.setAttribute('aria-description', words);
|
|
322
|
+
written.set(anchor, words);
|
|
323
|
+
}
|
|
324
|
+
else if (ours !== undefined) {
|
|
325
|
+
anchor.removeAttribute('aria-description');
|
|
326
|
+
written.delete(anchor);
|
|
327
|
+
}
|
|
328
|
+
if (wanted && !(anchor.getAttribute('aria-description') ?? '').trim()) {
|
|
329
|
+
// Once for the page, not once for each link; the key is recorded for `missingWords()`.
|
|
330
|
+
wordLacking(anchor, 'externalLabel');
|
|
331
|
+
report(anchor.ownerDocument.documentElement, 'LNK-34', 'a link of this page leaves the site and nothing says so to people who cannot see the arrow: give each external link aria-description, or set the words once for the page — setWords({ externalLabel }) of @tanrei/web, or externalLabel of markExternalLinks() where the page is made ("external link", in the product’s language; Tanrei ships no words)');
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/** Reads every anchor of a batch: first what each carries (attributes are written), then every style, then what follows. */
|
|
335
|
+
function readAll(anchors) {
|
|
336
|
+
const batch = [...anchors];
|
|
337
|
+
for (const anchor of batch)
|
|
338
|
+
read(anchor);
|
|
339
|
+
const looked = batch.map(look);
|
|
340
|
+
batch.forEach((anchor, index) => say(anchor, looked[index]));
|
|
341
|
+
}
|
|
342
|
+
let probe;
|
|
343
|
+
/** A color as the browser computed it, as sRGB bytes — whatever space it is written in. Null: it cannot be read, or it lets what is behind it through. */
|
|
344
|
+
function bytes(color) {
|
|
345
|
+
if (probe === undefined) {
|
|
346
|
+
try {
|
|
347
|
+
const canvas = document.createElement('canvas');
|
|
348
|
+
canvas.width = canvas.height = 1;
|
|
349
|
+
probe = canvas.getContext('2d', { willReadFrequently: true });
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
probe = null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (!probe)
|
|
356
|
+
return null;
|
|
357
|
+
try {
|
|
358
|
+
probe.clearRect(0, 0, 1, 1);
|
|
359
|
+
probe.fillStyle = '#010203';
|
|
360
|
+
probe.fillStyle = color;
|
|
361
|
+
// A color the canvas cannot read leaves the one before it.
|
|
362
|
+
if (probe.fillStyle === '#010203' && !/^(#010203|rgb\(1, 2, 3\))$/i.test(color.trim()))
|
|
363
|
+
return null;
|
|
364
|
+
probe.fillRect(0, 0, 1, 1);
|
|
365
|
+
const [r, g, b, a] = probe.getImageData(0, 0, 1, 1).data;
|
|
366
|
+
return a === 255 ? [r, g, b] : null;
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/** WCAG's relative luminance of an sRGB color. */
|
|
373
|
+
function luminance([r, g, b]) {
|
|
374
|
+
const linear = (byte) => {
|
|
375
|
+
const c = byte / 255;
|
|
376
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
377
|
+
};
|
|
378
|
+
return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
|
|
379
|
+
}
|
|
380
|
+
/** WCAG's contrast ratio of two colors, or null where either cannot be read. */
|
|
381
|
+
function contrastOf(one, other) {
|
|
382
|
+
const [a, b] = [bytes(one), bytes(other)];
|
|
383
|
+
if (!a || !b)
|
|
384
|
+
return null;
|
|
385
|
+
const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
386
|
+
return (light + 0.05) / (dark + 0.05);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* LNK-27, LNK-33, for a browser without style container queries: the two choices of the design system, by name, on
|
|
390
|
+
* the document's root, where the stylesheet reads them. A value a region set for itself is not seen (README, "Link").
|
|
391
|
+
*/
|
|
392
|
+
function syncSystem(doc) {
|
|
393
|
+
if (styleQueries())
|
|
394
|
+
return;
|
|
395
|
+
const root = doc.documentElement;
|
|
396
|
+
const style = getComputedStyle(root);
|
|
397
|
+
for (const [attribute, token, values] of [
|
|
398
|
+
['data-underline-system', UNDERLINE_TOKEN, UNDERLINES],
|
|
399
|
+
['data-external-marks-system', MARKS_TOKEN, MARKS],
|
|
400
|
+
]) {
|
|
401
|
+
const named = style.getPropertyValue(token).trim();
|
|
402
|
+
const value = values.includes(named) ? named : values[0];
|
|
403
|
+
if (root.getAttribute(attribute) !== value)
|
|
404
|
+
root.setAttribute(attribute, value);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/** The anchors whose address was refused and taken off: said once, as a refusal, and not again as a missing href. */
|
|
408
|
+
const refused = new WeakSet();
|
|
409
|
+
/**
|
|
410
|
+
* The press is this script's from here: the stylesheet's own answer to `:active` (link.css, for a page without the
|
|
411
|
+
* script) stands down for an anchor that carries `data-pressed`, so the attribute is written before anything reads a
|
|
412
|
+
* style — the press primitive reads the system's feedback from the cascade first, and would otherwise compute the
|
|
413
|
+
* stylesheet's overlay for that one read and hold it. The primitive then names the feedback in its place.
|
|
414
|
+
*/
|
|
415
|
+
function answered(anchor) {
|
|
416
|
+
if (!anchor.hasAttribute('data-pressed'))
|
|
417
|
+
anchor.dataset.pressed = 'none';
|
|
418
|
+
}
|
|
419
|
+
const presses = new WeakMap();
|
|
420
|
+
/** The press of one anchor (the shared primitive), made when it is first pressed. */
|
|
421
|
+
function pressOf(anchor) {
|
|
422
|
+
let press = presses.get(anchor);
|
|
423
|
+
if (!press) {
|
|
424
|
+
press = new PressController(anchor, {
|
|
425
|
+
container: () => anchor,
|
|
426
|
+
// The anchor's first transition is the hold (link.css), so its delay is press-hold as a time.
|
|
427
|
+
holdCarrier: () => anchor,
|
|
428
|
+
disabled: () => !live(anchor),
|
|
429
|
+
keys: LINK_KEYS,
|
|
430
|
+
// LNK-9's fallback: a link that runs over several lines has no one box to grow a ripple in.
|
|
431
|
+
feedback: (named) => (named === 'ripple' && anchor.getClientRects().length > 1 ? 'overlay' : named),
|
|
432
|
+
});
|
|
433
|
+
presses.set(anchor, press);
|
|
434
|
+
}
|
|
435
|
+
return press;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Where a root keeps the function that stops its observation: on the root itself, under a registered symbol, so that a
|
|
439
|
+
* second copy of this module on the page (two bundles, or a document written again over the same window) takes the
|
|
440
|
+
* first one's place instead of answering every press twice.
|
|
441
|
+
*/
|
|
442
|
+
const OBSERVING = Symbol.for('tanrei.observe-links');
|
|
443
|
+
const OWNER = {};
|
|
444
|
+
/**
|
|
445
|
+
* Adds the script side of the Link to every `a.tanrei-link` and every anchor of a `.tanrei-prose` under `root`, now
|
|
446
|
+
* and as the page changes. `@tanrei/web` and `@tanrei/web/link` call it for the document when they load; call it
|
|
447
|
+
* yourself for a shadow root of your own, which the document's listeners cannot see into. Calling it twice for one root
|
|
448
|
+
* observes once. Returns a function that stops (what was already written on an anchor stays).
|
|
449
|
+
*/
|
|
450
|
+
export function observeLinks(root = document) {
|
|
451
|
+
const observed = root;
|
|
452
|
+
const running = observed[OBSERVING];
|
|
453
|
+
if (running?.owner === OWNER)
|
|
454
|
+
return running;
|
|
455
|
+
if (typeof MutationObserver === 'undefined')
|
|
456
|
+
return () => { };
|
|
457
|
+
running?.();
|
|
458
|
+
let held = null;
|
|
459
|
+
const release = () => {
|
|
460
|
+
held?.press.release();
|
|
461
|
+
held = null;
|
|
462
|
+
};
|
|
463
|
+
const onPointerDown = (event) => {
|
|
464
|
+
const anchor = linkOf(event.target);
|
|
465
|
+
if (!anchor || !live(anchor))
|
|
466
|
+
return;
|
|
467
|
+
const pointer = event;
|
|
468
|
+
if (pointer.button !== 0 && pointer.pointerType === 'mouse')
|
|
469
|
+
return;
|
|
470
|
+
answered(anchor);
|
|
471
|
+
held = { anchor, press: pressOf(anchor) };
|
|
472
|
+
held.press.onPointerDown(pointer);
|
|
473
|
+
};
|
|
474
|
+
// `pointerleave` does not reach the document: the press ends when the pointer goes out of the anchor it holds.
|
|
475
|
+
const onPointerOut = (event) => {
|
|
476
|
+
const to = event.relatedTarget;
|
|
477
|
+
if (held && !(to instanceof Node && held.anchor.contains(to)))
|
|
478
|
+
release();
|
|
479
|
+
};
|
|
480
|
+
const onKeyDown = (event) => {
|
|
481
|
+
const anchor = linkOf(event.target);
|
|
482
|
+
const key = event;
|
|
483
|
+
if (!anchor || !live(anchor) || key.repeat || !LINK_KEYS.includes(key.key))
|
|
484
|
+
return;
|
|
485
|
+
answered(anchor);
|
|
486
|
+
pressOf(anchor).onKeyDown(key);
|
|
487
|
+
};
|
|
488
|
+
const onKeyUp = (event) => {
|
|
489
|
+
const anchor = linkOf(event.target);
|
|
490
|
+
if (anchor)
|
|
491
|
+
presses.get(anchor)?.onKeyUp(event);
|
|
492
|
+
};
|
|
493
|
+
const onFocusIn = (event) => {
|
|
494
|
+
const anchor = linkOf(event.target);
|
|
495
|
+
if (anchor)
|
|
496
|
+
syncFocusStyle(anchor, anchor);
|
|
497
|
+
};
|
|
498
|
+
const onFocusOut = (event) => {
|
|
499
|
+
const anchor = linkOf(event.target);
|
|
500
|
+
if (anchor)
|
|
501
|
+
presses.get(anchor)?.onBlur();
|
|
502
|
+
};
|
|
503
|
+
// LNK-19: a disabled link opens nothing and emits no click, even where the product left its address on it.
|
|
504
|
+
const onClick = (event) => {
|
|
505
|
+
const anchor = linkOf(event.target);
|
|
506
|
+
if (!anchor || !disabled(anchor))
|
|
507
|
+
return;
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
event.stopImmediatePropagation();
|
|
510
|
+
};
|
|
511
|
+
// LNK-32: a picture that cannot be loaded draws nothing in its room; one that arrives after all is drawn. (Neither
|
|
512
|
+
// event bubbles: both are heard on their way down.)
|
|
513
|
+
const pictureOf = (event) => {
|
|
514
|
+
const picture = event.target;
|
|
515
|
+
if (!(picture instanceof HTMLImageElement) || !picture.classList.contains(SITE_ICON))
|
|
516
|
+
return null;
|
|
517
|
+
const anchor = picture.parentElement instanceof HTMLAnchorElement ? linkOf(picture.parentElement) : null;
|
|
518
|
+
return anchor ? [anchor, picture] : null;
|
|
519
|
+
};
|
|
520
|
+
const onPictureError = (event) => {
|
|
521
|
+
const found = pictureOf(event);
|
|
522
|
+
if (found)
|
|
523
|
+
failed(...found);
|
|
524
|
+
};
|
|
525
|
+
const onPictureLoad = (event) => {
|
|
526
|
+
pictureOf(event)?.[1].removeAttribute('data-failed');
|
|
527
|
+
};
|
|
528
|
+
const listeners = [
|
|
529
|
+
['error', onPictureError],
|
|
530
|
+
['load', onPictureLoad],
|
|
531
|
+
['pointerdown', onPointerDown],
|
|
532
|
+
['pointerup', release],
|
|
533
|
+
['pointercancel', release],
|
|
534
|
+
['pointerout', onPointerOut],
|
|
535
|
+
['dragstart', release],
|
|
536
|
+
['keydown', onKeyDown],
|
|
537
|
+
['keyup', onKeyUp],
|
|
538
|
+
['focusin', onFocusIn],
|
|
539
|
+
['focusout', onFocusOut],
|
|
540
|
+
['click', onClick],
|
|
541
|
+
['auxclick', onClick],
|
|
542
|
+
];
|
|
543
|
+
for (const [type, listener] of listeners)
|
|
544
|
+
root.addEventListener(type, listener, true);
|
|
545
|
+
const links = (anchors) => [...anchors].filter((anchor) => anchor instanceof HTMLAnchorElement && anchor.isConnected && linkOf(anchor) === anchor);
|
|
546
|
+
const doc = root instanceof Document ? root : root.ownerDocument;
|
|
547
|
+
const observer = new MutationObserver((records) => {
|
|
548
|
+
syncSystem(doc);
|
|
549
|
+
const anchors = new Set();
|
|
550
|
+
for (const record of records) {
|
|
551
|
+
if (record.type === 'attributes') {
|
|
552
|
+
if (record.target instanceof HTMLAnchorElement)
|
|
553
|
+
anchors.add(record.target);
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
// A glyph or a text added to an anchor changes what names it.
|
|
557
|
+
const around = record.target instanceof Element ? record.target.closest('a') : null;
|
|
558
|
+
if (around)
|
|
559
|
+
anchors.add(around);
|
|
560
|
+
for (const node of record.addedNodes) {
|
|
561
|
+
if (!(node instanceof Element))
|
|
562
|
+
continue;
|
|
563
|
+
if (node.localName === 'a')
|
|
564
|
+
anchors.add(node);
|
|
565
|
+
for (const anchor of node.querySelectorAll('a'))
|
|
566
|
+
anchors.add(anchor);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
readAll(links(anchors));
|
|
570
|
+
});
|
|
571
|
+
observer.observe(root, { attributes: true, attributeFilter: ATTRIBUTES, childList: true, subtree: true });
|
|
572
|
+
// Where there are no style queries the root's own attributes may name another design system: its choices are read again.
|
|
573
|
+
const systemObserver = styleQueries() ? null : new MutationObserver(() => syncSystem(doc));
|
|
574
|
+
systemObserver?.observe(doc.documentElement, { attributes: true });
|
|
575
|
+
syncSystem(doc);
|
|
576
|
+
const reread = () => readAll(links(root.querySelectorAll('a')));
|
|
577
|
+
settings().reread.add(reread);
|
|
578
|
+
reread();
|
|
579
|
+
const stop = () => {
|
|
580
|
+
observer.disconnect();
|
|
581
|
+
systemObserver?.disconnect();
|
|
582
|
+
settings().reread.delete(reread);
|
|
583
|
+
for (const [type, listener] of listeners)
|
|
584
|
+
root.removeEventListener(type, listener, true);
|
|
585
|
+
release();
|
|
586
|
+
if (observed[OBSERVING] === stop)
|
|
587
|
+
delete observed[OBSERVING];
|
|
588
|
+
};
|
|
589
|
+
observed[OBSERVING] = Object.assign(stop, { owner: OWNER });
|
|
590
|
+
return stop;
|
|
591
|
+
}
|
|
592
|
+
if (typeof document !== 'undefined')
|
|
593
|
+
observeLinks(document);
|
|
594
|
+
//# sourceMappingURL=link.js.map
|