@bk2k/ui 0.6.8 → 0.7.1
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/BUILDING.md +56 -2
- package/CHANGELOG.md +199 -0
- package/USAGE.md +102 -28
- package/custom-elements.json +1 -1
- package/dist/charts/chart-tokens.js +1 -1
- package/dist/charts/fields.d.ts +20 -0
- package/dist/charts/fields.js +27 -0
- package/dist/charts/frame.d.ts +2 -0
- package/dist/charts/frame.js +2 -1
- package/dist/clipboard.js +1 -0
- package/dist/components/bk-alert.js +3 -2
- package/dist/components/bk-avatar-group.js +4 -6
- package/dist/components/bk-avatar.d.ts +10 -0
- package/dist/components/bk-avatar.js +17 -0
- package/dist/components/bk-bar.js +2 -0
- package/dist/components/bk-button-group.js +1 -1
- package/dist/components/bk-button-top.js +2 -1
- package/dist/components/bk-button.d.ts +42 -14
- package/dist/components/bk-button.js +67 -20
- package/dist/components/bk-card.d.ts +7 -0
- package/dist/components/bk-card.js +21 -2
- package/dist/components/bk-carousel-controls.d.ts +2 -0
- package/dist/components/bk-carousel-controls.js +4 -2
- package/dist/components/bk-chart-area.d.ts +10 -0
- package/dist/components/bk-chart-bar.d.ts +17 -0
- package/dist/components/bk-chart-bar.js +25 -4
- package/dist/components/bk-chart-line.d.ts +28 -0
- package/dist/components/bk-chart-line.js +27 -7
- package/dist/components/bk-chip-group.d.ts +2 -2
- package/dist/components/bk-chip-group.js +4 -0
- package/dist/components/bk-chip.d.ts +55 -8
- package/dist/components/bk-chip.js +46 -8
- package/dist/components/bk-code.js +6 -2
- package/dist/components/bk-columns.d.ts +11 -0
- package/dist/components/bk-columns.js +8 -1
- package/dist/components/bk-combobox.d.ts +3 -3
- package/dist/components/bk-combobox.js +9 -21
- package/dist/components/bk-delta.d.ts +10 -0
- package/dist/components/bk-delta.js +8 -6
- package/dist/components/bk-dialog.d.ts +12 -5
- package/dist/components/bk-dialog.js +14 -6
- package/dist/components/bk-disclosure.js +4 -2
- package/dist/components/bk-drop-target.d.ts +7 -1
- package/dist/components/bk-drop-target.js +20 -4
- package/dist/components/bk-error-summary.d.ts +5 -0
- package/dist/components/bk-error-summary.js +13 -4
- package/dist/components/bk-facts.js +3 -2
- package/dist/components/bk-footnote.d.ts +73 -0
- package/dist/components/bk-footnote.js +97 -0
- package/dist/components/bk-footnotes-item.d.ts +92 -0
- package/dist/components/bk-footnotes-item.js +139 -0
- package/dist/components/bk-footnotes.d.ts +51 -0
- package/dist/components/bk-footnotes.js +43 -0
- package/dist/components/bk-icon.js +2 -2
- package/dist/components/bk-image-compare.d.ts +69 -6
- package/dist/components/bk-image-compare.js +116 -32
- package/dist/components/bk-image-crop.d.ts +3 -3
- package/dist/components/bk-image-editor.d.ts +1 -1
- package/dist/components/bk-image-viewer.d.ts +178 -11
- package/dist/components/bk-image-viewer.js +310 -52
- package/dist/components/bk-input-color.d.ts +2 -5
- package/dist/components/bk-input-color.js +0 -14
- package/dist/components/bk-input-file.d.ts +17 -0
- package/dist/components/bk-input-file.js +18 -8
- package/dist/components/bk-input-inline.d.ts +15 -6
- package/dist/components/bk-input-inline.js +22 -6
- package/dist/components/bk-input-number.js +2 -1
- package/dist/components/bk-input-search.d.ts +1 -1
- package/dist/components/bk-input-search.js +2 -1
- package/dist/components/bk-input-tags.d.ts +219 -0
- package/dist/components/bk-input-tags.js +293 -0
- package/dist/components/bk-input-text.d.ts +20 -0
- package/dist/components/bk-input-text.js +34 -4
- package/dist/components/bk-input-time.js +2 -1
- package/dist/components/bk-item.js +2 -1
- package/dist/components/bk-lightbox.d.ts +37 -4
- package/dist/components/bk-lightbox.js +13 -3
- package/dist/components/bk-link.d.ts +9 -1
- package/dist/components/bk-link.js +14 -4
- package/dist/components/bk-menu-item.d.ts +40 -0
- package/dist/components/bk-menu-item.js +57 -9
- package/dist/components/bk-menu-label.js +2 -1
- package/dist/components/bk-menu-list.d.ts +1 -0
- package/dist/components/bk-menu-list.js +10 -0
- package/dist/components/bk-menu.d.ts +8 -1
- package/dist/components/bk-menu.js +16 -5
- package/dist/components/bk-message-feedback.d.ts +4 -3
- package/dist/components/bk-message-feedback.js +7 -5
- package/dist/components/bk-message-list.js +2 -1
- package/dist/components/bk-message-source.d.ts +1 -2
- package/dist/components/bk-message-source.js +3 -11
- package/dist/components/bk-message.js +2 -0
- package/dist/components/bk-nav-group.js +1 -1
- package/dist/components/bk-nav-item.d.ts +18 -0
- package/dist/components/bk-nav-item.js +18 -5
- package/dist/components/bk-nav.d.ts +1 -1
- package/dist/components/bk-page-cta.d.ts +2 -0
- package/dist/components/bk-page-cta.js +10 -1
- package/dist/components/bk-page-section.d.ts +1 -1
- package/dist/components/bk-page-section.js +3 -9
- package/dist/components/bk-pane.d.ts +1 -0
- package/dist/components/bk-pane.js +7 -5
- package/dist/components/bk-panel.d.ts +1 -1
- package/dist/components/bk-panel.js +6 -5
- package/dist/components/bk-picture.d.ts +17 -4
- package/dist/components/bk-picture.js +8 -1
- package/dist/components/bk-segmented-item.d.ts +24 -4
- package/dist/components/bk-segmented-item.js +37 -5
- package/dist/components/bk-segmented.js +2 -13
- package/dist/components/bk-select-cascade.d.ts +1 -1
- package/dist/components/bk-select-tree.d.ts +1 -1
- package/dist/components/bk-select.d.ts +1 -1
- package/dist/components/bk-shell-app.d.ts +10 -4
- package/dist/components/bk-shell-app.js +32 -9
- package/dist/components/bk-shell-sites.d.ts +2 -1
- package/dist/components/bk-shell-sites.js +3 -5
- package/dist/components/bk-sortable.js +7 -17
- package/dist/components/bk-split-grid.d.ts +104 -3
- package/dist/components/bk-split-grid.js +430 -2
- package/dist/components/bk-stat-group.js +2 -1
- package/dist/components/bk-stat.d.ts +19 -0
- package/dist/components/bk-stat.js +8 -4
- package/dist/components/bk-steps.js +2 -1
- package/dist/components/bk-surface.d.ts +2 -0
- package/dist/components/bk-surface.js +6 -3
- package/dist/components/bk-table.d.ts +3 -1
- package/dist/components/bk-table.js +10 -13
- package/dist/components/bk-tabs-item.d.ts +45 -7
- package/dist/components/bk-tabs-item.js +51 -20
- package/dist/components/bk-tabs-panel.d.ts +6 -3
- package/dist/components/bk-tabs-panel.js +6 -0
- package/dist/components/bk-tabs.d.ts +52 -8
- package/dist/components/bk-tabs.js +181 -97
- package/dist/components/bk-text.js +2 -1
- package/dist/components/bk-toast-group.d.ts +3 -1
- package/dist/components/bk-toast-group.js +11 -1
- package/dist/components/bk-tooltip.d.ts +3 -1
- package/dist/components/bk-tooltip.js +2 -1
- package/dist/components/bk-video.js +2 -2
- package/dist/components/bk-zoom.d.ts +3 -1
- package/dist/components/confirm.d.ts +15 -0
- package/dist/components/confirm.js +27 -4
- package/dist/i18n/de.js +12 -1
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.js +3 -0
- package/dist/i18n.d.ts +16 -2
- package/dist/i18n.js +28 -4
- package/dist/icons/brands-static.d.ts +3 -0
- package/dist/icons/brands-static.js +5 -0
- package/dist/icons/core.d.ts +1 -0
- package/dist/icons/core.js +2 -0
- package/dist/icons/load-static.d.ts +3 -0
- package/dist/icons/load-static.js +5 -0
- package/dist/icons/load.js +1 -0
- package/dist/icons/registry.js +1 -1
- package/dist/icons/set/save-as.d.ts +3 -0
- package/dist/icons/set/save-as.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/internal/announcer.d.ts +14 -1
- package/dist/internal/announcer.js +33 -12
- package/dist/internal/backdrop.d.ts +19 -0
- package/dist/internal/backdrop.js +29 -0
- package/dist/internal/busy.d.ts +3 -2
- package/dist/internal/busy.js +4 -5
- package/dist/internal/choice-field.js +1 -1
- package/dist/internal/choice-item.d.ts +17 -6
- package/dist/internal/choice-item.js +20 -9
- package/dist/internal/cloak.js +4 -0
- package/dist/internal/crop-frame.d.ts +1 -1
- package/dist/internal/crop-frame.js +2 -7
- package/dist/internal/date-field.js +2 -1
- package/dist/internal/define.d.ts +9 -0
- package/dist/internal/define.js +47 -1
- package/dist/internal/drag.d.ts +11 -0
- package/dist/internal/drag.js +23 -0
- package/dist/internal/elements.d.ts +6 -0
- package/dist/internal/elements.js +5 -0
- package/dist/internal/english-static.d.ts +3 -0
- package/dist/internal/english-static.js +5 -0
- package/dist/internal/english.d.ts +8 -0
- package/dist/internal/english.js +6 -0
- package/dist/internal/footnotes.d.ts +56 -0
- package/dist/internal/footnotes.js +143 -0
- package/dist/internal/handle-menu.js +2 -5
- package/dist/internal/hue.d.ts +8 -0
- package/dist/internal/hue.js +15 -4
- package/dist/internal/late/bk-shell-app.d.ts +4 -0
- package/dist/internal/late/bk-shell-app.js +7 -0
- package/dist/internal/late/bk-table.d.ts +4 -0
- package/dist/internal/late/bk-table.js +17 -0
- package/dist/internal/late/bk-tabs.d.ts +4 -0
- package/dist/internal/late/bk-tabs.js +8 -0
- package/dist/internal/late/handle-menu.d.ts +4 -0
- package/dist/internal/late/handle-menu.js +9 -0
- package/dist/internal/late/static.d.ts +7 -0
- package/dist/internal/late/static.js +5 -0
- package/dist/internal/late.d.ts +8 -3
- package/dist/internal/late.js +19 -4
- package/dist/internal/link.d.ts +2 -0
- package/dist/internal/link.js +11 -1
- package/dist/internal/own-text.d.ts +8 -0
- package/dist/internal/own-text.js +7 -0
- package/dist/internal/scope.js +1 -1
- package/dist/internal/scroll-lock.d.ts +4 -1
- package/dist/internal/scroll-lock.js +17 -4
- package/dist/internal/slider.js +2 -1
- package/dist/internal/styles.js +3 -0
- package/dist/internal/submit.d.ts +23 -0
- package/dist/internal/submit.js +57 -0
- package/dist/internal/tags.d.ts +15 -0
- package/dist/internal/tags.js +44 -0
- package/dist/internal/text-field.d.ts +2 -0
- package/dist/internal/text-field.js +8 -0
- package/dist/internal/toggle-control.js +3 -1
- package/dist/jsx.d.ts +222 -54
- package/dist/kit.d.ts +1 -0
- package/dist/kit.js +3 -0
- package/dist/reset.css +10 -0
- package/dist/standalone/all.js +226 -221
- package/dist/standalone/appearance.js +1 -1
- package/dist/standalone/bk-accordion-item.js +4 -4
- package/dist/standalone/bk-accordion.js +2 -2
- package/dist/standalone/bk-action-bar.js +3 -3
- package/dist/standalone/bk-alert-offline.js +1 -2
- package/dist/standalone/bk-alert.js +17 -13
- package/dist/standalone/bk-app-state.js +1 -1
- package/dist/standalone/bk-attachment.js +4 -4
- package/dist/standalone/bk-avatar-group.js +12 -10
- package/dist/standalone/bk-avatar.js +15 -5
- package/dist/standalone/bk-badge.js +2 -2
- package/dist/standalone/bk-bar.js +3 -1
- package/dist/standalone/bk-brand.js +3 -3
- package/dist/standalone/bk-breadcrumbs.js +5 -5
- package/dist/standalone/bk-button-copy.js +7 -7
- package/dist/standalone/bk-button-group.js +5 -5
- package/dist/standalone/bk-button-share.js +7 -7
- package/dist/standalone/bk-button-top.js +9 -8
- package/dist/standalone/bk-button.js +74 -34
- package/dist/standalone/bk-calendar-event.js +1 -1
- package/dist/standalone/bk-calendar-week.js +3 -3
- package/dist/standalone/bk-calendar.js +4 -4
- package/dist/standalone/bk-card.js +26 -7
- package/dist/standalone/bk-carousel-controls.js +7 -6
- package/dist/standalone/bk-carousel-item.js +2 -2
- package/dist/standalone/bk-carousel.js +1 -1
- package/dist/standalone/bk-chart-area.js +1 -1
- package/dist/standalone/bk-chart-bar-list.js +8 -8
- package/dist/standalone/bk-chart-bar.js +145 -117
- package/dist/standalone/bk-chart-bridge.js +7 -7
- package/dist/standalone/bk-chart-bullet.js +6 -6
- package/dist/standalone/bk-chart-calendar.js +7 -7
- package/dist/standalone/bk-chart-heatmap.js +7 -7
- package/dist/standalone/bk-chart-histogram.js +5 -5
- package/dist/standalone/bk-chart-legend.js +6 -6
- package/dist/standalone/bk-chart-line.js +128 -107
- package/dist/standalone/bk-chart-mark.js +1 -1
- package/dist/standalone/bk-chart-scatter.js +6 -6
- package/dist/standalone/bk-chart-sparkline.js +6 -6
- package/dist/standalone/bk-chart-stacked-bar.js +7 -7
- package/dist/standalone/bk-chart-tracker.js +6 -6
- package/dist/standalone/bk-chart-waterfall.js +6 -6
- package/dist/standalone/bk-checkbox-group.js +7 -7
- package/dist/standalone/bk-checkbox.js +4 -4
- package/dist/standalone/bk-chip-group.js +11 -7
- package/dist/standalone/bk-chip.js +59 -18
- package/dist/standalone/bk-cluster.js +1 -1
- package/dist/standalone/bk-code-diff.js +4 -4
- package/dist/standalone/bk-code-stack.js +4 -4
- package/dist/standalone/bk-code.js +10 -6
- package/dist/standalone/bk-color-panel.js +5 -5
- package/dist/standalone/bk-columns.js +13 -5
- package/dist/standalone/bk-combobox.js +23 -31
- package/dist/standalone/bk-command-menu.js +6 -6
- package/dist/standalone/bk-command-palette.js +8 -7
- package/dist/standalone/bk-composer.js +6 -6
- package/dist/standalone/bk-delta.js +11 -10
- package/dist/standalone/bk-diagram.js +1 -1
- package/dist/standalone/bk-dialog.js +1 -1
- package/dist/standalone/bk-disclosure.js +7 -5
- package/dist/standalone/bk-divider.js +5 -5
- package/dist/standalone/bk-drawer.js +3 -3
- package/dist/standalone/bk-drop-target.js +12 -6
- package/dist/standalone/bk-empty-state.js +3 -3
- package/dist/standalone/bk-error-summary.js +9 -6
- package/dist/standalone/bk-facts-item.js +2 -2
- package/dist/standalone/bk-facts.js +9 -8
- package/dist/standalone/bk-feature.js +3 -3
- package/dist/standalone/bk-fieldset.js +3 -3
- package/dist/standalone/bk-filter-bar.js +4 -4
- package/dist/standalone/bk-folder-browser.js +4 -4
- package/dist/standalone/bk-footnote.js +82 -0
- package/dist/standalone/bk-footnotes-item.js +122 -0
- package/dist/standalone/bk-footnotes.js +37 -0
- package/dist/standalone/bk-form-guard.js +2 -2
- package/dist/standalone/bk-form-steps.js +3 -3
- package/dist/standalone/bk-grid.js +1 -1
- package/dist/standalone/bk-icon-tile.js +3 -3
- package/dist/standalone/bk-icon.js +1 -1
- package/dist/standalone/bk-image-compare.js +127 -58
- package/dist/standalone/bk-image-crop.js +6 -6
- package/dist/standalone/bk-image-editor.js +1 -1
- package/dist/standalone/bk-image-viewer.js +283 -92
- package/dist/standalone/bk-input-code.js +4 -4
- package/dist/standalone/bk-input-color.js +4 -14
- package/dist/standalone/bk-input-date-range.js +2 -2
- package/dist/standalone/bk-input-date.js +2 -2
- package/dist/standalone/bk-input-file.js +22 -15
- package/dist/standalone/bk-input-group.js +4 -4
- package/dist/standalone/bk-input-inline.js +17 -10
- package/dist/standalone/bk-input-number.js +9 -8
- package/dist/standalone/bk-input-rating.js +6 -6
- package/dist/standalone/bk-input-rich.js +1 -1
- package/dist/standalone/bk-input-search.js +23 -22
- package/dist/standalone/bk-input-slider-range.js +5 -5
- package/dist/standalone/bk-input-slider.js +5 -5
- package/dist/standalone/bk-input-tags.js +224 -0
- package/dist/standalone/bk-input-text.js +1 -1
- package/dist/standalone/bk-input-time-zone.js +1 -1
- package/dist/standalone/bk-input-time.js +29 -28
- package/dist/standalone/bk-item-group.js +3 -3
- package/dist/standalone/bk-item.js +12 -11
- package/dist/standalone/bk-kbd-shortcuts.js +4 -3
- package/dist/standalone/bk-kbd.js +68 -1
- package/dist/standalone/bk-lightbox.js +24 -7
- package/dist/standalone/bk-lines.js +1 -1
- package/dist/standalone/bk-link.js +33 -19
- package/dist/standalone/bk-listbox-columns.js +8 -8
- package/dist/standalone/bk-listbox-item.js +1 -1
- package/dist/standalone/bk-listbox-search.js +7 -7
- package/dist/standalone/bk-listbox-transfer.js +6 -6
- package/dist/standalone/bk-listbox.js +7 -7
- package/dist/standalone/bk-logo-wall.js +2 -2
- package/dist/standalone/bk-logo.js +4 -4
- package/dist/standalone/bk-menu-bar.js +3 -3
- package/dist/standalone/bk-menu-context.js +1 -1
- package/dist/standalone/bk-menu-divider.js +2 -2
- package/dist/standalone/bk-menu-item.js +73 -29
- package/dist/standalone/bk-menu-label.js +7 -6
- package/dist/standalone/bk-menu-list.js +10 -4
- package/dist/standalone/bk-menu.js +19 -10
- package/dist/standalone/bk-message-approval.js +4 -4
- package/dist/standalone/bk-message-branches.js +3 -3
- package/dist/standalone/bk-message-citation.js +10 -10
- package/dist/standalone/bk-message-feedback.js +10 -6
- package/dist/standalone/bk-message-list.js +6 -5
- package/dist/standalone/bk-message-reasoning.js +5 -5
- package/dist/standalone/bk-message-source.js +13 -21
- package/dist/standalone/bk-message-tool-group.js +5 -5
- package/dist/standalone/bk-message-tool.js +5 -5
- package/dist/standalone/bk-message.js +6 -4
- package/dist/standalone/bk-meter.js +3 -3
- package/dist/standalone/bk-model-viewer.js +1 -1
- package/dist/standalone/bk-nav-divider.js +2 -2
- package/dist/standalone/bk-nav-group.js +9 -9
- package/dist/standalone/bk-nav-item.js +31 -23
- package/dist/standalone/bk-nav-toc.js +3 -3
- package/dist/standalone/bk-nav.js +3 -3
- package/dist/standalone/bk-overflow.js +3 -3
- package/dist/standalone/bk-page-cta.js +13 -4
- package/dist/standalone/bk-page-footer-column.js +2 -2
- package/dist/standalone/bk-page-footer.js +3 -3
- package/dist/standalone/bk-page-header.js +3 -3
- package/dist/standalone/bk-page-hero.js +3 -3
- package/dist/standalone/bk-page-pager.js +5 -5
- package/dist/standalone/bk-page-section.js +6 -6
- package/dist/standalone/bk-pagination.js +6 -6
- package/dist/standalone/bk-pane.js +10 -9
- package/dist/standalone/bk-panel.js +9 -10
- package/dist/standalone/bk-period-nav.js +4 -4
- package/dist/standalone/bk-picture.js +1 -166
- package/dist/standalone/bk-popover-help.js +3 -3
- package/dist/standalone/bk-popover.js +2 -2
- package/dist/standalone/bk-presence-cursor.js +3 -3
- package/dist/standalone/bk-preview.js +4 -4
- package/dist/standalone/bk-progress.js +3 -3
- package/dist/standalone/bk-prose.js +3 -3
- package/dist/standalone/bk-qr-code.js +1 -1
- package/dist/standalone/bk-radio-group.js +7 -7
- package/dist/standalone/bk-radio.js +3 -3
- package/dist/standalone/bk-rating.js +5 -5
- package/dist/standalone/bk-scroll.js +3 -3
- package/dist/standalone/bk-segmented-item.js +40 -16
- package/dist/standalone/bk-segmented.js +17 -15
- package/dist/standalone/bk-select-cascade.js +3 -3
- package/dist/standalone/bk-select-tree.js +4 -4
- package/dist/standalone/bk-select.js +5 -5
- package/dist/standalone/bk-shell-app.js +1 -1221
- package/dist/standalone/bk-shell-centered.js +2 -2
- package/dist/standalone/bk-shell-sites.js +5 -7
- package/dist/standalone/bk-skeleton.js +2 -2
- package/dist/standalone/bk-sortable.js +55 -60
- package/dist/standalone/bk-spinner.js +2 -2
- package/dist/standalone/bk-split-grid.js +324 -44
- package/dist/standalone/bk-split.js +8 -8
- package/dist/standalone/bk-stack.js +1 -1
- package/dist/standalone/bk-stat-group.js +8 -7
- package/dist/standalone/bk-stat.js +12 -9
- package/dist/standalone/bk-status-dot.js +3 -3
- package/dist/standalone/bk-steps-item.js +5 -5
- package/dist/standalone/bk-steps.js +8 -7
- package/dist/standalone/bk-surface.js +1 -1
- package/dist/standalone/bk-swatch-group.js +8 -8
- package/dist/standalone/bk-swatch-palette.js +1 -1
- package/dist/standalone/bk-swatch.js +2 -2
- package/dist/standalone/bk-switch.js +4 -4
- package/dist/standalone/bk-table.js +1 -1937
- package/dist/standalone/bk-tabs-item.js +58 -35
- package/dist/standalone/bk-tabs-panel.js +7 -3
- package/dist/standalone/bk-tabs.js +3 -352
- package/dist/standalone/bk-tasks-item.js +4 -4
- package/dist/standalone/bk-tasks.js +2 -2
- package/dist/standalone/bk-testimonial.js +3 -3
- package/dist/standalone/bk-text.js +21 -20
- package/dist/standalone/bk-time-countdown.js +4 -4
- package/dist/standalone/bk-time-relative.js +3 -3
- package/dist/standalone/bk-timeline-item.js +4 -4
- package/dist/standalone/bk-timeline.js +2 -2
- package/dist/standalone/bk-toast-group.js +1 -1
- package/dist/standalone/bk-toast.js +4 -4
- package/dist/standalone/bk-toolbar.js +2 -2
- package/dist/standalone/bk-tooltip.js +8 -7
- package/dist/standalone/bk-tree-item.js +6 -6
- package/dist/standalone/bk-tree.js +5 -5
- package/dist/standalone/bk-video.js +6 -6
- package/dist/standalone/bk-visually-hidden.js +2 -2
- package/dist/standalone/bk-zoom.js +5 -5
- package/dist/standalone/chunks/announcer-6tMlCOq1.js +41 -0
- package/dist/standalone/chunks/{appearance-waHnV0kk.js → appearance-CBOJXbmC.js} +1 -1
- package/dist/standalone/chunks/{bk-alert-offline-B1bQxOZp.js → bk-alert-offline-hCLuG-RM.js} +3 -3
- package/dist/standalone/chunks/{bk-carousel-BCwIQhG5.js → bk-carousel-_dudBMVq.js} +4 -4
- package/dist/standalone/chunks/{bk-diagram-DWK8CvRZ.js → bk-diagram-BB2odomE.js} +5 -5
- package/dist/standalone/chunks/{bk-dialog-DX0cPJ1o.js → bk-dialog-DcvwnOtN.js} +59 -25
- package/dist/standalone/chunks/{bk-icon-DssFsNuB.js → bk-icon-D4kI4F18.js} +4 -3
- package/dist/standalone/chunks/{bk-image-editor-DXEj9gCu.js → bk-image-editor-SRVkHI-4.js} +5 -5
- package/dist/standalone/chunks/{bk-input-date-range-Cbx_lpf0.js → bk-input-date-range-C0Vd-p0T.js} +2 -2
- package/dist/standalone/chunks/{bk-input-rich-ZB68vziu.js → bk-input-rich-AmDv87E5.js} +6 -6
- package/dist/standalone/chunks/{bk-input-text-DD32uWNO.js → bk-input-text-2n89GDIT.js} +73 -54
- package/dist/standalone/chunks/{bk-model-viewer-Dr81ahVv.js → bk-model-viewer-BoNYBd6W.js} +4 -4
- package/dist/standalone/chunks/bk-picture-CA5gLxgZ.js +186 -0
- package/dist/standalone/chunks/{bk-qr-code-QaYvZwOR.js → bk-qr-code-CSFfc8As.js} +3 -3
- package/dist/standalone/chunks/bk-shell-app-BlCOG25y.js +1236 -0
- package/dist/standalone/chunks/{bk-surface-DkIhrWMt.js → bk-surface-BULRdKam.js} +9 -7
- package/dist/standalone/chunks/{bk-swatch-palette-BNNXTP3w.js → bk-swatch-palette-Cqj85tSW.js} +6 -6
- package/dist/standalone/chunks/bk-table-DWlD7yoM.js +1945 -0
- package/dist/standalone/chunks/bk-tabs-STkr3-E1.js +422 -0
- package/dist/standalone/chunks/{bk-toast-group-BSeO_rPs.js → bk-toast-group-5nZg7BaJ.js} +27 -24
- package/dist/standalone/chunks/{brush-Bn3lPdHN.js → brush-DALmXSru.js} +18 -2
- package/dist/standalone/chunks/{busy-B7Mxemwm.js → busy-eG3uHonz.js} +5 -4
- package/dist/standalone/chunks/{chart-tokens-D1Exf7BW.js → chart-tokens-DQ4hVSmn.js} +2 -2
- package/dist/standalone/chunks/{choice-field-CGvE4tyb.js → choice-field-B0oe_9fI.js} +6 -6
- package/dist/standalone/chunks/{choice-item-B6-9ZRlf.js → choice-item-Cx-nm1js.js} +17 -8
- package/dist/standalone/chunks/{clipboard-Crzt1Sh9.js → clipboard-RqIeP9Uz.js} +1 -1
- package/dist/standalone/chunks/{clipboard-BKlrP5rj.js → clipboard-UVLSkL4C.js} +1 -1
- package/dist/standalone/chunks/{crop-frame-poLCGrBG.js → crop-frame-Z9N0QML4.js} +1 -11
- package/dist/standalone/chunks/{date-field-BlI6grfT.js → date-field-Dy1_qxNv.js} +48 -47
- package/dist/standalone/chunks/define-6OfuRn5c.js +60 -0
- package/dist/standalone/chunks/drag-DT4__0t9.js +12 -0
- package/dist/standalone/chunks/footnotes-BeisMxLk.js +94 -0
- package/dist/standalone/chunks/{form-control-CyXQIJ2x.js → form-control-Bmk0SRDX.js} +2 -2
- package/dist/standalone/chunks/{frame-abXBnl8a.js → frame-xIMVEUCi.js} +5 -4
- package/dist/standalone/chunks/{handle-menu-ZVR_msk2.js → handle-menu-BAe9fPYJ.js} +14 -33
- package/dist/standalone/chunks/{heading-text-CV5gBf7k.js → heading-text-B2kF-b8p.js} +1 -1
- package/dist/standalone/chunks/hue-vLbNdAEl.js +20 -0
- package/dist/standalone/chunks/{i18n-B6Al9xCK.js → i18n-DFfGgd3d.js} +49 -34
- package/dist/standalone/chunks/{i18n-BI16HQmm.js → i18n-DQAcbHkY.js} +1 -1
- package/dist/standalone/chunks/late-CPQ_RbU-.js +30 -0
- package/dist/standalone/chunks/link--YWr8exL.js +69 -0
- package/dist/standalone/chunks/{marks-0kbeB4n8.js → marks-pOUDNUf1.js} +2 -2
- package/dist/standalone/chunks/{options-DMEc8rQt.js → options-ySaDL-dW.js} +2 -2
- package/dist/standalone/chunks/own-text-mpZVnMyX.js +5 -0
- package/dist/standalone/chunks/{palettes-CKLHSIPx.js → palettes-J4bQ21ks.js} +2 -2
- package/dist/standalone/chunks/{popover-base-ac49G87f.js → popover-base-hxo-Vh6E.js} +2 -2
- package/dist/standalone/chunks/{prose-BG4oQH-i.js → prose-BiuJgiah.js} +1 -1
- package/dist/standalone/chunks/{ramp-ggoyjMvC.js → ramp-CGDOcqBZ.js} +1 -1
- package/dist/standalone/chunks/save-as-DBGZjczB.js +6 -0
- package/dist/standalone/chunks/shortcuts-DPxCSO4M.js +210 -0
- package/dist/standalone/chunks/{slider-BWT8Fmwz.js → slider-jp3d-Ld-.js} +15 -14
- package/dist/standalone/chunks/{stars-BN9M_9Q1.js → stars-BAUc_LqI.js} +1 -1
- package/dist/standalone/chunks/{styles-DwSR-9a3.js → styles-CaeyhYDA.js} +3 -0
- package/dist/standalone/chunks/submit-BjBGB8OW.js +42 -0
- package/dist/standalone/chunks/{summary-BK-B4m5A.js → summary-W5s0TFqV.js} +1 -1
- package/dist/standalone/chunks/tags-CMLAGsVw.js +37 -0
- package/dist/standalone/chunks/{text-field-4IUUpRHE.js → text-field-CufOGdfr.js} +17 -11
- package/dist/standalone/chunks/{toggle-control-ioV2jhNY.js → toggle-control-Cgqp1jhf.js} +5 -3
- package/dist/standalone/chunks/{tokens-BuahF1lF.js → tokens-C_ul7pL9.js} +4 -3
- package/dist/standalone/chunks/{virtual-B-1oN14Y.js → virtual-D-qgACnE.js} +1 -1
- package/dist/standalone/confirm.js +27 -14
- package/dist/standalone/i18n-de.js +13 -2
- package/dist/standalone/icons.js +100 -98
- package/dist/standalone/links.js +1 -1
- package/dist/standalone/reset.css +10 -0
- package/dist/standalone/toast.js +1 -1
- package/dist/standalone/tokens.css +6 -5
- package/dist/tokens.css +6 -5
- package/dist/tokens.js +4 -3
- package/package.json +25 -2
- package/dist/standalone/chunks/announcer-haFcvqbe.js +0 -25
- package/dist/standalone/chunks/bk-kbd-B_TlKzWj.js +0 -275
- package/dist/standalone/chunks/define-CzVPD4Zi.js +0 -30
- package/dist/standalone/chunks/hue-Jvb-141g.js +0 -14
- package/dist/standalone/chunks/keyed-CZ2AaouM.js +0 -16
- package/dist/standalone/chunks/link-CWSMsx04.js +0 -60
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, css, html, isServer, nothing } from "lit";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
3
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4
4
|
import { define } from "../internal/define.js";
|
|
5
5
|
import { LocalizeController } from "../i18n.js";
|
|
6
6
|
import { emit, emitDetail } from "../internal/events.js";
|
|
@@ -9,6 +9,8 @@ import "./bk-icon.js";
|
|
|
9
9
|
import "./bk-button.js";
|
|
10
10
|
import "./bk-spinner.js";
|
|
11
11
|
import { revealInside } from "../internal/scroll.js";
|
|
12
|
+
import { LoadingController } from "../internal/loading.js";
|
|
13
|
+
import { setHostVars } from "../internal/host-vars.js";
|
|
12
14
|
import { resizeObserver } from "../internal/server.js";
|
|
13
15
|
import { PanZoom, capture } from "../internal/pan-zoom.js";
|
|
14
16
|
import "../icons/set/actual-size.js";
|
|
@@ -29,6 +31,8 @@ const DOUBLE_TAP_ZOOM = 2.5;
|
|
|
29
31
|
const SWIPE_DISTANCE = 48;
|
|
30
32
|
const TAP_SLOP = 8;
|
|
31
33
|
const DOUBLE_TAP_MS = 300;
|
|
34
|
+
const CLICK_STEPS = [2, 4];
|
|
35
|
+
const OWN_KEYS = "input, textarea, select, [contenteditable]:not([contenteditable=false]), [role~=textbox], [role~=searchbox], [role~=combobox], [role~=spinbutton], [role~=slider], [role~=listbox], [role~=menu], [role~=menubar], [role~=radiogroup], [role~=tablist], [role~=tree], [role~=grid], [role~=treegrid]";
|
|
32
36
|
const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
33
37
|
class BkImageViewer extends LitElement {
|
|
34
38
|
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
@@ -36,6 +40,12 @@ class BkImageViewer extends LitElement {
|
|
|
36
40
|
items: { attribute: false },
|
|
37
41
|
index: { type: Number },
|
|
38
42
|
filmstrip: { type: Boolean, reflect: true },
|
|
43
|
+
loop: { type: Boolean, reflect: true },
|
|
44
|
+
immersive: { type: Boolean, reflect: true },
|
|
45
|
+
shaped: { type: Boolean, reflect: true },
|
|
46
|
+
pageable: { type: Boolean, reflect: true },
|
|
47
|
+
first: { type: Boolean, reflect: true },
|
|
48
|
+
last: { type: Boolean, reflect: true },
|
|
39
49
|
label: {},
|
|
40
50
|
prevLabel: { attribute: "prev-label" },
|
|
41
51
|
nextLabel: { attribute: "next-label" },
|
|
@@ -48,7 +58,9 @@ class BkImageViewer extends LitElement {
|
|
|
48
58
|
loading: { state: true },
|
|
49
59
|
failed: { state: true },
|
|
50
60
|
zoomed: { state: true },
|
|
51
|
-
ratio: { state: true }
|
|
61
|
+
ratio: { state: true },
|
|
62
|
+
thumbRatio: { state: true },
|
|
63
|
+
naturalSize: { state: true }
|
|
52
64
|
};
|
|
53
65
|
// Zoom and pan live outside Lit's update cycle: gestures write one transform per frame.
|
|
54
66
|
pz = new PanZoom(this, {
|
|
@@ -56,8 +68,17 @@ class BkImageViewer extends LitElement {
|
|
|
56
68
|
min: () => Math.min(1, this.actualScale),
|
|
57
69
|
max: () => Math.max(MAX_SCALE, this.actualScale * MAX_PIXEL_ZOOM),
|
|
58
70
|
content: () => this.box.w && this.box.h ? { w: this.fit.w / this.box.w, h: this.fit.h / this.box.h } : { w: 1, h: 1 },
|
|
59
|
-
onChange: () =>
|
|
71
|
+
onChange: () => this.onViewChange()
|
|
60
72
|
});
|
|
73
|
+
/** While true, a change of the view is not a change of the user: no `viewchange`. */
|
|
74
|
+
quiet = false;
|
|
75
|
+
viewChanged = false;
|
|
76
|
+
/** A view that the app set before the image had its shape. The viewer applies it again when the shape is known. */
|
|
77
|
+
pendingView = null;
|
|
78
|
+
/** The image of the last `load` event (index and URL). */
|
|
79
|
+
loadedKey = "";
|
|
80
|
+
/** The surrounding dialog whose keys the viewer handles (`immersive`). */
|
|
81
|
+
keyScope = null;
|
|
61
82
|
swipeX = 0;
|
|
62
83
|
smooth = false;
|
|
63
84
|
raf = 0;
|
|
@@ -74,6 +95,10 @@ class BkImageViewer extends LitElement {
|
|
|
74
95
|
lastTap = { t: 0, x: 0, y: 0 };
|
|
75
96
|
preloaded = /* @__PURE__ */ new Set();
|
|
76
97
|
observed = null;
|
|
98
|
+
/** The picture in the frame, and the last picture while it loads. */
|
|
99
|
+
shot = null;
|
|
100
|
+
previousShot = null;
|
|
101
|
+
loader = new LoadingController(this);
|
|
77
102
|
resizer = resizeObserver(() => {
|
|
78
103
|
this.measure();
|
|
79
104
|
this.clampPan();
|
|
@@ -85,6 +110,12 @@ class BkImageViewer extends LitElement {
|
|
|
85
110
|
this.items = [];
|
|
86
111
|
this.index = 0;
|
|
87
112
|
this.filmstrip = false;
|
|
113
|
+
this.loop = false;
|
|
114
|
+
this.immersive = false;
|
|
115
|
+
this.shaped = false;
|
|
116
|
+
this.pageable = false;
|
|
117
|
+
this.first = false;
|
|
118
|
+
this.last = false;
|
|
88
119
|
this.label = "";
|
|
89
120
|
this.prevLabel = "";
|
|
90
121
|
this.nextLabel = "";
|
|
@@ -98,10 +129,14 @@ class BkImageViewer extends LitElement {
|
|
|
98
129
|
this.failed = false;
|
|
99
130
|
this.zoomed = false;
|
|
100
131
|
this.ratio = 0;
|
|
132
|
+
this.thumbRatio = 0;
|
|
133
|
+
this.naturalSize = 0;
|
|
101
134
|
}
|
|
102
135
|
static styles = [base, srOnly, css`
|
|
103
|
-
:host { display: block; height: 100%; min-height: 0; }
|
|
136
|
+
:host { display: block; height: 100%; min-height: 0; max-block-size: var(--bk-image-viewer-max-height, none); }
|
|
104
137
|
.viewer {
|
|
138
|
+
/* Without a height of the host, the sizer gives the height; a maximum height of the host caps it. */
|
|
139
|
+
max-block-size: inherit;
|
|
105
140
|
color-scheme: var(--bk-image-viewer-color-scheme, dark);
|
|
106
141
|
--_bk-image-viewer-pad: var(--bk-image-viewer-padding, var(--bk-space-3));
|
|
107
142
|
--_bk-image-viewer-control: var(--bk-image-viewer-control-size, var(--bk-control-lg));
|
|
@@ -117,6 +152,25 @@ class BkImageViewer extends LitElement {
|
|
|
117
152
|
.viewer:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
118
153
|
.empty { height: 100%; background: var(--bk-image-viewer-bg, var(--bk-media-backdrop)); }
|
|
119
154
|
|
|
155
|
+
/* shaped: the box takes the shape of the image. The width follows the ratio under the cap, never wider than
|
|
156
|
+
the container and never wider than the natural image. The height comes from the ratio. */
|
|
157
|
+
:host([shaped]) {
|
|
158
|
+
height: auto; max-block-size: none;
|
|
159
|
+
inline-size: min(100%, var(--_bk-image-viewer-natural, 100%), calc(var(--bk-image-viewer-max-height, calc(infinity * 1px)) * var(--_bk-image-viewer-ratio, 4 / 3)));
|
|
160
|
+
}
|
|
161
|
+
:host([shaped]) .viewer { height: auto; grid-template-rows: auto auto; container-type: inline-size; }
|
|
162
|
+
:host([shaped]) .empty { height: auto; aspect-ratio: 4 / 3; }
|
|
163
|
+
:host([shaped]) .main { aspect-ratio: var(--_bk-image-viewer-ratio, 4 / 3); }
|
|
164
|
+
:host([shaped]) .sizer { display: none; }
|
|
165
|
+
:host([shaped]) .frame { inset: 0; }
|
|
166
|
+
/* The toolbar lies over the top of the image. Only its controls take the pointer. */
|
|
167
|
+
:host([shaped]) .bar { position: absolute; z-index: 4; inset-block-start: 0; inset-inline: 0; pointer-events: none; }
|
|
168
|
+
:host([shaped]) :is(.tools, .actions) { pointer-events: auto; }
|
|
169
|
+
:host([shaped]) .counter:not(:empty) {
|
|
170
|
+
display: inline-flex; align-items: center; min-block-size: var(--_bk-image-viewer-control);
|
|
171
|
+
border-radius: var(--_bk-image-viewer-control-radius); background: var(--_bk-image-viewer-control-bg); backdrop-filter: var(--bk-glass);
|
|
172
|
+
}
|
|
173
|
+
|
|
120
174
|
.control {
|
|
121
175
|
--bk-button-ghost-bg: var(--_bk-image-viewer-control-bg);
|
|
122
176
|
--bk-button-neutral-text: var(--bk-image-viewer-control-fg, var(--_bk-image-viewer-fg));
|
|
@@ -154,7 +208,13 @@ class BkImageViewer extends LitElement {
|
|
|
154
208
|
}
|
|
155
209
|
|
|
156
210
|
.main { position: relative; min-height: 0; }
|
|
211
|
+
/* Without a height, the viewer is as high as the image at the width of the frame (the shape of the image, else of the thumbnail). */
|
|
212
|
+
.sizer {
|
|
213
|
+
visibility: hidden; pointer-events: none; aspect-ratio: var(--_bk-image-viewer-ratio, 4 / 3);
|
|
214
|
+
margin-inline: calc(var(--_bk-image-viewer-control) + 2 * var(--_bk-image-viewer-pad)); max-block-size: 100%;
|
|
215
|
+
}
|
|
157
216
|
.stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
|
|
217
|
+
.stage.steps { cursor: zoom-in; }
|
|
158
218
|
.stage.zoomed { cursor: grab; }
|
|
159
219
|
.stage.zoomed:active { cursor: grabbing; }
|
|
160
220
|
.frame { position: absolute; inset: 0 calc(var(--_bk-image-viewer-control) + 2 * var(--_bk-image-viewer-pad)); transform-origin: 50% 50%; container-type: size; }
|
|
@@ -172,13 +232,17 @@ class BkImageViewer extends LitElement {
|
|
|
172
232
|
width: min(100cqw, 100cqh * var(--_bk-image-viewer-ratio)); height: min(100cqh, 100cqw / var(--_bk-image-viewer-ratio));
|
|
173
233
|
}
|
|
174
234
|
.image.loaded ~ .placeholder { visibility: hidden; transition: visibility 0s var(--bk-duration); }
|
|
235
|
+
/* The last image stays in view while the next one loads; the next one fades in over it. */
|
|
236
|
+
.previous { z-index: 0; }
|
|
237
|
+
.previous.gone { visibility: hidden; transition: visibility 0s var(--bk-duration); }
|
|
238
|
+
.frame.swap .placeholder { visibility: hidden; }
|
|
239
|
+
/* The LoadingController shows it only if loading takes longer than --bk-loading-delay. */
|
|
175
240
|
.spinner {
|
|
176
241
|
position: absolute; inset: 0; margin: auto; z-index: 2; width: fit-content; height: fit-content; display: flex;
|
|
177
242
|
padding: var(--bk-space-2); border-radius: var(--bk-radius-full); background: var(--_bk-image-viewer-control-bg); color: var(--_bk-image-viewer-fg);
|
|
178
|
-
|
|
179
|
-
opacity: 0; animation: bk-image-viewer-appear var(--bk-duration) var(--bk-ease) 250ms forwards;
|
|
243
|
+
animation: bk-image-viewer-appear var(--bk-duration) var(--bk-ease);
|
|
180
244
|
}
|
|
181
|
-
@keyframes bk-image-viewer-appear {
|
|
245
|
+
@keyframes bk-image-viewer-appear { from { opacity: 0; } }
|
|
182
246
|
.error {
|
|
183
247
|
position: absolute; inset: 0; margin: auto; z-index: 2; width: fit-content; height: fit-content;
|
|
184
248
|
display: flex; align-items: center; gap: var(--bk-space-2); font-size: var(--bk-type-body);
|
|
@@ -226,11 +290,16 @@ class BkImageViewer extends LitElement {
|
|
|
226
290
|
|
|
227
291
|
@media (max-width: 640px) {
|
|
228
292
|
.frame { inset: 0; }
|
|
293
|
+
.sizer { margin-inline: 0; }
|
|
229
294
|
}
|
|
230
295
|
@media (max-width: 480px) {
|
|
231
296
|
.level, .fit, .actual { display: none; }
|
|
232
297
|
}
|
|
233
|
-
|
|
298
|
+
/* A shaped box can be narrow on a wide screen: its own width counts. */
|
|
299
|
+
@container (max-width: 480px) {
|
|
300
|
+
:host([shaped]) :is(.level, .fit, .actual) { display: none; }
|
|
301
|
+
}
|
|
302
|
+
@media (prefers-reduced-motion: reduce) { .frame.animate, .image, .previous.gone { transition: none; } .spinner { animation: none; } }
|
|
234
303
|
@media (forced-colors: active) {
|
|
235
304
|
.viewer { background: Canvas; color: CanvasText; }
|
|
236
305
|
.spinner { background: Canvas; }
|
|
@@ -252,21 +321,49 @@ class BkImageViewer extends LitElement {
|
|
|
252
321
|
else
|
|
253
322
|
void this.updateComplete.then(() => this.renderRoot.querySelector(".viewer")?.focus(options));
|
|
254
323
|
}
|
|
255
|
-
/** Moves to the previous image
|
|
324
|
+
/** Moves to the previous image. It wraps around with `loop`, else it stops at the first image. */
|
|
256
325
|
previous() {
|
|
257
326
|
this.go(this.index - 1);
|
|
258
327
|
}
|
|
259
|
-
/** Moves to the next image
|
|
328
|
+
/** Moves to the next image. It wraps around with `loop`, else it stops at the last image. */
|
|
260
329
|
next() {
|
|
261
330
|
this.go(this.index + 1);
|
|
262
331
|
}
|
|
263
|
-
/** Returns to the fitted size. */
|
|
332
|
+
/** Returns to the fitted size. It fires no `viewchange`. */
|
|
264
333
|
resetZoom() {
|
|
334
|
+
this.silently(() => this.zoomFit());
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* The zoom and the visible part of the image (`ImageViewerView`). Set it to show the same part as another
|
|
338
|
+
* viewer, for example in `viewchange` of that viewer. Setting it fires no `viewchange`. A view that you set
|
|
339
|
+
* before the image has its shape applies again when the shape is known.
|
|
340
|
+
*/
|
|
341
|
+
get view() {
|
|
342
|
+
const { zoom, x, y } = this.pz.get();
|
|
343
|
+
const { kx, ky } = this.pictureScale();
|
|
344
|
+
return { zoom, x: 0.5 + (x - 0.5) * kx, y: 0.5 + (y - 0.5) * ky };
|
|
345
|
+
}
|
|
346
|
+
set view(v) {
|
|
347
|
+
this.pendingView = { ...this.view, ...v };
|
|
348
|
+
this.applyPendingView();
|
|
349
|
+
}
|
|
350
|
+
/** The width of the shown image in image pixels, as `naturalWidth` of an `<img>`. It is 0 while unknown. */
|
|
351
|
+
get naturalWidth() {
|
|
352
|
+
return this.failed ? 0 : this.image?.naturalWidth ?? 0;
|
|
353
|
+
}
|
|
354
|
+
/** The height of the shown image in image pixels, as `naturalHeight` of an `<img>`. It is 0 while unknown. */
|
|
355
|
+
get naturalHeight() {
|
|
356
|
+
return this.failed ? 0 : this.image?.naturalHeight ?? 0;
|
|
357
|
+
}
|
|
358
|
+
/** Shows the image at its actual size: one image pixel per screen pixel. It fires no `viewchange`. */
|
|
359
|
+
actualSize() {
|
|
360
|
+
this.silently(() => this.zoomActual());
|
|
361
|
+
}
|
|
362
|
+
zoomFit() {
|
|
265
363
|
this.pz.set({ zoom: 1, x: 0.5, y: 0.5 });
|
|
266
364
|
this.apply(true);
|
|
267
365
|
}
|
|
268
|
-
|
|
269
|
-
actualSize() {
|
|
366
|
+
zoomActual() {
|
|
270
367
|
if (!this.box.w)
|
|
271
368
|
this.measure();
|
|
272
369
|
this.zoomTo(this.actualScale);
|
|
@@ -279,8 +376,14 @@ class BkImageViewer extends LitElement {
|
|
|
279
376
|
get actualScale() {
|
|
280
377
|
return this.natural.w && this.fit.w ? this.natural.w / this.fit.w : 1;
|
|
281
378
|
}
|
|
379
|
+
connectedCallback() {
|
|
380
|
+
super.connectedCallback();
|
|
381
|
+
if (this.hasUpdated)
|
|
382
|
+
this.bindKeyScope();
|
|
383
|
+
}
|
|
282
384
|
disconnectedCallback() {
|
|
283
385
|
super.disconnectedCallback();
|
|
386
|
+
this.unbindKeyScope();
|
|
284
387
|
this.resizer.disconnect();
|
|
285
388
|
this.observed = null;
|
|
286
389
|
this.pointers.clear();
|
|
@@ -292,24 +395,47 @@ class BkImageViewer extends LitElement {
|
|
|
292
395
|
willUpdate(changed) {
|
|
293
396
|
const n = this.items.length;
|
|
294
397
|
this.index = clamp(Math.trunc(this.index) || 0, 0, Math.max(0, n - 1));
|
|
398
|
+
const active = this.hasUpdated && this.renderRoot instanceof ShadowRoot ? this.renderRoot.activeElement : null;
|
|
399
|
+
if (active && (active.matches(".prev") && !this.canStep(-1) || active.matches(".next") && !this.canStep(1)))
|
|
400
|
+
this.focus();
|
|
295
401
|
if (changed.has("index") || changed.has("items")) {
|
|
402
|
+
const item = this.items[this.index];
|
|
403
|
+
const shot = item ? { key: `${this.index}|${item.full || item.src}`, src: item.full || item.src, thumb: item.src, alt: item.alt } : null;
|
|
404
|
+
if (!shot)
|
|
405
|
+
this.previousShot = null;
|
|
406
|
+
else if (this.shot && this.shot.key !== shot.key) {
|
|
407
|
+
if (this.failed)
|
|
408
|
+
this.previousShot = null;
|
|
409
|
+
else if (!this.loading)
|
|
410
|
+
this.previousShot = this.shot;
|
|
411
|
+
}
|
|
412
|
+
if (this.previousShot?.key === shot?.key)
|
|
413
|
+
this.previousShot = null;
|
|
414
|
+
this.shot = shot;
|
|
296
415
|
this.loading = n > 0;
|
|
297
416
|
this.failed = false;
|
|
298
417
|
this.swipeX = 0;
|
|
299
|
-
this.pz.set({ zoom: 1, x: 0.5, y: 0.5 });
|
|
418
|
+
this.silently(() => this.pz.set({ zoom: 1, x: 0.5, y: 0.5 }));
|
|
300
419
|
this.zoomed = false;
|
|
301
420
|
this.natural = { w: 0, h: 0 };
|
|
302
|
-
const item = this.items[this.index];
|
|
303
421
|
this.ratio = item?.width && item.height ? item.width / item.height : 0;
|
|
422
|
+
this.naturalSize = item?.width && item.height ? item.width : 0;
|
|
423
|
+
this.thumbRatio = 0;
|
|
304
424
|
if (item && !isServer) {
|
|
305
425
|
const probe = new Image();
|
|
306
426
|
probe.src = item.full || item.src;
|
|
307
427
|
if (probe.complete && probe.naturalWidth && probe.naturalHeight) {
|
|
308
428
|
this.loading = false;
|
|
309
429
|
this.ratio = probe.naturalWidth / probe.naturalHeight;
|
|
430
|
+
this.naturalSize = probe.naturalWidth;
|
|
310
431
|
}
|
|
311
432
|
}
|
|
312
433
|
}
|
|
434
|
+
this.loader.set(this.loading);
|
|
435
|
+
setHostVars(this, {
|
|
436
|
+
"--_bk-image-viewer-ratio": String(this.ratio || this.thumbRatio || ""),
|
|
437
|
+
"--_bk-image-viewer-natural": this.naturalSize && this.ratio ? `${this.naturalSize}px` : ""
|
|
438
|
+
});
|
|
313
439
|
}
|
|
314
440
|
updated(changed) {
|
|
315
441
|
const frame = this.frame;
|
|
@@ -319,6 +445,8 @@ class BkImageViewer extends LitElement {
|
|
|
319
445
|
this.resizer.observe(frame);
|
|
320
446
|
this.observed = frame;
|
|
321
447
|
}
|
|
448
|
+
if (changed.has("immersive"))
|
|
449
|
+
this.bindKeyScope();
|
|
322
450
|
if (changed.has("index") || changed.has("items")) {
|
|
323
451
|
const img = this.image;
|
|
324
452
|
if (img?.complete && img.naturalWidth) {
|
|
@@ -332,8 +460,73 @@ class BkImageViewer extends LitElement {
|
|
|
332
460
|
this.watchSize();
|
|
333
461
|
this.preloadNeighbours();
|
|
334
462
|
revealInside(this.renderRoot.querySelector('.thumb[aria-current="true"]'), this);
|
|
463
|
+
this.applyPendingView();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/** Runs `fn` without a `viewchange`: a change that the app or the viewer makes, not the user. */
|
|
467
|
+
silently(fn) {
|
|
468
|
+
const was = this.quiet;
|
|
469
|
+
this.quiet = true;
|
|
470
|
+
try {
|
|
471
|
+
fn();
|
|
472
|
+
} finally {
|
|
473
|
+
this.quiet = was;
|
|
335
474
|
}
|
|
336
475
|
}
|
|
476
|
+
onViewChange() {
|
|
477
|
+
if (this.quiet)
|
|
478
|
+
return;
|
|
479
|
+
this.pendingView = null;
|
|
480
|
+
this.viewChanged = true;
|
|
481
|
+
}
|
|
482
|
+
/** The factors from fractions of the frame to fractions of the fitted image. */
|
|
483
|
+
pictureScale() {
|
|
484
|
+
return { kx: this.fit.w ? this.box.w / this.fit.w : 1, ky: this.fit.h ? this.box.h / this.fit.h : 1 };
|
|
485
|
+
}
|
|
486
|
+
applyPendingView() {
|
|
487
|
+
const v = this.pendingView;
|
|
488
|
+
if (!v || !this.hasUpdated || this.isUpdatePending || !this.frame)
|
|
489
|
+
return;
|
|
490
|
+
this.measure();
|
|
491
|
+
const { kx, ky } = this.pictureScale();
|
|
492
|
+
this.silently(() => this.pz.set({ zoom: v.zoom, x: 0.5 + (v.x - 0.5) / kx, y: 0.5 + (v.y - 0.5) / ky }));
|
|
493
|
+
this.apply(false);
|
|
494
|
+
if (this.ratio)
|
|
495
|
+
this.pendingView = null;
|
|
496
|
+
}
|
|
497
|
+
// ---- the keys of a surrounding dialog (`immersive`) ----
|
|
498
|
+
bindKeyScope() {
|
|
499
|
+
this.unbindKeyScope();
|
|
500
|
+
if (!this.immersive || !this.isConnected)
|
|
501
|
+
return;
|
|
502
|
+
for (let el = this; el; el = el.parentElement ?? (el.getRootNode().host ?? null)) {
|
|
503
|
+
if (el !== this && (el.localName === "dialog" || el.localName === "bk-dialog" || el.getAttribute("role") === "dialog")) {
|
|
504
|
+
this.keyScope = el;
|
|
505
|
+
el.addEventListener("keydown", this.onScopeKey);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
unbindKeyScope() {
|
|
511
|
+
this.keyScope?.removeEventListener("keydown", this.onScopeKey);
|
|
512
|
+
this.keyScope = null;
|
|
513
|
+
}
|
|
514
|
+
/** A key in the dialog outside the viewer. A field or a widget that uses the key itself keeps it. */
|
|
515
|
+
onScopeKey = (event) => {
|
|
516
|
+
const e = event;
|
|
517
|
+
if (e.defaultPrevented)
|
|
518
|
+
return;
|
|
519
|
+
const path = e.composedPath();
|
|
520
|
+
if (path.includes(this))
|
|
521
|
+
return;
|
|
522
|
+
for (const node of path) {
|
|
523
|
+
if (node === this.keyScope)
|
|
524
|
+
break;
|
|
525
|
+
if (node instanceof Element && (node.matches(OWN_KEYS) || node.isContentEditable))
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
this.onKey(e);
|
|
529
|
+
};
|
|
337
530
|
/**
|
|
338
531
|
* Reads the size of the full image as soon as the browser knows it (from the file header, long
|
|
339
532
|
* before the whole image has loaded), so the placeholder can use its shape.
|
|
@@ -347,8 +540,10 @@ class BkImageViewer extends LitElement {
|
|
|
347
540
|
return;
|
|
348
541
|
if (img.naturalWidth && img.naturalHeight) {
|
|
349
542
|
this.ratio = img.naturalWidth / img.naturalHeight;
|
|
543
|
+
this.naturalSize = img.naturalWidth;
|
|
350
544
|
this.measure();
|
|
351
545
|
this.apply(false);
|
|
546
|
+
this.applyPendingView();
|
|
352
547
|
return;
|
|
353
548
|
}
|
|
354
549
|
this.sizeWatch = requestAnimationFrame(check);
|
|
@@ -360,6 +555,8 @@ class BkImageViewer extends LitElement {
|
|
|
360
555
|
if (n < 2)
|
|
361
556
|
return;
|
|
362
557
|
for (const i of [this.index + 1, this.index - 1]) {
|
|
558
|
+
if (!this.loop && (i < 0 || i >= n))
|
|
559
|
+
continue;
|
|
363
560
|
const it = this.items[(i + n) % n];
|
|
364
561
|
const url = it.full || it.src;
|
|
365
562
|
if (this.preloaded.has(url))
|
|
@@ -371,15 +568,38 @@ class BkImageViewer extends LitElement {
|
|
|
371
568
|
}
|
|
372
569
|
}
|
|
373
570
|
// ---- navigation ----
|
|
571
|
+
/** Moves to image `i`. It wraps around with `loop`, else it stops at the ends. Returns false when the image stays. */
|
|
374
572
|
go(i) {
|
|
375
573
|
const n = this.items.length;
|
|
376
574
|
if (n < 2)
|
|
377
|
-
return;
|
|
378
|
-
const next = (i % n + n) % n;
|
|
575
|
+
return false;
|
|
576
|
+
const next = this.loop ? (i % n + n) % n : clamp(i, 0, n - 1);
|
|
379
577
|
if (next === this.index)
|
|
380
|
-
return;
|
|
578
|
+
return false;
|
|
381
579
|
this.index = next;
|
|
382
580
|
emitDetail(this, "change", { index: next });
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Where a step in direction `dir` goes: `own` to an item of the viewer, `app` to the list of the app (`pageable`),
|
|
585
|
+
* false when there is nothing in that direction.
|
|
586
|
+
*/
|
|
587
|
+
canStep(dir) {
|
|
588
|
+
const n = this.items.length;
|
|
589
|
+
if (n > 1 && (this.loop || (dir < 0 ? this.index > 0 : this.index < n - 1)))
|
|
590
|
+
return "own";
|
|
591
|
+
if (this.pageable && !(dir < 0 ? this.first : this.last))
|
|
592
|
+
return "app";
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
/** The previous (-1) or next (1) picture: an item of the viewer, else a `page` event for the list of the app. */
|
|
596
|
+
step(dir) {
|
|
597
|
+
const to = this.canStep(dir);
|
|
598
|
+
if (to === "own")
|
|
599
|
+
this.go(this.index + dir);
|
|
600
|
+
else if (to === "app")
|
|
601
|
+
emitDetail(this, "page", { direction: dir < 0 ? "previous" : "next" }, true);
|
|
602
|
+
return to;
|
|
383
603
|
}
|
|
384
604
|
/** How far a key or a pan button moves the image, in px. */
|
|
385
605
|
get panStep() {
|
|
@@ -394,15 +614,15 @@ class BkImageViewer extends LitElement {
|
|
|
394
614
|
ArrowRight: () => this.panBy(-pan, 0),
|
|
395
615
|
ArrowUp: () => this.panBy(0, pan),
|
|
396
616
|
ArrowDown: () => this.panBy(0, -pan)
|
|
397
|
-
} : { ArrowLeft: () => this.
|
|
617
|
+
} : { ArrowLeft: () => this.step(-1), ArrowRight: () => this.step(1) };
|
|
398
618
|
Object.assign(keys, {
|
|
399
619
|
Home: () => this.go(0),
|
|
400
620
|
End: () => this.go(this.items.length - 1),
|
|
401
621
|
"+": () => this.zoomTo(this.pz.zoom * ZOOM_STEP),
|
|
402
622
|
"=": () => this.zoomTo(this.pz.zoom * ZOOM_STEP),
|
|
403
623
|
"-": () => this.zoomTo(this.pz.zoom / ZOOM_STEP),
|
|
404
|
-
"0": () => this.
|
|
405
|
-
"1": () => this.
|
|
624
|
+
"0": () => this.zoomFit(),
|
|
625
|
+
"1": () => this.zoomActual()
|
|
406
626
|
});
|
|
407
627
|
const act = keys[e.key];
|
|
408
628
|
if (!act)
|
|
@@ -415,11 +635,10 @@ class BkImageViewer extends LitElement {
|
|
|
415
635
|
const f = this.frame;
|
|
416
636
|
if (!f)
|
|
417
637
|
return;
|
|
418
|
-
const r = f.getBoundingClientRect();
|
|
419
|
-
const
|
|
420
|
-
const w = r.width
|
|
421
|
-
|
|
422
|
-
this.box = { x: r.left + r.width / 2 - tx - this.swipeX, y: r.top + r.height / 2 - ty, w, h };
|
|
638
|
+
const r = (f.parentElement ?? f).getBoundingClientRect();
|
|
639
|
+
const inset = parseFloat(getComputedStyle(f).left) || 0;
|
|
640
|
+
const w = Math.max(0, r.width - 2 * inset), h = r.height;
|
|
641
|
+
this.box = { x: r.left + r.width / 2, y: r.top + r.height / 2, w, h };
|
|
423
642
|
const img = this.image;
|
|
424
643
|
if (img?.naturalWidth && img.naturalHeight) {
|
|
425
644
|
const k = Math.min(w / img.naturalWidth, h / img.naturalHeight);
|
|
@@ -459,6 +678,10 @@ class BkImageViewer extends LitElement {
|
|
|
459
678
|
const level = this.renderRoot.querySelector(".level");
|
|
460
679
|
if (level)
|
|
461
680
|
level.textContent = ratio ? this.formatPercent(ratio) : "";
|
|
681
|
+
if (this.viewChanged) {
|
|
682
|
+
this.viewChanged = false;
|
|
683
|
+
emitDetail(this, "viewchange", this.view);
|
|
684
|
+
}
|
|
462
685
|
});
|
|
463
686
|
}
|
|
464
687
|
formatPercent(ratio) {
|
|
@@ -470,7 +693,7 @@ class BkImageViewer extends LitElement {
|
|
|
470
693
|
}
|
|
471
694
|
/** Keeps the image in view after a change of the size of the frame or the image. */
|
|
472
695
|
clampPan() {
|
|
473
|
-
this.pz.set({});
|
|
696
|
+
this.silently(() => this.pz.set({}));
|
|
474
697
|
}
|
|
475
698
|
/** Zooms to `s`. The image point under (cx, cy) stays in place. The default point is the centre. */
|
|
476
699
|
zoomTo(s, cx = this.box.x, cy = this.box.y, animate = true) {
|
|
@@ -488,6 +711,8 @@ class BkImageViewer extends LitElement {
|
|
|
488
711
|
this.apply(true);
|
|
489
712
|
}
|
|
490
713
|
onWheel(e) {
|
|
714
|
+
if (!this.immersive && !this.zoomed && !e.ctrlKey && !e.metaKey)
|
|
715
|
+
return;
|
|
491
716
|
e.preventDefault();
|
|
492
717
|
const delta = e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;
|
|
493
718
|
this.zoomTo(this.pz.zoom * Math.exp(-delta * (e.ctrlKey ? 0.01 : 2e-3)), e.clientX, e.clientY, false);
|
|
@@ -533,7 +758,7 @@ class BkImageViewer extends LitElement {
|
|
|
533
758
|
if (this.zoomed) {
|
|
534
759
|
const z = this.pz.zoom;
|
|
535
760
|
this.pz.set({ x: this.drag.vx - dx / (this.box.w * z), y: this.drag.vy - dy / (this.box.h * z) });
|
|
536
|
-
} else if (this.items.length > 1) {
|
|
761
|
+
} else if (this.items.length > 1 || this.pageable) {
|
|
537
762
|
this.swipeX = dx;
|
|
538
763
|
}
|
|
539
764
|
this.apply(false);
|
|
@@ -552,29 +777,42 @@ class BkImageViewer extends LitElement {
|
|
|
552
777
|
const dx = this.swipeX;
|
|
553
778
|
if (dx) {
|
|
554
779
|
this.swipeX = 0;
|
|
555
|
-
if (e.type
|
|
556
|
-
this.go(this.index + (dx < 0 ? 1 : -1));
|
|
557
|
-
else
|
|
780
|
+
if (e.type === "pointercancel" || Math.abs(dx) <= SWIPE_DISTANCE || this.step(dx < 0 ? 1 : -1) !== "own")
|
|
558
781
|
this.apply(true);
|
|
559
782
|
return;
|
|
560
783
|
}
|
|
561
784
|
if (!this.drag.moved && e.type === "pointerup")
|
|
562
785
|
this.onTap(e);
|
|
563
786
|
}
|
|
564
|
-
/**
|
|
787
|
+
/**
|
|
788
|
+
* A double tap or double click toggles the zoom. A single tap beside the image closes the viewer.
|
|
789
|
+
* In an `immersive` viewer a click (mouse or pen) steps the zoom: 2×, 4×, then the fitted size.
|
|
790
|
+
*/
|
|
565
791
|
onTap(e) {
|
|
792
|
+
const outside = Math.abs(e.clientX - this.box.x) > this.fit.w / 2 || Math.abs(e.clientY - this.box.y) > this.fit.h / 2;
|
|
793
|
+
if (this.immersive && e.pointerType !== "touch") {
|
|
794
|
+
if (!this.zoomed && outside) {
|
|
795
|
+
emit(this, "dismiss");
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const step = CLICK_STEPS.find((s) => this.pz.zoom < s - 0.01);
|
|
799
|
+
if (step)
|
|
800
|
+
this.zoomTo(step, e.clientX, e.clientY);
|
|
801
|
+
else
|
|
802
|
+
this.zoomFit();
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
566
805
|
const now = e.timeStamp;
|
|
567
806
|
const last = this.lastTap;
|
|
568
807
|
if (now - last.t < DOUBLE_TAP_MS && Math.hypot(e.clientX - last.x, e.clientY - last.y) < 30) {
|
|
569
808
|
this.lastTap = { t: 0, x: 0, y: 0 };
|
|
570
809
|
if (this.zoomed)
|
|
571
|
-
this.
|
|
810
|
+
this.zoomFit();
|
|
572
811
|
else
|
|
573
812
|
this.zoomTo(DOUBLE_TAP_ZOOM, e.clientX, e.clientY);
|
|
574
813
|
return;
|
|
575
814
|
}
|
|
576
815
|
this.lastTap = { t: now, x: e.clientX, y: e.clientY };
|
|
577
|
-
const outside = Math.abs(e.clientX - this.box.x) > this.fit.w / 2 || Math.abs(e.clientY - this.box.y) > this.fit.h / 2;
|
|
578
816
|
if (!this.zoomed && outside)
|
|
579
817
|
emit(this, "dismiss");
|
|
580
818
|
}
|
|
@@ -583,15 +821,30 @@ class BkImageViewer extends LitElement {
|
|
|
583
821
|
return;
|
|
584
822
|
this.loading = false;
|
|
585
823
|
const img = this.image;
|
|
586
|
-
if (img?.naturalWidth && img.naturalHeight)
|
|
824
|
+
if (img?.naturalWidth && img.naturalHeight) {
|
|
587
825
|
this.ratio = img.naturalWidth / img.naturalHeight;
|
|
826
|
+
this.naturalSize = img.naturalWidth;
|
|
827
|
+
}
|
|
588
828
|
this.placeImage();
|
|
589
829
|
}
|
|
590
830
|
/** Fits the loaded image into the frame. It does not change reactive state. */
|
|
591
831
|
placeImage() {
|
|
592
|
-
this.
|
|
832
|
+
const src = this.image?.getAttribute("src") ?? "";
|
|
833
|
+
this.preloaded.add(src);
|
|
593
834
|
this.measure();
|
|
594
835
|
this.apply(false);
|
|
836
|
+
this.applyPendingView();
|
|
837
|
+
const key = `${this.index}|${src}`;
|
|
838
|
+
if (key !== this.loadedKey) {
|
|
839
|
+
this.loadedKey = key;
|
|
840
|
+
this.dispatchEvent(new Event("load"));
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
/** The thumbnail gives the height of the viewer until the shape of the full image is known. */
|
|
844
|
+
onThumbLoad(e) {
|
|
845
|
+
const img = e.target;
|
|
846
|
+
if (img.naturalWidth && img.naturalHeight)
|
|
847
|
+
this.thumbRatio = img.naturalWidth / img.naturalHeight;
|
|
595
848
|
}
|
|
596
849
|
onImageError(e) {
|
|
597
850
|
if (e.target !== this.image)
|
|
@@ -606,32 +859,37 @@ class BkImageViewer extends LitElement {
|
|
|
606
859
|
renderViewer(item) {
|
|
607
860
|
const n = this.items.length;
|
|
608
861
|
const many = n > 1;
|
|
609
|
-
const full = item.full || item.src;
|
|
610
862
|
const strip = this.filmstrip && many;
|
|
863
|
+
const shot = this.shot ?? { key: `${this.index}|${item.full || item.src}`, src: item.full || item.src, thumb: item.src, alt: item.alt };
|
|
864
|
+
const shots = this.previousShot ? [this.previousShot, shot] : [shot];
|
|
865
|
+
const swap = !!this.previousShot && this.loading;
|
|
611
866
|
return html`<div class="viewer" part="base" role="region" tabindex="0"
|
|
612
867
|
aria-label=${this.label || this.i18n.t("imageViewer")} @keydown=${this.onKey}>
|
|
613
868
|
<div class="bar" part="toolbar">
|
|
614
|
-
<span class="counter" part="counter" aria-live="polite" aria-atomic="true">${many ? html`<span aria-hidden="true">${this.index + 1} / ${n}</span><span class="sr-only">${this.i18n.t("imageCounter", { index: this.index + 1, total: n })}</span>` :
|
|
869
|
+
<span class="counter" part="counter" aria-live="polite" aria-atomic="true">${many ? html`<span aria-hidden="true">${this.index + 1} / ${n}</span><span class="sr-only">${this.i18n.t("imageCounter", { index: this.index + 1, total: n })}</span>` : nothing}</span>
|
|
615
870
|
<span class="tools">
|
|
616
871
|
<bk-button variant="ghost" class="control" size="lg" label=${this.zoomOutLabel || this.i18n.t("zoomOut")} icon="zoom-out" @click=${() => this.zoomTo(this.pz.zoom / ZOOM_STEP)}></bk-button>
|
|
617
872
|
<output class="level" part="zoom-level" aria-live="off" aria-label=${this.i18n.t("zoomLevel")}></output>
|
|
618
873
|
<bk-button variant="ghost" class="control" size="lg" label=${this.zoomInLabel || this.i18n.t("zoomIn")} icon="zoom-in" @click=${() => this.zoomTo(this.pz.zoom * ZOOM_STEP)}></bk-button>
|
|
619
|
-
<bk-button variant="ghost" class="control fit" size="lg" label=${this.fitLabel || this.i18n.t("zoomFit")} icon="fit-screen" @click=${() => this.
|
|
620
|
-
<bk-button variant="ghost" class="control actual" size="lg" label=${this.actualSizeLabel || this.i18n.t("zoomActual")} icon="actual-size" @click=${() => this.
|
|
874
|
+
<bk-button variant="ghost" class="control fit" size="lg" label=${this.fitLabel || this.i18n.t("zoomFit")} icon="fit-screen" @click=${() => this.zoomFit()}></bk-button>
|
|
875
|
+
<bk-button variant="ghost" class="control actual" size="lg" label=${this.actualSizeLabel || this.i18n.t("zoomActual")} icon="actual-size" @click=${() => this.zoomActual()}></bk-button>
|
|
621
876
|
</span>
|
|
622
877
|
<span class="actions"><slot name="actions"></slot></span>
|
|
623
878
|
</div>
|
|
624
879
|
<div class="main">
|
|
625
|
-
<div class="
|
|
880
|
+
<div class="sizer" aria-hidden="true"></div>
|
|
881
|
+
<div class="stage ${this.zoomed ? "zoomed" : ""} ${this.immersive ? "steps" : ""}" part="stage" @wheel=${this.onWheel}
|
|
626
882
|
@pointerdown=${this.onPointerDown} @pointermove=${this.onPointerMove}
|
|
627
883
|
@pointerup=${this.onPointerUp} @pointercancel=${this.onPointerUp}>
|
|
628
|
-
<div class="frame">${
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
src=${
|
|
633
|
-
|
|
634
|
-
|
|
884
|
+
<div class="frame ${swap ? "swap" : ""}">${repeat(shots, (s) => s.key, (s) => {
|
|
885
|
+
const shown = s === shot;
|
|
886
|
+
const classes = shown ? `image ${this.loading ? "" : "loaded"} ${this.failed ? "failed" : ""}` : `previous ${swap ? "" : "gone"}`;
|
|
887
|
+
return html`<img class=${classes}
|
|
888
|
+
part=${ifDefined(shown ? "image" : void 0)} src=${s.src} alt=${shown ? s.alt : ""} aria-hidden=${ifDefined(shown ? void 0 : "true")}
|
|
889
|
+
decoding="async" draggable="false" @load=${this.onImageLoad} @error=${this.onImageError}>${shown && s.src !== s.thumb ? html`<img
|
|
890
|
+
class="placeholder ${this.ratio ? "shaped" : ""}" src=${s.thumb} alt="" aria-hidden="true" decoding="async" draggable="false" @load=${this.onThumbLoad}>` : nothing}`;
|
|
891
|
+
})}</div>
|
|
892
|
+
${this.loader.visible ? html`<span class="spinner"><bk-spinner size="lg"></bk-spinner></span>` : nothing}
|
|
635
893
|
${this.failed ? html`<p class="error" role="alert"><bk-icon name="error" size="md"></bk-icon>${this.errorLabel || this.i18n.t("imageError")}</p>` : nothing}
|
|
636
894
|
</div>
|
|
637
895
|
<span class="pan" part="pan" role="group" aria-label=${this.panLabel || this.i18n.t("panGroup")} ?hidden=${!this.zoomed}>
|
|
@@ -640,9 +898,9 @@ class BkImageViewer extends LitElement {
|
|
|
640
898
|
<bk-button variant="ghost" class="control" size="sm" icon="chevron-down" label=${this.i18n.t("panDown")} @click=${() => this.panBy(0, -this.panStep)}></bk-button>
|
|
641
899
|
<bk-button variant="ghost" class="control" size="sm" icon="chevron-right" label=${this.i18n.t("panRight")} @click=${() => this.panBy(-this.panStep, 0)}></bk-button>
|
|
642
900
|
</span>
|
|
643
|
-
${many ? html`
|
|
644
|
-
<bk-button variant="ghost" class="control nav prev" part="nav" size="lg" icon="chevron-left" label=${this.prevLabel || this.i18n.t("previousImage")} @click=${() => this.
|
|
645
|
-
<bk-button variant="ghost" class="control nav next" part="nav" size="lg" icon="chevron-right" label=${this.nextLabel || this.i18n.t("nextImage")} @click=${() => this.
|
|
901
|
+
${many || this.pageable ? html`
|
|
902
|
+
<bk-button variant="ghost" class="control nav prev" part="nav" size="lg" icon="chevron-left" label=${this.prevLabel || this.i18n.t("previousImage")} ?disabled=${!this.canStep(-1)} @click=${() => this.step(-1)}></bk-button>
|
|
903
|
+
<bk-button variant="ghost" class="control nav next" part="nav" size="lg" icon="chevron-right" label=${this.nextLabel || this.i18n.t("nextImage")} ?disabled=${!this.canStep(1)} @click=${() => this.step(1)}></bk-button>` : nothing}
|
|
646
904
|
</div>
|
|
647
905
|
<div class="foot" ?hidden=${!item.caption && !strip}>
|
|
648
906
|
${item.caption ? html`<p class="caption" part="caption">${item.caption}</p>` : nothing}
|