@repobit/dex-system-design 3.0.1 → 3.0.2
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 +7 -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 +14 -3
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-player.css.js","
|
|
1
|
+
{"version":3,"file":"video-player.css.js","names":["video_player_css_default"],"sources":["../../../../src/components/video-player/video-player.css.ts"],"sourcesContent":["import { css } from \"lit\";\n\nexport default css`\n :host {\n display: block;\n width: 100%;\n }\n\n .bd-video-thumb {\n position: relative;\n display: block;\n width: 100%;\n padding: 0;\n border: none;\n background: none;\n cursor: pointer;\n border-radius: var(--shape-radius-lg);\n overflow: hidden;\n }\n\n .bd-video-thumb img {\n width: 100%;\n height: auto;\n display: block;\n border-radius: var(--shape-radius-lg);\n transition: transform var(--transition-duration-slow) var(--transition-easing-ease);\n }\n\n .bd-video-thumb:hover img {\n transform: scale(1.02);\n }\n\n .bd-video-play-btn {\n /* Centred by inset and auto margins, so the hover can scale it without\n restating a centring transform. */\n position: absolute;\n inset: 0;\n margin: auto;\n width: 64px;\n height: 64px;\n pointer-events: none;\n /* no token: drop-shadow() takes one shadow with no spread, and every\n --shadow-* step is spelled with a spread (two layers from md up), so\n none of them parses here. 30% black, not a card's 10%, because the\n glyph sits on whatever frame the thumbnail shows -- mixed over the\n palette like the close button's ground below, the same pixels as the\n rgba it replaces. */\n filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--color-neutral-1000) 30%, transparent));\n transition: scale var(--transition-duration-slow) var(--transition-easing-ease);\n }\n\n .bd-video-thumb:hover .bd-video-play-btn {\n scale: 1.1;\n }\n\n .bd-video-play-btn svg {\n width: 64px;\n height: 64px;\n }\n\n .bd-video-player {\n position: relative;\n width: 100%;\n aspect-ratio: 16 / 9;\n border-radius: var(--shape-radius-lg);\n overflow: hidden;\n /* The media frame, --color-surface-media: around a video, dark in every theme.\n This read --color-surface-inverse until dark mode decision 15 -- the\n polarity flip, which would turn a letterbox light in a dark theme. */\n background: var(--color-surface-media);\n }\n\n .bd-video-player iframe,\n .bd-video-player video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: none;\n }\n\n .bd-video-close {\n position: absolute;\n top: var(--spacing-8);\n right: var(--spacing-8);\n width: 32px;\n height: 32px;\n border-radius: 50%;\n border: none;\n /* no role: NOT a scrim, though it looks like one next to the modal's. This\n is the close button's own ground -- a 32px circle that has to carry a\n white glyph over whatever frame the video happens to be showing, so the\n darkness is doing contrast work for the icon rather than dimming content\n behind a dialog. Two declarations, one control, no role.\n .\n Mixed over the palette rather than written as a raw rgba, for the same\n reason as the modal's scrim: this follows --color-neutral-1000 where a\n literal black follows nothing. Pixel-identical to the rgba it replaces. */\n background: color-mix(in srgb, var(--color-neutral-1000) 60%, transparent);\n color: var(--color-text-on-media);\n font-size: 16px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n /* Above the video surface it sits on; nothing else in this shadow root\n is positioned. */\n z-index: var(--z-raised);\n transition: background var(--transition-duration-fast) var(--transition-easing-ease);\n }\n\n .bd-video-close:hover {\n /* no role: the same control ground at 90% under the pointer -- it gets more\n opaque rather than changing hue. Same reasoning as the rest state above,\n and no role for the same reason. Pixel-identical to the rgba it\n replaces. */\n background: color-mix(in srgb, var(--color-neutral-1000) 90%, transparent);\n }\n\n /* The one focus ring, on both controls. This sheet had no :focus-visible\n rule at all, so the two buttons fell back to the browser's outline:\n measured on the thumbnail with a real Tab, outline 1px auto\n rgb(0, 95, 204) and box-shadow none, where every other control in this\n package draws --focus-outline-primary. The two-colour ring also matters\n more here than most places -- the close button sits on video, so a\n single-colour outline has no guaranteed ground to contrast against, and\n the white inner band is what makes it visible on any frame.\n\n The ring follows each control's own shape: the thumbnail keeps its\n --radius-lg corner and the close button is a circle. */\n .bd-video-thumb:focus-visible,\n .bd-video-close:focus-visible {\n /* forced-colors mode does not paint box-shadow, so the ring\n vanishes there; it does paint an outline, in a system colour. This one\n is transparent everywhere else, and the offset lands it on the ring's\n outer band. */\n outline: var(--border-width-2) solid transparent;\n outline-offset: var(--focus-outline-offset);\n box-shadow: var(--focus-outline-primary);\n }\n\n /* The thumbnail lifts on hover and the play mark grows. Measured before\n this: with prefers-reduced-motion: reduce both still reported a 0.3s\n transition, so the scale ran for a reader who asked for less motion.\n The transform is dropped as well as the transition -- a scale that\n arrives instantly is still motion the reader did not ask for. */\n @media (prefers-reduced-motion: reduce) {\n .bd-video-thumb img,\n .bd-video-play-btn,\n .bd-video-close {\n transition: none;\n }\n\n .bd-video-thumb:hover img {\n transform: none;\n }\n\n /* scale, not transform. This used to restate a translate(-50%, -50%)\n left from when the mark was centred by top/left 50%; it is centred by\n inset and auto margins now, so the translate threw it up and left by\n half its size on hover -- and the scale it was meant to cancel is\n the individual property, which a transform does not reset. */\n .bd-video-thumb:hover .bd-video-play-btn {\n scale: none;\n }\n }\n`;"],"mappings":"A,0BAEA,IAAAA,EAAe,CAAG,+7D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
import "../../tokens/tokens.
|
|
3
|
-
import "../icons/close-icon.
|
|
2
|
+
import "../../tokens/tokens.js";
|
|
3
|
+
import "../icons/close-icon.js";
|
|
4
4
|
declare class BdVideoPlayer extends LitElement {
|
|
5
5
|
static styles: import("lit").CSSResult[];
|
|
6
6
|
src: string;
|
|
@@ -1,139 +1,27 @@
|
|
|
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 { LitElement, html, nothing } from "lit";
|
|
8
|
-
import { property, state } from "lit/decorators.js";
|
|
9
|
-
import { defineElement } from "../shared/define-element.js";
|
|
10
|
-
// Installs the design tokens into document scope; see src/tokens/tokens.ts
|
|
11
|
-
import "../../tokens/tokens.js";
|
|
12
|
-
import "../icons/close-icon.js";
|
|
13
|
-
import videoPlayerCSS from "./video-player.css.js";
|
|
14
|
-
let BdVideoPlayer = class BdVideoPlayer extends LitElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.src = "";
|
|
18
|
-
this.thumb = "";
|
|
19
|
-
this.thumbAlt = "";
|
|
20
|
-
/* The embedded player's name, as a screen reader announces the iframe.
|
|
21
|
-
Every instance used to be titled "Video player", which says what the
|
|
22
|
-
frame is and nothing about which video it holds. */
|
|
23
|
-
this.videoTitle = "";
|
|
24
|
-
this._open = false;
|
|
25
|
-
}
|
|
26
|
-
static { this.styles = [videoPlayerCSS]; }
|
|
27
|
-
_isYoutube() {
|
|
28
|
-
return this.src.includes("youtube.com") || this.src.includes("youtu.be");
|
|
29
|
-
}
|
|
30
|
-
/* autoplay=1 is set on the URL's own query rather than appended to the
|
|
31
|
-
string. Appended, an embed URL that already had a query -- ?start=, ?list=,
|
|
32
|
-
or the ?autoplay=1 of the YouTube with Autoplay story -- came out as
|
|
33
|
-
...?autoplay=1?autoplay=1, its second "?" read as part of the first
|
|
34
|
-
value. Only behind a thumbnail: the click on it is the request to play. */
|
|
35
|
-
get _embedSrc() {
|
|
36
|
-
if (!this.thumb)
|
|
37
|
-
return this.src;
|
|
38
|
-
try {
|
|
39
|
-
const url = new URL(this.src, document.baseURI);
|
|
40
|
-
url.searchParams.set("autoplay", "1");
|
|
41
|
-
return url.href;
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return this.src;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Opening replaces the thumbnail button with the player, which destroys the
|
|
49
|
-
* element that had focus. Measured with a real keyboard: Tab to the
|
|
50
|
-
* thumbnail, Enter, and document.activeElement was body -- the keyboard user
|
|
51
|
-
* was dropped to the top of the document by the act of pressing Play.
|
|
52
|
-
*
|
|
53
|
-
* Focus goes to the close button, which is the one control this component
|
|
54
|
-
* owns once the player is up. That also answers a reachability problem it
|
|
55
|
-
* would otherwise have: the close button follows the iframe in DOM order, so
|
|
56
|
-
* reaching it by Tab means traversing the embedded player's own tab stops
|
|
57
|
-
* first -- measured, six Tabs after opening never left the iframe. Landing on
|
|
58
|
-
* it directly means the way out is the first thing the keyboard has.
|
|
59
|
-
*
|
|
60
|
-
* Only when there is a thumbnail: without one the component renders the
|
|
61
|
-
* player immediately, owns no close button, and nothing has been displaced.
|
|
62
|
-
*/
|
|
63
|
-
_openVideo() {
|
|
64
|
-
this._open = true;
|
|
65
|
-
if (!this.thumb)
|
|
66
|
-
return;
|
|
67
|
-
this.updateComplete.then(() => {
|
|
68
|
-
this.renderRoot?.querySelector(".bd-video-close")?.focus();
|
|
69
|
-
this._playOnOpen();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/* A direct video starts from the click on its thumbnail, with its sound.
|
|
73
|
-
It used to be <video autoplay> without muted, which a browser is free to
|
|
74
|
-
refuse -- most do for a video with sound -- and iOS played it full screen
|
|
75
|
-
besides. play() is called from the click's own task, which is the user
|
|
76
|
-
activation that lets unmuted playback start everywhere; if it is refused
|
|
77
|
-
anyway, the poster and the controls are still there. */
|
|
78
|
-
_playOnOpen() {
|
|
79
|
-
const video = this.renderRoot?.querySelector("video");
|
|
80
|
-
video?.play().catch(() => { });
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Closing destroys the close button the same way, so focus returns to the
|
|
84
|
-
* thumbnail it came from.
|
|
85
|
-
*/
|
|
86
|
-
_closeVideo() {
|
|
87
|
-
this._open = false;
|
|
88
|
-
this.updateComplete.then(() => {
|
|
89
|
-
this.renderRoot?.querySelector(".bd-video-thumb")?.focus();
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/* Behind a thumbnail the video is the thumbnail's click (see
|
|
93
|
-
_playOnOpen), so it never autoplays and keeps the thumbnail as its
|
|
94
|
-
poster. Without one it starts on its own, which a browser allows only
|
|
95
|
-
muted and inline -- and not at all under prefers-reduced-motion, where it
|
|
96
|
-
waits for its play button. Behind a thumbnail preload is "none": the
|
|
97
|
-
poster is the picture, and nothing is fetched before playback is asked
|
|
98
|
-
for. Without one it is "metadata", or a video held still under reduced
|
|
99
|
-
motion would be an empty box with controls -- no first frame, no
|
|
100
|
-
duration -- until it was played. muted is the property as well as the
|
|
101
|
-
attribute, because the attribute is only read when the element is
|
|
102
|
-
parsed, never when a template sets it. */
|
|
103
|
-
_renderVideo() {
|
|
104
|
-
const autoplay = !this.thumb &&
|
|
105
|
-
!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
106
|
-
return html `
|
|
1
|
+
import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import t from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../icons/close-icon.js";import n from"./video-player.css.js";import{LitElement as r,html as i,nothing as a}from"lit";import{property as o,state as s}from"lit/decorators.js";var c=class extends r{constructor(...e){super(...e),this.src=``,this.thumb=``,this.thumbAlt=``,this.videoTitle=``,this._open=!1}static{this.styles=[n]}_isYoutube(){return this.src.includes(`youtube.com`)||this.src.includes(`youtu.be`)}get _embedSrc(){if(!this.thumb)return this.src;try{let e=new URL(this.src,document.baseURI);return e.searchParams.set(`autoplay`,`1`),e.href}catch{return this.src}}_openVideo(){this._open=!0,this.thumb&&this.updateComplete.then(()=>{this.renderRoot?.querySelector(`.bd-video-close`)?.focus(),this._playOnOpen()})}_playOnOpen(){(this.renderRoot?.querySelector(`video`))?.play().catch(()=>{})}_closeVideo(){this._open=!1,this.updateComplete.then(()=>{this.renderRoot?.querySelector(`.bd-video-thumb`)?.focus()})}_renderVideo(){let e=!this.thumb&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return i`
|
|
107
2
|
<video
|
|
108
3
|
src="${this.src}"
|
|
109
|
-
poster="${this.thumb
|
|
4
|
+
poster="${this.thumb||a}"
|
|
110
5
|
controls
|
|
111
6
|
playsinline
|
|
112
|
-
preload="${this.thumb
|
|
113
|
-
?autoplay=${
|
|
114
|
-
?muted=${
|
|
115
|
-
.muted=${
|
|
7
|
+
preload="${this.thumb?`none`:`metadata`}"
|
|
8
|
+
?autoplay=${e}
|
|
9
|
+
?muted=${e}
|
|
10
|
+
.muted=${e}
|
|
116
11
|
></video>
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
render() {
|
|
120
|
-
if (!this.thumb || this._open) {
|
|
121
|
-
return html `
|
|
12
|
+
`}render(){return!this.thumb||this._open?i`
|
|
122
13
|
<div class="bd-video-player">
|
|
123
|
-
${this._isYoutube()
|
|
124
|
-
? html `
|
|
14
|
+
${this._isYoutube()?i`
|
|
125
15
|
<iframe
|
|
126
16
|
src="${this._embedSrc}"
|
|
127
|
-
title="${this.videoTitle
|
|
17
|
+
title="${this.videoTitle||`Video player`}"
|
|
128
18
|
loading="lazy"
|
|
129
19
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
130
20
|
referrerpolicy="strict-origin-when-cross-origin"
|
|
131
21
|
allowfullscreen
|
|
132
22
|
></iframe>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
${this.thumb
|
|
136
|
-
? html `
|
|
23
|
+
`:this._renderVideo()}
|
|
24
|
+
${this.thumb?i`
|
|
137
25
|
<button
|
|
138
26
|
class="bd-video-close"
|
|
139
27
|
@click=${this._closeVideo}
|
|
@@ -141,12 +29,9 @@ let BdVideoPlayer = class BdVideoPlayer extends LitElement {
|
|
|
141
29
|
>
|
|
142
30
|
<bd-close-icon size="xs" aria-hidden="true"></bd-close-icon>
|
|
143
31
|
</button>
|
|
144
|
-
|
|
145
|
-
: ""}
|
|
32
|
+
`:``}
|
|
146
33
|
</div>
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
return html `
|
|
34
|
+
`:i`
|
|
150
35
|
<button
|
|
151
36
|
class="bd-video-thumb"
|
|
152
37
|
@click=${this._openVideo}
|
|
@@ -154,7 +39,7 @@ let BdVideoPlayer = class BdVideoPlayer extends LitElement {
|
|
|
154
39
|
>
|
|
155
40
|
<img
|
|
156
41
|
src="${this.thumb}"
|
|
157
|
-
alt="${this.thumbAlt
|
|
42
|
+
alt="${this.thumbAlt||`Video preview`}"
|
|
158
43
|
loading="lazy"
|
|
159
44
|
/>
|
|
160
45
|
<span class="bd-video-play-btn" aria-hidden="true">
|
|
@@ -164,25 +49,5 @@ let BdVideoPlayer = class BdVideoPlayer extends LitElement {
|
|
|
164
49
|
</svg>
|
|
165
50
|
</span>
|
|
166
51
|
</button>
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
__decorate([
|
|
171
|
-
property({ type: String })
|
|
172
|
-
], BdVideoPlayer.prototype, "src", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
property({ type: String })
|
|
175
|
-
], BdVideoPlayer.prototype, "thumb", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
property({ type: String, attribute: "thumb-alt" })
|
|
178
|
-
], BdVideoPlayer.prototype, "thumbAlt", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
property({ type: String, attribute: "video-title" })
|
|
181
|
-
], BdVideoPlayer.prototype, "videoTitle", void 0);
|
|
182
|
-
__decorate([
|
|
183
|
-
state()
|
|
184
|
-
], BdVideoPlayer.prototype, "_open", void 0);
|
|
185
|
-
BdVideoPlayer = __decorate([
|
|
186
|
-
defineElement("bd-video-player")
|
|
187
|
-
], BdVideoPlayer);
|
|
52
|
+
`}};t([o({type:String})],c.prototype,`src`,void 0),t([o({type:String})],c.prototype,`thumb`,void 0),t([o({type:String,attribute:`thumb-alt`})],c.prototype,`thumbAlt`,void 0),t([o({type:String,attribute:`video-title`})],c.prototype,`videoTitle`,void 0),t([s()],c.prototype,`_open`,void 0),c=t([e(`bd-video-player`)],c);
|
|
188
53
|
//# sourceMappingURL=video-player.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-player.js","
|
|
1
|
+
{"version":3,"file":"video-player.js","names":["videoPlayerCSS","_decorate","__decorate","video_player_css_default","BdVideoPlayer","LitElement","_args","url","autoplay","nothing","property","state","defineElement"],"sources":["../../../../src/components/video-player/video-player.ts"],"sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/close-icon.ts\";\nimport videoPlayerCSS from \"./video-player.css.ts\";\n\n@defineElement(\"bd-video-player\")\nclass BdVideoPlayer extends LitElement {\n static styles = [videoPlayerCSS];\n\n @property({ type: String })\n src = \"\";\n @property({ type: String })\n thumb = \"\";\n @property({ type: String, attribute: \"thumb-alt\" })\n thumbAlt = \"\";\n /* The embedded player's name, as a screen reader announces the iframe.\n Every instance used to be titled \"Video player\", which says what the\n frame is and nothing about which video it holds. */\n @property({ type: String, attribute: \"video-title\" })\n videoTitle = \"\";\n @state()\n _open = false;\n\n _isYoutube() {\n return this.src.includes(\"youtube.com\") || this.src.includes(\"youtu.be\");\n }\n\n /* autoplay=1 is set on the URL's own query rather than appended to the\n string. Appended, an embed URL that already had a query -- ?start=, ?list=,\n or the ?autoplay=1 of the YouTube with Autoplay story -- came out as\n ...?autoplay=1?autoplay=1, its second \"?\" read as part of the first\n value. Only behind a thumbnail: the click on it is the request to play. */\n get _embedSrc() {\n if (!this.thumb) return this.src;\n try {\n const url = new URL(this.src, document.baseURI);\n url.searchParams.set(\"autoplay\", \"1\");\n return url.href;\n } catch {\n return this.src;\n }\n }\n\n /**\n * Opening replaces the thumbnail button with the player, which destroys the\n * element that had focus. Measured with a real keyboard: Tab to the\n * thumbnail, Enter, and document.activeElement was body -- the keyboard user\n * was dropped to the top of the document by the act of pressing Play.\n *\n * Focus goes to the close button, which is the one control this component\n * owns once the player is up. That also answers a reachability problem it\n * would otherwise have: the close button follows the iframe in DOM order, so\n * reaching it by Tab means traversing the embedded player's own tab stops\n * first -- measured, six Tabs after opening never left the iframe. Landing on\n * it directly means the way out is the first thing the keyboard has.\n *\n * Only when there is a thumbnail: without one the component renders the\n * player immediately, owns no close button, and nothing has been displaced.\n */\n _openVideo() {\n this._open = true;\n if (!this.thumb) return;\n this.updateComplete.then(() => {\n this.renderRoot?.querySelector<HTMLButtonElement>(\".bd-video-close\")?.focus();\n this._playOnOpen();\n });\n }\n\n /* A direct video starts from the click on its thumbnail, with its sound.\n It used to be <video autoplay> without muted, which a browser is free to\n refuse -- most do for a video with sound -- and iOS played it full screen\n besides. play() is called from the click's own task, which is the user\n activation that lets unmuted playback start everywhere; if it is refused\n anyway, the poster and the controls are still there. */\n _playOnOpen() {\n const video = this.renderRoot?.querySelector(\"video\");\n video?.play().catch(() => {});\n }\n\n /**\n * Closing destroys the close button the same way, so focus returns to the\n * thumbnail it came from.\n */\n _closeVideo() {\n this._open = false;\n this.updateComplete.then(() => {\n this.renderRoot?.querySelector<HTMLButtonElement>(\".bd-video-thumb\")?.focus();\n });\n }\n\n /* Behind a thumbnail the video is the thumbnail's click (see\n _playOnOpen), so it never autoplays and keeps the thumbnail as its\n poster. Without one it starts on its own, which a browser allows only\n muted and inline -- and not at all under prefers-reduced-motion, where it\n waits for its play button. Behind a thumbnail preload is \"none\": the\n poster is the picture, and nothing is fetched before playback is asked\n for. Without one it is \"metadata\", or a video held still under reduced\n motion would be an empty box with controls -- no first frame, no\n duration -- until it was played. muted is the property as well as the\n attribute, because the attribute is only read when the element is\n parsed, never when a template sets it. */\n _renderVideo() {\n const autoplay = !this.thumb &&\n !window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n return html`\n <video\n src=\"${this.src}\"\n poster=\"${this.thumb || nothing}\"\n controls\n playsinline\n preload=\"${this.thumb ? \"none\" : \"metadata\"}\"\n ?autoplay=${autoplay}\n ?muted=${autoplay}\n .muted=${autoplay}\n ></video>\n `;\n }\n\n render() {\n if (!this.thumb || this._open) {\n return html`\n <div class=\"bd-video-player\">\n ${this._isYoutube()\n ? html`\n <iframe\n src=\"${this._embedSrc}\"\n title=\"${this.videoTitle || \"Video player\"}\"\n loading=\"lazy\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\"\n referrerpolicy=\"strict-origin-when-cross-origin\"\n allowfullscreen\n ></iframe>\n `\n : this._renderVideo()}\n ${this.thumb\n ? html`\n <button\n class=\"bd-video-close\"\n @click=${this._closeVideo}\n aria-label=\"Close video\"\n >\n <bd-close-icon size=\"xs\" aria-hidden=\"true\"></bd-close-icon>\n </button>\n `\n : \"\"}\n </div>\n `;\n }\n\n return html`\n <button\n class=\"bd-video-thumb\"\n @click=${this._openVideo}\n aria-label=\"Play video\"\n >\n <img\n src=\"${this.thumb}\"\n alt=\"${this.thumbAlt || 'Video preview'}\"\n loading=\"lazy\"\n />\n <span class=\"bd-video-play-btn\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 64 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"32\" cy=\"32\" r=\"32\" fill=\"white\" fill-opacity=\"0.9\"/>\n <path d=\"M26 20L46 32L26 44V20Z\" fill=\"var(--color-brand-500)\"/>\n </svg>\n </span>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-video-player\": BdVideoPlayer;\n }\n}\n"],"mappings":"A,yVAQA,IACMI,EADN,cAC4BC,CAAW,C,8BAI/B,KAAA,IAAA,GAEE,KAAA,MAAA,GAEG,KAAA,SAAA,GAKE,KAAA,WAAA,GAEL,KAAA,MAAA,E,QAdQ,KAAA,OAAA,CAACL,CAAc,C,CAgB/B,YAAa,CACX,OAAO,KAAK,IAAI,SAAS,aAAa,GAAK,KAAK,IAAI,SAAS,UAAU,CACzE,CAOA,IAAI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AA,UAAA,MAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAS,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,QAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAS,EAAS,CAAE,KAAM,OAAQ,UAAW,WAAY,CAAC,CAAA,EAAAN,EAAA,UAAA,WAAA,IAAA,EAAA,EAKjDH,EAAA,CAAAS,EAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,CAAC,CAAA,EAAAN,EAAA,UAAA,aAAA,IAAA,EAAA,EAEnDH,EAAA,CAAAU,EAAM,CAAA,EAAAP,EAAA,UAAA,QAAA,IAAA,EAAA,EAfR,EAAAH,EAAA,CAAAW,EAAc,iBAAiB,CAAA,EAAAR,CAAA"}
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
/** Styled entirely from design tokens — see npm run lint:tokens. */
|
|
3
|
-
export const visuallyHiddenCSS = css `
|
|
4
|
-
/* Removed from view but kept in the accessibility tree. Not display:none,
|
|
5
|
-
which would remove it from the tree as well. */
|
|
6
|
-
:host {
|
|
7
|
-
position: absolute;
|
|
8
|
-
/* no token: 1px is the clip idiom's own measure, not a border. It was
|
|
9
|
-
spelled --border-width-1, which resolves to the same pixel and reads as
|
|
10
|
-
a category error — the lint already sanctions the literal here, as it
|
|
11
|
-
does the -1px below. */
|
|
12
|
-
width: 1px;
|
|
13
|
-
height: 1px;
|
|
14
|
-
margin: -1px;
|
|
15
|
-
padding: 0;
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
clip-path: inset(50%);
|
|
18
|
-
white-space: nowrap;
|
|
19
|
-
border: 0;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
export default visuallyHiddenCSS;
|
|
1
|
+
import{css as e}from"lit";var t=e`:host{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}`;export{t as default,t as visuallyHiddenCSS};
|
|
23
2
|
//# sourceMappingURL=visually-hidden.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visually-hidden.css.js","
|
|
1
|
+
{"version":3,"file":"visually-hidden.css.js","names":["visuallyHiddenCSS"],"sources":["../../../../src/components/visually-hidden/visually-hidden.css.ts"],"sourcesContent":["import { css } from 'lit';\n\n/** Styled entirely from design tokens — see npm run lint:tokens. */\nexport const visuallyHiddenCSS = css`\n /* Removed from view but kept in the accessibility tree. Not display:none,\n which would remove it from the tree as well. */\n :host {\n position: absolute;\n /* no token: 1px is the clip idiom's own measure, not a border. It was\n spelled --border-width-1, which resolves to the same pixel and reads as\n a category error — the lint already sanctions the literal here, as it\n does the -1px below. */\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n`;\n\nexport default visuallyHiddenCSS;\n"],"mappings":"A,0BAGA,IAAaA,EAAoB,CAAG,uI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LitElement } from
|
|
2
|
-
import
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "../../tokens/tokens.js";
|
|
3
3
|
export declare class BdVisuallyHidden extends LitElement {
|
|
4
4
|
static styles: import("lit").CSSResult[];
|
|
5
5
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
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 { LitElement, html } from 'lit';
|
|
8
|
-
import { defineElement } from "../shared/define-element.js";
|
|
9
|
-
// Installs the design tokens into document scope; see src/tokens/tokens.ts
|
|
10
|
-
import "../../tokens/tokens.js";
|
|
11
|
-
import { visuallyHiddenCSS } from "./visually-hidden.css.js";
|
|
12
|
-
let BdVisuallyHidden = class BdVisuallyHidden extends LitElement {
|
|
13
|
-
static { this.styles = [visuallyHiddenCSS]; }
|
|
14
|
-
render() {
|
|
15
|
-
return html `
|
|
1
|
+
import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import t from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import n from"./visually-hidden.css.js";import{LitElement as r,html as i}from"lit";var a=class extends r{static{this.styles=[n]}render(){return i`
|
|
16
2
|
<slot></slot>
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
BdVisuallyHidden = __decorate([
|
|
21
|
-
defineElement('bd-visually-hidden')
|
|
22
|
-
], BdVisuallyHidden);
|
|
23
|
-
export { BdVisuallyHidden };
|
|
3
|
+
`}};a=t([e(`bd-visually-hidden`)],a);export{a as BdVisuallyHidden};
|
|
24
4
|
//# sourceMappingURL=visually-hidden.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visually-hidden.js","
|
|
1
|
+
{"version":3,"file":"visually-hidden.js","names":["_decorate","__decorate","visuallyHiddenCSS","BdVisuallyHidden","LitElement","defineElement"],"sources":["../../../../src/components/visually-hidden/visually-hidden.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { defineElement } from '#shared/define-element.ts';\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport '#tokens/tokens.ts';\nimport { visuallyHiddenCSS } from './visually-hidden.css.ts';\n\n@defineElement('bd-visually-hidden')\nexport class BdVisuallyHidden extends LitElement {\n static styles = [visuallyHiddenCSS];\n\n render() {\n return html`\n <slot></slot>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bd-visually-hidden': BdVisuallyHidden;\n }\n}\n"],"mappings":"A,wPAOO,IAAMG,EAAN,cAA+BC,CAAW,C,OAC/B,KAAA,OAAA,CAACF,CAAiB,C,CAElC,QAAS,CACP,MAAO,EAAI;;KAGb,CACF,EATC,EAAAF,EAAA,CAAAK,EAAc,oBAAoB,CAAA,EAAAF,CAAA,E"}
|
|
@@ -1,170 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Why a block per brand has to re-declare tokens, rather than only the values
|
|
6
|
-
* the brand changes:
|
|
7
|
-
*
|
|
8
|
-
* A custom property that reads another one is resolved where it is declared,
|
|
9
|
-
* and every element below inherits the finished value. The tokens are declared
|
|
10
|
-
* on :root, so --color-action-primary is worked out once, there, from
|
|
11
|
-
* --color-brand-500. A wrapper that overrides --color-brand-500 alone changes
|
|
12
|
-
* nothing below it -- every token that reads it was already resolved upstream.
|
|
13
|
-
* This was measured, not assumed: overriding --color-action-primary on a
|
|
14
|
-
* wrapper left a bd-button blue, because the button reads
|
|
15
|
-
* --button-primary-background-default, which :root had already resolved.
|
|
16
|
-
*
|
|
17
|
-
* So a brand's block re-declares the tokens it overrides, and also every token
|
|
18
|
-
* that depends on them, directly or through any number of hops. Those
|
|
19
|
-
* re-declarations re-resolve inside the brand's scope. Tokens that depend on
|
|
20
|
-
* nothing a brand touches are left out: their :root values are already right
|
|
21
|
-
* under every brand.
|
|
22
|
-
*
|
|
23
|
-
* Every block declares the same set of names -- the union of everything any
|
|
24
|
-
* brand overrides, plus all of their dependents -- taking the brand's own value
|
|
25
|
-
* where it has one and the default where it does not. That is what makes nesting
|
|
26
|
-
* safe: an inner brand restates every brandable token, so nothing an outer brand
|
|
27
|
-
* changed can leak through it. data-brand="bitdefender" inside another brand
|
|
28
|
-
* returns to the foundation.
|
|
29
|
-
*
|
|
30
|
-
* This module has no imports and only erasable types, because two places call
|
|
31
|
-
* it and they must not disagree: tokens.ts, which installs the tokens at runtime
|
|
32
|
-
* when any component is imported, and scripts/build-tokens.mjs, which writes
|
|
33
|
-
* tokens.css. Both pass the same declaration text.
|
|
34
|
-
*
|
|
35
|
-
* With only the Bitdefender theme registered, nothing is overridden, so this
|
|
36
|
-
* returns an empty string and neither output changes.
|
|
37
|
-
*/
|
|
38
|
-
/** A brand name has to be safe inside [data-brand="..."] without escaping. */
|
|
39
|
-
const NAME = /^[a-z][a-z0-9-]*$/;
|
|
40
|
-
/** Token name -> value, in declaration order, with comments removed. */
|
|
41
|
-
export function parseDeclarations(text) {
|
|
42
|
-
const body = text.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
43
|
-
const map = new Map();
|
|
44
|
-
for (const m of body.matchAll(/(--[A-Za-z0-9-]+)\s*:\s*([^;]+);/g)) {
|
|
45
|
-
map.set(m[1], m[2].trim().replace(/\s+/g, ' '));
|
|
46
|
-
}
|
|
47
|
-
return map;
|
|
48
|
-
}
|
|
49
|
-
/** The tokens a value reads, e.g. color-mix(... var(--a) ...) -> ['--a']. */
|
|
50
|
-
const reads = (value) => [...value.matchAll(/var\(\s*(--[A-Za-z0-9-]+)/g)].map(m => m[1]);
|
|
51
|
-
/**
|
|
52
|
-
* Every token that reads any of `seeds`, directly or through other tokens.
|
|
53
|
-
* Excludes the seeds themselves.
|
|
54
|
-
*/
|
|
55
|
-
export function dependentsOf(seeds, declarations) {
|
|
56
|
-
const readers = new Map(); // token -> tokens that read it
|
|
57
|
-
for (const [name, value] of declarations) {
|
|
58
|
-
for (const r of reads(value)) {
|
|
59
|
-
if (!readers.has(r))
|
|
60
|
-
readers.set(r, new Set());
|
|
61
|
-
readers.get(r).add(name);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const out = new Set();
|
|
65
|
-
const queue = [...seeds];
|
|
66
|
-
while (queue.length) {
|
|
67
|
-
for (const reader of readers.get(queue.shift()) ?? []) {
|
|
68
|
-
if (seeds.has(reader) || out.has(reader))
|
|
69
|
-
continue;
|
|
70
|
-
out.add(reader);
|
|
71
|
-
queue.push(reader);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* The [data-brand] blocks for `brands`, as CSS text to place inside the
|
|
78
|
-
* bd-tokens layer after the :root block. Returns '' when no brand overrides
|
|
79
|
-
* anything.
|
|
80
|
-
*
|
|
81
|
-
* Throws on a brand name that is not a plain lowercase identifier, and on an
|
|
82
|
-
* override of a token that :root does not declare -- a misspelt token would
|
|
83
|
-
* otherwise be a silent no-op, and a brand that quietly renders as blue is the
|
|
84
|
-
* failure this layer exists to prevent.
|
|
85
|
-
*/
|
|
86
|
-
export function brandLayer(declarationText, brands) {
|
|
87
|
-
const declarations = parseDeclarations(declarationText);
|
|
88
|
-
const overridden = new Set();
|
|
89
|
-
for (const [brand, overrides] of Object.entries(brands)) {
|
|
90
|
-
if (!NAME.test(brand)) {
|
|
91
|
-
throw new Error(`brand "${brand}": use lowercase letters, digits and hyphens`);
|
|
92
|
-
}
|
|
93
|
-
for (const token of Object.keys(overrides)) {
|
|
94
|
-
if (!declarations.has(token)) {
|
|
95
|
-
throw new Error(`brand "${brand}" overrides ${token}, which no token declares`);
|
|
96
|
-
}
|
|
97
|
-
overridden.add(token);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (overridden.size === 0)
|
|
101
|
-
return '';
|
|
102
|
-
const dependents = dependentsOf(overridden, declarations);
|
|
103
|
-
// :root order, so a block reads like the token file it came from
|
|
104
|
-
const names = [...declarations.keys()].filter(n => overridden.has(n) || dependents.has(n));
|
|
105
|
-
return Object.entries(brands).map(([brand, overrides]) => {
|
|
106
|
-
const lines = names.map(n => ` ${n}: ${overrides[n] ?? declarations.get(n)};`);
|
|
107
|
-
return ` [data-brand="${brand}"] {\n${lines.join('\n')}\n }`;
|
|
108
|
-
})
|
|
109
|
-
.join('\n\n');
|
|
110
|
-
}
|
|
111
|
-
/** Flatten one theme to {token: value}, refusing anything outside the contract. */
|
|
112
|
-
export function flattenTheme(name, theme, contract) {
|
|
113
|
-
const flat = {};
|
|
114
|
-
for (const [group, values] of Object.entries(theme ?? {})) {
|
|
115
|
-
if (!(group in contract)) {
|
|
116
|
-
throw new Error(`theme "${name}": "${group}" is not themable -- a theme sets ${Object.keys(contract).join(' and ')} only`);
|
|
117
|
-
}
|
|
118
|
-
for (const [token, value] of Object.entries(values)) {
|
|
119
|
-
if (!contract[group].includes(token)) {
|
|
120
|
-
throw new Error(`theme "${name}" sets ${token}, which the ${group} contract does not list -- see src/tokens/themes/contract.ts`);
|
|
121
|
-
}
|
|
122
|
-
flat[token] = String(value);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return flat;
|
|
126
|
-
}
|
|
127
|
-
/** The [data-brand] blocks for a set of themes. '' while only the default exists. */
|
|
128
|
-
export function themeLayer(declarationText, themes, contract, defaultTheme) {
|
|
129
|
-
if (!(defaultTheme in themes))
|
|
130
|
-
throw new Error(`the default theme "${defaultTheme}" is not registered`);
|
|
131
|
-
const declarations = parseDeclarations(declarationText);
|
|
132
|
-
const same = (a, b) => String(a).trim()
|
|
133
|
-
.replace(/\s+/g, ' ') === String(b).trim()
|
|
134
|
-
.replace(/\s+/g, ' ');
|
|
135
|
-
const brands = {};
|
|
136
|
-
for (const [name, theme] of Object.entries(themes)) {
|
|
137
|
-
const flat = flattenTheme(name, theme, contract);
|
|
138
|
-
brands[name] = name === defaultTheme
|
|
139
|
-
? {}
|
|
140
|
-
: Object.fromEntries(Object.entries(flat).filter(([t, v]) => !declarations.has(t) || !same(v, declarations.get(t))));
|
|
141
|
-
}
|
|
142
|
-
return brandLayer(declarationText, brands);
|
|
143
|
-
}
|
|
144
|
-
/** The source of the generated default theme: every contract token at the
|
|
145
|
-
foundation's own value. build-tokens writes it to themes/bitdefender.ts. */
|
|
146
|
-
export function defaultThemeSource(declarationText, contract) {
|
|
147
|
-
const declarations = parseDeclarations(declarationText);
|
|
148
|
-
const groups = Object.entries(contract).map(([group, tokens]) => {
|
|
149
|
-
const width = Math.max(...tokens.map(t => t.length + 2));
|
|
150
|
-
const lines = tokens.map((t, i) => {
|
|
151
|
-
if (!declarations.has(t))
|
|
152
|
-
throw new Error(`contract lists ${t}, which no token declares`);
|
|
153
|
-
const key = `'${t}'`.padEnd(width);
|
|
154
|
-
const value = declarations.get(t).replace(/'/g, "\\'");
|
|
155
|
-
return ` ${key}: '${value}'${i < tokens.length - 1 ? ',' : ''}`;
|
|
156
|
-
});
|
|
157
|
-
return ` ${group}: {\n${lines.join('\n')}\n }`;
|
|
158
|
-
});
|
|
159
|
-
return `/* AUTO-GENERATED from src/tokens/tokens.ts by \`npm run build:tokens\` -- do not edit.
|
|
1
|
+
var e=/^[a-z][a-z0-9-]*$/;function t(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,``),n=/* @__PURE__ */ new Map;for(let e of t.matchAll(/(--[A-Za-z0-9-]+)\s*:\s*([^;]+);/g))n.set(e[1],e[2].trim().replace(/\s+/g,` `));return n}var n=e=>[...e.matchAll(/var\(\s*(--[A-Za-z0-9-]+)/g)].map(e=>e[1]);function r(e,t){let r=/* @__PURE__ */ new Map;for(let[e,i]of t)for(let t of n(i))r.has(t)||r.set(t,/* @__PURE__ */ new Set),r.get(t).add(e);let i=/* @__PURE__ */ new Set,a=[...e];for(;a.length;)for(let t of r.get(a.shift())??[])e.has(t)||i.has(t)||(i.add(t),a.push(t));return i}function i(n,i){let a=t(n),o=/* @__PURE__ */ new Set;for(let[t,n]of Object.entries(i)){if(!e.test(t))throw Error(`brand "${t}": use lowercase letters, digits and hyphens`);for(let e of Object.keys(n)){if(!a.has(e))throw Error(`brand "${t}" overrides ${e}, which no token declares`);o.add(e)}}if(o.size===0)return``;let s=r(o,a),c=[...a.keys()].filter(e=>o.has(e)||s.has(e));return Object.entries(i).map(([e,t])=>` [data-brand="${e}"] {\n${c.map(e=>` ${e}: ${t[e]??a.get(e)};`).join(`
|
|
2
|
+
`)}\n }`).join(`
|
|
3
|
+
|
|
4
|
+
`)}function a(e,t,n){let r={};for(let[i,a]of Object.entries(t??{})){if(!(i in n))throw Error(`theme "${e}": "${i}" is not themable -- a theme sets ${Object.keys(n).join(` and `)} only`);for(let[t,o]of Object.entries(a)){if(!n[i].includes(t))throw Error(`theme "${e}" sets ${t}, which the ${i} contract does not list -- see src/tokens/themes/contract.ts`);r[t]=String(o)}}return r}function o(e,n,r,o){if(!(o in n))throw Error(`the default theme "${o}" is not registered`);let s=t(e),c=(e,t)=>String(e).trim().replace(/\s+/g,` `)===String(t).trim().replace(/\s+/g,` `),l={};for(let[e,t]of Object.entries(n)){let n=a(e,t,r);l[e]=e===o?{}:Object.fromEntries(Object.entries(n).filter(([e,t])=>!s.has(e)||!c(t,s.get(e))))}return i(e,l)}function s(e,n){let r=t(e);return`/* AUTO-GENERATED from src/tokens/tokens.ts by \`npm run build:tokens\` -- do not edit.
|
|
160
5
|
|
|
161
6
|
The Bitdefender theme: the default, and the one every partner theme starts
|
|
162
7
|
from. It states the foundation's own value for every token the theme
|
|
163
8
|
contract lists. Change Bitdefender in tokens.ts; start a partner theme from
|
|
164
9
|
this one as src/tokens/themes/index.ts describes. */
|
|
165
10
|
export default {
|
|
166
|
-
${
|
|
11
|
+
${Object.entries(n).map(([e,t])=>{let n=Math.max(...t.map(e=>e.length+2));return` ${e}: {\n${t.map((e,i)=>{if(!r.has(e))throw Error(`contract lists ${e}, which no token declares`);return` ${`'${e}'`.padEnd(n)}: '${r.get(e).replace(/'/g,`\\'`)}'${i<t.length-1?`,`:``}`}).join(`
|
|
12
|
+
`)}\n }`}).join(`,
|
|
13
|
+
`)}
|
|
167
14
|
};
|
|
168
|
-
|
|
169
|
-
}
|
|
15
|
+
`}export{i as brandLayer,s as defaultThemeSource,r as dependentsOf,a as flattenTheme,t as parseDeclarations,o as themeLayer};
|
|
170
16
|
//# sourceMappingURL=brand-layer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-layer.js","sourceRoot":"","sources":["../../../src/tokens/brand-layer.ts"],"names":[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M,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACrE,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,KAAK,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,OAAO;;;;;;;EAOP,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;;CAEnB,CAAC;AACF,CAAC","sourcesContent":["/**\n * The brand layer: one [data-brand] block per brand theme, generated from the\n * token declarations and the themes in src/tokens/themes/.\n *\n * Why a block per brand has to re-declare tokens, rather than only the values\n * the brand changes:\n *\n * A custom property that reads another one is resolved where it is declared,\n * and every element below inherits the finished value. The tokens are declared\n * on :root, so --color-action-primary is worked out once, there, from\n * --color-brand-500. A wrapper that overrides --color-brand-500 alone changes\n * nothing below it -- every token that reads it was already resolved upstream.\n * This was measured, not assumed: overriding --color-action-primary on a\n * wrapper left a bd-button blue, because the button reads\n * --button-primary-background-default, which :root had already resolved.\n *\n * So a brand's block re-declares the tokens it overrides, and also every token\n * that depends on them, directly or through any number of hops. Those\n * re-declarations re-resolve inside the brand's scope. Tokens that depend on\n * nothing a brand touches are left out: their :root values are already right\n * under every brand.\n *\n * Every block declares the same set of names -- the union of everything any\n * brand overrides, plus all of their dependents -- taking the brand's own value\n * where it has one and the default where it does not. That is what makes nesting\n * safe: an inner brand restates every brandable token, so nothing an outer brand\n * changed can leak through it. data-brand=\"bitdefender\" inside another brand\n * returns to the foundation.\n *\n * This module has no imports and only erasable types, because two places call\n * it and they must not disagree: tokens.ts, which installs the tokens at runtime\n * when any component is imported, and scripts/build-tokens.mjs, which writes\n * tokens.css. Both pass the same declaration text.\n *\n * With only the Bitdefender theme registered, nothing is overridden, so this\n * returns an empty string and neither output changes.\n */\n\n/** A brand name has to be safe inside [data-brand=\"...\"] without escaping. */\nconst NAME = /^[a-z][a-z0-9-]*$/;\n\n/** Token name -> value, in declaration order, with comments removed. */\nexport function parseDeclarations(text: string) {\n const body = text.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n const map = new Map<string, string>();\n for (const m of body.matchAll(/(--[A-Za-z0-9-]+)\\s*:\\s*([^;]+);/g)) {\n map.set(m[1], m[2].trim().replace(/\\s+/g, ' '));\n }\n return map;\n}\n\n/** The tokens a value reads, e.g. color-mix(... var(--a) ...) -> ['--a']. */\nconst reads = (value: string) => [...value.matchAll(/var\\(\\s*(--[A-Za-z0-9-]+)/g)].map(m => m[1]);\n\n/**\n * Every token that reads any of `seeds`, directly or through other tokens.\n * Excludes the seeds themselves.\n */\nexport function dependentsOf(seeds: ReadonlySet<string>, declarations: ReadonlyMap<string, string>) {\n const readers = new Map<string, Set<string>>(); // token -> tokens that read it\n for (const [name, value] of declarations) {\n for (const r of reads(value)) {\n if (!readers.has(r)) readers.set(r, new Set());\n readers.get(r)!.add(name);\n }\n }\n const out = new Set<string>();\n const queue = [...seeds];\n while (queue.length) {\n for (const reader of readers.get(queue.shift()!) ?? []) {\n if (seeds.has(reader) || out.has(reader)) continue;\n out.add(reader);\n queue.push(reader);\n }\n }\n return out;\n}\n\n/**\n * The [data-brand] blocks for `brands`, as CSS text to place inside the\n * bd-tokens layer after the :root block. Returns '' when no brand overrides\n * anything.\n *\n * Throws on a brand name that is not a plain lowercase identifier, and on an\n * override of a token that :root does not declare -- a misspelt token would\n * otherwise be a silent no-op, and a brand that quietly renders as blue is the\n * failure this layer exists to prevent.\n */\nexport function brandLayer(declarationText: string, brands: Record<string, Record<string, string>>) {\n const declarations = parseDeclarations(declarationText);\n\n const overridden = new Set<string>();\n for (const [brand, overrides] of Object.entries(brands)) {\n if (!NAME.test(brand)) {\n throw new Error(`brand \"${brand}\": use lowercase letters, digits and hyphens`);\n }\n for (const token of Object.keys(overrides)) {\n if (!declarations.has(token)) {\n throw new Error(`brand \"${brand}\" overrides ${token}, which no token declares`);\n }\n overridden.add(token);\n }\n }\n if (overridden.size === 0) return '';\n\n const dependents = dependentsOf(overridden, declarations);\n // :root order, so a block reads like the token file it came from\n const names = [...declarations.keys()].filter(n => overridden.has(n) || dependents.has(n));\n\n return Object.entries(brands).map(([brand, overrides]) => {\n const lines = names.map(n => ` ${n}: ${overrides[n] ?? declarations.get(n)};`);\n return ` [data-brand=\"${brand}\"] {\\n${lines.join('\\n')}\\n }`;\n })\n .join('\\n\\n');\n}\n\n/* ---------- themes ------------------------------------------------------\n\n A theme is { colour: {token: value}, shape: {token: value} }, the groups and\n tokens named in src/tokens/themes/contract.ts. The default theme is the\n foundation itself, so it contributes no overrides; every other theme\n contributes the values that differ from the foundation. A value a partner\n inherited from the default by spreading it is equal, so it drops out here\n and the partner's block carries only what it actually changed (and what\n reads that). */\n\n/** Group -> the tokens a theme may set in it, as themes/contract.ts lists them. */\nexport type ThemeContract = Record<string, readonly string[]>;\n\n/** Group -> {token: value}. */\nexport type Theme = Record<string, Record<string, string>>;\n\n/** Flatten one theme to {token: value}, refusing anything outside the contract. */\nexport function flattenTheme(name: string, theme: Theme, contract: ThemeContract) {\n const flat: Record<string, string> = {};\n for (const [group, values] of Object.entries(theme ?? {})) {\n if (!(group in contract)) {\n throw new Error(`theme \"${name}\": \"${group}\" is not themable -- a theme sets ${Object.keys(contract).join(' and ')} only`);\n }\n for (const [token, value] of Object.entries(values)) {\n if (!contract[group].includes(token)) {\n throw new Error(`theme \"${name}\" sets ${token}, which the ${group} contract does not list -- see src/tokens/themes/contract.ts`);\n }\n flat[token] = String(value);\n }\n }\n return flat;\n}\n\n/** The [data-brand] blocks for a set of themes. '' while only the default exists. */\nexport function themeLayer(declarationText: string, themes: Record<string, Theme>, contract: ThemeContract, defaultTheme: string) {\n if (!(defaultTheme in themes)) throw new Error(`the default theme \"${defaultTheme}\" is not registered`);\n const declarations = parseDeclarations(declarationText);\n const same = (a: string, b: string | undefined) => String(a).trim()\n .replace(/\\s+/g, ' ') === String(b).trim()\n .replace(/\\s+/g, ' ');\n const brands: Record<string, Record<string, string>> = {};\n for (const [name, theme] of Object.entries(themes)) {\n const flat = flattenTheme(name, theme, contract);\n brands[name] = name === defaultTheme\n ? {}\n : Object.fromEntries(Object.entries(flat).filter(([t, v]) => !declarations.has(t) || !same(v, declarations.get(t))));\n }\n return brandLayer(declarationText, brands);\n}\n\n/** The source of the generated default theme: every contract token at the\n foundation's own value. build-tokens writes it to themes/bitdefender.ts. */\nexport function defaultThemeSource(declarationText: string, contract: ThemeContract) {\n const declarations = parseDeclarations(declarationText);\n const groups = Object.entries(contract).map(([group, tokens]) => {\n const width = Math.max(...tokens.map(t => t.length + 2));\n const lines = tokens.map((t, i) => {\n if (!declarations.has(t)) throw new Error(`contract lists ${t}, which no token declares`);\n const key = `'${t}'`.padEnd(width);\n const value = declarations.get(t)!.replace(/'/g, \"\\\\'\");\n return ` ${key}: '${value}'${i < tokens.length - 1 ? ',' : ''}`;\n });\n return ` ${group}: {\\n${lines.join('\\n')}\\n }`;\n });\n return `/* AUTO-GENERATED from src/tokens/tokens.ts by \\`npm run build:tokens\\` -- do not edit.\n\n The Bitdefender theme: the default, and the one every partner theme starts\n from. It states the foundation's own value for every token the theme\n contract lists. Change Bitdefender in tokens.ts; start a partner theme from\n this one as src/tokens/themes/index.ts describes. */\nexport default {\n${groups.join(',\\n')}\n};\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"brand-layer.js","names":["NAME","parseDeclarations","body","text","map","m","reads","value","dependentsOf","readers","name","declarations","r","out","queue","seeds","reader","brandLayer","declarationText","overridden","brand","overrides","brands","token","dependents","names","n","flattenTheme","flat","group","values","theme","contract","themeLayer","defaultTheme","themes","same","a","b","t","v","defaultThemeSource","tokens","width"],"sources":["../../../src/tokens/brand-layer.ts"],"sourcesContent":["/**\n * The brand layer: one [data-brand] block per brand theme, generated from the\n * token declarations and the themes in src/tokens/themes/.\n *\n * Why a block per brand has to re-declare tokens, rather than only the values\n * the brand changes:\n *\n * A custom property that reads another one is resolved where it is declared,\n * and every element below inherits the finished value. The tokens are declared\n * on :root, so --color-action-primary is worked out once, there, from\n * --color-brand-500. A wrapper that overrides --color-brand-500 alone changes\n * nothing below it -- every token that reads it was already resolved upstream.\n * This was measured, not assumed: overriding --color-action-primary on a\n * wrapper left a bd-button blue, because the button reads\n * --button-primary-background-default, which :root had already resolved.\n *\n * So a brand's block re-declares the tokens it overrides, and also every token\n * that depends on them, directly or through any number of hops. Those\n * re-declarations re-resolve inside the brand's scope. Tokens that depend on\n * nothing a brand touches are left out: their :root values are already right\n * under every brand.\n *\n * Every block declares the same set of names -- the union of everything any\n * brand overrides, plus all of their dependents -- taking the brand's own value\n * where it has one and the default where it does not. That is what makes nesting\n * safe: an inner brand restates every brandable token, so nothing an outer brand\n * changed can leak through it. data-brand=\"bitdefender\" inside another brand\n * returns to the foundation.\n *\n * This module has no imports and only erasable types, because two places call\n * it and they must not disagree: tokens.ts, which installs the tokens at runtime\n * when any component is imported, and scripts/build-tokens.mjs, which writes\n * tokens.css. Both pass the same declaration text.\n *\n * With only the Bitdefender theme registered, nothing is overridden, so this\n * returns an empty string and neither output changes.\n */\n\n/** A brand name has to be safe inside [data-brand=\"...\"] without escaping. */\nconst NAME = /^[a-z][a-z0-9-]*$/;\n\n/** Token name -> value, in declaration order, with comments removed. */\nexport function parseDeclarations(text: string) {\n const body = text.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n const map = new Map<string, string>();\n for (const m of body.matchAll(/(--[A-Za-z0-9-]+)\\s*:\\s*([^;]+);/g)) {\n map.set(m[1], m[2].trim().replace(/\\s+/g, ' '));\n }\n return map;\n}\n\n/** The tokens a value reads, e.g. color-mix(... var(--a) ...) -> ['--a']. */\nconst reads = (value: string) => [...value.matchAll(/var\\(\\s*(--[A-Za-z0-9-]+)/g)].map(m => m[1]);\n\n/**\n * Every token that reads any of `seeds`, directly or through other tokens.\n * Excludes the seeds themselves.\n */\nexport function dependentsOf(seeds: ReadonlySet<string>, declarations: ReadonlyMap<string, string>) {\n const readers = new Map<string, Set<string>>(); // token -> tokens that read it\n for (const [name, value] of declarations) {\n for (const r of reads(value)) {\n if (!readers.has(r)) readers.set(r, new Set());\n readers.get(r)!.add(name);\n }\n }\n const out = new Set<string>();\n const queue = [...seeds];\n while (queue.length) {\n for (const reader of readers.get(queue.shift()!) ?? []) {\n if (seeds.has(reader) || out.has(reader)) continue;\n out.add(reader);\n queue.push(reader);\n }\n }\n return out;\n}\n\n/**\n * The [data-brand] blocks for `brands`, as CSS text to place inside the\n * bd-tokens layer after the :root block. Returns '' when no brand overrides\n * anything.\n *\n * Throws on a brand name that is not a plain lowercase identifier, and on an\n * override of a token that :root does not declare -- a misspelt token would\n * otherwise be a silent no-op, and a brand that quietly renders as blue is the\n * failure this layer exists to prevent.\n */\nexport function brandLayer(declarationText: string, brands: Record<string, Record<string, string>>) {\n const declarations = parseDeclarations(declarationText);\n\n const overridden = new Set<string>();\n for (const [brand, overrides] of Object.entries(brands)) {\n if (!NAME.test(brand)) {\n throw new Error(`brand \"${brand}\": use lowercase letters, digits and hyphens`);\n }\n for (const token of Object.keys(overrides)) {\n if (!declarations.has(token)) {\n throw new Error(`brand \"${brand}\" overrides ${token}, which no token declares`);\n }\n overridden.add(token);\n }\n }\n if (overridden.size === 0) return '';\n\n const dependents = dependentsOf(overridden, declarations);\n // :root order, so a block reads like the token file it came from\n const names = [...declarations.keys()].filter(n => overridden.has(n) || dependents.has(n));\n\n return Object.entries(brands).map(([brand, overrides]) => {\n const lines = names.map(n => ` ${n}: ${overrides[n] ?? declarations.get(n)};`);\n return ` [data-brand=\"${brand}\"] {\\n${lines.join('\\n')}\\n }`;\n })\n .join('\\n\\n');\n}\n\n/* ---------- themes ------------------------------------------------------\n\n A theme is { colour: {token: value}, shape: {token: value} }, the groups and\n tokens named in src/tokens/themes/contract.ts. The default theme is the\n foundation itself, so it contributes no overrides; every other theme\n contributes the values that differ from the foundation. A value a partner\n inherited from the default by spreading it is equal, so it drops out here\n and the partner's block carries only what it actually changed (and what\n reads that). */\n\n/** Group -> the tokens a theme may set in it, as themes/contract.ts lists them. */\nexport type ThemeContract = Record<string, readonly string[]>;\n\n/** Group -> {token: value}. */\nexport type Theme = Record<string, Record<string, string>>;\n\n/** Flatten one theme to {token: value}, refusing anything outside the contract. */\nexport function flattenTheme(name: string, theme: Theme, contract: ThemeContract) {\n const flat: Record<string, string> = {};\n for (const [group, values] of Object.entries(theme ?? {})) {\n if (!(group in contract)) {\n throw new Error(`theme \"${name}\": \"${group}\" is not themable -- a theme sets ${Object.keys(contract).join(' and ')} only`);\n }\n for (const [token, value] of Object.entries(values)) {\n if (!contract[group].includes(token)) {\n throw new Error(`theme \"${name}\" sets ${token}, which the ${group} contract does not list -- see src/tokens/themes/contract.ts`);\n }\n flat[token] = String(value);\n }\n }\n return flat;\n}\n\n/** The [data-brand] blocks for a set of themes. '' while only the default exists. */\nexport function themeLayer(declarationText: string, themes: Record<string, Theme>, contract: ThemeContract, defaultTheme: string) {\n if (!(defaultTheme in themes)) throw new Error(`the default theme \"${defaultTheme}\" is not registered`);\n const declarations = parseDeclarations(declarationText);\n const same = (a: string, b: string | undefined) => String(a).trim()\n .replace(/\\s+/g, ' ') === String(b).trim()\n .replace(/\\s+/g, ' ');\n const brands: Record<string, Record<string, string>> = {};\n for (const [name, theme] of Object.entries(themes)) {\n const flat = flattenTheme(name, theme, contract);\n brands[name] = name === defaultTheme\n ? {}\n : Object.fromEntries(Object.entries(flat).filter(([t, v]) => !declarations.has(t) || !same(v, declarations.get(t))));\n }\n return brandLayer(declarationText, brands);\n}\n\n/** The source of the generated default theme: every contract token at the\n foundation's own value. build-tokens writes it to themes/bitdefender.ts. */\nexport function defaultThemeSource(declarationText: string, contract: ThemeContract) {\n const declarations = parseDeclarations(declarationText);\n const groups = Object.entries(contract).map(([group, tokens]) => {\n const width = Math.max(...tokens.map(t => t.length + 2));\n const lines = tokens.map((t, i) => {\n if (!declarations.has(t)) throw new Error(`contract lists ${t}, which no token declares`);\n const key = `'${t}'`.padEnd(width);\n const value = declarations.get(t)!.replace(/'/g, \"\\\\'\");\n return ` ${key}: '${value}'${i < tokens.length - 1 ? ',' : ''}`;\n });\n return ` ${group}: {\\n${lines.join('\\n')}\\n }`;\n });\n return `/* AUTO-GENERATED from src/tokens/tokens.ts by \\`npm run build:tokens\\` -- do not edit.\n\n The Bitdefender theme: the default, and the one every partner theme starts\n from. It states the foundation's own value for every token the theme\n contract lists. Change Bitdefender in tokens.ts; start a partner theme from\n this one as src/tokens/themes/index.ts describes. */\nexport default {\n${groups.join(',\\n')}\n};\n`;\n}\n"],"mappings":"AAuCA,IAAMA,EAAO,oBAGb,SAAgBC,EAAkB,EAAc,CAC9C,IAAMC,EAAOC,EAAK,QAAQ,oBAAqB,EAAE,EAC3CC,kBAAM,IAAI,IAChB,IAAK,IAAMC,KAAKH,EAAK,SAAS,mCAAmC,EAC/DE,EAAI,IAAIC,EAAE,GAAIA,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,OAAQ,GAAG,CAAC,EAEhD,OAAOD,CACT,CAGA,IAAME,EAAS,GAAkB,CAAC,GAAGC,EAAM,SAAS,4BAA4B,CAAC,CAAC,CAAC,IAAI,GAAKF,EAAE,EAAE,EAMhG,SAAgBG,EAAa,EAA4B,EAA2C,CAClG,IAAMC,kBAAU,IAAI,IACpB,IAAK,GAAM,CAACC,EAAMH,KAAUI,EAC1B,IAAK,IAAMC,KAAKN,EAAMC,CAAK,EACpBE,EAAQ,IAAIG,CAAC,GAAGH,EAAQ,IAAIG,kBAAG,IAAI,GAAK,EAC7CH,EAAQ,IAAIG,CAAC,CAAC,CAAE,IAAIF,CAAI,EAG5B,IAAMG,kBAAM,IAAI,IACVC,EAAQ,CAAC,GAAGC,CAAK,EACvB,KAAOD,EAAM,QACX,IAAK,IAAME,KAAUP,EAAQ,IAAIK,EAAM,MAAM,CAAE,GAAK,CAAC,EAC/CC,EAAM,IAAIC,CAAM,GAAKH,EAAI,IAAIG,CAAM,IACvCH,EAAI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