vanilla-breeze 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +9527 -9580
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/ai-chat.js +6 -6
- package/dist/cdn/components/ai-summary.js +2 -2
- package/dist/cdn/components/analytics-panel.js +2 -2
- package/dist/cdn/components/audio-player.js +4 -4
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +1 -1
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +1 -1
- package/dist/cdn/components/chart-wc.js +13 -13
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +35 -35
- package/dist/cdn/components/comment-thread.js +38 -38
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +2 -2
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/geo-map.js +3 -3
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/icon-wc.js +2 -2
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/manifest.json +60 -56
- package/dist/cdn/components/markdown-editor.js +25 -25
- package/dist/cdn/components/markdown-viewer.js +27 -27
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +2 -2
- package/dist/cdn/components/notification-wc.js +23 -22
- package/dist/cdn/components/page-info.js +6 -6
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +1 -1
- package/dist/cdn/components/pager-wc.js +1 -1
- package/dist/cdn/components/poll-wc.js +1 -1
- package/dist/cdn/components/pop-over.js +1 -1
- package/dist/cdn/components/popularity-index.js +1 -1
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/progress-tracker.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +1 -1
- package/dist/cdn/components/score-card.js +2 -2
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +6 -6
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +1 -1
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/social-links.js +2 -0
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +1 -1
- package/dist/cdn/components/stepper-wc.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-picker.js +44 -212
- package/dist/cdn/components/time-index.js +1 -1
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +2 -2
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +4 -4
- package/dist/cdn/components/trust-filter.js +1 -1
- package/dist/cdn/components/version-switcher.js +6 -6
- package/dist/cdn/components/video-player.js +4 -4
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/fonts/barlow-condensed-OFL.txt +93 -0
- package/dist/cdn/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-500-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-600-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-500-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-600-normal.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/big-shoulders-display-OFL.txt +93 -0
- package/dist/cdn/fonts/big-shoulders-display-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/big-shoulders-display-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/caveat-OFL.txt +93 -0
- package/dist/cdn/fonts/caveat-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/caveat-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/courier-prime-OFL.txt +93 -0
- package/dist/cdn/fonts/courier-prime-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/courier-prime-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/courier-prime-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/courier-prime-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-OFL.txt +93 -0
- package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-OFL.txt +93 -0
- package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-OFL.txt +93 -0
- package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/fira-code-OFL.txt +93 -0
- package/dist/cdn/fonts/fira-code-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/fira-code-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/flow-block-OFL.txt +93 -0
- package/dist/cdn/fonts/flow-block-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/flow-block-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/fraunces-OFL.txt +93 -0
- package/dist/cdn/fonts/fraunces-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/fraunces-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/ibm-plex-mono-OFL.txt +93 -0
- package/dist/cdn/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/ibm-plex-mono-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/ibm-plex-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/inter-OFL.txt +93 -0
- package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-OFL.txt +93 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-OFL.txt +93 -0
- package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/lora-OFL.txt +93 -0
- package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-OFL.txt +93 -0
- package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/newsreader-OFL.txt +93 -0
- package/dist/cdn/fonts/newsreader-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/newsreader-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/newsreader-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/newsreader-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/nunito-OFL.txt +93 -0
- package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/orbitron-OFL.txt +93 -0
- package/dist/cdn/fonts/orbitron-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/playfair-display-OFL.txt +93 -0
- package/dist/cdn/fonts/playfair-display-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/playfair-display-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/press-start-2p-OFL.txt +93 -0
- package/dist/cdn/fonts/press-start-2p-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/press-start-2p-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/redacted-script-OFL.txt +93 -0
- package/dist/cdn/fonts/redacted-script-latin-300-normal.woff2 +0 -0
- package/dist/cdn/fonts/redacted-script-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/redacted-script-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/redacted-script-latin-ext-300-normal.woff2 +0 -0
- package/dist/cdn/fonts/redacted-script-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/redacted-script-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/shantell-sans-OFL.txt +93 -0
- package/dist/cdn/fonts/shantell-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/shantell-sans-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/shantell-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/shantell-sans-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/share-tech-mono-OFL.txt +93 -0
- package/dist/cdn/fonts/share-tech-mono-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/source-code-pro-OFL.txt +93 -0
- package/dist/cdn/fonts/source-code-pro-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/source-code-pro-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/fonts/space-mono-OFL.txt +93 -0
- package/dist/cdn/fonts/space-mono-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/space-mono-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/space-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/space-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/vt323-OFL.txt +93 -0
- package/dist/cdn/fonts/vt323-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/vt323-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/kawaii/fonts/fira-code-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/fira-code-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-normal.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-normal.woff2 +0 -0
- package/dist/cdn/packs/kawaii.full.css +1 -1
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +5 -5
- package/dist/cdn/packs/prototype.full.js +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +44 -212
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +8 -37
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +3 -6
- package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +5 -11
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +13 -7
- package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
- package/dist/cdn/themes/brutalist.tokens.json +5 -11
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +41 -41
- package/dist/cdn/themes/classic.tokens.json +25 -31
- package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +531 -135
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +5 -11
- package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.css +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.css +1 -1
- package/dist/cdn/themes/dusk.tokens.json +10 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +19 -16
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +3 -2
- package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
- package/dist/cdn/themes/high-noon.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +10 -1
- package/dist/cdn/themes/journal-dark.tokens.json +3 -27
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +21 -21
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +2 -14
- package/dist/cdn/themes/manifest.json +37 -37
- package/dist/cdn/themes/midnight.css +1 -1
- package/dist/cdn/themes/midnight.tokens.json +9 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.tokens.json +25 -27
- package/dist/cdn/themes/modern-dark.tokens.json +41 -41
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +21 -21
- package/dist/cdn/themes/nes-dark.tokens.json +3 -27
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +10 -39
- package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +266 -134
- package/dist/cdn/themes/nord-dark.tokens.json +3 -27
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +3 -2
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +5 -14
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +3 -2
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
- package/dist/cdn/themes/solarized.css +1 -1
- package/dist/cdn/themes/solarized.tokens.json +1 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +1 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
- package/dist/cdn/themes/swiss.tokens.json +34 -68
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +286 -120
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +3 -2
- package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +9 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
- package/dist/cdn/themes/win9x.tokens.json +9 -9
- package/dist/cdn/vanilla-breeze-autoload.js +113 -107
- package/dist/cdn/vanilla-breeze-charts.js +13 -13
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +86 -80
- package/dist/cdn/vanilla-breeze-dev.css +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +33 -33
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +158 -325
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var $=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function A(h,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(h);if(customElements.get(h)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(h,n),customElements.define(h,t)}var b=class extends HTMLElement{#t=[];#a;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#a||(this.#a=this.attachInternals());let i=this.#a.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#a||(this.#a=t)}#e(){return this.constructor.formAssociated&&this.#a?this.#a:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var p=86400,k=0;function m(h){return String(h).padStart(2,"0")}function f(h){if(!h)return null;let t=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/.exec(String(h).trim());if(!t)return null;let e=Number(t[1]),i=Number(t[2]),n=Number(t[3]||0);return e>23||i>59||n>59?null:e*3600+i*60+n}function w(h,t){let e=Math.floor(h/3600),i=Math.floor(h%3600/60),n=h%60;return t?`${m(e)}:${m(i)}:${m(n)}`:`${m(e)}:${m(i)}`}function c(h,t){return(h%t+t)%t}function x(h){try{let{hourCycle:t}=new Intl.DateTimeFormat(h||void 0,{hour:"numeric"}).resolvedOptions();return t==="h12"||t==="h11"?"12h":"24h"}catch{return"24h"}}function E(h){let t={am:"AM",pm:"PM",periodFirst:!1};try{let e=new Intl.DateTimeFormat(h||void 0,{hour:"numeric",minute:"2-digit",hourCycle:"h12"}),i=e.formatToParts(new Date(2e3,0,1,9,0)),n=e.formatToParts(new Date(2e3,0,1,21,0)),s=i.find(a=>a.type==="dayPeriod")?.value,r=n.find(a=>a.type==="dayPeriod")?.value;if(s&&r){t.am=s,t.pm=r;let a=i.map(o=>o.type);t.periodFirst=a.indexOf("dayPeriod")<a.indexOf("hour")}}catch{}return t}function C(h,t){let e=h.trim().toLowerCase();if(!e)return null;let i=null,n=[[t.am.toLowerCase(),"AM"],[t.pm.toLowerCase(),"PM"],["a.m.","AM"],["p.m.","PM"],["am","AM"],["pm","PM"],["a","AM"],["p","PM"]].sort((u,l)=>l[0].length-u[0].length);for(let[u,l]of n)if(u){if(e.endsWith(u)){i=l,e=e.slice(0,-u.length).trim();break}if(e.startsWith(u)){i=l,e=e.slice(u.length).trim();break}}if(!/^\d{1,2}(?:[:.]\d{1,2}){0,2}$/.test(e))return null;let s=e.split(/[:.]/).map(Number),r=s[0],a=s[1]??0,o=s[2]??0;if(a>59||o>59)return null;if(i){if(r<1||r>12)return null;i==="AM"?r=r===12?0:r:r=r===12?12:r+12}else if(r>23)return null;return r*3600+a*60+o}var g=class extends b{static formAssociated=!0;static get observedAttributes(){return["disabled","required"]}#t;#a=`tp${++k}`;#e=!1;#s;#i;#y;#h;#r;#f=[];#m=null;#x=[];#c="24h";#v="";#A={am:"AM",pm:"PM",periodFirst:!1};#b=!1;#n=null;#d=null;#w=null;#u=60;#P;#E;#o=!1;#U="";#T=!1;constructor(){super(),this.#t=this.attachInternals(),this._adoptInternals(this.#t)}setup(){let t=this.querySelector(':scope > input[type="time"]');if(!t)return!1;this.#s=t,this.#v=this.closest("[lang]")?.lang||navigator.language||"en-US",this.#A=E(this.#v);let e=this.getAttribute("data-format");this.#c=e==="12h"||e==="24h"?e:x(this.#v),this.#z();let i=t.getAttribute("name");i&&(this.hasAttribute("name")||this.setAttribute("name",i),t.removeAttribute("name")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),this.hasAttribute("disabled")||this.setAttribute("disabled",""));let n=`${this.#a}-no-form`,s=t.getAttribute("form");return s&&s!==n&&!this.hasAttribute("form")&&this.setAttribute("form",s),t.setAttribute("form",n),this.#P===void 0&&(this.#P=t.defaultValue),this.#E!==void 0&&(t.value=this.#E,this.#E=void 0),this.#n=f(t.value),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.listen(t,"click",this.#Y),this.listen(t,"focus",this.#F),this.#J(),this.#Q(),this.#e=!0,this.#G(),this.#D(),this.#L(!1),this.#S(),this.listen(document,"click",this.#X),this.listen(this,"focusout",this.#Z),this.listen(this,"invalid",this.#_),this.#V(this.matches(":disabled")),!0}teardown(){this.#o=!1,this.#y?.remove(),this.#r?.remove(),this.#f=[],this.#x=[],this.#m=null,this.#e=!1,clearTimeout(this.#B),this.#M=""}attributeChangedCallback(t){this.#e&&(t==="disabled"&&this.#V(this.matches(":disabled")),t==="required"&&this.#S())}formDisabledCallback(t){this.#e&&this.#V(t)}#V(t){this.#i.disabled=t,this.#h.disabled=t,t&&this.#p()}#z(){let t=this.#s.getAttribute("step");if(t&&t.trim().toLowerCase()==="any")this.#u=null;else{let i=Number(t);this.#u=Number.isFinite(i)&&i>0?Math.max(1,Math.round(i)):60}this.#d=f(this.#s.getAttribute("min")),this.#w=f(this.#s.getAttribute("max"));let e=f(this.#s.value);this.#b=this.#u!==null&&this.#u%60!==0||e!==null&&e%60!==0}#l(t,e){return this.dataset[`label${t}`]||e}#F=()=>{this.#e&&!this.#i.disabled&&this.#i.focus()};#Y=t=>{t.preventDefault(),this.#F()};#G(){let t=new Set([...Array.from(this.#s.labels||[]),...Array.from(this.#t.labels||[])]),e=[];for(let r of t)r.id||(r.id=`${this.#a}-label-${e.length}`),e.push(r.id),this.listen(r,"click",this.#F);let i=this.#i,n=e.join(" ")||this.#s.getAttribute("aria-labelledby")||this.getAttribute("aria-labelledby");n?i.setAttribute("aria-labelledby",n):i.setAttribute("aria-label",this.#s.getAttribute("aria-label")||this.getAttribute("aria-label")||this.#l("Input","Time"));let s=this.#s.getAttribute("aria-describedby");s&&i.setAttribute("aria-describedby",s)}#J(){this.#y=document.createElement("div"),this.#y.className="time-trigger";let t=document.createElement("input");t.type="text",t.className="time-input",t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("autocomplete","off"),t.setAttribute("placeholder",this.#l("Placeholder","Type a time\u2026")),this.#i=t,this.#y.appendChild(t),this.#h=document.createElement("button"),this.#h.type="button",this.#h.className="time-trigger-icon",this.#h.setAttribute("aria-label",this.#l("Toggle","Toggle time spinners")),this.#h.setAttribute("tabindex","-1");let e=document.createElement("icon-wc");e.setAttribute("name","clock"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),this.#h.appendChild(e),this.#y.appendChild(this.#h),this.appendChild(this.#y),this.listen(this.#h,"click",i=>{i.stopPropagation(),this.#o?this.#p():this.#j(),this.#i.focus()}),this.listen(t,"focus",()=>t.select()),this.listen(t,"keydown",this.#tt),this.listen(t,"blur",this.#et)}#Q(){let t=`${this.#a}-panel`;this.#r=document.createElement("div"),this.#r.className="time-panel",this.#r.id=t,this.#r.setAttribute("role","dialog"),this.#r.setAttribute("aria-modal","false"),this.#r.setAttribute("aria-label",this.#l("Dialog","Choose time")),this.#i.setAttribute("aria-controls",t);let e=this.#u??60,i=e>=3600&&e%3600===0?e/3600:1,n=e>=60&&e<3600&&e%60===0?e/60:1,s=e<60?e:1,r=e>=3600&&e%3600===0,a=this.#c==="12h",o=null;a&&(o=document.createElement("button"),o.type="button",o.className="period-toggle"),this.#m=o,o&&this.#A.periodFirst&&this.#r.appendChild(o);let u=!a&&this.#d!==null&&this.#w!==null&&this.#d<=this.#w;this.#f=[],this.#f.push(this.#q("hour",this.#l("Hours","Hours"),a?1:u?Math.floor(this.#d/3600):0,a?12:u?Math.floor(this.#w/3600):23,i,!1)),this.#r.appendChild(this.#R()),this.#f.push(this.#q("minute",this.#l("Minutes","Minutes"),0,59,n,r)),this.#b&&(this.#r.appendChild(this.#R()),this.#f.push(this.#q("second",this.#l("Seconds","Seconds"),0,59,s,!1))),o&&!this.#A.periodFirst&&this.#r.appendChild(o),this.#x=[...this.#r.querySelectorAll(".time-spinner, .period-toggle")],this.appendChild(this.#r);for(let l of this.#f)this.listen(l.incBtn,"click",()=>this.#k(l,l.delta,"pointer")),this.listen(l.decBtn,"click",()=>this.#k(l,-l.delta,"pointer")),this.listen(l.el,"keydown",d=>this.#it(d,l));if(this.#m){let l=this.#m;this.listen(l,"click",d=>{this.#rt(d.detail===0?"keyboard":"pointer")}),this.listen(l,"keydown",d=>this.#K(d,l))}}#q(t,e,i,n,s,r){let a=document.createElement("div");a.className="time-spinner",a.dataset.unit=t,a.setAttribute("role","spinbutton"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin",String(i)),a.setAttribute("aria-valuemax",String(n)),r&&a.setAttribute("aria-readonly","true"),a.setAttribute("tabindex","0");let o=document.createElement("button");o.type="button",o.className="time-inc",o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex","-1"),o.textContent="\u25B2",r&&(o.disabled=!0);let u=document.createElement("span");u.className="time-value";let l=document.createElement("button");return l.type="button",l.className="time-dec",l.setAttribute("aria-hidden","true"),l.setAttribute("tabindex","-1"),l.textContent="\u25BC",r&&(l.disabled=!0),a.append(o,u,l),this.#r.appendChild(a),{unit:t,el:a,valueEl:u,incBtn:o,decBtn:l,min:i,max:n,delta:s,readOnly:r}}#R(){let t=document.createElement("span");return t.className="time-sep",t.setAttribute("aria-hidden","true"),t.textContent=":",t}#j(){this.#o||this.#i.disabled||(this.#o=!0,this.#r.setAttribute("data-open",""),this.#i.setAttribute("aria-expanded","true"))}#p(){this.#o&&(this.#o=!1,this.#r.removeAttribute("data-open"),this.#i.setAttribute("aria-expanded","false"))}#X=t=>{this.#o&&!this.contains(t.target)&&this.#p()};#Z=t=>{let e=t.relatedTarget;e instanceof Node&&this.contains(e)||this.#p()};#C(t){try{let e=new Date(2e3,0,1,Math.floor(t/3600),Math.floor(t%3600/60),t%60),i={hour:this.#c==="12h"?"numeric":"2-digit",minute:"2-digit",hourCycle:this.#c==="12h"?"h12":"h23"};return this.#b&&(i.second="2-digit"),new Intl.DateTimeFormat(this.#v,i).format(e)}catch{return w(t,this.#b)}}#tt=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation(),this.#H(),this.#o&&this.#p();return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#o||this.#j(),this.#x[0]?.focus();return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#o&&this.#p(),this.#D();return}};#H(){let t=this.#i.value.trim();if(!t)this.#g(null,"keyboard");else{let e=C(t,this.#A);e!==null&&this.#g(e,"keyboard")}this.#D()}#et=t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#H(),this.#_())};#_=()=>{this.#e&&(this.#T||(this.#T=!0,this.#S()),this.#s.dispatchEvent(new Event("blur",{bubbles:!0})))};#K(t,e){let i=this.#x.indexOf(e),n=getComputedStyle(this).direction==="rtl",s=n?"ArrowLeft":"ArrowRight",r=n?"ArrowRight":"ArrowLeft";return t.key===s||t.key===r?(t.preventDefault(),this.#x[i+(t.key===s?1:-1)]?.focus(),!0):t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),this.#p(),this.#i.focus(),!0):!1}#it(t,e){if(this.#K(t,e.el))return;let i=e.unit==="hour"?e.delta:e.delta*10;switch(t.key){case"ArrowUp":t.preventDefault(),this.#k(e,e.delta,"keyboard");break;case"ArrowDown":t.preventDefault(),this.#k(e,-e.delta,"keyboard");break;case"PageUp":t.preventDefault(),this.#k(e,i,"keyboard");break;case"PageDown":t.preventDefault(),this.#k(e,-i,"keyboard");break;case"Home":t.preventDefault(),this.#O(e,e.min,1,"keyboard");break;case"End":t.preventDefault(),this.#O(e,e.max,-1,"keyboard");break;default:/^\d$/.test(t.key)&&(t.preventDefault(),this.#st(t.key,e))}}#M="";#B;#st(t,e){clearTimeout(this.#B),this.#M+=t;let i=()=>{let n=Math.min(Math.max(Number(this.#M),e.min),e.max);this.#M="",this.#O(e,n,0,"keyboard")};this.#M.length>=2||Number(this.#M)*10>e.max?i():this.#B=setTimeout(i,800)}#I(){return this.#$(this.#d??0,1)}#$(t,e){let i=c(t,p),n=this.#u;if(n){let a=this.#d??0,o=(i-a)/n,u=e>0?Math.floor(o):e<0?Math.ceil(o):Math.round(o);i=c(a+u*n,p)}let s=this.#d,r=this.#w;return s!==null&&r!==null&&s<=r?(i<s&&(i=s),i>r&&(i=n?s+Math.floor((r-s)/n)*n:r)):s!==null&&r===null&&i<s?i=s:r!==null&&s===null&&i>r&&(i=n?Math.floor(r/n)*n:r),i}#k(t,e,i){if(t.readOnly)return;if(this.#n===null){this.#g(this.#I(),i);return}let n=this.#n,s=Math.floor(n/3600),r=Math.floor(n%3600/60),a=n%60,o;t.unit==="hour"?o=(this.#c==="12h"?c(s%12+e,12)+(s>=12?12:0):c(s+e,24))*3600+r*60+a:t.unit==="minute"?o=s*3600+c(r+e,60)*60+a:o=s*3600+r*60+c(a+e,60),this.#g(this.#$(o,e),i)}#O(t,e,i,n){if(t.readOnly)return;let s=this.#n??this.#I(),r=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60,u;t.unit==="hour"?u=(this.#c==="12h"?e%12+(r>=12?12:0):e)*3600+a*60+o:t.unit==="minute"?u=r*3600+e*60+o:u=r*3600+a*60+e,this.#g(this.#$(u,i),n)}#rt(t){let e=this.#n??this.#I();this.#g(this.#$(c(e+12*3600,p),0),t)}#g(t,e){let i=this.value;return this.#n=t,t!==null&&t%60!==0&&!this.#b&&(this.#b=!0),this.#D(),this.value===i?!1:(this.#L(),this.#S(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{...this.#nt(),source:e}})),!0)}#nt(){let t=this.#n;return t===null?{value:"",hours:null,minutes:null,seconds:null}:{value:this.value,hours:Math.floor(t/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}#D(){if(!this.#e)return;let t=this.#n;this.#i.value=t===null?"":this.#C(t);let e=this.#l("Empty","Not set"),i=t===null?null:Math.floor(t/3600),n={hour:i===null?null:this.#c==="12h"?i%12||12:i,minute:t===null?null:Math.floor(t%3600/60),second:t===null?null:t%60},s=i===null?"":i>=12?this.#A.pm:this.#A.am;for(let r of this.#f){let a=n[r.unit];if(r.valueEl.textContent=a===null?"--":m(a),a===null){r.el.removeAttribute("aria-valuenow"),r.el.setAttribute("aria-valuetext",e);continue}r.el.setAttribute("aria-valuenow",String(a));let o;try{o=r.unit==="hour"&&this.#c==="12h"?new Intl.DateTimeFormat(this.#v,{hour:"numeric",hourCycle:"h12"}).format(new Date(2e3,0,1,i)):new Intl.NumberFormat(this.#v,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(a)}catch{o=r.unit==="hour"&&s?`${a} ${s}`:String(a)}r.el.setAttribute("aria-valuetext",o)}this.#m&&(this.#m.textContent=s||"--",this.#m.setAttribute("aria-label",`${this.#l("Period","AM/PM")}: ${s||e}`))}#L(t=!0){let e=this.value;this.#t.setFormValue(e||null),this.#s.value=e,t&&this.#s.dispatchEvent(new Event("input",{bubbles:!0}))}#N(t,e,i,n={}){let s=this.#s.getAttribute(`data-message-${t.toLowerCase()}`)??this.#l(e,i);for(let[r,a]of Object.entries(n))s=s.replaceAll(`{${r}}`,a);return s}#S(){if(!this.#e)return!1;let t=this.hasAttribute("required")||this.#s.hasAttribute("required");t?this.#i.setAttribute("aria-required","true"):this.#i.removeAttribute("aria-required");let e=this.#n,i=this.#d,n=this.#w,s={},r="";if(e===null)t&&(s={valueMissing:!0},r=this.#N("valueMissing","Required","Please select a time"));else{let u=i!==null&&n!==null&&i>n,l=i!==null&&e<i,d=n!==null&&e>n;if(u?l&&d:l)s=u?{rangeUnderflow:!0,rangeOverflow:!0}:{rangeUnderflow:!0},r=this.#N("rangeUnderflow","RangeUnderflow","Choose a time at or after {time}",{time:this.#C(i)});else if(!u&&d)s={rangeOverflow:!0},r=this.#N("rangeOverflow","RangeOverflow","Choose a time at or before {time}",{time:this.#C(n)});else if(this.#u&&c(e-(i??0),this.#u)!==0){let y=this.#$(e,1),M=c(y+this.#u,p);s={stepMismatch:!0},r=this.#N("stepMismatch","StepMismatch","Choose a valid time. The nearest are {lower} and {upper}",{lower:this.#C(y),upper:this.#C(M)})}}let a=this.#t.validationMessage;return r?this.#t.setValidity(s,r,this.#i):this.#t.setValidity({}),r&&(e!==null||this.#T)?this.#i.setAttribute("aria-invalid","true"):this.#i.removeAttribute("aria-invalid"),(this.#s.validationMessage===this.#U||!this.#s.validity.customError)&&(this.#s.setCustomValidity(r),this.#U=r),a!==r}#W(t){this.#n=t,this.#D(),this.#L(),this.#S()}formResetCallback(){this.#e&&(this.#T=!1,this.#W(f(this.#P)))}formStateRestoreCallback(t){!this.#e||typeof t!="string"||this.#W(f(t))}get form(){return this.#t.form}get validity(){return this.#t.validity}get validationMessage(){return this.#t.validationMessage}get willValidate(){return this.#t.willValidate}checkValidity(){return this.#t.checkValidity()}reportValidity(){return this.#t.reportValidity()}get value(){return this.#e?this.#n===null?"":w(this.#n,this.#b):this.#E??""}set value(t){let e=t==null?"":String(t).trim(),i=e?f(e):null;if(!(e&&i===null)){if(!this.#e){this.#E=e;return}this.#g(i,"api")}}};A("time-picker",g);export{g as TimePicker};
|
|
1
|
+
var P=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function A(u,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(u);if(customElements.get(u)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(u,n),customElements.define(u,t)}var b=class extends HTMLElement{#t=[];#a;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#a||(this.#a=this.attachInternals());let i=this.#a.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#a||(this.#a=t)}#e(){return this.constructor.formAssociated&&this.#a?this.#a:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var p=86400,M=0;function m(u){return String(u).padStart(2,"0")}function f(u){if(!u)return null;let t=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/.exec(String(u).trim());if(!t)return null;let e=Number(t[1]),i=Number(t[2]),n=Number(t[3]||0);return e>23||i>59||n>59?null:e*3600+i*60+n}function w(u,t){let e=Math.floor(u/3600),i=Math.floor(u%3600/60),n=u%60;return t?`${m(e)}:${m(i)}:${m(n)}`:`${m(e)}:${m(i)}`}function c(u,t){return(u%t+t)%t}function k(u){try{let{hourCycle:t}=new Intl.DateTimeFormat(u||void 0,{hour:"numeric"}).resolvedOptions();return t==="h12"||t==="h11"?"12h":"24h"}catch{return"24h"}}function x(u){let t={am:"AM",pm:"PM",periodFirst:!1};try{let e=new Intl.DateTimeFormat(u||void 0,{hour:"numeric",minute:"2-digit",hourCycle:"h12"}),i=e.formatToParts(new Date(2e3,0,1,9,0)),n=e.formatToParts(new Date(2e3,0,1,21,0)),s=i.find(a=>a.type==="dayPeriod")?.value,r=n.find(a=>a.type==="dayPeriod")?.value;if(s&&r){t.am=s,t.pm=r;let a=i.map(o=>o.type);t.periodFirst=a.indexOf("dayPeriod")<a.indexOf("hour")}}catch{}return t}function C(u,t){let e=u.trim().toLowerCase();if(!e)return null;let i=null,n=[[t.am.toLowerCase(),"AM"],[t.pm.toLowerCase(),"PM"],["a.m.","AM"],["p.m.","PM"],["am","AM"],["pm","PM"],["a","AM"],["p","PM"]].sort((h,l)=>l[0].length-h[0].length);for(let[h,l]of n)if(h){if(e.endsWith(h)){i=l,e=e.slice(0,-h.length).trim();break}if(e.startsWith(h)){i=l,e=e.slice(h.length).trim();break}}if(!/^\d{1,2}(?:[:.]\d{1,2}){0,2}$/.test(e))return null;let s=e.split(/[:.]/).map(Number),r=s[0],a=s[1]??0,o=s[2]??0;if(a>59||o>59)return null;if(i){if(r<1||r>12)return null;i==="AM"?r=r===12?0:r:r=r===12?12:r+12}else if(r>23)return null;return r*3600+a*60+o}var g=class extends b{static formAssociated=!0;static get observedAttributes(){return["disabled","required"]}#t;#a=`tp${++M}`;#e=!1;#s;#i;#y;#u;#r;#f=[];#m=null;#k=[];#c="24h";#v="";#A={am:"AM",pm:"PM",periodFirst:!1};#b=!1;#n=null;#d=null;#w=null;#h=60;#F;#x;#o=!1;#H="";#P=!1;constructor(){super(),this.#t=this.attachInternals(),this._adoptInternals(this.#t)}setup(){let t=this.querySelector(':scope > input[type="time"]');if(!t)return!1;this.#s=t,this.#v=this.closest("[lang]")?.lang||navigator.language||"en-US",this.#A=x(this.#v);let e=this.getAttribute("data-format");this.#c=e==="12h"||e==="24h"?e:k(this.#v),this.#Y();let i=t.getAttribute("name");i&&(this.hasAttribute("name")||this.setAttribute("name",i),t.removeAttribute("name")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),this.hasAttribute("disabled")||this.setAttribute("disabled",""));let n=`${this.#a}-no-form`,s=t.getAttribute("form");return s&&s!==n&&!this.hasAttribute("form")&&this.setAttribute("form",s),t.setAttribute("form",n),this.#F===void 0&&(this.#F=t.defaultValue),this.#x!==void 0&&(t.value=this.#x,this.#x=void 0),this.#n=f(t.value),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.listen(t,"click",this.#G),this.listen(t,"focus",this.#V),this.#Q(),this.#X(),this.#e=!0,this.#J(),this.#S(),this.#_(!1),this.#T(),this.listen(document,"click",this.#Z),this.listen(this,"focusout",this.#N),this.listen(this,"invalid",this.#K),this.#B(this.matches(":disabled")),!0}teardown(){this.#o=!1,this.#y?.remove(),this.#r?.remove(),this.#f=[],this.#k=[],this.#m=null,this.#e=!1,clearTimeout(this.#q),this.#E=""}attributeChangedCallback(t){this.#e&&(t==="disabled"&&this.#B(this.matches(":disabled")),t==="required"&&this.#T())}formDisabledCallback(t){this.#e&&this.#B(t)}#B(t){this.#i.disabled=t,this.#u.disabled=t,t&&this.#p()}#Y(){let t=this.#s.getAttribute("step");if(t&&t.trim().toLowerCase()==="any")this.#h=null;else{let i=Number(t);this.#h=Number.isFinite(i)&&i>0?Math.max(1,Math.round(i)):60}this.#d=f(this.#s.getAttribute("min")),this.#w=f(this.#s.getAttribute("max"));let e=f(this.#s.value);this.#b=this.#h!==null&&this.#h%60!==0||e!==null&&e%60!==0}#l(t,e){return this.dataset[`label${t}`]||e}#V=()=>{this.#e&&!this.#i.disabled&&this.#i.focus()};#G=t=>{t.preventDefault(),this.#V()};#J(){let t=new Set([...Array.from(this.#s.labels||[]),...Array.from(this.#t.labels||[])]),e=[];for(let r of t)r.id||(r.id=`${this.#a}-label-${e.length}`),e.push(r.id),this.listen(r,"click",this.#V);let i=this.#i,n=e.join(" ")||this.#s.getAttribute("aria-labelledby")||this.getAttribute("aria-labelledby");n?i.setAttribute("aria-labelledby",n):i.setAttribute("aria-label",this.#s.getAttribute("aria-label")||this.getAttribute("aria-label")||this.#l("Input","Time"));let s=this.#s.getAttribute("aria-describedby");s&&i.setAttribute("aria-describedby",s)}#Q(){this.#y=document.createElement("div"),this.#y.className="time-trigger";let t=document.createElement("input");t.type="text",t.className="time-input",t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("autocomplete","off"),t.setAttribute("placeholder",this.#l("Placeholder","Type a time\u2026")),this.#i=t,this.#y.appendChild(t),this.#u=document.createElement("button"),this.#u.type="button",this.#u.className="time-trigger-icon",this.#u.setAttribute("aria-label",this.#l("Toggle","Toggle time spinners")),this.#u.setAttribute("tabindex","-1");let e=document.createElement("icon-wc");e.setAttribute("name","clock"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),this.#u.appendChild(e),this.#y.appendChild(this.#u),this.appendChild(this.#y),this.listen(this.#u,"click",i=>{i.stopPropagation(),this.#o?this.#p():this.#R(),this.#i.focus()}),this.listen(t,"focus",()=>t.select()),this.listen(t,"keydown",this.#tt),this.listen(t,"blur",this.#et)}#X(){let t=`${this.#a}-panel`;this.#r=document.createElement("div"),this.#r.className="time-panel",this.#r.id=t,this.#r.setAttribute("role","dialog"),this.#r.setAttribute("aria-modal","false"),this.#r.setAttribute("aria-label",this.#l("Dialog","Choose time")),this.#i.setAttribute("aria-controls",t);let e=this.#h??60,i=e>=3600&&e%3600===0?e/3600:1,n=e>=60&&e<3600&&e%60===0?e/60:1,s=e<60?e:1,r=e>=3600&&e%3600===0,a=this.#c==="12h",o=null;a&&(o=document.createElement("button"),o.type="button",o.className="period-toggle"),this.#m=o,o&&this.#A.periodFirst&&this.#r.appendChild(o);let h=!a&&this.#d!==null&&this.#w!==null&&this.#d<=this.#w;this.#f=[],this.#f.push(this.#L("hour",this.#l("Hours","Hours"),a?1:h?Math.floor(this.#d/3600):0,a?12:h?Math.floor(this.#w/3600):23,i,!1)),this.#r.appendChild(this.#j()),this.#f.push(this.#L("minute",this.#l("Minutes","Minutes"),0,59,n,r)),this.#b&&(this.#r.appendChild(this.#j()),this.#f.push(this.#L("second",this.#l("Seconds","Seconds"),0,59,s,!1))),o&&!this.#A.periodFirst&&this.#r.appendChild(o),this.#k=[...this.#r.querySelectorAll(".time-spinner, .period-toggle")],this.appendChild(this.#r);for(let l of this.#f)this.listen(l.incBtn,"click",()=>this.#M(l,l.delta,"pointer")),this.listen(l.decBtn,"click",()=>this.#M(l,-l.delta,"pointer")),this.listen(l.el,"keydown",d=>this.#it(d,l));if(this.#m){let l=this.#m;this.listen(l,"click",d=>{this.#rt(d.detail===0?"keyboard":"pointer")}),this.listen(l,"keydown",d=>this.#z(d,l))}}#L(t,e,i,n,s,r){let a=document.createElement("div");a.className="time-spinner",a.dataset.unit=t,a.setAttribute("role","spinbutton"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin",String(i)),a.setAttribute("aria-valuemax",String(n)),r&&a.setAttribute("aria-readonly","true"),a.setAttribute("tabindex","0");let o=document.createElement("button");o.type="button",o.className="time-inc",o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex","-1"),o.textContent="\u25B2",r&&(o.disabled=!0);let h=document.createElement("span");h.className="time-value";let l=document.createElement("button");return l.type="button",l.className="time-dec",l.setAttribute("aria-hidden","true"),l.setAttribute("tabindex","-1"),l.textContent="\u25BC",r&&(l.disabled=!0),a.append(o,h,l),this.#r.appendChild(a),{unit:t,el:a,valueEl:h,incBtn:o,decBtn:l,min:i,max:n,delta:s,readOnly:r}}#j(){let t=document.createElement("span");return t.className="time-sep",t.setAttribute("aria-hidden","true"),t.textContent=":",t}#R(){this.#o||this.#i.disabled||(this.#o=!0,this.#r.setAttribute("data-open",""),this.#i.setAttribute("aria-expanded","true"))}#p(){this.#o&&(this.#o=!1,this.#r.removeAttribute("data-open"),this.#i.setAttribute("aria-expanded","false"))}#Z=t=>{this.#o&&!this.contains(t.target)&&this.#p()};#N=t=>{let e=t.relatedTarget;e instanceof Node&&this.contains(e)||this.#p()};#C(t){try{let e=new Date(2e3,0,1,Math.floor(t/3600),Math.floor(t%3600/60),t%60),i={hour:this.#c==="12h"?"numeric":"2-digit",minute:"2-digit",hourCycle:this.#c==="12h"?"h12":"h23"};return this.#b&&(i.second="2-digit"),new Intl.DateTimeFormat(this.#v,i).format(e)}catch{return w(t,this.#b)}}#tt=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation(),this.#U(),this.#o&&this.#p();return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#o||this.#R(),this.#k[0]?.focus();return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#o&&this.#p(),this.#S();return}};#U(){let t=this.#i.value.trim();if(!t)this.#g(null,"keyboard");else{let e=C(t,this.#A);e!==null&&this.#g(e,"keyboard")}this.#S()}#et=t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#U(),this.#K())};#K=()=>{this.#e&&(this.#P||(this.#P=!0,this.#T()),this.#s.dispatchEvent(new Event("blur",{bubbles:!0})))};#z(t,e){let i=this.#k.indexOf(e),n=getComputedStyle(this).direction==="rtl",s=n?"ArrowLeft":"ArrowRight",r=n?"ArrowRight":"ArrowLeft";return t.key===s||t.key===r?(t.preventDefault(),this.#k[i+(t.key===s?1:-1)]?.focus(),!0):t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),this.#p(),this.#i.focus(),!0):!1}#it(t,e){if(this.#z(t,e.el))return;let i=e.unit==="hour"?e.delta:Math.ceil(10/e.delta)*e.delta;switch(t.key){case"ArrowUp":t.preventDefault(),this.#M(e,e.delta,"keyboard");break;case"ArrowDown":t.preventDefault(),this.#M(e,-e.delta,"keyboard");break;case"PageUp":t.preventDefault(),this.#M(e,i,"keyboard");break;case"PageDown":t.preventDefault(),this.#M(e,-i,"keyboard");break;case"Home":t.preventDefault(),this.#I(e,e.min,1,"keyboard");break;case"End":t.preventDefault(),this.#I(e,e.max,-1,"keyboard");break;default:/^\d$/.test(t.key)&&(t.preventDefault(),this.#st(t.key,e))}}#E="";#q;#st(t,e){clearTimeout(this.#q),this.#E+=t;let i=()=>{let n=Math.min(Math.max(Number(this.#E),e.min),e.max);this.#E="",this.#I(e,n,0,"keyboard")};this.#E.length>=2||Number(this.#E)*10>e.max?i():this.#q=setTimeout(i,800)}#O(){return this.#$(this.#d??0,1)}#$(t,e){let i=c(t,p),n=this.#h;if(n){let a=this.#d??0,o=(i-a)/n,h=e>0?Math.floor(o):e<0?Math.ceil(o):Math.round(o);i=c(a+h*n,p)}let s=this.#d,r=this.#w;return s!==null&&r!==null&&s<=r?(i<s&&(i=s),i>r&&(i=n?s+Math.floor((r-s)/n)*n:r)):s!==null&&r===null&&i<s?i=s:r!==null&&s===null&&i>r&&(i=n?Math.floor(r/n)*n:r),i}#M(t,e,i){if(t.readOnly)return;if(this.#n===null){this.#g(this.#O(),i);return}let n=this.#n,s=Math.floor(n/3600),r=Math.floor(n%3600/60),a=n%60,o;t.unit==="hour"?o=(this.#c==="12h"?c(s%12+e,12)+(s>=12?12:0):c(s+e,24))*3600+r*60+a:t.unit==="minute"?o=s*3600+c(r+e,60)*60+a:o=s*3600+r*60+c(a+e,60),this.#g(this.#$(o,e),i)}#I(t,e,i,n){if(t.readOnly)return;let s=this.#n??this.#O(),r=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60,h;t.unit==="hour"?h=(this.#c==="12h"?e%12+(r>=12?12:0):e)*3600+a*60+o:t.unit==="minute"?h=r*3600+e*60+o:h=r*3600+a*60+e,this.#g(this.#$(h,i),n)}#rt(t){let e=this.#n??this.#O();this.#g(this.#$(c(e+12*3600,p),0),t)}#g(t,e){let i=this.value;return this.#n=t,t!==null&&t%60!==0&&!this.#b&&(this.#b=!0),this.#S(),this.value===i?!1:(this.#_(),this.#T(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{...this.#nt(),source:e}})),!0)}#nt(){let t=this.#n;return t===null?{value:"",hours:null,minutes:null,seconds:null}:{value:this.value,hours:Math.floor(t/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}#S(){if(!this.#e)return;let t=this.#n;this.#i.value=t===null?"":this.#C(t);let e=this.#l("Empty","Not set"),i=t===null?null:Math.floor(t/3600),n={hour:i===null?null:this.#c==="12h"?i%12||12:i,minute:t===null?null:Math.floor(t%3600/60),second:t===null?null:t%60},s=i===null?"":i>=12?this.#A.pm:this.#A.am;for(let r of this.#f){let a=n[r.unit];if(r.valueEl.textContent=a===null?"--":m(a),a===null){r.el.removeAttribute("aria-valuenow"),r.el.setAttribute("aria-valuetext",e);continue}r.el.setAttribute("aria-valuenow",String(a));let o;try{o=r.unit==="hour"&&this.#c==="12h"?new Intl.DateTimeFormat(this.#v,{hour:"numeric",hourCycle:"h12"}).format(new Date(2e3,0,1,i)):new Intl.NumberFormat(this.#v,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(a)}catch{o=r.unit==="hour"&&s?`${a} ${s}`:String(a)}r.el.setAttribute("aria-valuetext",o)}this.#m&&(this.#m.textContent=s||"--",this.#m.setAttribute("aria-label",`${this.#l("Period","AM/PM")}: ${s||e}`))}#_(t=!0){let e=this.value;this.#t.setFormValue(e||null),this.#s.value=e,t&&this.#s.dispatchEvent(new Event("input",{bubbles:!0}))}#D(t,e,i,n={}){let s=this.#s.getAttribute(`data-message-${t.toLowerCase()}`)??this.#l(e,i);for(let[r,a]of Object.entries(n))s=s.replaceAll(`{${r}}`,a);return s}#T(){if(!this.#e)return!1;let t=this.hasAttribute("required")||this.#s.hasAttribute("required");t?this.#i.setAttribute("aria-required","true"):this.#i.removeAttribute("aria-required");let e=this.#n,i=this.#d,n=this.#w,s={},r="";if(e===null)t&&(s={valueMissing:!0},r=this.#D("valueMissing","Required","Please select a time"));else{let h=i!==null&&n!==null&&i>n,l=i!==null&&e<i,d=n!==null&&e>n;if(h?l&&d:l)s=h?{rangeUnderflow:!0,rangeOverflow:!0}:{rangeUnderflow:!0},r=this.#D("rangeUnderflow","RangeUnderflow","Choose a time at or after {time}",{time:this.#C(i)});else if(!h&&d)s={rangeOverflow:!0},r=this.#D("rangeOverflow","RangeOverflow","Choose a time at or before {time}",{time:this.#C(n)});else if(this.#h&&c(e-(i??0),this.#h)!==0){let y=this.#$(e,1),E=c(y+this.#h,p);s={stepMismatch:!0},r=this.#D("stepMismatch","StepMismatch","Choose a valid time. The nearest are {lower} and {upper}",{lower:this.#C(y),upper:this.#C(E)})}}let a=this.#t.validationMessage;return r?this.#t.setValidity(s,r,this.#i):this.#t.setValidity({}),r&&(e!==null||this.#P)?this.#i.setAttribute("aria-invalid","true"):this.#i.removeAttribute("aria-invalid"),(this.#s.validationMessage===this.#H||!this.#s.validity.customError)&&(this.#s.setCustomValidity(r),this.#H=r),a!==r}#W(t){this.#n=t,this.#S(),this.#_(),this.#T()}formResetCallback(){this.#e&&(this.#P=!1,this.#W(f(this.#F)))}formStateRestoreCallback(t){!this.#e||typeof t!="string"||this.#W(f(t))}get form(){return this.#t.form}get validity(){return this.#t.validity}get validationMessage(){return this.#t.validationMessage}get willValidate(){return this.#t.willValidate}checkValidity(){return this.#t.checkValidity()}reportValidity(){return this.#t.reportValidity()}get value(){return this.#e?this.#n===null?"":w(this.#n,this.#b):this.#x??""}set value(t){let e=t==null?"":String(t).trim(),i=e?f(e):null;if(!(e&&i===null)){if(!this.#e){this.#x=e;return}this.#g(i,"api")}}};A("time-picker",g);export{g as TimePicker};
|
|
2
2
|
//# sourceMappingURL=time-picker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var u=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#i(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var
|
|
1
|
+
var u=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#i(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var T=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function p(a,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=b.get(a);if(customElements.get(a)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(a,s),customElements.define(a,t)}var g={region:"Notifications",dismiss:"Dismiss",info:"Info",success:"Success",warning:"Warning",error:"Error"},v=["info","success","warning","error"],E={info:"ⓘ",success:"✓",warning:"⚠",error:"✗"},y=300,h=class extends u{#e=[];#t=[];#i=new WeakMap;#n=!1;#r=!1;#a=new Set;setup(){this.#c("role","log"),this.#c("aria-live","polite"),this.#c("aria-relevant","additions"),this.#c("aria-label",this.#d("region")),this.listen(this,"pointerover",()=>{this.#n||(this.#n=!0,this.#s())}),this.listen(this,"pointerout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#n=!1,this.#s())}),this.listen(this,"focusin",()=>{this.#r=!0,this.#s()}),this.listen(this,"focusout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#r=!1,this.#s())}),this.listen(this,"keydown",t=>{if(t.key!=="Escape")return;let e=t.target.closest?.(".toast");e&&this.#t.includes(e)&&(t.preventDefault(),this.dismiss(e))}),this.listen(document,"visibilitychange",()=>this.#s()),this.#t=this.#t.filter(t=>t.parentNode===this),this.#n=!!this.querySelector(".toast:hover"),this.#r=this.contains(document.activeElement),this.#l(),this.#s()}teardown(){for(let t of[...this.#t]){let e=this.#i.get(t);e&&(e.hiding?this.#f(t):this.#h(e))}for(let t of this.#a)this.removeAttribute(t);this.#a.clear()}show(t){let{message:e,variant:i="info",duration:s=this.#E(),dismissible:n=!0,action:r,onAction:o,source:c="api"}=t,f=v.includes(i)?i:"info",d=this.#b({message:e,variant:f,dismissible:n,action:r,onAction:o}),l=document.activeElement;this.#i.set(d,{message:String(e??""),duration:Math.max(0,Number(s)||0),remaining:Math.max(0,Number(s)||0),startedAt:0,timer:void 0,returnFocus:l&&!this.contains(l)?l:null,hiding:!1});let m=!this.isConnected||this.#t.length>=this.#m();return m?this.#e.push({toast:d,duration:s}):this.#u(d),this.dispatchEvent(new CustomEvent("toast-msg:enqueued",{detail:{message:e,variant:f,duration:s,source:c,toast:d,queued:m},bubbles:!0})),d}dismiss(t){let e=this.#e.findIndex(i=>i.toast===t);if(e>-1){this.#e.splice(e,1);return}this.#o(t)}dismissAll(){this.#e=[],[...this.#t].forEach(t=>this.#o(t))}get queue(){let t=(e,i)=>({message:this.#i.get(e)?.message??"",variant:e.getAttribute("data-variant")||"info",state:i});return[...this.#t.map(e=>t(e,"visible")),...this.#e.map(({toast:e})=>t(e,"queued"))]}#c(t,e){this.hasAttribute(t)&&!this.#a.has(t)||(this.setAttribute(t,e),this.#a.add(t))}#d(t){return this.getAttribute(`data-label-${t}`)??g[t]??t}#b({message:t,variant:e,dismissible:i,action:s,onAction:n}){let r=document.createElement("div");r.className="toast",r.setAttribute("data-variant",e);let o=c=>this.#y(c);return r.innerHTML=`
|
|
2
2
|
<span class="icon" aria-hidden="true">${E[e]}</span>
|
|
3
3
|
<span class="message"><span class="variant-label">${o(this.#d(e))}: </span>${o(t)}</span>
|
|
4
4
|
${s?`<button type="button" class="action">${o(s)}</button>`:""}
|
|
5
5
|
${i?`<button type="button" class="close" aria-label="${o(this.#d("dismiss"))}">✕</button>`:""}
|
|
6
|
-
`,r.querySelector(".close")?.addEventListener("click",()=>this.#o(r)),s&&r.querySelector(".action")?.addEventListener("click",()=>{n?.(),this.#o(r)}),r}#u(t){this.appendChild(t),this.#t.push(t),requestAnimationFrame(()=>{t.getAttribute("data-state")!=="hiding"&&t.setAttribute("data-state","visible")}),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:show",{bubbles:!0,detail:{toast:t}}))}#
|
|
6
|
+
`,r.querySelector(".close")?.addEventListener("click",()=>this.#o(r)),s&&r.querySelector(".action")?.addEventListener("click",()=>{n?.(),this.#o(r)}),r}#u(t){this.appendChild(t),this.#t.push(t),requestAnimationFrame(()=>{t.getAttribute("data-state")!=="hiding"&&t.setAttribute("data-state","visible")}),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:show",{bubbles:!0,detail:{toast:t}}))}#l(){for(;this.isConnected&&this.#e.length&&this.#t.length<this.#m();){let{toast:t}=this.#e.shift();this.#u(t)}}get#p(){return this.#n||this.#r||document.visibilityState==="hidden"}#s(){let t=this.#p||!this.isConnected;for(let e of this.#t){let i=this.#i.get(e);!i||i.hiding||i.duration<=0||(t?this.#h(i):i.timer===void 0&&this.#g(e,i))}}#g(t,e){e.startedAt=performance.now(),e.timer=setTimeout(()=>{e.timer=void 0,this.#o(t)},e.remaining)}#h(t){t.timer!==void 0&&(clearTimeout(t.timer),t.timer=void 0,t.remaining=Math.max(0,t.remaining-(performance.now()-t.startedAt)))}#o(t){let e=this.#i.get(t);if(!e||e.hiding||t.parentNode!==this)return;e.hiding=!0,e.timer!==void 0&&clearTimeout(e.timer),e.timer=void 0,this.#v(t,e),t.setAttribute("data-state","hiding");let i=()=>this.#f(t);t.addEventListener("animationend",i,{once:!0}),setTimeout(i,y)}#f(t){if(t.parentNode!==this&&!this.#t.includes(t))return;t.remove();let e=this.#t.indexOf(t);e>-1&&this.#t.splice(e,1),this.#r=this.contains(document.activeElement),this.#t.length||(this.#n=!1),this.#l(),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:hide",{bubbles:!0,detail:{toast:t}}))}#v(t,e){if(!t.contains(document.activeElement))return;let i=this.#t.filter(c=>c!==t&&!this.#i.get(c)?.hiding),s=this.#t.indexOf(t),r=(i.find(c=>this.#t.indexOf(c)>s)??i[i.length-1])?.querySelector("button");if(r){r.focus();return}let o=e.returnFocus;o instanceof HTMLElement&&o.isConnected&&o.focus()}#E(){let t=this.getAttribute("duration"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)?e:5e3}#m(){let t=this.getAttribute("max"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)&&e>0?e:5}#y(t){let e=document.createElement("div");return e.textContent=t??"",e.innerHTML}};p("toast-msg",h);export{h as ToastMsg};
|
|
7
7
|
//# sourceMappingURL=toast-msg.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#e||(this.#e=t)}#i(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var D=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function f(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=S.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(s,n),customElements.define(s,t)}var m=CSS.supports("anchor-name","--x"),N=CSS.supports("position-area","bottom"),I=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),V=["auto","manual","hint"];function B(s){let t=V.includes(s||"")?s:"auto";return t==="hint"&&!I?"auto":t}var q=["top","bottom","left","right","inset-inline-start","inset-inline-end"],H=["position","top","left","right","bottom","margin"],C=8,R=0,L=0;function T(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var y=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#i=`--pop-over-anchor-${++L}`;#o=!1;#s=!1;#n=!1;setup(){if(this.id||(this.id=`pop-over-${++R}`),(!this.hasAttribute("popover")||this.#o)&&this.#r(),this.#l(),this.#u(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!m&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!m){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#s&&(q.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#n&&(H.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#o=!0);return}if(t==="data-mode"){this.#r();return}this._reinit()}}#r(){let t=B(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#o=!0}show(){this.matches(":popover-open")||(this.showPopover(),!m&&this.#t&&this.matches(":popover-open")&&this.#a())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#l(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#u(){if(!this.#t||!m)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=T(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#i)||i.push(this.#i),t.style.setProperty("anchor-name",i.join(", ")),this.#e=this.#i,this.style.setProperty("position-anchor",this.#i),this.setAttribute("data-anchor-name",this.#i),N||this.#h(this.dataset.position||"bottom")}#c(){if(this.#t&&this.#e){let t=T(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#e);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#e=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([a,h])=>this.style.setProperty(a,h)),this.#s=!0}#a(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#p(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#n=!0;let o=this.offsetWidth,a=this.offsetHeight,h=e.split("-")[0];["top","bottom","left","right"].includes(h)||(h="bottom");let d={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},p={top:"bottom",bottom:"top",left:"right",right:"left"},P=h==="top"||h==="bottom"?a:o;d[h]<P&&d[p[h]]>d[h]&&(h=p[h]);let l,c;switch(h){case"top":l=t.top-a-i,c=t.left;break;case"left":l=t.top,c=t.left-o-i;break;case"right":l=t.top,c=t.right+i;break;default:l=t.bottom+i,c=t.left;break}if(h==="top"||h==="bottom"){let g=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==g?t.right-o:t.left}else e.endsWith("-end")&&(l=t.bottom-a);let A=(g,E,k)=>Math.max(C,Math.min(g,k-E-C));c=A(c,o,n),l=A(l,a,r),this.style.top=`${Math.round(l)}px`,this.style.left=`${Math.round(c)}px`}#p(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};f("pop-over",y);var F=new Set(["BUTTON","A","AREA"]),v=CSS.supports("anchor-name","--x"),$=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),x=8;function M(s){return document.documentElement.hasAttribute("data-interest-polyfill")?!0:"interestForElement"in HTMLButtonElement.prototype?F.has(s.tagName):!1}function O(s){return s.getAttribute("aria-label")?.trim()||s.hasAttribute("aria-labelledby")||s.labels?.length||s.textContent?.trim()||s instanceof HTMLInputElement&&["button","submit","reset"].includes(s.type)&&s.value?!0:!!s.querySelector('img[alt]:not([alt=""]), [aria-label]:not([aria-hidden="true"])')}function _(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(Boolean);return i.includes(e)?!1:(s.setAttribute(t,[...i,e].join(" ")),!0)}function W(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(n=>n&&n!==e);i.length?s.setAttribute(t,i.join(" ")):s.removeAttribute(t)}var b=0,w=class extends u{#t=null;#e=null;#i;#o;#s=!1;#n=!1;#r;#l;#u=[];#c=null;#h=!1;#a=!1;setup(){return this.#s=this.getAttribute("variant")==="card",this.#s?this.#S():this.#p()}#p(){if(this.#t=this.querySelector(":scope > :not(template):not(pop-over.tooltip)"),!this.#t)return!1;this.#n=M(this.#t);let t=this.querySelector(":scope > template[data-tooltip]"),e=this.getAttribute("content"),i=this.#t.getAttribute("title");if(!t&&!e&&!i)return!1;let n=!1;i&&(O(this.#t)||(this.#t.setAttribute("aria-label",i),this.#l=i,n=!t&&!e),this.#r=i,this.#t.removeAttribute("title"));let r=this.getAttribute("position")||"top";this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let o=document.createElement("pop-over");o.className="tooltip",o.setAttribute("role","tooltip"),o.dataset.mode=$?"hint":"manual",o.dataset.anchor=this.#t.id,o.dataset.tooltipPosition=r,v||(o.dataset.position=r),o.id=`tooltip-${++b}`,t?o.innerHTML=t.innerHTML:o.textContent=e||i;let a=document.createElement("span");if(a.className="tooltip-arrow",a.setAttribute("aria-hidden","true"),o.appendChild(a),this.appendChild(o),this.#e=o,n||this.#g("aria-describedby",o.id),this.#n?(this.#t.setAttribute("interestfor",o.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#C),this.listen(o,"mouseenter",this.#b),this.listen(o,"mouseleave",this.#d)),$||this.#v(),!v){this.listen(o,"toggle",d=>{d.newState==="open"&&this.#f()});let h=()=>{this.isVisible&&this.#f()};this.listen(window,"resize",h),this.listen(window,"scroll",h,{capture:!0,passive:!0})}return this.#y(o),!0}#S(){this.#t=this.querySelector(":scope > [data-trigger]");let t=this.querySelector(":scope > [data-content]");if(!this.#t||!t)return!1;this.#n=M(this.#t),this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let e=document.createElement("pop-over");return e.className="hover-card",e.dataset.mode="manual",e.dataset.anchor=this.#t.id,e.dataset.position=this.getAttribute("position")||"bottom",e.id=`hc-${++b}`,this.#c={node:t,next:t.nextSibling,hidden:t.hidden},e.appendChild(t),t.removeAttribute("data-content"),t.hidden=!1,this.appendChild(e),this.#e=e,this.#g("aria-controls",e.id),this.#t.hasAttribute("aria-expanded")||(this.#t.setAttribute("aria-expanded","false"),this.#h=!0),this.#n?(this.#t.setAttribute("interestfor",e.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#d),this.listen(e,"mouseenter",this.#b),this.listen(e,"mouseleave",this.#d),this.listen(e,"focusin",this.#b),this.listen(e,"focusout",i=>{i.relatedTarget instanceof Node&&this.contains(i.relatedTarget)||this.#d()})),this.#v(),this.listen(e,"pop-over:show",()=>{this.#h&&this.#t?.setAttribute("aria-expanded","true")}),this.listen(e,"pop-over:hide",()=>{this.#h&&this.#t?.setAttribute("aria-expanded","false")}),this.#y(e),!0}teardown(){clearTimeout(this.#i),clearTimeout(this.#o);let t=this.#t;if(t){this.#n&&(t.removeAttribute("interestfor"),this.#m&&(t.style.removeProperty("interest-delay-start"),t.style.removeProperty("--interest-delay-start"),this.#m=!1));for(let[e,i]of this.#u)W(t,e,i);this.#l!==void 0&&t.getAttribute("aria-label")===this.#l&&t.removeAttribute("aria-label"),this.#h&&t.removeAttribute("aria-expanded"),this.#r&&t.setAttribute("title",this.#r)}if(this.#u=[],this.#l=void 0,this.#r=void 0,this.#h=!1,this.#c){let{node:e,next:i,hidden:n}=this.#c;e.setAttribute("data-content",""),e.hidden=n,i&&i.parentNode===this?this.insertBefore(e,i):this.insertBefore(e,this.#e?.parentNode===this?this.#e:null),this.#c=null}this.#e&&(this.#e.remove(),this.#e=null),this.#t=null,this.setState("show-pending",!1)}#g(t,e){this.#t&&_(this.#t,t,e)&&this.#u.push([t,e])}#y(t){this.listen(t,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(t,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}#v(){this.listen(document,"keydown",this.#T),this.listen(document,"pointerdown",t=>{this.isVisible&&!(t.target instanceof Node&&this.contains(t.target))&&this.hide()})}#f(){let t=this.#e,e=this.#t;if(!t||!e||this.#s)return;let i=t.dataset.position||"top",n=e.getBoundingClientRect(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,a=(h,d,p)=>Math.max(x,Math.min(h,p-d-x));t.style.translate="none",i==="left"||i==="right"?t.style.top=`${Math.round(a(n.top+(n.height-t.offsetHeight)/2,t.offsetHeight,o))}px`:t.style.left=`${Math.round(a(n.left+(n.width-t.offsetWidth)/2,t.offsetWidth,r))}px`}#m=!1;#w(){let t=this.getAttribute("delay"),e=this.#t;if(t===null||!e)return;let i=parseInt(t,10);!Number.isFinite(i)||i<0||(e.style.setProperty("interest-delay-start",`${i}ms`),e.style.setProperty("--interest-delay-start",`${i}ms`),this.#m=!0)}#A=()=>{clearTimeout(this.#o);let t=this.#s?300:200,e=parseInt(this.getAttribute("delay")||String(t),10);this.setState("show-pending",!0),this.#i=setTimeout(()=>{this.setState("show-pending",!1),this.show()},e)};#d=()=>{clearTimeout(this.#i),this.setState("show-pending",!1);let t=this.#s?200:100;this.#o=setTimeout(()=>this.hide(),t)};#E=()=>{this.#a||(clearTimeout(this.#o),this.show())};#C=()=>{clearTimeout(this.#i),this.setState("show-pending",!1),this.hide()};#b=()=>{clearTimeout(this.#o)};#T=t=>{if(t.key!=="Escape"||!this.isVisible)return;clearTimeout(this.#i);let e=this.#s&&this.#e?.contains(document.activeElement);this.hide(),e&&(this.#a=!0,this.#t?.focus({preventScroll:!0}),this.#a=!1)};show(){!this.#e||this.isVisible||(typeof this.#e.show=="function"?this.#e.show():this.#e.showPopover(),v||this.#f())}hide(){!this.#e||!this.isVisible||(typeof this.#e.hide=="function"?this.#e.hide():this.#e.hidePopover())}get isVisible(){return this.#e?.matches(":popover-open")??!1}};f("tool-tip",w);export{w as ToolTip};
|
|
1
|
+
var u=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#e||(this.#e=t)}#i(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var K=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function p(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=S.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(s,n),customElements.define(s,t)}var m=CSS.supports("anchor-name","--x"),B=CSS.supports("position-area","bottom"),H=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),V=["auto","manual","hint"];function I(s){let t=V.includes(s||"")?s:"auto";return t==="hint"&&!H?"auto":t}var L=["top","bottom","left","right","inset-inline-start","inset-inline-end"],_=["position","top","left","right","bottom","margin"],$=8,q=0,F=0;function C(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var g=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#i=`--pop-over-anchor-${++F}`;#o=!1;#s=!1;#n=!1;setup(){if(this.id||(this.id=`pop-over-${++q}`),(!this.hasAttribute("popover")||this.#o)&&this.#r(),this.#l(),this.#u(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!m&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#h()})}),!m){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#h()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#s&&(L.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#n&&(_.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#o=!0);return}if(t==="data-mode"){this.#r();return}this._reinit()}}#r(){let t=I(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#o=!0}show(){this.matches(":popover-open")||(this.showPopover(),!m&&this.#t&&this.matches(":popover-open")&&this.#h())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#l(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#u(){if(!this.#t||!m)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=C(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#i)||i.push(this.#i),t.style.setProperty("anchor-name",i.join(", ")),this.#e=this.#i,this.style.setProperty("position-anchor",this.#i),this.setAttribute("data-anchor-name",this.#i),B||this.#a(this.dataset.position||"bottom")}#c(){if(this.#t&&this.#e){let t=C(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#e);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#e=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#a(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([h,a])=>this.style.setProperty(h,a)),this.#s=!0}#h(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#f(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#n=!0;let o=this.offsetWidth,h=this.offsetHeight,a=e.split("-")[0];["top","bottom","left","right"].includes(a)||(a="bottom");let d={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},f={top:"bottom",bottom:"top",left:"right",right:"left"},M=a==="top"||a==="bottom"?h:o;d[a]<M&&d[f[a]]>d[a]&&(a=f[a]);let l,c;switch(a){case"top":l=t.top-h-i,c=t.left;break;case"left":l=t.top,c=t.left-o-i;break;case"right":l=t.top,c=t.right+i;break;default:l=t.bottom+i,c=t.left;break}if(a==="top"||a==="bottom"){let y=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==y?t.right-o:t.left}else e.endsWith("-end")&&(l=t.bottom-h);let A=(y,E,k)=>Math.max($,Math.min(y,k-E-$));c=A(c,o,n),l=A(l,h,r),this.style.top=`${Math.round(l)}px`,this.style.left=`${Math.round(c)}px`}#f(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};p("pop-over",g);var O=new Set(["BUTTON","A","AREA"]),v=CSS.supports("anchor-name","--x"),T=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),P=8;function x(s){return document.documentElement.hasAttribute("data-interest-polyfill")?!0:"interestForElement"in HTMLButtonElement.prototype?O.has(s.tagName):!1}function R(s){return s.getAttribute("aria-label")?.trim()||s.hasAttribute("aria-labelledby")||s.labels?.length||s.textContent?.trim()||s instanceof HTMLInputElement&&["button","submit","reset"].includes(s.type)&&s.value?!0:!!s.querySelector('img[alt]:not([alt=""]), [aria-label]:not([aria-hidden="true"])')}function j(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(Boolean);return i.includes(e)?!1:(s.setAttribute(t,[...i,e].join(" ")),!0)}function W(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(n=>n&&n!==e);i.length?s.setAttribute(t,i.join(" ")):s.removeAttribute(t)}var b=0,w=class extends u{#t=null;#e=null;#i;#o;#s=!1;#n=!1;#r;#l;#u=[];#c=null;#a=!1;#h=!1;setup(){return this.#s=this.getAttribute("variant")==="card",this.#s?this.#S():this.#f()}#f(){if(this.#t=this.querySelector(":scope > :not(template):not(pop-over.tooltip)"),!this.#t)return!1;this.#n=x(this.#t);let t=this.querySelector(":scope > template[data-tooltip]"),e=this.getAttribute("content"),i=this.#t.getAttribute("title");if(!t&&!e&&!i)return!1;let n=!1;i&&(R(this.#t)||(this.#t.setAttribute("aria-label",i),this.#l=i,n=!t&&!e),this.#r=i,this.#t.removeAttribute("title"));let r=this.getAttribute("position")||"top";this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let o=document.createElement("pop-over");o.className="tooltip",o.setAttribute("role","tooltip"),o.dataset.mode=T?"hint":"manual",o.dataset.anchor=this.#t.id,o.dataset.tooltipPosition=r,v||(o.dataset.position=r),o.id=`tooltip-${++b}`,t?o.innerHTML=t.innerHTML:o.textContent=e||i;let h=document.createElement("span");if(h.className="tooltip-arrow",h.setAttribute("aria-hidden","true"),o.appendChild(h),this.appendChild(o),this.#e=o,n||this.#y("aria-describedby",o.id),this.#n?(this.#t.setAttribute("interestfor",o.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#$),this.listen(o,"mouseenter",this.#b),this.listen(o,"mouseleave",this.#d)),T||this.#v(),!v){this.listen(o,"toggle",d=>{d.newState==="open"&&this.#p()});let a=()=>{this.isVisible&&this.#p()};this.listen(window,"resize",a),this.listen(window,"scroll",a,{capture:!0,passive:!0})}return this.#g(o),!0}#S(){this.#t=this.querySelector(":scope > [data-trigger]");let t=this.querySelector(":scope > [data-content]");if(!this.#t||!t)return!1;this.#n=x(this.#t),this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let e=document.createElement("pop-over");return e.className="hover-card",e.dataset.mode="manual",e.dataset.anchor=this.#t.id,e.dataset.position=this.getAttribute("position")||"bottom",e.id=`hc-${++b}`,this.#c={node:t,next:t.nextSibling,hidden:t.hidden},e.appendChild(t),t.removeAttribute("data-content"),t.hidden=!1,this.appendChild(e),this.#e=e,this.#y("aria-controls",e.id),this.#t.hasAttribute("aria-expanded")||(this.#t.setAttribute("aria-expanded","false"),this.#a=!0),this.#n?(this.#t.setAttribute("interestfor",e.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#d),this.listen(e,"mouseenter",this.#b),this.listen(e,"mouseleave",this.#d),this.listen(e,"focusin",this.#b),this.listen(e,"focusout",i=>{i.relatedTarget instanceof Node&&this.contains(i.relatedTarget)||this.#d()})),this.#v(),this.listen(e,"pop-over:show",()=>{this.#a&&this.#t?.setAttribute("aria-expanded","true")}),this.listen(e,"pop-over:hide",()=>{this.#a&&this.#t?.setAttribute("aria-expanded","false")}),this.#g(e),!0}teardown(){clearTimeout(this.#i),clearTimeout(this.#o);let t=this.#t;if(t){this.#n&&(t.removeAttribute("interestfor"),this.#m&&(t.style.removeProperty("interest-delay-start"),t.style.removeProperty("--interest-delay-start"),this.#m=!1));for(let[e,i]of this.#u)W(t,e,i);this.#l!==void 0&&t.getAttribute("aria-label")===this.#l&&t.removeAttribute("aria-label"),this.#a&&t.removeAttribute("aria-expanded"),this.#r&&t.setAttribute("title",this.#r)}if(this.#u=[],this.#l=void 0,this.#r=void 0,this.#a=!1,this.#c){let{node:e,next:i,hidden:n}=this.#c;e.setAttribute("data-content",""),e.hidden=n,i&&i.parentNode===this?this.insertBefore(e,i):this.insertBefore(e,this.#e?.parentNode===this?this.#e:null),this.#c=null}this.#e&&(this.#e.remove(),this.#e=null),this.#t=null,this.setState("show-pending",!1)}#y(t,e){this.#t&&j(this.#t,t,e)&&this.#u.push([t,e])}#g(t){this.listen(t,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(t,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}#v(){this.listen(document,"keydown",this.#C),this.listen(document,"pointerdown",t=>{this.isVisible&&!(t.target instanceof Node&&this.contains(t.target))&&this.hide()})}#p(){let t=this.#e,e=this.#t;if(!t||!e||this.#s)return;let i=t.dataset.position||"top",n=e.getBoundingClientRect(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,h=(a,d,f)=>Math.max(P,Math.min(a,f-d-P));t.style.translate="none",i==="left"||i==="right"?t.style.top=`${Math.round(h(n.top+(n.height-t.offsetHeight)/2,t.offsetHeight,o))}px`:t.style.left=`${Math.round(h(n.left+(n.width-t.offsetWidth)/2,t.offsetWidth,r))}px`}#m=!1;#w(){let t=this.getAttribute("delay"),e=this.#t;if(t===null||!e)return;let i=parseInt(t,10);!Number.isFinite(i)||i<0||(e.style.setProperty("interest-delay-start",`${i}ms`),e.style.setProperty("--interest-delay-start",`${i}ms`),this.#m=!0)}#A=()=>{clearTimeout(this.#o);let t=this.#s?300:200,e=parseInt(this.getAttribute("delay")||String(t),10);this.setState("show-pending",!0),this.#i=setTimeout(()=>{this.setState("show-pending",!1),this.show()},e)};#d=()=>{clearTimeout(this.#i),this.setState("show-pending",!1);let t=this.#s?200:100;this.#o=setTimeout(()=>this.hide(),t)};#E=()=>{this.#h||(clearTimeout(this.#o),this.show())};#$=()=>{clearTimeout(this.#i),this.setState("show-pending",!1),this.hide()};#b=()=>{clearTimeout(this.#o)};#C=t=>{if(t.key!=="Escape"||!this.isVisible)return;clearTimeout(this.#i);let e=this.#s&&this.#e?.contains(document.activeElement);this.hide(),e&&(this.#h=!0,this.#t?.focus({preventScroll:!0}),this.#h=!1)};show(){!this.#e||this.isVisible||(typeof this.#e.show=="function"?this.#e.show():this.#e.showPopover(),v||this.#p())}hide(){!this.#e||!this.isVisible||(typeof this.#e.hide=="function"?this.#e.hide():this.#e.hidePopover())}get isVisible(){return this.#e?.matches(":popover-open")??!1}};p("tool-tip",w);export{w as ToolTip};
|
|
2
2
|
//# sourceMappingURL=tool-tip.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}#o(t,e,
|
|
1
|
+
var B=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function k(i,t,e={}){let r=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=S.get(i);if(customElements.get(i)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(i,o),customElements.define(i,t)}var w=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,o){t.addEventListener(e,r,o),this.#t.push(()=>t.removeEventListener(e,r,o))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{e?r.add(t):r.delete(t)}catch{let o=`--${t}`;e?r.add(o):r.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var T={heading:"Topics",page:"{count} page",pages:"{count} pages",uncategorized:"Uncategorized","topic-link":"{label} topic page",error:"Topics could not be loaded."};function x(i){let t=String(i??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://topic-map.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function _(i,t){let e=Array.isArray(t?.concepts)?t.concepts:[],r=E(t?.["skos:hasTopConcept"]),o=new Map;for(let n of e)n&&typeof n["@id"]=="string"&&n["@id"]&&o.set(n["@id"],n);let s=new Map,d=new Map,l=(n,a)=>{!o.has(n)||!o.has(a)||n===a||(s.set(n,(s.get(n)??new Set).add(a)),d.set(a,(d.get(a)??new Set).add(n)))};for(let n of o.values()){let a=n["@id"];for(let c of E(n["skos:broader"]))l(c,a);for(let c of E(n["skos:narrower"]))l(a,c)}let f=new Map,g=[];for(let n of i){if(!n||typeof n!="object")continue;let a=Array.isArray(n.concepts)?n.concepts:[],c=!1;for(let u of new Set(a)){if(!o.has(u))continue;let p=f.get(u);p?p.push(n):f.set(u,[n]),c=!0}c||g.push(n)}let b=new Map,$=n=>{if(b.has(n))return b.get(n);let a=new Set,c=new Set,u=[n];for(;u.length;){let p=u.pop();if(!a.has(p)){a.add(p);for(let m of f.get(p)||[])c.add(M(m));for(let m of s.get(p)||[])u.push(m)}}return b.set(n,c.size),c.size},y=r.filter(n=>o.has(n));return y.length===0&&(y=[...o.keys()].filter(n=>!d.has(n))),{byId:o,childrenOf:s,directPages:f,uncategorized:g,roots:y,totalFor:$}}var A=class extends w{#t=0;setup(){let t=++this.#t;if(this.__data){this.#r(this.__data.pages,this.__data.vocabulary);return}let e=this.getAttribute("data-lens-src")||this.getAttribute("src"),r=this.getAttribute("data-vocabulary-src")||"/vocabulary.json";e&&this.#e(e,r,t)}teardown(){this.#t++}get data(){return this.__data||null}set data(t){if(!t||typeof t!="object")return;let e=Array.isArray(t.pages)?t.pages:[],r=t.vocabulary||{};this.__data={pages:e,vocabulary:r},this._reinit(),this.dispatchEvent(new CustomEvent("topic-map:data-changed",{detail:{pages:e,vocabulary:r,source:"property"},bubbles:!0}))}async#e(t,e,r){let[o,s]=await Promise.all([C(t),C(e)]);if(r!==this.#t)return;let d=o.error?[t,o.error]:s.error?[e,s.error]:null;if(d){console.warn(`[topic-map] could not load ${d[0]}: ${d[1]}`),this.#a();return}let l=o.data,f=Array.isArray(l)?l:Array.isArray(l?.pages)?l.pages:[];this.#r(f,s.data)}#r(t,e){try{this.#d(t,e)}catch(r){console.warn("[topic-map] could not render the topic tree:",r),this.#a()}}#d(t,e){let r=_(t,e),o=this.hasAttribute("expand-all"),s=[],d=this.#l(t.length);d&&s.push(d);for(let l of r.roots)s.push(this.#o(l,r,o,0,new Set));if(r.uncategorized.length){let l=o?" open":"";s.push(`<details${l} data-topic-node="__uncategorized">`),s.push(`<summary><span class="topic-name">${h(this.#n("uncategorized"))}</span> <span class="topic-count">${h(this.#s(new Set(r.uncategorized.map(M)).size))}</span></summary>`),s.push(this.#i(r.uncategorized)),s.push("</details>")}this.innerHTML=s.join(`
|
|
2
|
+
`)}#o(t,e,r,o,s){let d=e.byId.get(t);if(!d||s.has(t))return"";let l=new Set(s).add(t),f=String(d["skos:prefLabel"]||t),g=e.directPages.get(t)||[],b=e.childrenOf.get(t),$=r||o<1?" open":"",y=this.#n("topic-link").replaceAll("{label}",f),n=[];if(n.push(`<details${$} data-topic-node="${v(t)}">`),n.push(`<summary><span class="topic-name">${h(f)}</span> <span class="topic-count">${h(this.#s(e.totalFor(t)))}</span></summary>`),n.push(`<p class="topic-link"><a href="/topics/${v(encodeURIComponent(t))}/">${h(y)}</a></p>`),g.length&&n.push(this.#i(g)),b&&b.size){let a=[...b].sort((c,u)=>{let p=String(e.byId.get(c)?.["skos:prefLabel"]||c),m=String(e.byId.get(u)?.["skos:prefLabel"]||u);return p.localeCompare(m,this.#c(),{sensitivity:"base"})});for(let c of a)n.push(this.#o(c,e,r,o+1,l))}return n.push("</details>"),n.join(`
|
|
3
3
|
`)}#i(t){return`<ul class="topic-pages">
|
|
4
|
-
${t.map(
|
|
4
|
+
${t.map(r=>{let o=h(r.title||r.url||""),s=x(r.url);return s?`<li><a href="${v(s)}">${o}</a></li>`:`<li>${o}</li>`}).join(`
|
|
5
5
|
`)}
|
|
6
|
-
</ul>`}#
|
|
6
|
+
</ul>`}#l(t){let e=this.getAttribute("data-heading-level"),r=e==null||e===""?2:Number.parseInt(e,10);if(r===0)return"";let o=Number.isFinite(r)?Math.min(6,Math.max(1,r)):2;return`<h${o} class="topic-map-heading">${h(this.#n("heading"))} <small>(${h(this.#s(t))})</small></h${o}>`}#s(t){let e=this.#c(),r=new Intl.PluralRules(e).select(t)==="one"?"page":"pages";return this.#n(r).replaceAll("{count}",new Intl.NumberFormat(e).format(t))}#a(){this.querySelector(":scope > [data-topic-map-error]")?.remove();let t=document.createElement("p");t.setAttribute("data-topic-map-error",""),t.textContent=this.#n("error"),this.prepend(t)}#n(t){return this.getAttribute(`data-label-${t}`)||T[t]}#c(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};async function C(i){try{let t=await fetch(i);if(!t.ok)throw new Error(`status ${t.status}`);return{data:await t.json()}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function M(i){return typeof i?.url=="string"&&i.url?i.url:i}function E(i){return i==null?[]:Array.isArray(i)?i:[i]}function h(i){return String(i??"").replace(/[&<>]/g,t=>({"&":"&","<":"<",">":">"})[t])}function v(i){return String(i??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}k("topic-map",A);export{A as TopicMap,_ as buildTopicGraph,x as safeHref};
|
|
7
7
|
//# sourceMappingURL=topic-map.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function y(o,t,e={}){let r=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=v.get(o);if(customElements.get(o)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(o,s),customElements.define(o,t)}var m=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,s){t.addEventListener(e,r,s),this.#e.push(()=>t.removeEventListener(e,r,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let s=`--${t}`;e?r.add(s):r.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var C={form:"Filter pages",provenance:"How was it made",review:"Review",status:"Status",signed:"Has signature",yes:"Yes",no:"No",clear:"Clear all",page:"{count} of {total} page",pages:"{count} of {total} pages","has-signature":"has signature",error:"Pages could not be loaded.","no-source":"No data source set."},w=["provenance","review","status","signed"];function x(o){let t=String(o??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://trust-filter.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function S(o){return String(o??"").split(/\s+/).filter(Boolean)}function E(o,t){if(t.provenance?.size&&!S(o.provenance).some(e=>t.provenance.has(e))||t.review?.size&&!t.review.has(o.review)||t.status?.size&&!t.status.has(o.status))return!1;if(t.signed?.size===1){let e=t.signed.has("yes");if(!!o.signed!==e)return!1}return!0}var g=class extends m{#e=[];#t=b();#r=0;setup(){let t=++this.#r;this.#t=b();let e=this.getAttribute("data-lens-src")||this.getAttribute("src");if(!e){this.#a(this.#n("no-source"));return}this.#c(e,t)}teardown(){this.#r++}async#c(t,e){let r;try{let n=await fetch(t);if(!n.ok)throw new Error(`status ${n.status}`);r=await n.json()}catch(n){if(e!==this.#r)return;console.warn(`[trust-filter] could not load ${t}:`,n),this.#a(this.#n("error"));return}if(e!==this.#r)return;let s=Array.isArray(r)?r:r?.pages;this.#e=Array.isArray(s)?s.filter(n=>n&&typeof n=="object"):[],this.#u(),this.#o()}#u(){let t={provenance:this.#s("provenance"),review:this.#s("review"),status:this.#s("status"),signed:["yes","no"]},e=document.createElement("form");e.setAttribute("data-trust-filter-controls",""),e.setAttribute("aria-label",this.#n("form"));for(let u of w){if(t[u].length===0)continue;let c=document.createElement("fieldset");c.dataset.dim=u;let l=document.createElement("legend");l.textContent=this.#n(u),c.append(l);for(let i of t[u]){let d=document.createElement("label"),f=document.createElement("input");f.type="checkbox",f.dataset.dim=u,f.value=i;let p=document.createElement("span");p.textContent=u==="signed"?this.#n(i):k(i),d.append(f," ",p),c.append(d)}e.append(c)}let r=document.createElement("button");r.type="reset",r.className="ghost",r.textContent=this.#n("clear"),e.append(r);let s=document.createElement("output");s.setAttribute("data-trust-filter-count",""),s.setAttribute("aria-live","polite");let n=document.createElement("ul");n.setAttribute("data-trust-filter-results",""),this.replaceChildren(e,s,n),e.addEventListener("change",u=>{let c=u.target;if(!c?.matches('input[type="checkbox"]'))return;let l=this.#t[c.dataset.dim||""];l&&(c.checked?l.add(c.value):l.delete(c.value),this.#o(),this.#i())}),e.addEventListener("reset",()=>{this.#t=b(),this.#o(),this.#i()})}#s(t){let e=new Set;for(let r of this.#e){let s=r[t];if(!(!s||typeof s!="string"))if(t==="provenance")for(let n of S(s))e.add(n);else e.add(s)}return[...e].sort()}#o(){let t=this.querySelector("[data-trust-filter-count]"),e=this.querySelector("[data-trust-filter-results]");if(!t||!e)return;let r=this.#e.filter(i=>E(i,this.#t)),s=this.#l(),n=this.#e.length,u=new Intl.NumberFormat(s),c=new Intl.PluralRules(s).select(n)==="one"?"page":"pages";t.textContent=this.#n(c).replaceAll("{count}",u.format(r.length)).replaceAll("{total}",u.format(n));let l=r.map(i=>{let d=document.createElement("li"),f=String(i.title||i.url||""),p=x(i.url);if(p){let a=document.createElement("a");a.href=p,a.textContent=f,d.append(a)}else d.append(f);let h=[];if(typeof i.provenance=="string"&&i.provenance){let a=document.createElement("span");a.className="trust-filter-prov",a.dataset.provenance=i.provenance,a.textContent=i.provenance,h.push(a)}if(i.review&&i.review!=="unreviewed"&&h.push(String(i.review)),i.status&&i.status!=="published"&&h.push(String(i.status)),i.signed){let a=document.createElement("span");a.className="trust-filter-signature",a.textContent=this.#n("has-signature"),h.push(a)}if(h.length){let a=document.createElement("small");h.forEach((A,$)=>{$&&a.append(" \xB7 "),a.append(A)}),d.append(a)}return d});e.replaceChildren(...l),e.hidden=l.length===0}#i(){let t={};for(let[r,s]of Object.entries(this.#t))t[r]=[...s];let e=this.#e.filter(r=>E(r,this.#t)).length;this.dispatchEvent(new CustomEvent("trust-filter:change",{detail:{selected:t,count:e},bubbles:!0}))}#a(t){let e=document.createElement("p");e.setAttribute("data-trust-filter-error",""),e.textContent=t,this.replaceChildren(e)}#n(t){return this.getAttribute(`data-label-${t}`)||C[t]}#l(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};function b(){return Object.fromEntries(w.map(o=>[o,new Set]))}function k(o){return String(o).replace(/-/g," ")}y("trust-filter",g);export{g as TrustFilter,E as matchesSelection,x as safeHref};
|
|
2
2
|
//# sourceMappingURL=trust-filter.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var Tt=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function m(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=$.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(s,n),customElements.define(s,t)}var p=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#i||(this.#i=t)}#e(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function L(s){return B(s&&s.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function B(s,t="en-US"){try{if(s)return Intl.getCanonicalLocales(s),s}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var j="http://www.w3.org/1999/xhtml",y="http://www.w3.org/2000/svg",H="http://www.w3.org/1998/Math/MathML",W=new Set([j,y,H]),A="user-content-",z=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),M=new Set(["title","desc"]),G=new Set(["animate","set","animatemotion","animatetransform"]),J=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),Y=new Set(["src","poster","srcset"]),K=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),X=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),Z=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),Q={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},tt=new Set(["social-embed","youtube-player","geo-map"]),et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],it=new Set(["audio-player","video-player","image-map","brand-mark"]);function nt(s){return String(s).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function g(s,t=!1){let e=nt(s);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(n=>n.startsWith("data:")).some(n=>!/^data:(image|audio|video|font)\//.test(n)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function I(s){let t=String(s).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var st=s=>String(s.localName||s.tagName||"").toLowerCase(),rt=s=>s.startsWith(A)?s:A+s;function ot(s,t){if(z.has(t))return!0;let e=s.namespaceURI;return!!(e&&!W.has(e)||t==="title"&&e!==y||M.has(t)&&e===y&&s.children?.length||G.has(t)&&(s.getAttribute("attributeName")||s.getAttribute("attributename")||"").toLowerCase().includes("href"))}function at(s,t){for(let e of[...s.attributes]){let i=e.name.toLowerCase();if(i.startsWith("on")||K.has(i)||!t.keepIds&&X.has(i)){s.removeAttribute(e.name);continue}if(i==="style"){(!t.keepStyle||I(e.value))&&s.removeAttribute(e.name);continue}if((i==="id"||i==="name")&&!t.keepIds){let n=rt(e.value);i==="id"?t.ids.set(e.value,n):t.ids.set(`name:${e.value}`,n),s.setAttribute(e.name,n);continue}if(J.has(i)||i.endsWith(":href")){g(e.value,!1)&&s.removeAttribute(e.name);continue}Y.has(i)&&g(e.value,!0)&&s.removeAttribute(e.name)}}function ct(s,t){let e=(s.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&s.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&s.setAttribute("type","button")}function lt(s,t){for(let e of s)for(let i of[...e.attributes]){let n=i.name.toLowerCase(),r=i.value;if((n==="href"||n.endsWith(":href"))&&r.startsWith("#")){let o=ht(r.slice(1));t.has(o)&&e.setAttribute(i.name,`#${t.get(o)}`)}else if(n==="usemap"&&r.startsWith("#")){let o=t.get(`name:${r.slice(1)}`);o?e.setAttribute(i.name,`#${o}`):e.removeAttribute(i.name)}else if(Z.has(n)){let o=r.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(A)?a:null)).filter(Boolean);o.length?e.setAttribute(i.name,o.join(" ")):e.removeAttribute(i.name)}else r.includes("url(#")&&e.setAttribute(i.name,r.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function ht(s){try{return decodeURIComponent(s)}catch{return s}}function R(s){let t=s.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&R(e)}function O(s,t){R(s);let e=[...s.querySelectorAll("*")];t.includeRoot&&e.unshift(s);let i=new Map,n=[],r={...t,ids:i};for(let o of e){if(!dt(o,s))continue;let a=st(o);if(t.svgOnly&&(M.has(a)||a==="style")){if(a==="style"&&I(o.textContent||"")){o.remove();continue}}else if(ot(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&tt.has(a)){ut(o);continue}if(a==="template"){let h=o.content;h&&O(h,{...t,includeRoot:!1})}at(o,r),t.keepIds||ct(o,a);let c=Q[a];if(c)for(let h of c)o.removeAttribute(h);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!it.has(a))for(let h of et)o.removeAttribute(h);n.push(o)}!t.keepIds&&i.size&<(n,i)}function ut(s){let t=s.parentNode;if(t){for(let e of[...s.childNodes])t.insertBefore(e,s);s.remove()}}function dt(s,t){let e=s;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function P(s,t={}){let e=document.createElement("template");return s&&typeof s=="string"&&(e.innerHTML=s,O(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var v=CSS.supports("anchor-name","--x"),ft=CSS.supports("position-area","bottom"),pt=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),mt=["auto","manual","hint"];function bt(s){let t=mt.includes(s||"")?s:"auto";return t==="hint"&&!pt?"auto":t}var gt=["top","bottom","left","right","inset-inline-start","inset-inline-end"],vt=["position","top","left","right","bottom","margin"],D=8,wt=0,yt=0;function _(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var E=class extends p{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#i=null;#e=`--pop-over-anchor-${++yt}`;#n=!1;#c=!1;#s=!1;setup(){if(this.id||(this.id=`pop-over-${++wt}`),(!this.hasAttribute("popover")||this.#n)&&this.#a(),this.#u(),this.#l(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!v&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#r()})}),!v){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#r()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#c&&(gt.forEach(t=>this.style.removeProperty(t)),this.#c=!1),this.#s&&(vt.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#n=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=bt(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#n=!0}show(){this.matches(":popover-open")||(this.showPopover(),!v&&this.#t&&this.matches(":popover-open")&&this.#r())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#u(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#l(){if(!this.#t||!v)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=_(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#e)||i.push(this.#e),t.style.setProperty("anchor-name",i.join(", ")),this.#i=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),ft||this.#h(this.dataset.position||"bottom")}#d(){if(this.#t&&this.#i){let t=_(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#i);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#i=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([a,c])=>this.style.setProperty(a,c)),this.#c=!0}#r(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#b(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#s=!0;let o=this.offsetWidth,a=this.offsetHeight,c=e.split("-")[0];["top","bottom","left","right"].includes(c)||(c="bottom");let h={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},l={top:"bottom",bottom:"top",left:"right",right:"left"},u=c==="top"||c==="bottom"?a:o;h[c]<u&&h[l[c]]>h[c]&&(c=l[c]);let d,f;switch(c){case"top":d=t.top-a-i,f=t.left;break;case"left":d=t.top,f=t.left-o-i;break;case"right":d=t.top,f=t.right+i;break;default:d=t.bottom+i,f=t.left;break}if(c==="top"||c==="bottom"){let w=getComputedStyle(this).direction==="rtl";f=e.endsWith("-end")!==w?t.right-o:t.left}else e.endsWith("-end")&&(d=t.bottom-a);let T=(w,k,F)=>Math.max(D,Math.min(w,F-k-D));f=T(f,o,n),d=T(d,a,r),this.style.top=`${Math.round(d)}px`,this.style.left=`${Math.round(f)}px`}#b(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};m("pop-over",E);var S=["tracking","final","original"],At={tracking:"Tracking",final:"Final",original:"Original"},C=class extends p{static observedAttributes=["view","author","datetime","controls"];setup(){this.#t(),this.listen(this,"click",this.#s)}attributeChangedCallback(t,e,i){!this.hasAttribute("data-upgraded")||e===i||(t==="view"?this.#c():this.#t())}#t(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#i(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#e(t)),this.prepend(...e),this.#c()}#i(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let i=document.createElement("p");if(i.setAttribute("data-change-caption",""),i.append(t?`Changes by ${t}`:"Changes"),e){i.append(t?", ":" from ");let n=document.createElement("time");n.setAttribute("datetime",e),n.textContent=this.#n(e),i.append(n)}return i}#e(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let i=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${i}`);for(let n of S){let r=document.createElement("button");r.type="button",r.dataset.action=n,r.textContent=At[n],e.append(r)}return e}#n(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let i=this.closest("[lang]")?.lang||void 0,n=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(i,{dateStyle:"medium",...n?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#c(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#s=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let i=e.dataset.action;!i||!S.includes(i)||i!==this.view&&(this.#a(i),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:i},bubbles:!0})))};#a(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#c()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!S.includes(t)||this.view===t||(this.#a(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};m("change-set",C);function U(s,t){let e=String(s??"").split(`
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
`));else if(
|
|
5
|
-
`,e.appendChild(
|
|
6
|
-
`,e.appendChild(n)}return t.appendChild(e),t}var Et={trigger:"Version",loading:"Loading\u2026","loading-versions":"Loading versions\u2026",empty:"No versions available.","heading-releases":"Versions","heading-history":"History",archived:"archived",draft:"draft",current:"current",by:"by {author}",changelog:"Changelog","changelog-for":"{version} changelog","banner-label":"Archived version notice",banner:"You\u2019re viewing {version} (archived).","banner-latest":"Latest: {version}",diff:"Diff: {from} \u2192 {to}"},St=/^\d{4}-\d{2}-\d{2}$/,x=0,N=class extends p{static observedAttributes=["data-versions","data-src","data-mode","aria-label"];#t=[];#i=null;#e;#n;#c;#s;#a=null;#u=null;#l=null;#d=null;#h=null;setup(){this.#w(),this.#D(),this.#_(),this.#U(),this.#f(),this.#T(),this.#C(),this.hasAttribute("data-page-info-target")&&this.#P(),this.#t.length===0&&(this.getAttribute("data-src")||this.#E())&&this.#S()}teardown(){this.#u?.disconnect(),this.#u=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null,this.#a?.remove(),this.#a=null,this.#h=null}attributeChangedCallback(t,e,i){!this.isConnected||e===i||!this.#e||(t==="data-versions"&&this.refresh(),t==="data-src"&&this.#S(),(t==="data-mode"||t==="aria-label")&&this.#p())}#r(t,e={}){let i=this.getAttribute(`data-label-${t}`)??Et[t]??t;for(let[n,r]of Object.entries(e))i=i.replaceAll(`{${n}}`,String(r));return i}#b(){return this.getAttribute("aria-label")||this.#r("trigger")}#v(){return this.#r(this.#O()==="history"?"heading-history":"heading-releases")}#w(){let t=null,e=this.getAttribute("data-versions");if(e)try{t=JSON.parse(e)}catch(i){this.#o("Failed to parse data-versions JSON",{error:i})}if(!t){let i=this.querySelector(':scope > script[type="application/json"][data-versions]');if(i?.textContent.trim())try{t=JSON.parse(i.textContent)}catch(n){this.#o("Failed to parse <script data-versions> JSON",{error:n})}}this.#t=this.#y(t),this.#i=this.#A()}#y(t){if(!Array.isArray(t))return[];let e=[];for(let i of t){if(!i||typeof i.id!="string")continue;let n={...i};if(n.url!=null&&!b(n.url)){this.#o(`Dropped version "${n.id}": unsafe url.`,{entry:n});continue}n.versionUrl!=null&&!b(n.versionUrl)&&delete n.versionUrl,e.push(n)}return e}#A(){if(this.#t.length===0)return null;let t=this.#t.find(i=>i.current===!0);if(t)return t.id;let e=document.querySelector('meta[itemprop="version"]')?.getAttribute("content");if(e){let i=this.#t.find(n=>n.id===e);if(i)return i.id}return this.#t[0].id}#O(){let t=this.getAttribute("data-mode");return t==="releases"||t==="history"?t:new Set(this.#t.map(i=>i.url).filter(Boolean)).size>1?"releases":"history"}#E(){return document.querySelector('meta[name="vb:versions-manifest"]')?.getAttribute("content")}async#S(){let t=this.getAttribute("data-src")||this.#E();if(!t)return;this.#h=t,this.#f();let e;try{let i=await fetch(t,{credentials:"same-origin"});if(!i.ok)throw new Error(`Fetch failed (${i.status}) for ${t}`);e=await i.json()}catch(i){if(this.#h!==t)return;this.#h=null,this.#o(`Failed to load versions manifest: ${i.message}`,{error:i}),this.#f();return}if(this.#h===t){if(this.#h=null,!Array.isArray(e)){this.#o(`Manifest is not a JSON array: ${t}`),this.#f();return}this.#t=this.#y(e),this.#i=this.#A(),this.#p()}}#p(){this.#f(),this.#T(),this.#C(),this.#a&&this.#N()}#C(){if(this.#d?.remove(),this.#d=null,!this.hasAttribute("data-banner"))return;let t=this.#t.find(o=>o.id===this.#i),e=this.#t.find(o=>!o.archived&&!o.draft);if(!t?.archived||!e||e.id===t.id)return;let i=document.createElement("aside");i.className="version-switcher-banner",i.setAttribute("aria-label",this.#r("banner-label"));let n=document.createElement("p");n.className="version-switcher-banner-text",n.setAttribute("role","status"),i.append(n),this.prepend(i),this.#d=i;let r=()=>{if(this.#d!==i)return;n.textContent=this.#r("banner",{version:t.label||t.id});let o=this.#r("banner-latest",{version:e.label||e.id});if(e.url&&b(e.url)){let a=document.createElement("a");a.className="version-switcher-banner-link",a.href=e.url,a.textContent=o,i.append(a)}else{let a=document.createElement("span");a.className="version-switcher-banner-latest",a.textContent=o,i.append(a)}};requestAnimationFrame(()=>requestAnimationFrame(r))}#P(){let t=this.getAttribute("data-page-info-target");if(!t)return;let e=document.getElementById(t);if(!e||e.localName!=="page-info"){this.#o(`data-page-info-target: no <page-info id="${t}"> found.`);return}this.#e.hidden=!0;let i=()=>{let r=e.querySelector(".page-info-panel");return r?(this.#N(r),!0):!1};if(i())return;let n=new MutationObserver(()=>{i()&&this.#x()});n.observe(e,{childList:!0,subtree:!0}),this.#u=n,this.#l=setTimeout(()=>{this.#l=null,!this.#a&&(this.#x(),this.#o(`<page-info id="${t}"> never rendered .page-info-panel within 5s.`))},5e3)}#x(){this.#u?.disconnect(),this.#u=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null}#N(t){let e=t||this.#a?.parentNode;if(!e)return;let i=this.#a;if(!i){i=document.createElement("section"),i.className="version-switcher-panel-section";let r=document.createElement("h3");r.className="version-switcher-panel-heading",r.id=`version-switcher-panel-${++x}`,i.setAttribute("aria-labelledby",r.id);let o=document.createElement("ul");o.className="version-switcher-panel-list",i.append(r,o),e.appendChild(i),this.#a=i,this.listen(o,"click",this.#$)}i.querySelector(".version-switcher-panel-heading").textContent=this.#v();let n=i.querySelector("ul.version-switcher-panel-list");this.#k(n,this.#h?"loading-versions":"empty")}#D(){this.#e?.parentNode!==this&&(this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="version-switcher-trigger",this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.appendChild(this.#e))}#_(){if(this.#n?.parentNode===this)return;let t=`version-switcher-${++x}`;this.#e.setAttribute("popovertarget",t),this.#n=document.createElement("pop-over"),this.#n.id=t,this.#n.className="version-switcher-popover",this.#n.dataset.position="bottom-end",this.#n.setAttribute("role","dialog"),this.#c=document.createElement("h3"),this.#c.className="version-switcher-heading",this.#s=document.createElement("ul"),this.#s.className="version-switcher-list",this.#s.setAttribute("role","list"),this.#n.append(this.#c,this.#s),this.appendChild(this.#n)}#U(){!this.#n||!this.#s||(this.listen(this.#n,"pop-over:show",()=>{this.#e.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("version-switcher:open",{bubbles:!0}));let t=this.#s.querySelector('[data-current="true"] button')||this.#s.querySelector("button");requestAnimationFrame(()=>t?.focus())}),this.listen(this.#n,"pop-over:hide",()=>{this.#e.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("version-switcher:close",{bubbles:!0}))}),this.listen(this.#s,"keydown",this.#V),this.listen(this.#s,"click",this.#$))}#f(){if(!this.#e)return;let t=this.#t.find(a=>a.id===this.#i),e=!!this.#h&&this.#t.length===0,i=e?this.#r("loading"):t?.label||t?.id||this.#r("trigger"),n=document.createElement("span");n.className="version-switcher-trigger-label",n.textContent=i;let r=document.createElement("span");r.className="version-switcher-trigger-chevron",r.setAttribute("aria-hidden","true"),r.textContent="\u25BE",this.#e.replaceChildren(n,r);let o=this.#b();this.#e.setAttribute("aria-label",i===o?o:`${o}: ${i}`),this.#n?.setAttribute("aria-label",o),this.#t.length===0?(this.#e.disabled=!0,this.#e.setAttribute("title",this.#r(e?"loading-versions":"empty"))):(this.#e.disabled=!1,this.#e.removeAttribute("title"))}#T(){this.#s&&(this.#c.textContent=this.#v(),this.#k(this.#s,"empty"))}#k(t,e){if(t.replaceChildren(),this.#t.length===0){let i=document.createElement("li");i.className="version-switcher-empty",i.textContent=this.#r(e),t.appendChild(i);return}for(let i of this.#t)t.appendChild(this.#q(i))}#q(t){let e=t.id===this.#i,i=t.label||t.id,n=document.createElement("li");n.setAttribute("role","listitem"),n.className="version-switcher-item",n.dataset.versionId=t.id,e&&(n.dataset.current="true"),t.archived&&(n.dataset.archived=""),t.draft&&(n.dataset.draft="");let r=document.createElement("button");r.type="button",r.className="version-switcher-entry",r.setAttribute("aria-current",e?"true":"false");let o=document.createElement("span");o.className="version-switcher-entry-label",o.append(i);let a=l=>{let u=document.createElement("span");u.className=`version-switcher-badge version-switcher-badge-${l}`,u.textContent=this.#r(l),o.append(" ",u)};if(t.archived&&a("archived"),t.draft&&a("draft"),e&&a("current"),r.appendChild(o),t.date){let l=document.createElement("time");l.className="version-switcher-entry-date",l.setAttribute("datetime",t.date);let u=L(this),d=xt(t.date,u);d&&(l.title=d),l.textContent=Nt(t.date,u)||d||t.date,r.append(" ",l)}n.appendChild(r);let c=[],h=`${this.#n?.id||"version-switcher"}-${Ct(t.id)}-${++x}`;if(t.author){let l=document.createElement("span");l.className="version-switcher-entry-author",l.id=`${h}-author`,l.textContent=this.#r("by",{author:t.author}),n.appendChild(l),c.push(l.id)}if(t.summary){let l=document.createElement("span");l.className="version-switcher-entry-summary",l.id=`${h}-summary`,l.textContent=t.summary,n.appendChild(l),c.push(l.id)}if(c.length&&r.setAttribute("aria-describedby",c.join(" ")),t.versionUrl&&b(t.versionUrl)){let l=document.createElement("a");l.className="version-switcher-entry-changelog",l.href=t.versionUrl,l.setAttribute("aria-label",this.#r("changelog-for",{version:i})),l.append(this.#r("changelog"));let u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.textContent=" \u2192",l.append(u),n.appendChild(l)}return n}#$=t=>{let e=t.target.closest?.("button.version-switcher-entry");if(!e)return;let i=e.closest("[data-version-id]")?.dataset.versionId,n=this.#t.find(r=>r.id===i);n&&this.#F(n)};#V=t=>{let e=[...this.#s.querySelectorAll("button.version-switcher-entry")],i=e.indexOf(document.activeElement);if(i===-1)return;let n=i;switch(t.key){case"ArrowDown":t.preventDefault(),n=Math.min(e.length-1,i+1);break;case"ArrowUp":t.preventDefault(),n=Math.max(0,i-1);break;case"Home":t.preventDefault(),n=0;break;case"End":t.preventDefault(),n=e.length-1;break;default:return}e[n]?.focus()};#F(t){this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:t}})),this.#L(t)}#L(t){let e=this.getAttribute("data-action")||"navigate";if(e==="navigate")return this.#M(t);if(e==="swap")return this.#B(t);if(e==="diff")return this.#j(t);this.#o(`Unknown action "${e}"; falling back to navigate.`),this.#M(t)}#M(t){if(!t?.url||!b(t.url)){this.#o("Cannot navigate: entry has no safe url.",{entry:t});return}let e=new URL(t.url,location.href);if(e.href===location.href){this.#o("Cannot navigate: entry url is the current page.",{entry:t});return}let i=new CustomEvent("version-switcher:before-navigate",{bubbles:!0,cancelable:!0,detail:{entry:t}});this.dispatchEvent(i)&&(this.closePicker(),location.href=e.href)}#m(){return this.getAttribute("data-versioned-region")||"[data-versioned], main"}#g(t){return t.querySelector(this.#m())}#I(t,e){if(!t?.url||!b(t.url))return this.#o(`Cannot ${e}: entry has no safe url.`,{entry:t}),null;let i=new URL(t.url,location.href);return i.origin!==location.origin?(this.#o(`Cannot ${e}: ${i.href} is not same-origin.`,{entry:t}),null):i}async#R(t){let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw new Error(`Fetch failed (${e.status}) for ${t.href}`);let i=await e.text(),n=new DOMParser().parseFromString(i,"text/html"),r=this.#g(n);if(!r)throw new Error(`No versioned region (${this.#m()}) found in ${t.href}`);return r}async#B(t){let e=this.#I(t,"swap");if(!e)return;let i=this.#g(document);if(!i){this.#o(`No versioned region (${this.#m()}) on this page to swap.`,{entry:t});return}let n=new CustomEvent("version-switcher:before-swap",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(n))return;this.closePicker();let r=this.#i,o=async()=>{try{let c=await this.#R(e);i.replaceChildren(P(c.innerHTML,{keepIds:!0,keepStyle:!0}))}catch(c){throw this.#o(c.message,{entry:t,error:c}),c}};try{if("startViewTransition"in document){let c;try{c=document.startViewTransition({update:o,types:["version-swap"]})}catch{c=document.startViewTransition(o)}await c.updateCallbackDone}else await o()}catch{return}let a=document.querySelector('meta[itemprop="version"]');a||(a=document.createElement("meta"),a.setAttribute("itemprop","version"),document.head.appendChild(a)),a.setAttribute("content",t.id),this.#i=t.id,this.#p(),this.dispatchEvent(new CustomEvent("version-switcher:swap",{bubbles:!0,detail:{entry:t,previousId:r}}))}async#j(t){let e=this.#I(t,"diff");if(!e)return;let i=this.#g(document);if(!i){this.#o(`No versioned region (${this.#m()}) on this page to diff against.`,{entry:t});return}if(t.id===this.#i){this.#o("Cannot diff against the current version.",{entry:t});return}let n=new CustomEvent("version-switcher:before-diff",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(n))return;this.closePicker();let r;try{r=await this.#R(e)}catch(h){this.#o(h.message,{entry:t,error:h});return}document.querySelectorAll(".version-switcher-diff-host").forEach(h=>h.remove());let o=U(i.textContent.trim(),r.textContent.trim()),a=document.createElement("change-set");a.classList.add("version-switcher-diff-host"),a.dataset.versionFrom=this.#i??"",a.dataset.versionTo=t.id,a.dataset.diffLabel=this.#r("diff",{from:this.#i??"",to:t.id}),a.appendChild(q(o)),(this.getAttribute("data-diff-position")||"before")==="after"?i.parentNode.insertBefore(a,i.nextSibling):i.parentNode.insertBefore(a,i),a.setAttribute("tabindex","-1"),a.focus({preventScroll:!1}),this.dispatchEvent(new CustomEvent("version-switcher:diff",{bubbles:!0,detail:{entry:t,previousId:this.#i,diffElement:a,opCount:o.length}}))}get versions(){return this.#t.slice()}get currentId(){return this.#i}openPicker(){this.#n?.show()}closePicker(){this.#n?.hide()}switchTo(t){let e=this.#t.find(i=>i.id===t);if(!e){this.#o(`switchTo: no entry with id "${t}"`);return}this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:e}})),this.#L(e)}refresh(){this.#w(),!(!this.#e||!this.#s)&&this.#p()}#o(t,e={}){this.dispatchEvent(new CustomEvent("version-switcher:error",{bubbles:!0,detail:{message:t,...e}}))}};function b(s){return typeof s=="string"&&s.trim()!==""&&!g(s,!1)}function Ct(s){return String(s).replace(/[^\w-]/g,"_")}function V(s){let t=new Date(s);return Number.isNaN(t.getTime())?null:t}function xt(s,t){let e=V(s);if(!e)return null;let i=St.test(s)?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"};try{return new Intl.DateTimeFormat(t,i).format(e)}catch{return e.toISOString()}}function Nt(s,t){let e=V(s);if(!e)return null;let i=(Date.now()-e.getTime())/1e3;if(i<0)return null;let n;try{n=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{n=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}let r=60,o=3600,a=86400,c=2592e3,h=31536e3;return i<r?n.format(0,"second"):i<o?n.format(-Math.floor(i/r),"minute"):i<a?n.format(-Math.floor(i/o),"hour"):i<c?n.format(-Math.floor(i/a),"day"):i<h?n.format(-Math.floor(i/c),"month"):n.format(-Math.floor(i/h),"year")}m("version-switcher",N);export{N as VersionSwitcher};
|
|
1
|
+
var Mt=window.matchMedia("(prefers-reduced-motion: reduce)");var L=new Map;function m(r,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=L.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}L.set(r,i),customElements.define(r,t)}var p=class extends HTMLElement{#t=[];#n;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#n||(this.#n=this.attachInternals());let n=this.#n.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#n||(this.#n=t)}#e(){return this.constructor.formAssociated&&this.#n?this.#n:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function M(r){return B(r&&r.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function B(r,t="en-US"){try{if(r)return Intl.getCanonicalLocales(r),r}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var H="http://www.w3.org/1999/xhtml",y="http://www.w3.org/2000/svg",j="http://www.w3.org/1998/Math/MathML",W=new Set([H,y,j]),E="user-content-",z=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),N=new Set(["title","desc"]),G=new Set(["animate","set","animatemotion","animatetransform"]),J=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),Y=new Set(["src","poster","srcset"]),K=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),X=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),Z=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),Q={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},tt=new Set(["social-embed","youtube-player","geo-map"]),et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],nt=new Set(["audio-player","video-player","image-map","brand-mark"]);function it(r){return String(r).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function g(r,t=!1){let e=it(r);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(i=>i.startsWith("data:")).some(i=>!/^data:(image|audio|video|font)\//.test(i)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function P(r){let t=String(r).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var rt=r=>String(r.localName||r.tagName||"").toLowerCase(),st=r=>r.startsWith(E)?r:E+r;function ot(r,t){if(z.has(t))return!0;let e=r.namespaceURI;return!!(e&&!W.has(e)||t==="title"&&e!==y||N.has(t)&&e===y&&r.children?.length||G.has(t)&&(r.getAttribute("attributeName")||r.getAttribute("attributename")||"").toLowerCase().includes("href"))}function at(r,t){for(let e of[...r.attributes]){let n=e.name.toLowerCase();if(n.startsWith("on")||K.has(n)||!t.keepIds&&X.has(n)){r.removeAttribute(e.name);continue}if(n==="style"){(!t.keepStyle||P(e.value))&&r.removeAttribute(e.name);continue}if((n==="id"||n==="name")&&!t.keepIds){let i=st(e.value);n==="id"?t.ids.set(e.value,i):t.ids.set(`name:${e.value}`,i),r.setAttribute(e.name,i);continue}if(J.has(n)||n.endsWith(":href")){g(e.value,!1)&&r.removeAttribute(e.name);continue}Y.has(n)&&g(e.value,!0)&&r.removeAttribute(e.name)}}function ct(r,t){let e=(r.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&r.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&r.setAttribute("type","button")}function lt(r,t){for(let e of r)for(let n of[...e.attributes]){let i=n.name.toLowerCase(),s=n.value;if((i==="href"||i.endsWith(":href"))&&s.startsWith("#")){let o=ut(s.slice(1));t.has(o)&&e.setAttribute(n.name,`#${t.get(o)}`)}else if(i==="usemap"&&s.startsWith("#")){let o=t.get(`name:${s.slice(1)}`);o?e.setAttribute(n.name,`#${o}`):e.removeAttribute(n.name)}else if(Z.has(i)){let o=s.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(E)?a:null)).filter(Boolean);o.length?e.setAttribute(n.name,o.join(" ")):e.removeAttribute(n.name)}else s.includes("url(#")&&e.setAttribute(n.name,s.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function ut(r){try{return decodeURIComponent(r)}catch{return r}}function I(r){let t=r.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&I(e)}function _(r,t){I(r);let e=[...r.querySelectorAll("*")];t.includeRoot&&e.unshift(r);let n=new Map,i=[],s={...t,ids:n};for(let o of e){if(!dt(o,r))continue;let a=rt(o);if(t.svgOnly&&(N.has(a)||a==="style")){if(a==="style"&&P(o.textContent||"")){o.remove();continue}}else if(ot(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&tt.has(a)){ht(o);continue}if(a==="template"){let u=o.content;u&&_(u,{...t,includeRoot:!1})}at(o,s),t.keepIds||ct(o,a);let c=Q[a];if(c)for(let u of c)o.removeAttribute(u);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!nt.has(a))for(let u of et)o.removeAttribute(u);i.push(o)}!t.keepIds&&n.size&<(i,n)}function ht(r){let t=r.parentNode;if(t){for(let e of[...r.childNodes])t.insertBefore(e,r);r.remove()}}function dt(r,t){let e=r;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function R(r,t={}){let e=document.createElement("template");return r&&typeof r=="string"&&(e.innerHTML=r,_(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var v=CSS.supports("anchor-name","--x"),ft=CSS.supports("position-area","bottom"),pt=(()=>{let r=document.createElement("span");return r.setAttribute("popover","hint"),r.popover==="hint"})(),mt=["auto","manual","hint"];function bt(r){let t=mt.includes(r||"")?r:"auto";return t==="hint"&&!pt?"auto":t}var gt=["top","bottom","left","right","inset-inline-start","inset-inline-end"],vt=["position","top","left","right","bottom","margin"],O=8,wt=0,yt=0;function q(r){return!r||r==="none"?[]:r.split(",").map(t=>t.trim()).filter(Boolean)}var A=class extends p{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#n=null;#e=`--pop-over-anchor-${++yt}`;#i=!1;#c=!1;#r=!1;setup(){if(this.id||(this.id=`pop-over-${++wt}`),(!this.hasAttribute("popover")||this.#i)&&this.#a(),this.#h(),this.#l(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!v&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#s()})}),!v){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#s()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#c&&(gt.forEach(t=>this.style.removeProperty(t)),this.#c=!1),this.#r&&(vt.forEach(t=>this.style.removeProperty(t)),this.#r=!1),this.#t=null}attributeChangedCallback(t,e,n){if(e!==n){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#i=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=bt(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#i=!0}show(){this.matches(":popover-open")||(this.showPopover(),!v&&this.#t&&this.matches(":popover-open")&&this.#s())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#h(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#l(){if(!this.#t||!v)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),n=q(e||getComputedStyle(t).getPropertyValue("anchor-name"));n.includes(this.#e)||n.push(this.#e),t.style.setProperty("anchor-name",n.join(", ")),this.#n=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),ft||this.#u(this.dataset.position||"bottom")}#d(){if(this.#t&&this.#n){let t=q(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#n);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#n=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#u(t){let e="var(--_pop-over-offset, var(--size-xs))",n=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},i={top:{bottom:`calc(anchor(top) + ${e})`,...n},bottom:{top:`calc(anchor(bottom) + ${e})`,...n},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],o=i[s]||i.bottom;Object.entries(o).forEach(([a,c])=>this.style.setProperty(a,c)),this.#c=!0}#s(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",n=this.#m(),i=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#r=!0;let o=this.offsetWidth,a=this.offsetHeight,c=e.split("-")[0];["top","bottom","left","right"].includes(c)||(c="bottom");let u={top:t.top-n,bottom:s-t.bottom-n,left:t.left-n,right:i-t.right-n},l={top:"bottom",bottom:"top",left:"right",right:"left"},h=c==="top"||c==="bottom"?a:o;u[c]<h&&u[l[c]]>u[c]&&(c=l[c]);let d,f;switch(c){case"top":d=t.top-a-n,f=t.left;break;case"left":d=t.top,f=t.left-o-n;break;case"right":d=t.top,f=t.right+n;break;default:d=t.bottom+n,f=t.left;break}if(c==="top"||c==="bottom"){let w=getComputedStyle(this).direction==="rtl";f=e.endsWith("-end")!==w?t.right-o:t.left}else e.endsWith("-end")&&(d=t.bottom-a);let $=(w,k,V)=>Math.max(O,Math.min(w,V-k-O));f=$(f,o,i),d=$(d,a,s),this.style.top=`${Math.round(d)}px`,this.style.left=`${Math.round(f)}px`}#m(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};m("pop-over",A);var S=["tracking","final","original"],Et={tracking:"Tracking",final:"Final",original:"Original"},C=class extends p{static observedAttributes=["view","author","datetime","controls"];setup(){this.#t(),this.listen(this,"click",this.#r)}attributeChangedCallback(t,e,n){!this.hasAttribute("data-upgraded")||e===n||(t==="view"?this.#c():this.#t())}#t(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#n(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#e(t)),this.prepend(...e),this.#c()}#n(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let n=document.createElement("p");if(n.setAttribute("data-change-caption",""),n.append(t?`Changes by ${t}`:"Changes"),e){n.append(t?", ":" from ");let i=document.createElement("time");i.setAttribute("datetime",e),i.textContent=this.#i(e),n.append(i)}return n}#e(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let n=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${n}`);for(let i of S){let s=document.createElement("button");s.type="button",s.dataset.action=i,s.textContent=Et[i],e.append(s)}return e}#i(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let n=this.closest("[lang]")?.lang||void 0,i=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(n,{dateStyle:"medium",...i?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#c(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#r=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let n=e.dataset.action;!n||!S.includes(n)||n!==this.view&&(this.#a(n),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:n},bubbles:!0})))};#a(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#c()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!S.includes(t)||this.view===t||(this.#a(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};m("change-set",C);function D(r,t){let e=String(r??"").split(`
|
|
2
|
+
`),n=String(t??"").split(`
|
|
3
|
+
`),i=e.length,s=n.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let l=1;l<=i;l++)for(let h=1;h<=s;h++)e[l-1]===n[h-1]?o[l][h]=o[l-1][h-1]+1:o[l][h]=Math.max(o[l-1][h],o[l][h-1]);let a=[],c=i,u=s;for(;c>0||u>0;)c>0&&u>0&&e[c-1]===n[u-1]?(a.unshift({type:"eq",text:e[c-1]}),c-=1,u-=1):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(a.unshift({type:"add",text:n[u-1]}),u-=1):(a.unshift({type:"del",text:e[c-1]}),c-=1);return a}function F(r){let t=document.createDocumentFragment(),e=document.createElement("pre");e.className="text-diff";for(let n of r)if(n.type==="eq")e.appendChild(document.createTextNode(`${n.text}
|
|
4
|
+
`));else if(n.type==="add"){let i=document.createElement("ins");i.textContent=`${n.text}
|
|
5
|
+
`,e.appendChild(i)}else if(n.type==="del"){let i=document.createElement("del");i.textContent=`${n.text}
|
|
6
|
+
`,e.appendChild(i)}return t.appendChild(e),t}var At={trigger:"Version",loading:"Loading\u2026","loading-versions":"Loading versions\u2026",empty:"No versions available.","heading-releases":"Versions","heading-history":"History",archived:"archived",draft:"draft",current:"current",by:"by {author}",changelog:"Changelog","changelog-for":"{version} changelog","banner-label":"Archived version notice",banner:"You\u2019re viewing {version} (archived).","banner-latest":"Latest: {version}",diff:"Diff: {from} \u2192 {to}"},St=/^\d{4}-\d{2}-\d{2}$/,x=0,T=class extends p{static observedAttributes=["data-versions","data-src","data-mode","aria-label"];#t=[];#n=null;#e;#i;#c;#r;#a=null;#h=null;#l=null;#d=null;#u=null;setup(){this.#w(),this.#O(),this.#q(),this.#D(),this.#f(),this.#$(),this.#C(),this.hasAttribute("data-page-info-target")&&this.#R(),this.#t.length===0&&(this.getAttribute("data-src")||this.#A())&&this.#S()}teardown(){this.#h?.disconnect(),this.#h=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null,this.#a?.remove(),this.#a=null,this.#u=null}attributeChangedCallback(t,e,n){!this.isConnected||e===n||!this.#e||(t==="data-versions"&&this.refresh(),t==="data-src"&&this.#S(),(t==="data-mode"||t==="aria-label")&&this.#p())}#s(t,e={}){let n=this.getAttribute(`data-label-${t}`)??At[t]??t;for(let[i,s]of Object.entries(e))n=n.replaceAll(`{${i}}`,String(s));return n}#m(){return this.getAttribute("aria-label")||this.#s("trigger")}#v(){return this.#s(this.#_()==="history"?"heading-history":"heading-releases")}#w(){let t=null,e=this.getAttribute("data-versions");if(e)try{t=JSON.parse(e)}catch(n){this.#o("Failed to parse data-versions JSON",{error:n})}if(!t){let n=this.querySelector(':scope > script[type="application/json"][data-versions]');if(n?.textContent.trim())try{t=JSON.parse(n.textContent)}catch(i){this.#o("Failed to parse <script data-versions> JSON",{error:i})}}this.#t=this.#y(t),this.#n=this.#E()}#y(t){if(!Array.isArray(t))return[];let e=[];for(let n of t){if(!n||typeof n.id!="string")continue;let i={...n};if(i.url!=null&&!b(i.url)){this.#o(`Dropped version "${i.id}": unsafe url.`,{entry:i});continue}i.versionUrl!=null&&!b(i.versionUrl)&&delete i.versionUrl,e.push(i)}return e}#E(){if(this.#t.length===0)return null;let t=this.#t.find(n=>n.current===!0);if(t)return t.id;let e=document.querySelector('meta[itemprop="version"]')?.getAttribute("content");if(e){let n=this.#t.find(i=>i.id===e);if(n)return n.id}return this.#t[0].id}#_(){let t=this.getAttribute("data-mode");return t==="releases"||t==="history"?t:new Set(this.#t.map(n=>n.url).filter(Boolean)).size>1?"releases":"history"}#A(){return document.querySelector('meta[name="vb:versions-manifest"]')?.getAttribute("content")}async#S(){let t=this.getAttribute("data-src")||this.#A();if(!t)return;this.#u=t,this.#f();let e;try{let n=await fetch(t,{credentials:"same-origin"});if(!n.ok)throw new Error(`Fetch failed (${n.status}) for ${t}`);e=await n.json()}catch(n){if(this.#u!==t)return;this.#u=null,this.#o(`Failed to load versions manifest: ${n.message}`,{error:n}),this.#f();return}if(this.#u===t){if(this.#u=null,!Array.isArray(e)){this.#o(`Manifest is not a JSON array: ${t}`),this.#f();return}this.#t=this.#y(e),this.#n=this.#E(),this.#p()}}#p(){this.#f(),this.#$(),this.#C(),this.#a&&this.#T()}#C(){if(this.#d?.remove(),this.#d=null,!this.hasAttribute("data-banner"))return;let t=this.#t.find(o=>o.id===this.#n),e=this.#t.find(o=>!o.archived&&!o.draft);if(!t?.archived||!e||e.id===t.id)return;let n=document.createElement("aside");n.className="version-switcher-banner",n.setAttribute("aria-label",this.#s("banner-label"));let i=document.createElement("p");i.className="version-switcher-banner-text",i.setAttribute("role","status"),n.append(i),this.prepend(n),this.#d=n;let s=()=>{if(this.#d!==n)return;i.textContent=this.#s("banner",{version:t.label||t.id});let o=this.#s("banner-latest",{version:e.label||e.id});if(e.url&&b(e.url)){let a=document.createElement("a");a.className="version-switcher-banner-link",a.href=e.url,a.textContent=o,n.append(a)}else{let a=document.createElement("span");a.className="version-switcher-banner-latest",a.textContent=o,n.append(a)}};requestAnimationFrame(()=>requestAnimationFrame(s))}#R(){let t=this.getAttribute("data-page-info-target");if(!t)return;let e=document.getElementById(t);if(!e||e.localName!=="page-info"){this.#o(`data-page-info-target: no <page-info id="${t}"> found.`);return}this.#e.hidden=!0;let n=()=>{let s=e.querySelector(".page-info-panel");return s?(this.#T(s),!0):!1};if(n())return;let i=new MutationObserver(()=>{n()&&this.#x()});i.observe(e,{childList:!0,subtree:!0}),this.#h=i,this.#l=setTimeout(()=>{this.#l=null,!this.#a&&(this.#x(),this.#o(`<page-info id="${t}"> never rendered .page-info-panel within 5s.`))},5e3)}#x(){this.#h?.disconnect(),this.#h=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null}#T(t){let e=t||this.#a?.parentNode;if(!e)return;let n=this.#a;if(!n){n=document.createElement("section"),n.className="version-switcher-panel-section";let s=document.createElement("h3");s.className="version-switcher-panel-heading",s.id=`version-switcher-panel-${++x}`,n.setAttribute("aria-labelledby",s.id);let o=document.createElement("ul");o.className="version-switcher-panel-list",n.append(s,o),e.appendChild(n),this.#a=n,this.listen(o,"click",this.#L)}n.querySelector(".version-switcher-panel-heading").textContent=this.#v();let i=n.querySelector("ul.version-switcher-panel-list");this.#k(i,this.#u?"loading-versions":"empty")}#O(){this.#e?.parentNode!==this&&(this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="version-switcher-trigger",this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.appendChild(this.#e))}#q(){if(this.#i?.parentNode===this)return;let t=`version-switcher-${++x}`;this.#e.setAttribute("popovertarget",t),this.#i=document.createElement("pop-over"),this.#i.id=t,this.#i.className="version-switcher-popover",this.#i.dataset.position="bottom-end",this.#i.setAttribute("role","dialog"),this.#c=document.createElement("h3"),this.#c.className="version-switcher-heading",this.#r=document.createElement("ul"),this.#r.className="version-switcher-list",this.#r.setAttribute("role","list"),this.#i.append(this.#c,this.#r),this.appendChild(this.#i)}#D(){!this.#i||!this.#r||(this.listen(this.#i,"pop-over:show",()=>{this.#e.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("version-switcher:open",{bubbles:!0}));let t=this.#r.querySelector('[data-current="true"] button')||this.#r.querySelector("button");requestAnimationFrame(()=>t?.focus())}),this.listen(this.#i,"pop-over:hide",()=>{this.#e.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("version-switcher:close",{bubbles:!0}))}),this.listen(this.#r,"keydown",this.#U),this.listen(this.#r,"click",this.#L))}#f(){if(!this.#e)return;let t=this.#t.find(a=>a.id===this.#n),e=!!this.#u&&this.#t.length===0,n=e?this.#s("loading"):t?.label||t?.id||this.#s("trigger"),i=document.createElement("span");i.className="version-switcher-trigger-label",i.textContent=n;let s=document.createElement("span");s.className="version-switcher-trigger-chevron",s.setAttribute("aria-hidden","true"),s.textContent="\u25BE",this.#e.replaceChildren(i,s);let o=this.#m();this.#e.setAttribute("aria-label",n===o?o:`${o}: ${n}`),this.#i?.setAttribute("aria-label",o),this.#t.length===0?(this.#e.disabled=!0,this.#e.setAttribute("title",this.#s(e?"loading-versions":"empty"))):(this.#e.disabled=!1,this.#e.removeAttribute("title"))}#$(){this.#r&&(this.#c.textContent=this.#v(),this.#k(this.#r,"empty"))}#k(t,e){if(t.replaceChildren(),this.#t.length===0){let n=document.createElement("li");n.className="version-switcher-empty",n.textContent=this.#s(e),t.appendChild(n);return}for(let n of this.#t)t.appendChild(this.#F(n))}#F(t){let e=t.id===this.#n,n=t.label||t.id,i=document.createElement("li");i.setAttribute("role","listitem"),i.className="version-switcher-item",i.dataset.versionId=t.id,e&&(i.dataset.current="true"),t.archived&&(i.dataset.archived=""),t.draft&&(i.dataset.draft="");let s=document.createElement("button");s.type="button",s.className="version-switcher-entry",s.setAttribute("aria-current",e?"true":"false");let o=document.createElement("span");o.className="version-switcher-entry-label",o.append(n);let a=l=>{let h=document.createElement("span");h.className=`version-switcher-badge version-switcher-badge-${l}`,h.textContent=this.#s(l),o.append(" ",h)};if(t.archived&&a("archived"),t.draft&&a("draft"),e&&a("current"),s.appendChild(o),t.date){let l=document.createElement("time");l.className="version-switcher-entry-date",l.setAttribute("datetime",t.date);let h=M(this),d=xt(t.date,h);d&&(l.title=d),l.textContent=Tt(t.date,h)||d||t.date,s.append(" ",l)}i.appendChild(s);let c=[],u=`${this.#i?.id||"version-switcher"}-${Ct(t.id)}-${++x}`;if(t.author){let l=document.createElement("span");l.className="version-switcher-entry-author",l.id=`${u}-author`,l.textContent=this.#s("by",{author:t.author}),i.appendChild(l),c.push(l.id)}if(t.summary){let l=document.createElement("span");l.className="version-switcher-entry-summary",l.id=`${u}-summary`,l.textContent=t.summary,i.appendChild(l),c.push(l.id)}if(c.length&&s.setAttribute("aria-describedby",c.join(" ")),t.versionUrl&&b(t.versionUrl)){let l=document.createElement("a");l.className="version-switcher-entry-changelog",l.href=t.versionUrl,l.setAttribute("aria-label",this.#s("changelog-for",{version:n})),l.append(this.#s("changelog"));let h=document.createElement("span");h.setAttribute("aria-hidden","true"),h.textContent=" \u2192",l.append(h),i.appendChild(l)}return i}#L=t=>{let e=t.target.closest?.("button.version-switcher-entry");if(!e)return;let n=e.closest("[data-version-id]")?.dataset.versionId,i=this.#t.find(s=>s.id===n);i&&this.#V(i)};#U=t=>{let e=[...this.#r.querySelectorAll("button.version-switcher-entry")],n=e.indexOf(document.activeElement);if(n===-1)return;let i=n;switch(t.key){case"ArrowDown":t.preventDefault(),i=Math.min(e.length-1,n+1);break;case"ArrowUp":t.preventDefault(),i=Math.max(0,n-1);break;case"Home":t.preventDefault(),i=0;break;case"End":t.preventDefault(),i=e.length-1;break;default:return}e[i]?.focus()};#V(t){this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:t}})),this.#M(t)}#M(t){let e=this.getAttribute("data-action")||"navigate";if(e==="navigate")return this.#N(t);if(e==="swap")return this.#B(t);if(e==="diff")return this.#H(t);this.#o(`Unknown action "${e}"; falling back to navigate.`),this.#N(t)}#N(t){if(!t?.url||!b(t.url)){this.#o("Cannot navigate: entry has no safe url.",{entry:t});return}let e=new URL(t.url,location.href);if(e.href===location.href){this.#o("Cannot navigate: entry url is the current page.",{entry:t});return}let n=new CustomEvent("version-switcher:before-navigate",{bubbles:!0,cancelable:!0,detail:{entry:t}});this.dispatchEvent(n)&&(this.closePicker(),location.href=e.href)}#b(){return this.getAttribute("data-versioned-region")||"[data-versioned], else main"}#g(t){let e=this.getAttribute("data-versioned-region");return e?t.querySelector(e):t.querySelector("[data-versioned]")??t.querySelector("main")}#P(t,e){if(!t?.url||!b(t.url))return this.#o(`Cannot ${e}: entry has no safe url.`,{entry:t}),null;let n=new URL(t.url,location.href);return n.origin!==location.origin?(this.#o(`Cannot ${e}: ${n.href} is not same-origin.`,{entry:t}),null):n}async#I(t){let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw new Error(`Fetch failed (${e.status}) for ${t.href}`);let n=await e.text(),i=new DOMParser().parseFromString(n,"text/html"),s=this.#g(i);if(!s)throw new Error(`No versioned region (${this.#b()}) found in ${t.href}`);return s}async#B(t){let e=this.#P(t,"swap");if(!e)return;let n=this.#g(document);if(!n){this.#o(`No versioned region (${this.#b()}) on this page to swap.`,{entry:t});return}let i=new CustomEvent("version-switcher:before-swap",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(i))return;this.closePicker();let s=this.#n,o=async()=>{try{let c=await this.#I(e);n.replaceChildren(R(c.innerHTML,{keepIds:!0,keepStyle:!0}))}catch(c){throw this.#o(c.message,{entry:t,error:c}),c}};try{if("startViewTransition"in document){let c;try{c=document.startViewTransition({update:o,types:["version-swap"]})}catch{c=document.startViewTransition(o)}await c.updateCallbackDone}else await o()}catch{return}let a=document.querySelector('meta[itemprop="version"]');a||(a=document.createElement("meta"),a.setAttribute("itemprop","version"),document.head.appendChild(a)),a.setAttribute("content",t.id),this.#n=t.id,this.#p(),this.dispatchEvent(new CustomEvent("version-switcher:swap",{bubbles:!0,detail:{entry:t,previousId:s}}))}async#H(t){let e=this.#P(t,"diff");if(!e)return;let n=this.#g(document);if(!n){this.#o(`No versioned region (${this.#b()}) on this page to diff against.`,{entry:t});return}if(t.id===this.#n){this.#o("Cannot diff against the current version.",{entry:t});return}let i=new CustomEvent("version-switcher:before-diff",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(i))return;this.closePicker();let s;try{s=await this.#I(e)}catch(u){this.#o(u.message,{entry:t,error:u});return}document.querySelectorAll(".version-switcher-diff-host").forEach(u=>u.remove());let o=D(n.textContent.trim(),s.textContent.trim()),a=document.createElement("change-set");a.classList.add("version-switcher-diff-host"),a.dataset.versionFrom=this.#n??"",a.dataset.versionTo=t.id,a.dataset.diffLabel=this.#s("diff",{from:this.#n??"",to:t.id}),a.appendChild(F(o)),(this.getAttribute("data-diff-position")||"before")==="after"?n.parentNode.insertBefore(a,n.nextSibling):n.parentNode.insertBefore(a,n),a.setAttribute("tabindex","-1"),a.focus({preventScroll:!1}),this.dispatchEvent(new CustomEvent("version-switcher:diff",{bubbles:!0,detail:{entry:t,previousId:this.#n,diffElement:a,opCount:o.length}}))}get versions(){return this.#t.slice()}get currentId(){return this.#n}openPicker(){this.#i?.show()}closePicker(){this.#i?.hide()}switchTo(t){let e=this.#t.find(n=>n.id===t);if(!e){this.#o(`switchTo: no entry with id "${t}"`);return}this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:e}})),this.#M(e)}refresh(){this.#w(),!(!this.#e||!this.#r)&&this.#p()}#o(t,e={}){this.dispatchEvent(new CustomEvent("version-switcher:error",{bubbles:!0,detail:{message:t,...e}}))}};function b(r){return typeof r=="string"&&r.trim()!==""&&!g(r,!1)}function Ct(r){return String(r).replace(/[^\w-]/g,"_")}function U(r){let t=new Date(r);return Number.isNaN(t.getTime())?null:t}function xt(r,t){let e=U(r);if(!e)return null;let n=St.test(r)?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"};try{return new Intl.DateTimeFormat(t,n).format(e)}catch{return e.toISOString()}}function Tt(r,t){let e=U(r);if(!e)return null;let n=(Date.now()-e.getTime())/1e3;if(n<0)return null;let i;try{i=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{i=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}let s=60,o=3600,a=86400,c=2592e3,u=31536e3;return n<s?i.format(0,"second"):n<o?i.format(-Math.floor(n/s),"minute"):n<a?i.format(-Math.floor(n/o),"hour"):n<c?i.format(-Math.floor(n/a),"day"):n<u?i.format(-Math.floor(n/c),"month"):i.format(-Math.floor(n/u),"year")}m("version-switcher",T);export{T as VersionSwitcher};
|
|
7
7
|
//# sourceMappingURL=version-switcher.js.map
|