@bk2k/ui 0.6.8 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/BUILDING.md +56 -2
  2. package/CHANGELOG.md +136 -0
  3. package/USAGE.md +89 -26
  4. package/custom-elements.json +1 -1
  5. package/dist/charts/chart-tokens.js +1 -1
  6. package/dist/charts/fields.d.ts +20 -0
  7. package/dist/charts/fields.js +27 -0
  8. package/dist/charts/frame.js +2 -1
  9. package/dist/clipboard.js +1 -0
  10. package/dist/components/bk-alert.js +2 -1
  11. package/dist/components/bk-avatar-group.js +4 -6
  12. package/dist/components/bk-avatar.d.ts +10 -0
  13. package/dist/components/bk-avatar.js +17 -0
  14. package/dist/components/bk-bar.js +2 -0
  15. package/dist/components/bk-button-group.js +1 -1
  16. package/dist/components/bk-button-top.js +2 -1
  17. package/dist/components/bk-button.d.ts +37 -14
  18. package/dist/components/bk-button.js +52 -16
  19. package/dist/components/bk-card.d.ts +4 -0
  20. package/dist/components/bk-card.js +15 -2
  21. package/dist/components/bk-carousel-controls.d.ts +2 -0
  22. package/dist/components/bk-carousel-controls.js +4 -2
  23. package/dist/components/bk-chart-area.d.ts +6 -0
  24. package/dist/components/bk-chart-bar.d.ts +17 -0
  25. package/dist/components/bk-chart-bar.js +25 -4
  26. package/dist/components/bk-chart-line.d.ts +13 -0
  27. package/dist/components/bk-chart-line.js +11 -1
  28. package/dist/components/bk-chip-group.d.ts +2 -2
  29. package/dist/components/bk-chip-group.js +4 -0
  30. package/dist/components/bk-chip.d.ts +53 -8
  31. package/dist/components/bk-chip.js +43 -7
  32. package/dist/components/bk-code.js +6 -2
  33. package/dist/components/bk-columns.d.ts +11 -0
  34. package/dist/components/bk-columns.js +8 -1
  35. package/dist/components/bk-combobox.d.ts +1 -1
  36. package/dist/components/bk-combobox.js +2 -1
  37. package/dist/components/bk-delta.d.ts +10 -0
  38. package/dist/components/bk-delta.js +8 -6
  39. package/dist/components/bk-dialog.d.ts +12 -5
  40. package/dist/components/bk-dialog.js +14 -6
  41. package/dist/components/bk-disclosure.js +4 -2
  42. package/dist/components/bk-drop-target.d.ts +7 -1
  43. package/dist/components/bk-drop-target.js +20 -4
  44. package/dist/components/bk-error-summary.d.ts +5 -0
  45. package/dist/components/bk-error-summary.js +13 -4
  46. package/dist/components/bk-facts.js +3 -2
  47. package/dist/components/bk-footnote.d.ts +73 -0
  48. package/dist/components/bk-footnote.js +97 -0
  49. package/dist/components/bk-footnotes-item.d.ts +92 -0
  50. package/dist/components/bk-footnotes-item.js +139 -0
  51. package/dist/components/bk-footnotes.d.ts +51 -0
  52. package/dist/components/bk-footnotes.js +43 -0
  53. package/dist/components/bk-icon.js +2 -2
  54. package/dist/components/bk-image-compare.d.ts +33 -5
  55. package/dist/components/bk-image-compare.js +72 -24
  56. package/dist/components/bk-image-crop.d.ts +3 -3
  57. package/dist/components/bk-image-editor.d.ts +1 -1
  58. package/dist/components/bk-image-viewer.d.ts +107 -11
  59. package/dist/components/bk-image-viewer.js +205 -34
  60. package/dist/components/bk-input-inline.d.ts +15 -6
  61. package/dist/components/bk-input-inline.js +22 -6
  62. package/dist/components/bk-input-number.js +2 -1
  63. package/dist/components/bk-input-search.d.ts +1 -1
  64. package/dist/components/bk-input-search.js +2 -1
  65. package/dist/components/bk-input-text.d.ts +11 -0
  66. package/dist/components/bk-input-text.js +17 -3
  67. package/dist/components/bk-input-time.js +2 -1
  68. package/dist/components/bk-item.js +2 -1
  69. package/dist/components/bk-lightbox.d.ts +12 -3
  70. package/dist/components/bk-lightbox.js +6 -3
  71. package/dist/components/bk-link.d.ts +9 -1
  72. package/dist/components/bk-link.js +14 -4
  73. package/dist/components/bk-menu-item.d.ts +40 -0
  74. package/dist/components/bk-menu-item.js +57 -9
  75. package/dist/components/bk-menu-label.js +2 -1
  76. package/dist/components/bk-menu-list.d.ts +1 -0
  77. package/dist/components/bk-menu-list.js +10 -0
  78. package/dist/components/bk-menu.d.ts +8 -1
  79. package/dist/components/bk-menu.js +16 -5
  80. package/dist/components/bk-message-feedback.d.ts +4 -3
  81. package/dist/components/bk-message-feedback.js +7 -5
  82. package/dist/components/bk-message-list.js +2 -1
  83. package/dist/components/bk-message-source.d.ts +1 -2
  84. package/dist/components/bk-message-source.js +3 -11
  85. package/dist/components/bk-message.js +2 -0
  86. package/dist/components/bk-nav-group.js +1 -1
  87. package/dist/components/bk-nav-item.d.ts +18 -0
  88. package/dist/components/bk-nav-item.js +18 -5
  89. package/dist/components/bk-nav.d.ts +1 -1
  90. package/dist/components/bk-page-cta.js +2 -0
  91. package/dist/components/bk-page-section.d.ts +1 -1
  92. package/dist/components/bk-page-section.js +3 -9
  93. package/dist/components/bk-pane.d.ts +1 -0
  94. package/dist/components/bk-pane.js +7 -5
  95. package/dist/components/bk-panel.d.ts +1 -1
  96. package/dist/components/bk-panel.js +6 -5
  97. package/dist/components/bk-picture.d.ts +17 -4
  98. package/dist/components/bk-picture.js +8 -1
  99. package/dist/components/bk-segmented-item.d.ts +24 -4
  100. package/dist/components/bk-segmented-item.js +37 -5
  101. package/dist/components/bk-segmented.js +2 -13
  102. package/dist/components/bk-select-cascade.d.ts +1 -1
  103. package/dist/components/bk-select-tree.d.ts +1 -1
  104. package/dist/components/bk-select.d.ts +1 -1
  105. package/dist/components/bk-shell-app.d.ts +10 -4
  106. package/dist/components/bk-shell-app.js +32 -9
  107. package/dist/components/bk-shell-sites.d.ts +2 -1
  108. package/dist/components/bk-shell-sites.js +3 -5
  109. package/dist/components/bk-sortable.js +7 -17
  110. package/dist/components/bk-split-grid.d.ts +104 -3
  111. package/dist/components/bk-split-grid.js +425 -2
  112. package/dist/components/bk-stat-group.js +2 -1
  113. package/dist/components/bk-stat.d.ts +17 -0
  114. package/dist/components/bk-stat.js +7 -3
  115. package/dist/components/bk-steps.js +2 -1
  116. package/dist/components/bk-surface.d.ts +2 -0
  117. package/dist/components/bk-surface.js +6 -3
  118. package/dist/components/bk-table.d.ts +1 -1
  119. package/dist/components/bk-table.js +9 -12
  120. package/dist/components/bk-tabs-item.d.ts +45 -7
  121. package/dist/components/bk-tabs-item.js +51 -20
  122. package/dist/components/bk-tabs-panel.d.ts +6 -3
  123. package/dist/components/bk-tabs-panel.js +6 -0
  124. package/dist/components/bk-tabs.d.ts +50 -7
  125. package/dist/components/bk-tabs.js +168 -96
  126. package/dist/components/bk-text.js +2 -1
  127. package/dist/components/bk-toast-group.d.ts +3 -1
  128. package/dist/components/bk-toast-group.js +11 -1
  129. package/dist/components/bk-tooltip.d.ts +3 -1
  130. package/dist/components/bk-tooltip.js +2 -1
  131. package/dist/components/bk-video.js +2 -2
  132. package/dist/components/bk-zoom.d.ts +3 -1
  133. package/dist/components/confirm.d.ts +15 -0
  134. package/dist/components/confirm.js +27 -4
  135. package/dist/i18n/de.js +12 -1
  136. package/dist/i18n/en.d.ts +2 -0
  137. package/dist/i18n/en.js +3 -0
  138. package/dist/i18n.d.ts +16 -2
  139. package/dist/i18n.js +28 -4
  140. package/dist/icons/brands-static.d.ts +3 -0
  141. package/dist/icons/brands-static.js +5 -0
  142. package/dist/icons/core.d.ts +1 -0
  143. package/dist/icons/core.js +2 -0
  144. package/dist/icons/load-static.d.ts +3 -0
  145. package/dist/icons/load-static.js +5 -0
  146. package/dist/icons/load.js +1 -0
  147. package/dist/icons/registry.js +1 -1
  148. package/dist/icons/set/save-as.d.ts +3 -0
  149. package/dist/icons/set/save-as.js +7 -0
  150. package/dist/index.d.ts +3 -0
  151. package/dist/index.js +3 -0
  152. package/dist/internal/announcer.d.ts +8 -1
  153. package/dist/internal/announcer.js +26 -10
  154. package/dist/internal/backdrop.d.ts +19 -0
  155. package/dist/internal/backdrop.js +29 -0
  156. package/dist/internal/busy.d.ts +3 -2
  157. package/dist/internal/busy.js +4 -5
  158. package/dist/internal/choice-field.js +1 -1
  159. package/dist/internal/choice-item.d.ts +17 -6
  160. package/dist/internal/choice-item.js +20 -9
  161. package/dist/internal/cloak.js +3 -0
  162. package/dist/internal/crop-frame.d.ts +1 -1
  163. package/dist/internal/crop-frame.js +2 -7
  164. package/dist/internal/date-field.js +2 -1
  165. package/dist/internal/drag.d.ts +11 -0
  166. package/dist/internal/drag.js +23 -0
  167. package/dist/internal/english-static.d.ts +3 -0
  168. package/dist/internal/english-static.js +5 -0
  169. package/dist/internal/english.d.ts +8 -0
  170. package/dist/internal/english.js +6 -0
  171. package/dist/internal/footnotes.d.ts +56 -0
  172. package/dist/internal/footnotes.js +143 -0
  173. package/dist/internal/handle-menu.js +2 -5
  174. package/dist/internal/late/bk-shell-app.d.ts +4 -0
  175. package/dist/internal/late/bk-shell-app.js +7 -0
  176. package/dist/internal/late/bk-table.d.ts +4 -0
  177. package/dist/internal/late/bk-table.js +17 -0
  178. package/dist/internal/late/handle-menu.d.ts +4 -0
  179. package/dist/internal/late/handle-menu.js +9 -0
  180. package/dist/internal/late/static.d.ts +7 -0
  181. package/dist/internal/late/static.js +5 -0
  182. package/dist/internal/late.d.ts +8 -3
  183. package/dist/internal/late.js +19 -4
  184. package/dist/internal/link.d.ts +2 -0
  185. package/dist/internal/link.js +11 -1
  186. package/dist/internal/own-text.d.ts +8 -0
  187. package/dist/internal/own-text.js +7 -0
  188. package/dist/internal/scope.js +1 -1
  189. package/dist/internal/scroll-lock.d.ts +4 -1
  190. package/dist/internal/scroll-lock.js +17 -4
  191. package/dist/internal/slider.js +2 -1
  192. package/dist/internal/styles.js +3 -0
  193. package/dist/internal/submit.d.ts +23 -0
  194. package/dist/internal/submit.js +57 -0
  195. package/dist/jsx.d.ts +141 -52
  196. package/dist/reset.css +10 -0
  197. package/dist/standalone/all.js +226 -222
  198. package/dist/standalone/appearance.js +1 -1
  199. package/dist/standalone/bk-accordion-item.js +4 -4
  200. package/dist/standalone/bk-accordion.js +2 -2
  201. package/dist/standalone/bk-action-bar.js +3 -3
  202. package/dist/standalone/bk-alert-offline.js +1 -2
  203. package/dist/standalone/bk-alert.js +13 -12
  204. package/dist/standalone/bk-app-state.js +1 -1
  205. package/dist/standalone/bk-attachment.js +4 -4
  206. package/dist/standalone/bk-avatar-group.js +12 -10
  207. package/dist/standalone/bk-avatar.js +14 -4
  208. package/dist/standalone/bk-badge.js +2 -2
  209. package/dist/standalone/bk-bar.js +3 -1
  210. package/dist/standalone/bk-brand.js +3 -3
  211. package/dist/standalone/bk-breadcrumbs.js +5 -5
  212. package/dist/standalone/bk-button-copy.js +5 -5
  213. package/dist/standalone/bk-button-group.js +5 -5
  214. package/dist/standalone/bk-button-share.js +5 -5
  215. package/dist/standalone/bk-button-top.js +9 -8
  216. package/dist/standalone/bk-button.js +62 -30
  217. package/dist/standalone/bk-calendar-event.js +1 -1
  218. package/dist/standalone/bk-calendar-week.js +3 -3
  219. package/dist/standalone/bk-calendar.js +4 -4
  220. package/dist/standalone/bk-card.js +20 -7
  221. package/dist/standalone/bk-carousel-controls.js +7 -6
  222. package/dist/standalone/bk-carousel-item.js +2 -2
  223. package/dist/standalone/bk-carousel.js +1 -1
  224. package/dist/standalone/bk-chart-area.js +1 -1
  225. package/dist/standalone/bk-chart-bar-list.js +8 -8
  226. package/dist/standalone/bk-chart-bar.js +145 -117
  227. package/dist/standalone/bk-chart-bridge.js +7 -7
  228. package/dist/standalone/bk-chart-bullet.js +6 -6
  229. package/dist/standalone/bk-chart-calendar.js +7 -7
  230. package/dist/standalone/bk-chart-heatmap.js +7 -7
  231. package/dist/standalone/bk-chart-histogram.js +5 -5
  232. package/dist/standalone/bk-chart-legend.js +6 -6
  233. package/dist/standalone/bk-chart-line.js +116 -103
  234. package/dist/standalone/bk-chart-mark.js +1 -1
  235. package/dist/standalone/bk-chart-scatter.js +6 -6
  236. package/dist/standalone/bk-chart-sparkline.js +6 -6
  237. package/dist/standalone/bk-chart-stacked-bar.js +7 -7
  238. package/dist/standalone/bk-chart-tracker.js +6 -6
  239. package/dist/standalone/bk-chart-waterfall.js +6 -6
  240. package/dist/standalone/bk-checkbox-group.js +4 -4
  241. package/dist/standalone/bk-checkbox.js +4 -4
  242. package/dist/standalone/bk-chip-group.js +9 -5
  243. package/dist/standalone/bk-chip.js +56 -17
  244. package/dist/standalone/bk-cluster.js +1 -1
  245. package/dist/standalone/bk-code-diff.js +4 -4
  246. package/dist/standalone/bk-code-stack.js +4 -4
  247. package/dist/standalone/bk-code.js +10 -6
  248. package/dist/standalone/bk-color-panel.js +5 -5
  249. package/dist/standalone/bk-columns.js +13 -5
  250. package/dist/standalone/bk-combobox.js +9 -8
  251. package/dist/standalone/bk-command-menu.js +6 -6
  252. package/dist/standalone/bk-command-palette.js +6 -5
  253. package/dist/standalone/bk-composer.js +6 -6
  254. package/dist/standalone/bk-delta.js +11 -10
  255. package/dist/standalone/bk-diagram.js +1 -1
  256. package/dist/standalone/bk-dialog.js +1 -1
  257. package/dist/standalone/bk-disclosure.js +7 -5
  258. package/dist/standalone/bk-divider.js +2 -2
  259. package/dist/standalone/bk-drawer.js +3 -3
  260. package/dist/standalone/bk-drop-target.js +12 -6
  261. package/dist/standalone/bk-empty-state.js +3 -3
  262. package/dist/standalone/bk-error-summary.js +9 -6
  263. package/dist/standalone/bk-facts-item.js +2 -2
  264. package/dist/standalone/bk-facts.js +9 -8
  265. package/dist/standalone/bk-feature.js +3 -3
  266. package/dist/standalone/bk-fieldset.js +3 -3
  267. package/dist/standalone/bk-filter-bar.js +4 -4
  268. package/dist/standalone/bk-folder-browser.js +4 -4
  269. package/dist/standalone/bk-footnote.js +82 -0
  270. package/dist/standalone/bk-footnotes-item.js +122 -0
  271. package/dist/standalone/bk-footnotes.js +37 -0
  272. package/dist/standalone/bk-form-guard.js +2 -2
  273. package/dist/standalone/bk-form-steps.js +3 -3
  274. package/dist/standalone/bk-grid.js +1 -1
  275. package/dist/standalone/bk-icon-tile.js +3 -3
  276. package/dist/standalone/bk-icon.js +1 -1
  277. package/dist/standalone/bk-image-compare.js +88 -47
  278. package/dist/standalone/bk-image-crop.js +6 -6
  279. package/dist/standalone/bk-image-editor.js +1 -1
  280. package/dist/standalone/bk-image-viewer.js +180 -59
  281. package/dist/standalone/bk-input-code.js +4 -4
  282. package/dist/standalone/bk-input-color.js +4 -4
  283. package/dist/standalone/bk-input-date-range.js +2 -2
  284. package/dist/standalone/bk-input-date.js +2 -2
  285. package/dist/standalone/bk-input-file.js +5 -5
  286. package/dist/standalone/bk-input-group.js +4 -4
  287. package/dist/standalone/bk-input-inline.js +17 -10
  288. package/dist/standalone/bk-input-number.js +9 -8
  289. package/dist/standalone/bk-input-rating.js +6 -6
  290. package/dist/standalone/bk-input-rich.js +1 -1
  291. package/dist/standalone/bk-input-search.js +23 -22
  292. package/dist/standalone/bk-input-slider-range.js +5 -5
  293. package/dist/standalone/bk-input-slider.js +5 -5
  294. package/dist/standalone/bk-input-text.js +1 -1
  295. package/dist/standalone/bk-input-time-zone.js +1 -1
  296. package/dist/standalone/bk-input-time.js +29 -28
  297. package/dist/standalone/bk-item-group.js +3 -3
  298. package/dist/standalone/bk-item.js +12 -11
  299. package/dist/standalone/bk-kbd-shortcuts.js +4 -3
  300. package/dist/standalone/bk-kbd.js +68 -1
  301. package/dist/standalone/bk-lightbox.js +11 -7
  302. package/dist/standalone/bk-lines.js +1 -1
  303. package/dist/standalone/bk-link.js +33 -19
  304. package/dist/standalone/bk-listbox-columns.js +6 -6
  305. package/dist/standalone/bk-listbox-item.js +1 -1
  306. package/dist/standalone/bk-listbox-search.js +7 -7
  307. package/dist/standalone/bk-listbox-transfer.js +6 -6
  308. package/dist/standalone/bk-listbox.js +7 -7
  309. package/dist/standalone/bk-logo-wall.js +2 -2
  310. package/dist/standalone/bk-logo.js +3 -3
  311. package/dist/standalone/bk-menu-bar.js +3 -3
  312. package/dist/standalone/bk-menu-context.js +1 -1
  313. package/dist/standalone/bk-menu-divider.js +2 -2
  314. package/dist/standalone/bk-menu-item.js +73 -29
  315. package/dist/standalone/bk-menu-label.js +7 -6
  316. package/dist/standalone/bk-menu-list.js +10 -4
  317. package/dist/standalone/bk-menu.js +19 -10
  318. package/dist/standalone/bk-message-approval.js +4 -4
  319. package/dist/standalone/bk-message-branches.js +3 -3
  320. package/dist/standalone/bk-message-citation.js +10 -10
  321. package/dist/standalone/bk-message-feedback.js +10 -6
  322. package/dist/standalone/bk-message-list.js +6 -5
  323. package/dist/standalone/bk-message-reasoning.js +5 -5
  324. package/dist/standalone/bk-message-source.js +13 -21
  325. package/dist/standalone/bk-message-tool-group.js +5 -5
  326. package/dist/standalone/bk-message-tool.js +5 -5
  327. package/dist/standalone/bk-message.js +6 -4
  328. package/dist/standalone/bk-meter.js +3 -3
  329. package/dist/standalone/bk-model-viewer.js +1 -1
  330. package/dist/standalone/bk-nav-divider.js +2 -2
  331. package/dist/standalone/bk-nav-group.js +6 -6
  332. package/dist/standalone/bk-nav-item.js +31 -23
  333. package/dist/standalone/bk-nav-toc.js +3 -3
  334. package/dist/standalone/bk-nav.js +3 -3
  335. package/dist/standalone/bk-overflow.js +3 -3
  336. package/dist/standalone/bk-page-cta.js +5 -3
  337. package/dist/standalone/bk-page-footer-column.js +2 -2
  338. package/dist/standalone/bk-page-footer.js +3 -3
  339. package/dist/standalone/bk-page-header.js +3 -3
  340. package/dist/standalone/bk-page-hero.js +3 -3
  341. package/dist/standalone/bk-page-pager.js +5 -5
  342. package/dist/standalone/bk-page-section.js +6 -6
  343. package/dist/standalone/bk-pagination.js +6 -6
  344. package/dist/standalone/bk-pane.js +10 -9
  345. package/dist/standalone/bk-panel.js +9 -10
  346. package/dist/standalone/bk-period-nav.js +4 -4
  347. package/dist/standalone/bk-picture.js +24 -15
  348. package/dist/standalone/bk-popover-help.js +3 -3
  349. package/dist/standalone/bk-popover.js +2 -2
  350. package/dist/standalone/bk-presence-cursor.js +2 -2
  351. package/dist/standalone/bk-preview.js +4 -4
  352. package/dist/standalone/bk-progress.js +3 -3
  353. package/dist/standalone/bk-prose.js +3 -3
  354. package/dist/standalone/bk-qr-code.js +1 -1
  355. package/dist/standalone/bk-radio-group.js +4 -4
  356. package/dist/standalone/bk-radio.js +3 -3
  357. package/dist/standalone/bk-rating.js +5 -5
  358. package/dist/standalone/bk-scroll.js +3 -3
  359. package/dist/standalone/bk-segmented-item.js +40 -16
  360. package/dist/standalone/bk-segmented.js +15 -13
  361. package/dist/standalone/bk-select-cascade.js +3 -3
  362. package/dist/standalone/bk-select-tree.js +4 -4
  363. package/dist/standalone/bk-select.js +5 -5
  364. package/dist/standalone/bk-shell-app.js +1 -1221
  365. package/dist/standalone/bk-shell-centered.js +2 -2
  366. package/dist/standalone/bk-shell-sites.js +5 -7
  367. package/dist/standalone/bk-skeleton.js +2 -2
  368. package/dist/standalone/bk-sortable.js +55 -60
  369. package/dist/standalone/bk-spinner.js +2 -2
  370. package/dist/standalone/bk-split-grid.js +318 -41
  371. package/dist/standalone/bk-split.js +4 -4
  372. package/dist/standalone/bk-stack.js +1 -1
  373. package/dist/standalone/bk-stat-group.js +8 -7
  374. package/dist/standalone/bk-stat.js +11 -8
  375. package/dist/standalone/bk-status-dot.js +3 -3
  376. package/dist/standalone/bk-steps-item.js +5 -5
  377. package/dist/standalone/bk-steps.js +8 -7
  378. package/dist/standalone/bk-surface.js +1 -1
  379. package/dist/standalone/bk-swatch-group.js +4 -4
  380. package/dist/standalone/bk-swatch-palette.js +1 -1
  381. package/dist/standalone/bk-swatch.js +2 -2
  382. package/dist/standalone/bk-switch.js +4 -4
  383. package/dist/standalone/bk-table.js +1 -1937
  384. package/dist/standalone/bk-tabs-item.js +58 -35
  385. package/dist/standalone/bk-tabs-panel.js +7 -3
  386. package/dist/standalone/bk-tabs.js +160 -98
  387. package/dist/standalone/bk-tasks-item.js +4 -4
  388. package/dist/standalone/bk-tasks.js +2 -2
  389. package/dist/standalone/bk-testimonial.js +3 -3
  390. package/dist/standalone/bk-text.js +19 -18
  391. package/dist/standalone/bk-time-countdown.js +4 -4
  392. package/dist/standalone/bk-time-relative.js +3 -3
  393. package/dist/standalone/bk-timeline-item.js +4 -4
  394. package/dist/standalone/bk-timeline.js +2 -2
  395. package/dist/standalone/bk-toast-group.js +1 -1
  396. package/dist/standalone/bk-toast.js +4 -4
  397. package/dist/standalone/bk-toolbar.js +2 -2
  398. package/dist/standalone/bk-tooltip.js +8 -7
  399. package/dist/standalone/bk-tree-item.js +6 -6
  400. package/dist/standalone/bk-tree.js +3 -3
  401. package/dist/standalone/bk-video.js +6 -6
  402. package/dist/standalone/bk-visually-hidden.js +2 -2
  403. package/dist/standalone/bk-zoom.js +5 -5
  404. package/dist/standalone/chunks/announcer-D1zrRWwO.js +36 -0
  405. package/dist/standalone/chunks/{appearance-waHnV0kk.js → appearance-CBOJXbmC.js} +1 -1
  406. package/dist/standalone/chunks/{bk-alert-offline-B1bQxOZp.js → bk-alert-offline-Clw0ZSsH.js} +3 -3
  407. package/dist/standalone/chunks/{bk-carousel-BCwIQhG5.js → bk-carousel-Biz7t8sL.js} +4 -4
  408. package/dist/standalone/chunks/{bk-diagram-DWK8CvRZ.js → bk-diagram-D_fQf6SF.js} +5 -5
  409. package/dist/standalone/chunks/{bk-dialog-DX0cPJ1o.js → bk-dialog-DwZyUUHh.js} +59 -25
  410. package/dist/standalone/chunks/{bk-icon-DssFsNuB.js → bk-icon-Bp_flKdv.js} +4 -3
  411. package/dist/standalone/chunks/{bk-image-editor-DXEj9gCu.js → bk-image-editor-BADsoLRL.js} +5 -5
  412. package/dist/standalone/chunks/{bk-input-date-range-Cbx_lpf0.js → bk-input-date-range-DHcJ8-5g.js} +2 -2
  413. package/dist/standalone/chunks/{bk-input-rich-ZB68vziu.js → bk-input-rich-CFhW6vRa.js} +6 -6
  414. package/dist/standalone/chunks/{bk-input-text-DD32uWNO.js → bk-input-text-DviyLBqj.js} +63 -54
  415. package/dist/standalone/chunks/{bk-model-viewer-Dr81ahVv.js → bk-model-viewer-w_Ah4Tvs.js} +4 -4
  416. package/dist/standalone/chunks/{bk-qr-code-QaYvZwOR.js → bk-qr-code-CYMovNVl.js} +3 -3
  417. package/dist/standalone/chunks/bk-shell-app-B2lxHit8.js +1235 -0
  418. package/dist/standalone/chunks/{bk-surface-DkIhrWMt.js → bk-surface-D7e0tErs.js} +9 -7
  419. package/dist/standalone/chunks/{bk-swatch-palette-BNNXTP3w.js → bk-swatch-palette-x13JgJQi.js} +6 -6
  420. package/dist/standalone/chunks/bk-table-CP8n_jy7.js +1944 -0
  421. package/dist/standalone/chunks/{bk-toast-group-BSeO_rPs.js → bk-toast-group-CoL6W7uk.js} +27 -24
  422. package/dist/standalone/chunks/{brush-Bn3lPdHN.js → brush-DALmXSru.js} +18 -2
  423. package/dist/standalone/chunks/{busy-B7Mxemwm.js → busy-BUB22mGY.js} +5 -4
  424. package/dist/standalone/chunks/{chart-tokens-D1Exf7BW.js → chart-tokens-DQ4hVSmn.js} +2 -2
  425. package/dist/standalone/chunks/{choice-field-CGvE4tyb.js → choice-field-poOTerh1.js} +6 -6
  426. package/dist/standalone/chunks/{choice-item-B6-9ZRlf.js → choice-item-Cx-nm1js.js} +17 -8
  427. package/dist/standalone/chunks/{clipboard-Crzt1Sh9.js → clipboard-RqIeP9Uz.js} +1 -1
  428. package/dist/standalone/chunks/{clipboard-BKlrP5rj.js → clipboard-UVLSkL4C.js} +1 -1
  429. package/dist/standalone/chunks/{crop-frame-poLCGrBG.js → crop-frame-Z9N0QML4.js} +1 -11
  430. package/dist/standalone/chunks/{date-field-BlI6grfT.js → date-field-B-fCXa2D.js} +48 -47
  431. package/dist/standalone/chunks/{define-CzVPD4Zi.js → define-DkVeu7e9.js} +1 -1
  432. package/dist/standalone/chunks/drag-DT4__0t9.js +12 -0
  433. package/dist/standalone/chunks/footnotes-BeisMxLk.js +94 -0
  434. package/dist/standalone/chunks/{form-control-CyXQIJ2x.js → form-control-CHpfKAKa.js} +2 -2
  435. package/dist/standalone/chunks/{frame-abXBnl8a.js → frame-xIMVEUCi.js} +5 -4
  436. package/dist/standalone/chunks/{handle-menu-ZVR_msk2.js → handle-menu-BgYUbGO2.js} +26 -19
  437. package/dist/standalone/chunks/{heading-text-CV5gBf7k.js → heading-text-CgnCa_q2.js} +1 -1
  438. package/dist/standalone/chunks/{i18n-B6Al9xCK.js → i18n-DFfGgd3d.js} +49 -34
  439. package/dist/standalone/chunks/{i18n-BI16HQmm.js → i18n-DQAcbHkY.js} +1 -1
  440. package/dist/standalone/chunks/link--YWr8exL.js +69 -0
  441. package/dist/standalone/chunks/{marks-0kbeB4n8.js → marks-pOUDNUf1.js} +2 -2
  442. package/dist/standalone/chunks/{options-DMEc8rQt.js → options-BdC8-KKM.js} +2 -2
  443. package/dist/standalone/chunks/own-text-mpZVnMyX.js +5 -0
  444. package/dist/standalone/chunks/{palettes-CKLHSIPx.js → palettes-J4bQ21ks.js} +2 -2
  445. package/dist/standalone/chunks/{popover-base-ac49G87f.js → popover-base-hxo-Vh6E.js} +2 -2
  446. package/dist/standalone/chunks/{prose-BG4oQH-i.js → prose-BiuJgiah.js} +1 -1
  447. package/dist/standalone/chunks/{ramp-ggoyjMvC.js → ramp-CGDOcqBZ.js} +1 -1
  448. package/dist/standalone/chunks/save-as-DBGZjczB.js +6 -0
  449. package/dist/standalone/chunks/shortcuts-DPxCSO4M.js +210 -0
  450. package/dist/standalone/chunks/{slider-BWT8Fmwz.js → slider-jp3d-Ld-.js} +15 -14
  451. package/dist/standalone/chunks/{stars-BN9M_9Q1.js → stars-BgKEjDQx.js} +1 -1
  452. package/dist/standalone/chunks/{styles-DwSR-9a3.js → styles-CaeyhYDA.js} +3 -0
  453. package/dist/standalone/chunks/submit-BjBGB8OW.js +42 -0
  454. package/dist/standalone/chunks/{summary-BK-B4m5A.js → summary-W5s0TFqV.js} +1 -1
  455. package/dist/standalone/chunks/{text-field-4IUUpRHE.js → text-field-CqhJSAwZ.js} +4 -4
  456. package/dist/standalone/chunks/{toggle-control-ioV2jhNY.js → toggle-control-lvZbQtGW.js} +2 -2
  457. package/dist/standalone/chunks/{tokens-BuahF1lF.js → tokens-C_ul7pL9.js} +4 -3
  458. package/dist/standalone/chunks/{virtual-B-1oN14Y.js → virtual-C_h6sHnm.js} +1 -1
  459. package/dist/standalone/confirm.js +27 -14
  460. package/dist/standalone/i18n-de.js +13 -2
  461. package/dist/standalone/icons.js +100 -98
  462. package/dist/standalone/links.js +1 -1
  463. package/dist/standalone/reset.css +10 -0
  464. package/dist/standalone/toast.js +1 -1
  465. package/dist/standalone/tokens.css +6 -5
  466. package/dist/tokens.css +6 -5
  467. package/dist/tokens.js +4 -3
  468. package/package.json +25 -2
  469. package/dist/standalone/chunks/announcer-haFcvqbe.js +0 -25
  470. package/dist/standalone/chunks/bk-kbd-B_TlKzWj.js +0 -275
  471. package/dist/standalone/chunks/link-CWSMsx04.js +0 -60
@@ -0,0 +1,139 @@
1
+ import { LitElement, css, html, nothing } from "lit";
2
+ import { ifDefined } from "lit/directives/if-defined.js";
3
+ import { LocalizeController } from "../i18n.js";
4
+ import { define } from "../internal/define.js";
5
+ import { addFootnoteNote, clearFootnoteTarget, footnoteLetter, footnotesSettled, isPlainClick, removeFootnoteNote, revealFootnoteTarget, scheduleFootnotes } from "../internal/footnotes.js";
6
+ import { setHostVars } from "../internal/host-vars.js";
7
+ import { LinkController, sourceHost } from "../internal/link.js";
8
+ import { mutationObserver } from "../internal/server.js";
9
+ import { base } from "../internal/styles.js";
10
+ import "./bk-icon.js";
11
+ import "../icons/set/arrow-up.js";
12
+ function formatNoteDate(value, locale) {
13
+ const m = /^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/.exec(value.trim());
14
+ if (!m)
15
+ return value;
16
+ const [, y, mo, d] = m;
17
+ const date = new Date(Date.UTC(Number(y), mo ? Number(mo) - 1 : 0, d ? Number(d) : 1));
18
+ const options = d ? { dateStyle: "medium" } : mo ? { month: "short", year: "numeric" } : { year: "numeric" };
19
+ return new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(date);
20
+ }
21
+ class BkFootnotesItem extends LitElement {
22
+ static properties = {
23
+ href: {},
24
+ target: {},
25
+ rel: {},
26
+ date: {},
27
+ number: { state: true },
28
+ markers: { state: true }
29
+ };
30
+ i18n = new LocalizeController(this);
31
+ links = new LinkController(this);
32
+ internals = this.attachInternals();
33
+ /** The `id` is the name of the note: a new id numbers the page again. */
34
+ ids = mutationObserver(() => scheduleFootnotes());
35
+ constructor() {
36
+ super();
37
+ this.markers = [];
38
+ this.internals.role = "listitem";
39
+ }
40
+ connectedCallback() {
41
+ super.connectedCallback();
42
+ addFootnoteNote(this);
43
+ this.ids.observe(this, { attributes: true, attributeFilter: ["id"] });
44
+ }
45
+ disconnectedCallback() {
46
+ super.disconnectedCallback();
47
+ this.ids.disconnect();
48
+ removeFootnoteNote(this);
49
+ clearFootnoteTarget(this);
50
+ }
51
+ /** @internal */
52
+ setFootnoteState(number, markers) {
53
+ if (this.number !== number)
54
+ this.number = number;
55
+ if (markers.length !== this.markers.length || markers.some((m, i) => m !== this.markers[i]))
56
+ this.markers = markers;
57
+ }
58
+ /** Moves the focus to the note, scrolls to it and marks it. A marker calls it. */
59
+ reveal() {
60
+ revealFootnoteTarget(this, this.internals, this.renderRoot.querySelector(".body"));
61
+ }
62
+ updated() {
63
+ setHostVars(this, { "--_bk-footnotes-item-order": this.number === void 0 ? "" : String(this.number) });
64
+ }
65
+ async getUpdateComplete() {
66
+ const done = await super.getUpdateComplete();
67
+ await footnotesSettled();
68
+ return await super.getUpdateComplete() && done;
69
+ }
70
+ static styles = [base, css`
71
+ :host {
72
+ display: grid; grid-column: 1 / -1; align-items: baseline; min-width: 0;
73
+ grid-template-columns: var(--_bk-footnotes-subgrid, auto minmax(0, 1fr));
74
+ column-gap: var(--_bk-footnotes-gap, var(--bk-space-2));
75
+ order: var(--_bk-footnotes-item-order, 0);
76
+ border-radius: var(--bk-footnotes-item-radius, var(--bk-radius-xs));
77
+ scroll-margin-block: var(--bk-footnotes-item-scroll-margin, calc(var(--bk-shell-app-sticky-top, var(--bk-height-header, calc(var(--bk-control-md) + var(--bk-space-5)))) + var(--bk-space-4)));
78
+ transition: background-color var(--bk-duration-slow) var(--bk-ease), box-shadow var(--bk-duration-slow) var(--bk-ease);
79
+ }
80
+ /* The mark spreads around the note with a ring of its own colour: the text keeps its place. */
81
+ :host(:state(target)) {
82
+ background: var(--bk-footnotes-item-target-bg, var(--bk-accent-soft));
83
+ box-shadow: 0 0 0 var(--bk-space-1) var(--bk-footnotes-item-target-bg, var(--bk-accent-soft));
84
+ }
85
+ .number { color: var(--bk-footnotes-item-number-fg, var(--bk-text-muted)); font-variant-numeric: tabular-nums; text-align: end; }
86
+ .body { min-width: 0; overflow-wrap: break-word; border-radius: var(--bk-footnotes-item-radius, var(--bk-radius-xs)); }
87
+ .body:focus { outline: none; }
88
+ .body:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset); }
89
+ .part::before { content: "·" / ""; margin-inline: var(--bk-footnotes-item-separator-gap, var(--bk-space-1)); }
90
+ a { position: relative; color: var(--bk-footnotes-item-link-fg, var(--bk-link)); border-radius: var(--bk-radius-xs); }
91
+ .source { text-decoration: underline; text-underline-offset: 0.2em; }
92
+ @media (hover: hover) { a:hover { color: var(--bk-footnotes-item-link-hover-fg, var(--bk-link-hover)); } }
93
+ a:focus { outline: none; }
94
+ a:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset); }
95
+ /* The hit area is at least --bk-target-min; the visible arrow and letters stay small. */
96
+ .back::before { content: ""; position: absolute; inset: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
97
+ .backs { display: inline-flex; align-items: baseline; margin-inline-start: var(--bk-space-1-5); white-space: nowrap; }
98
+ /* Each back link is as wide as the smallest target, so the letters a, b, … are targets that do not overlap. */
99
+ .back {
100
+ display: inline-flex; justify-content: center; align-self: center; min-inline-size: var(--bk-target-min);
101
+ text-decoration: none; font-weight: var(--bk-weight-medium);
102
+ }
103
+ @media (hover: hover) { .back:hover { text-decoration: underline; } }
104
+ bk-icon { --bk-icon-size: 1em; color: var(--bk-footnotes-item-number-fg, var(--bk-text-muted)); align-self: center; }
105
+ .back bk-icon { color: inherit; }
106
+ @media (forced-colors: active) {
107
+ a { color: LinkText; }
108
+ :host(:state(target)) { outline: var(--bk-border-width) solid Highlight; }
109
+ }
110
+ `];
111
+ onBack = (e) => {
112
+ if (!isPlainClick(e))
113
+ return;
114
+ e.preventDefault();
115
+ const i = Number(e.currentTarget.dataset.index);
116
+ this.markers[i]?.reveal();
117
+ };
118
+ renderBacks() {
119
+ const markers = this.markers;
120
+ if (!markers.length || this.number === void 0)
121
+ return nothing;
122
+ const label = (i) => this.i18n.t("footnoteBack", { label: markers.length > 1 ? `${this.number}${footnoteLetter(i)}` : String(this.number) });
123
+ if (markers.length === 1) {
124
+ return html`<span class="backs"><a class="back" part="back" href="#" data-index="0" aria-label=${label(0)} @click=${this.onBack}><bk-icon name="arrow-up"></bk-icon></a></span>`;
125
+ }
126
+ return html`<span class="backs"><bk-icon name="arrow-up"></bk-icon>${markers.map((_, i) => html`<a class="back" part="back" href="#" data-index=${i} aria-label=${label(i)} @click=${this.onBack}>${footnoteLetter(i)}</a>`)}</span>`;
127
+ }
128
+ render() {
129
+ const locale = this.i18n.locale;
130
+ const host = this.href ? sourceHost(this.href) || this.href : "";
131
+ return html`<span class="number" part="number">${this.number ?? nothing}</span>
132
+ <span class="body" part="body" tabindex="-1"><slot></slot>${this.href ? html`<span class="part"><a class="source" part="source" href=${this.links.href(this.href)} target=${ifDefined(this.target)} rel=${ifDefined(this.rel)} @click=${this.links.click}>${host}</a></span>` : nothing}${this.date ? html`<span class="part"><time part="date" datetime=${this.date}>${this.i18n.t("footnoteAsOf", { date: formatNoteDate(this.date, locale) })}</time></span>` : nothing}${this.renderBacks()}</span>`;
133
+ }
134
+ }
135
+ define("bk-footnotes-item", BkFootnotesItem);
136
+ export {
137
+ BkFootnotesItem
138
+ };
139
+ //# sourceMappingURL=bk-footnotes-item.js.map
@@ -0,0 +1,51 @@
1
+ import { LitElement } from "lit";
2
+ import "./bk-footnotes-item.js";
3
+ /**
4
+ * The list of the notes of a page or of a part of it: the sources and the remarks that the markers
5
+ * (`<bk-footnote>`) in the text refer to. Put it at the end of the content, in a `bk-page-section` or in the footer
6
+ * of the page, under a heading of the app ("Sources", "Notes").
7
+ *
8
+ * ```html
9
+ * <p>Prices rose by 2.1 %<bk-footnote note="cpi"></bk-footnote> in a year.</p>
10
+ * <bk-footnotes>
11
+ * <bk-footnotes-item id="cpi" href="https://example.com/cpi" date="2026-11">Statistics office, consumer price index.</bk-footnotes-item>
12
+ * </bk-footnotes>
13
+ * ```
14
+ *
15
+ * - Each list numbers its own notes from 1, in the order of their first marker on the page. A note without a marker
16
+ * gets a number after them. A second list (the notes of a table) starts again at 1.
17
+ * - The list shows the notes in the order of their numbers. Write them in this order too: screen readers and the
18
+ * Tab key follow the order of the markup.
19
+ * - The notes are smaller than the body text and muted.
20
+ *
21
+ * Content, no surface.
22
+ *
23
+ * @slot - The `<bk-footnotes-item>` elements.
24
+ * @cssprop --bk-footnotes-fg - Colour of the text of the notes (default --bk-text-muted).
25
+ * @cssprop --bk-footnotes-font-size - Text size of the notes (default --bk-type-small).
26
+ * @cssprop --bk-footnotes-gap - Space between the number and the text (default --bk-space-2).
27
+ * @cssprop --bk-footnotes-row-gap - Space between the notes (default --bk-space-1-5).
28
+ *
29
+ * @tag bk-footnotes
30
+ * @a11y The list is a `list` with the name "Footnotes" (i18n `footnotes`; `label` sets another name). Each note is a `listitem`.
31
+ */
32
+ export declare class BkFootnotes extends LitElement {
33
+ static properties: {
34
+ label: {};
35
+ };
36
+ /** Accessible name of the list (default: "Footnotes", i18n `footnotes`). */
37
+ label: string | undefined;
38
+ private i18n;
39
+ private internals;
40
+ constructor();
41
+ connectedCallback(): void;
42
+ protected willUpdate(): void;
43
+ static styles: import("lit").CSSResult[];
44
+ render(): import("lit-html").TemplateResult<1>;
45
+ }
46
+ declare global {
47
+ interface HTMLElementTagNameMap {
48
+ "bk-footnotes": BkFootnotes;
49
+ }
50
+ }
51
+ //# sourceMappingURL=bk-footnotes.d.ts.map
@@ -0,0 +1,43 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { LocalizeController } from "../i18n.js";
3
+ import { define } from "../internal/define.js";
4
+ import { scheduleFootnotes } from "../internal/footnotes.js";
5
+ import { base } from "../internal/styles.js";
6
+ import "./bk-footnotes-item.js";
7
+ class BkFootnotes extends LitElement {
8
+ static properties = {
9
+ label: {}
10
+ };
11
+ i18n = new LocalizeController(this);
12
+ internals = this.attachInternals();
13
+ constructor() {
14
+ super();
15
+ this.internals.role = "list";
16
+ }
17
+ connectedCallback() {
18
+ super.connectedCallback();
19
+ scheduleFootnotes();
20
+ }
21
+ willUpdate() {
22
+ this.internals.ariaLabel = this.label || this.i18n.t("footnotes");
23
+ }
24
+ static styles = [base, css`
25
+ :host {
26
+ display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; min-width: 0;
27
+ column-gap: var(--bk-footnotes-gap, var(--bk-space-2));
28
+ row-gap: var(--bk-footnotes-row-gap, var(--bk-space-1-5));
29
+ font-size: var(--bk-footnotes-font-size, var(--bk-type-small)); line-height: var(--bk-line-height-body);
30
+ color: var(--bk-footnotes-fg, var(--bk-text-muted));
31
+ }
32
+ /* The numbers of all notes share one column: the texts start on one line. */
33
+ ::slotted(bk-footnotes-item) { --_bk-footnotes-subgrid: subgrid; --_bk-footnotes-gap: var(--bk-footnotes-gap, var(--bk-space-2)); }
34
+ `];
35
+ render() {
36
+ return html`<slot></slot>`;
37
+ }
38
+ }
39
+ define("bk-footnotes", BkFootnotes);
40
+ export {
41
+ BkFootnotes
42
+ };
43
+ //# sourceMappingURL=bk-footnotes.js.map
@@ -2,7 +2,7 @@ import { LitElement, css, isServer, nothing } from "lit";
2
2
  import { define } from "../internal/define.js";
3
3
  import { base } from "../internal/styles.js";
4
4
  import { getIcon, onIconsChanged } from "../icons/registry.js";
5
- import { iconLoaders } from "../icons/load.js";
5
+ import { iconLoaders } from "#bk/icons/load.js";
6
6
  class BkIcon extends LitElement {
7
7
  static properties = {
8
8
  name: { reflect: true, useDefault: true },
@@ -83,7 +83,7 @@ function loadIcon(name) {
83
83
  load().catch(() => console.warn(`<bk-icon>: cannot load the icon "${name}".`));
84
84
  return;
85
85
  }
86
- console.warn(`<bk-icon>: unknown icon "${name}". Register it with registerIcons(): it is not in the core set of @bk2k/ui.`);
86
+ console.warn(`<bk-icon>: no code loaded the icon "${name}". For an icon of the core set, add: import "@bk2k/ui/icons/${name}.js"; for another icon, register it with registerIcons().`);
87
87
  }
88
88
  const templates = /* @__PURE__ */ new Map();
89
89
  function template(name) {
@@ -13,6 +13,8 @@ import "../icons/set/group.js";
13
13
  export type ImageCompareVariant = "slider" | "side" | "toggle";
14
14
  /** One of the two pictures. */
15
15
  export type ImageCompareSide = "before" | "after";
16
+ /** The zoom (1 to 8) and the point of the pictures in the centre, as fractions of their width and height. */
17
+ export type ImageCompareView = PanZoomView;
16
18
  /**
17
19
  * Two pictures of the same subject, for example a photo and its edit, or an image and
18
20
  * its upscale. The pictures must have the same shape.
@@ -36,11 +38,26 @@ export type ImageCompareSide = "before" | "after";
36
38
  * The box uses the shape of the after picture when it loads (4 / 3 before). The pictures are on the
37
39
  * dark media backdrop in both themes, as in `<bk-image-viewer>`.
38
40
  *
41
+ * Content instead of pictures: fill the slot `before` or `after` with any content, for example two cards
42
+ * with the same layout. The slot replaces the picture of its side, and the `*-src` attributes still work
43
+ * for the other side. Both sides lie in one grid cell, so the box takes the size of the larger side (no
44
+ * ratio). The divider cuts the before side as it cuts a picture. Each side has a surface
45
+ * (`--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.
46
+ * Each side is a `group` with its label as its name. Assistive technology reads both sides in full, also the
47
+ * part that the divider hides. Tab reaches interactive content in both sides, also in the hidden part. So
48
+ * use content that is not interactive, or that stays correct when its hidden part has focus. A side that the
49
+ * divider hides completely (`position` 0 or 100) is `inert`. The pointer works in the content as usual:
50
+ * only the divider and its grip start a drag.
51
+ *
39
52
  * i18n keys: `imageCompare` (the name of the group), `compareBefore`, `compareAfter`, `compareDivider`,
40
53
  * `compareShown`, `compareShow`, `compareZoomHelp`, and the keys of `<bk-zoom>`.
41
54
  *
55
+ * @slot before - Content for the before side. It replaces the before picture.
56
+ * @slot after - Content for the after side. It replaces the after picture.
42
57
  * @csspart view - The box of the pictures. It handles the zoom keys with `zoomable`.
43
- * @csspart stage - The box of one picture.
58
+ * @csspart stage - The box of the pictures (`side`: the box of one picture).
59
+ * @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.
60
+ * @csspart after - The box of the after side, as `before`.
44
61
  * @csspart image - One `<img>`.
45
62
  * @csspart tag - The label of a picture in a top corner (`slider`).
46
63
  * @csspart divider - The area around the line that the user drags (`slider`). It is a `slider` for assistive technology.
@@ -51,11 +68,12 @@ export type ImageCompareSide = "before" | "after";
51
68
  * @csspart zoom - The zoom control (`zoomable`).
52
69
  * @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
70
  * @cssprop --bk-image-compare-color-scheme - Colour scheme of the tags and the zoom control over the pictures (default dark).
71
+ * @cssprop --bk-image-compare-content-bg - Surface of a side with slotted content (default --bk-layer-base-bg).
54
72
  * @cssprop --bk-image-compare-bg - Background around a picture that does not fill its box (default --bk-media-backdrop).
55
73
  * @cssprop --bk-image-compare-radius - Corner radius of a picture box (default --bk-radius-md).
56
74
  * @cssprop --bk-image-compare-gap - Space between the pictures (`side`) and between the pictures and the parts under them (default --bk-space-2).
57
75
  * @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).
76
+ * @cssprop --bk-image-compare-divider-color - Colour of the divider line (default --bk-on-media, --bk-accent-solid with content).
59
77
  * @cssprop --bk-image-compare-divider-width - Thickness of the divider line (default 2 × --bk-border-width).
60
78
  * @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
79
  * @cssprop --bk-image-compare-handle-size - Size of the grip on the divider (default --bk-control-md).
@@ -72,6 +90,7 @@ export type ImageCompareSide = "before" | "after";
72
90
  * @cssprop --bk-image-compare-caption-color - Colour of the captions (default --bk-text-muted).
73
91
  * @fires {Event} input - The element fires this event while the user moves the divider.
74
92
  * @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`).
93
+ * @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
94
  *
76
95
  * @tag bk-image-compare
77
96
  * @keyboard ←, → - On the divider: move it. The arrows follow the writing direction. Shift: larger steps.
@@ -143,15 +162,24 @@ export declare class BkImageCompare extends LitElement {
143
162
  private sliding;
144
163
  private i18n;
145
164
  private pz;
165
+ /** While true, a change of the view is not a change of the user: no `viewchange`. */
166
+ private quiet;
167
+ private viewChanged;
146
168
  private internals;
169
+ private slots;
147
170
  constructor();
148
171
  static styles: import("lit").CSSResult[];
149
172
  /** 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(): PanZoomView;
151
- set view(v: Partial<PanZoomView>);
152
- /** Shows the whole picture again. */
173
+ get view(): ImageCompareView;
174
+ /** Setting the view fires no `viewchange`. */
175
+ set view(v: Partial<ImageCompareView>);
176
+ /** Shows the whole picture again. It fires no `viewchange`. */
153
177
  resetZoom(): void;
178
+ private silently;
179
+ private onViewChange;
180
+ protected updated(): void;
154
181
  protected willUpdate(changed: PropertyValues<this>): void;
182
+ private get content();
155
183
  private get single();
156
184
  private get mode();
157
185
  private labelOf;
@@ -3,9 +3,10 @@ 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";
9
10
  import "./bk-icon.js";
10
11
  import "./bk-segmented.js";
11
12
  import "./bk-button.js";
@@ -34,8 +35,12 @@ class BkImageCompare extends LitElement {
34
35
  sliding: { state: true }
35
36
  };
36
37
  i18n = new LocalizeController(this);
37
- pz = new PanZoom(this, { max: MAX_ZOOM });
38
+ pz = new PanZoom(this, { max: MAX_ZOOM, onChange: () => this.onViewChange() });
39
+ /** While true, a change of the view is not a change of the user: no `viewchange`. */
40
+ quiet = false;
41
+ viewChanged = false;
38
42
  internals = this.attachInternals();
43
+ slots = new SlotController(this);
39
44
  constructor() {
40
45
  super();
41
46
  this.beforeSrc = "";
@@ -80,8 +85,17 @@ class BkImageCompare extends LitElement {
80
85
  border-radius: max(0px, calc(var(--_bk-image-compare-radius) - var(--bk-border-width)));
81
86
  background: var(--bk-image-compare-bg, var(--bk-media-backdrop));
82
87
  }
88
+ /* Content: the sides lie in one grid cell, and the larger side gives the size of the box. */
89
+ .stage.content { display: grid; aspect-ratio: auto; user-select: text; -webkit-user-select: text; }
90
+ .stage.content::before { display: none; }
91
+ .stage.content > .layer { position: relative; inset: auto; grid-area: 1 / 1; min-inline-size: 0; }
92
+ .layer.slotted {
93
+ display: grid; grid-template-columns: minmax(0, 1fr);
94
+ background: var(--bk-image-compare-content-bg, var(--bk-layer-base-bg));
95
+ }
83
96
  .side .stage.after { grid-column: 2; }
84
- .layer { position: absolute; inset: 0; }
97
+ /* The box of one side has the corners of the pictures: a ring on the part follows them. */
98
+ .layer { position: absolute; inset: 0; border-radius: inherit; }
85
99
  .layer.hidden { visibility: hidden; }
86
100
  .frame { position: absolute; inset: 0; transform-origin: 0 0; transition: transform var(--bk-duration-fast) var(--bk-ease); }
87
101
  .frame.instant { transition: none; }
@@ -110,6 +124,8 @@ class BkImageCompare extends LitElement {
110
124
  /* The line lies in a box with the corners of the pictures: at the ends it does not cross the rounded edge. */
111
125
  .rail { position: absolute; z-index: 0; inset: 0; overflow: hidden; border-radius: var(--_bk-image-compare-radius); }
112
126
  .line.ends { visibility: hidden; }
127
+ /* Content lies on a surface of the page, not on the dark backdrop: the line needs the accent. */
128
+ .view.has-content .line { background: var(--bk-image-compare-divider-color, var(--bk-accent-solid)); }
113
129
  .line {
114
130
  position: absolute; inset-block: 0; inset-inline-start: var(--_bk-image-compare-pos);
115
131
  --_bk-image-compare-line: var(--bk-image-compare-divider-width, calc(2 * var(--bk-border-width)));
@@ -173,29 +189,54 @@ class BkImageCompare extends LitElement {
173
189
  get view() {
174
190
  return this.pz.get();
175
191
  }
192
+ /** Setting the view fires no `viewchange`. */
176
193
  set view(v) {
177
- this.pz.set(v);
194
+ this.silently(() => this.pz.set(v));
178
195
  }
179
- /** Shows the whole picture again. */
196
+ /** Shows the whole picture again. It fires no `viewchange`. */
180
197
  resetZoom() {
181
- this.pz.set({ zoom: 1 });
198
+ this.silently(() => this.pz.set({ zoom: 1 }));
199
+ }
200
+ silently(fn) {
201
+ const was = this.quiet;
202
+ this.quiet = true;
203
+ try {
204
+ fn();
205
+ } finally {
206
+ this.quiet = was;
207
+ }
208
+ }
209
+ onViewChange() {
210
+ this.requestUpdate();
211
+ if (!this.quiet)
212
+ this.viewChanged = true;
213
+ }
214
+ updated() {
215
+ if (!this.viewChanged)
216
+ return;
217
+ this.viewChanged = false;
218
+ emitDetail(this, "viewchange", this.view);
182
219
  }
183
220
  willUpdate(changed) {
184
221
  if (changed.has("position"))
185
222
  this.position = clamp(Number(this.position) || 0, 0, 100);
186
223
  if (changed.has("afterSrc") || changed.has("beforeSrc"))
187
224
  this.ratio = 0;
188
- if (changed.has("zoomable")) {
189
- this.pz.enabled = this.zoomable;
190
- if (!this.zoomable)
191
- this.pz.set({ zoom: 1 });
225
+ const zoom = this.zoomable && !this.content;
226
+ if (this.pz.enabled !== zoom) {
227
+ this.pz.enabled = zoom;
228
+ if (!zoom)
229
+ this.silently(() => this.pz.set({ zoom: 1 }));
192
230
  }
193
231
  if (changed.has("label") || changed.has("beforeLabel") || changed.has("afterLabel")) {
194
232
  this.internals.ariaLabel = this.label || this.i18n.t("imageCompare");
195
233
  }
196
234
  }
235
+ get content() {
236
+ return this.slots.has("before") || this.slots.has("after");
237
+ }
197
238
  get single() {
198
- return !this.beforeSrc;
239
+ return !this.beforeSrc && !this.slots.has("before");
199
240
  }
200
241
  get mode() {
201
242
  return this.single ? "single" : this.variant;
@@ -288,25 +329,32 @@ class BkImageCompare extends LitElement {
288
329
  render() {
289
330
  const mode = this.mode;
290
331
  const shown = mode === "single" ? "after" : this.show === "before" ? "before" : "after";
332
+ const content = this.content;
333
+ const zoomable = this.zoomable && !content;
291
334
  const zoomed = this.pz.zoom > 1;
292
335
  const transform = this.pz.transform();
293
336
  const sel = ".stage";
294
337
  const layer = (side) => {
295
338
  const src = side === "before" ? this.beforeSrc : this.afterSrc;
296
339
  const hidden = mode === "toggle" && side !== shown;
297
- return html`<div class="layer ${side} ${hidden ? "hidden" : ""}" aria-hidden=${ifDefined(hidden ? "true" : void 0)}>
298
- <div class="frame ${this.pz.instant ? "instant" : ""}" style=${styleMap({ transform })}>
299
- ${src ? html`<img part="image" src=${src} alt=${this.labelOf(side)} decoding="async" draggable="false"
340
+ const slotted = this.slots.has(side);
341
+ const cut = mode === "slider" && (side === "before" ? this.position <= 0 : this.position >= 100);
342
+ return html`<div class="layer ${side} ${hidden ? "hidden" : ""} ${slotted ? "slotted" : ""}" part=${side}
343
+ role=${ifDefined(slotted ? "group" : void 0)} aria-label=${ifDefined(slotted ? this.labelOf(side) : void 0)}
344
+ aria-hidden=${ifDefined(hidden ? "true" : void 0)} ?inert=${slotted && cut}>
345
+ <slot name=${side}></slot>
346
+ <div class="frame ${this.pz.instant ? "instant" : ""}" style=${styleMap({ transform })} ?hidden=${slotted}>
347
+ ${src && !slotted ? html`<img part="image" src=${src} alt=${this.labelOf(side)} decoding="async" draggable="false"
300
348
  @load=${(e) => this.onLoad(side, e)}>` : nothing}
301
349
  </div>
302
350
  </div>`;
303
351
  };
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" ? nothing : layer("before")}${layer("after")}</div>`;
352
+ 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
353
  const pct = Math.round(this.position);
306
354
  const percent = new Intl.NumberFormat(this.i18n.locale, { style: "percent", maximumFractionDigits: 0 }).format(pct / 100);
307
355
  const slider = mode === "slider" ? html`
308
- <div class="tags before"><span class="tag" part="tag">${this.labelOf("before")}</span></div>
309
- <div class="tags after"><span class="tag" part="tag">${this.labelOf("after")}</span></div>
356
+ ${content ? nothing : html`<div class="tags before"><span class="tag" part="tag">${this.labelOf("before")}</span></div>
357
+ <div class="tags after"><span class="tag" part="tag">${this.labelOf("after")}</span></div>`}
310
358
  <div class="divider" part="divider" role="slider" tabindex="0"
311
359
  aria-label=${this.i18n.t("compareDivider", { before: this.labelOf("before"), after: this.labelOf("after") })}
312
360
  aria-orientation="horizontal" aria-valuemin="0" aria-valuemax="100" aria-valuenow=${pct}
@@ -317,17 +365,17 @@ class BkImageCompare extends LitElement {
317
365
  @pointerdown=${this.onDividerDown} @pointermove=${this.onDividerMove} @pointerup=${this.onDividerUp}
318
366
  @pointercancel=${this.onDividerUp}><bk-icon name="chevron-left"></bk-icon><bk-icon name="chevron-right"></bk-icon></span>
319
367
  <div class="rail"><span class="line ${this.position <= 0 || this.position >= 100 ? "ends" : ""}" part="line"></span></div>` : nothing;
320
- const zoom = this.zoomable ? html`<span class="zoom" part="zoom"><bk-zoom variant="compact" size="sm" min="1" max=${MAX_ZOOM} .value=${this.pz.zoom}
368
+ 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
369
  @input=${this.onZoomInput} @change=${(e) => e.stopPropagation()}>
322
370
  <bk-button slot="end" variant="ghost" size="sm" icon="fit-screen" label=${this.i18n.t("zoomFit")} ?disabled=${this.pz.zoom <= 1}
323
- @click=${() => this.resetZoom()}></bk-button>
371
+ @click=${() => this.pz.set({ zoom: 1 })}></bk-button>
324
372
  </bk-zoom></span>` : nothing;
325
373
  return html`<div class="compare">
326
- <div class="view ${mode} ${this.zoomable ? "zoomable" : ""} ${zoomed ? "zoomed" : ""}" part="view"
374
+ <div class="view ${mode} ${content ? "has-content" : ""} ${zoomable ? "zoomable" : ""} ${zoomed ? "zoomed" : ""}" part="view"
327
375
  style=${styleMap({ "--_bk-image-compare-ratio": this.ratio || void 0, "--_bk-image-compare-pos": `${this.position}%` })}
328
- tabindex=${ifDefined(this.zoomable ? "0" : void 0)} role=${ifDefined(this.zoomable ? "group" : void 0)}
329
- aria-label=${ifDefined(this.zoomable ? this.label || this.i18n.t("imageCompare") : void 0)}
330
- aria-describedby=${ifDefined(this.zoomable ? "zoom-help" : void 0)}
376
+ tabindex=${ifDefined(zoomable ? "0" : void 0)} role=${ifDefined(zoomable ? "group" : void 0)}
377
+ aria-label=${ifDefined(zoomable ? this.label || this.i18n.t("imageCompare") : void 0)}
378
+ aria-describedby=${ifDefined(zoomable ? "zoom-help" : void 0)}
331
379
  @keydown=${this.onViewKey}
332
380
  @wheel=${(e) => this.pz.wheel(e, sel)} @dblclick=${(e) => this.pz.doubleClick(e, sel)}
333
381
  @pointerdown=${(e) => this.pz.pointerDown(e, sel)} @pointermove=${(e) => this.pz.pointerMove(e, sel)}
@@ -335,7 +383,7 @@ class BkImageCompare extends LitElement {
335
383
  ${stages}
336
384
  ${slider !== nothing || zoom !== nothing ? html`<div class="over">${slider}${zoom}</div>` : nothing}
337
385
  </div>
338
- ${this.zoomable ? html`<span class="sr-only" id="zoom-help">${this.i18n.t("compareZoomHelp")}</span>` : nothing}
386
+ ${zoomable ? html`<span class="sr-only" id="zoom-help">${this.i18n.t("compareZoomHelp")}</span>` : nothing}
339
387
  ${mode === "side" ? html`<div class="captions">
340
388
  <span class="caption" part="caption" aria-hidden="true">${this.labelOf("before")}</span>
341
389
  <span class="caption" part="caption" aria-hidden="true">${this.labelOf("after")}</span>
@@ -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 moves the centre of the frame to that point. With `ratio` the frame keeps that shape.
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 moves the centre of the frame there.
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