@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
|
@@ -2,6 +2,7 @@ import { LitElement, type PropertyValues } from "lit";
|
|
|
2
2
|
import { type PanZoomView } from "../internal/pan-zoom.js";
|
|
3
3
|
import "./bk-icon.js";
|
|
4
4
|
import "./bk-segmented.js";
|
|
5
|
+
import "./bk-segmented-item.js";
|
|
5
6
|
import "./bk-button.js";
|
|
6
7
|
import "./bk-zoom.js";
|
|
7
8
|
import "../icons/set/chevron-left.js";
|
|
@@ -13,6 +14,14 @@ import "../icons/set/group.js";
|
|
|
13
14
|
export type ImageCompareVariant = "slider" | "side" | "toggle";
|
|
14
15
|
/** One of the two pictures. */
|
|
15
16
|
export type ImageCompareSide = "before" | "after";
|
|
17
|
+
/** The zoom (1 to 8) and the point of the pictures in the centre, as fractions of their width and height. */
|
|
18
|
+
export type ImageCompareView = PanZoomView;
|
|
19
|
+
/** Detail of the `load` event: the side of the picture and its natural size in image pixels. */
|
|
20
|
+
export interface ImageCompareLoadDetail {
|
|
21
|
+
side: ImageCompareSide;
|
|
22
|
+
naturalWidth: number;
|
|
23
|
+
naturalHeight: number;
|
|
24
|
+
}
|
|
16
25
|
/**
|
|
17
26
|
* Two pictures of the same subject, for example a photo and its edit, or an image and
|
|
18
27
|
* its upscale. The pictures must have the same shape.
|
|
@@ -34,14 +43,39 @@ export type ImageCompareSide = "before" | "after";
|
|
|
34
43
|
* sets the zoom and the visible part. `resetZoom()` shows the whole picture again.
|
|
35
44
|
*
|
|
36
45
|
* The box uses the shape of the after picture when it loads (4 / 3 before). The pictures are on the
|
|
37
|
-
* dark media backdrop in both themes, as in `<bk-image-viewer>`.
|
|
46
|
+
* dark media backdrop in both themes, as in `<bk-image-viewer>`. `--bk-image-compare-max-height` caps the height
|
|
47
|
+
* of the box. The box then keeps the full width, and the backdrop shows at the sides of the pictures.
|
|
48
|
+
*
|
|
49
|
+
* With `shaped` the box takes the shape of the pictures also under the cap: the width follows the ratio. The box is never
|
|
50
|
+
* wider than its container and a picture never shows larger than its natural size (the after picture gives it). With
|
|
51
|
+
* `side` the two boxes and the gap between them follow the same rules. A 400 × 1200 picture in a 1200 px container
|
|
52
|
+
* with a cap of 600 px gives a box of 200 × 600 px. `shaped` has no effect with content in the slots.
|
|
53
|
+
*
|
|
54
|
+
* The element fires `load` for each picture that loads, with its side and its natural size. Each element that shows the
|
|
55
|
+
* name of a side has the part `label`, in every variant: style the names with `::part(label)`.
|
|
56
|
+
*
|
|
57
|
+
* Content instead of pictures: fill the slot `before` or `after` with any content, for example two cards
|
|
58
|
+
* with the same layout. The slot replaces the picture of its side, and the `*-src` attributes still work
|
|
59
|
+
* for the other side. Both sides lie in one grid cell, so the box takes the size of the larger side (no
|
|
60
|
+
* ratio). The divider cuts the before side as it cuts a picture. Each side has a surface
|
|
61
|
+
* (`--bk-image-compare-content-bg`), because the side below must not show through. Zoom and the tags are off with content: the content shows its own headings.
|
|
62
|
+
* Each side is a `group` with its label as its name. Assistive technology reads both sides in full, also the
|
|
63
|
+
* part that the divider hides. Tab reaches interactive content in both sides, also in the hidden part. So
|
|
64
|
+
* use content that is not interactive, or that stays correct when its hidden part has focus. A side that the
|
|
65
|
+
* divider hides completely (`position` 0 or 100) is `inert`. The pointer works in the content as usual:
|
|
66
|
+
* only the divider and its grip start a drag.
|
|
38
67
|
*
|
|
39
68
|
* i18n keys: `imageCompare` (the name of the group), `compareBefore`, `compareAfter`, `compareDivider`,
|
|
40
69
|
* `compareShown`, `compareShow`, `compareZoomHelp`, and the keys of `<bk-zoom>`.
|
|
41
70
|
*
|
|
71
|
+
* @slot before - Content for the before side. It replaces the before picture.
|
|
72
|
+
* @slot after - Content for the after side. It replaces the after picture.
|
|
42
73
|
* @csspart view - The box of the pictures. It handles the zoom keys with `zoomable`.
|
|
43
|
-
* @csspart stage - The box of one picture.
|
|
74
|
+
* @csspart stage - The box of the pictures (`side`: the box of one picture).
|
|
75
|
+
* @csspart before - The box of the before side (a picture or the slot), with the corners of the pictures. Style a ring with `outline` and a negative `outline-offset`, or an inset `box-shadow`. With `slider` the divider cuts it.
|
|
76
|
+
* @csspart after - The box of the after side, as `before`.
|
|
44
77
|
* @csspart image - One `<img>`.
|
|
78
|
+
* @csspart label - Each element that shows the name of a side, in every variant: the tags (`slider`), the captions (`side`) and the items of the segmented control (`toggle`).
|
|
45
79
|
* @csspart tag - The label of a picture in a top corner (`slider`).
|
|
46
80
|
* @csspart divider - The area around the line that the user drags (`slider`). It is a `slider` for assistive technology.
|
|
47
81
|
* @csspart line - The divider line. The corners of the pictures cut the line.
|
|
@@ -49,13 +83,15 @@ export type ImageCompareSide = "before" | "after";
|
|
|
49
83
|
* @csspart caption - The caption under a picture (`side`).
|
|
50
84
|
* @csspart switch - The segmented control that chooses the picture (`toggle`).
|
|
51
85
|
* @csspart zoom - The zoom control (`zoomable`).
|
|
86
|
+
* @cssprop --bk-image-compare-max-height - Maximum height of the box of the pictures, a length (default none). With `shaped` the width follows the ratio under it.
|
|
52
87
|
* @cssprop --bk-image-compare-ratio - Shape of the pictures, for example `16 / 9` (default: the shape of the after picture, 4 / 3 before it loads).
|
|
53
88
|
* @cssprop --bk-image-compare-color-scheme - Colour scheme of the tags and the zoom control over the pictures (default dark).
|
|
89
|
+
* @cssprop --bk-image-compare-content-bg - Surface of a side with slotted content (default --bk-layer-base-bg).
|
|
54
90
|
* @cssprop --bk-image-compare-bg - Background around a picture that does not fill its box (default --bk-media-backdrop).
|
|
55
91
|
* @cssprop --bk-image-compare-radius - Corner radius of a picture box (default --bk-radius-md).
|
|
56
92
|
* @cssprop --bk-image-compare-gap - Space between the pictures (`side`) and between the pictures and the parts under them (default --bk-space-2).
|
|
57
93
|
* @cssprop --bk-image-compare-padding - Space between the edge of the pictures and the tags and the zoom control (default --bk-space-2).
|
|
58
|
-
* @cssprop --bk-image-compare-divider-color - Colour of the divider line (default --bk-on-media).
|
|
94
|
+
* @cssprop --bk-image-compare-divider-color - Colour of the divider line (default --bk-on-media, --bk-accent-solid with content).
|
|
59
95
|
* @cssprop --bk-image-compare-divider-width - Thickness of the divider line (default 2 × --bk-border-width).
|
|
60
96
|
* @cssprop --bk-image-compare-divider-active-width - Thickness of the divider line under the pointer, while the user drags it and with keyboard focus (default 4 × --bk-border-width).
|
|
61
97
|
* @cssprop --bk-image-compare-handle-size - Size of the grip on the divider (default --bk-control-md).
|
|
@@ -70,8 +106,12 @@ export type ImageCompareSide = "before" | "after";
|
|
|
70
106
|
* @cssprop --bk-image-compare-control-bg - Background of the tags and the zoom control (default --bk-media-control-bg).
|
|
71
107
|
* @cssprop --bk-image-compare-control-fg - Text and icon colour of the tags and the zoom control (default --bk-on-media).
|
|
72
108
|
* @cssprop --bk-image-compare-caption-color - Colour of the captions (default --bk-text-muted).
|
|
109
|
+
* @cssprop --bk-image-compare-label-transform - Text transform of the names of the sides (default none).
|
|
110
|
+
* @cssprop --bk-image-compare-label-tracking - Letter spacing of the names of the sides, a length (default 0em; for uppercase use --bk-tracking-label). The element takes the space after the last letter back, so the name stays centred.
|
|
73
111
|
* @fires {Event} input - The element fires this event while the user moves the divider.
|
|
74
112
|
* @fires {Event} change - The element fires this event when the user moves the divider (on release, on a key) or chooses the other picture (`toggle`).
|
|
113
|
+
* @fires {CustomEvent<ImageCompareLoadDetail>} load - A picture has loaded, also from the cache of the browser. `event.detail` is `{ side, naturalWidth, naturalHeight }` with `side` `before` or `after`. The event bubbles and is composed: the native `load` of the inner `<img>` does not leave the shadow root.
|
|
114
|
+
* @fires {CustomEvent<ImageCompareView>} viewchange - The user zoomed or panned (`zoomable`). `event.detail` is the new `view`. Setting `view` and `resetZoom()` fire no event. Use it to show the same part in another `<bk-image-compare>` or `<bk-image-viewer>`. The event bubbles and is composed.
|
|
75
115
|
*
|
|
76
116
|
* @tag bk-image-compare
|
|
77
117
|
* @keyboard ←, → - On the divider: move it. The arrows follow the writing direction. Shift: larger steps.
|
|
@@ -113,9 +153,16 @@ export declare class BkImageCompare extends LitElement {
|
|
|
113
153
|
type: BooleanConstructor;
|
|
114
154
|
reflect: boolean;
|
|
115
155
|
};
|
|
156
|
+
shaped: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
reflect: boolean;
|
|
159
|
+
};
|
|
116
160
|
ratio: {
|
|
117
161
|
state: boolean;
|
|
118
162
|
};
|
|
163
|
+
naturalSize: {
|
|
164
|
+
state: boolean;
|
|
165
|
+
};
|
|
119
166
|
sliding: {
|
|
120
167
|
state: boolean;
|
|
121
168
|
};
|
|
@@ -138,20 +185,36 @@ export declare class BkImageCompare extends LitElement {
|
|
|
138
185
|
show: ImageCompareSide;
|
|
139
186
|
/** The user can zoom and pan. Both pictures show the same part. */
|
|
140
187
|
zoomable: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* The box takes the shape of the pictures: under `--bk-image-compare-max-height` the width follows the ratio. The box
|
|
190
|
+
* is never wider than its container and never larger than the natural size of the pictures.
|
|
191
|
+
*/
|
|
192
|
+
shaped: boolean;
|
|
141
193
|
/** Width / height of the after picture. It is 0 while the size is unknown. */
|
|
142
194
|
private ratio;
|
|
195
|
+
/** Width of the after picture in image pixels. It is 0 while the size is unknown. */
|
|
196
|
+
private naturalSize;
|
|
143
197
|
private sliding;
|
|
144
198
|
private i18n;
|
|
145
199
|
private pz;
|
|
200
|
+
/** While true, a change of the view is not a change of the user: no `viewchange`. */
|
|
201
|
+
private quiet;
|
|
202
|
+
private viewChanged;
|
|
146
203
|
private internals;
|
|
204
|
+
private slots;
|
|
147
205
|
constructor();
|
|
148
206
|
static styles: import("lit").CSSResult[];
|
|
149
207
|
/** The zoom and the part that shows: `zoom` from 1 to 8, `x` and `y` are the point in the centre as fractions of the picture. */
|
|
150
|
-
get view():
|
|
151
|
-
|
|
152
|
-
|
|
208
|
+
get view(): ImageCompareView;
|
|
209
|
+
/** Setting the view fires no `viewchange`. */
|
|
210
|
+
set view(v: Partial<ImageCompareView>);
|
|
211
|
+
/** Shows the whole picture again. It fires no `viewchange`. */
|
|
153
212
|
resetZoom(): void;
|
|
213
|
+
private silently;
|
|
214
|
+
private onViewChange;
|
|
215
|
+
protected updated(): void;
|
|
154
216
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
217
|
+
private get content();
|
|
155
218
|
private get single();
|
|
156
219
|
private get mode();
|
|
157
220
|
private labelOf;
|
|
@@ -3,11 +3,14 @@ import { styleMap } from "../internal/style-map.js";
|
|
|
3
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
|
-
import { emit } from "../internal/events.js";
|
|
6
|
+
import { emit, emitDetail } from "../internal/events.js";
|
|
7
7
|
import { PanZoom, capture } from "../internal/pan-zoom.js";
|
|
8
8
|
import { base, srOnly } from "../internal/styles.js";
|
|
9
|
+
import { SlotController } from "../internal/slots.js";
|
|
10
|
+
import { setHostVars } from "../internal/host-vars.js";
|
|
9
11
|
import "./bk-icon.js";
|
|
10
12
|
import "./bk-segmented.js";
|
|
13
|
+
import "./bk-segmented-item.js";
|
|
11
14
|
import "./bk-button.js";
|
|
12
15
|
import "./bk-zoom.js";
|
|
13
16
|
import "../icons/set/chevron-left.js";
|
|
@@ -30,12 +33,18 @@ class BkImageCompare extends LitElement {
|
|
|
30
33
|
position: { type: Number },
|
|
31
34
|
show: { reflect: true, useDefault: true },
|
|
32
35
|
zoomable: { type: Boolean, reflect: true },
|
|
36
|
+
shaped: { type: Boolean, reflect: true },
|
|
33
37
|
ratio: { state: true },
|
|
38
|
+
naturalSize: { state: true },
|
|
34
39
|
sliding: { state: true }
|
|
35
40
|
};
|
|
36
41
|
i18n = new LocalizeController(this);
|
|
37
|
-
pz = new PanZoom(this, { max: MAX_ZOOM });
|
|
42
|
+
pz = new PanZoom(this, { max: MAX_ZOOM, onChange: () => this.onViewChange() });
|
|
43
|
+
/** While true, a change of the view is not a change of the user: no `viewchange`. */
|
|
44
|
+
quiet = false;
|
|
45
|
+
viewChanged = false;
|
|
38
46
|
internals = this.attachInternals();
|
|
47
|
+
slots = new SlotController(this);
|
|
39
48
|
constructor() {
|
|
40
49
|
super();
|
|
41
50
|
this.beforeSrc = "";
|
|
@@ -47,7 +56,9 @@ class BkImageCompare extends LitElement {
|
|
|
47
56
|
this.position = 50;
|
|
48
57
|
this.show = "after";
|
|
49
58
|
this.zoomable = false;
|
|
59
|
+
this.shaped = false;
|
|
50
60
|
this.ratio = 0;
|
|
61
|
+
this.naturalSize = 0;
|
|
51
62
|
this.sliding = false;
|
|
52
63
|
this.internals.role = "group";
|
|
53
64
|
}
|
|
@@ -60,6 +71,15 @@ class BkImageCompare extends LitElement {
|
|
|
60
71
|
--_bk-image-compare-control-fg: var(--bk-image-compare-control-fg, var(--bk-on-media));
|
|
61
72
|
--_bk-image-compare-radius: var(--bk-image-compare-radius, var(--bk-radius-md));
|
|
62
73
|
}
|
|
74
|
+
/* shaped: the width follows the ratio under the cap, never wider than the container or the natural pictures. With
|
|
75
|
+
side, the width is two boxes and the gap. */
|
|
76
|
+
:host([shaped]:not(:state(content))) {
|
|
77
|
+
--_bk-image-compare-cap: var(--bk-image-compare-max-height, calc(infinity * 1px));
|
|
78
|
+
--_bk-image-compare-shape: var(--bk-image-compare-ratio, var(--_bk-image-compare-ratio, 4 / 3));
|
|
79
|
+
inline-size: min(100%,
|
|
80
|
+
calc(var(--_bk-image-compare-cols, 1) * var(--_bk-image-compare-natural, calc(infinity * 1px)) + (var(--_bk-image-compare-cols, 1) - 1) * var(--_bk-image-compare-gap)),
|
|
81
|
+
calc(var(--_bk-image-compare-cols, 1) * var(--_bk-image-compare-cap) * var(--_bk-image-compare-shape) + (var(--_bk-image-compare-cols, 1) - 1) * var(--_bk-image-compare-gap)));
|
|
82
|
+
}
|
|
63
83
|
.compare { display: grid; gap: var(--_bk-image-compare-gap); min-width: 0; }
|
|
64
84
|
.view { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--_bk-image-compare-gap); border-radius: var(--_bk-image-compare-radius); }
|
|
65
85
|
.view.side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
|
|
@@ -72,6 +92,8 @@ class BkImageCompare extends LitElement {
|
|
|
72
92
|
.stage {
|
|
73
93
|
position: relative; grid-row: 1; grid-column: 1; overflow: hidden; isolation: isolate;
|
|
74
94
|
aspect-ratio: var(--bk-image-compare-ratio, var(--_bk-image-compare-ratio, 4 / 3));
|
|
95
|
+
/* Under the cap the box keeps the full width: stretch, not the width from the ratio of a grid item. */
|
|
96
|
+
max-block-size: var(--bk-image-compare-max-height, none); justify-self: stretch;
|
|
75
97
|
border-radius: var(--_bk-image-compare-radius); user-select: none; -webkit-user-select: none;
|
|
76
98
|
}
|
|
77
99
|
/* The backdrop stays a hairline inside the edge: the smoothed edge of a picture never mixes with it. */
|
|
@@ -80,8 +102,17 @@ class BkImageCompare extends LitElement {
|
|
|
80
102
|
border-radius: max(0px, calc(var(--_bk-image-compare-radius) - var(--bk-border-width)));
|
|
81
103
|
background: var(--bk-image-compare-bg, var(--bk-media-backdrop));
|
|
82
104
|
}
|
|
105
|
+
/* Content: the sides lie in one grid cell, and the larger side gives the size of the box. */
|
|
106
|
+
.stage.content { display: grid; aspect-ratio: auto; max-block-size: none; user-select: text; -webkit-user-select: text; }
|
|
107
|
+
.stage.content::before { display: none; }
|
|
108
|
+
.stage.content > .layer { position: relative; inset: auto; grid-area: 1 / 1; min-inline-size: 0; }
|
|
109
|
+
.layer.slotted {
|
|
110
|
+
display: grid; grid-template-columns: minmax(0, 1fr);
|
|
111
|
+
background: var(--bk-image-compare-content-bg, var(--bk-layer-base-bg));
|
|
112
|
+
}
|
|
83
113
|
.side .stage.after { grid-column: 2; }
|
|
84
|
-
|
|
114
|
+
/* The box of one side has the corners of the pictures: a ring on the part follows them. */
|
|
115
|
+
.layer { position: absolute; inset: 0; border-radius: inherit; }
|
|
85
116
|
.layer.hidden { visibility: hidden; }
|
|
86
117
|
.frame { position: absolute; inset: 0; transform-origin: 0 0; transition: transform var(--bk-duration-fast) var(--bk-ease); }
|
|
87
118
|
.frame.instant { transition: none; }
|
|
@@ -101,15 +132,20 @@ class BkImageCompare extends LitElement {
|
|
|
101
132
|
.tag {
|
|
102
133
|
position: absolute; inset-block-start: var(--_bk-image-compare-pad); max-inline-size: 40%;
|
|
103
134
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
104
|
-
|
|
135
|
+
/* Letter spacing also follows the last letter: the end padding gives it back, so the text stays centred. */
|
|
136
|
+
padding-block: var(--bk-space-1); padding-inline: var(--bk-space-2) calc(var(--bk-space-2) - var(--bk-image-compare-label-tracking, 0em));
|
|
137
|
+
border-radius: var(--bk-radius-full);
|
|
105
138
|
background: var(--_bk-image-compare-control-bg); color: var(--_bk-image-compare-control-fg); backdrop-filter: var(--bk-glass);
|
|
106
139
|
font-size: var(--bk-type-small); line-height: var(--bk-line-height-tight);
|
|
140
|
+
text-transform: var(--bk-image-compare-label-transform, none); letter-spacing: var(--bk-image-compare-label-tracking, 0em);
|
|
107
141
|
}
|
|
108
142
|
.tags.before .tag { inset-inline-start: var(--_bk-image-compare-pad); }
|
|
109
143
|
.tags.after .tag { inset-inline-end: var(--_bk-image-compare-pad); }
|
|
110
144
|
/* The line lies in a box with the corners of the pictures: at the ends it does not cross the rounded edge. */
|
|
111
145
|
.rail { position: absolute; z-index: 0; inset: 0; overflow: hidden; border-radius: var(--_bk-image-compare-radius); }
|
|
112
146
|
.line.ends { visibility: hidden; }
|
|
147
|
+
/* Content lies on a surface of the page, not on the dark backdrop: the line needs the accent. */
|
|
148
|
+
.view.has-content .line { background: var(--bk-image-compare-divider-color, var(--bk-accent-solid)); }
|
|
113
149
|
.line {
|
|
114
150
|
position: absolute; inset-block: 0; inset-inline-start: var(--_bk-image-compare-pos);
|
|
115
151
|
--_bk-image-compare-line: var(--bk-image-compare-divider-width, calc(2 * var(--bk-border-width)));
|
|
@@ -161,6 +197,8 @@ class BkImageCompare extends LitElement {
|
|
|
161
197
|
.caption {
|
|
162
198
|
min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
163
199
|
font-size: var(--bk-type-small); color: var(--bk-image-compare-caption-color, var(--bk-text-muted));
|
|
200
|
+
text-transform: var(--bk-image-compare-label-transform, none); letter-spacing: var(--bk-image-compare-label-tracking, 0em);
|
|
201
|
+
padding-inline-start: var(--bk-image-compare-label-tracking, 0em);
|
|
164
202
|
}
|
|
165
203
|
.switch { justify-self: center; }
|
|
166
204
|
@media (prefers-reduced-motion: reduce) { .frame, .line, .handle { transition: none; } }
|
|
@@ -173,29 +211,65 @@ class BkImageCompare extends LitElement {
|
|
|
173
211
|
get view() {
|
|
174
212
|
return this.pz.get();
|
|
175
213
|
}
|
|
214
|
+
/** Setting the view fires no `viewchange`. */
|
|
176
215
|
set view(v) {
|
|
177
|
-
this.pz.set(v);
|
|
216
|
+
this.silently(() => this.pz.set(v));
|
|
178
217
|
}
|
|
179
|
-
/** Shows the whole picture again. */
|
|
218
|
+
/** Shows the whole picture again. It fires no `viewchange`. */
|
|
180
219
|
resetZoom() {
|
|
181
|
-
this.pz.set({ zoom: 1 });
|
|
220
|
+
this.silently(() => this.pz.set({ zoom: 1 }));
|
|
221
|
+
}
|
|
222
|
+
silently(fn) {
|
|
223
|
+
const was = this.quiet;
|
|
224
|
+
this.quiet = true;
|
|
225
|
+
try {
|
|
226
|
+
fn();
|
|
227
|
+
} finally {
|
|
228
|
+
this.quiet = was;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
onViewChange() {
|
|
232
|
+
this.requestUpdate();
|
|
233
|
+
if (!this.quiet)
|
|
234
|
+
this.viewChanged = true;
|
|
235
|
+
}
|
|
236
|
+
updated() {
|
|
237
|
+
if (!this.viewChanged)
|
|
238
|
+
return;
|
|
239
|
+
this.viewChanged = false;
|
|
240
|
+
emitDetail(this, "viewchange", this.view);
|
|
182
241
|
}
|
|
183
242
|
willUpdate(changed) {
|
|
184
243
|
if (changed.has("position"))
|
|
185
244
|
this.position = clamp(Number(this.position) || 0, 0, 100);
|
|
186
|
-
if (changed.has("afterSrc") || changed.has("beforeSrc"))
|
|
245
|
+
if (changed.has("afterSrc") || changed.has("beforeSrc")) {
|
|
187
246
|
this.ratio = 0;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
247
|
+
this.naturalSize = 0;
|
|
248
|
+
}
|
|
249
|
+
const zoom = this.zoomable && !this.content;
|
|
250
|
+
if (this.pz.enabled !== zoom) {
|
|
251
|
+
this.pz.enabled = zoom;
|
|
252
|
+
if (!zoom)
|
|
253
|
+
this.silently(() => this.pz.set({ zoom: 1 }));
|
|
192
254
|
}
|
|
193
255
|
if (changed.has("label") || changed.has("beforeLabel") || changed.has("afterLabel")) {
|
|
194
256
|
this.internals.ariaLabel = this.label || this.i18n.t("imageCompare");
|
|
195
257
|
}
|
|
258
|
+
if (this.content)
|
|
259
|
+
this.internals.states?.add("content");
|
|
260
|
+
else
|
|
261
|
+
this.internals.states?.delete("content");
|
|
262
|
+
setHostVars(this, {
|
|
263
|
+
"--_bk-image-compare-ratio": this.ratio ? String(this.ratio) : "",
|
|
264
|
+
"--_bk-image-compare-natural": this.naturalSize && this.ratio ? `${this.naturalSize}px` : "",
|
|
265
|
+
"--_bk-image-compare-cols": this.mode === "side" ? "2" : ""
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
get content() {
|
|
269
|
+
return this.slots.has("before") || this.slots.has("after");
|
|
196
270
|
}
|
|
197
271
|
get single() {
|
|
198
|
-
return !this.beforeSrc;
|
|
272
|
+
return !this.beforeSrc && !this.slots.has("before");
|
|
199
273
|
}
|
|
200
274
|
get mode() {
|
|
201
275
|
return this.single ? "single" : this.variant;
|
|
@@ -205,8 +279,11 @@ class BkImageCompare extends LitElement {
|
|
|
205
279
|
}
|
|
206
280
|
onLoad(side, e) {
|
|
207
281
|
const img = e.target;
|
|
208
|
-
if ((side === "after" || !this.afterSrc) && img.naturalWidth && img.naturalHeight)
|
|
282
|
+
if ((side === "after" || !this.afterSrc) && img.naturalWidth && img.naturalHeight) {
|
|
209
283
|
this.ratio = img.naturalWidth / img.naturalHeight;
|
|
284
|
+
this.naturalSize = img.naturalWidth;
|
|
285
|
+
}
|
|
286
|
+
emitDetail(this, "load", { side, naturalWidth: img.naturalWidth, naturalHeight: img.naturalHeight });
|
|
210
287
|
}
|
|
211
288
|
// ---- the divider ----
|
|
212
289
|
setPosition(p, commit) {
|
|
@@ -288,25 +365,32 @@ class BkImageCompare extends LitElement {
|
|
|
288
365
|
render() {
|
|
289
366
|
const mode = this.mode;
|
|
290
367
|
const shown = mode === "single" ? "after" : this.show === "before" ? "before" : "after";
|
|
368
|
+
const content = this.content;
|
|
369
|
+
const zoomable = this.zoomable && !content;
|
|
291
370
|
const zoomed = this.pz.zoom > 1;
|
|
292
371
|
const transform = this.pz.transform();
|
|
293
372
|
const sel = ".stage";
|
|
294
373
|
const layer = (side) => {
|
|
295
374
|
const src = side === "before" ? this.beforeSrc : this.afterSrc;
|
|
296
375
|
const hidden = mode === "toggle" && side !== shown;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
376
|
+
const slotted = this.slots.has(side);
|
|
377
|
+
const cut = mode === "slider" && (side === "before" ? this.position <= 0 : this.position >= 100);
|
|
378
|
+
return html`<div class="layer ${side} ${hidden ? "hidden" : ""} ${slotted ? "slotted" : ""}" part=${side}
|
|
379
|
+
role=${ifDefined(slotted ? "group" : void 0)} aria-label=${ifDefined(slotted ? this.labelOf(side) : void 0)}
|
|
380
|
+
aria-hidden=${ifDefined(hidden ? "true" : void 0)} ?inert=${slotted && cut}>
|
|
381
|
+
<slot name=${side}></slot>
|
|
382
|
+
<div class="frame ${this.pz.instant ? "instant" : ""}" style=${styleMap({ transform })} ?hidden=${slotted}>
|
|
383
|
+
${src && !slotted ? html`<img part="image" src=${src} alt=${this.labelOf(side)} decoding="async" draggable="false"
|
|
300
384
|
@load=${(e) => this.onLoad(side, e)}>` : nothing}
|
|
301
385
|
</div>
|
|
302
386
|
</div>`;
|
|
303
387
|
};
|
|
304
|
-
const stages = mode === "side" ? html`<div class="stage before" part="stage">${layer("before")}</div><div class="stage after" part="stage">${layer("after")}</div>` : html`<div class="stage" part="stage">${mode === "single" ?
|
|
388
|
+
const stages = mode === "side" ? html`<div class="stage before ${content ? "content" : ""}" part="stage">${layer("before")}</div><div class="stage after ${content ? "content" : ""}" part="stage">${layer("after")}</div>` : html`<div class="stage ${content ? "content" : ""}" part="stage">${mode === "single" ? html`<slot name="before" hidden></slot>` : layer("before")}${layer("after")}</div>`;
|
|
305
389
|
const pct = Math.round(this.position);
|
|
306
390
|
const percent = new Intl.NumberFormat(this.i18n.locale, { style: "percent", maximumFractionDigits: 0 }).format(pct / 100);
|
|
307
391
|
const slider = mode === "slider" ? html`
|
|
308
|
-
|
|
309
|
-
<div class="tags after"><span class="tag" part="tag">${this.labelOf("after")}</span></div
|
|
392
|
+
${content ? nothing : html`<div class="tags before"><span class="tag" part="tag label">${this.labelOf("before")}</span></div>
|
|
393
|
+
<div class="tags after"><span class="tag" part="tag label">${this.labelOf("after")}</span></div>`}
|
|
310
394
|
<div class="divider" part="divider" role="slider" tabindex="0"
|
|
311
395
|
aria-label=${this.i18n.t("compareDivider", { before: this.labelOf("before"), after: this.labelOf("after") })}
|
|
312
396
|
aria-orientation="horizontal" aria-valuemin="0" aria-valuemax="100" aria-valuenow=${pct}
|
|
@@ -317,17 +401,17 @@ class BkImageCompare extends LitElement {
|
|
|
317
401
|
@pointerdown=${this.onDividerDown} @pointermove=${this.onDividerMove} @pointerup=${this.onDividerUp}
|
|
318
402
|
@pointercancel=${this.onDividerUp}><bk-icon name="chevron-left"></bk-icon><bk-icon name="chevron-right"></bk-icon></span>
|
|
319
403
|
<div class="rail"><span class="line ${this.position <= 0 || this.position >= 100 ? "ends" : ""}" part="line"></span></div>` : nothing;
|
|
320
|
-
const zoom =
|
|
404
|
+
const zoom = zoomable ? html`<span class="zoom" part="zoom"><bk-zoom variant="compact" size="sm" min="1" max=${MAX_ZOOM} .value=${this.pz.zoom}
|
|
321
405
|
@input=${this.onZoomInput} @change=${(e) => e.stopPropagation()}>
|
|
322
406
|
<bk-button slot="end" variant="ghost" size="sm" icon="fit-screen" label=${this.i18n.t("zoomFit")} ?disabled=${this.pz.zoom <= 1}
|
|
323
|
-
@click=${() => this.
|
|
407
|
+
@click=${() => this.pz.set({ zoom: 1 })}></bk-button>
|
|
324
408
|
</bk-zoom></span>` : nothing;
|
|
325
409
|
return html`<div class="compare">
|
|
326
|
-
<div class="view ${mode} ${
|
|
327
|
-
style=${styleMap({ "--_bk-image-compare-
|
|
328
|
-
tabindex=${ifDefined(
|
|
329
|
-
aria-label=${ifDefined(
|
|
330
|
-
aria-describedby=${ifDefined(
|
|
410
|
+
<div class="view ${mode} ${content ? "has-content" : ""} ${zoomable ? "zoomable" : ""} ${zoomed ? "zoomed" : ""}" part="view"
|
|
411
|
+
style=${styleMap({ "--_bk-image-compare-pos": `${this.position}%` })}
|
|
412
|
+
tabindex=${ifDefined(zoomable ? "0" : void 0)} role=${ifDefined(zoomable ? "group" : void 0)}
|
|
413
|
+
aria-label=${ifDefined(zoomable ? this.label || this.i18n.t("imageCompare") : void 0)}
|
|
414
|
+
aria-describedby=${ifDefined(zoomable ? "zoom-help" : void 0)}
|
|
331
415
|
@keydown=${this.onViewKey}
|
|
332
416
|
@wheel=${(e) => this.pz.wheel(e, sel)} @dblclick=${(e) => this.pz.doubleClick(e, sel)}
|
|
333
417
|
@pointerdown=${(e) => this.pz.pointerDown(e, sel)} @pointermove=${(e) => this.pz.pointerMove(e, sel)}
|
|
@@ -335,15 +419,15 @@ class BkImageCompare extends LitElement {
|
|
|
335
419
|
${stages}
|
|
336
420
|
${slider !== nothing || zoom !== nothing ? html`<div class="over">${slider}${zoom}</div>` : nothing}
|
|
337
421
|
</div>
|
|
338
|
-
${
|
|
422
|
+
${zoomable ? html`<span class="sr-only" id="zoom-help">${this.i18n.t("compareZoomHelp")}</span>` : nothing}
|
|
339
423
|
${mode === "side" ? html`<div class="captions">
|
|
340
|
-
<span class="caption" part="caption" aria-hidden="true">${this.labelOf("before")}</span>
|
|
341
|
-
<span class="caption" part="caption" aria-hidden="true">${this.labelOf("after")}</span>
|
|
424
|
+
<span class="caption" part="caption label" aria-hidden="true">${this.labelOf("before")}</span>
|
|
425
|
+
<span class="caption" part="caption label" aria-hidden="true">${this.labelOf("after")}</span>
|
|
342
426
|
</div>` : nothing}
|
|
343
427
|
${mode === "toggle" ? html`<bk-segmented class="switch" part="switch" size="sm" aria-label=${this.i18n.t("compareShow")}
|
|
344
428
|
.value=${shown} @input=${this.onShow} @change=${this.onShow}>
|
|
345
|
-
<bk-segmented-item value="before">${this.labelOf("before")}</bk-segmented-item>
|
|
346
|
-
<bk-segmented-item value="after">${this.labelOf("after")}</bk-segmented-item>
|
|
429
|
+
<bk-segmented-item part="label" value="before">${this.labelOf("before")}</bk-segmented-item>
|
|
430
|
+
<bk-segmented-item part="label" value="after">${this.labelOf("after")}</bk-segmented-item>
|
|
347
431
|
</bk-segmented>` : nothing}
|
|
348
432
|
</div>`;
|
|
349
433
|
}
|
|
@@ -17,15 +17,15 @@ export interface ImageCropRect {
|
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
19
|
* **Free.** `variant="free"` leaves the picture whole and still: a frame with eight grips is over it. Drag in the frame to
|
|
20
|
-
* move it, drag a grip to change its size, or drag outside it to draw a new frame. A click
|
|
20
|
+
* move it, drag a grip to change its size, or drag outside it to draw a new frame. A click without a drag changes nothing, so a stray click does not lose the frame. With `ratio` the frame keeps that shape.
|
|
21
21
|
* Without `ratio` the frame can have any shape. The arrow keys move the frame. Shift and the arrow keys change its width or height.
|
|
22
22
|
* `+` and `-` and the zoom control zoom the picture behind the frame: the frame keeps its place and size, and the crop becomes
|
|
23
23
|
* smaller around its centre. `0` selects the whole picture. When the frame leaves the part in view, the view moves until the
|
|
24
24
|
* frame is in view again.
|
|
25
25
|
*
|
|
26
26
|
* **Without dragging.** Drag the picture, or use the keyboard: the arrow keys move it (Shift: larger steps), `+` and `-` zoom,
|
|
27
|
-
* `0` resets. Every drag has a single-pointer alternative: a click in the picture moves the centre of the crop to that point
|
|
28
|
-
* and two zoom buttons and a zoom slider change its size. The frame
|
|
27
|
+
* `0` resets. Every drag has a single-pointer alternative: a click in the picture moves the centre of the crop to that point
|
|
28
|
+
* (not with `variant="free"`), and two zoom buttons and a zoom slider change its size. The frame
|
|
29
29
|
* is a named group; the component announces changes in a polite live region after a short pause.
|
|
30
30
|
*
|
|
31
31
|
* **The value.** The form value is the crop rectangle in source pixels, `x,y,width,height` (`"120,40,600,600"`): a server crops
|
|
@@ -82,7 +82,7 @@ type Tool = ImageEditorTool;
|
|
|
82
82
|
* - **The panel** contains the controls of the tool: beside the picture on a wide surface, under it on a narrow one. On a wide
|
|
83
83
|
* surface it has the name of the tool and its reset.
|
|
84
84
|
* - **Crop**: a frame with L-shaped grips is over the picture, as in `<bk-image-crop variant="free">`. Drag in the frame
|
|
85
|
-
* to move it. Drag a grip to change its size. Drag outside the frame to draw a new frame. A click
|
|
85
|
+
* to move it. Drag a grip to change its size. Drag outside the frame to draw a new frame. A click without a drag changes nothing.
|
|
86
86
|
* While the frame moves, thirds help to place it, and the bar under the picture shows its size. The panel has the format (`formats`, with a
|
|
87
87
|
* button that swaps width and height), quarter turns and mirrors (a turn animates) and a slider that straightens the
|
|
88
88
|
* picture from its centre. The slider turns the picture live under a fine grid, snaps to 0 and cuts the empty corners off; a double click
|