@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,303 @@
|
|
|
1
|
+
// The web's way of composing (W1 to W14), built once. A composed element is a custom element whose shadow root holds its members' OWN custom
|
|
2
|
+
// elements, by their tags — never a copy of what they draw. What is here is everything such an element needs besides
|
|
3
|
+
// its template (README "Composed elements" is the builder's guide):
|
|
4
|
+
//
|
|
5
|
+
// ComposedElement — the base of every composed element: focus passed to the control without delegating it (W7), a
|
|
6
|
+
// slot passed on only while it is filled (W9), the Field's connection left alone and asked again
|
|
7
|
+
// through the element (W8), `updateComplete` that waits for the members, the debug report for an
|
|
8
|
+
// ARIA name on the host (W8).
|
|
9
|
+
// ComposedControl — a composed element with a value member: the value that is the member's at every moment (W5) and
|
|
10
|
+
// the form — the element is the form's control and repeats what its value member tells its own
|
|
11
|
+
// internals (W6). `memberUpdated()` is where an element fills a member's prop from what its value
|
|
12
|
+
// member holds (W14, `fills`).
|
|
13
|
+
// forward() — src/primitives/forward.ts: a directive on a member's tag — each named property of the composed
|
|
14
|
+
// element set on the member, as a property, on every render (W2).
|
|
15
|
+
// exported() — a member's documented parts as an `exportparts` value, from the list its class keeps (W4).
|
|
16
|
+
//
|
|
17
|
+
// The element writes no custom property and reads no token of a member (W3): nothing here touches a style.
|
|
18
|
+
import { LitElement, css, html, nothing } from 'lit';
|
|
19
|
+
import { FIELD_CONTROL } from './field.js';
|
|
20
|
+
import { takeFormDisabled } from './form-disabled.js';
|
|
21
|
+
import { formSaysOf } from './form-says.js';
|
|
22
|
+
import { hiddenHost } from './hidden.js';
|
|
23
|
+
import { report } from './report.js';
|
|
24
|
+
import { disabledWaitsWhileFocused } from './disabled-while-focused.js';
|
|
25
|
+
import { wantsAutofocus } from './autofocus.js';
|
|
26
|
+
export { forward } from './forward.js';
|
|
27
|
+
/**
|
|
28
|
+
* W4: a member's documented parts for the composed element — `attribute` is the member's `exportparts`, `names` what
|
|
29
|
+
* `::part()` on the composed element can then name. Made from the member's own list, never written by hand. `collisions`
|
|
30
|
+
* says, for a part whose name two members share, the prefixed name it is always exported under and whether the bare
|
|
31
|
+
* name is exported too (`exportparts="label, label: field-label"`). `omit` names the parts of the member that the
|
|
32
|
+
* composed element never draws and so does not export — a Field's `counter`, in a field that gives its Field no count.
|
|
33
|
+
*/
|
|
34
|
+
export function exported(member, collisions = {}, omit = []) {
|
|
35
|
+
const entries = [];
|
|
36
|
+
const names = [];
|
|
37
|
+
for (const part of member.parts) {
|
|
38
|
+
if (omit.includes(part))
|
|
39
|
+
continue;
|
|
40
|
+
const collision = collisions[part];
|
|
41
|
+
if (!collision) {
|
|
42
|
+
entries.push(part);
|
|
43
|
+
names.push(part);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (collision.bare) {
|
|
47
|
+
entries.push(part);
|
|
48
|
+
names.push(part);
|
|
49
|
+
}
|
|
50
|
+
entries.push(`${part}: ${collision.as}`);
|
|
51
|
+
names.push(collision.as);
|
|
52
|
+
}
|
|
53
|
+
return { attribute: entries.join(', '), names };
|
|
54
|
+
}
|
|
55
|
+
// ─── The base ────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
56
|
+
/** W1: a composed element's own stylesheet where it has no part and no arrangement of its own — the host is a block. */
|
|
57
|
+
export const composedHost = css `
|
|
58
|
+
:host {
|
|
59
|
+
display: block;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
/**
|
|
63
|
+
* W8: a frame defined after the controls inside it asks each of its descendants to ask again (`FIELD_CONTROL`), and
|
|
64
|
+
* cannot see into a shadow root: the composed element keeps, under the same key a control does, a way to have its
|
|
65
|
+
* members ask. One that has its answer already does nothing; the frame member's own question then leaves the element.
|
|
66
|
+
*/
|
|
67
|
+
function passAsking(host, members) {
|
|
68
|
+
host[FIELD_CONTROL] = { ask: () => members().forEach((member) => member[FIELD_CONTROL]?.ask?.()) };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The base of a composed element (W1, W7, W8, W9). A subclass renders its members' own elements —
|
|
72
|
+
* `<tanrei-field part="field" exportparts=${FIELD_PARTS.attribute} ${forward(this, FIELD)}>` — and says which of them
|
|
73
|
+
* focus goes to (`control`).
|
|
74
|
+
*
|
|
75
|
+
* The shadow root does not delegate focus (W7): a press on text that is not a control must move no focus. The host is
|
|
76
|
+
* never focusable; `focus()` and `blur()` are the control's, a click that arrives on the host itself — a page's own
|
|
77
|
+
* `<label for>` — moves focus to the control, and `autofocus` on the host reaches the control when the element first
|
|
78
|
+
* renders.
|
|
79
|
+
*/
|
|
80
|
+
export class ComposedElement extends LitElement {
|
|
81
|
+
static { this.styles = [composedHost, hiddenHost]; }
|
|
82
|
+
constructor() {
|
|
83
|
+
super();
|
|
84
|
+
/**
|
|
85
|
+
* W8: the sentence a debug build names when the host is given an ARIA name. The host has no role: its name is the
|
|
86
|
+
* frame's `label`. Empty: nothing is reported.
|
|
87
|
+
*/
|
|
88
|
+
this.hostNameSentence = '';
|
|
89
|
+
/** W9: the names of the slots it has passed on, and the watch on its own children for them. */
|
|
90
|
+
this.passing = new Set();
|
|
91
|
+
this.children_ = null;
|
|
92
|
+
this.focusedAtFirst = false;
|
|
93
|
+
// W7, item 3: a click on the host itself is not a press inside it (whose first target is a member's): it is what a
|
|
94
|
+
// page's `<label for>` sends its control.
|
|
95
|
+
this.addEventListener('click', (event) => {
|
|
96
|
+
if (event.composedPath()[0] === this)
|
|
97
|
+
this.control?.focus();
|
|
98
|
+
});
|
|
99
|
+
passAsking(this, () => this.members);
|
|
100
|
+
}
|
|
101
|
+
/** The members it has rendered: the custom elements of its own shadow tree. */
|
|
102
|
+
get members() {
|
|
103
|
+
return [...(this.renderRoot?.querySelectorAll('*') ?? [])].filter((element) => element.localName.includes('-'));
|
|
104
|
+
}
|
|
105
|
+
/** W7, item 2: focus is the control's. */
|
|
106
|
+
focus(options) {
|
|
107
|
+
this.control?.focus(options);
|
|
108
|
+
}
|
|
109
|
+
/** W7, item 2: what has focus inside the control loses it (an engine does not take it from inside a host it blurs). */
|
|
110
|
+
blur() {
|
|
111
|
+
let active = this.shadowRoot?.activeElement ?? null;
|
|
112
|
+
while (active?.shadowRoot?.activeElement)
|
|
113
|
+
active = active.shadowRoot.activeElement;
|
|
114
|
+
active?.blur();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* W9: a slot of a member, passed on — `${this.pass('label-icon')}` among that member's children. Rendered only while
|
|
118
|
+
* the element has a child for it: a member that draws room for a filled slot would take a passing slot that is
|
|
119
|
+
* always there for content.
|
|
120
|
+
*/
|
|
121
|
+
pass(name) {
|
|
122
|
+
if (!this.passing.has(name)) {
|
|
123
|
+
this.passing.add(name);
|
|
124
|
+
this.watchChildren();
|
|
125
|
+
}
|
|
126
|
+
return [...this.children].some((child) => child.slot === name) ? html `<slot name=${name} slot=${name}></slot>` : nothing;
|
|
127
|
+
}
|
|
128
|
+
watchChildren() {
|
|
129
|
+
if (this.children_ || !this.passing.size || typeof MutationObserver === 'undefined')
|
|
130
|
+
return;
|
|
131
|
+
this.children_ = new MutationObserver(() => this.requestUpdate());
|
|
132
|
+
// The element's own children and the slot each of them names; nothing below them.
|
|
133
|
+
this.children_.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['slot'] });
|
|
134
|
+
}
|
|
135
|
+
connectedCallback() {
|
|
136
|
+
super.connectedCallback();
|
|
137
|
+
this.watchChildren();
|
|
138
|
+
}
|
|
139
|
+
disconnectedCallback() {
|
|
140
|
+
super.disconnectedCallback();
|
|
141
|
+
this.children_?.disconnect();
|
|
142
|
+
this.children_ = null;
|
|
143
|
+
}
|
|
144
|
+
/** The element has updated when its members have: what it gave them, they have taken. */
|
|
145
|
+
async getUpdateComplete() {
|
|
146
|
+
const done = await super.getUpdateComplete();
|
|
147
|
+
await Promise.all(this.members.map((member) => member.updateComplete));
|
|
148
|
+
return done;
|
|
149
|
+
}
|
|
150
|
+
updated(changed) {
|
|
151
|
+
super.updated(changed);
|
|
152
|
+
// W7, item 4: `autofocus` on the host. The browser focuses nothing for it — the host is not focusable — so the
|
|
153
|
+
// element gives the control focus itself, once, when it first renders, and only where the page has given focus to
|
|
154
|
+
// nothing else (as the browser's own autofocus does).
|
|
155
|
+
if (!this.focusedAtFirst) {
|
|
156
|
+
this.focusedAtFirst = true;
|
|
157
|
+
if (wantsAutofocus(this))
|
|
158
|
+
void this.focusWhenReady();
|
|
159
|
+
}
|
|
160
|
+
// W8: the host has no role, so an ARIA name on it names nothing a person meets.
|
|
161
|
+
if (this.hostNameSentence && (this.hasAttribute('aria-label') || this.hasAttribute('aria-labelledby'))) {
|
|
162
|
+
report(this, this.hostNameSentence, 'aria-label and aria-labelledby on the element name nothing: it has no role; name it with label (labelHidden keeps the name and draws none)');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** The control has rendered what takes focus only after its own first update. */
|
|
166
|
+
async focusWhenReady() {
|
|
167
|
+
await this.updateComplete;
|
|
168
|
+
if (this.isConnected)
|
|
169
|
+
this.control?.focus();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A composed element with a value member (W5, W6). The subclass names the member (`valueMember`) and writes the
|
|
174
|
+
* `value` accessor in place, on these two:
|
|
175
|
+
*
|
|
176
|
+
* get value(): string { return this.memberValue(''); }
|
|
177
|
+
* set value(value: string) { this.giveValue(value); }
|
|
178
|
+
*
|
|
179
|
+
* **The value is the member's at every moment** (W5): what was last set on the element until the member has taken it
|
|
180
|
+
* — the element's next render — and from then on what the member holds. So in every listener of a member's event,
|
|
181
|
+
* capturing or bubbling, `event.target.value` is the new value, and a value the member changed is read back changed.
|
|
182
|
+
*
|
|
183
|
+
* **The element is the form's control** (W6): its class says `static formAssociated = true`; it takes `name` and `form`, and repeats on its own
|
|
184
|
+
* internals what its value member tells its own through `FormSays` (src/primitives/form-says.ts) — the value and the
|
|
185
|
+
* state as they are, the validity flags, the message and the member's own anchor. It resets to its `value` attribute
|
|
186
|
+
* (`firstValue()`), passes a restore on to the member, and joins a disabled `<fieldset>` with its own `disabled` for
|
|
187
|
+
* its frame (`formDisabled`). Enter is the member's: it asks for the element's form (`formOf`).
|
|
188
|
+
*/
|
|
189
|
+
export class ComposedControl extends ComposedElement {
|
|
190
|
+
constructor() {
|
|
191
|
+
super(...arguments);
|
|
192
|
+
/** Web only: the name the value is submitted under. */
|
|
193
|
+
this.name = '';
|
|
194
|
+
/** W6, item 6: a disabled `<fieldset>` around the element, or its own `disabled` attribute, as the platform says it. */
|
|
195
|
+
this.formDisabled = false;
|
|
196
|
+
this.internals = this.attachInternals();
|
|
197
|
+
this.pending = false;
|
|
198
|
+
this.heard = null;
|
|
199
|
+
this.restored = null;
|
|
200
|
+
}
|
|
201
|
+
static { this.properties = {
|
|
202
|
+
name: { type: String, reflect: true },
|
|
203
|
+
formDisabled: { state: true },
|
|
204
|
+
}; }
|
|
205
|
+
get control() {
|
|
206
|
+
return this.valueMember;
|
|
207
|
+
}
|
|
208
|
+
/** W5: what `value` returns — `initial` is the member's own default, for an element that has not rendered and was given nothing. */
|
|
209
|
+
memberValue(initial) {
|
|
210
|
+
if (this.pending)
|
|
211
|
+
return this.given;
|
|
212
|
+
const member = this.valueMember;
|
|
213
|
+
return member ? member.value : initial;
|
|
214
|
+
}
|
|
215
|
+
/** W5: what `value` is set with. The member takes it at the element's next render; what the member holds already changes nothing. */
|
|
216
|
+
giveValue(value) {
|
|
217
|
+
const member = this.valueMember;
|
|
218
|
+
if (!this.pending && member && Object.is(member.value, value))
|
|
219
|
+
return;
|
|
220
|
+
this.given = value;
|
|
221
|
+
this.pending = true;
|
|
222
|
+
}
|
|
223
|
+
/** W6, item 4: the value a form's reset returns to — the `value` attribute, where the first value is written. */
|
|
224
|
+
firstValue() {
|
|
225
|
+
return (this.getAttribute('value') ?? '');
|
|
226
|
+
}
|
|
227
|
+
/** The form it belongs to, if any. */
|
|
228
|
+
get form() {
|
|
229
|
+
return this.internals.form;
|
|
230
|
+
}
|
|
231
|
+
/** The element's validity: its value member's (W6, item 3). */
|
|
232
|
+
get validity() {
|
|
233
|
+
return this.internals.validity;
|
|
234
|
+
}
|
|
235
|
+
get validationMessage() {
|
|
236
|
+
return this.internals.validationMessage;
|
|
237
|
+
}
|
|
238
|
+
get willValidate() {
|
|
239
|
+
return this.internals.willValidate;
|
|
240
|
+
}
|
|
241
|
+
checkValidity() {
|
|
242
|
+
return this.internals.checkValidity();
|
|
243
|
+
}
|
|
244
|
+
reportValidity() {
|
|
245
|
+
return this.internals.reportValidity();
|
|
246
|
+
}
|
|
247
|
+
formResetCallback() {
|
|
248
|
+
this.value = this.firstValue();
|
|
249
|
+
}
|
|
250
|
+
formStateRestoreCallback(state, mode) {
|
|
251
|
+
const member = this.valueMember;
|
|
252
|
+
// Restored before it first rendered: passed on when the member is there.
|
|
253
|
+
if (!member) {
|
|
254
|
+
this.restored = [state, mode];
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
member.formStateRestoreCallback?.(state, mode);
|
|
258
|
+
// W6, item 5: the member's value is the element's.
|
|
259
|
+
this.pending = false;
|
|
260
|
+
this.given = undefined;
|
|
261
|
+
}
|
|
262
|
+
formDisabledCallback(disabled) {
|
|
263
|
+
takeFormDisabled(this, disabled, (value) => (this.formDisabled = value));
|
|
264
|
+
}
|
|
265
|
+
/** W6, items 2 and 3: the same value and state, the same flags and message, and the member's own anchor. */
|
|
266
|
+
repeat(word) {
|
|
267
|
+
this.internals.setFormValue(word.value, word.state);
|
|
268
|
+
if (word.anchor)
|
|
269
|
+
this.internals.setValidity(word.flags, word.message, word.anchor);
|
|
270
|
+
else
|
|
271
|
+
this.internals.setValidity(word.flags, word.message);
|
|
272
|
+
this.memberUpdated();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* W14 (`fills`): called after each word the value member tells its form — when the element first hears it, and after
|
|
276
|
+
* each of the member's updates, which is when a member speaks. An element whose spec names a member's prop it fills
|
|
277
|
+
* itself from state the value member holds (a text field: its Field's count text, from its input's count) sets it
|
|
278
|
+
* here; it reads the member and writes the other member's property, and computes nothing of its own. Does nothing
|
|
279
|
+
* otherwise.
|
|
280
|
+
*/
|
|
281
|
+
memberUpdated() { }
|
|
282
|
+
updated(changed) {
|
|
283
|
+
// W5: the render that has just ended gave the member what was set; from here the value is the member's.
|
|
284
|
+
this.pending = false;
|
|
285
|
+
this.given = undefined;
|
|
286
|
+
const member = this.valueMember;
|
|
287
|
+
if (member !== this.heard) {
|
|
288
|
+
this.unhear?.();
|
|
289
|
+
this.heard = member;
|
|
290
|
+
this.unhear = formSaysOf(member)?.hear((word) => this.repeat(word));
|
|
291
|
+
}
|
|
292
|
+
if (member && this.restored) {
|
|
293
|
+
const [state, mode] = this.restored;
|
|
294
|
+
this.restored = null;
|
|
295
|
+
member.formStateRestoreCallback?.(state, mode);
|
|
296
|
+
}
|
|
297
|
+
super.updated(changed);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// W6, item 6: an element's `disabled` attribute, written while it holds focus, waits until focus has left — a frame at
|
|
301
|
+
// most —, so a composed element lets go of focus as the platform's own control does.
|
|
302
|
+
disabledWaitsWhileFocused(ComposedControl);
|
|
303
|
+
//# sourceMappingURL=composed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed.js","sourceRoot":"","sources":["../../src/primitives/composed.ts"],"names":[],"mappings":"AAAA,6IAA6I;AAC7I,qHAAqH;AACrH,oEAAoE;AACpE,EAAE;AACF,qHAAqH;AACrH,sHAAsH;AACtH,sHAAsH;AACtH,mDAAmD;AACnD,uHAAuH;AACvH,oHAAoH;AACpH,uHAAuH;AACvH,oDAAoD;AACpD,s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QACD,IAAI,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5B,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;YACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,MAAM,CAAC,wBAAwB,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;CACF;AAED,uHAAuH;AACvH,qFAAqF;AACrF,yBAAyB,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Tanrei element that can be a form's submit button answers with. Internal between Tanrei elements: the
|
|
3
|
+
* primitive imports no component, so a Button of another copy of the package is read the same way.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SUBMIT_BUTTON: unique symbol;
|
|
6
|
+
/** The element's side: what it is now, read at the moment of the key. */
|
|
7
|
+
export interface SubmitButtonState {
|
|
8
|
+
/** Whether a press of it submits its form now: its type is `submit` and nothing makes it ignore that (BTN-33). */
|
|
9
|
+
readonly submits: boolean;
|
|
10
|
+
/** Whether it is disabled now, by itself or by a disabled fieldset (BTN-32). */
|
|
11
|
+
readonly disabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Marks `button` as a submit button in passing. */
|
|
14
|
+
export declare function markPassingSubmitter(button: HTMLButtonElement): void;
|
|
15
|
+
/**
|
|
16
|
+
* The form's default button: the first submit button among its controls in document order — the platform's own
|
|
17
|
+
* (`<button>` without a type or of type `submit`, `<input type="submit">`, `<input type="image">`) or a Tanrei Button
|
|
18
|
+
* whose type is `submit`. Disabled or not: a disabled default button is still the default button. Null where the form
|
|
19
|
+
* has none.
|
|
20
|
+
*/
|
|
21
|
+
export declare function defaultButton(form: HTMLFormElement): HTMLElement | null;
|
|
22
|
+
/** Whether `button` — a form's default button — is disabled now. */
|
|
23
|
+
export declare function isDisabledButton(button: HTMLElement): boolean;
|
|
24
|
+
/** Whether `button` is a Tanrei Button and not one of the platform's own. */
|
|
25
|
+
export declare function isTanreiButton(button: HTMLElement): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Enter in a control of `form` (BTN-30): the form's default button is pressed — its `click`, and then, unless the
|
|
28
|
+
* product cancelled it, the submission with that button named in it. A disabled default button stops it: nothing is
|
|
29
|
+
* emitted and nothing is sent. A form with no submit button is asked directly, as before. The button takes no focus
|
|
30
|
+
* and draws no pressed state: the key was pressed elsewhere.
|
|
31
|
+
*/
|
|
32
|
+
export declare function pressDefaultButton(form: HTMLFormElement): void;
|
|
33
|
+
/**
|
|
34
|
+
* The form a control submits on Enter: its own — `own`, what its
|
|
35
|
+
* `ElementInternals` says — or, where it has none and stands in the shadow root of a form-associated element, that
|
|
36
|
+
* element's. A member of a composed element is outside every form: the form is the composed element's, which is the
|
|
37
|
+
* form's control. A control calls `formOf(this, this.form)` where it read `this.form`, and presses that form's default
|
|
38
|
+
* button.
|
|
39
|
+
*
|
|
40
|
+
* It looks no further than form-associated hosts: a control in the shadow root of anything else has no form, as before.
|
|
41
|
+
*/
|
|
42
|
+
export declare function formOf(control: Element, own: HTMLFormElement | null): HTMLFormElement | null;
|
|
43
|
+
/**
|
|
44
|
+
* A Tanrei submit Button tells which form it belongs to now (`null`: none, or it is no submit button any more). While
|
|
45
|
+
* a form has at least one, Enter in a control of the platform's own that belongs to that form — inside it or naming
|
|
46
|
+
* it from outside — presses the form's default button when that button is Tanrei's (BTN-30): one `keydown` listener
|
|
47
|
+
* per tree, in the capture phase, added with the tree's first such form and removed with its last.
|
|
48
|
+
*/
|
|
49
|
+
export declare function watchNativeInputs(button: Element, form: HTMLFormElement | null, previous: HTMLFormElement | null): void;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// A form's default button, and the one way a Tanrei control asks its form to submit on Enter (BTN-30).
|
|
2
|
+
//
|
|
3
|
+
// The platform's rule: Enter in a field presses the form's default button — its first submit button in document
|
|
4
|
+
// order — so that button's `click` is emitted, its name and value are sent, and a disabled one stops the submission.
|
|
5
|
+
// A Tanrei Button of type `submit` counts exactly as the platform's own does. Every Tanrei control that submits its form
|
|
6
|
+
// on Enter calls `pressDefaultButton()` where it would ask the form directly (the text field, the number field, the
|
|
7
|
+
// color field, the combobox, the one-time-code input, the search, and the selection primitive of the checkbox, the radio
|
|
8
|
+
// button and the switch), and `watchNativeInputs()` lets the browser itself press a Tanrei default button from the
|
|
9
|
+
// platform's own controls, which know only the platform's buttons.
|
|
10
|
+
/**
|
|
11
|
+
* What a Tanrei element that can be a form's submit button answers with. Internal between Tanrei elements: the
|
|
12
|
+
* primitive imports no component, so a Button of another copy of the package is read the same way.
|
|
13
|
+
*/
|
|
14
|
+
export const SUBMIT_BUTTON = Symbol.for('tanrei.submit-button');
|
|
15
|
+
/**
|
|
16
|
+
* The submit buttons of the platform's own that a Button holds in passing: the submitter of one dispatch (BTN-31), in
|
|
17
|
+
* `form.elements` while a `submit` listener runs, and the one the browser presses for Enter in a control of its own
|
|
18
|
+
* (`watchNativeInputs()`). Neither is ever a form's default button. A property and not a set of this module, so a
|
|
19
|
+
* Button of another copy of the package is read the same way.
|
|
20
|
+
*/
|
|
21
|
+
const PASSING = Symbol.for('tanrei.passing-submitter');
|
|
22
|
+
/** Marks `button` as a submit button in passing. */
|
|
23
|
+
export function markPassingSubmitter(button) {
|
|
24
|
+
button[PASSING] = true;
|
|
25
|
+
}
|
|
26
|
+
const isTanreiSubmit = (el) => SUBMIT_BUTTON in el && el[SUBMIT_BUTTON].submits;
|
|
27
|
+
// An image button is a submit button the platform leaves out of `form.elements`.
|
|
28
|
+
const isNativeSubmit = (el) => !(PASSING in el) && ((el instanceof HTMLButtonElement && el.type === 'submit') || (el instanceof HTMLInputElement && (el.type === 'submit' || el.type === 'image')));
|
|
29
|
+
/**
|
|
30
|
+
* The form's default button: the first submit button among its controls in document order — the platform's own
|
|
31
|
+
* (`<button>` without a type or of type `submit`, `<input type="submit">`, `<input type="image">`) or a Tanrei Button
|
|
32
|
+
* whose type is `submit`. Disabled or not: a disabled default button is still the default button. Null where the form
|
|
33
|
+
* has none.
|
|
34
|
+
*/
|
|
35
|
+
export function defaultButton(form) {
|
|
36
|
+
let first = null;
|
|
37
|
+
for (const el of form.elements) {
|
|
38
|
+
if (isNativeSubmit(el) || isTanreiSubmit(el)) {
|
|
39
|
+
first = el;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Image buttons are not listed: one that stands before the first listed button is the default button.
|
|
44
|
+
const root = form.getRootNode();
|
|
45
|
+
for (const image of root.querySelectorAll('input[type="image" i]')) {
|
|
46
|
+
if (image.form !== form)
|
|
47
|
+
continue;
|
|
48
|
+
if (!first || image.compareDocumentPosition(first) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
49
|
+
return image;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return first;
|
|
53
|
+
}
|
|
54
|
+
/** Whether `button` — a form's default button — is disabled now. */
|
|
55
|
+
export function isDisabledButton(button) {
|
|
56
|
+
return SUBMIT_BUTTON in button ? button[SUBMIT_BUTTON].disabled : button.matches(':disabled');
|
|
57
|
+
}
|
|
58
|
+
/** Whether `button` is a Tanrei Button and not one of the platform's own. */
|
|
59
|
+
export function isTanreiButton(button) {
|
|
60
|
+
return SUBMIT_BUTTON in button;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Enter in a control of `form` (BTN-30): the form's default button is pressed — its `click`, and then, unless the
|
|
64
|
+
* product cancelled it, the submission with that button named in it. A disabled default button stops it: nothing is
|
|
65
|
+
* emitted and nothing is sent. A form with no submit button is asked directly, as before. The button takes no focus
|
|
66
|
+
* and draws no pressed state: the key was pressed elsewhere.
|
|
67
|
+
*/
|
|
68
|
+
export function pressDefaultButton(form) {
|
|
69
|
+
const button = defaultButton(form);
|
|
70
|
+
if (!button) {
|
|
71
|
+
form.requestSubmit();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (isDisabledButton(button))
|
|
75
|
+
return;
|
|
76
|
+
button.click();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The form a control submits on Enter: its own — `own`, what its
|
|
80
|
+
* `ElementInternals` says — or, where it has none and stands in the shadow root of a form-associated element, that
|
|
81
|
+
* element's. A member of a composed element is outside every form: the form is the composed element's, which is the
|
|
82
|
+
* form's control. A control calls `formOf(this, this.form)` where it read `this.form`, and presses that form's default
|
|
83
|
+
* button.
|
|
84
|
+
*
|
|
85
|
+
* It looks no further than form-associated hosts: a control in the shadow root of anything else has no form, as before.
|
|
86
|
+
*/
|
|
87
|
+
export function formOf(control, own) {
|
|
88
|
+
let form = own;
|
|
89
|
+
let at = control;
|
|
90
|
+
while (!form) {
|
|
91
|
+
const root = at.getRootNode();
|
|
92
|
+
if (!(root instanceof ShadowRoot))
|
|
93
|
+
break;
|
|
94
|
+
const host = root.host;
|
|
95
|
+
if (!host.constructor.formAssociated)
|
|
96
|
+
break;
|
|
97
|
+
form = host.form instanceof HTMLFormElement ? host.form : null;
|
|
98
|
+
at = host;
|
|
99
|
+
}
|
|
100
|
+
return form;
|
|
101
|
+
}
|
|
102
|
+
// ─── Enter in the platform's own controls ────────────────────────────────────────────────────────────────────────
|
|
103
|
+
//
|
|
104
|
+
// A native control knows only the platform's buttons, and what it does with Enter is the engine's own: which controls
|
|
105
|
+
// submit (a `<select>` and a range input in two engines of three), with which modifier keys (Alt and the command key
|
|
106
|
+
// in one), never for the Enter an input method or a suggestion list took, and always after the field has committed
|
|
107
|
+
// what was typed — `change`, then the button's `click`, then `submit`. None of that is listed here. For the length
|
|
108
|
+
// of one Enter the Tanrei default button holds a submit button of the platform's own, and the browser presses it
|
|
109
|
+
// exactly where, when and whether it would press its own default button; that press is turned into the Button's.
|
|
110
|
+
/** The forms that hold a Tanrei submit Button now, each with those Buttons and where its keys are heard. */
|
|
111
|
+
const watched = new WeakMap();
|
|
112
|
+
/** How many watched forms each tree's listener serves. */
|
|
113
|
+
const hearing = new Map();
|
|
114
|
+
/** The button the browser may press for the key going on now, the Button that holds it and the window that hears its click. */
|
|
115
|
+
let held = null;
|
|
116
|
+
/**
|
|
117
|
+
* Where a form's keys are heard: its tree — the window of a document, so that a key stopped on its way down is heard
|
|
118
|
+
* all the same, or its shadow root. A control that names the form by its `form` attribute from outside it is in the
|
|
119
|
+
* same tree, and its keys never pass the form itself.
|
|
120
|
+
*/
|
|
121
|
+
function treeOf(form) {
|
|
122
|
+
const root = form.getRootNode();
|
|
123
|
+
return root instanceof Document ? (root.defaultView ?? root) : root;
|
|
124
|
+
}
|
|
125
|
+
/** The browser did not press it, or has: the passing button is gone, and so are its listeners. */
|
|
126
|
+
function letGo() {
|
|
127
|
+
if (!held)
|
|
128
|
+
return;
|
|
129
|
+
const { passing, view } = held;
|
|
130
|
+
held = null;
|
|
131
|
+
passing.remove();
|
|
132
|
+
if (view !== window)
|
|
133
|
+
view.removeEventListener('click', onPassingClick, true);
|
|
134
|
+
view.removeEventListener('keyup', onKeyUp, true);
|
|
135
|
+
view.removeEventListener('keypress', onKeyPress, true);
|
|
136
|
+
view.removeEventListener('blur', letGo);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The browser pressed the passing button: the form's default button is the Button that holds it, so the press is the
|
|
140
|
+
* Button's. The browser's own click is stopped where it starts — at the window, by a listener that is there from the
|
|
141
|
+
* page's first watched form on, so that no listener of the page below the window, and none added to the window
|
|
142
|
+
* after it, hears a click that is no one's — and its submission is cancelled: the Button's `click` and its own
|
|
143
|
+
* submission (BTN-27, BTN-31) follow at once, inside the same key — after the field's `change`, as with the
|
|
144
|
+
* platform's own default button.
|
|
145
|
+
*/
|
|
146
|
+
function onPassingClick(event) {
|
|
147
|
+
if (!held || event.composedPath()[0] !== held.passing)
|
|
148
|
+
return;
|
|
149
|
+
const { button } = held;
|
|
150
|
+
event.stopImmediatePropagation();
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
letGo();
|
|
153
|
+
if (!isDisabledButton(button))
|
|
154
|
+
button.click();
|
|
155
|
+
}
|
|
156
|
+
function onKeyUp(event) {
|
|
157
|
+
if (event.key === 'Enter' || event.keyCode === 13)
|
|
158
|
+
letGo();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The key's `keyup` is not always the page's to hear: where Enter opens a list of the platform's own (a `<select>` in
|
|
162
|
+
* one engine on Linux and Windows), the list takes the rest of the key, and the passing button would stay in the form
|
|
163
|
+
* until the next key. The browser presses its default button inside the key's `keypress`, or not at all: once that
|
|
164
|
+
* dispatch and what the browser does after it are over — the next task — a button not pressed is let go.
|
|
165
|
+
*/
|
|
166
|
+
function onKeyPress(event) {
|
|
167
|
+
if (!held || !event.isTrusted || (event.key !== 'Enter' && event.keyCode !== 13))
|
|
168
|
+
return;
|
|
169
|
+
const during = held;
|
|
170
|
+
during.view.setTimeout(() => {
|
|
171
|
+
if (held === during)
|
|
172
|
+
letGo();
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Enter goes down in a control of the platform's own whose form is watched and whose default button is a Tanrei
|
|
177
|
+
* Button: for the length of the key that Button holds a hidden submit button of the platform's own — the form's first
|
|
178
|
+
* submit button exactly when the Button is, disabled while the Button is, in a slot the Button does not have so it is
|
|
179
|
+
* drawn nowhere — which is all the browser needs to treat the form as one with a default button of its own. Held
|
|
180
|
+
* again for each repeat of a key kept down; let go when the browser presses it, once the key's `keypress` is over
|
|
181
|
+
* (`onKeyPress()`), at the key's `keyup`, and when the window loses the keyboard.
|
|
182
|
+
*/
|
|
183
|
+
function onKeyDown(event) {
|
|
184
|
+
// A key a script dispatched is no key to the browser, which submits nothing for it.
|
|
185
|
+
if (!event.isTrusted || (event.key !== 'Enter' && event.keyCode !== 13))
|
|
186
|
+
return;
|
|
187
|
+
const control = event.composedPath()[0];
|
|
188
|
+
// A Tanrei control asks for itself (`pressDefaultButton()`): the browser submits nothing from a custom element.
|
|
189
|
+
if (!(control instanceof HTMLElement) || control.localName.includes('-'))
|
|
190
|
+
return;
|
|
191
|
+
const form = control.form;
|
|
192
|
+
if (!(form instanceof HTMLFormElement) || !watched.has(form))
|
|
193
|
+
return;
|
|
194
|
+
letGo();
|
|
195
|
+
const button = defaultButton(form);
|
|
196
|
+
// The platform's own default button is the browser's to press.
|
|
197
|
+
if (!button || !isTanreiButton(button))
|
|
198
|
+
return;
|
|
199
|
+
const view = button.ownerDocument.defaultView;
|
|
200
|
+
if (!view)
|
|
201
|
+
return;
|
|
202
|
+
const passing = button.ownerDocument.createElement('button');
|
|
203
|
+
passing.type = 'submit';
|
|
204
|
+
passing.hidden = true;
|
|
205
|
+
passing.slot = 'passing';
|
|
206
|
+
// A disabled Tanrei Button is not a disabled button to the browser, which would otherwise submit behind it.
|
|
207
|
+
passing.disabled = isDisabledButton(button);
|
|
208
|
+
// A Button that names its form from outside it: the passing button names the same one.
|
|
209
|
+
const named = button.getAttribute('form');
|
|
210
|
+
if (named !== null)
|
|
211
|
+
passing.setAttribute('form', named);
|
|
212
|
+
markPassingSubmitter(passing);
|
|
213
|
+
button.append(passing);
|
|
214
|
+
held = { passing, button, view };
|
|
215
|
+
// There already, as a rule (`watchNativeInputs()`); added here for another window's document, and for a document
|
|
216
|
+
// written anew (`document.open()`), which takes every listener from its window.
|
|
217
|
+
view.addEventListener('click', onPassingClick, true);
|
|
218
|
+
view.addEventListener('keyup', onKeyUp, true);
|
|
219
|
+
view.addEventListener('keypress', onKeyPress, true);
|
|
220
|
+
view.addEventListener('blur', letGo);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A Tanrei submit Button tells which form it belongs to now (`null`: none, or it is no submit button any more). While
|
|
224
|
+
* a form has at least one, Enter in a control of the platform's own that belongs to that form — inside it or naming
|
|
225
|
+
* it from outside — presses the form's default button when that button is Tanrei's (BTN-30): one `keydown` listener
|
|
226
|
+
* per tree, in the capture phase, added with the tree's first such form and removed with its last.
|
|
227
|
+
*/
|
|
228
|
+
export function watchNativeInputs(button, form, previous) {
|
|
229
|
+
if (form === previous)
|
|
230
|
+
return;
|
|
231
|
+
if (previous) {
|
|
232
|
+
const entry = watched.get(previous);
|
|
233
|
+
entry?.buttons.delete(button);
|
|
234
|
+
if (entry && entry.buttons.size === 0) {
|
|
235
|
+
watched.delete(previous);
|
|
236
|
+
const count = (hearing.get(entry.heard) ?? 1) - 1;
|
|
237
|
+
if (count > 0)
|
|
238
|
+
hearing.set(entry.heard, count);
|
|
239
|
+
else {
|
|
240
|
+
hearing.delete(entry.heard);
|
|
241
|
+
entry.heard.removeEventListener('keydown', onKeyDown, true);
|
|
242
|
+
if (entry.heard !== window)
|
|
243
|
+
entry.heard.removeEventListener('click', onPassingClick, true);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (held?.button === button)
|
|
247
|
+
letGo();
|
|
248
|
+
}
|
|
249
|
+
if (form) {
|
|
250
|
+
// The press of a passing button is stopped at the window, by a listener that is there from the page's first
|
|
251
|
+
// watched form on — before most listeners of the page — and is never taken away; adding it again changes nothing.
|
|
252
|
+
window.addEventListener('click', onPassingClick, true);
|
|
253
|
+
let entry = watched.get(form);
|
|
254
|
+
if (!entry) {
|
|
255
|
+
const heard = treeOf(form);
|
|
256
|
+
entry = { buttons: new Set(), heard };
|
|
257
|
+
watched.set(form, entry);
|
|
258
|
+
const count = hearing.get(heard) ?? 0;
|
|
259
|
+
if (count === 0) {
|
|
260
|
+
heard.addEventListener('keydown', onKeyDown, true);
|
|
261
|
+
// A closed shadow root shows the window nothing of what is pressed inside it: the click is stopped at the root.
|
|
262
|
+
if (heard !== window)
|
|
263
|
+
heard.addEventListener('click', onPassingClick, true);
|
|
264
|
+
}
|
|
265
|
+
hearing.set(heard, count + 1);
|
|
266
|
+
}
|
|
267
|
+
entry.buttons.add(button);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=default-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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