@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,47 @@
|
|
|
1
|
+
import { type CSSResult, type TemplateResult, nothing } from 'lit';
|
|
2
|
+
/** One layer of a `box-shadow`, as the browser resolves it. */
|
|
3
|
+
export interface ShadowLayer {
|
|
4
|
+
color: string;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
blur: number;
|
|
8
|
+
spread: number;
|
|
9
|
+
}
|
|
10
|
+
/** A resolved `box-shadow` as its outer layers that draw something (an inset layer is the box's own). */
|
|
11
|
+
export declare function shadowLayers(value: string): ShadowLayer[];
|
|
12
|
+
/**
|
|
13
|
+
* The elevation as a filter over the box and its arrow together, so that its ring and its shadows run round the one
|
|
14
|
+
* shape: each layer is the shape grown by the layer's spread, blurred, moved and colored, and cut where the shape
|
|
15
|
+
* itself is — what `box-shadow` draws round a box. Nothing while there is no layer.
|
|
16
|
+
*/
|
|
17
|
+
export declare function shadeFilter(layers: readonly ShadowLayer[]): TemplateResult | typeof nothing;
|
|
18
|
+
/** What `arrowStyles()` is told: the selectors of the markup above, and the values the arrow is drawn from. */
|
|
19
|
+
export interface ArrowStyleOptions {
|
|
20
|
+
/** The placed box, which carries `data-side`, `data-arrow` and `--_arrow-at`. */
|
|
21
|
+
surface: string;
|
|
22
|
+
/** The painted box inside it, which gives up its own shadow while an arrow is shaded. */
|
|
23
|
+
box: string;
|
|
24
|
+
/** The arrow's base and height, as CSS length expressions (the component's tokens). */
|
|
25
|
+
width: string;
|
|
26
|
+
height: string;
|
|
27
|
+
/** The arrow's color and the elevation, as CSS expressions: the painted box's own. */
|
|
28
|
+
fill: string;
|
|
29
|
+
elevation: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The arrow's rules: the triangle on the edge that faces the anchor, its tip where the script says, reaching under the
|
|
33
|
+
* painted box by its own height so that no line shows between the two (the box is drawn over that part); and the
|
|
34
|
+
* elevation as the browser resolves it (`.shade`), read by script to make the filter that goes round both.
|
|
35
|
+
*/
|
|
36
|
+
export declare function arrowStyles({ surface, box, width, height, fill, elevation }: ArrowStyleOptions): CSSResult;
|
|
37
|
+
/**
|
|
38
|
+
* The arrow where a person's own colors are forced (POP-32): the mode removes the shadow, so the painted box draws an
|
|
39
|
+
* edge in the text color (the component's own rule) and the arrow continues it as one outline — the triangle in the text
|
|
40
|
+
* color, with the same triangle in the page's color laid over it, moved towards the box by `edge`, so that two strokes
|
|
41
|
+
* are left along the arrow's sides and the box's edge is covered where the arrow stands. `edge` is a CSS length
|
|
42
|
+
* expression: how far the inner triangle is moved (a stroke along a side is thinner than that by the side's slope).
|
|
43
|
+
*/
|
|
44
|
+
export declare function arrowOutlineStyles({ surface, edge }: {
|
|
45
|
+
surface: string;
|
|
46
|
+
edge: string;
|
|
47
|
+
}): CSSResult;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { html, nothing, svg, unsafeCSS } from 'lit';
|
|
2
|
+
/** A resolved `box-shadow` as its outer layers that draw something (an inset layer is the box's own). */
|
|
3
|
+
export function shadowLayers(value) {
|
|
4
|
+
if (!value || value === 'none')
|
|
5
|
+
return [];
|
|
6
|
+
const layers = [];
|
|
7
|
+
// Split at the commas between layers, not those inside a color function.
|
|
8
|
+
for (const layer of value.split(/,(?![^(]*\))/)) {
|
|
9
|
+
const color = /[a-z-]+\([^)]*\)|#[0-9a-f]+/i.exec(layer)?.[0] ?? layer.trim().split(/\s+/).find((word) => /^[a-z]+$/i.test(word) && word !== 'inset') ?? '';
|
|
10
|
+
const [x = 0, y = 0, blur = 0, spread = 0] = (layer.replace(color, ' ').match(/-?[\d.]+(?:e-?\d+)?px|(?<![\w.])0(?![\w.])/g) ?? []).map((length) => Number.parseFloat(length));
|
|
11
|
+
// No alpha at all: `transparent`, a fourth component of 0 (`rgba(0, 0, 0, 0)`) or one after a slash (`color(srgb 0 0 0 / 0)`).
|
|
12
|
+
const clear = color === 'transparent' || /^[a-z-]+\((?:[^,]+,){3}\s*0(?:\.0+)?%?\s*\)$/i.test(color) || /\/\s*0(?:\.0+)?%?\s*\)$/.test(color);
|
|
13
|
+
if (/\binset\b/.test(layer) || clear || !color || (x === 0 && y === 0 && blur === 0 && spread <= 0))
|
|
14
|
+
continue;
|
|
15
|
+
layers.push({ color, x, y, blur, spread });
|
|
16
|
+
}
|
|
17
|
+
return layers;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The elevation as a filter over the box and its arrow together, so that its ring and its shadows run round the one
|
|
21
|
+
* shape: each layer is the shape grown by the layer's spread, blurred, moved and colored, and cut where the shape
|
|
22
|
+
* itself is — what `box-shadow` draws round a box. Nothing while there is no layer.
|
|
23
|
+
*/
|
|
24
|
+
export function shadeFilter(layers) {
|
|
25
|
+
if (!layers.length)
|
|
26
|
+
return nothing;
|
|
27
|
+
const under = [...layers].reverse();
|
|
28
|
+
return html `<svg class="shade-filter" aria-hidden="true" focusable="false">
|
|
29
|
+
<filter id="shade" x="-100%" y="-400%" width="300%" height="900%" color-interpolation-filters="sRGB">
|
|
30
|
+
${under.map((layer, i) => svg `
|
|
31
|
+
${layer.spread ? svg `<feMorphology in="SourceAlpha" operator=${layer.spread < 0 ? 'erode' : 'dilate'} radius=${Math.abs(layer.spread)} result="grown" />` : nothing}
|
|
32
|
+
<feGaussianBlur in=${layer.spread ? 'grown' : 'SourceAlpha'} stdDeviation=${layer.blur / 2} />
|
|
33
|
+
<feOffset dx=${layer.x} dy=${layer.y} result="cast" />
|
|
34
|
+
<feFlood style="flood-color: ${layer.color}" />
|
|
35
|
+
<feComposite in2="cast" operator="in" />
|
|
36
|
+
<feComposite in2="SourceAlpha" operator="out" result=${`layer${i}`} />`)}
|
|
37
|
+
<feMerge>
|
|
38
|
+
${under.map((_, i) => svg `<feMergeNode in=${`layer${i}`} />`)}
|
|
39
|
+
<feMergeNode in="SourceGraphic" />
|
|
40
|
+
</feMerge>
|
|
41
|
+
</filter>
|
|
42
|
+
</svg>`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The arrow's rules: the triangle on the edge that faces the anchor, its tip where the script says, reaching under the
|
|
46
|
+
* painted box by its own height so that no line shows between the two (the box is drawn over that part); and the
|
|
47
|
+
* elevation as the browser resolves it (`.shade`), read by script to make the filter that goes round both.
|
|
48
|
+
*/
|
|
49
|
+
export function arrowStyles({ surface, box, width, height, fill, elevation }) {
|
|
50
|
+
return unsafeCSS(`
|
|
51
|
+
.arrow {
|
|
52
|
+
display: none;
|
|
53
|
+
position: absolute;
|
|
54
|
+
background: ${fill};
|
|
55
|
+
--_w: ${width};
|
|
56
|
+
--_h: ${height};
|
|
57
|
+
}
|
|
58
|
+
${surface}[data-arrow] .arrow {
|
|
59
|
+
display: block;
|
|
60
|
+
}
|
|
61
|
+
/* Above the anchor: under the box's bottom edge, pointing down. */
|
|
62
|
+
${surface}[data-side='top'] .arrow {
|
|
63
|
+
inline-size: var(--_w);
|
|
64
|
+
block-size: calc(2 * var(--_h));
|
|
65
|
+
left: calc(var(--_arrow-at) - var(--_w) / 2);
|
|
66
|
+
top: calc(100% - var(--_h));
|
|
67
|
+
clip-path: polygon(0 0, 100% 0, 100% 50%, 50% 100%, 0 50%);
|
|
68
|
+
}
|
|
69
|
+
${surface}[data-side='bottom'] .arrow {
|
|
70
|
+
inline-size: var(--_w);
|
|
71
|
+
block-size: calc(2 * var(--_h));
|
|
72
|
+
left: calc(var(--_arrow-at) - var(--_w) / 2);
|
|
73
|
+
top: calc(-1 * var(--_h));
|
|
74
|
+
clip-path: polygon(50% 0, 100% 50%, 100% 100%, 0 100%, 0 50%);
|
|
75
|
+
}
|
|
76
|
+
/* At the anchor's left: on the box's right edge, pointing right. */
|
|
77
|
+
${surface}[data-side='left'] .arrow {
|
|
78
|
+
inline-size: calc(2 * var(--_h));
|
|
79
|
+
block-size: var(--_w);
|
|
80
|
+
left: calc(100% - var(--_h));
|
|
81
|
+
top: calc(var(--_arrow-at) - var(--_w) / 2);
|
|
82
|
+
clip-path: polygon(0 0, 50% 0, 100% 50%, 50% 100%, 0 100%);
|
|
83
|
+
}
|
|
84
|
+
${surface}[data-side='right'] .arrow {
|
|
85
|
+
inline-size: calc(2 * var(--_h));
|
|
86
|
+
block-size: var(--_w);
|
|
87
|
+
left: calc(-1 * var(--_h));
|
|
88
|
+
top: calc(var(--_arrow-at) - var(--_w) / 2);
|
|
89
|
+
clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%, 0 50%);
|
|
90
|
+
}
|
|
91
|
+
/* One shape, one elevation: the box gives up its own shadow for the filter that goes round both. */
|
|
92
|
+
${surface}[data-arrow='shaded'] ${box} {
|
|
93
|
+
box-shadow: none;
|
|
94
|
+
}
|
|
95
|
+
/* The elevation as the browser resolves it, read by script to make that filter; and the filter. Neither draws. */
|
|
96
|
+
.shade {
|
|
97
|
+
display: none;
|
|
98
|
+
box-shadow: ${elevation};
|
|
99
|
+
}
|
|
100
|
+
.shade-filter {
|
|
101
|
+
position: absolute;
|
|
102
|
+
inline-size: 0;
|
|
103
|
+
block-size: 0;
|
|
104
|
+
}
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The arrow where a person's own colors are forced (POP-32): the mode removes the shadow, so the painted box draws an
|
|
109
|
+
* edge in the text color (the component's own rule) and the arrow continues it as one outline — the triangle in the text
|
|
110
|
+
* color, with the same triangle in the page's color laid over it, moved towards the box by `edge`, so that two strokes
|
|
111
|
+
* are left along the arrow's sides and the box's edge is covered where the arrow stands. `edge` is a CSS length
|
|
112
|
+
* expression: how far the inner triangle is moved (a stroke along a side is thinner than that by the side's slope).
|
|
113
|
+
*/
|
|
114
|
+
export function arrowOutlineStyles({ surface, edge }) {
|
|
115
|
+
return unsafeCSS(`
|
|
116
|
+
@media (forced-colors: active) {
|
|
117
|
+
.arrow {
|
|
118
|
+
z-index: 1;
|
|
119
|
+
background: CanvasText;
|
|
120
|
+
--_e: ${edge};
|
|
121
|
+
}
|
|
122
|
+
.arrow::after {
|
|
123
|
+
content: '';
|
|
124
|
+
position: absolute;
|
|
125
|
+
inset: 0;
|
|
126
|
+
background: Canvas;
|
|
127
|
+
}
|
|
128
|
+
${surface}[data-side='top'] .arrow {
|
|
129
|
+
clip-path: polygon(0 calc(50% - var(--_e)), 100% calc(50% - var(--_e)), 100% 50%, 50% 100%, 0 50%);
|
|
130
|
+
}
|
|
131
|
+
${surface}[data-side='top'] .arrow::after {
|
|
132
|
+
clip-path: polygon(0 50%, 100% 50%, 50% 100%);
|
|
133
|
+
translate: 0 calc(-1 * var(--_e));
|
|
134
|
+
}
|
|
135
|
+
${surface}[data-side='bottom'] .arrow {
|
|
136
|
+
clip-path: polygon(50% 0, 100% 50%, 100% calc(50% + var(--_e)), 0 calc(50% + var(--_e)), 0 50%);
|
|
137
|
+
}
|
|
138
|
+
${surface}[data-side='bottom'] .arrow::after {
|
|
139
|
+
clip-path: polygon(50% 0, 100% 50%, 0 50%);
|
|
140
|
+
translate: 0 var(--_e);
|
|
141
|
+
}
|
|
142
|
+
${surface}[data-side='left'] .arrow {
|
|
143
|
+
clip-path: polygon(calc(50% - var(--_e)) 0, 50% 0, 100% 50%, 50% 100%, calc(50% - var(--_e)) 100%);
|
|
144
|
+
}
|
|
145
|
+
${surface}[data-side='left'] .arrow::after {
|
|
146
|
+
clip-path: polygon(50% 0, 100% 50%, 50% 100%);
|
|
147
|
+
translate: calc(-1 * var(--_e)) 0;
|
|
148
|
+
}
|
|
149
|
+
${surface}[data-side='right'] .arrow {
|
|
150
|
+
clip-path: polygon(calc(50% + var(--_e)) 0, 50% 0, 0 50%, 50% 100%, calc(50% + var(--_e)) 100%);
|
|
151
|
+
}
|
|
152
|
+
${surface}[data-side='right'] .arrow::after {
|
|
153
|
+
clip-path: polygon(50% 0, 0 50%, 50% 100%);
|
|
154
|
+
translate: var(--_e) 0;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`);
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=arrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow.js","sourceRoot":"","sources":["../../src/primitives/arrow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AA8BzF,yGAAyG;AACzG,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,yEAAyE;IACzE,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5J,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,6CAA6C,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAA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2CACL,KAAK,CAAC,KAAK;;mEAEa,QAAQ,CAAC,EAAE,KAAK,CAC1E;;YAEG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAA,mBAAmB,QAAQ,CAAC,EAAE,KAAK,CAAC;;;;WAI5D,CAAC;AACZ,CAAC;AAgBD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAqB;IAC7F,OAAO,SAAS,CAAC;;;;kBAID,IAAI;YACV,KAAK;YACL,MAAM;;IAEd,OAAO;;;;IAIP,OAAO;;;;;;;IAOP,OAAO;;;;;;;;IAQP,OAAO;;;;;;;IAOP,OAAO;;;;;;;;IAQP,OAAO,yBAAyB,GAAG;;;;;;kBAMrB,SAAS;;;;;;;CAO1B,CAAC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAqC;IACrF,OAAO,SAAS,CAAC;;;;;cAKL,IAAI;;;;;;;;MAQZ,OAAO;;;MAGP,OAAO;;;;MAIP,OAAO;;;MAGP,OAAO;;;;MAIP,OAAO;;;MAGP,OAAO;;;;MAIP,OAAO;;;MAGP,OAAO;;;;;CAKZ,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** What the routine reads and writes; each is asked for when it runs, so an element drawn again is found again. */
|
|
2
|
+
export interface AutoHeightOptions {
|
|
3
|
+
/** The box whose block size is the animated one. */
|
|
4
|
+
box: () => HTMLElement | null;
|
|
5
|
+
/** The native text area; none while the component shows one line (`<input>`), which needs no routine. */
|
|
6
|
+
input: () => HTMLTextAreaElement | null;
|
|
7
|
+
/**
|
|
8
|
+
* A copy of the placeholder, laid out in the element's own width and text style and drawn nowhere, whose
|
|
9
|
+
* `scrollHeight` is the height the placeholder's lines need (ETI-22): a browser does not count a placeholder among
|
|
10
|
+
* what a text area scrolls. Read only while the value is empty.
|
|
11
|
+
*/
|
|
12
|
+
placeholder?: () => HTMLElement | null;
|
|
13
|
+
/** The fewest lines it shows; anything below one is one. */
|
|
14
|
+
min: () => number;
|
|
15
|
+
/** The most lines it shows before the text scrolls inside it; 0 is no limit, and one below `min` is `min`. */
|
|
16
|
+
max: () => number;
|
|
17
|
+
/** A change is made at once while this answers true: a pointer held down in the text (ETI-9). */
|
|
18
|
+
still?: () => boolean;
|
|
19
|
+
/** The number of lines shown is about to change, or is first known: called once, before any motion of that change begins. */
|
|
20
|
+
rows?: (rows: number, scrolling: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare class AutoHeight {
|
|
23
|
+
private readonly options;
|
|
24
|
+
/** The lines the element shows, or is on its way to show; 0 until it was first fitted. */
|
|
25
|
+
rows: number;
|
|
26
|
+
/** Whether the text has more lines than it shows, and scrolls inside it. */
|
|
27
|
+
scrolling: boolean;
|
|
28
|
+
/** The width and the line the last fit was made for: a different one is a change that is made at once (ETI-9). */
|
|
29
|
+
private laid;
|
|
30
|
+
constructor(options: AutoHeightOptions);
|
|
31
|
+
/** `min` and `max` as the sentence reads them (ETI-7). */
|
|
32
|
+
private bounds;
|
|
33
|
+
private lineOf;
|
|
34
|
+
/** The number of lines is `rows`: said once for each change, before anything moves. */
|
|
35
|
+
private tell;
|
|
36
|
+
/** The component shows one line and has no text area: one line, nothing scrolling up or down, no box that moves. */
|
|
37
|
+
single(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Fits the height to the lines of the text. With `animate` — a change that follows the value — the height moves from
|
|
40
|
+
* the one shown to the new one; a change that arrives while it moves goes on from the height then shown, and nothing
|
|
41
|
+
* is queued. Without it, and where the element is not laid out, a pointer is held down in the text or motion is
|
|
42
|
+
* reduced, the change is made at once.
|
|
43
|
+
*/
|
|
44
|
+
fit(animate: boolean): void;
|
|
45
|
+
/** The box is as tall as what it holds again: a motion has ended, or the next change is made at once. */
|
|
46
|
+
private settle;
|
|
47
|
+
/** The box's own transition of its height ended or was cancelled: bind it to `transitionend` and `transitioncancel` on the box. */
|
|
48
|
+
readonly ended: (event: TransitionEvent) => void;
|
|
49
|
+
/**
|
|
50
|
+
* The element was laid out again: where its width or the line of its text changed — a narrower column, enlarged
|
|
51
|
+
* text, another text style — the lines are counted again and the height changes at once (ETI-9). A layout that
|
|
52
|
+
* changed neither (the element's own height, which it wrote itself) is left alone. Call it from a `ResizeObserver`
|
|
53
|
+
* of the native element.
|
|
54
|
+
*/
|
|
55
|
+
relaid(): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// The height of a native text area that follows its lines (ETI-7 to ETI-10).
|
|
2
|
+
//
|
|
3
|
+
// A `<textarea>` has the height it is given, never the height of its text. This routine gives it one: it measures the
|
|
4
|
+
// lines the text needs in the width the element has, holds them between a fewest and a most, and — where the change
|
|
5
|
+
// follows the value — moves the height there from the one shown, as ONE motion however many lines came or went.
|
|
6
|
+
//
|
|
7
|
+
// What moves is a box around the native element, never the element and never its text:
|
|
8
|
+
//
|
|
9
|
+
// <div class="box"> ← `box`: its block size is the animated one. It is what the host is as tall as, so the
|
|
10
|
+
// <textarea class="input"> height the element takes IN ITS LAYOUT changes at every frame (ETI-10) and a holder
|
|
11
|
+
// </div> that sizes itself to its content follows with no script of its own.
|
|
12
|
+
//
|
|
13
|
+
// The native element is given its end height at once (`--_rows`, which the component's stylesheet multiplies by one
|
|
14
|
+
// line of its text style). A box as tall as its text has nothing to scroll, so the browser never scrolls the first line
|
|
15
|
+
// away to show a caret on a line the box does not hold yet; the first line stays at the top edge at every frame, and
|
|
16
|
+
// the box, which clips while it moves, uncovers the new lines as its bottom edge passes them. Going down, the element is
|
|
17
|
+
// the smaller height at once and the box still holds the room that leaves.
|
|
18
|
+
//
|
|
19
|
+
// It holds no token and writes no duration: the component's stylesheet says how `[data-resizing]` moves
|
|
20
|
+
// (`transition: block-size <its duration> <its curve>`), and a stylesheet that says none — reduced motion — is a change
|
|
21
|
+
// made at once. It asks for no frame and no layout at rest: it runs when it is called, and reads the layout only then.
|
|
22
|
+
/** The lines a measured height is: a whole number, a hair's breadth forgiven (a line of 24.5 px reported as 24). */
|
|
23
|
+
const wholeLines = (lines) => Math.max(1, Math.ceil(lines - 0.05));
|
|
24
|
+
const reduced = () => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
25
|
+
export class AutoHeight {
|
|
26
|
+
constructor(options) {
|
|
27
|
+
this.options = options;
|
|
28
|
+
/** The lines the element shows, or is on its way to show; 0 until it was first fitted. */
|
|
29
|
+
this.rows = 0;
|
|
30
|
+
/** Whether the text has more lines than it shows, and scrolls inside it. */
|
|
31
|
+
this.scrolling = false;
|
|
32
|
+
/** The width and the line the last fit was made for: a different one is a change that is made at once (ETI-9). */
|
|
33
|
+
this.laid = null;
|
|
34
|
+
/** The box's own transition of its height ended or was cancelled: bind it to `transitionend` and `transitioncancel` on the box. */
|
|
35
|
+
this.ended = (event) => {
|
|
36
|
+
const box = this.options.box();
|
|
37
|
+
if (!box || event.target !== box || !/^(block-size|height|width)$/.test(event.propertyName))
|
|
38
|
+
return;
|
|
39
|
+
this.settle(box);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** `min` and `max` as the sentence reads them (ETI-7). */
|
|
43
|
+
bounds() {
|
|
44
|
+
const least = Number(this.options.min());
|
|
45
|
+
const min = Number.isFinite(least) && least >= 1 ? Math.floor(least) : 1;
|
|
46
|
+
const most = Number(this.options.max());
|
|
47
|
+
const max = Number.isFinite(most) && most > 0 ? Math.max(min, Math.floor(most)) : Number.POSITIVE_INFINITY;
|
|
48
|
+
return { min, max };
|
|
49
|
+
}
|
|
50
|
+
lineOf(input) {
|
|
51
|
+
return Number.parseFloat(getComputedStyle(input).lineHeight) || 0;
|
|
52
|
+
}
|
|
53
|
+
/** The number of lines is `rows`: said once for each change, before anything moves. */
|
|
54
|
+
tell(rows, scrolling) {
|
|
55
|
+
const changed = rows !== this.rows;
|
|
56
|
+
this.rows = rows;
|
|
57
|
+
this.scrolling = scrolling;
|
|
58
|
+
if (changed)
|
|
59
|
+
this.options.rows?.(rows, scrolling);
|
|
60
|
+
}
|
|
61
|
+
/** The component shows one line and has no text area: one line, nothing scrolling up or down, no box that moves. */
|
|
62
|
+
single() {
|
|
63
|
+
const box = this.options.box();
|
|
64
|
+
if (box)
|
|
65
|
+
this.settle(box);
|
|
66
|
+
this.laid = null;
|
|
67
|
+
this.tell(1, false);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Fits the height to the lines of the text. With `animate` — a change that follows the value — the height moves from
|
|
71
|
+
* the one shown to the new one; a change that arrives while it moves goes on from the height then shown, and nothing
|
|
72
|
+
* is queued. Without it, and where the element is not laid out, a pointer is held down in the text or motion is
|
|
73
|
+
* reduced, the change is made at once.
|
|
74
|
+
*/
|
|
75
|
+
fit(animate) {
|
|
76
|
+
const box = this.options.box();
|
|
77
|
+
const input = this.options.input();
|
|
78
|
+
if (!box || !input)
|
|
79
|
+
return;
|
|
80
|
+
const line = this.lineOf(input);
|
|
81
|
+
const width = input.clientWidth;
|
|
82
|
+
const { min, max } = this.bounds();
|
|
83
|
+
// An element that is not shown has no lines to measure: it stands at its fewest until it is laid out.
|
|
84
|
+
if (!line || !width) {
|
|
85
|
+
this.settle(box);
|
|
86
|
+
input.style.setProperty('--_rows', String(Math.max(min, Math.min(this.rows || min, max))));
|
|
87
|
+
this.laid = null;
|
|
88
|
+
if (!this.rows)
|
|
89
|
+
this.tell(min, false);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const moving = box.hasAttribute('data-resizing');
|
|
93
|
+
const shown = animate || moving ? box.getBoundingClientRect().height : 0;
|
|
94
|
+
// The lines the text needs: what the element scrolls when it is given no height.
|
|
95
|
+
const { blockSize } = input.style;
|
|
96
|
+
input.style.blockSize = '0px';
|
|
97
|
+
let needed = wholeLines(input.scrollHeight / line);
|
|
98
|
+
input.style.blockSize = blockSize;
|
|
99
|
+
// ETI-22: an empty input is as tall as its placeholder's lines.
|
|
100
|
+
const hint = input.value ? null : (this.options.placeholder?.() ?? null);
|
|
101
|
+
if (hint)
|
|
102
|
+
needed = Math.max(needed, wholeLines(hint.scrollHeight / line));
|
|
103
|
+
const rows = Math.max(min, Math.min(needed, max));
|
|
104
|
+
const scrolling = needed > rows;
|
|
105
|
+
this.tell(rows, scrolling);
|
|
106
|
+
this.laid = { width, line };
|
|
107
|
+
input.style.setProperty('--_rows', String(rows));
|
|
108
|
+
input.toggleAttribute('data-overflows', scrolling);
|
|
109
|
+
this.settle(box);
|
|
110
|
+
if (!animate || this.options.still?.() || reduced())
|
|
111
|
+
return;
|
|
112
|
+
const end = box.getBoundingClientRect().height;
|
|
113
|
+
if (Math.abs(end - shown) < 0.5)
|
|
114
|
+
return;
|
|
115
|
+
// From the height shown, drawn without a transition…
|
|
116
|
+
box.style.blockSize = `${shown}px`;
|
|
117
|
+
void box.offsetHeight;
|
|
118
|
+
// …to the end height, as the stylesheet says `[data-resizing]` moves.
|
|
119
|
+
box.setAttribute('data-resizing', '');
|
|
120
|
+
box.style.blockSize = `${end}px`;
|
|
121
|
+
// A stylesheet that gives the motion no time (a layer's duration of zero) starts none, and none will end.
|
|
122
|
+
const style = getComputedStyle(box);
|
|
123
|
+
if (!style.transitionDuration.split(',').some((time) => Number.parseFloat(time) > 0))
|
|
124
|
+
this.settle(box);
|
|
125
|
+
}
|
|
126
|
+
/** The box is as tall as what it holds again: a motion has ended, or the next change is made at once. */
|
|
127
|
+
settle(box) {
|
|
128
|
+
if (box.hasAttribute('data-resizing'))
|
|
129
|
+
box.removeAttribute('data-resizing');
|
|
130
|
+
if (box.style.blockSize)
|
|
131
|
+
box.style.blockSize = '';
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The element was laid out again: where its width or the line of its text changed — a narrower column, enlarged
|
|
135
|
+
* text, another text style — the lines are counted again and the height changes at once (ETI-9). A layout that
|
|
136
|
+
* changed neither (the element's own height, which it wrote itself) is left alone. Call it from a `ResizeObserver`
|
|
137
|
+
* of the native element.
|
|
138
|
+
*/
|
|
139
|
+
relaid() {
|
|
140
|
+
const input = this.options.input();
|
|
141
|
+
if (!input)
|
|
142
|
+
return;
|
|
143
|
+
const width = input.clientWidth;
|
|
144
|
+
const line = this.lineOf(input);
|
|
145
|
+
if (this.laid && this.laid.width === width && this.laid.line === line)
|
|
146
|
+
return;
|
|
147
|
+
this.fit(false);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=auto-height.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-height.js","sourceRoot":"","sources":["../../src/primitives/auto-height.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,sHAAsH;AACtH,oHAAoH;AACpH,gHAAgH;AAChH,EAAE;AACF,uFAAuF;AACvF,EAAE;AACF,wHAAwH;AACxH,uHAAuH;AACvH,uGAAuG;AACvG,EAAE;AACF,oHAAoH;AACpH,wHAAwH;AACxH,qHAAqH;AACrH,yHAAyH;AACzH,2EAA2E;AAC3E,EAAE;AACF,wGAAwG;AACxG,wHAAwH;AACxH,uHAAuH;AAwBvH,oHAAoH;AACpH,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AAE3E,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AAEjH,MAAM,OAAO,UAAU;IAQrB,YAA6B,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;QAPvD,0FAA0F;QAC1F,SAAI,GAAG,CAAC,CAAC;QACT,4EAA4E;QAC5E,cAAS,GAAG,KAAK,C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AE,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;IACpD,CAAC;IASD;;;;;OAKG;IACH,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO;QAC9E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LitElement } from 'lit';
|
|
2
|
+
/** Whether `host` is asked for by `autofocus` and nothing of the page has focus. */
|
|
3
|
+
export declare function wantsAutofocus(host: HTMLElement): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Gives an element's class that answer in one call, after the class is written: when an element of it first renders
|
|
6
|
+
* with `autofocus`, and nothing but the body has focus then and still when its first update has ended, it is focused
|
|
7
|
+
* (its own `focus()`, which delegates).
|
|
8
|
+
*/
|
|
9
|
+
export declare function focusedAtFirst(element: {
|
|
10
|
+
prototype: LitElement;
|
|
11
|
+
}): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Whether `host` is asked for by `autofocus` and nothing of the page has focus. */
|
|
2
|
+
export function wantsAutofocus(host) {
|
|
3
|
+
if (!host.hasAttribute('autofocus'))
|
|
4
|
+
return false;
|
|
5
|
+
const active = host.ownerDocument.activeElement;
|
|
6
|
+
return !active || active === host.ownerDocument.body || active === host.ownerDocument.documentElement;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Gives an element's class that answer in one call, after the class is written: when an element of it first renders
|
|
10
|
+
* with `autofocus`, and nothing but the body has focus then and still when its first update has ended, it is focused
|
|
11
|
+
* (its own `focus()`, which delegates).
|
|
12
|
+
*/
|
|
13
|
+
export function focusedAtFirst(element) {
|
|
14
|
+
const prototype = element.prototype;
|
|
15
|
+
const first = prototype.firstUpdated;
|
|
16
|
+
prototype.firstUpdated = function (changed) {
|
|
17
|
+
first.call(this, changed);
|
|
18
|
+
if (!wantsAutofocus(this))
|
|
19
|
+
return;
|
|
20
|
+
void this.updateComplete.then(() => {
|
|
21
|
+
if (this.isConnected && wantsAutofocus(this))
|
|
22
|
+
this.focus();
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=autofocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autofocus.js","sourceRoot":"","sources":["../../src/primitives/autofocus.ts"],"names":[],"mappings":"AAUA,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,IAAiB;IAC9C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;IAChD,OAAO,CAAC,MAAM,IAAI,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;AACxG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAkC;IAC/D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAgE,CAAC;IAC3F,MAAM,KAAK,GAAG,SAAS,CAAC,YAAY,CAAC;IACrC,SAAS,CAAC,YAAY,GAAG,UAA4B,OAAgB;QACnE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YAAE,OAAO;QAClC,KAAK,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE;YACjC,IAAI,IAAI,CAAC,WAAW,IAAI,cAAc,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/** What the active system does not ship: `component` or `component:variant`, space-separated, in one string. */
|
|
3
|
+
export declare const UNAVAILABLE = "--tanrei-unavailable";
|
|
4
|
+
/** What the active system uses instead: `<entry>=<replacement>[,<replacement>…]`, space-separated, in one string. */
|
|
5
|
+
export declare const UNAVAILABLE_REPLACEMENT = "--tanrei-unavailable-replacement";
|
|
6
|
+
/** The active system's id, in one string. */
|
|
7
|
+
export declare const SYSTEM = "--tanrei-system";
|
|
8
|
+
export declare function parseUnavailable(value: string): Set<string>;
|
|
9
|
+
export declare function parseReplacements(value: string): Map<string, string[]>;
|
|
10
|
+
/** The entry that leaves this component, or this variant of it, out — the component whole first — or null. */
|
|
11
|
+
export declare function unavailableEntry(list: ReadonlySet<string>, component: string, variant?: string): string | null;
|
|
12
|
+
/** The report's text: what is left out, by which system (null: the active one, unnamed), and what it uses instead. */
|
|
13
|
+
export declare function unavailableMessage(entry: string, system: string | null, replacements?: readonly string[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* Availability as a Lit controller: when the host connects, and when its `variant` changes, the list the
|
|
16
|
+
* active system's stylesheet declares is read from the cascade, and a component or variant it leaves out is reported
|
|
17
|
+
* once per element in debug builds. Nothing else changes: what is left out still renders and works.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AvailabilityController implements ReactiveController {
|
|
20
|
+
private readonly host;
|
|
21
|
+
private readonly component;
|
|
22
|
+
private checked;
|
|
23
|
+
constructor(host: ReactiveControllerHost & HTMLElement, component: string);
|
|
24
|
+
private variant;
|
|
25
|
+
hostConnected(): void;
|
|
26
|
+
hostUpdated(): void;
|
|
27
|
+
private check;
|
|
28
|
+
/** The host's update of this turn, done (or failed: the read does not depend on it). */
|
|
29
|
+
drawn(): Promise<unknown>;
|
|
30
|
+
/** Reads the cascade for this host, as it is now. Called for every host that is due, in one pass. */
|
|
31
|
+
read(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { debugBuild, report } from './report.js';
|
|
2
|
+
/** What the active system does not ship: `component` or `component:variant`, space-separated, in one string. */
|
|
3
|
+
export const UNAVAILABLE = '--tanrei-unavailable';
|
|
4
|
+
/** What the active system uses instead: `<entry>=<replacement>[,<replacement>…]`, space-separated, in one string. */
|
|
5
|
+
export const UNAVAILABLE_REPLACEMENT = '--tanrei-unavailable-replacement';
|
|
6
|
+
/** The active system's id, in one string. */
|
|
7
|
+
export const SYSTEM = '--tanrei-system';
|
|
8
|
+
/** A string custom property's text: `"a b"` → `a b`; empty when the property is not declared. */
|
|
9
|
+
const unquote = (value) => value.trim().replace(/^(["'])(.*)\1$/s, '$2').trim();
|
|
10
|
+
const words = (value) => unquote(value).split(/\s+/).filter(Boolean);
|
|
11
|
+
export function parseUnavailable(value) {
|
|
12
|
+
return new Set(words(value));
|
|
13
|
+
}
|
|
14
|
+
export function parseReplacements(value) {
|
|
15
|
+
const replacements = new Map();
|
|
16
|
+
for (const pair of words(value)) {
|
|
17
|
+
const at = pair.indexOf('=');
|
|
18
|
+
const uses = pair.slice(at + 1).split(',').filter(Boolean);
|
|
19
|
+
if (at > 0 && uses.length)
|
|
20
|
+
replacements.set(pair.slice(0, at), uses);
|
|
21
|
+
}
|
|
22
|
+
return replacements;
|
|
23
|
+
}
|
|
24
|
+
/** The entry that leaves this component, or this variant of it, out — the component whole first — or null. */
|
|
25
|
+
export function unavailableEntry(list, component, variant) {
|
|
26
|
+
if (list.has(component))
|
|
27
|
+
return component;
|
|
28
|
+
const entry = `${component}:${variant}`;
|
|
29
|
+
return variant && list.has(entry) ? entry : null;
|
|
30
|
+
}
|
|
31
|
+
const describe = (entry) => {
|
|
32
|
+
const [component, variant] = entry.split(':');
|
|
33
|
+
return variant ? `variant "${variant}" of ${component}` : component;
|
|
34
|
+
};
|
|
35
|
+
/** The report's text: what is left out, by which system (null: the active one, unnamed), and what it uses instead. */
|
|
36
|
+
export function unavailableMessage(entry, system, replacements = []) {
|
|
37
|
+
const by = system ? `the design system "${system}"` : 'the active design system';
|
|
38
|
+
const instead = replacements.length ? `, but the system uses ${replacements.map(describe).join(' or ')} instead` : '';
|
|
39
|
+
return `${describe(entry)} is left out of ${by}; it still works${instead}`;
|
|
40
|
+
}
|
|
41
|
+
/** The nearest `data-tanrei-system` around the element, across shadow roots. */
|
|
42
|
+
function scopeSystem(element) {
|
|
43
|
+
for (let node = element; node;) {
|
|
44
|
+
const scope = node.closest('[data-tanrei-system]');
|
|
45
|
+
if (scope)
|
|
46
|
+
return scope.getAttribute('data-tanrei-system');
|
|
47
|
+
const root = node.getRootNode();
|
|
48
|
+
node = root instanceof ShadowRoot ? root.host : null;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The hosts whose availability is to be read. Reading the cascade asks the browser to bring every style of the page
|
|
54
|
+
* up to date, so the hosts that connect in one turn — the fifty code blocks of a page being defined, each with its
|
|
55
|
+
* copy button and that button's Button — are read together, in one microtask, and cost the page one style pass
|
|
56
|
+
* between them rather than one each.
|
|
57
|
+
*/
|
|
58
|
+
const due = new Set();
|
|
59
|
+
function readDue() {
|
|
60
|
+
const hosts = [...due];
|
|
61
|
+
due.clear();
|
|
62
|
+
for (const host of hosts)
|
|
63
|
+
host.read();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The read waits for the hosts' own updates of the turn. The computed style of an element that is a size container
|
|
67
|
+
* (`container-type`: a link card, a table, a page header) is answered only after a layout, and a host that then
|
|
68
|
+
* writes its content in its first update had the page laid out a second time, each container styled again inside it
|
|
69
|
+
* (fifty link cards: 101 style passes and 2 layouts where 51 and 1 are owed). Read after them, the layout it asks for
|
|
70
|
+
* is the one the frame needed anyway.
|
|
71
|
+
*/
|
|
72
|
+
function readDueOnceDrawn() {
|
|
73
|
+
void Promise.all([...due].map((each) => each.drawn())).then(readDue);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Availability as a Lit controller: when the host connects, and when its `variant` changes, the list the
|
|
77
|
+
* active system's stylesheet declares is read from the cascade, and a component or variant it leaves out is reported
|
|
78
|
+
* once per element in debug builds. Nothing else changes: what is left out still renders and works.
|
|
79
|
+
*/
|
|
80
|
+
export class AvailabilityController {
|
|
81
|
+
constructor(host, component) {
|
|
82
|
+
this.host = host;
|
|
83
|
+
this.component = component;
|
|
84
|
+
this.checked = null;
|
|
85
|
+
host.addController(this);
|
|
86
|
+
}
|
|
87
|
+
variant() {
|
|
88
|
+
const variant = this.host.variant;
|
|
89
|
+
return typeof variant === 'string' ? variant : undefined;
|
|
90
|
+
}
|
|
91
|
+
hostConnected() {
|
|
92
|
+
this.check();
|
|
93
|
+
}
|
|
94
|
+
hostUpdated() {
|
|
95
|
+
if (this.variant() !== this.checked)
|
|
96
|
+
this.check();
|
|
97
|
+
}
|
|
98
|
+
check() {
|
|
99
|
+
this.checked = this.variant();
|
|
100
|
+
if (!debugBuild() || !this.host.isConnected)
|
|
101
|
+
return;
|
|
102
|
+
if (!due.size)
|
|
103
|
+
queueMicrotask(readDueOnceDrawn);
|
|
104
|
+
due.add(this);
|
|
105
|
+
}
|
|
106
|
+
/** The host's update of this turn, done (or failed: the read does not depend on it). */
|
|
107
|
+
drawn() {
|
|
108
|
+
return this.host.updateComplete.catch(() => undefined);
|
|
109
|
+
}
|
|
110
|
+
/** Reads the cascade for this host, as it is now. Called for every host that is due, in one pass. */
|
|
111
|
+
read() {
|
|
112
|
+
if (!this.host.isConnected)
|
|
113
|
+
return;
|
|
114
|
+
const style = getComputedStyle(this.host);
|
|
115
|
+
const entry = unavailableEntry(parseUnavailable(style.getPropertyValue(UNAVAILABLE)), this.component, this.variant());
|
|
116
|
+
if (!entry)
|
|
117
|
+
return;
|
|
118
|
+
const system = unquote(style.getPropertyValue(SYSTEM)) || scopeSystem(this.host);
|
|
119
|
+
report(this.host, 'availability', unavailableMessage(entry, system, parseReplacements(style.getPropertyValue(UNAVAILABLE_REPLACEMENT)).get(entry)));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=availability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"availability.js","sourceRoot":"","sources":["../../src/primitives/availability.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEjD,gHAAgH;AAChH,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAClD,qHAAqH;AACrH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kCAAkC,CAAC;AAC1E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC;AAExC,iGAAiG;AACjG,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACxF,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAE7E,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAC;IACjD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,E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