@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,77 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { type IconSet } from '../generated/icon-sets.js';
|
|
3
|
+
/** The product's decision for one use: by the icon set's list, always, or never. */
|
|
4
|
+
export type GlyphMirroring = 'auto' | 'always' | 'never';
|
|
5
|
+
/**
|
|
6
|
+
* The icon set that is active where `element` is: the set of the design system around it (the nearest
|
|
7
|
+
* `data-tanrei-system`, the default system where there is none), and for a system Tanrei does not ship — a product's own
|
|
8
|
+
* layer — the set whose `families` hold the first family the element is drawn with. Null: no set describes it, so
|
|
9
|
+
* nothing is mirrored by itself there.
|
|
10
|
+
*/
|
|
11
|
+
export declare function activeIconSet(element: Element): IconSet | null;
|
|
12
|
+
/**
|
|
13
|
+
* The glyph name an element holds, or null where it holds none: its text — through any wrapper of its own, such as the
|
|
14
|
+
* `.ink` of GlyphDrawnController, and without the white space around it — when that is one ligature name. An image, an
|
|
15
|
+
* SVG, a custom element, an element that holds one of those or a `.tanrei-icon` of its own (which is marked itself), and
|
|
16
|
+
* a box whose slot the product filled (the glyph is then the slotted element, not the box) hold no name.
|
|
17
|
+
*/
|
|
18
|
+
export declare function glyphName(element: Element): string | null;
|
|
19
|
+
/** Whether the icon set active at `element` mirrors the glyph called `name` in a right-to-left layout. */
|
|
20
|
+
export declare function glyphMirrors(element: Element, name: string | null): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* THE rule: marks `element` with `data-tanrei-mirrored` when the glyph it holds is drawn mirrored
|
|
23
|
+
* in a right-to-left layout, and removes the mark when it is not. `data-mirror="always"` on the element marks it
|
|
24
|
+
* whatever it holds, `"never"` never; otherwise (`auto`) the active icon set's list decides by the glyph's name. Returns
|
|
25
|
+
* whether it is marked. It writes nothing when nothing changes.
|
|
26
|
+
*/
|
|
27
|
+
export declare function markGlyph(element: Element): boolean;
|
|
28
|
+
export interface GlyphMirrorOptions {
|
|
29
|
+
/**
|
|
30
|
+
* A selector, in the host's shadow root, for the boxes whose glyph the COMPONENT writes by name: each is an
|
|
31
|
+
* `iconGlyph()` box holding the ligature text (directly or in an `.ink`). Leave it out when the component draws none
|
|
32
|
+
* that could mirror — it costs one set lookup per box and render, so naming every box is fine.
|
|
33
|
+
*/
|
|
34
|
+
drawn?: string;
|
|
35
|
+
/**
|
|
36
|
+
* A selector, in the host's shadow root, for the slots that take a glyph of the PRODUCT's: `'slot[name="icon"]'`.
|
|
37
|
+
* Each element assigned to them (through forwarded slots too) is marked itself.
|
|
38
|
+
*/
|
|
39
|
+
slots?: string;
|
|
40
|
+
}
|
|
41
|
+
type Host = ReactiveControllerHost & HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Keeps the mirror mark of a component's glyphs right (BTN-19 and its like): after every render, when a slot's content
|
|
44
|
+
* changes, when a slotted glyph's name or `data-mirror` changes, and when the design system is switched. The component
|
|
45
|
+
* only names its boxes and slots; the direction itself is followed by the styles `iconGlyph()` includes.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* private readonly mirror = new GlyphMirrorController(this, { slots: 'slot[name="icon"]', drawn: '.chevron' });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Each `drawn` box and each slot's parent box must be styled by `iconGlyph()` — that is where the mirroring is drawn.
|
|
52
|
+
* A text node placed directly in a slot cannot carry a mark: a glyph is given in an element.
|
|
53
|
+
*/
|
|
54
|
+
export declare class GlyphMirrorController implements ReactiveController {
|
|
55
|
+
private readonly host;
|
|
56
|
+
private readonly options;
|
|
57
|
+
private readonly observer;
|
|
58
|
+
private observed;
|
|
59
|
+
private readonly refresh;
|
|
60
|
+
private root;
|
|
61
|
+
constructor(host: Host, options: GlyphMirrorOptions);
|
|
62
|
+
hostConnected(): void;
|
|
63
|
+
hostDisconnected(): void;
|
|
64
|
+
/** After every render: the glyphs it drew, and what its slots hold now, before the frame is painted. */
|
|
65
|
+
hostUpdated(): void;
|
|
66
|
+
/** Decides every glyph of the host again. Called for you; call it after changing a glyph outside a render. */
|
|
67
|
+
mark(): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Marks every bare `.tanrei-icon` under `root`, now and as the page changes:
|
|
71
|
+
* icons added later, a glyph's name or `data-mirror` changed, the class given to an element, the design system
|
|
72
|
+
* switched. `@tanrei/web` and `@tanrei/web/icons` call it for the document when they load; call it yourself for a
|
|
73
|
+
* shadow root of your own, which the document's observer cannot see into. Calling it twice for one root observes once.
|
|
74
|
+
* Returns a function that stops observing that root (the marks already written stay).
|
|
75
|
+
*/
|
|
76
|
+
export declare function observeIcons(root?: Document | ShadowRoot | Element): () => void;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { iconSets, systemIconSets } from '../generated/icon-sets.js';
|
|
2
|
+
import { MIRROR, MIRRORED } from '../styles/icons.js';
|
|
3
|
+
/** The design system of a page that names none. */
|
|
4
|
+
const DEFAULT_SYSTEM = 'tanrei';
|
|
5
|
+
/** A ligature name: one word of letters, digits and underscores. Anything else is text, not a glyph. */
|
|
6
|
+
const NAME = /^[a-z0-9_]+$/i;
|
|
7
|
+
/** What is a picture or a view of the product's, not a name: never mirrored by the list. */
|
|
8
|
+
const NOT_A_NAME = 'svg, img, picture, canvas, video, object, embed, iframe';
|
|
9
|
+
/** The nearest `data-tanrei-system` around the element, across shadow roots. */
|
|
10
|
+
function scopeSystem(element) {
|
|
11
|
+
for (let node = element; node;) {
|
|
12
|
+
const scope = node.closest('[data-tanrei-system]');
|
|
13
|
+
if (scope)
|
|
14
|
+
return scope.getAttribute('data-tanrei-system');
|
|
15
|
+
const root = node.getRootNode();
|
|
16
|
+
node = root instanceof ShadowRoot ? root.host : null;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The icon set that is active where `element` is: the set of the design system around it (the nearest
|
|
22
|
+
* `data-tanrei-system`, the default system where there is none), and for a system Tanrei does not ship — a product's own
|
|
23
|
+
* layer — the set whose `families` hold the first family the element is drawn with. Null: no set describes it, so
|
|
24
|
+
* nothing is mirrored by itself there.
|
|
25
|
+
*/
|
|
26
|
+
export function activeIconSet(element) {
|
|
27
|
+
const system = scopeSystem(element) || DEFAULT_SYSTEM;
|
|
28
|
+
if (Object.hasOwn(systemIconSets, system)) {
|
|
29
|
+
const id = systemIconSets[system];
|
|
30
|
+
return id && Object.hasOwn(iconSets, id) ? iconSets[id] : null;
|
|
31
|
+
}
|
|
32
|
+
const family = getComputedStyle(element).fontFamily.split(',')[0]?.trim().replace(/^["']|["']$/g, '').toLowerCase();
|
|
33
|
+
if (!family)
|
|
34
|
+
return null;
|
|
35
|
+
return Object.values(iconSets).find((set) => set.families.some((name) => name.toLowerCase() === family)) ?? null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The glyph name an element holds, or null where it holds none: its text — through any wrapper of its own, such as the
|
|
39
|
+
* `.ink` of GlyphDrawnController, and without the white space around it — when that is one ligature name. An image, an
|
|
40
|
+
* SVG, a custom element, an element that holds one of those or a `.tanrei-icon` of its own (which is marked itself), and
|
|
41
|
+
* a box whose slot the product filled (the glyph is then the slotted element, not the box) hold no name.
|
|
42
|
+
*/
|
|
43
|
+
export function glyphName(element) {
|
|
44
|
+
if (element.matches(NOT_A_NAME) || element.localName.includes('-'))
|
|
45
|
+
return null;
|
|
46
|
+
if (element.querySelector(`${NOT_A_NAME}, .tanrei-icon`))
|
|
47
|
+
return null;
|
|
48
|
+
for (const slot of element.querySelectorAll('slot'))
|
|
49
|
+
if (slot.assignedNodes({ flatten: true }).length)
|
|
50
|
+
return null;
|
|
51
|
+
const text = element.textContent?.trim() ?? '';
|
|
52
|
+
return NAME.test(text) ? text : null;
|
|
53
|
+
}
|
|
54
|
+
/** Whether the icon set active at `element` mirrors the glyph called `name` in a right-to-left layout. */
|
|
55
|
+
export function glyphMirrors(element, name) {
|
|
56
|
+
return !!name && !!activeIconSet(element)?.mirrored.has(name);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* THE rule: marks `element` with `data-tanrei-mirrored` when the glyph it holds is drawn mirrored
|
|
60
|
+
* in a right-to-left layout, and removes the mark when it is not. `data-mirror="always"` on the element marks it
|
|
61
|
+
* whatever it holds, `"never"` never; otherwise (`auto`) the active icon set's list decides by the glyph's name. Returns
|
|
62
|
+
* whether it is marked. It writes nothing when nothing changes.
|
|
63
|
+
*/
|
|
64
|
+
export function markGlyph(element) {
|
|
65
|
+
const mirroring = element.getAttribute(MIRROR);
|
|
66
|
+
const mirrored = mirroring === 'always' || (mirroring !== 'never' && glyphMirrors(element, glyphName(element)));
|
|
67
|
+
if (mirrored !== element.hasAttribute(MIRRORED))
|
|
68
|
+
element.toggleAttribute(MIRRORED, mirrored);
|
|
69
|
+
return mirrored;
|
|
70
|
+
}
|
|
71
|
+
// The active icon set changes when the design system does. A system is switched on the document's root (as
|
|
72
|
+
// primitives/system-watch.ts says); everything that marked glyphs marks them again then. One observer for the page.
|
|
73
|
+
const refreshers = new Set();
|
|
74
|
+
let systemObserver = null;
|
|
75
|
+
function watchSystem(refresh) {
|
|
76
|
+
refreshers.add(refresh);
|
|
77
|
+
if (systemObserver || typeof MutationObserver === 'undefined' || typeof document === 'undefined')
|
|
78
|
+
return;
|
|
79
|
+
systemObserver = new MutationObserver(() => {
|
|
80
|
+
for (const each of [...refreshers])
|
|
81
|
+
each();
|
|
82
|
+
});
|
|
83
|
+
systemObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-tanrei-system', 'class', 'style'] });
|
|
84
|
+
}
|
|
85
|
+
function unwatchSystem(refresh) {
|
|
86
|
+
refreshers.delete(refresh);
|
|
87
|
+
if (refreshers.size)
|
|
88
|
+
return;
|
|
89
|
+
systemObserver?.disconnect();
|
|
90
|
+
systemObserver = null;
|
|
91
|
+
}
|
|
92
|
+
/** What tells a glyph's mark to be decided again: its name (its text) or the product's `data-mirror` changed. */
|
|
93
|
+
const GLYPH_CHANGES = { attributes: true, attributeFilter: [MIRROR], characterData: true, childList: true, subtree: true };
|
|
94
|
+
/**
|
|
95
|
+
* Keeps the mirror mark of a component's glyphs right (BTN-19 and its like): after every render, when a slot's content
|
|
96
|
+
* changes, when a slotted glyph's name or `data-mirror` changes, and when the design system is switched. The component
|
|
97
|
+
* only names its boxes and slots; the direction itself is followed by the styles `iconGlyph()` includes.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* private readonly mirror = new GlyphMirrorController(this, { slots: 'slot[name="icon"]', drawn: '.chevron' });
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* Each `drawn` box and each slot's parent box must be styled by `iconGlyph()` — that is where the mirroring is drawn.
|
|
104
|
+
* A text node placed directly in a slot cannot carry a mark: a glyph is given in an element.
|
|
105
|
+
*/
|
|
106
|
+
export class GlyphMirrorController {
|
|
107
|
+
constructor(host, options) {
|
|
108
|
+
this.host = host;
|
|
109
|
+
this.options = options;
|
|
110
|
+
this.observer = typeof MutationObserver === 'undefined' ? null : new MutationObserver(() => this.mark());
|
|
111
|
+
this.observed = [];
|
|
112
|
+
this.refresh = () => this.mark();
|
|
113
|
+
this.root = null;
|
|
114
|
+
host.addController(this);
|
|
115
|
+
}
|
|
116
|
+
hostConnected() {
|
|
117
|
+
watchSystem(this.refresh);
|
|
118
|
+
// `slotchange` bubbles to the shadow root: one listener hears every slot of the component.
|
|
119
|
+
this.root = this.host.shadowRoot;
|
|
120
|
+
this.root?.addEventListener('slotchange', this.refresh);
|
|
121
|
+
this.mark();
|
|
122
|
+
}
|
|
123
|
+
hostDisconnected() {
|
|
124
|
+
unwatchSystem(this.refresh);
|
|
125
|
+
this.root?.removeEventListener('slotchange', this.refresh);
|
|
126
|
+
this.root = null;
|
|
127
|
+
this.observer?.disconnect();
|
|
128
|
+
this.observed = [];
|
|
129
|
+
}
|
|
130
|
+
/** After every render: the glyphs it drew, and what its slots hold now, before the frame is painted. */
|
|
131
|
+
hostUpdated() {
|
|
132
|
+
if (!this.root && this.host.shadowRoot) {
|
|
133
|
+
this.root = this.host.shadowRoot;
|
|
134
|
+
this.root.addEventListener('slotchange', this.refresh);
|
|
135
|
+
}
|
|
136
|
+
this.mark();
|
|
137
|
+
}
|
|
138
|
+
/** Decides every glyph of the host again. Called for you; call it after changing a glyph outside a render. */
|
|
139
|
+
mark() {
|
|
140
|
+
const root = this.host.shadowRoot;
|
|
141
|
+
if (!root || !this.host.isConnected)
|
|
142
|
+
return;
|
|
143
|
+
const { drawn, slots } = this.options;
|
|
144
|
+
if (drawn)
|
|
145
|
+
for (const box of root.querySelectorAll(drawn))
|
|
146
|
+
markGlyph(box);
|
|
147
|
+
if (!slots)
|
|
148
|
+
return;
|
|
149
|
+
const assigned = [...root.querySelectorAll(slots)].flatMap((slot) => slot.assignedElements({ flatten: true }));
|
|
150
|
+
for (const element of assigned)
|
|
151
|
+
markGlyph(element);
|
|
152
|
+
if (assigned.length === this.observed.length && assigned.every((element, index) => element === this.observed[index]))
|
|
153
|
+
return;
|
|
154
|
+
this.observer?.disconnect();
|
|
155
|
+
this.observed = assigned;
|
|
156
|
+
for (const element of assigned)
|
|
157
|
+
this.observer?.observe(element, GLYPH_CHANGES);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const ICON = '.tanrei-icon';
|
|
161
|
+
const observing = new WeakMap();
|
|
162
|
+
/**
|
|
163
|
+
* Marks every bare `.tanrei-icon` under `root`, now and as the page changes:
|
|
164
|
+
* icons added later, a glyph's name or `data-mirror` changed, the class given to an element, the design system
|
|
165
|
+
* switched. `@tanrei/web` and `@tanrei/web/icons` call it for the document when they load; call it yourself for a
|
|
166
|
+
* shadow root of your own, which the document's observer cannot see into. Calling it twice for one root observes once.
|
|
167
|
+
* Returns a function that stops observing that root (the marks already written stay).
|
|
168
|
+
*/
|
|
169
|
+
export function observeIcons(root = document) {
|
|
170
|
+
const running = observing.get(root);
|
|
171
|
+
if (running)
|
|
172
|
+
return running;
|
|
173
|
+
if (typeof MutationObserver === 'undefined')
|
|
174
|
+
return () => { };
|
|
175
|
+
const all = () => {
|
|
176
|
+
for (const icon of root.querySelectorAll(ICON))
|
|
177
|
+
markGlyph(icon);
|
|
178
|
+
};
|
|
179
|
+
const observer = new MutationObserver((records) => {
|
|
180
|
+
const icons = new Set();
|
|
181
|
+
for (const record of records) {
|
|
182
|
+
const target = record.target instanceof Element ? record.target : record.target.parentElement;
|
|
183
|
+
// A change inside an icon (its text, a wrapper) or on it (its class, its `data-mirror`).
|
|
184
|
+
const around = target?.closest(ICON);
|
|
185
|
+
if (around)
|
|
186
|
+
icons.add(around);
|
|
187
|
+
for (const node of record.addedNodes) {
|
|
188
|
+
if (!(node instanceof Element))
|
|
189
|
+
continue;
|
|
190
|
+
if (node.matches(ICON))
|
|
191
|
+
icons.add(node);
|
|
192
|
+
for (const icon of node.querySelectorAll(ICON))
|
|
193
|
+
icons.add(icon);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
for (const icon of icons)
|
|
197
|
+
if (icon.isConnected)
|
|
198
|
+
markGlyph(icon);
|
|
199
|
+
});
|
|
200
|
+
observer.observe(root, { attributes: true, attributeFilter: ['class', MIRROR], characterData: true, childList: true, subtree: true });
|
|
201
|
+
watchSystem(all);
|
|
202
|
+
all();
|
|
203
|
+
const stop = () => {
|
|
204
|
+
observer.disconnect();
|
|
205
|
+
unwatchSystem(all);
|
|
206
|
+
observing.delete(root);
|
|
207
|
+
};
|
|
208
|
+
observing.set(root, stop);
|
|
209
|
+
return stop;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=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,OAAO,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,MAAM;gBAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC9B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBACrC,IAAI,CAAC,CAAC,IAAI,YAAY,OAAO,CAAC;oBAAE,SAAS;gBACzC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACxC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;oBAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,IAAI,IAAI,CAAC,WAAW;gBAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACtI,WAAW,CAAC,GAAG,CAAC,CAAC;IACjB,GAAG,EAAE,CAAC;IACN,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,QAAQ,CAAC,UAAU,EAAE,CAAC;QACtB,aAAa,CAAC,GAAG,CAAC,CAAC;QACnB,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Whether `node` is the box a host's glyph is measured in: its coming and going is not a change of the host's content. */
|
|
2
|
+
export declare const isGlyphProbe: (node: Node) => boolean;
|
|
3
|
+
export declare class PendingGlyphs {
|
|
4
|
+
private readonly host;
|
|
5
|
+
private readonly glyph;
|
|
6
|
+
private probe;
|
|
7
|
+
private sizes;
|
|
8
|
+
/** `glyph`: a name the icon set has (the component's own mark: `chevron_right`). */
|
|
9
|
+
constructor(host: HTMLElement, glyph: string);
|
|
10
|
+
/** Call when the host is connected. */
|
|
11
|
+
connect(): void;
|
|
12
|
+
/** Call when the host is disconnected. */
|
|
13
|
+
disconnect(): void;
|
|
14
|
+
/** Reads whether the family draws the glyph now, and writes the mark. A host that is not drawn is asked again when it is. */
|
|
15
|
+
read(): void;
|
|
16
|
+
private box;
|
|
17
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DRAWN_WIDTH } from './glyph.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the icon set can draw a glyph yet, for a light-DOM component whose glyphs are drawn by a stylesheet (a
|
|
4
|
+
* pseudo-element's `content`, the product's own `.tanrei-icon` elements): there is no box of the component's own to
|
|
5
|
+
* measure each glyph in, so ONE name is measured in the icon family, in a box that is not drawn, and the host is marked
|
|
6
|
+
* `data-glyphs="pending"` while the family cannot draw it. The stylesheet draws no glyph under that mark and keeps
|
|
7
|
+
* every box (TRV-40).
|
|
8
|
+
*
|
|
9
|
+
* A glyph is a ligature — one glyph, about one em wide — and its name spelled in a text face is several
|
|
10
|
+
* (src/primitives/glyph.ts). A family that draws is remembered until the fonts of the page change. Only while the
|
|
11
|
+
* family cannot draw does the measured box stay, as a child of the host that is not drawn, so that the font's arrival
|
|
12
|
+
* is heard as a change of that box's size in the frame it happens, whatever the engine says of its fonts.
|
|
13
|
+
*/
|
|
14
|
+
const drawable = new Set();
|
|
15
|
+
const EM = 24;
|
|
16
|
+
const PROBE = 'data-tanrei-glyph-probe';
|
|
17
|
+
const FAMILY = '--tanrei-sys-icon-family-unselected';
|
|
18
|
+
const connected = new Set();
|
|
19
|
+
const fontsChanged = () => {
|
|
20
|
+
drawable.clear();
|
|
21
|
+
for (const pending of connected)
|
|
22
|
+
pending.read();
|
|
23
|
+
};
|
|
24
|
+
/** Whether `node` is the box a host's glyph is measured in: its coming and going is not a change of the host's content. */
|
|
25
|
+
export const isGlyphProbe = (node) => node instanceof Element && node.hasAttribute(PROBE);
|
|
26
|
+
export class PendingGlyphs {
|
|
27
|
+
/** `glyph`: a name the icon set has (the component's own mark: `chevron_right`). */
|
|
28
|
+
constructor(host, glyph) {
|
|
29
|
+
this.host = host;
|
|
30
|
+
this.glyph = glyph;
|
|
31
|
+
this.probe = null;
|
|
32
|
+
}
|
|
33
|
+
/** Call when the host is connected. */
|
|
34
|
+
connect() {
|
|
35
|
+
if (!connected.size) {
|
|
36
|
+
document.fonts?.addEventListener('loadingdone', fontsChanged);
|
|
37
|
+
document.fonts?.addEventListener('loadingerror', fontsChanged);
|
|
38
|
+
}
|
|
39
|
+
connected.add(this);
|
|
40
|
+
}
|
|
41
|
+
/** Call when the host is disconnected. */
|
|
42
|
+
disconnect() {
|
|
43
|
+
connected.delete(this);
|
|
44
|
+
if (!connected.size) {
|
|
45
|
+
document.fonts?.removeEventListener('loadingdone', fontsChanged);
|
|
46
|
+
document.fonts?.removeEventListener('loadingerror', fontsChanged);
|
|
47
|
+
}
|
|
48
|
+
this.sizes?.disconnect();
|
|
49
|
+
this.probe?.remove();
|
|
50
|
+
this.probe = null;
|
|
51
|
+
}
|
|
52
|
+
/** Reads whether the family draws the glyph now, and writes the mark. A host that is not drawn is asked again when it is. */
|
|
53
|
+
read() {
|
|
54
|
+
const host = this.host;
|
|
55
|
+
if (!host.isConnected)
|
|
56
|
+
return;
|
|
57
|
+
const family = getComputedStyle(host).getPropertyValue(FAMILY).trim();
|
|
58
|
+
let drawn = !family || drawable.has(family);
|
|
59
|
+
if (!drawn) {
|
|
60
|
+
const probe = this.probe ?? host.appendChild(this.box());
|
|
61
|
+
const width = probe.getBoundingClientRect().width;
|
|
62
|
+
drawn = width <= EM * DRAWN_WIDTH;
|
|
63
|
+
if (drawn && width > 0)
|
|
64
|
+
drawable.add(family);
|
|
65
|
+
else if (!this.probe) {
|
|
66
|
+
this.probe = probe;
|
|
67
|
+
this.sizes ??= typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.read());
|
|
68
|
+
this.sizes?.observe(probe);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (drawn && this.probe) {
|
|
72
|
+
this.sizes?.disconnect();
|
|
73
|
+
this.probe = null;
|
|
74
|
+
}
|
|
75
|
+
if (drawn)
|
|
76
|
+
host.querySelector(`:scope > [${PROBE}]`)?.remove();
|
|
77
|
+
if (drawn)
|
|
78
|
+
host.removeAttribute('data-glyphs');
|
|
79
|
+
else if (host.getAttribute('data-glyphs') !== 'pending')
|
|
80
|
+
host.setAttribute('data-glyphs', 'pending');
|
|
81
|
+
}
|
|
82
|
+
box() {
|
|
83
|
+
const probe = document.createElement('span');
|
|
84
|
+
probe.setAttribute('aria-hidden', 'true');
|
|
85
|
+
probe.setAttribute(PROBE, '');
|
|
86
|
+
probe.style.cssText = `position: absolute; visibility: hidden; pointer-events: none; white-space: nowrap; font: normal ${EM}px/1 var(${FAMILY}); letter-spacing: normal; font-feature-settings: 'liga'; text-transform: none`;
|
|
87
|
+
probe.textContent = this.glyph;
|
|
88
|
+
return probe;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=glyph-pending.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glyph-pending.js","sourceRoot":"","sources":["../../src/primitives/glyph-pending.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AACnC,MAAM,EAAE,GAAG,EAAE,CAAC;AACd,MAAM,KAAK,GAAG,yBAAyB,CAAC;AACxC,MAAM,MAAM,GAAG,qCAAqC,CAAC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AAK;YAAE,IAAI,CAAC,aAAa,CAAC,aAAa,KAAK,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/D,IAAI,KAAK;YAAE,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;aAC1C,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,SAAS;YAAE,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACvG,CAAC;IAEO,GAAG;QACT,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7C,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC1C,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,mGAAmG,EAAE,YAAY,MAAM,gFAAgF,CAAC;QAC9N,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A glyph of the icon set is a ligature: while its font is missing (still loading, failed, or never made available —
|
|
4
|
+
* fonts are named, not bundled) the browser spells the glyph's name in a text face instead (CHK-19). A
|
|
5
|
+
* ligature is one glyph, about one em wide; its name spelled out is several. A glyph is drawn while its ink is at most
|
|
6
|
+
* `DRAWN_WIDTH` of its box (the box is one em: `iconGlyph()` sizes both from the icon size). The one answer on the web to
|
|
7
|
+
* whether a glyph of the icon set can be drawn yet: the checkbox (CHK-19), the switch (SWT-17), the menu's check (MNU-30),
|
|
8
|
+
* the snackbar's glyphs (SNK-26) and every other mark of the icon set use it.
|
|
9
|
+
*
|
|
10
|
+
* It assumes that a face that draws the ligature draws it no wider than `DRAWN_WIDTH` em, and that a fallback face
|
|
11
|
+
* spells the name wider than that. That holds for Material Symbols and Material Icons; an icon font whose ligatures are
|
|
12
|
+
* wider than their em box would read as not drawable.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DRAWN_WIDTH = 1.5;
|
|
15
|
+
/** What was read of a glyph: whether the icon set can draw it now. */
|
|
16
|
+
type Reading = readonly [glyph: HTMLElement, drawn: boolean];
|
|
17
|
+
/**
|
|
18
|
+
* Marks each glyph the host draws with `data-drawn` while the icon set can draw it, and removes the mark while it cannot,
|
|
19
|
+
* so the component's styles draw nothing in its place until then. Each glyph is a box styled by `iconGlyph()` holding
|
|
20
|
+
* ONE inline-block child with the ligature text — the child's width is the ink's. A ResizeObserver on that child hears
|
|
21
|
+
* the font arrive (or a system switch to another icon set) in the frame it changes the layout, before it is painted.
|
|
22
|
+
* When a glyph becomes drawable, the transitions running on it are ended, so it appears without motion.
|
|
23
|
+
*/
|
|
24
|
+
export declare class GlyphDrawnController implements ReactiveController {
|
|
25
|
+
private readonly host;
|
|
26
|
+
private readonly glyphs;
|
|
27
|
+
private readonly options;
|
|
28
|
+
private connected;
|
|
29
|
+
private readonly observed;
|
|
30
|
+
private readonly fontsChanged;
|
|
31
|
+
/**
|
|
32
|
+
* `firstInFrame`: a glyph the host draws for the first time is decided by the observer — after the layout of the
|
|
33
|
+
* frame it is first drawn in, before that frame is painted — in place of a layout the host asks for in the task of
|
|
34
|
+
* its render. For a host that a page draws many of at once (the copy button of every code block of a page): the
|
|
35
|
+
* hosts are then decided in one pass, and none of them costs the page a layout of its own. The mark is in the
|
|
36
|
+
* first frame painted either way; it is not there yet in the task of the render, nor in a frame callback before it.
|
|
37
|
+
*/
|
|
38
|
+
constructor(host: ReactiveControllerHost & Element, glyphs: () => Iterable<HTMLElement>, options?: {
|
|
39
|
+
firstInFrame?: boolean;
|
|
40
|
+
});
|
|
41
|
+
hostConnected(): void;
|
|
42
|
+
hostDisconnected(): void;
|
|
43
|
+
/**
|
|
44
|
+
* After every render: observe the glyphs it drew, and decide in this turn, before the first frame is painted — with
|
|
45
|
+
* every other host that rendered in it (`decideTogether`). With
|
|
46
|
+
* `firstInFrame`, a render that draws only glyphs the observer is newly given leaves the decision to it; a render
|
|
47
|
+
* that draws a glyph the observer already has is decided at once, as its size may not change.
|
|
48
|
+
*/
|
|
49
|
+
hostUpdated(): void;
|
|
50
|
+
/** Each glyph, and whether its ink is the ligature: a reading of the layout. None for a host that is not connected. */
|
|
51
|
+
read(): Reading[];
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A glyph of the icon set is a ligature: while its font is missing (still loading, failed, or never made available —
|
|
3
|
+
* fonts are named, not bundled) the browser spells the glyph's name in a text face instead (CHK-19). A
|
|
4
|
+
* ligature is one glyph, about one em wide; its name spelled out is several. A glyph is drawn while its ink is at most
|
|
5
|
+
* `DRAWN_WIDTH` of its box (the box is one em: `iconGlyph()` sizes both from the icon size). The one answer on the web to
|
|
6
|
+
* whether a glyph of the icon set can be drawn yet: the checkbox (CHK-19), the switch (SWT-17), the menu's check (MNU-30),
|
|
7
|
+
* the snackbar's glyphs (SNK-26) and every other mark of the icon set use it.
|
|
8
|
+
*
|
|
9
|
+
* It assumes that a face that draws the ligature draws it no wider than `DRAWN_WIDTH` em, and that a fallback face
|
|
10
|
+
* spells the name wider than that. That holds for Material Symbols and Material Icons; an icon font whose ligatures are
|
|
11
|
+
* wider than their em box would read as not drawable.
|
|
12
|
+
*/
|
|
13
|
+
export const DRAWN_WIDTH = 1.5;
|
|
14
|
+
/**
|
|
15
|
+
* The glyphs whose mark is not what was read get it; those that became drawable appear without motion. Returns the
|
|
16
|
+
* glyphs whose mark changed.
|
|
17
|
+
*/
|
|
18
|
+
function mark(readings) {
|
|
19
|
+
const appeared = [];
|
|
20
|
+
const changed = [];
|
|
21
|
+
for (const [glyph, drawn] of readings) {
|
|
22
|
+
if (drawn === glyph.hasAttribute('data-drawn'))
|
|
23
|
+
continue;
|
|
24
|
+
glyph.toggleAttribute('data-drawn', drawn);
|
|
25
|
+
changed.push(glyph);
|
|
26
|
+
if (drawn)
|
|
27
|
+
appeared.push(glyph);
|
|
28
|
+
}
|
|
29
|
+
for (const animation of appeared.flatMap((glyph) => glyph.getAnimations()))
|
|
30
|
+
animation.finish();
|
|
31
|
+
return changed;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* One observer for every glyph of the page: it is told of them all after a layout, every host reads its glyphs, and
|
|
35
|
+
* only then are the marks written — so the glyphs of a page are decided in one pass, not one layout for each host.
|
|
36
|
+
*/
|
|
37
|
+
const owners = new WeakMap();
|
|
38
|
+
const observer = typeof ResizeObserver === 'undefined'
|
|
39
|
+
? null
|
|
40
|
+
: new ResizeObserver((entries) => {
|
|
41
|
+
const hosts = new Set();
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const owner = owners.get(entry.target);
|
|
44
|
+
if (owner)
|
|
45
|
+
hosts.add(owner);
|
|
46
|
+
}
|
|
47
|
+
mark([...hosts].flatMap((host) => host.read()));
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* The hosts that decide at once, in the turn of their render — collected, and read together. Each host renders in a
|
|
51
|
+
* microtask of its own, after writing its own shadow tree: a host that read its glyphs there had the page styled and
|
|
52
|
+
* laid out once for itself (fifty layouts).
|
|
53
|
+
* The hosts of one turn are read in ONE microtask after their renders — one layout for them all — and only then are
|
|
54
|
+
* the marks written. The decision is still made in the task of the render, before any frame.
|
|
55
|
+
*/
|
|
56
|
+
const deciding = new Set();
|
|
57
|
+
function decideTogether(host) {
|
|
58
|
+
if (!deciding.size) {
|
|
59
|
+
queueMicrotask(() => {
|
|
60
|
+
const hosts = [...deciding];
|
|
61
|
+
deciding.clear();
|
|
62
|
+
watchAgain(mark(hosts.flatMap((each) => each.read())));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
deciding.add(host);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A mark written here, between two frames, was read from a width the observer has not been told of: it compares an
|
|
69
|
+
* ink's width with the one it last reported, so an ink that is back at that width by the next frame — the face that
|
|
70
|
+
* arrived is gone again, the icon set was switched and switched back — is not reported, and its mark would stay as
|
|
71
|
+
* this read left it (a check still marked drawable, five seconds after its font was taken away). The inks whose mark changed here are given to the observer anew, which
|
|
72
|
+
* has it report them after the next layout whatever their width is then. Nothing is laid out for it: the observer
|
|
73
|
+
* reads after the frame's own layout, and writes only a mark that differs.
|
|
74
|
+
*/
|
|
75
|
+
function watchAgain(glyphs) {
|
|
76
|
+
if (!observer)
|
|
77
|
+
return;
|
|
78
|
+
for (const glyph of glyphs) {
|
|
79
|
+
const ink = glyph.firstElementChild;
|
|
80
|
+
if (!ink || !owners.has(ink))
|
|
81
|
+
continue;
|
|
82
|
+
observer.unobserve(ink);
|
|
83
|
+
observer.observe(ink);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Marks each glyph the host draws with `data-drawn` while the icon set can draw it, and removes the mark while it cannot,
|
|
88
|
+
* so the component's styles draw nothing in its place until then. Each glyph is a box styled by `iconGlyph()` holding
|
|
89
|
+
* ONE inline-block child with the ligature text — the child's width is the ink's. A ResizeObserver on that child hears
|
|
90
|
+
* the font arrive (or a system switch to another icon set) in the frame it changes the layout, before it is painted.
|
|
91
|
+
* When a glyph becomes drawable, the transitions running on it are ended, so it appears without motion.
|
|
92
|
+
*/
|
|
93
|
+
export class GlyphDrawnController {
|
|
94
|
+
/**
|
|
95
|
+
* `firstInFrame`: a glyph the host draws for the first time is decided by the observer — after the layout of the
|
|
96
|
+
* frame it is first drawn in, before that frame is painted — in place of a layout the host asks for in the task of
|
|
97
|
+
* its render. For a host that a page draws many of at once (the copy button of every code block of a page): the
|
|
98
|
+
* hosts are then decided in one pass, and none of them costs the page a layout of its own. The mark is in the
|
|
99
|
+
* first frame painted either way; it is not there yet in the task of the render, nor in a frame callback before it.
|
|
100
|
+
*/
|
|
101
|
+
constructor(host, glyphs, options = {}) {
|
|
102
|
+
this.host = host;
|
|
103
|
+
this.glyphs = glyphs;
|
|
104
|
+
this.options = options;
|
|
105
|
+
this.connected = false;
|
|
106
|
+
this.observed = new Set();
|
|
107
|
+
this.fontsChanged = () => decideTogether(this);
|
|
108
|
+
host.addController(this);
|
|
109
|
+
}
|
|
110
|
+
hostConnected() {
|
|
111
|
+
this.connected = true;
|
|
112
|
+
document.fonts?.addEventListener('loadingdone', this.fontsChanged);
|
|
113
|
+
document.fonts?.addEventListener('loadingerror', this.fontsChanged);
|
|
114
|
+
}
|
|
115
|
+
hostDisconnected() {
|
|
116
|
+
this.connected = false;
|
|
117
|
+
for (const ink of this.observed) {
|
|
118
|
+
observer?.unobserve(ink);
|
|
119
|
+
owners.delete(ink);
|
|
120
|
+
}
|
|
121
|
+
this.observed.clear();
|
|
122
|
+
document.fonts?.removeEventListener('loadingdone', this.fontsChanged);
|
|
123
|
+
document.fonts?.removeEventListener('loadingerror', this.fontsChanged);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* After every render: observe the glyphs it drew, and decide in this turn, before the first frame is painted — with
|
|
127
|
+
* every other host that rendered in it (`decideTogether`). With
|
|
128
|
+
* `firstInFrame`, a render that draws only glyphs the observer is newly given leaves the decision to it; a render
|
|
129
|
+
* that draws a glyph the observer already has is decided at once, as its size may not change.
|
|
130
|
+
*/
|
|
131
|
+
hostUpdated() {
|
|
132
|
+
const watching = !!observer && this.connected;
|
|
133
|
+
let decide = !watching || !this.options.firstInFrame;
|
|
134
|
+
for (const glyph of this.glyphs()) {
|
|
135
|
+
const ink = glyph.firstElementChild;
|
|
136
|
+
if (ink && watching && !this.observed.has(ink)) {
|
|
137
|
+
this.observed.add(ink);
|
|
138
|
+
owners.set(ink, this);
|
|
139
|
+
observer.observe(ink);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
decide = true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (decide)
|
|
146
|
+
decideTogether(this);
|
|
147
|
+
}
|
|
148
|
+
/** Each glyph, and whether its ink is the ligature: a reading of the layout. None for a host that is not connected. */
|
|
149
|
+
read() {
|
|
150
|
+
const readings = [];
|
|
151
|
+
if (!this.connected)
|
|
152
|
+
return readings;
|
|
153
|
+
for (const glyph of this.glyphs()) {
|
|
154
|
+
const ink = glyph.firstElementChild;
|
|
155
|
+
const box = glyph.clientWidth;
|
|
156
|
+
readings.push([glyph, !!ink && box > 0 && ink.offsetWidth <= box * DRAWN_WIDTH]);
|
|
157
|
+
}
|
|
158
|
+
return readings;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=glyph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glyph.js","sourceRoot":"","sources":["../../src/primitives/glyph.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAK/B;;;GAGG;AACH,SAAS,IAAI,CAAC,QAA4B;IACxC,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,MAAM,OAAO,GAAkB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;QACtC,IAAI,KAAK,KAAK,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC;YAAE,SAAS;QACzD,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,IAAI,KAAK;YAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAAE,SAAS,CAAC,MAAM,EAAE,CAAC;IAC/F,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GA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