@repobit/dex-system-design 3.0.1 → 3.0.3
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/CHANGELOG.md +14 -0
- package/dist/src/_bundled/oxc-project_runtime/helpers/esm/decorate.js +1 -0
- package/dist/src/components/accordion/accordion-bg.css.js +1 -288
- package/dist/src/components/accordion/accordion-bg.css.js.map +1 -1
- package/dist/src/components/accordion/accordion-bg.d.ts +5 -5
- package/dist/src/components/accordion/accordion-bg.js +15 -210
- package/dist/src/components/accordion/accordion-bg.js.map +1 -1
- package/dist/src/components/accordion/accordion-keyboard.js +1 -89
- package/dist/src/components/accordion/accordion-keyboard.js.map +1 -1
- package/dist/src/components/accordion/accordion-panel.js +1 -22
- package/dist/src/components/accordion/accordion-panel.js.map +1 -1
- package/dist/src/components/accordion/accordion.css.js +1 -380
- package/dist/src/components/accordion/accordion.css.js.map +1 -1
- package/dist/src/components/accordion/accordion.d.ts +7 -7
- package/dist/src/components/accordion/accordion.js +16 -138
- package/dist/src/components/accordion/accordion.js.map +1 -1
- package/dist/src/components/agent-endpoints/agent-endpoints.css.js +1 -88
- package/dist/src/components/agent-endpoints/agent-endpoints.css.js.map +1 -1
- package/dist/src/components/agent-endpoints/agent-endpoints.d.ts +4 -4
- package/dist/src/components/agent-endpoints/agent-endpoints.js +17 -76
- package/dist/src/components/agent-endpoints/agent-endpoints.js.map +1 -1
- package/dist/src/components/alert/alert.css.js +1 -217
- package/dist/src/components/alert/alert.css.js.map +1 -1
- package/dist/src/components/alert/alert.d.ts +4 -4
- package/dist/src/components/alert/alert.js +6 -110
- package/dist/src/components/alert/alert.js.map +1 -1
- package/dist/src/components/anchor/anchor-nav.css.js +1 -546
- package/dist/src/components/anchor/anchor-nav.css.js.map +1 -1
- package/dist/src/components/anchor/anchor-nav.d.ts +4 -4
- package/dist/src/components/anchor/anchor-nav.js +23 -567
- package/dist/src/components/anchor/anchor-nav.js.map +1 -1
- package/dist/src/components/annotation/annotation.css.js +1 -64
- package/dist/src/components/annotation/annotation.css.js.map +1 -1
- package/dist/src/components/annotation/annotation.d.ts +2 -2
- package/dist/src/components/annotation/annotation.js +7 -72
- package/dist/src/components/annotation/annotation.js.map +1 -1
- package/dist/src/components/audience-card/audience-card.css.js +1 -122
- package/dist/src/components/audience-card/audience-card.css.js.map +1 -1
- package/dist/src/components/audience-card/audience-card.d.ts +2 -2
- package/dist/src/components/audience-card/audience-card.js +8 -83
- package/dist/src/components/audience-card/audience-card.js.map +1 -1
- package/dist/src/components/avatar/avatar.css.js +1 -65
- package/dist/src/components/avatar/avatar.css.js.map +1 -1
- package/dist/src/components/avatar/avatar.d.ts +3 -3
- package/dist/src/components/avatar/avatar.js +6 -76
- package/dist/src/components/avatar/avatar.js.map +1 -1
- package/dist/src/components/awards/awards-flex.css.js +1 -273
- package/dist/src/components/awards/awards-flex.css.js.map +1 -1
- package/dist/src/components/awards/awards-flex.d.ts +12 -12
- package/dist/src/components/awards/awards-flex.js +33 -264
- package/dist/src/components/awards/awards-flex.js.map +1 -1
- package/dist/src/components/awards/awards-spotlight.css.js +1 -161
- package/dist/src/components/awards/awards-spotlight.css.js.map +1 -1
- package/dist/src/components/awards/awards-spotlight.d.ts +4 -4
- package/dist/src/components/awards/awards-spotlight.js +24 -140
- package/dist/src/components/awards/awards-spotlight.js.map +1 -1
- package/dist/src/components/awards/awards.css.js +1 -401
- package/dist/src/components/awards/awards.css.js.map +1 -1
- package/dist/src/components/awards/awards.d.ts +13 -13
- package/dist/src/components/awards/awards.js +26 -179
- package/dist/src/components/awards/awards.js.map +1 -1
- package/dist/src/components/awards/scroll-slides.js +1 -131
- package/dist/src/components/awards/scroll-slides.js.map +1 -1
- package/dist/src/components/back/back.css.js +1 -91
- package/dist/src/components/back/back.css.js.map +1 -1
- package/dist/src/components/back/back.d.ts +1 -1
- package/dist/src/components/back/back.js +8 -71
- package/dist/src/components/back/back.js.map +1 -1
- package/dist/src/components/badge/badge.css.js +1 -204
- package/dist/src/components/badge/badge.css.js.map +1 -1
- package/dist/src/components/badge/badge.d.ts +4 -4
- package/dist/src/components/badge/badge.js +2 -117
- package/dist/src/components/badge/badge.js.map +1 -1
- package/dist/src/components/bento-grid/bento-grid.css.js +16 -150
- package/dist/src/components/bento-grid/bento-grid.css.js.map +1 -1
- package/dist/src/components/bento-grid/bento-grid.d.ts +3 -3
- package/dist/src/components/bento-grid/bento-grid.js +10 -189
- package/dist/src/components/bento-grid/bento-grid.js.map +1 -1
- package/dist/src/components/bento-grid/bento-item.css.js +1 -338
- package/dist/src/components/bento-grid/bento-item.css.js.map +1 -1
- package/dist/src/components/bento-grid/bento-item.d.ts +3 -3
- package/dist/src/components/bento-grid/bento-item.js +10 -94
- package/dist/src/components/bento-grid/bento-item.js.map +1 -1
- package/dist/src/components/blockquote/blockquote.css.js +1 -54
- package/dist/src/components/blockquote/blockquote.css.js.map +1 -1
- package/dist/src/components/blockquote/blockquote.d.ts +2 -2
- package/dist/src/components/blockquote/blockquote.js +1 -44
- package/dist/src/components/blockquote/blockquote.js.map +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.css.js +1 -168
- package/dist/src/components/breadcrumb/breadcrumb.css.js.map +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.d.ts +5 -5
- package/dist/src/components/breadcrumb/breadcrumb.js +9 -166
- package/dist/src/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/src/components/button/button.css.js +1 -843
- package/dist/src/components/button/button.css.js.map +1 -1
- package/dist/src/components/button/button.d.ts +5 -5
- package/dist/src/components/button/button.js +18 -420
- package/dist/src/components/button/button.js.map +1 -1
- package/dist/src/components/caption/caption.css.js +1 -29
- package/dist/src/components/caption/caption.css.js.map +1 -1
- package/dist/src/components/caption/caption.d.ts +3 -3
- package/dist/src/components/caption/caption.js +2 -36
- package/dist/src/components/caption/caption.js.map +1 -1
- package/dist/src/components/card-features/card-features.css.js +1 -120
- package/dist/src/components/card-features/card-features.css.js.map +1 -1
- package/dist/src/components/card-features/card-features.d.ts +3 -3
- package/dist/src/components/card-features/card-features.js +12 -145
- package/dist/src/components/card-features/card-features.js.map +1 -1
- package/dist/src/components/cards/card.css.js +1 -369
- package/dist/src/components/cards/card.css.js.map +1 -1
- package/dist/src/components/cards/card.d.ts +3 -3
- package/dist/src/components/cards/card.js +21 -312
- package/dist/src/components/cards/card.js.map +1 -1
- package/dist/src/components/carousel/carousel.css.js +1 -261
- package/dist/src/components/carousel/carousel.css.js.map +1 -1
- package/dist/src/components/carousel/carousel.d.ts +5 -5
- package/dist/src/components/carousel/carousel.js +13 -297
- package/dist/src/components/carousel/carousel.js.map +1 -1
- package/dist/src/components/checkbox/checkbox.css.js +1 -173
- package/dist/src/components/checkbox/checkbox.css.js.map +1 -1
- package/dist/src/components/checkbox/checkbox.d.ts +2 -2
- package/dist/src/components/checkbox/checkbox.js +5 -138
- package/dist/src/components/checkbox/checkbox.js.map +1 -1
- package/dist/src/components/code/code.css.js +1 -73
- package/dist/src/components/code/code.css.js.map +1 -1
- package/dist/src/components/code/code.d.ts +2 -2
- package/dist/src/components/code/code.js +4 -87
- package/dist/src/components/code/code.js.map +1 -1
- package/dist/src/components/compare/compare.css.js +1 -478
- package/dist/src/components/compare/compare.css.js.map +1 -1
- package/dist/src/components/compare/compare.d.ts +5 -5
- package/dist/src/components/compare/compare.js +23 -476
- package/dist/src/components/compare/compare.js.map +1 -1
- package/dist/src/components/comparison-panel/comparison-panel.css.js +1 -141
- package/dist/src/components/comparison-panel/comparison-panel.css.js.map +1 -1
- package/dist/src/components/comparison-panel/comparison-panel.d.ts +2 -2
- package/dist/src/components/comparison-panel/comparison-panel.js +18 -86
- package/dist/src/components/comparison-panel/comparison-panel.js.map +1 -1
- package/dist/src/components/compatibility-table/compatibility-table.css.js +1 -391
- package/dist/src/components/compatibility-table/compatibility-table.css.js.map +1 -1
- package/dist/src/components/compatibility-table/compatibility-table.d.ts +2 -2
- package/dist/src/components/compatibility-table/compatibility-table.js +26 -136
- package/dist/src/components/compatibility-table/compatibility-table.js.map +1 -1
- package/dist/src/components/cta-banner/cta-banner.css.js +1 -97
- package/dist/src/components/cta-banner/cta-banner.css.js.map +1 -1
- package/dist/src/components/cta-banner/cta-banner.d.ts +2 -2
- package/dist/src/components/cta-banner/cta-banner.js +8 -51
- package/dist/src/components/cta-banner/cta-banner.js.map +1 -1
- package/dist/src/components/display/display.css.js +1 -95
- package/dist/src/components/display/display.css.js.map +1 -1
- package/dist/src/components/display/display.d.ts +2 -2
- package/dist/src/components/display/display.js +3 -84
- package/dist/src/components/display/display.js.map +1 -1
- package/dist/src/components/divider/divider-horizontal.d.ts +2 -2
- package/dist/src/components/divider/divider-horizontal.js +4 -63
- package/dist/src/components/divider/divider-horizontal.js.map +1 -1
- package/dist/src/components/divider/divider-vertical.d.ts +2 -2
- package/dist/src/components/divider/divider-vertical.js +6 -61
- package/dist/src/components/divider/divider-vertical.js.map +1 -1
- package/dist/src/components/divider/divider.css.js +1 -20
- package/dist/src/components/divider/divider.css.js.map +1 -1
- package/dist/src/components/dropdown/dropdown.css.js +1 -121
- package/dist/src/components/dropdown/dropdown.css.js.map +1 -1
- package/dist/src/components/dropdown/dropdown.d.ts +5 -5
- package/dist/src/components/dropdown/dropdown.js +17 -283
- package/dist/src/components/dropdown/dropdown.js.map +1 -1
- package/dist/src/components/features/features.css.js +1 -123
- package/dist/src/components/features/features.css.js.map +1 -1
- package/dist/src/components/features/features.d.ts +5 -5
- package/dist/src/components/features/features.js +11 -71
- package/dist/src/components/features/features.js.map +1 -1
- package/dist/src/components/features-tab/features-tab.css.js +1 -100
- package/dist/src/components/features-tab/features-tab.css.js.map +1 -1
- package/dist/src/components/features-tab/features-tab.d.ts +5 -5
- package/dist/src/components/features-tab/features-tab.js +9 -70
- package/dist/src/components/features-tab/features-tab.js.map +1 -1
- package/dist/src/components/fieldset/fieldset.css.js +1 -28
- package/dist/src/components/fieldset/fieldset.css.js.map +1 -1
- package/dist/src/components/fieldset/fieldset.d.ts +2 -2
- package/dist/src/components/fieldset/fieldset.js +3 -31
- package/dist/src/components/fieldset/fieldset.js.map +1 -1
- package/dist/src/components/footer/footer-images.js +5 -27
- package/dist/src/components/footer/footer-images.js.map +1 -1
- package/dist/src/components/footer/footer-links-group.css.js +1 -33
- package/dist/src/components/footer/footer-links-group.css.js.map +1 -1
- package/dist/src/components/footer/footer-links-group.d.ts +3 -3
- package/dist/src/components/footer/footer-links-group.js +3 -32
- package/dist/src/components/footer/footer-links-group.js.map +1 -1
- package/dist/src/components/footer/footer-locale.js +1 -45
- package/dist/src/components/footer/footer-locale.js.map +1 -1
- package/dist/src/components/footer/footer-lp.d.ts +7 -7
- package/dist/src/components/footer/footer-lp.js +8 -121
- package/dist/src/components/footer/footer-lp.js.map +1 -1
- package/dist/src/components/footer/footer-nav-menu.css.js +1 -61
- package/dist/src/components/footer/footer-nav-menu.css.js.map +1 -1
- package/dist/src/components/footer/footer-nav-menu.d.ts +3 -3
- package/dist/src/components/footer/footer-nav-menu.js +3 -47
- package/dist/src/components/footer/footer-nav-menu.js.map +1 -1
- package/dist/src/components/footer/footer.css.js +1 -664
- package/dist/src/components/footer/footer.css.js.map +1 -1
- package/dist/src/components/footer/footer.d.ts +13 -13
- package/dist/src/components/footer/footer.js +20 -305
- package/dist/src/components/footer/footer.js.map +1 -1
- package/dist/src/components/footer/localeMap.js +1 -1
- package/dist/src/components/footer/localeMap.js.map +1 -1
- package/dist/src/components/grid/grid.css.js +1 -78
- package/dist/src/components/grid/grid.css.js.map +1 -1
- package/dist/src/components/grid/grid.d.ts +2 -2
- package/dist/src/components/grid/grid.js +9 -126
- package/dist/src/components/grid/grid.js.map +1 -1
- package/dist/src/components/header/header-code.css.js +1 -369
- package/dist/src/components/header/header-code.css.js.map +1 -1
- package/dist/src/components/header/header-code.d.ts +4 -4
- package/dist/src/components/header/header-code.js +15 -163
- package/dist/src/components/header/header-code.js.map +1 -1
- package/dist/src/components/header/header.css.js +1 -757
- package/dist/src/components/header/header.css.js.map +1 -1
- package/dist/src/components/header/header.d.ts +7 -7
- package/dist/src/components/header/header.js +4 -212
- package/dist/src/components/header/header.js.map +1 -1
- package/dist/src/components/heading/heading.css.js +1 -89
- package/dist/src/components/heading/heading.css.js.map +1 -1
- package/dist/src/components/heading/heading.d.ts +2 -2
- package/dist/src/components/heading/heading.js +1 -108
- package/dist/src/components/heading/heading.js.map +1 -1
- package/dist/src/components/help-text/help-text.css.js +1 -19
- package/dist/src/components/help-text/help-text.css.js.map +1 -1
- package/dist/src/components/help-text/help-text.d.ts +2 -2
- package/dist/src/components/help-text/help-text.js +3 -31
- package/dist/src/components/help-text/help-text.js.map +1 -1
- package/dist/src/components/hero/hero.css.js +1 -362
- package/dist/src/components/hero/hero.css.js.map +1 -1
- package/dist/src/components/hero/hero.d.ts +3 -3
- package/dist/src/components/hero/hero.js +12 -164
- package/dist/src/components/hero/hero.js.map +1 -1
- package/dist/src/components/highlight/highlight.css.js +1 -175
- package/dist/src/components/highlight/highlight.css.js.map +1 -1
- package/dist/src/components/highlight/highlight.d.ts +3 -3
- package/dist/src/components/highlight/highlight.js +4 -115
- package/dist/src/components/highlight/highlight.js.map +1 -1
- package/dist/src/components/icons/analysis-icon.d.ts +1 -1
- package/dist/src/components/icons/analysis-icon.js +2 -20
- package/dist/src/components/icons/analysis-icon.js.map +1 -1
- package/dist/src/components/icons/arrow-down-icon.d.ts +1 -1
- package/dist/src/components/icons/arrow-down-icon.js +2 -20
- package/dist/src/components/icons/arrow-down-icon.js.map +1 -1
- package/dist/src/components/icons/arrow-icon.d.ts +1 -1
- package/dist/src/components/icons/arrow-icon.js +2 -48
- package/dist/src/components/icons/arrow-icon.js.map +1 -1
- package/dist/src/components/icons/arrow-right-icon.d.ts +1 -1
- package/dist/src/components/icons/arrow-right-icon.js +2 -45
- package/dist/src/components/icons/arrow-right-icon.js.map +1 -1
- package/dist/src/components/icons/arrow-up-icon.d.ts +1 -1
- package/dist/src/components/icons/arrow-up-icon.js +2 -33
- package/dist/src/components/icons/arrow-up-icon.js.map +1 -1
- package/dist/src/components/icons/av-comparatives-icon.js +2 -31
- package/dist/src/components/icons/av-comparatives-icon.js.map +1 -1
- package/dist/src/components/icons/bd-ai-icon.js +2 -31
- package/dist/src/components/icons/bd-ai-icon.js.map +1 -1
- package/dist/src/components/icons/best-brands-icon.js +2 -31
- package/dist/src/components/icons/best-brands-icon.js.map +1 -1
- package/dist/src/components/icons/brand-signature-icon.d.ts +1 -1
- package/dist/src/components/icons/brand-signature-icon.js +2 -46
- package/dist/src/components/icons/brand-signature-icon.js.map +1 -1
- package/dist/src/components/icons/check-icon.d.ts +1 -1
- package/dist/src/components/icons/check-icon.js +2 -31
- package/dist/src/components/icons/check-icon.js.map +1 -1
- package/dist/src/components/icons/circle-info-icon.d.ts +1 -1
- package/dist/src/components/icons/circle-info-icon.js +2 -35
- package/dist/src/components/icons/circle-info-icon.js.map +1 -1
- package/dist/src/components/icons/close-icon.d.ts +1 -1
- package/dist/src/components/icons/close-icon.js +2 -20
- package/dist/src/components/icons/close-icon.js.map +1 -1
- package/dist/src/components/icons/enterprise-icon.d.ts +1 -1
- package/dist/src/components/icons/enterprise-icon.js +2 -22
- package/dist/src/components/icons/enterprise-icon.js.map +1 -1
- package/dist/src/components/icons/family-icon.d.ts +1 -1
- package/dist/src/components/icons/family-icon.js +2 -20
- package/dist/src/components/icons/family-icon.js.map +1 -1
- package/dist/src/components/icons/globe-icon.d.ts +1 -1
- package/dist/src/components/icons/globe-icon.js +2 -20
- package/dist/src/components/icons/globe-icon.js.map +1 -1
- package/dist/src/components/icons/guide-icon.d.ts +1 -1
- package/dist/src/components/icons/guide-icon.js +2 -20
- package/dist/src/components/icons/guide-icon.js.map +1 -1
- package/dist/src/components/icons/home-icon.d.ts +1 -1
- package/dist/src/components/icons/home-icon.js +2 -22
- package/dist/src/components/icons/home-icon.js.map +1 -1
- package/dist/src/components/icons/icon-element.js +1 -162
- package/dist/src/components/icons/icon-element.js.map +1 -1
- package/dist/src/components/icons/icons.d.ts +23 -23
- package/dist/src/components/icons/icons.js +1 -42
- package/dist/src/components/icons/individual-icon.d.ts +1 -1
- package/dist/src/components/icons/individual-icon.js +2 -20
- package/dist/src/components/icons/individual-icon.js.map +1 -1
- package/dist/src/components/icons/laurel-icon.d.ts +1 -1
- package/dist/src/components/icons/laurel-icon.js +2 -24
- package/dist/src/components/icons/laurel-icon.js.map +1 -1
- package/dist/src/components/icons/machine-learning-icon.d.ts +1 -1
- package/dist/src/components/icons/machine-learning-icon.js +2 -20
- package/dist/src/components/icons/machine-learning-icon.js.map +1 -1
- package/dist/src/components/icons/marks.d.ts +9 -9
- package/dist/src/components/icons/marks.js +1 -41
- package/dist/src/components/icons/minus-icon.d.ts +1 -1
- package/dist/src/components/icons/minus-icon.js +2 -19
- package/dist/src/components/icons/minus-icon.js.map +1 -1
- package/dist/src/components/icons/missing-icon.d.ts +1 -1
- package/dist/src/components/icons/missing-icon.js +3 -53
- package/dist/src/components/icons/missing-icon.js.map +1 -1
- package/dist/src/components/icons/pause-icon.d.ts +1 -1
- package/dist/src/components/icons/pause-icon.js +2 -22
- package/dist/src/components/icons/pause-icon.js.map +1 -1
- package/dist/src/components/icons/pc-mag-2024-icon.js +2 -31
- package/dist/src/components/icons/pc-mag-2024-icon.js.map +1 -1
- package/dist/src/components/icons/pc-mag-business-icon.js +2 -31
- package/dist/src/components/icons/pc-mag-business-icon.js.map +1 -1
- package/dist/src/components/icons/pc-mag-icon.js +2 -31
- package/dist/src/components/icons/pc-mag-icon.js.map +1 -1
- package/dist/src/components/icons/pc-mag-readers-icon.js +2 -30
- package/dist/src/components/icons/pc-mag-readers-icon.js.map +1 -1
- package/dist/src/components/icons/play-icon.d.ts +1 -1
- package/dist/src/components/icons/play-icon.js +2 -22
- package/dist/src/components/icons/play-icon.js.map +1 -1
- package/dist/src/components/icons/plus-icon.d.ts +1 -1
- package/dist/src/components/icons/plus-icon.js +2 -19
- package/dist/src/components/icons/plus-icon.js.map +1 -1
- package/dist/src/components/icons/quote-icon.d.ts +1 -1
- package/dist/src/components/icons/quote-icon.js +2 -30
- package/dist/src/components/icons/quote-icon.js.map +1 -1
- package/dist/src/components/icons/small-business-icon.d.ts +1 -1
- package/dist/src/components/icons/small-business-icon.js +2 -22
- package/dist/src/components/icons/small-business-icon.js.map +1 -1
- package/dist/src/components/icons/top-product-icon.js +2 -31
- package/dist/src/components/icons/top-product-icon.js.map +1 -1
- package/dist/src/components/image/image.css.js +1 -106
- package/dist/src/components/image/image.css.js.map +1 -1
- package/dist/src/components/image/image.d.ts +2 -2
- package/dist/src/components/image/image.js +10 -115
- package/dist/src/components/image/image.js.map +1 -1
- package/dist/src/components/input/input-clipboard.css.js +1 -93
- package/dist/src/components/input/input-clipboard.css.js.map +1 -1
- package/dist/src/components/input/input-clipboard.d.ts +5 -5
- package/dist/src/components/input/input-clipboard.js +20 -257
- package/dist/src/components/input/input-clipboard.js.map +1 -1
- package/dist/src/components/input/input.css.js +1 -9
- package/dist/src/components/input/input.css.js.map +1 -1
- package/dist/src/components/input/input.d.ts +4 -4
- package/dist/src/components/input/input.js +19 -202
- package/dist/src/components/input/input.js.map +1 -1
- package/dist/src/components/install-options/install-options.css.js +1 -308
- package/dist/src/components/install-options/install-options.css.js.map +1 -1
- package/dist/src/components/install-options/install-options.d.ts +4 -4
- package/dist/src/components/install-options/install-options.js +28 -159
- package/dist/src/components/install-options/install-options.js.map +1 -1
- package/dist/src/components/label/label.css.js +1 -33
- package/dist/src/components/label/label.css.js.map +1 -1
- package/dist/src/components/label/label.d.ts +3 -3
- package/dist/src/components/label/label.js +3 -135
- package/dist/src/components/label/label.js.map +1 -1
- package/dist/src/components/light-carousel/light-carousel.css.js +1 -270
- package/dist/src/components/light-carousel/light-carousel.css.js.map +1 -1
- package/dist/src/components/light-carousel/light-carousel.d.ts +3 -3
- package/dist/src/components/light-carousel/light-carousel.js +16 -181
- package/dist/src/components/light-carousel/light-carousel.js.map +1 -1
- package/dist/src/components/link/link.css.js +1 -288
- package/dist/src/components/link/link.css.js.map +1 -1
- package/dist/src/components/link/link.d.ts +3 -3
- package/dist/src/components/link/link.js +6 -233
- package/dist/src/components/link/link.js.map +1 -1
- package/dist/src/components/list/list-item/list-item.css.js +1 -167
- package/dist/src/components/list/list-item/list-item.css.js.map +1 -1
- package/dist/src/components/list/list-item/list-item.d.ts +3 -3
- package/dist/src/components/list/list-item/list-item.js +3 -122
- package/dist/src/components/list/list-item/list-item.js.map +1 -1
- package/dist/src/components/list/list.css.js +1 -180
- package/dist/src/components/list/list.css.js.map +1 -1
- package/dist/src/components/list/list.d.ts +1 -1
- package/dist/src/components/list/list.js +5 -82
- package/dist/src/components/list/list.js.map +1 -1
- package/dist/src/components/logo-marquee/logo-marquee.css.js +1 -93
- package/dist/src/components/logo-marquee/logo-marquee.css.js.map +1 -1
- package/dist/src/components/logo-marquee/logo-marquee.d.ts +3 -3
- package/dist/src/components/logo-marquee/logo-marquee.js +6 -147
- package/dist/src/components/logo-marquee/logo-marquee.js.map +1 -1
- package/dist/src/components/modal/modal.css.js +1 -203
- package/dist/src/components/modal/modal.css.js.map +1 -1
- package/dist/src/components/modal/modal.d.ts +3 -3
- package/dist/src/components/modal/modal.js +3 -131
- package/dist/src/components/modal/modal.js.map +1 -1
- package/dist/src/components/motion-art/motion-art.d.ts +1 -1
- package/dist/src/components/motion-art/motion-art.js +1 -114
- package/dist/src/components/motion-art/motion-art.js.map +1 -1
- package/dist/src/components/overview/overview.css.js +1 -125
- package/dist/src/components/overview/overview.css.js.map +1 -1
- package/dist/src/components/overview/overview.d.ts +2 -2
- package/dist/src/components/overview/overview.js +9 -50
- package/dist/src/components/overview/overview.js.map +1 -1
- package/dist/src/components/page-switcher/page-switcher.css.js +1 -174
- package/dist/src/components/page-switcher/page-switcher.css.js.map +1 -1
- package/dist/src/components/page-switcher/page-switcher.d.ts +2 -2
- package/dist/src/components/page-switcher/page-switcher.js +6 -62
- package/dist/src/components/page-switcher/page-switcher.js.map +1 -1
- package/dist/src/components/pagination-dots/pagination-dots.css.js +1 -160
- package/dist/src/components/pagination-dots/pagination-dots.css.js.map +1 -1
- package/dist/src/components/pagination-dots/pagination-dots.d.ts +2 -2
- package/dist/src/components/pagination-dots/pagination-dots.js +10 -210
- package/dist/src/components/pagination-dots/pagination-dots.js.map +1 -1
- package/dist/src/components/paragraph/paragraph.css.js +1 -101
- package/dist/src/components/paragraph/paragraph.css.js.map +1 -1
- package/dist/src/components/paragraph/paragraph.d.ts +2 -2
- package/dist/src/components/paragraph/paragraph.js +3 -119
- package/dist/src/components/paragraph/paragraph.js.map +1 -1
- package/dist/src/components/partner-banner/partner-banner.css.js +1 -245
- package/dist/src/components/partner-banner/partner-banner.css.js.map +1 -1
- package/dist/src/components/partner-banner/partner-banner.d.ts +1 -1
- package/dist/src/components/partner-banner/partner-banner.js +6 -81
- package/dist/src/components/partner-banner/partner-banner.js.map +1 -1
- package/dist/src/components/picture/picture.css.js +1 -208
- package/dist/src/components/picture/picture.css.js.map +1 -1
- package/dist/src/components/picture/picture.d.ts +2 -2
- package/dist/src/components/picture/picture.js +14 -186
- package/dist/src/components/picture/picture.js.map +1 -1
- package/dist/src/components/post-card/post-card.css.js +1 -149
- package/dist/src/components/post-card/post-card.css.js.map +1 -1
- package/dist/src/components/post-card/post-card.d.ts +2 -2
- package/dist/src/components/post-card/post-card.js +5 -97
- package/dist/src/components/post-card/post-card.js.map +1 -1
- package/dist/src/components/pricing-cards/adopt-styles.js +1 -18
- package/dist/src/components/pricing-cards/adopt-styles.js.map +1 -1
- package/dist/src/components/pricing-cards/new-pricing-card.d.ts +2 -2
- package/dist/src/components/pricing-cards/new-pricing-card.js +4 -49
- package/dist/src/components/pricing-cards/new-pricing-card.js.map +1 -1
- package/dist/src/components/pricing-cards/new-pricing.css.js +1 -74
- package/dist/src/components/pricing-cards/new-pricing.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-actions.css.js +1 -11
- package/dist/src/components/pricing-cards/pricing-card-actions.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-actions.d.ts +2 -2
- package/dist/src/components/pricing-cards/pricing-card-actions.js +2 -59
- package/dist/src/components/pricing-cards/pricing-card-actions.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-container.css.js +1 -41
- package/dist/src/components/pricing-cards/pricing-card-container.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-container.d.ts +1 -1
- package/dist/src/components/pricing-cards/pricing-card-container.js +2 -40
- package/dist/src/components/pricing-cards/pricing-card-container.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-header.css.js +1 -82
- package/dist/src/components/pricing-cards/pricing-card-header.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-header.d.ts +5 -5
- package/dist/src/components/pricing-cards/pricing-card-header.js +7 -70
- package/dist/src/components/pricing-cards/pricing-card-header.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-pricing.css.js +1 -92
- package/dist/src/components/pricing-cards/pricing-card-pricing.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-pricing.d.ts +6 -6
- package/dist/src/components/pricing-cards/pricing-card-pricing.js +7 -87
- package/dist/src/components/pricing-cards/pricing-card-pricing.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-show-more.css.js +1 -29
- package/dist/src/components/pricing-cards/pricing-card-show-more.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card-show-more.d.ts +4 -4
- package/dist/src/components/pricing-cards/pricing-card-show-more.js +5 -41
- package/dist/src/components/pricing-cards/pricing-card-show-more.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card.css.js +1 -660
- package/dist/src/components/pricing-cards/pricing-card.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-card.d.ts +7 -7
- package/dist/src/components/pricing-cards/pricing-card.js +53 -639
- package/dist/src/components/pricing-cards/pricing-card.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-feature-item.css.js +1 -34
- package/dist/src/components/pricing-cards/pricing-feature-item.css.js.map +1 -1
- package/dist/src/components/pricing-cards/pricing-feature-item.d.ts +2 -2
- package/dist/src/components/pricing-cards/pricing-feature-item.js +2 -22
- package/dist/src/components/pricing-cards/pricing-feature-item.js.map +1 -1
- package/dist/src/components/process-steps/process-steps.css.js +1 -106
- package/dist/src/components/process-steps/process-steps.css.js.map +1 -1
- package/dist/src/components/process-steps/process-steps.d.ts +5 -5
- package/dist/src/components/process-steps/process-steps.js +10 -78
- package/dist/src/components/process-steps/process-steps.js.map +1 -1
- package/dist/src/components/progress/progress.css.js +1 -123
- package/dist/src/components/progress/progress.css.js.map +1 -1
- package/dist/src/components/progress/progress.d.ts +2 -2
- package/dist/src/components/progress/progress.js +6 -72
- package/dist/src/components/progress/progress.js.map +1 -1
- package/dist/src/components/quick-answer/quick-answer.css.js +1 -130
- package/dist/src/components/quick-answer/quick-answer.css.js.map +1 -1
- package/dist/src/components/quick-answer/quick-answer.d.ts +2 -2
- package/dist/src/components/quick-answer/quick-answer.js +9 -49
- package/dist/src/components/quick-answer/quick-answer.js.map +1 -1
- package/dist/src/components/radio/radio-group.css.js +1 -41
- package/dist/src/components/radio/radio-group.css.js.map +1 -1
- package/dist/src/components/radio/radio-group.d.ts +1 -1
- package/dist/src/components/radio/radio-group.js +5 -92
- package/dist/src/components/radio/radio-group.js.map +1 -1
- package/dist/src/components/radio/radio.css.js +1 -193
- package/dist/src/components/radio/radio.css.js.map +1 -1
- package/dist/src/components/radio/radio.d.ts +4 -4
- package/dist/src/components/radio/radio.js +6 -263
- package/dist/src/components/radio/radio.js.map +1 -1
- package/dist/src/components/radio/toggle-radio.d.ts +2 -2
- package/dist/src/components/radio/toggle-radio.js +3 -39
- package/dist/src/components/radio/toggle-radio.js.map +1 -1
- package/dist/src/components/review/review-grid.css.js +1 -46
- package/dist/src/components/review/review-grid.css.js.map +1 -1
- package/dist/src/components/review/review-grid.d.ts +2 -2
- package/dist/src/components/review/review-grid.js +4 -49
- package/dist/src/components/review/review-grid.js.map +1 -1
- package/dist/src/components/review/review.css.js +1 -54
- package/dist/src/components/review/review.css.js.map +1 -1
- package/dist/src/components/review/review.d.ts +2 -2
- package/dist/src/components/review/review.js +2 -59
- package/dist/src/components/review/review.js.map +1 -1
- package/dist/src/components/section/section.css.js +1 -37
- package/dist/src/components/section/section.css.js.map +1 -1
- package/dist/src/components/section/section.d.ts +1 -1
- package/dist/src/components/section/section.js +1 -50
- package/dist/src/components/section/section.js.map +1 -1
- package/dist/src/components/section-header/section-header.css.js +1 -99
- package/dist/src/components/section-header/section-header.css.js.map +1 -1
- package/dist/src/components/section-header/section-header.d.ts +2 -2
- package/dist/src/components/section-header/section-header.js +4 -85
- package/dist/src/components/section-header/section-header.js.map +1 -1
- package/dist/src/components/shared/announcer.d.ts +1 -1
- package/dist/src/components/shared/announcer.js +1 -34
- package/dist/src/components/shared/announcer.js.map +1 -1
- package/dist/src/components/shared/controller.media-query.d.ts +1 -1
- package/dist/src/components/shared/controller.media-query.js +1 -57
- package/dist/src/components/shared/controller.media-query.js.map +1 -1
- package/dist/src/components/shared/define-element.js +1 -16
- package/dist/src/components/shared/define-element.js.map +1 -1
- package/dist/src/components/shared/ensemble.css.js +1 -101
- package/dist/src/components/shared/ensemble.css.js.map +1 -1
- package/dist/src/components/shared/events.js +0 -13
- package/dist/src/components/shared/fill-width.css.js +2 -27
- package/dist/src/components/shared/fill-width.css.js.map +1 -1
- package/dist/src/components/shared/form-control.d.ts +1 -1
- package/dist/src/components/shared/form-control.js +1 -198
- package/dist/src/components/shared/form-control.js.map +1 -1
- package/dist/src/components/shared/form-field.css.js +1 -258
- package/dist/src/components/shared/form-field.css.js.map +1 -1
- package/dist/src/components/shared/prop-vocabulary.js +1 -49
- package/dist/src/components/shared/prop-vocabulary.js.map +1 -1
- package/dist/src/components/shared/token-scales.js +1 -351
- package/dist/src/components/shared/token-scales.js.map +1 -1
- package/dist/src/components/skeleton/skeleton.css.js +1 -32
- package/dist/src/components/skeleton/skeleton.css.js.map +1 -1
- package/dist/src/components/skeleton/skeleton.d.ts +2 -2
- package/dist/src/components/skeleton/skeleton.js +4 -36
- package/dist/src/components/skeleton/skeleton.js.map +1 -1
- package/dist/src/components/spinner/spinner.css.js +1 -87
- package/dist/src/components/spinner/spinner.css.js.map +1 -1
- package/dist/src/components/spinner/spinner.d.ts +3 -3
- package/dist/src/components/spinner/spinner.js +3 -69
- package/dist/src/components/spinner/spinner.js.map +1 -1
- package/dist/src/components/spotlight-section/spotlight-section.css.js +1 -105
- package/dist/src/components/spotlight-section/spotlight-section.css.js.map +1 -1
- package/dist/src/components/spotlight-section/spotlight-section.d.ts +2 -2
- package/dist/src/components/spotlight-section/spotlight-section.js +11 -72
- package/dist/src/components/spotlight-section/spotlight-section.js.map +1 -1
- package/dist/src/components/stat/stat-highlight.js +6 -82
- package/dist/src/components/stat/stat-highlight.js.map +1 -1
- package/dist/src/components/stat/stat-tile.js +5 -52
- package/dist/src/components/stat/stat-tile.js.map +1 -1
- package/dist/src/components/stat/stat.css.js +1 -145
- package/dist/src/components/stat/stat.css.js.map +1 -1
- package/dist/src/components/stat/stat.d.ts +2 -2
- package/dist/src/components/stat/stat.js +1 -3
- package/dist/src/components/switch/switch.css.js +1 -175
- package/dist/src/components/switch/switch.css.js.map +1 -1
- package/dist/src/components/switch/switch.d.ts +4 -4
- package/dist/src/components/switch/switch.js +4 -99
- package/dist/src/components/switch/switch.js.map +1 -1
- package/dist/src/components/tab-list/tab-list.css.js +1 -289
- package/dist/src/components/tab-list/tab-list.css.js.map +1 -1
- package/dist/src/components/tab-list/tab-list.d.ts +1 -1
- package/dist/src/components/tab-list/tab-list.js +13 -191
- package/dist/src/components/tab-list/tab-list.js.map +1 -1
- package/dist/src/components/tabs/tabs.css.js +1 -77
- package/dist/src/components/tabs/tabs.css.js.map +1 -1
- package/dist/src/components/tabs/tabs.d.ts +6 -6
- package/dist/src/components/tabs/tabs.js +8 -220
- package/dist/src/components/tabs/tabs.js.map +1 -1
- package/dist/src/components/tag/tag.css.js +1 -52
- package/dist/src/components/tag/tag.css.js.map +1 -1
- package/dist/src/components/tag/tag.d.ts +2 -2
- package/dist/src/components/tag/tag.js +2 -37
- package/dist/src/components/tag/tag.js.map +1 -1
- package/dist/src/components/terminal/terminal-cursor.js +1 -65
- package/dist/src/components/terminal/terminal-cursor.js.map +1 -1
- package/dist/src/components/terminal/terminal-message.css.js +1 -409
- package/dist/src/components/terminal/terminal-message.css.js.map +1 -1
- package/dist/src/components/terminal/terminal-message.d.ts +5 -5
- package/dist/src/components/terminal/terminal-message.js +28 -183
- package/dist/src/components/terminal/terminal-message.js.map +1 -1
- package/dist/src/components/termsOfUse/terms.css.js +1 -55
- package/dist/src/components/termsOfUse/terms.css.js.map +1 -1
- package/dist/src/components/termsOfUse/terms.d.ts +5 -5
- package/dist/src/components/termsOfUse/terms.js +9 -82
- package/dist/src/components/termsOfUse/terms.js.map +1 -1
- package/dist/src/components/textarea/textarea.css.js +1 -49
- package/dist/src/components/textarea/textarea.css.js.map +1 -1
- package/dist/src/components/textarea/textarea.d.ts +5 -5
- package/dist/src/components/textarea/textarea.js +15 -160
- package/dist/src/components/textarea/textarea.js.map +1 -1
- package/dist/src/components/tooltip/tooltip.css.js +1 -96
- package/dist/src/components/tooltip/tooltip.css.js.map +1 -1
- package/dist/src/components/tooltip/tooltip.d.ts +2 -2
- package/dist/src/components/tooltip/tooltip.js +5 -285
- package/dist/src/components/tooltip/tooltip.js.map +1 -1
- package/dist/src/components/trust-panel/trust-panel.css.js +1 -228
- package/dist/src/components/trust-panel/trust-panel.css.js.map +1 -1
- package/dist/src/components/trust-panel/trust-panel.d.ts +4 -4
- package/dist/src/components/trust-panel/trust-panel.js +25 -104
- package/dist/src/components/trust-panel/trust-panel.js.map +1 -1
- package/dist/src/components/video/video.css.js +1 -20
- package/dist/src/components/video/video.css.js.map +1 -1
- package/dist/src/components/video/video.d.ts +2 -2
- package/dist/src/components/video/video.js +5 -88
- package/dist/src/components/video/video.js.map +1 -1
- package/dist/src/components/video-player/video-player.css.js +1 -167
- package/dist/src/components/video-player/video-player.css.js.map +1 -1
- package/dist/src/components/video-player/video-player.d.ts +2 -2
- package/dist/src/components/video-player/video-player.js +15 -150
- package/dist/src/components/video-player/video-player.js.map +1 -1
- package/dist/src/components/visually-hidden/visually-hidden.css.js +1 -22
- package/dist/src/components/visually-hidden/visually-hidden.css.js.map +1 -1
- package/dist/src/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/src/components/visually-hidden/visually-hidden.js +2 -22
- package/dist/src/components/visually-hidden/visually-hidden.js.map +1 -1
- package/dist/src/tokens/brand-layer.js +8 -162
- package/dist/src/tokens/brand-layer.js.map +1 -1
- package/dist/src/tokens/dark-derivation.js +1 -325
- package/dist/src/tokens/dark-derivation.js.map +1 -1
- package/dist/src/tokens/dark-findings.d.ts +1 -1
- package/dist/src/tokens/dark-findings.js +1 -204
- package/dist/src/tokens/dark-findings.js.map +1 -1
- package/dist/src/tokens/fonts.css +1 -166
- package/dist/src/tokens/layout.css +1 -61
- package/dist/src/tokens/story-chrome.js +27 -221
- package/dist/src/tokens/story-chrome.js.map +1 -1
- package/dist/src/tokens/themes/bitdefender.js +1 -30
- package/dist/src/tokens/themes/bitdefender.js.map +1 -1
- package/dist/src/tokens/themes/contract.js +1 -7
- package/dist/src/tokens/themes/contract.js.map +1 -1
- package/dist/src/tokens/themes/index.js +1 -39
- package/dist/src/tokens/themes/index.js.map +1 -1
- package/dist/src/tokens/token-map.js +1 -236
- package/dist/src/tokens/token-map.js.map +1 -1
- package/dist/src/tokens/token-purposes.js +1 -259
- package/dist/src/tokens/token-purposes.js.map +1 -1
- package/dist/src/tokens/tokens.css +1 -1809
- package/dist/src/tokens/tokens.js +1 -1865
- package/dist/src/tokens/tokens.js.map +1 -1
- package/dist/src/tokens/type-ceiling-words.js +1 -293
- package/dist/src/tokens/type-ceiling-words.js.map +1 -1
- package/package.json +16 -5
- package/schemas/component-manifest.json +1 -1
- package/dist/src/components/icons/icons.js.map +0 -1
- package/dist/src/components/icons/marks.js.map +0 -1
- package/dist/src/components/shared/events.js.map +0 -1
- package/dist/src/components/stat/stat.js.map +0 -1
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const REDUCED_MOTION = '(prefers-reduced-motion: reduce)';
|
|
3
|
-
/**
|
|
4
|
-
* A media query a component follows for as long as it is connected.
|
|
5
|
-
*
|
|
6
|
-
* Five components kept a query live -- the reduced-motion preference, or a
|
|
7
|
-
* width -- and each spelled the same four steps: make the list, read it,
|
|
8
|
-
* listen for changes, stop listening on disconnect. This is those steps once.
|
|
9
|
-
* What a change means stays the component's own: it hands over a callback,
|
|
10
|
-
* called with the current answer on connect and again whenever it changes,
|
|
11
|
-
* and keeps the state it already had.
|
|
12
|
-
*
|
|
13
|
-
* A one-off read -- whether to scroll smoothly at the moment of a click --
|
|
14
|
-
* needs none of this; `window.matchMedia(q).matches` at that moment is right.
|
|
15
|
-
*
|
|
16
|
-
* new MediaQueryController(this, REDUCED_MOTION, reduced => { this._reduced = reduced; });
|
|
17
|
-
*/
|
|
18
|
-
export class MediaQueryController {
|
|
19
|
-
constructor(host, query, onChange) {
|
|
20
|
-
this._connected = false;
|
|
21
|
-
this._listener = (e) => this._onChange(e.matches);
|
|
22
|
-
this._query = query;
|
|
23
|
-
this._onChange = onChange;
|
|
24
|
-
host.addController(this);
|
|
25
|
-
}
|
|
26
|
-
/** The query followed. Setting another starts following it, and reports its answer. */
|
|
27
|
-
get query() {
|
|
28
|
-
return this._query;
|
|
29
|
-
}
|
|
30
|
-
set query(query) {
|
|
31
|
-
if (query === this._query)
|
|
32
|
-
return;
|
|
33
|
-
this._detach();
|
|
34
|
-
this._query = query;
|
|
35
|
-
if (this._connected)
|
|
36
|
-
this._attach();
|
|
37
|
-
}
|
|
38
|
-
hostConnected() {
|
|
39
|
-
this._connected = true;
|
|
40
|
-
this._attach();
|
|
41
|
-
}
|
|
42
|
-
hostDisconnected() {
|
|
43
|
-
this._connected = false;
|
|
44
|
-
this._detach();
|
|
45
|
-
}
|
|
46
|
-
_attach() {
|
|
47
|
-
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
48
|
-
return;
|
|
49
|
-
this._list = window.matchMedia(this._query);
|
|
50
|
-
this._list.addEventListener('change', this._listener);
|
|
51
|
-
this._onChange(this._list.matches);
|
|
52
|
-
}
|
|
53
|
-
_detach() {
|
|
54
|
-
this._list?.removeEventListener('change', this._listener);
|
|
55
|
-
this._list = undefined;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
var e=`(prefers-reduced-motion: reduce)`,t=class{constructor(e,t,n){this._connected=!1,this._listener=e=>this._onChange(e.matches),this._query=t,this._onChange=n,e.addController(this)}get query(){return this._query}set query(e){e!==this._query&&(this._detach(),this._query=e,this._connected&&this._attach())}hostConnected(){this._connected=!0,this._attach()}hostDisconnected(){this._connected=!1,this._detach()}_attach(){typeof window<`u`&&typeof window.matchMedia==`function`&&(this._list=window.matchMedia(this._query),this._list.addEventListener(`change`,this._listener),this._onChange(this._list.matches))}_detach(){this._list?.removeEventListener(`change`,this._listener),this._list=void 0}};export{t as MediaQueryController,e as REDUCED_MOTION};
|
|
58
2
|
//# sourceMappingURL=controller.media-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.media-query.js","
|
|
1
|
+
{"version":3,"file":"controller.media-query.js","names":["REDUCED_MOTION","MediaQueryController","query","onChange","host"],"sources":["../../../../src/components/shared/controller.media-query.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/** The query a component asks before it moves on its own. */\nexport const REDUCED_MOTION = '(prefers-reduced-motion: reduce)';\n\n/**\n * A media query a component follows for as long as it is connected.\n *\n * Five components kept a query live -- the reduced-motion preference, or a\n * width -- and each spelled the same four steps: make the list, read it,\n * listen for changes, stop listening on disconnect. This is those steps once.\n * What a change means stays the component's own: it hands over a callback,\n * called with the current answer on connect and again whenever it changes,\n * and keeps the state it already had.\n *\n * A one-off read -- whether to scroll smoothly at the moment of a click --\n * needs none of this; `window.matchMedia(q).matches` at that moment is right.\n *\n * new MediaQueryController(this, REDUCED_MOTION, reduced => { this._reduced = reduced; });\n */\nexport class MediaQueryController implements ReactiveController {\n private _query : string;\n private _list? : MediaQueryList;\n private _connected = false;\n private readonly _onChange: (matches: boolean) => void;\n private readonly _listener = (e: MediaQueryListEvent) => this._onChange(e.matches);\n\n constructor(host: ReactiveControllerHost, query: string, onChange: (matches: boolean) => void) {\n this._query = query;\n this._onChange = onChange;\n host.addController(this);\n }\n\n /** The query followed. Setting another starts following it, and reports its answer. */\n get query() {\n return this._query;\n }\n\n set query(query: string) {\n if (query === this._query) return;\n this._detach();\n this._query = query;\n if (this._connected) this._attach();\n }\n\n hostConnected() {\n this._connected = true;\n this._attach();\n }\n\n hostDisconnected() {\n this._connected = false;\n this._detach();\n }\n\n private _attach() {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;\n this._list = window.matchMedia(this._query);\n this._list.addEventListener('change', this._listener);\n this._onChange(this._list.matches);\n }\n\n private _detach() {\n this._list?.removeEventListener('change', this._listener);\n this._list = undefined;\n }\n}\n"],"mappings":"AAGA,IAAaA,EAAiB,mCAiBjBC,EAAb,KAAgE,CAO9D,YAAY,EAA8B,EAAe,EAAsC,CAJ1E,KAAA,WAAA,GAES,KAAA,UAAA,GAA2B,KAAK,UAAU,EAAE,OAAO,EAG/E,KAAK,OAASC,EACd,KAAK,UAAYC,EACjBC,EAAK,cAAc,IAAI,CACzB,CAGA,IAAI,OAAQ,CACV,OAAO,KAAK,MACd,CAEA,IAAI,MAAM,EAAe,CACnBF,IAAU,KAAK,SACnB,KAAK,QAAQ,EACb,KAAK,OAASA,EACV,KAAK,YAAY,KAAK,QAAQ,EACpC,CAEA,eAAgB,CACd,KAAK,WAAa,GAClB,KAAK,QAAQ,CACf,CAEA,kBAAmB,CACjB,KAAK,WAAa,GAClB,KAAK,QAAQ,CACf,CAEA,SAAkB,CACZ,OAAO,OAAW,KAAe,OAAO,OAAO,YAAe,aAClE,KAAK,MAAQ,OAAO,WAAW,KAAK,MAAM,EAC1C,KAAK,MAAM,iBAAiB,SAAU,KAAK,SAAS,EACpD,KAAK,UAAU,KAAK,MAAM,OAAO,EACnC,CAEA,SAAkB,CAChB,KAAK,OAAO,oBAAoB,SAAU,KAAK,SAAS,EACxD,KAAK,MAAQ,IAAA,EACf,CACF,E"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Registers a bd-* element once per page.
|
|
3
|
-
*
|
|
4
|
-
* Several projects load their own bundled copy of this package onto one page,
|
|
5
|
-
* and a tag can be defined only once: a second `customElements.define` throws,
|
|
6
|
-
* and the throw aborts the rest of that bundle's module. So a copy that finds
|
|
7
|
-
* the tag already defined leaves it to the copy that got there first -- the
|
|
8
|
-
* same rule every other piece of page-wide state in dex-core follows.
|
|
9
|
-
*
|
|
10
|
-
* @defineElement('bd-badge')
|
|
11
|
-
* export class BdBadge extends LitElement { ... }
|
|
12
|
-
*/
|
|
13
|
-
export const defineElement = (tag) => (element) => {
|
|
14
|
-
if (!customElements.get(tag))
|
|
15
|
-
customElements.define(tag, element);
|
|
16
|
-
};
|
|
1
|
+
var e=e=>t=>{customElements.get(e)||customElements.define(e,t)};export{e as defineElement};
|
|
17
2
|
//# sourceMappingURL=define-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-element.js","
|
|
1
|
+
{"version":3,"file":"define-element.js","names":["defineElement","tag","element"],"sources":["../../../../src/components/shared/define-element.ts"],"sourcesContent":["/**\n * Registers a bd-* element once per page.\n *\n * Several projects load their own bundled copy of this package onto one page,\n * and a tag can be defined only once: a second `customElements.define` throws,\n * and the throw aborts the rest of that bundle's module. So a copy that finds\n * the tag already defined leaves it to the copy that got there first -- the\n * same rule every other piece of page-wide state in dex-core follows.\n *\n * @defineElement('bd-badge')\n * export class BdBadge extends LitElement { ... }\n */\nexport const defineElement = (tag: string) =>\n (element: CustomElementConstructor): void => {\n if (!customElements.get(tag)) customElements.define(tag, element);\n };\n"],"mappings":"AAYA,IAAaA,EAAiB,GAC3B,GAA4C,CACtC,eAAe,IAAIC,CAAG,GAAG,eAAe,OAAOA,EAAKC,CAAO,CAClE,E"}
|
|
@@ -1,102 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { above } from "./token-scales.js";
|
|
3
|
-
/**
|
|
4
|
-
* The page column: the one wrapper every page-level section composes, so that
|
|
5
|
-
* a page assembled from independent modules has its content on one pair of
|
|
6
|
-
* edges without any module knowing about the others.
|
|
7
|
-
*
|
|
8
|
-
* It exists because there was no such thing. Foundations/Grid System documents
|
|
9
|
-
* a container -- "each container caps content at its breakpoint's max width and
|
|
10
|
-
* applies the matching horizontal padding" -- and nothing in the package
|
|
11
|
-
* implemented it: bd-grid lays out columns, layout.css's .bd-container is a
|
|
12
|
-
* light-DOM class no shadow root can reach. So fourteen modules each wrote a
|
|
13
|
-
* wrapper of their own, and a composed page measured ten different left edges
|
|
14
|
-
* (16, 86, 88, 99, 113, 137, 240, 307, 310, 409px at 1440). Seven of them had
|
|
15
|
-
* copied 1290px from one another since 2026-04-30 with no reason recorded
|
|
16
|
-
* anywhere; two carried 1400; the hero used a 240px gutter that made it the one
|
|
17
|
-
* section whose width depended on the viewport.
|
|
18
|
-
*
|
|
19
|
-
* This is that container, implemented once, on the scale the docs promised:
|
|
20
|
-
* --grid-container-max-* with --grid-padding-* per breakpoint. The top two
|
|
21
|
-
* steps, xxl and xxxl, are not the grid's own progression: they put the
|
|
22
|
-
* column's content edges on the site menu's and footer's -- 1200 wide up to
|
|
23
|
-
* 1599, 1292 from 1600 (see --grid-container-max-* in tokens.ts). A module
|
|
24
|
-
* imports it first and puts the class on the element that holds its content:
|
|
25
|
-
*
|
|
26
|
-
* static styles = [ensembleCSS, ownCSS];
|
|
27
|
-
* <div class="bd-ensemble bd-thing-wrapper">...</div>
|
|
28
|
-
*
|
|
29
|
-
* A band that must run full-bleed keeps its background on :host and puts the
|
|
30
|
-
* column inside. A heading or prose block that is deliberately narrower than
|
|
31
|
-
* the page keeps its own measure; that is a measure, not a column.
|
|
32
|
-
*
|
|
33
|
-
* Sections nest -- bd-features inside bd-tabs, an accordion inside a feature
|
|
34
|
-
* column, bd-features-tab inside a tab panel -- and a column inside a column
|
|
35
|
-
* must not pad or cap again. So the width and gutter are read through two
|
|
36
|
-
* component-local properties with the grid step as fallback, and the column
|
|
37
|
-
* neutralises both on its children. Custom properties inherit through slots
|
|
38
|
-
* and into shadow trees, so a nested column finds `none` and `0` waiting for it
|
|
39
|
-
* and collapses to its parent's edges. No module has to know whether it is the
|
|
40
|
-
* outer one. The neutralisers go on the children rather than the column
|
|
41
|
-
* itself, because a custom property set on an element is what that element's
|
|
42
|
-
* own declarations read.
|
|
43
|
-
*
|
|
44
|
-
* check:ensemble holds this: a unit the registry marks `column: true` must
|
|
45
|
-
* compose this file and write the class, and no section-layer stylesheet may
|
|
46
|
-
* spell a column of its own again.
|
|
47
|
-
*/
|
|
48
|
-
export const ensembleCSS = css `
|
|
49
|
-
.bd-ensemble {
|
|
50
|
-
box-sizing: border-box;
|
|
51
|
-
width: 100%;
|
|
52
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xs));
|
|
53
|
-
margin-inline: auto;
|
|
54
|
-
padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-xs));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* a column inside this column is not a column */
|
|
58
|
-
.bd-ensemble > * {
|
|
59
|
-
--bd-ensemble-max-width: none;
|
|
60
|
-
--bd-ensemble-inline-padding: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@media ${unsafeCSS(above('sm'))} {
|
|
64
|
-
.bd-ensemble {
|
|
65
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-sm));
|
|
66
|
-
padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-sm));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@media ${unsafeCSS(above('md'))} {
|
|
71
|
-
.bd-ensemble {
|
|
72
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-md));
|
|
73
|
-
padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-md));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
@media ${unsafeCSS(above('lg'))} {
|
|
78
|
-
.bd-ensemble {
|
|
79
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-lg));
|
|
80
|
-
padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-lg));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@media ${unsafeCSS(above('xl'))} {
|
|
85
|
-
.bd-ensemble {
|
|
86
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xl));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@media ${unsafeCSS(above('xxl'))} {
|
|
91
|
-
.bd-ensemble {
|
|
92
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xxl));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@media ${unsafeCSS(above('xxxl'))} {
|
|
97
|
-
.bd-ensemble {
|
|
98
|
-
max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xxxl));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
1
|
+
import"./token-scales.js";import{css as e}from"lit";var t=e`.bd-ensemble{box-sizing:border-box;width:100%;max-width:var(--bd-ensemble-max-width,var(--grid-container-max-xs));padding-inline:var(--bd-ensemble-inline-padding,var(--grid-padding-xs));margin-inline:auto}.bd-ensemble>*{--bd-ensemble-max-width:none;--bd-ensemble-inline-padding:0}@media (width>=576px){.bd-ensemble{max-width:var(--bd-ensemble-max-width,var(--grid-container-max-sm));padding-inline:var(--bd-ensemble-inline-padding,var(--grid-padding-sm))}}@media (width>=768px){.bd-ensemble{max-width:var(--bd-ensemble-max-width,var(--grid-container-max-md));padding-inline:var(--bd-ensemble-inline-padding,var(--grid-padding-md))}}@media (width>=992px){.bd-ensemble{max-width:var(--bd-ensemble-max-width,var(--grid-container-max-lg));padding-inline:var(--bd-ensemble-inline-padding,var(--grid-padding-lg))}}@media (width>=1200px){.bd-ensemble{max-width:var(--bd-ensemble-max-width,var(--grid-container-max-xl))}}@media (width>=1400px){.bd-ensemble{max-width:var(--bd-ensemble-max-width,var(--grid-container-max-xxl))}}@media (width>=1600px){.bd-ensemble{max-width:var(--bd-ensemble-max-width,var(--grid-container-max-xxxl))}}`;export{t as ensembleCSS};
|
|
102
2
|
//# sourceMappingURL=ensemble.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensemble.css.js","
|
|
1
|
+
{"version":3,"file":"ensemble.css.js","names":["ensembleCSS"],"sources":["../../../../src/components/shared/ensemble.css.ts"],"sourcesContent":["import { css, unsafeCSS } from \"lit\";\nimport { above } from \"./token-scales.ts\";\n\n/**\n * The page column: the one wrapper every page-level section composes, so that\n * a page assembled from independent modules has its content on one pair of\n * edges without any module knowing about the others.\n *\n * It exists because there was no such thing. Foundations/Grid System documents\n * a container -- \"each container caps content at its breakpoint's max width and\n * applies the matching horizontal padding\" -- and nothing in the package\n * implemented it: bd-grid lays out columns, layout.css's .bd-container is a\n * light-DOM class no shadow root can reach. So fourteen modules each wrote a\n * wrapper of their own, and a composed page measured ten different left edges\n * (16, 86, 88, 99, 113, 137, 240, 307, 310, 409px at 1440). Seven of them had\n * copied 1290px from one another since 2026-04-30 with no reason recorded\n * anywhere; two carried 1400; the hero used a 240px gutter that made it the one\n * section whose width depended on the viewport.\n *\n * This is that container, implemented once, on the scale the docs promised:\n * --grid-container-max-* with --grid-padding-* per breakpoint. The top two\n * steps, xxl and xxxl, are not the grid's own progression: they put the\n * column's content edges on the site menu's and footer's -- 1200 wide up to\n * 1599, 1292 from 1600 (see --grid-container-max-* in tokens.ts). A module\n * imports it first and puts the class on the element that holds its content:\n *\n * static styles = [ensembleCSS, ownCSS];\n * <div class=\"bd-ensemble bd-thing-wrapper\">...</div>\n *\n * A band that must run full-bleed keeps its background on :host and puts the\n * column inside. A heading or prose block that is deliberately narrower than\n * the page keeps its own measure; that is a measure, not a column.\n *\n * Sections nest -- bd-features inside bd-tabs, an accordion inside a feature\n * column, bd-features-tab inside a tab panel -- and a column inside a column\n * must not pad or cap again. So the width and gutter are read through two\n * component-local properties with the grid step as fallback, and the column\n * neutralises both on its children. Custom properties inherit through slots\n * and into shadow trees, so a nested column finds `none` and `0` waiting for it\n * and collapses to its parent's edges. No module has to know whether it is the\n * outer one. The neutralisers go on the children rather than the column\n * itself, because a custom property set on an element is what that element's\n * own declarations read.\n *\n * check:ensemble holds this: a unit the registry marks `column: true` must\n * compose this file and write the class, and no section-layer stylesheet may\n * spell a column of its own again.\n */\nexport const ensembleCSS = css`\n .bd-ensemble {\n box-sizing: border-box;\n width: 100%;\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xs));\n margin-inline: auto;\n padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-xs));\n }\n\n /* a column inside this column is not a column */\n .bd-ensemble > * {\n --bd-ensemble-max-width: none;\n --bd-ensemble-inline-padding: 0;\n }\n\n @media ${unsafeCSS(above('sm'))} {\n .bd-ensemble {\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-sm));\n padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-sm));\n }\n }\n\n @media ${unsafeCSS(above('md'))} {\n .bd-ensemble {\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-md));\n padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-md));\n }\n }\n\n @media ${unsafeCSS(above('lg'))} {\n .bd-ensemble {\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-lg));\n padding-inline: var(--bd-ensemble-inline-padding, var(--grid-padding-lg));\n }\n }\n\n @media ${unsafeCSS(above('xl'))} {\n .bd-ensemble {\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xl));\n }\n }\n\n @media ${unsafeCSS(above('xxl'))} {\n .bd-ensemble {\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xxl));\n }\n }\n\n @media ${unsafeCSS(above('xxxl'))} {\n .bd-ensemble {\n max-width: var(--bd-ensemble-max-width, var(--grid-container-max-xxxl));\n }\n }\n`;\n"],"mappings":"A,oDAgDA,IAAaA,EAAc,CAAG,ymC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The two events several elements send, each with a detail of its own.
|
|
3
|
-
*
|
|
4
|
-
* Every other bd-* event is declared beside the one element that dispatches
|
|
5
|
-
* it. `bd-change` and `bd-input` are the package's generic "the value
|
|
6
|
-
* changed" pair, and what the value is depends on who sends it, so the event
|
|
7
|
-
* map can only carry the union. A listener that knows its element narrows
|
|
8
|
-
* from there; one that does not has to look before it reads.
|
|
9
|
-
*
|
|
10
|
-
* A sender imports this module for its side effect, which is what puts these
|
|
11
|
-
* declarations in front of a consumer who imports that element.
|
|
12
|
-
*/
|
|
13
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
* The width a size container's host takes: all of its column, less its own
|
|
4
|
-
* margins.
|
|
5
|
-
*
|
|
6
|
-
* An element with `container-type: inline-size` contributes nothing to its
|
|
7
|
-
* own intrinsic width, so where its parent sizes it to its content -- a flex
|
|
8
|
-
* row, a grid placing items at start -- it measures 0. These hosts used to
|
|
9
|
-
* answer that with `width: 100%`, which fills the containing block and
|
|
10
|
-
* ignores the host's margins: a page writing `margin-inline: 24px` on one got
|
|
11
|
-
* a box 48px wider than its column, scrolling the page sideways on a phone.
|
|
12
|
-
*
|
|
13
|
-
* `stretch` is the width a block takes by default -- the containing block
|
|
14
|
-
* less the margins -- asked for explicitly, so it holds in a flex row or a
|
|
15
|
-
* grid cell too. It is newer than the Widely available target, so it is
|
|
16
|
-
* behind @supports with 100% before it, and its prefixed spellings come
|
|
17
|
-
* first, Gecko's and then WebKit's, so the standard one wins where more than
|
|
18
|
-
* one is read (CLAUDE.md, Browser support).
|
|
19
|
-
*
|
|
20
|
-
* :host { display: block; container-type: inline-size; }
|
|
21
|
-
* ${hostFillsWidth()}
|
|
22
|
-
*/
|
|
23
|
-
const KEYWORDS = ["-moz-available", "-webkit-fill-available", "stretch"];
|
|
24
|
-
export const hostFillsWidth = () => unsafeCSS([
|
|
25
|
-
":host { width: 100%; }",
|
|
26
|
-
...KEYWORDS.map(keyword => `@supports (width: ${keyword}) { :host { width: ${keyword}; } }`)
|
|
27
|
-
].join("\n"));
|
|
1
|
+
import{unsafeCSS as e}from"lit";var t=[`-moz-available`,`-webkit-fill-available`,`stretch`],n=()=>e([`:host { width: 100%; }`,...t.map(e=>`@supports (width: ${e}) { :host { width: ${e}; } }`)].join(`
|
|
2
|
+
`));export{n as hostFillsWidth};
|
|
28
3
|
//# sourceMappingURL=fill-width.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-width.css.js","
|
|
1
|
+
{"version":3,"file":"fill-width.css.js","names":["KEYWORDS","hostFillsWidth","unsafeCSS","keyword"],"sources":["../../../../src/components/shared/fill-width.css.ts"],"sourcesContent":["import { unsafeCSS } from \"lit\";\n\n/**\n * The width a size container's host takes: all of its column, less its own\n * margins.\n *\n * An element with `container-type: inline-size` contributes nothing to its\n * own intrinsic width, so where its parent sizes it to its content -- a flex\n * row, a grid placing items at start -- it measures 0. These hosts used to\n * answer that with `width: 100%`, which fills the containing block and\n * ignores the host's margins: a page writing `margin-inline: 24px` on one got\n * a box 48px wider than its column, scrolling the page sideways on a phone.\n *\n * `stretch` is the width a block takes by default -- the containing block\n * less the margins -- asked for explicitly, so it holds in a flex row or a\n * grid cell too. It is newer than the Widely available target, so it is\n * behind @supports with 100% before it, and its prefixed spellings come\n * first, Gecko's and then WebKit's, so the standard one wins where more than\n * one is read (CLAUDE.md, Browser support).\n *\n * :host { display: block; container-type: inline-size; }\n * ${hostFillsWidth()}\n */\nconst KEYWORDS = [\"-moz-available\", \"-webkit-fill-available\", \"stretch\"];\n\nexport const hostFillsWidth = () => unsafeCSS([\n \":host { width: 100%; }\",\n ...KEYWORDS.map(keyword => `@supports (width: ${keyword}) { :host { width: ${keyword}; } }`)\n].join(\"\\n\"));\n"],"mappings":"A,gCAuBA,IAAMA,EAAW,CAAC,iBAAkB,yBAA0B,SAAS,EAE1DC,MAAuBC,EAAU,CAC5C,yBACA,GAAGF,EAAS,IAAI,GAAW,qBAAqBG,EAAQ,qBAAqBA,EAAQ,MAAM,CAC7F,CAAC,CAAC,KAAK;CAAI,CAAC,E"}
|
|
@@ -1,199 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { state } from 'lit/decorators.js';
|
|
8
|
-
/**
|
|
9
|
-
* What makes a bd-* control take part in a <form>.
|
|
10
|
-
*
|
|
11
|
-
* Every control in this package renders its native element inside a shadow
|
|
12
|
-
* root, and a native control there has no form owner: the <form> around the
|
|
13
|
-
* element could not see it. A form submitted none of them, reset none of them
|
|
14
|
-
* and let a required one through empty. Form-associated custom elements are
|
|
15
|
-
* the platform's answer -- Baseline Widely available since 2023 -- so the
|
|
16
|
-
* host joins the form itself through ElementInternals, the way the guide in
|
|
17
|
-
* .claude/skills/modern-web-guidance/guides/html/form-associated-custom-elements.md
|
|
18
|
-
* lays out, with no hidden input.
|
|
19
|
-
*
|
|
20
|
-
* This is the part every control shares: the opt-in, the internals, the
|
|
21
|
-
* read-only surface a native control has (form, validity, checkValidity...),
|
|
22
|
-
* and the two states a control cannot see from inside its shadow root -- a
|
|
23
|
-
* <fieldset disabled> around it, and a submit that failed. What a control
|
|
24
|
-
* submits, when it is valid and what reset puts back are its own.
|
|
25
|
-
*
|
|
26
|
-
* class BdThing extends FormControl(LitElement) { ... }
|
|
27
|
-
*/
|
|
28
|
-
/* For `name`, which reflects: FACE submits under the host's name ATTRIBUTE, so
|
|
29
|
-
a name set as a property -- what every framework binding does -- has to
|
|
30
|
-
reach it. An empty name submits nothing either way, so it is left off the
|
|
31
|
-
element rather than written as name="" on every control on the page. */
|
|
32
|
-
export const omitEmpty = { toAttribute: value => value || null };
|
|
33
|
-
/* The input types that block implicit submission (HTML, "implicit
|
|
34
|
-
submission"): a form with no submit button submits on Enter only while it
|
|
35
|
-
has at most one field of these. A text field here says which type it is
|
|
36
|
-
through its own `type`, so it is counted the same way. */
|
|
37
|
-
const BLOCKS_IMPLICIT_SUBMISSION = new Set([
|
|
38
|
-
'text', 'search', 'url', 'tel', 'email', 'password', 'date', 'month', 'week', 'time',
|
|
39
|
-
'datetime-local', 'number'
|
|
40
|
-
]);
|
|
41
|
-
export const FormControl = (Base) => {
|
|
42
|
-
class FormControlElement extends Base {
|
|
43
|
-
static { this.formAssociated = true; }
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a mixin constructor must take any[]
|
|
45
|
-
constructor(...args) {
|
|
46
|
-
super(...args);
|
|
47
|
-
/* Disabled as the form sees it: the control's own `disabled`, or a
|
|
48
|
-
<fieldset disabled> it sits in. The platform reports both through
|
|
49
|
-
formDisabledCallback. It is kept here and never written to the host's
|
|
50
|
-
attribute, or a fieldset re-enabled later could not re-enable it. */
|
|
51
|
-
this._formDisabled = false;
|
|
52
|
-
/* A submit has been tried and found this control invalid. A native
|
|
53
|
-
control turns :user-invalid then, but the native element in here has
|
|
54
|
-
no form owner, so it never learns of the attempt; the `invalid` event
|
|
55
|
-
the form fires at the host is how it hears. checkValidity() fires the
|
|
56
|
-
same event, so a silent check counts too. Reset clears it. */
|
|
57
|
-
this._attempted = false;
|
|
58
|
-
this._internals = this.attachInternals();
|
|
59
|
-
this.addEventListener('invalid', () => { this._attempted = true; });
|
|
60
|
-
/* An outside activation is passed on to the native control, whose own
|
|
61
|
-
click then reaches this element like any other. This one stops here, so
|
|
62
|
-
a click listener on the element hears one click, not two -- one
|
|
63
|
-
el.click() is one click on a native control. Registered in the
|
|
64
|
-
constructor, it runs before any listener the page adds. */
|
|
65
|
-
this.addEventListener('click', e => {
|
|
66
|
-
if (e.composedPath()[0] !== this || !this._fromOutside(e))
|
|
67
|
-
return;
|
|
68
|
-
e.stopImmediatePropagation();
|
|
69
|
-
this._activate();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/* A click on the host itself, not on anything inside it, is one of three
|
|
73
|
-
things. A <label for> pointing at this element sends one carrying the
|
|
74
|
-
label's position, and el.click() an untrusted one: the two ways a native
|
|
75
|
-
control is activated from outside, and both activate this one. The third
|
|
76
|
-
is a real click inside the host's own box but on nothing in it -- the
|
|
77
|
-
slack beside a short label when a column stretches the host -- and that
|
|
78
|
-
did nothing before and still does not, or a wide row would toggle from
|
|
79
|
-
across the page. */
|
|
80
|
-
_fromOutside(e) {
|
|
81
|
-
if (!e.isTrusted)
|
|
82
|
-
return true;
|
|
83
|
-
const r = this.getBoundingClientRect();
|
|
84
|
-
return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;
|
|
85
|
-
}
|
|
86
|
-
/** The native element inside; each control says which. */
|
|
87
|
-
get _control() {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
/** What an outside activation does: a field takes focus, a checkable control overrides this to toggle. */
|
|
91
|
-
_activate() {
|
|
92
|
-
this._control?.focus();
|
|
93
|
-
}
|
|
94
|
-
get form() { return this._internals.form; }
|
|
95
|
-
get labels() { return this._internals.labels; }
|
|
96
|
-
get validity() { return this._internals.validity; }
|
|
97
|
-
get validationMessage() { return this._internals.validationMessage; }
|
|
98
|
-
get willValidate() { return this._internals.willValidate; }
|
|
99
|
-
checkValidity() { return this._internals.checkValidity(); }
|
|
100
|
-
reportValidity() { return this._internals.reportValidity(); }
|
|
101
|
-
/* Enter in a native text field, checkbox, radio or switch submits its
|
|
102
|
-
form -- implicit submission: the form's default button is clicked, or,
|
|
103
|
-
with none, the form is submitted, unless more than one of its fields
|
|
104
|
-
blocks that (BLOCKS_IMPLICIT_SUBMISSION above). Enter never toggles;
|
|
105
|
-
Space does. The native control in here has no form, so the host does it.
|
|
106
|
-
The default button is the form's first submit button, and a bd-button
|
|
107
|
-
with type="submit" is one: it is in form.elements and its type says so.
|
|
108
|
-
A disabled default button means no submission, as natively. */
|
|
109
|
-
_submitImplicitly() {
|
|
110
|
-
const form = this.form;
|
|
111
|
-
if (!form)
|
|
112
|
-
return;
|
|
113
|
-
const elements = [...form.elements];
|
|
114
|
-
const button = elements.find(el => el.type === 'submit' || el.type === 'image');
|
|
115
|
-
if (button) {
|
|
116
|
-
if (!button.matches(':disabled'))
|
|
117
|
-
button.click();
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const blocking = elements.filter(el => BLOCKS_IMPLICIT_SUBMISSION.has(el.type)).length;
|
|
121
|
-
if (blocking <= 1)
|
|
122
|
-
form.requestSubmit();
|
|
123
|
-
}
|
|
124
|
-
formDisabledCallback(disabled) {
|
|
125
|
-
this._formDisabled = disabled;
|
|
126
|
-
}
|
|
127
|
-
formResetCallback() {
|
|
128
|
-
this._attempted = false;
|
|
129
|
-
}
|
|
130
|
-
/* The native control already knows whether it is valid, and says so in the
|
|
131
|
-
browser's own words and language, so the host repeats it rather than
|
|
132
|
-
re-deriving it. The control is the anchor: reportValidity() and a failed
|
|
133
|
-
submit focus it and point the message at it. A disabled control is out
|
|
134
|
-
of validation altogether, and says so with an empty message that
|
|
135
|
-
setValidity() would refuse; the host is disabled with it. */
|
|
136
|
-
_mirrorValidity(control) {
|
|
137
|
-
if (!control?.willValidate || control.validity.valid) {
|
|
138
|
-
this._internals.setValidity({});
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
this._internals.setValidity(control.validity, control.validationMessage, control);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
__decorate([
|
|
146
|
-
state()
|
|
147
|
-
], FormControlElement.prototype, "_formDisabled", void 0);
|
|
148
|
-
__decorate([
|
|
149
|
-
state()
|
|
150
|
-
], FormControlElement.prototype, "_attempted", void 0);
|
|
151
|
-
return FormControlElement;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* What a control holding a typed or chosen value adds to FormControl --
|
|
155
|
-
* bd-custom-input, the clipboard field, bd-textarea, bd-custom-dropdown.
|
|
156
|
-
*
|
|
157
|
-
* The `value` property is the current value and the value ATTRIBUTE is the
|
|
158
|
-
* default a reset returns to, as on a native field. A reset also rebuilds the
|
|
159
|
-
* native control -- the subclass keys it on `_resets` -- because it has to
|
|
160
|
-
* forget that the reader touched it (:user-invalid), and only the form it
|
|
161
|
-
* belongs to could tell it that; the control in here has none.
|
|
162
|
-
*
|
|
163
|
-
* class BdField extends ValueControl(LitElement) { ... }
|
|
164
|
-
*/
|
|
165
|
-
export const ValueControl = (Base) => {
|
|
166
|
-
class ValueControlElement extends FormControl(Base) {
|
|
167
|
-
constructor() {
|
|
168
|
-
super(...arguments);
|
|
169
|
-
this._resets = 0;
|
|
170
|
-
}
|
|
171
|
-
/* What a form sees: the value, and whether the native control finds it
|
|
172
|
-
valid -- required, type, and anything else it checks -- in its own
|
|
173
|
-
words. Called after every update, and before a field's own events, so a
|
|
174
|
-
handler asking the form gets the answer for what was just typed. */
|
|
175
|
-
_sync() {
|
|
176
|
-
this._internals.setFormValue(this.value);
|
|
177
|
-
this._mirrorValidity(this._control);
|
|
178
|
-
}
|
|
179
|
-
formResetCallback() {
|
|
180
|
-
super.formResetCallback();
|
|
181
|
-
this.value = this.getAttribute('value') ?? '';
|
|
182
|
-
this._resets++;
|
|
183
|
-
}
|
|
184
|
-
formStateRestoreCallback(state) {
|
|
185
|
-
this.value = state;
|
|
186
|
-
}
|
|
187
|
-
/* Enter in a one-line field submits its form, as from a native <input>.
|
|
188
|
-
Not mid-composition: there Enter commits the IME's candidate. */
|
|
189
|
-
_onFieldKeydown(e) {
|
|
190
|
-
if (e.key === 'Enter' && !e.isComposing)
|
|
191
|
-
this._submitImplicitly();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
__decorate([
|
|
195
|
-
state()
|
|
196
|
-
], ValueControlElement.prototype, "_resets", void 0);
|
|
197
|
-
return ValueControlElement;
|
|
198
|
-
};
|
|
1
|
+
import e from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{state as t}from"lit/decorators.js";var n={toAttribute:e=>e||null},r=/* @__PURE__ */ new Set([`text`,`search`,`url`,`tel`,`email`,`password`,`date`,`month`,`week`,`time`,`datetime-local`,`number`]),i=n=>{class i extends n{static{this.formAssociated=!0}constructor(...e){super(...e),this._formDisabled=!1,this._attempted=!1,this._internals=this.attachInternals(),this.addEventListener(`invalid`,()=>{this._attempted=!0}),this.addEventListener(`click`,e=>{e.composedPath()[0]===this&&this._fromOutside(e)&&(e.stopImmediatePropagation(),this._activate())})}_fromOutside(e){if(!e.isTrusted)return!0;let t=this.getBoundingClientRect();return e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom}get _control(){return null}_activate(){this._control?.focus()}get form(){return this._internals.form}get labels(){return this._internals.labels}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}_submitImplicitly(){let e=this.form;if(!e)return;let t=[...e.elements],n=t.find(e=>e.type===`submit`||e.type===`image`);n?n.matches(`:disabled`)||n.click():t.filter(e=>r.has(e.type)).length<=1&&e.requestSubmit()}formDisabledCallback(e){this._formDisabled=e}formResetCallback(){this._attempted=!1}_mirrorValidity(e){!e?.willValidate||e.validity.valid?this._internals.setValidity({}):this._internals.setValidity(e.validity,e.validationMessage,e)}}return e([t()],i.prototype,`_formDisabled`,void 0),e([t()],i.prototype,`_attempted`,void 0),i},a=n=>{class r extends i(n){constructor(...e){super(...e),this._resets=0}_sync(){this._internals.setFormValue(this.value),this._mirrorValidity(this._control)}formResetCallback(){super.formResetCallback(),this.value=this.getAttribute(`value`)??``,this._resets++}formStateRestoreCallback(e){this.value=e}_onFieldKeydown(e){e.key===`Enter`&&!e.isComposing&&this._submitImplicitly()}}return e([t()],r.prototype,`_resets`,void 0),r};export{i as FormControl,a as ValueControl,n as omitEmpty};
|
|
199
2
|
//# sourceMappingURL=form-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-control.js","sourceRoot":"","sources":["../../../../src/components/shared/form-control.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;0EAG0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAsC,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;AAEpG;;;4DAG4D;AAC5D,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAqB;IAC7D,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IACpF,gBAAgB,EAAE,QAAQ;CAC3B,CAAC,CAAC;AAyCH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAoC,IAAO,EAAE,EAAE;IACxE,MAAM,kBAAmB,SAAQ,IAAI;iBAC5B,mBAAc,GAAG,IAAI,AAAP,CAAQ;QAe7B,qGAAqG;QACrG,YAAY,GAAG,IAAW;YACx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C;QAC/B,CAAC;QAED;2EACmE;QACzD,eAAe,CAAC,CAAgB;YACxC,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,WAAW;gBAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACpE,CAAC;KACF;IA3BoB;QAAlB,KAAK,EAAE;wDAAuB;IA4BjC,OAAO,mBAA4G,CAAC;AACtH,CAAC,CAAC","sourcesContent":["import type { ComplexAttributeConverter, LitElement } from 'lit';\nimport { state } from 'lit/decorators.js';\n\n/**\n * What makes a bd-* control take part in a <form>.\n *\n * Every control in this package renders its native element inside a shadow\n * root, and a native control there has no form owner: the <form> around the\n * element could not see it. A form submitted none of them, reset none of them\n * and let a required one through empty. Form-associated custom elements are\n * the platform's answer -- Baseline Widely available since 2023 -- so the\n * host joins the form itself through ElementInternals, the way the guide in\n * .claude/skills/modern-web-guidance/guides/html/form-associated-custom-elements.md\n * lays out, with no hidden input.\n *\n * This is the part every control shares: the opt-in, the internals, the\n * read-only surface a native control has (form, validity, checkValidity...),\n * and the two states a control cannot see from inside its shadow root -- a\n * <fieldset disabled> around it, and a submit that failed. What a control\n * submits, when it is valid and what reset puts back are its own.\n *\n * class BdThing extends FormControl(LitElement) { ... }\n */\n\n/* For `name`, which reflects: FACE submits under the host's name ATTRIBUTE, so\n a name set as a property -- what every framework binding does -- has to\n reach it. An empty name submits nothing either way, so it is left off the\n element rather than written as name=\"\" on every control on the page. */\nexport const omitEmpty: ComplexAttributeConverter<string> = { toAttribute: value => value || null };\n\n/* The input types that block implicit submission (HTML, \"implicit\n submission\"): a form with no submit button submits on Enter only while it\n has at most one field of these. A text field here says which type it is\n through its own `type`, so it is counted the same way. */\nconst BLOCKS_IMPLICIT_SUBMISSION = new Set<string | undefined>([\n 'text', 'search', 'url', 'tel', 'email', 'password', 'date', 'month', 'week', 'time',\n 'datetime-local', 'number'\n]);\n\n// Lit's mixin pattern: the class a mixin returns is typed by the declared\n// interfaces below, so its members reach the elements built on it without the\n// anonymous class itself leaking into the published declarations.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor<T = object> = new (...args: any[]) => T;\n\n/** The native element a control renders and stands in for. */\ntype NativeControl = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement;\n\n/* The members a control's own code reaches are protected: they are how the\n elements built on the mixin talk to it, not part of what a page may call. */\nexport declare class FormControlInterface {\n protected _internals : ElementInternals;\n protected _formDisabled: boolean;\n protected _attempted : boolean;\n protected _fromOutside(e: MouseEvent): boolean;\n protected get _control(): NativeControl | null;\n protected _activate(): void;\n get form(): HTMLFormElement | null;\n get labels(): NodeList;\n get validity(): ValidityState;\n get validationMessage(): string;\n get willValidate(): boolean;\n checkValidity(): boolean;\n reportValidity(): boolean;\n protected _submitImplicitly(): void;\n formDisabledCallback(disabled: boolean): void;\n formResetCallback(): void;\n protected _mirrorValidity(control: NativeControl | null | undefined): void;\n}\n\nexport declare class ValueControlInterface {\n protected _resets: number;\n value : string;\n protected _sync(): void;\n formStateRestoreCallback(state: string | File | FormData | null): void;\n protected _onFieldKeydown(e: KeyboardEvent): void;\n}\n\nexport const FormControl = <T extends Constructor<LitElement>>(Base: T) => {\n class FormControlElement extends Base {\n static formAssociated = true;\n\n /* Disabled as the form sees it: the control's own `disabled`, or a\n <fieldset disabled> it sits in. The platform reports both through\n formDisabledCallback. It is kept here and never written to the host's\n attribute, or a fieldset re-enabled later could not re-enable it. */\n @state() protected _formDisabled = false;\n /* A submit has been tried and found this control invalid. A native\n control turns :user-invalid then, but the native element in here has\n no form owner, so it never learns of the attempt; the `invalid` event\n the form fires at the host is how it hears. checkValidity() fires the\n same event, so a silent check counts too. Reset clears it. */\n @state() protected _attempted = false;\n protected _internals: ElementInternals;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- a mixin constructor must take any[]\n constructor(...args: any[]) {\n super(...args);\n this._internals = this.attachInternals();\n this.addEventListener('invalid', () => { this._attempted = true; });\n /* An outside activation is passed on to the native control, whose own\n click then reaches this element like any other. This one stops here, so\n a click listener on the element hears one click, not two -- one\n el.click() is one click on a native control. Registered in the\n constructor, it runs before any listener the page adds. */\n this.addEventListener('click', e => {\n if (e.composedPath()[0] !== this || !this._fromOutside(e)) return;\n e.stopImmediatePropagation();\n this._activate();\n });\n }\n\n /* A click on the host itself, not on anything inside it, is one of three\n things. A <label for> pointing at this element sends one carrying the\n label's position, and el.click() an untrusted one: the two ways a native\n control is activated from outside, and both activate this one. The third\n is a real click inside the host's own box but on nothing in it -- the\n slack beside a short label when a column stretches the host -- and that\n did nothing before and still does not, or a wide row would toggle from\n across the page. */\n protected _fromOutside(e: MouseEvent) {\n if (!e.isTrusted) return true;\n const r = this.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n }\n\n /** The native element inside; each control says which. */\n protected get _control(): NativeControl | null {\n return null;\n }\n\n /** What an outside activation does: a field takes focus, a checkable control overrides this to toggle. */\n protected _activate() {\n this._control?.focus();\n }\n\n get form() { return this._internals.form; }\n get labels() { return this._internals.labels; }\n get validity() { return this._internals.validity; }\n get validationMessage() { return this._internals.validationMessage; }\n get willValidate() { return this._internals.willValidate; }\n checkValidity() { return this._internals.checkValidity(); }\n reportValidity() { return this._internals.reportValidity(); }\n\n /* Enter in a native text field, checkbox, radio or switch submits its\n form -- implicit submission: the form's default button is clicked, or,\n with none, the form is submitted, unless more than one of its fields\n blocks that (BLOCKS_IMPLICIT_SUBMISSION above). Enter never toggles;\n Space does. The native control in here has no form, so the host does it.\n The default button is the form's first submit button, and a bd-button\n with type=\"submit\" is one: it is in form.elements and its type says so.\n A disabled default button means no submission, as natively. */\n protected _submitImplicitly() {\n const form = this.form;\n if (!form) return;\n const elements = [...form.elements] as Array<HTMLElement & { type?: string }>;\n const button = elements.find(el => el.type === 'submit' || el.type === 'image');\n if (button) {\n if (!button.matches(':disabled')) button.click();\n return;\n }\n const blocking = elements.filter(el => BLOCKS_IMPLICIT_SUBMISSION.has(el.type)).length;\n if (blocking <= 1) form.requestSubmit();\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled;\n }\n\n formResetCallback() {\n this._attempted = false;\n }\n\n /* The native control already knows whether it is valid, and says so in the\n browser's own words and language, so the host repeats it rather than\n re-deriving it. The control is the anchor: reportValidity() and a failed\n submit focus it and point the message at it. A disabled control is out\n of validation altogether, and says so with an empty message that\n setValidity() would refuse; the host is disabled with it. */\n protected _mirrorValidity(control: NativeControl | null | undefined) {\n if (!control?.willValidate || control.validity.valid) {\n this._internals.setValidity({});\n } else {\n this._internals.setValidity(control.validity, control.validationMessage, control);\n }\n }\n }\n return FormControlElement as unknown as Constructor<FormControlInterface> & T;\n};\n\n/**\n * What a control holding a typed or chosen value adds to FormControl --\n * bd-custom-input, the clipboard field, bd-textarea, bd-custom-dropdown.\n *\n * The `value` property is the current value and the value ATTRIBUTE is the\n * default a reset returns to, as on a native field. A reset also rebuilds the\n * native control -- the subclass keys it on `_resets` -- because it has to\n * forget that the reader touched it (:user-invalid), and only the form it\n * belongs to could tell it that; the control in here has none.\n *\n * class BdField extends ValueControl(LitElement) { ... }\n */\nexport const ValueControl = <T extends Constructor<LitElement>>(Base: T) => {\n class ValueControlElement extends FormControl(Base) {\n @state() protected _resets = 0;\n declare value: string;\n\n /* What a form sees: the value, and whether the native control finds it\n valid -- required, type, and anything else it checks -- in its own\n words. Called after every update, and before a field's own events, so a\n handler asking the form gets the answer for what was just typed. */\n protected _sync() {\n this._internals.setFormValue(this.value);\n this._mirrorValidity(this._control);\n }\n\n formResetCallback() {\n super.formResetCallback();\n this.value = this.getAttribute('value') ?? '';\n this._resets++;\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this.value = state as string;\n }\n\n /* Enter in a one-line field submits its form, as from a native <input>.\n Not mid-composition: there Enter commits the IME's candidate. */\n protected _onFieldKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter' && !e.isComposing) this._submitImplicitly();\n }\n }\n return ValueControlElement as unknown as Constructor<ValueControlInterface> & Constructor<FormControlInterface> & T;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"form-control.js","names":["__decorate","omitEmpty","value","BLOCKS_IMPLICIT_SUBMISSION","FormControl","FormControlElement","Base","args","r","form","elements","button","el","disabled","control","state","ValueControl","ValueControlElement","_args"],"sources":["../../../../src/components/shared/form-control.ts"],"sourcesContent":["import type { ComplexAttributeConverter, LitElement } from 'lit';\nimport { state } from 'lit/decorators.js';\n\n/**\n * What makes a bd-* control take part in a <form>.\n *\n * Every control in this package renders its native element inside a shadow\n * root, and a native control there has no form owner: the <form> around the\n * element could not see it. A form submitted none of them, reset none of them\n * and let a required one through empty. Form-associated custom elements are\n * the platform's answer -- Baseline Widely available since 2023 -- so the\n * host joins the form itself through ElementInternals, the way the guide in\n * .claude/skills/modern-web-guidance/guides/html/form-associated-custom-elements.md\n * lays out, with no hidden input.\n *\n * This is the part every control shares: the opt-in, the internals, the\n * read-only surface a native control has (form, validity, checkValidity...),\n * and the two states a control cannot see from inside its shadow root -- a\n * <fieldset disabled> around it, and a submit that failed. What a control\n * submits, when it is valid and what reset puts back are its own.\n *\n * class BdThing extends FormControl(LitElement) { ... }\n */\n\n/* For `name`, which reflects: FACE submits under the host's name ATTRIBUTE, so\n a name set as a property -- what every framework binding does -- has to\n reach it. An empty name submits nothing either way, so it is left off the\n element rather than written as name=\"\" on every control on the page. */\nexport const omitEmpty: ComplexAttributeConverter<string> = { toAttribute: value => value || null };\n\n/* The input types that block implicit submission (HTML, \"implicit\n submission\"): a form with no submit button submits on Enter only while it\n has at most one field of these. A text field here says which type it is\n through its own `type`, so it is counted the same way. */\nconst BLOCKS_IMPLICIT_SUBMISSION = new Set<string | undefined>([\n 'text', 'search', 'url', 'tel', 'email', 'password', 'date', 'month', 'week', 'time',\n 'datetime-local', 'number'\n]);\n\n// Lit's mixin pattern: the class a mixin returns is typed by the declared\n// interfaces below, so its members reach the elements built on it without the\n// anonymous class itself leaking into the published declarations.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor<T = object> = new (...args: any[]) => T;\n\n/** The native element a control renders and stands in for. */\ntype NativeControl = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement;\n\n/* The members a control's own code reaches are protected: they are how the\n elements built on the mixin talk to it, not part of what a page may call. */\nexport declare class FormControlInterface {\n protected _internals : ElementInternals;\n protected _formDisabled: boolean;\n protected _attempted : boolean;\n protected _fromOutside(e: MouseEvent): boolean;\n protected get _control(): NativeControl | null;\n protected _activate(): void;\n get form(): HTMLFormElement | null;\n get labels(): NodeList;\n get validity(): ValidityState;\n get validationMessage(): string;\n get willValidate(): boolean;\n checkValidity(): boolean;\n reportValidity(): boolean;\n protected _submitImplicitly(): void;\n formDisabledCallback(disabled: boolean): void;\n formResetCallback(): void;\n protected _mirrorValidity(control: NativeControl | null | undefined): void;\n}\n\nexport declare class ValueControlInterface {\n protected _resets: number;\n value : string;\n protected _sync(): void;\n formStateRestoreCallback(state: string | File | FormData | null): void;\n protected _onFieldKeydown(e: KeyboardEvent): void;\n}\n\nexport const FormControl = <T extends Constructor<LitElement>>(Base: T) => {\n class FormControlElement extends Base {\n static formAssociated = true;\n\n /* Disabled as the form sees it: the control's own `disabled`, or a\n <fieldset disabled> it sits in. The platform reports both through\n formDisabledCallback. It is kept here and never written to the host's\n attribute, or a fieldset re-enabled later could not re-enable it. */\n @state() protected _formDisabled = false;\n /* A submit has been tried and found this control invalid. A native\n control turns :user-invalid then, but the native element in here has\n no form owner, so it never learns of the attempt; the `invalid` event\n the form fires at the host is how it hears. checkValidity() fires the\n same event, so a silent check counts too. Reset clears it. */\n @state() protected _attempted = false;\n protected _internals: ElementInternals;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- a mixin constructor must take any[]\n constructor(...args: any[]) {\n super(...args);\n this._internals = this.attachInternals();\n this.addEventListener('invalid', () => { this._attempted = true; });\n /* An outside activation is passed on to the native control, whose own\n click then reaches this element like any other. This one stops here, so\n a click listener on the element hears one click, not two -- one\n el.click() is one click on a native control. Registered in the\n constructor, it runs before any listener the page adds. */\n this.addEventListener('click', e => {\n if (e.composedPath()[0] !== this || !this._fromOutside(e)) return;\n e.stopImmediatePropagation();\n this._activate();\n });\n }\n\n /* A click on the host itself, not on anything inside it, is one of three\n things. A <label for> pointing at this element sends one carrying the\n label's position, and el.click() an untrusted one: the two ways a native\n control is activated from outside, and both activate this one. The third\n is a real click inside the host's own box but on nothing in it -- the\n slack beside a short label when a column stretches the host -- and that\n did nothing before and still does not, or a wide row would toggle from\n across the page. */\n protected _fromOutside(e: MouseEvent) {\n if (!e.isTrusted) return true;\n const r = this.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n }\n\n /** The native element inside; each control says which. */\n protected get _control(): NativeControl | null {\n return null;\n }\n\n /** What an outside activation does: a field takes focus, a checkable control overrides this to toggle. */\n protected _activate() {\n this._control?.focus();\n }\n\n get form() { return this._internals.form; }\n get labels() { return this._internals.labels; }\n get validity() { return this._internals.validity; }\n get validationMessage() { return this._internals.validationMessage; }\n get willValidate() { return this._internals.willValidate; }\n checkValidity() { return this._internals.checkValidity(); }\n reportValidity() { return this._internals.reportValidity(); }\n\n /* Enter in a native text field, checkbox, radio or switch submits its\n form -- implicit submission: the form's default button is clicked, or,\n with none, the form is submitted, unless more than one of its fields\n blocks that (BLOCKS_IMPLICIT_SUBMISSION above). Enter never toggles;\n Space does. The native control in here has no form, so the host does it.\n The default button is the form's first submit button, and a bd-button\n with type=\"submit\" is one: it is in form.elements and its type says so.\n A disabled default button means no submission, as natively. */\n protected _submitImplicitly() {\n const form = this.form;\n if (!form) return;\n const elements = [...form.elements] as Array<HTMLElement & { type?: string }>;\n const button = elements.find(el => el.type === 'submit' || el.type === 'image');\n if (button) {\n if (!button.matches(':disabled')) button.click();\n return;\n }\n const blocking = elements.filter(el => BLOCKS_IMPLICIT_SUBMISSION.has(el.type)).length;\n if (blocking <= 1) form.requestSubmit();\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled;\n }\n\n formResetCallback() {\n this._attempted = false;\n }\n\n /* The native control already knows whether it is valid, and says so in the\n browser's own words and language, so the host repeats it rather than\n re-deriving it. The control is the anchor: reportValidity() and a failed\n submit focus it and point the message at it. A disabled control is out\n of validation altogether, and says so with an empty message that\n setValidity() would refuse; the host is disabled with it. */\n protected _mirrorValidity(control: NativeControl | null | undefined) {\n if (!control?.willValidate || control.validity.valid) {\n this._internals.setValidity({});\n } else {\n this._internals.setValidity(control.validity, control.validationMessage, control);\n }\n }\n }\n return FormControlElement as unknown as Constructor<FormControlInterface> & T;\n};\n\n/**\n * What a control holding a typed or chosen value adds to FormControl --\n * bd-custom-input, the clipboard field, bd-textarea, bd-custom-dropdown.\n *\n * The `value` property is the current value and the value ATTRIBUTE is the\n * default a reset returns to, as on a native field. A reset also rebuilds the\n * native control -- the subclass keys it on `_resets` -- because it has to\n * forget that the reader touched it (:user-invalid), and only the form it\n * belongs to could tell it that; the control in here has none.\n *\n * class BdField extends ValueControl(LitElement) { ... }\n */\nexport const ValueControl = <T extends Constructor<LitElement>>(Base: T) => {\n class ValueControlElement extends FormControl(Base) {\n @state() protected _resets = 0;\n declare value: string;\n\n /* What a form sees: the value, and whether the native control finds it\n valid -- required, type, and anything else it checks -- in its own\n words. Called after every update, and before a field's own events, so a\n handler asking the form gets the answer for what was just typed. */\n protected _sync() {\n this._internals.setFormValue(this.value);\n this._mirrorValidity(this._control);\n }\n\n formResetCallback() {\n super.formResetCallback();\n this.value = this.getAttribute('value') ?? '';\n this._resets++;\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this.value = state as string;\n }\n\n /* Enter in a one-line field submits its form, as from a native <input>.\n Not mid-composition: there Enter commits the IME's candidate. */\n protected _onFieldKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter' && !e.isComposing) this._submitImplicitly();\n }\n }\n return ValueControlElement as unknown as Constructor<ValueControlInterface> & Const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