scb-wc 0.1.2 → 0.1.4
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/README.md +194 -164
- package/all.js +91 -5
- package/blazor/CustomEvents.cs +83 -0
- package/blazor/ScbBlazorInteropBase.cs +4460 -1663
- package/blazor/scb-blazor-bridge.js +6827 -2517
- package/blazor/wrappers/ScbAccordion.razor +50 -0
- package/blazor/wrappers/ScbAppBar.razor +95 -0
- package/blazor/wrappers/ScbBreadcrumb.razor +59 -0
- package/blazor/wrappers/ScbCalendar.razor +100 -0
- package/blazor/wrappers/ScbCalendarCard.razor +189 -0
- package/blazor/wrappers/ScbCheckbox.razor +92 -0
- package/blazor/wrappers/ScbCollapse.razor +76 -0
- package/blazor/wrappers/ScbCookiesConsent.razor +106 -0
- package/blazor/wrappers/ScbDatepicker.razor +77 -0
- package/blazor/wrappers/ScbDialog.razor +72 -0
- package/blazor/wrappers/ScbDrawer.razor +64 -0
- package/blazor/wrappers/ScbDropZone.razor +168 -0
- package/blazor/wrappers/ScbDropdown.razor +76 -0
- package/blazor/wrappers/ScbHorizontalScroller.razor +137 -0
- package/blazor/wrappers/ScbList.razor +77 -0
- package/blazor/wrappers/ScbMenu.razor +71 -0
- package/blazor/wrappers/ScbNav.razor +92 -0
- package/blazor/wrappers/ScbNotificationCard.razor +122 -0
- package/blazor/wrappers/ScbOptionsMenu.razor +88 -0
- package/blazor/wrappers/ScbPagination.razor +80 -0
- package/blazor/wrappers/ScbRadioGroup.razor +94 -0
- package/blazor/wrappers/ScbSearch.razor +83 -0
- package/blazor/wrappers/ScbSegmentedButton.razor +85 -0
- package/blazor/wrappers/ScbSelect.razor +79 -0
- package/blazor/wrappers/ScbSlider.razor +96 -0
- package/blazor/wrappers/ScbSnackbar.razor +93 -0
- package/blazor/wrappers/ScbSwitch.razor +92 -0
- package/blazor/wrappers/ScbTable.razor +67 -0
- package/blazor/wrappers/ScbTableAdvanced.razor +78 -0
- package/blazor/wrappers/ScbTabs.razor +55 -0
- package/blazor/wrappers/ScbTextfield.razor +104 -0
- package/blazor/wrappers/ScbTooltip.razor +88 -0
- package/blazor/wrappers/ScbViz.razor +142 -0
- package/demo-data-preview.svg +12 -0
- package/dummy.png +0 -0
- package/fonts/inter/files/inter-latin-wght-italic.woff2 +0 -0
- package/fonts/inter/files/inter-latin-wght-normal.woff2 +0 -0
- package/fonts/material-symbols-outlined/files/material-symbols-outlined-latin-wght-normal.woff2 +0 -0
- package/index.js +91 -1
- package/mvc/components/all.js +90 -1
- package/mvc/components/scb-accordion/scb-accordion-item.js +211 -0
- package/mvc/components/scb-accordion/scb-accordion.js +44 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +166 -0
- package/mvc/components/scb-avatar/scb-avatar.js +111 -0
- package/mvc/components/scb-badge/scb-badge.js +80 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +14 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +96 -0
- package/mvc/components/scb-button/scb-button.js +268 -0
- package/mvc/components/scb-calendar/scb-calendar-event.js +6 -0
- package/mvc/components/scb-calendar/scb-calendar.js +168 -0
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +346 -0
- package/mvc/components/scb-card/scb-card.js +761 -0
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +33 -0
- package/mvc/components/scb-checkbox/scb-checkbox.js +140 -0
- package/mvc/components/scb-chevron/scb-chevron.js +121 -0
- package/mvc/components/scb-chip/scb-chip.js +66 -0
- package/mvc/components/scb-collapse/scb-collapse.js +89 -0
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +78 -0
- package/mvc/components/scb-datepicker/scb-datepicker.js +296 -0
- package/mvc/components/scb-dialog/scb-dialog.js +265 -0
- package/mvc/components/scb-divider/scb-divider.js +69 -0
- package/mvc/components/scb-drawer/scb-drawer.js +128 -0
- package/mvc/components/scb-drop-zone/scb-drop-zone.js +555 -0
- package/mvc/components/scb-dropdown/scb-dropdown.js +306 -0
- package/mvc/components/scb-fab/scb-fab.js +108 -0
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +46 -0
- package/mvc/components/scb-fact-card/scb-fact-card.js +226 -0
- package/mvc/components/scb-footer/scb-footer-section.js +3 -0
- package/mvc/components/scb-footer/scb-footer.js +210 -0
- package/mvc/components/scb-gallery-grid/scb-gallery-grid.js +131 -0
- package/mvc/components/scb-grid/scb-grid-item.js +11 -0
- package/mvc/components/scb-grid/scb-grid.js +98 -0
- package/mvc/components/scb-grid/scb-stack.js +33 -0
- package/mvc/components/scb-header/scb-header-menu-group.js +1 -0
- package/mvc/components/scb-header/scb-header-menu-item.js +5 -0
- package/mvc/components/scb-header/scb-header-tab.js +5 -0
- package/mvc/components/scb-header/scb-header-utility.js +1 -0
- package/mvc/components/scb-header/scb-header.js +681 -0
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +196 -0
- package/mvc/components/scb-icon-button/scb-icon-button.js +171 -0
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +212 -0
- package/mvc/components/scb-link/scb-link.js +61 -0
- package/mvc/components/scb-list/scb-list-item.js +153 -0
- package/mvc/components/scb-list/scb-list.js +26 -0
- package/mvc/components/scb-menu/scb-menu-item.js +205 -0
- package/mvc/components/scb-menu/scb-menu-section.js +42 -0
- package/mvc/components/scb-menu/scb-menu.js +81 -0
- package/mvc/components/scb-menu/scb-sub-menu.js +10 -0
- package/mvc/components/scb-nav/scb-nav-item.js +28 -0
- package/mvc/components/scb-nav/scb-nav.js +104 -0
- package/mvc/components/scb-notification-card/scb-notification-card.js +358 -0
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +66 -0
- package/mvc/components/scb-options-menu/scb-options-menu.js +88 -0
- package/mvc/components/scb-options-menu/scb-options-sub-menu.js +34 -0
- package/mvc/components/scb-overlay/scb-overlay.js +49 -0
- package/mvc/components/scb-pagination/scb-pagination.js +312 -0
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +87 -0
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +147 -0
- package/mvc/components/scb-progress-stepper/scb-progress-stepper.js +62 -0
- package/mvc/components/scb-radio-button/scb-radio-button.js +132 -0
- package/mvc/components/scb-radio-button/scb-radio-group.js +43 -0
- package/mvc/components/scb-scrollspy/scb-scrollspy.js +79 -0
- package/mvc/components/scb-search/scb-search.js +292 -0
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +32 -0
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +74 -0
- package/mvc/components/scb-select/scb-select-option.js +61 -0
- package/mvc/components/scb-select/scb-select.js +284 -0
- package/mvc/components/scb-skeleton/scb-skeleton.js +38 -0
- package/mvc/components/scb-slider/scb-slider.js +27 -0
- package/mvc/components/scb-snackbar/scb-snackbar.js +128 -0
- package/mvc/components/scb-status-pill/scb-status-pill.js +45 -0
- package/mvc/components/scb-stepper/scb-step.js +239 -0
- package/mvc/components/scb-stepper/scb-stepper.js +139 -0
- package/mvc/components/scb-switch/scb-switch.js +59 -0
- package/mvc/components/scb-table/scb-table.js +51 -0
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +76 -0
- package/mvc/components/scb-tabs/scb-primary-tab.js +6 -0
- package/mvc/components/scb-tabs/scb-secondary-tab.js +6 -0
- package/mvc/components/scb-tabs/scb-tabs.js +28 -0
- package/mvc/components/scb-textfield/scb-textfield.js +595 -0
- package/mvc/components/scb-toc/scb-toc-item.js +303 -0
- package/mvc/components/scb-toc/scb-toc.js +19 -0
- package/mvc/components/scb-tooltip/scb-tooltip.js +196 -0
- package/mvc/components/scb-vignette/scb-vignette.js +37 -0
- package/mvc/components/scb-viz/scb-viz-actions-runtime.js +2 -0
- package/mvc/components/scb-viz/scb-viz-print-runtime.js +98 -0
- package/mvc/components/scb-viz/scb-viz-series-differentiation-registry.js +1 -0
- package/mvc/components/scb-viz/scb-viz-series-differentiation-runtime.js +1 -0
- package/mvc/components/scb-viz/scb-viz-table-runtime.js +1 -0
- package/mvc/components/scb-viz/scb-viz.js +1140 -0
- package/mvc/fonts/inter/files/inter-latin-wght-italic.woff2 +0 -0
- package/mvc/fonts/inter/files/inter-latin-wght-normal.woff2 +0 -0
- package/mvc/fonts/material-symbols-outlined/files/material-symbols-outlined-latin-wght-normal.woff2 +0 -0
- package/mvc/scb-blazor-bridge.js +6827 -2517
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb-typography.css +1 -1
- package/mvc/scb-wc.css +3 -2
- package/mvc/scb.svg +13 -13
- package/mvc/vendor/assertClassBrand.js +1 -0
- package/mvc/vendor/classPrivateFieldGet2.js +1 -0
- package/mvc/vendor/decorate.js +1 -0
- package/mvc/vendor/preload-helper.js +1 -0
- package/mvc/vendor/vendor-lit.js +1 -0
- package/mvc/vendor/vendor-material.js +364 -0
- package/mvc/vendor/vendor.js +4 -0
- package/package.json +420 -77
- package/scb-accordion/scb-accordion-item.js +340 -0
- package/scb-accordion/scb-accordion.js +151 -0
- package/scb-app-bar/scb-app-bar.js +317 -0
- package/scb-avatar/scb-avatar.js +197 -0
- package/scb-badge/scb-badge.js +165 -0
- package/scb-breadcrumb/scb-breadcrumb-item.js +62 -0
- package/scb-breadcrumb/scb-breadcrumb.js +255 -0
- package/scb-button/scb-button.js +398 -0
- package/scb-calendar/scb-calendar-event.js +48 -0
- package/scb-calendar/scb-calendar.js +700 -0
- package/scb-calendar-card/scb-calendar-card.js +505 -0
- package/scb-card/scb-card.js +1231 -0
- package/scb-checkbox/scb-checkbox-group.js +104 -0
- package/scb-checkbox/scb-checkbox.js +316 -0
- package/scb-chevron/scb-chevron.js +144 -0
- package/scb-chip/scb-chip.js +234 -0
- package/scb-collapse/scb-collapse.js +231 -0
- package/scb-cookies-consent/scb-cookies-consent.js +164 -0
- package/scb-datepicker/scb-datepicker.js +470 -0
- package/scb-dialog/scb-dialog.js +574 -0
- package/scb-divider/scb-divider.js +119 -0
- package/scb-drawer/scb-drawer.js +297 -0
- package/scb-drop-zone/scb-drop-zone.js +965 -0
- package/scb-dropdown/scb-dropdown.js +598 -0
- package/scb-fab/scb-fab.js +190 -0
- package/scb-fact-card/scb-fact-card-content.js +82 -0
- package/scb-fact-card/scb-fact-card.js +376 -0
- package/scb-footer/scb-footer-section.js +23 -0
- package/scb-footer/scb-footer.js +343 -0
- package/scb-gallery-grid/scb-gallery-grid.js +242 -0
- package/scb-grid/scb-grid-item.js +81 -0
- package/scb-grid/scb-grid.js +200 -0
- package/scb-grid/scb-stack.js +120 -0
- package/scb-header/scb-header-menu-group.js +21 -0
- package/scb-header/scb-header-menu-item.js +22 -0
- package/scb-header/scb-header-tab.js +25 -0
- package/scb-header/scb-header-utility.js +27 -0
- package/scb-header/scb-header.js +1358 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +353 -0
- package/scb-icon-button/scb-icon-button.js +335 -0
- package/scb-keyfigure-card/scb-keyfigure-card.js +340 -0
- package/scb-link/scb-link.js +136 -0
- package/scb-list/scb-list-item.js +297 -0
- package/scb-list/scb-list.js +119 -0
- package/scb-menu/scb-menu-item.js +330 -0
- package/scb-menu/scb-menu-section.js +60 -0
- package/scb-menu/scb-menu.js +154 -0
- package/scb-menu/scb-sub-menu.js +36 -0
- package/scb-nav/scb-nav-item.js +96 -0
- package/scb-nav/scb-nav.js +263 -0
- package/scb-notification-card/scb-notification-card.js +479 -0
- package/scb-options-menu/scb-options-menu-item.js +218 -0
- package/scb-options-menu/scb-options-menu.js +237 -0
- package/scb-options-menu/scb-options-sub-menu.js +69 -0
- package/scb-overlay/scb-overlay.js +144 -0
- package/scb-pagination/scb-pagination.js +438 -0
- package/scb-progress-indicator/scb-progress-indicator.js +199 -0
- package/scb-progress-stepper/scb-progress-step.js +213 -0
- package/scb-progress-stepper/scb-progress-stepper.js +132 -0
- package/scb-radio-button/scb-radio-button.js +249 -0
- package/scb-radio-button/scb-radio-group.js +216 -0
- package/scb-scrollspy/scb-scrollspy.js +670 -0
- package/scb-search/scb-search.js +643 -0
- package/scb-segmented-button/scb-segmented-button.js +215 -0
- package/scb-segmented-button/scb-segmented-item.js +133 -0
- package/scb-select/scb-select-option.js +88 -0
- package/scb-select/scb-select.js +517 -0
- package/scb-skeleton/scb-skeleton.js +92 -0
- package/scb-slider/scb-slider.js +98 -0
- package/scb-snackbar/scb-snackbar.js +223 -0
- package/scb-status-pill/scb-status-pill.js +100 -0
- package/scb-stepper/scb-step.js +311 -0
- package/scb-stepper/scb-stepper.js +325 -0
- package/scb-switch/scb-switch.js +182 -0
- package/scb-table/scb-table.js +202 -0
- package/scb-table-advanced/scb-table-advanced.js +327 -0
- package/scb-tabs/scb-primary-tab.js +68 -0
- package/scb-tabs/scb-secondary-tab.js +68 -0
- package/scb-tabs/scb-tabs.js +100 -0
- package/scb-test-components/index.d.ts +90 -0
- package/scb-test-components/scb-accordion/scb-accordion-item.d.ts +39 -0
- package/scb-test-components/scb-accordion/scb-accordion.d.ts +27 -0
- package/scb-test-components/scb-app-bar/scb-app-bar.d.ts +25 -0
- package/scb-test-components/scb-avatar/scb-avatar.d.ts +37 -0
- package/scb-test-components/scb-badge/scb-badge.d.ts +28 -0
- package/scb-test-components/scb-breadcrumb/scb-breadcrumb-item.d.ts +15 -0
- package/scb-test-components/scb-breadcrumb/scb-breadcrumb.d.ts +27 -0
- package/scb-test-components/scb-button/scb-button.d.ts +40 -0
- package/scb-test-components/scb-calendar/scb-calendar-event.d.ts +15 -0
- package/scb-test-components/scb-calendar/scb-calendar.d.ts +77 -0
- package/scb-test-components/scb-calendar-card/scb-calendar-card.d.ts +45 -0
- package/scb-test-components/scb-card/scb-card.d.ts +101 -0
- package/scb-test-components/scb-checkbox/scb-checkbox-group.d.ts +23 -0
- package/scb-test-components/scb-checkbox/scb-checkbox.d.ts +52 -0
- package/scb-test-components/scb-chevron/scb-chevron.d.ts +13 -0
- package/scb-test-components/scb-chip/scb-chip.d.ts +61 -0
- package/scb-test-components/scb-collapse/scb-collapse.d.ts +29 -0
- package/scb-test-components/scb-cookies-consent/scb-cookies-consent.d.ts +23 -0
- package/scb-test-components/scb-datepicker/scb-datepicker.d.ts +39 -0
- package/scb-test-components/scb-dialog/scb-dialog.d.ts +72 -0
- package/scb-test-components/scb-divider/scb-divider.d.ts +34 -0
- package/scb-test-components/scb-drawer/scb-drawer.d.ts +72 -0
- package/scb-test-components/scb-drop-zone/scb-drop-zone.d.ts +143 -0
- package/scb-test-components/scb-dropdown/scb-dropdown.d.ts +70 -0
- package/scb-test-components/scb-fab/scb-fab.d.ts +42 -0
- package/scb-test-components/scb-fact-card/scb-fact-card-content.d.ts +15 -0
- package/scb-test-components/scb-fact-card/scb-fact-card.d.ts +49 -0
- package/scb-test-components/scb-footer/scb-footer-section.d.ts +20 -0
- package/scb-test-components/scb-footer/scb-footer.d.ts +31 -0
- package/scb-test-components/scb-gallery-grid/scb-gallery-grid.d.ts +20 -0
- package/scb-test-components/scb-grid/scb-grid-item.d.ts +32 -0
- package/scb-test-components/scb-grid/scb-grid.d.ts +36 -0
- package/scb-test-components/scb-grid/scb-stack.d.ts +32 -0
- package/scb-test-components/scb-header/scb-header-menu-group.d.ts +12 -0
- package/scb-test-components/scb-header/scb-header-menu-item.d.ts +13 -0
- package/scb-test-components/scb-header/scb-header-tab.d.ts +13 -0
- package/scb-test-components/scb-header/scb-header-utility.d.ts +14 -0
- package/scb-test-components/scb-header/scb-header.d.ts +132 -0
- package/scb-test-components/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +47 -0
- package/scb-test-components/scb-icon-button/scb-icon-button.d.ts +76 -0
- package/scb-test-components/scb-keyfigure-card/scb-keyfigure-card.d.ts +46 -0
- package/scb-test-components/scb-link/scb-link.d.ts +25 -0
- package/scb-test-components/scb-list/scb-list-item.d.ts +38 -0
- package/scb-test-components/scb-list/scb-list.d.ts +26 -0
- package/scb-test-components/scb-menu/scb-menu-item.d.ts +52 -0
- package/scb-test-components/scb-menu/scb-menu-section.d.ts +11 -0
- package/scb-test-components/scb-menu/scb-menu.d.ts +25 -0
- package/scb-test-components/scb-menu/scb-sub-menu.d.ts +14 -0
- package/scb-test-components/scb-nav/scb-nav-item.d.ts +20 -0
- package/scb-test-components/scb-nav/scb-nav.d.ts +50 -0
- package/scb-test-components/scb-notification-card/scb-notification-card.d.ts +46 -0
- package/scb-test-components/scb-options-menu/scb-options-menu-item.d.ts +29 -0
- package/scb-test-components/scb-options-menu/scb-options-menu.d.ts +35 -0
- package/scb-test-components/scb-options-menu/scb-options-sub-menu.d.ts +11 -0
- package/scb-test-components/scb-overlay/scb-overlay.d.ts +24 -0
- package/scb-test-components/scb-pagination/scb-pagination.d.ts +36 -0
- package/scb-test-components/scb-progress-indicator/scb-progress-indicator.d.ts +28 -0
- package/scb-test-components/scb-progress-stepper/scb-progress-step.d.ts +21 -0
- package/scb-test-components/scb-progress-stepper/scb-progress-stepper.d.ts +22 -0
- package/scb-test-components/scb-radio-button/scb-radio-button.d.ts +26 -0
- package/scb-test-components/scb-radio-button/scb-radio-group.d.ts +49 -0
- package/scb-test-components/scb-scrollspy/scb-scrollspy.d.ts +217 -0
- package/scb-test-components/scb-search/scb-search.d.ts +96 -0
- package/scb-test-components/scb-segmented-button/scb-segmented-button.d.ts +80 -0
- package/scb-test-components/scb-segmented-button/scb-segmented-item.d.ts +21 -0
- package/scb-test-components/scb-select/scb-select-option.d.ts +16 -0
- package/scb-test-components/scb-select/scb-select.d.ts +62 -0
- package/scb-test-components/scb-skeleton/scb-skeleton.d.ts +25 -0
- package/scb-test-components/scb-slider/scb-slider.d.ts +28 -0
- package/scb-test-components/scb-snackbar/scb-snackbar.d.ts +24 -0
- package/scb-test-components/scb-status-pill/scb-status-pill.d.ts +22 -0
- package/scb-test-components/scb-stepper/scb-step.d.ts +22 -0
- package/scb-test-components/scb-stepper/scb-stepper.d.ts +47 -0
- package/scb-test-components/scb-switch/scb-switch.d.ts +52 -0
- package/scb-test-components/scb-table/scb-table.d.ts +24 -0
- package/scb-test-components/scb-table-advanced/scb-table-advanced.d.ts +39 -0
- package/scb-test-components/scb-tabs/scb-primary-tab.d.ts +15 -0
- package/scb-test-components/scb-tabs/scb-secondary-tab.d.ts +15 -0
- package/scb-test-components/scb-tabs/scb-tabs.d.ts +21 -0
- package/scb-test-components/scb-textfield/scb-textfield.d.ts +75 -0
- package/scb-test-components/scb-toc/scb-toc-item.d.ts +38 -0
- package/scb-test-components/scb-toc/scb-toc.d.ts +27 -0
- package/scb-test-components/scb-tooltip/scb-tooltip.d.ts +51 -0
- package/scb-test-components/scb-vignette/scb-vignette.d.ts +20 -0
- package/scb-test-components/scb-viz/scb-viz-actions-runtime.d.ts +26 -0
- package/scb-test-components/scb-viz/scb-viz-print-runtime.d.ts +27 -0
- package/scb-test-components/scb-viz/scb-viz-series-differentiation-registry.d.ts +21 -0
- package/scb-test-components/scb-viz/scb-viz-series-differentiation-runtime.d.ts +42 -0
- package/scb-test-components/scb-viz/scb-viz-table-runtime.d.ts +28 -0
- package/scb-test-components/scb-viz/scb-viz.d.ts +207 -0
- package/scb-textfield/scb-textfield.js +827 -0
- package/scb-toc/scb-toc-item.js +477 -0
- package/scb-toc/scb-toc.js +101 -0
- package/scb-tooltip/scb-tooltip.js +402 -0
- package/scb-typography.css +1 -1
- package/scb-vignette/scb-vignette.js +88 -0
- package/scb-viz/scb-viz-actions-runtime.js +143 -0
- package/scb-viz/scb-viz-print-runtime.js +121 -0
- package/scb-viz/scb-viz-series-differentiation-registry.js +117 -0
- package/scb-viz/scb-viz-series-differentiation-runtime.js +126 -0
- package/scb-viz/scb-viz-table-runtime.js +86 -0
- package/scb-viz/scb-viz.js +2195 -0
- package/scb-wc-selfhost.css +29 -0
- package/scb-wc.bundle.js +12893 -1099
- package/scb-wc.css +3 -2
- package/scb-wc.d.ts +180 -0
- package/index.d.ts +0 -0
- package/mvc/components/index.js +0 -1
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { __decorate as e } from "../_virtual/_@oxc-project_runtime@0.126.0/helpers/decorate.js";
|
|
2
|
+
import { LitElement as t, css as n, html as r } from "lit";
|
|
3
|
+
import { customElement as i } from "lit/decorators.js";
|
|
4
|
+
//#region src/scb-test-components/scb-scrollspy/scb-scrollspy.ts
|
|
5
|
+
var a = class extends t {
|
|
6
|
+
constructor(...e) {
|
|
7
|
+
super(...e), this.navSelector = "", this.offsetTop = 0, this.offsetBottom = 0, this.updateHash = !0, this.activeId = "", this.layout = "", this.sidebarNavWidth = "320px", this.sidebarHeight = "560px", this.stackHeight = "", this.sidebarNavTop = "0px", this.contentPadding = "0px", this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this.__navEl = null, this.__contentEl = null, this.__contentShellEl = null, this.__links = [], this.__observer = null, this.__fallbackScrollRoot = null, this.__entries = /* @__PURE__ */ new Map(), this.__rafId = null, this.__scrollRafId = null, this.__hashAllowUpdates = !1, this.__hashBaselineReady = !1, this.__hashBaselinePos = 0, this.__hashBaselineRafId = null, this.__hashScrollRoot = null, this.__hashSuspend = !1, this.__hashInitialApplied = !1, this.__onHashScrollBound = () => this.__onHashScroll(), this.__scrollAnimSeq = 0, this.__syncingActiveId = !1, this.__slotsResolvedOnce = !1, this.__motionMeasureEl = null, this.__focusableRafId = null, this.__autoOffsetTop = 0, this.__autoOffsetRafId = null, this.__navResizeObserver = null, this.__onNavClickBound = (e) => this.__onNavClick(e), this.__onScrollFallbackBound = () => this.__updateActiveFromRects(), this.__onResizeBound = () => {
|
|
8
|
+
this.__requestActiveRecalc(), this.__requestAutoOffsetMeasure();
|
|
9
|
+
}, this.__onSlotChange = () => {
|
|
10
|
+
let e = this.__navEl;
|
|
11
|
+
this.__teardown(), this.__resolveSlots(), this.__requestEnsureContentFocusable(), this.__navEl && this.__navEl.addEventListener("click", this.__onNavClickBound, !0), (e !== this.__navEl || !this.__links.length) && this.__collectLinks(), this.__requestAutoOffsetMeasure(), this.__rebuildObserver(), this.__attachHashScrollRoot(), this.__applyInitialHashIfAny(), !this.__hashInitialApplied && this.activeId && this.__applyActiveId(this.activeId, {
|
|
12
|
+
updateHash: !1,
|
|
13
|
+
scrollToTarget: !1
|
|
14
|
+
}), this.__slotsResolvedOnce = !0;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.properties = {
|
|
19
|
+
navSelector: {
|
|
20
|
+
type: String,
|
|
21
|
+
attribute: "nav-selector"
|
|
22
|
+
},
|
|
23
|
+
offsetTop: {
|
|
24
|
+
type: Number,
|
|
25
|
+
attribute: "offset-top"
|
|
26
|
+
},
|
|
27
|
+
offsetBottom: {
|
|
28
|
+
type: Number,
|
|
29
|
+
attribute: "offset-bottom"
|
|
30
|
+
},
|
|
31
|
+
updateHash: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
attribute: "update-hash",
|
|
34
|
+
converter: {
|
|
35
|
+
fromAttribute: (e) => {
|
|
36
|
+
if (e === null) return !0;
|
|
37
|
+
let t = e.trim().toLowerCase();
|
|
38
|
+
return !(t === "false" || t === "0" || t === "no");
|
|
39
|
+
},
|
|
40
|
+
toAttribute: (e) => e ? "" : null
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
activeId: {
|
|
44
|
+
type: String,
|
|
45
|
+
attribute: "active-id",
|
|
46
|
+
reflect: !0
|
|
47
|
+
},
|
|
48
|
+
layout: {
|
|
49
|
+
type: String,
|
|
50
|
+
reflect: !0
|
|
51
|
+
},
|
|
52
|
+
sidebarNavWidth: {
|
|
53
|
+
type: String,
|
|
54
|
+
attribute: "sidebar-nav-width"
|
|
55
|
+
},
|
|
56
|
+
sidebarHeight: {
|
|
57
|
+
type: String,
|
|
58
|
+
attribute: "sidebar-height"
|
|
59
|
+
},
|
|
60
|
+
stackHeight: {
|
|
61
|
+
type: String,
|
|
62
|
+
attribute: "stack-height"
|
|
63
|
+
},
|
|
64
|
+
sidebarNavTop: {
|
|
65
|
+
type: String,
|
|
66
|
+
attribute: "sidebar-nav-top"
|
|
67
|
+
},
|
|
68
|
+
contentPadding: {
|
|
69
|
+
type: String,
|
|
70
|
+
attribute: "content-padding"
|
|
71
|
+
},
|
|
72
|
+
spacing: {
|
|
73
|
+
type: String,
|
|
74
|
+
reflect: !0
|
|
75
|
+
},
|
|
76
|
+
spacingTop: {
|
|
77
|
+
type: String,
|
|
78
|
+
attribute: "spacing-top",
|
|
79
|
+
reflect: !0
|
|
80
|
+
},
|
|
81
|
+
spacingBottom: {
|
|
82
|
+
type: String,
|
|
83
|
+
attribute: "spacing-bottom",
|
|
84
|
+
reflect: !0
|
|
85
|
+
},
|
|
86
|
+
spacingLeft: {
|
|
87
|
+
type: String,
|
|
88
|
+
attribute: "spacing-left",
|
|
89
|
+
reflect: !0
|
|
90
|
+
},
|
|
91
|
+
spacingRight: {
|
|
92
|
+
type: String,
|
|
93
|
+
attribute: "spacing-right",
|
|
94
|
+
reflect: !0
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static {
|
|
99
|
+
this.styles = n`
|
|
100
|
+
:host {
|
|
101
|
+
display: contents;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:host([layout='sidebar']) {
|
|
105
|
+
display: block;
|
|
106
|
+
margin-block-start: var(--scb-scrollspy-spacing-block-start, 0);
|
|
107
|
+
margin-block-end: var(--scb-scrollspy-spacing-block-end, 0);
|
|
108
|
+
margin-inline-start: var(--scb-scrollspy-spacing-inline-start, 0);
|
|
109
|
+
margin-inline-end: var(--scb-scrollspy-spacing-inline-end, 0);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([layout='stack']) {
|
|
113
|
+
display: block;
|
|
114
|
+
margin-block-start: var(--scb-scrollspy-spacing-block-start, 0);
|
|
115
|
+
margin-block-end: var(--scb-scrollspy-spacing-block-end, 0);
|
|
116
|
+
margin-inline-start: var(--scb-scrollspy-spacing-inline-start, 0);
|
|
117
|
+
margin-inline-end: var(--scb-scrollspy-spacing-inline-end, 0);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.stack-shell {
|
|
121
|
+
max-height: var(--_scb-scrollspy-stack-height, none);
|
|
122
|
+
overflow: auto;
|
|
123
|
+
border-radius: 16px;
|
|
124
|
+
font-family: var(--brand-font);
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.stack-content {
|
|
129
|
+
padding: var(--_scb-scrollspy-content-padding, 0px);
|
|
130
|
+
box-sizing: border-box;
|
|
131
|
+
}
|
|
132
|
+
.sidebar-layout {
|
|
133
|
+
display: grid;
|
|
134
|
+
grid-template-columns: var(--_scb-scrollspy-sidebar-nav-width, 320px) minmax(0, 1fr);
|
|
135
|
+
gap: var(--spacing-6, 20px);
|
|
136
|
+
align-items: start;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.sidebar-nav {
|
|
140
|
+
height: var(--_scb-scrollspy-sidebar-height, 560px);
|
|
141
|
+
overflow: auto;
|
|
142
|
+
position: sticky;
|
|
143
|
+
top: var(--_scb-scrollspy-sidebar-nav-top, 0px);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.sidebar-content {
|
|
147
|
+
height: var(--_scb-scrollspy-sidebar-height, 560px);
|
|
148
|
+
overflow: auto;
|
|
149
|
+
border-radius: 16px;
|
|
150
|
+
font-family: var(--brand-font);
|
|
151
|
+
padding: var(--_scb-scrollspy-content-padding, 0px);
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:host([layout='sidebar']) ::slotted(scb-menu) {
|
|
156
|
+
border-radius: var(--scb-menu-surface-radius, 16px);
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
connectedCallback() {
|
|
161
|
+
super.connectedCallback(), window.addEventListener("resize", this.__onResizeBound, { passive: !0 });
|
|
162
|
+
}
|
|
163
|
+
firstUpdated() {
|
|
164
|
+
this.__ensureMotionMeasureEl(), this.__resolveInternals(), this.__requestEnsureContentFocusable(), this.__requestAutoOffsetMeasure(), this.__applySpacing();
|
|
165
|
+
}
|
|
166
|
+
disconnectedCallback() {
|
|
167
|
+
window.removeEventListener("resize", this.__onResizeBound), this.__teardown(), super.disconnectedCallback();
|
|
168
|
+
}
|
|
169
|
+
updated(e) {
|
|
170
|
+
if ((e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom") || e.has("spacingLeft") || e.has("spacingRight")) && this.__applySpacing(), e.has("navSelector")) {
|
|
171
|
+
this.__onSlotChange();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (e.has("layout")) {
|
|
175
|
+
this.__onSlotChange();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
(e.has("offsetTop") || e.has("offsetBottom")) && (this.__rebuildObserver(), this.__attachHashScrollRoot()), (e.has("sidebarNavWidth") || e.has("sidebarHeight") || e.has("stackHeight") || e.has("sidebarNavTop") || e.has("contentPadding")) && (this.__resolveInternals(), this.__requestEnsureContentFocusable(), this.__rebuildObserver()), e.has("activeId") && (this.__syncingActiveId ? this.__syncingActiveId = !1 : this.__applyExternalActiveId());
|
|
179
|
+
}
|
|
180
|
+
__mapSpacingToken(e) {
|
|
181
|
+
if (!e) return;
|
|
182
|
+
let t = String(e).trim();
|
|
183
|
+
if (t) return /^\d+$/.test(t) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(t, 10)))})` : t;
|
|
184
|
+
}
|
|
185
|
+
__applySpacing() {
|
|
186
|
+
let e = this.__mapSpacingToken(this.spacing), t = this.__mapSpacingToken(this.spacingTop) ?? e, n = this.__mapSpacingToken(this.spacingBottom) ?? e, r = this.__mapSpacingToken(this.spacingLeft), i = this.__mapSpacingToken(this.spacingRight);
|
|
187
|
+
t ? this.style.setProperty("--scb-scrollspy-spacing-block-start", t) : this.style.removeProperty("--scb-scrollspy-spacing-block-start"), n ? this.style.setProperty("--scb-scrollspy-spacing-block-end", n) : this.style.removeProperty("--scb-scrollspy-spacing-block-end"), r ? this.style.setProperty("--scb-scrollspy-spacing-inline-start", r) : this.style.removeProperty("--scb-scrollspy-spacing-inline-start"), i ? this.style.setProperty("--scb-scrollspy-spacing-inline-end", i) : this.style.removeProperty("--scb-scrollspy-spacing-inline-end");
|
|
188
|
+
}
|
|
189
|
+
__teardown() {
|
|
190
|
+
this.__cancelScrollAnimation(), this.__cancelEnsureContentFocusable(), this.__cancelAutoOffsetMeasure(), this.__disconnectAutoOffsetObserver(), this.__disconnectObserver(), this.__navEl && this.__navEl.removeEventListener("click", this.__onNavClickBound, !0), this.__fallbackScrollRoot && this.__fallbackScrollRoot.removeEventListener?.("scroll", this.__onScrollFallbackBound), this.__fallbackScrollRoot = null, this.__entries.clear(), this.__links = [], this.__detachHashScrollRoot(), this.__cancelHashBaseline();
|
|
191
|
+
}
|
|
192
|
+
__cancelScrollAnimation() {
|
|
193
|
+
this.__scrollAnimSeq++, this.__scrollRafId !== null && (window.cancelAnimationFrame(this.__scrollRafId), this.__scrollRafId = null);
|
|
194
|
+
}
|
|
195
|
+
__cancelEnsureContentFocusable() {
|
|
196
|
+
this.__focusableRafId !== null && (window.cancelAnimationFrame(this.__focusableRafId), this.__focusableRafId = null);
|
|
197
|
+
}
|
|
198
|
+
__requestEnsureContentFocusable() {
|
|
199
|
+
typeof window > "u" || (this.__cancelEnsureContentFocusable(), this.__focusableRafId = window.requestAnimationFrame(() => {
|
|
200
|
+
this.__focusableRafId = null, this.__ensureScrollableContentFocusable();
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
__ensureScrollableContentFocusable() {
|
|
204
|
+
let e = this.__getScrollContainerEl();
|
|
205
|
+
e instanceof HTMLElement && (e.hasAttribute("tabindex") || (e.scrollHeight > e.clientHeight + 1 || e.scrollWidth > e.clientWidth + 1) && (e.querySelector("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"\"], [contenteditable=\"true\"]") || e.setAttribute("tabindex", "0")));
|
|
206
|
+
}
|
|
207
|
+
__ensureMotionMeasureEl() {
|
|
208
|
+
if (this.__motionMeasureEl) return;
|
|
209
|
+
let e = document.createElement("span");
|
|
210
|
+
e.setAttribute("aria-hidden", "true"), e.style.position = "fixed", e.style.width = "0", e.style.height = "0", e.style.overflow = "hidden", e.style.pointerEvents = "none", e.style.visibility = "hidden", this.__motionMeasureEl = e, this.renderRoot.appendChild(e);
|
|
211
|
+
}
|
|
212
|
+
__disconnectObserver() {
|
|
213
|
+
this.__observer &&= (this.__observer.disconnect(), null);
|
|
214
|
+
}
|
|
215
|
+
__resolveInternals() {
|
|
216
|
+
this.__contentShellEl = this.layout === "sidebar" ? this.renderRoot.querySelector(".sidebar-content") : this.layout === "stack" ? this.renderRoot.querySelector(".stack-shell") : null;
|
|
217
|
+
}
|
|
218
|
+
__resolveSlots() {
|
|
219
|
+
let e = this.renderRoot.querySelector("slot[name=\"nav\"]"), t = this.renderRoot.querySelector("slot[name=\"content\"]"), n = e?.assignedElements({ flatten: !0 }) ?? [], r = t?.assignedElements({ flatten: !0 }) ?? [], i = (this.navSelector || "").trim(), a = i ? this.__queryExternalNav(i) : n[0], o = r[0];
|
|
220
|
+
this.__navEl = a instanceof HTMLElement ? a : null, this.__contentEl = o instanceof HTMLElement ? o : null, this.__resolveInternals();
|
|
221
|
+
}
|
|
222
|
+
__queryExternalNav(e) {
|
|
223
|
+
try {
|
|
224
|
+
return (this.getRootNode?.())?.querySelector?.(e) ?? document.querySelector(e);
|
|
225
|
+
} catch {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
__getScrollContainerEl() {
|
|
230
|
+
return this.layout === "sidebar" || this.layout === "stack" ? this.__contentShellEl : this.__contentEl;
|
|
231
|
+
}
|
|
232
|
+
__isOffsetTopExplicit() {
|
|
233
|
+
return this.hasAttribute("offset-top");
|
|
234
|
+
}
|
|
235
|
+
__getEffectiveOffsetTop() {
|
|
236
|
+
let e = this.__isOffsetTopExplicit() ? this.offsetTop : this.__autoOffsetTop;
|
|
237
|
+
return Math.max(0, e);
|
|
238
|
+
}
|
|
239
|
+
__cancelAutoOffsetMeasure() {
|
|
240
|
+
this.__autoOffsetRafId !== null && (window.cancelAnimationFrame(this.__autoOffsetRafId), this.__autoOffsetRafId = null);
|
|
241
|
+
}
|
|
242
|
+
__disconnectAutoOffsetObserver() {
|
|
243
|
+
this.__navResizeObserver &&= (this.__navResizeObserver.disconnect(), null);
|
|
244
|
+
}
|
|
245
|
+
__requestAutoOffsetMeasure() {
|
|
246
|
+
if (!(typeof window > "u")) {
|
|
247
|
+
if (this.__isOffsetTopExplicit()) {
|
|
248
|
+
this.__setAutoOffsetTop(0), this.__disconnectAutoOffsetObserver();
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
this.__autoOffsetRafId === null && (this.__autoOffsetRafId = window.requestAnimationFrame(() => {
|
|
252
|
+
this.__autoOffsetRafId = null, this.__measureAutoOffset();
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
__measureAutoOffset() {
|
|
257
|
+
let e = this.__navEl;
|
|
258
|
+
if (this.__isOffsetTopExplicit()) {
|
|
259
|
+
this.__setAutoOffsetTop(0), this.__disconnectAutoOffsetObserver();
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (!(e?.tagName === "SCB-NAV" && (e.hasAttribute("sticky") || e.sticky === !0))) {
|
|
263
|
+
this.__setAutoOffsetTop(0), this.__disconnectAutoOffsetObserver();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
let t = Math.max(0, Math.round(e.getBoundingClientRect().height));
|
|
267
|
+
this.__setAutoOffsetTop(t), !this.__navResizeObserver && "ResizeObserver" in window && (this.__navResizeObserver = new ResizeObserver(() => {
|
|
268
|
+
this.__requestAutoOffsetMeasure();
|
|
269
|
+
}), this.__navResizeObserver.observe(e));
|
|
270
|
+
}
|
|
271
|
+
__setAutoOffsetTop(e) {
|
|
272
|
+
let t = Math.max(0, e);
|
|
273
|
+
Math.abs(t - this.__autoOffsetTop) < 1 || (this.__autoOffsetTop = t, this.__rebuildObserver(), this.__requestActiveRecalc());
|
|
274
|
+
}
|
|
275
|
+
__rebuildObserver() {
|
|
276
|
+
this.__disconnectObserver(), this.__entries.clear();
|
|
277
|
+
let e = this.__getObserverRoot(), t = `-${Math.max(0, this.__getEffectiveOffsetTop())}px 0px -${Math.max(0, this.offsetBottom)}px 0px`;
|
|
278
|
+
if (!(typeof window > "u")) {
|
|
279
|
+
if ("IntersectionObserver" in window) {
|
|
280
|
+
this.__observer = new IntersectionObserver((e) => this.__onIntersect(e), {
|
|
281
|
+
root: e,
|
|
282
|
+
rootMargin: t,
|
|
283
|
+
threshold: [
|
|
284
|
+
0,
|
|
285
|
+
.1,
|
|
286
|
+
.25,
|
|
287
|
+
.5,
|
|
288
|
+
.75,
|
|
289
|
+
1
|
|
290
|
+
]
|
|
291
|
+
});
|
|
292
|
+
for (let e of this.__links) this.__observer.observe(e.targetEl);
|
|
293
|
+
this.__requestActiveRecalc();
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
this.__enableFallbackScrollSpy();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
__enableFallbackScrollSpy() {
|
|
300
|
+
let e = this.__getObserverRoot() ?? window;
|
|
301
|
+
this.__fallbackScrollRoot = e, e.addEventListener?.("scroll", this.__onScrollFallbackBound, { passive: !0 }), this.__requestActiveRecalc();
|
|
302
|
+
}
|
|
303
|
+
__getObserverRoot() {
|
|
304
|
+
let e = this.__getScrollContainerEl();
|
|
305
|
+
return e instanceof HTMLElement && (e.scrollHeight > e.clientHeight + 1 || e.scrollWidth > e.clientWidth + 1) ? e : null;
|
|
306
|
+
}
|
|
307
|
+
__collectLinks() {
|
|
308
|
+
let e = this.__navEl, t = this.__contentEl;
|
|
309
|
+
if (!e || !t) {
|
|
310
|
+
this.__links = [];
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
let n = Array.from(e.querySelectorAll("scb-menu-item[item-href^=\"#\"], scb-nav-item[href^=\"#\"], scb-nav-item[data-href^=\"#\"], a[href^=\"#\"], button[data-href^=\"#\"]")), r = [];
|
|
314
|
+
for (let e of n) {
|
|
315
|
+
let n = this.__getHref(e);
|
|
316
|
+
if (!n || !n.startsWith("#")) continue;
|
|
317
|
+
let i = n.slice(1);
|
|
318
|
+
if (!i) continue;
|
|
319
|
+
let a = t.querySelector(`#${CSS.escape(i)}`);
|
|
320
|
+
a && r.push({
|
|
321
|
+
id: i,
|
|
322
|
+
navEl: e,
|
|
323
|
+
targetEl: a
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
this.__links = r;
|
|
327
|
+
}
|
|
328
|
+
__getHref(e) {
|
|
329
|
+
return e.tagName === "A" ? e.getAttribute("href") ?? "" : e.tagName === "SCB-MENU-ITEM" ? e.itemHref ?? e.getAttribute("item-href") ?? "" : e.tagName === "BUTTON" ? e.getAttribute("data-href") ?? "" : e.tagName === "SCB-NAV-ITEM" ? e.href || e.dataHref || e.getAttribute("href") || e.getAttribute("data-href") || "" : e.getAttribute("href") ?? "";
|
|
330
|
+
}
|
|
331
|
+
__onIntersect(e) {
|
|
332
|
+
for (let t of e) {
|
|
333
|
+
let e = t.target.id;
|
|
334
|
+
e && this.__entries.set(e, {
|
|
335
|
+
id: e,
|
|
336
|
+
isIntersecting: t.isIntersecting,
|
|
337
|
+
top: t.boundingClientRect.top,
|
|
338
|
+
ratio: t.intersectionRatio
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
this.__requestActiveRecalc();
|
|
342
|
+
}
|
|
343
|
+
__requestActiveRecalc() {
|
|
344
|
+
this.__rafId === null && (this.__rafId = window.requestAnimationFrame(() => {
|
|
345
|
+
this.__rafId = null, this.__updateActiveFromEntries();
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
__updateActiveFromEntries() {
|
|
349
|
+
if (this.__entries.size === 0) {
|
|
350
|
+
this.__updateActiveFromRects();
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
let e = Array.from(this.__entries.values()).filter((e) => e.isIntersecting);
|
|
354
|
+
if (e.length === 0) return;
|
|
355
|
+
let t = this.__getObserverRoot(), n = ((t ? t.getBoundingClientRect() : null)?.top ?? 0) + Math.max(0, this.__getEffectiveOffsetTop()), r = e.filter((e) => e.top >= n).sort((e, t) => e.top - t.top)[0] ?? e.sort((e, t) => t.top - e.top)[0];
|
|
356
|
+
r?.id && this.__setActiveId(r.id, { updateHash: this.updateHash });
|
|
357
|
+
}
|
|
358
|
+
__updateActiveFromRects() {
|
|
359
|
+
if (!this.__contentEl) return;
|
|
360
|
+
let e = this.__getObserverRoot(), t = ((e ? e.getBoundingClientRect() : null)?.top ?? 0) + Math.max(0, this.__getEffectiveOffsetTop()), n = this.__links.map((e) => {
|
|
361
|
+
let n = e.targetEl.getBoundingClientRect();
|
|
362
|
+
return {
|
|
363
|
+
id: e.id,
|
|
364
|
+
top: n.top - t
|
|
365
|
+
};
|
|
366
|
+
}).filter((e) => Number.isFinite(e.top));
|
|
367
|
+
if (n.length === 0) return;
|
|
368
|
+
let r = n.filter((e) => e.top >= 0).sort((e, t) => e.top - t.top)[0] ?? n.sort((e, t) => t.top - e.top)[0];
|
|
369
|
+
r?.id && this.__setActiveId(r.id, { updateHash: this.updateHash });
|
|
370
|
+
}
|
|
371
|
+
__applyActiveId(e, t) {
|
|
372
|
+
let n = this.__links.find((t) => t.id === e);
|
|
373
|
+
if (this.__navEl?.tagName === "SCB-NAV" ? this.__navEl.activeHref = `#${e}` : n && (this.__applyActiveToNav(n.navEl), this.__expandAncestors(n.navEl)), t.scrollToTarget) {
|
|
374
|
+
let t = n?.targetEl ?? null;
|
|
375
|
+
if (!t) {
|
|
376
|
+
let n = this.__contentEl ?? this;
|
|
377
|
+
try {
|
|
378
|
+
t = n.querySelector(`#${CSS.escape(e)}`);
|
|
379
|
+
} catch {
|
|
380
|
+
t = n.querySelector(`[id="${e}"]`);
|
|
381
|
+
}
|
|
382
|
+
!t && typeof document < "u" && (t = document.getElementById(e));
|
|
383
|
+
}
|
|
384
|
+
t && this.__scrollToTarget(t);
|
|
385
|
+
}
|
|
386
|
+
if (t.updateHash && this.__hashAllowUpdates && typeof history < "u") try {
|
|
387
|
+
history.replaceState(null, "", `#${encodeURIComponent(e)}`);
|
|
388
|
+
} catch {}
|
|
389
|
+
this.dispatchEvent(new CustomEvent("scb-scrollspy-active-changed", {
|
|
390
|
+
bubbles: !0,
|
|
391
|
+
composed: !0,
|
|
392
|
+
detail: { id: e }
|
|
393
|
+
})), this.dispatchEvent(new CustomEvent("scbscrollspyactivechanged", {
|
|
394
|
+
bubbles: !0,
|
|
395
|
+
composed: !0,
|
|
396
|
+
detail: { id: e }
|
|
397
|
+
}));
|
|
398
|
+
}
|
|
399
|
+
__applyExternalActiveId() {
|
|
400
|
+
let e = (this.activeId || "").trim();
|
|
401
|
+
e && (this.__links.length || this.__collectLinks(), this.__applyActiveId(e, {
|
|
402
|
+
updateHash: this.updateHash,
|
|
403
|
+
scrollToTarget: this.__slotsResolvedOnce
|
|
404
|
+
}));
|
|
405
|
+
}
|
|
406
|
+
__setActiveId(e, t) {
|
|
407
|
+
!e || e === this.activeId || (this.__syncingActiveId = !0, this.activeId = e, this.__applyActiveId(e, {
|
|
408
|
+
updateHash: t.updateHash,
|
|
409
|
+
scrollToTarget: !1
|
|
410
|
+
}));
|
|
411
|
+
}
|
|
412
|
+
__applyActiveToNav(e) {
|
|
413
|
+
let t = this.__navEl;
|
|
414
|
+
if (!t) return;
|
|
415
|
+
let n = Array.from(t.querySelectorAll("scb-menu-item[item-href^=\"#\"], scb-nav-item[href^=\"#\"], scb-nav-item[data-href^=\"#\"], a[href^=\"#\"], button[data-href^=\"#\"]"));
|
|
416
|
+
for (let t of n) {
|
|
417
|
+
let n = t === e;
|
|
418
|
+
if (t.tagName === "SCB-MENU-ITEM") {
|
|
419
|
+
let e = t;
|
|
420
|
+
typeof e.selected == "boolean" && (e.selected = n), n && t.dispatchEvent(new CustomEvent("scb-menu-select", {
|
|
421
|
+
bubbles: !0,
|
|
422
|
+
composed: !0,
|
|
423
|
+
detail: { item: t }
|
|
424
|
+
}));
|
|
425
|
+
} else t.tagName === "A" || t.tagName === "BUTTON" ? n ? t.setAttribute("aria-current", "location") : t.removeAttribute("aria-current") : t.tagName === "SCB-NAV-ITEM" && (n ? (t.setAttribute("aria-current", "location"), t.setAttribute("data-active", "true")) : (t.removeAttribute("aria-current"), t.removeAttribute("data-active")));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
__expandAncestors(e) {
|
|
429
|
+
let t = e;
|
|
430
|
+
for (; t;) {
|
|
431
|
+
if (t.tagName === "SCB-MENU-ITEM") {
|
|
432
|
+
let e = t;
|
|
433
|
+
typeof e.expanded == "boolean" && (e.expanded = !0);
|
|
434
|
+
}
|
|
435
|
+
t = t.parentElement;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
__scrollToTarget(e) {
|
|
439
|
+
let t = typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches, n = this.__getScrollContainerEl();
|
|
440
|
+
if (n instanceof HTMLElement && n.scrollHeight > n.clientHeight + 1) {
|
|
441
|
+
let r = this.__getScrollTopInContainer(e, n) - this.__getEffectiveOffsetTop(), i = Math.max(0, n.scrollHeight - n.clientHeight), a = Math.min(i, Math.max(0, r));
|
|
442
|
+
if (t) {
|
|
443
|
+
n.scrollTop = a;
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
this.__animateScroll({
|
|
447
|
+
get: () => n.scrollTop,
|
|
448
|
+
set: (e) => {
|
|
449
|
+
n.scrollTop = e;
|
|
450
|
+
},
|
|
451
|
+
max: i,
|
|
452
|
+
to: a
|
|
453
|
+
});
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (!(e instanceof HTMLElement)) return;
|
|
457
|
+
let r = e.getBoundingClientRect(), i = (window.scrollY || window.pageYOffset || 0) + r.top - this.__getEffectiveOffsetTop(), a = document.documentElement, o = Math.max(0, a.scrollHeight - window.innerHeight), s = Math.min(o, Math.max(0, i));
|
|
458
|
+
if (t) {
|
|
459
|
+
window.scrollTo(0, s);
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
this.__animateScroll({
|
|
463
|
+
get: () => window.scrollY || window.pageYOffset || 0,
|
|
464
|
+
set: (e) => window.scrollTo(0, e),
|
|
465
|
+
max: o,
|
|
466
|
+
to: s
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
__getScrollTopInContainer(e, t) {
|
|
470
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
471
|
+
return t.scrollTop + (r.top - n.top);
|
|
472
|
+
}
|
|
473
|
+
__animateScroll(e) {
|
|
474
|
+
let t = e.get(), n = Math.min(e.max, Math.max(0, e.to));
|
|
475
|
+
if (!Number.isFinite(t) || !Number.isFinite(n)) return;
|
|
476
|
+
if (Math.abs(n - t) < 1) {
|
|
477
|
+
e.set(n);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
this.__cancelScrollAnimation(), this.__ensureMotionMeasureEl();
|
|
481
|
+
let r = ++this.__scrollAnimSeq, i = Math.abs(n - t), a = this.__getScrollDurationMs(i), o = this.__getScrollEasingFn(), s = performance.now(), c = (i) => {
|
|
482
|
+
if (r !== this.__scrollAnimSeq) return;
|
|
483
|
+
let l = a <= 0 ? 1 : Math.min(1, (i - s) / a), u = o(l);
|
|
484
|
+
e.set(t + (n - t) * u), l < 1 ? this.__scrollRafId = window.requestAnimationFrame(c) : this.__scrollRafId = null;
|
|
485
|
+
};
|
|
486
|
+
this.__scrollRafId = window.requestAnimationFrame(c);
|
|
487
|
+
}
|
|
488
|
+
__getScrollDurationMs(e) {
|
|
489
|
+
let t = this.__resolveTimeMs("var(--motion-duration-medium, 300ms)") ?? 300, n = this.__resolveTimeMs("var(--motion-duration-long, 500ms)") ?? 500, r = this.__resolveTimeMs("var(--motion-duration-extra-long, 700ms)") ?? 700, i = Math.min(1, Math.max(0, e / 1800)), a = t + (n - t) * i;
|
|
490
|
+
return Math.min(r, Math.max(t, a));
|
|
491
|
+
}
|
|
492
|
+
__getScrollEasingFn() {
|
|
493
|
+
let e = this.__resolveTimingFunction("var(--motion-easing-emphasized-decelerate, var(--motion-easing-emphasized, cubic-bezier(.69,.16,.2,.98)))") ?? "cubic-bezier(0.05, 0.7, 0.1, 1)";
|
|
494
|
+
return this.__parseEasingFunction(e) ?? ((e) => e);
|
|
495
|
+
}
|
|
496
|
+
__resolveTimeMs(e) {
|
|
497
|
+
let t = this.__motionMeasureEl;
|
|
498
|
+
if (!t) return null;
|
|
499
|
+
t.style.transitionDuration = e;
|
|
500
|
+
let n = getComputedStyle(t).transitionDuration.split(",")[0]?.trim() ?? "";
|
|
501
|
+
return this.__parseTimeToMs(n);
|
|
502
|
+
}
|
|
503
|
+
__resolveTimingFunction(e) {
|
|
504
|
+
let t = this.__motionMeasureEl;
|
|
505
|
+
return t ? (t.style.transitionTimingFunction = e, getComputedStyle(t).transitionTimingFunction.split(",")[0]?.trim() ?? null) : null;
|
|
506
|
+
}
|
|
507
|
+
__parseTimeToMs(e) {
|
|
508
|
+
let t = e.trim();
|
|
509
|
+
if (!t) return null;
|
|
510
|
+
let n = parseFloat(t);
|
|
511
|
+
return Number.isFinite(n) ? t.endsWith("ms") ? n : t.endsWith("s") ? n * 1e3 : null : null;
|
|
512
|
+
}
|
|
513
|
+
__parseEasingFunction(e) {
|
|
514
|
+
let t = e.trim();
|
|
515
|
+
if (!t) return null;
|
|
516
|
+
if (t === "linear") return (e) => e;
|
|
517
|
+
let n = t.match(/cubic-bezier\(([^)]+)\)/i);
|
|
518
|
+
if (!n) return null;
|
|
519
|
+
let r = n[1].split(",").map((e) => parseFloat(e.trim())).filter((e) => Number.isFinite(e));
|
|
520
|
+
if (r.length !== 4) return null;
|
|
521
|
+
let [i, a, o, s] = r;
|
|
522
|
+
return this.__cubicBezier(i, a, o, s);
|
|
523
|
+
}
|
|
524
|
+
__cubicBezier(e, t, n, r) {
|
|
525
|
+
let i = 3 * e, a = 3 * (n - e) - i, o = 1 - i - a, s = 3 * t, c = 3 * (r - t) - s, l = 1 - s - c, u = (e) => ((o * e + a) * e + i) * e, d = (e) => ((l * e + c) * e + s) * e, f = (e) => (3 * o * e + 2 * a) * e + i, p = (e) => {
|
|
526
|
+
let t = e;
|
|
527
|
+
for (let n = 0; n < 8; n++) {
|
|
528
|
+
let n = u(t) - e;
|
|
529
|
+
if (Math.abs(n) < 1e-6) return t;
|
|
530
|
+
let r = f(t);
|
|
531
|
+
if (Math.abs(r) < 1e-6) break;
|
|
532
|
+
t -= n / r;
|
|
533
|
+
}
|
|
534
|
+
let n = 0, r = 1;
|
|
535
|
+
for (t = e; n < r;) {
|
|
536
|
+
let i = u(t) - e;
|
|
537
|
+
if (Math.abs(i) < 1e-6) return t;
|
|
538
|
+
i > 0 ? r = t : n = t, t = (r + n) / 2;
|
|
539
|
+
}
|
|
540
|
+
return t;
|
|
541
|
+
};
|
|
542
|
+
return (e) => d(p(Math.min(1, Math.max(0, e))));
|
|
543
|
+
}
|
|
544
|
+
__detachHashScrollRoot() {
|
|
545
|
+
if (!this.__hashScrollRoot) return;
|
|
546
|
+
let e = this.__hashScrollRoot;
|
|
547
|
+
try {
|
|
548
|
+
e instanceof Window, e.removeEventListener("scroll", this.__onHashScrollBound);
|
|
549
|
+
} catch {}
|
|
550
|
+
this.__hashScrollRoot = null;
|
|
551
|
+
}
|
|
552
|
+
__cancelHashBaseline() {
|
|
553
|
+
this.__hashBaselineRafId !== null && (window.cancelAnimationFrame(this.__hashBaselineRafId), this.__hashBaselineRafId = null), this.__hashBaselineReady = !1;
|
|
554
|
+
}
|
|
555
|
+
__attachHashScrollRoot() {
|
|
556
|
+
this.__detachHashScrollRoot();
|
|
557
|
+
let e = this.__getObserverRoot() ?? window;
|
|
558
|
+
this.__hashScrollRoot = e;
|
|
559
|
+
try {
|
|
560
|
+
e.addEventListener("scroll", this.__onHashScrollBound, { passive: !0 });
|
|
561
|
+
} catch {}
|
|
562
|
+
this.__hashAllowUpdates = !1, this.__scheduleHashBaseline();
|
|
563
|
+
}
|
|
564
|
+
__scheduleHashBaseline() {
|
|
565
|
+
this.__cancelHashBaseline();
|
|
566
|
+
let e = () => {
|
|
567
|
+
this.__hashBaselinePos = this.__getHashScrollPos(), this.__hashBaselineReady = !0, this.__hashBaselineRafId = null;
|
|
568
|
+
};
|
|
569
|
+
this.__hashBaselineRafId = window.requestAnimationFrame(() => {
|
|
570
|
+
this.__hashBaselineRafId = window.requestAnimationFrame(e);
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
__getHashScrollPos() {
|
|
574
|
+
let e = this.__hashScrollRoot;
|
|
575
|
+
if (e instanceof Window) return e.scrollY || e.pageYOffset || 0;
|
|
576
|
+
if (e && "scrollTop" in e) {
|
|
577
|
+
let t = e;
|
|
578
|
+
return typeof t.scrollTop == "number" ? t.scrollTop : 0;
|
|
579
|
+
}
|
|
580
|
+
return 0;
|
|
581
|
+
}
|
|
582
|
+
__onHashScroll() {
|
|
583
|
+
if (!this.updateHash || this.__hashSuspend || this.__hashAllowUpdates || !this.__hashBaselineReady) return;
|
|
584
|
+
let e = this.__getHashScrollPos();
|
|
585
|
+
Math.abs(e - this.__hashBaselinePos) > 2 && (this.__hashAllowUpdates = !0);
|
|
586
|
+
}
|
|
587
|
+
__jumpToTarget(e) {
|
|
588
|
+
let t = this.__getScrollContainerEl();
|
|
589
|
+
if (t instanceof HTMLElement && t.scrollHeight > t.clientHeight + 1) {
|
|
590
|
+
let n = this.__getScrollTopInContainer(e, t) - this.__getEffectiveOffsetTop(), r = Math.max(0, t.scrollHeight - t.clientHeight);
|
|
591
|
+
t.scrollTop = Math.min(r, Math.max(0, n));
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
if (!(e instanceof HTMLElement)) return;
|
|
595
|
+
let n = e.getBoundingClientRect(), r = (window.scrollY || window.pageYOffset || 0) + n.top - this.__getEffectiveOffsetTop(), i = document.documentElement, a = Math.max(0, i.scrollHeight - window.innerHeight), o = Math.min(a, Math.max(0, r));
|
|
596
|
+
window.scrollTo(0, o);
|
|
597
|
+
}
|
|
598
|
+
__applyInitialHashIfAny() {
|
|
599
|
+
if (this.__hashInitialApplied) return;
|
|
600
|
+
let e = typeof window < "u" ? window.location.hash : "";
|
|
601
|
+
if (!e || e.length < 2) return;
|
|
602
|
+
let t = "";
|
|
603
|
+
try {
|
|
604
|
+
t = decodeURIComponent(e.slice(1));
|
|
605
|
+
} catch {
|
|
606
|
+
t = e.slice(1);
|
|
607
|
+
}
|
|
608
|
+
if (!t) return;
|
|
609
|
+
let n = this.__links.find((e) => e.id === t);
|
|
610
|
+
if (n?.targetEl) {
|
|
611
|
+
this.__hashInitialApplied = !0, this.__hashSuspend = !0;
|
|
612
|
+
try {
|
|
613
|
+
this.__jumpToTarget(n.targetEl), this.__setActiveId(t, { updateHash: !1 });
|
|
614
|
+
} finally {
|
|
615
|
+
window.requestAnimationFrame(() => {
|
|
616
|
+
window.requestAnimationFrame(() => {
|
|
617
|
+
this.__hashSuspend = !1;
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
__onNavClick(e) {
|
|
624
|
+
let t = this.__navEl, n = this.__contentEl;
|
|
625
|
+
if (!t || !n) return;
|
|
626
|
+
let r = e.composedPath().find((e) => e instanceof Element && (e.tagName === "SCB-MENU-ITEM" || e.tagName === "SCB-NAV-ITEM" || e.tagName === "A" || e.tagName === "BUTTON"));
|
|
627
|
+
if (!r) return;
|
|
628
|
+
let i = this.__getHref(r);
|
|
629
|
+
if (!i || !i.startsWith("#")) return;
|
|
630
|
+
let a = i.slice(1);
|
|
631
|
+
if (!a) return;
|
|
632
|
+
let o = n.querySelector(`#${CSS.escape(a)}`);
|
|
633
|
+
o && (e.preventDefault(), this.__hashAllowUpdates = !0, this.__scrollToTarget(o), this.__setActiveId(a, { updateHash: this.updateHash }));
|
|
634
|
+
}
|
|
635
|
+
render() {
|
|
636
|
+
if (this.layout === "sidebar") return r`
|
|
637
|
+
<div class="sidebar-layout" style=${[
|
|
638
|
+
`--_scb-scrollspy-sidebar-nav-width: ${this.sidebarNavWidth}`,
|
|
639
|
+
`--_scb-scrollspy-sidebar-height: ${this.sidebarHeight}`,
|
|
640
|
+
`--_scb-scrollspy-sidebar-nav-top: ${this.sidebarNavTop}`,
|
|
641
|
+
`--_scb-scrollspy-content-padding: ${this.contentPadding}`
|
|
642
|
+
].join("; ")}>
|
|
643
|
+
<div class="sidebar-nav">
|
|
644
|
+
<slot name="nav" @slotchange=${this.__onSlotChange}></slot>
|
|
645
|
+
</div>
|
|
646
|
+
<div class="sidebar-content">
|
|
647
|
+
<slot name="content" @slotchange=${this.__onSlotChange}></slot>
|
|
648
|
+
</div>
|
|
649
|
+
</div>
|
|
650
|
+
`;
|
|
651
|
+
if (this.layout === "stack") {
|
|
652
|
+
let e = [`--_scb-scrollspy-content-padding: ${this.contentPadding}`], t = (this.stackHeight || "").trim();
|
|
653
|
+
return t && e.unshift(`--_scb-scrollspy-stack-height: ${t}`), r`
|
|
654
|
+
<div class="stack-shell" style=${e.join("; ")}>
|
|
655
|
+
<slot name="nav" @slotchange=${this.__onSlotChange}></slot>
|
|
656
|
+
<div class="stack-content">
|
|
657
|
+
<slot name="content" @slotchange=${this.__onSlotChange}></slot>
|
|
658
|
+
</div>
|
|
659
|
+
</div>
|
|
660
|
+
`;
|
|
661
|
+
}
|
|
662
|
+
return r`
|
|
663
|
+
<slot name="nav" @slotchange=${this.__onSlotChange}></slot>
|
|
664
|
+
<slot name="content" @slotchange=${this.__onSlotChange}></slot>
|
|
665
|
+
`;
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
a = e([i("scb-scrollspy")], a);
|
|
669
|
+
//#endregion
|
|
670
|
+
export { a as ScbScrollspy };
|