@vonage/vivid 5.15.0 → 5.16.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 (730) hide show
  1. package/README.md +1 -1
  2. package/accordion/definition.cjs +7 -212
  3. package/accordion/definition.js +2 -204
  4. package/accordion/index.cjs +4 -4
  5. package/accordion/index.js +93 -138
  6. package/accordion-item/definition.cjs +6 -146
  7. package/accordion-item/definition.js +2 -139
  8. package/accordion-item/index.cjs +1 -1
  9. package/accordion-item/index.js +6 -2
  10. package/action-group/definition.cjs +5 -69
  11. package/action-group/definition.js +1 -62
  12. package/action-group/index.cjs +4 -4
  13. package/action-group/index.js +16 -46
  14. package/alert/definition.cjs +6 -201
  15. package/alert/definition.js +2 -194
  16. package/alert/index.cjs +15 -15
  17. package/alert/index.js +90 -136
  18. package/audio-player/definition.cjs +6 -463
  19. package/audio-player/definition.js +2 -456
  20. package/audio-player/index.cjs +49 -49
  21. package/audio-player/index.js +234 -308
  22. package/avatar/definition.cjs +6 -117
  23. package/avatar/definition.js +2 -110
  24. package/avatar/index.cjs +14 -14
  25. package/avatar/index.js +44 -84
  26. package/badge/definition.cjs +6 -85
  27. package/badge/definition.js +2 -78
  28. package/badge/index.cjs +4 -4
  29. package/badge/index.js +21 -65
  30. package/banner/definition.cjs +6 -160
  31. package/banner/definition.js +2 -153
  32. package/banner/index.cjs +13 -13
  33. package/banner/index.js +76 -109
  34. package/breadcrumb/definition.cjs +5 -98
  35. package/breadcrumb/definition.js +1 -91
  36. package/breadcrumb/index.cjs +4 -4
  37. package/breadcrumb/index.js +33 -60
  38. package/breadcrumb-item/definition.cjs +7 -47
  39. package/breadcrumb-item/definition.js +3 -40
  40. package/breadcrumb-item/index.cjs +5 -5
  41. package/breadcrumb-item/index.js +20 -32
  42. package/bundled/affix.cjs +10 -10
  43. package/bundled/affix.js +44 -57
  44. package/bundled/anchored.cjs +3 -3
  45. package/bundled/anchored.js +47 -65
  46. package/bundled/aria.cjs +1 -1
  47. package/bundled/aria.js +6 -6
  48. package/bundled/attribute-binding-behaviour.cjs +1 -1
  49. package/bundled/attribute-binding-behaviour.js +17 -30
  50. package/bundled/base-color-picker.cjs +10 -10
  51. package/bundled/base-color-picker.js +115 -202
  52. package/bundled/base-progress.cjs +1 -1
  53. package/bundled/base-progress.js +29 -59
  54. package/bundled/breadcrumb-item.cjs +1 -1
  55. package/bundled/breadcrumb-item.js +11 -20
  56. package/bundled/button.cjs +1 -1
  57. package/bundled/button.js +65 -109
  58. package/bundled/calendar-event.cjs +1 -1
  59. package/bundled/calendar-event.js +11 -34
  60. package/bundled/calendar-picker.template.cjs +77 -77
  61. package/bundled/calendar-picker.template.js +2881 -3297
  62. package/bundled/char-count.cjs +7 -7
  63. package/bundled/char-count.js +31 -46
  64. package/bundled/children.cjs +1 -1
  65. package/bundled/children.js +27 -45
  66. package/bundled/class-names.cjs +1 -1
  67. package/bundled/class-names.js +8 -8
  68. package/bundled/data-grid.options.cjs +1 -1
  69. package/bundled/data-grid.options.js +22 -26
  70. package/bundled/decorate.cjs +1 -0
  71. package/bundled/decorate.js +9 -0
  72. package/bundled/definition.cjs +1 -39
  73. package/bundled/definition.js +5 -122
  74. package/bundled/definition10.cjs +27 -69
  75. package/bundled/definition10.js +173 -362
  76. package/bundled/definition11.cjs +19 -12
  77. package/bundled/definition11.js +77 -93
  78. package/bundled/definition12.cjs +11 -11
  79. package/bundled/definition12.js +122 -217
  80. package/bundled/definition13.cjs +18 -9
  81. package/bundled/definition13.js +76 -42
  82. package/bundled/definition14.cjs +10 -1
  83. package/bundled/definition14.js +28 -19
  84. package/bundled/definition15.cjs +73 -5
  85. package/bundled/definition15.js +194 -28
  86. package/bundled/definition16.cjs +5 -30
  87. package/bundled/definition16.js +16 -79
  88. package/bundled/definition17.cjs +13 -19
  89. package/bundled/definition17.js +81 -105
  90. package/bundled/definition18.cjs +12 -13
  91. package/bundled/definition18.js +67 -147
  92. package/bundled/definition19.cjs +48 -48
  93. package/bundled/definition19.js +365 -699
  94. package/bundled/definition2.cjs +8 -8
  95. package/bundled/definition2.js +80 -124
  96. package/bundled/definition20.cjs +5 -20
  97. package/bundled/definition20.js +11 -106
  98. package/bundled/definition21.cjs +20 -5
  99. package/bundled/definition21.js +57 -18
  100. package/bundled/definition22.cjs +16 -16
  101. package/bundled/definition22.js +79 -141
  102. package/bundled/definition3.cjs +1 -29
  103. package/bundled/definition3.js +183 -195
  104. package/bundled/definition4.cjs +39 -6
  105. package/bundled/definition4.js +71 -41
  106. package/bundled/definition5.cjs +30 -1
  107. package/bundled/definition5.js +48 -351
  108. package/bundled/definition6.cjs +28 -30
  109. package/bundled/definition6.js +110 -265
  110. package/bundled/definition7.cjs +6 -30
  111. package/bundled/definition7.js +22 -291
  112. package/bundled/definition8.cjs +13 -18
  113. package/bundled/definition8.js +150 -143
  114. package/bundled/definition9.cjs +29 -13
  115. package/bundled/definition9.js +157 -232
  116. package/bundled/delegates-aria.cjs +1 -1
  117. package/bundled/delegates-aria.js +56 -90
  118. package/bundled/dialog.cjs +1 -0
  119. package/bundled/dialog.js +6 -0
  120. package/bundled/divider.cjs +1 -1
  121. package/bundled/divider.js +16 -33
  122. package/bundled/dom.cjs +1 -1
  123. package/bundled/dom.js +5 -5
  124. package/bundled/enums.cjs +1 -1
  125. package/bundled/enums.js +16 -9
  126. package/bundled/floating-ui.dom.cjs +1 -1
  127. package/bundled/floating-ui.dom.js +953 -1234
  128. package/bundled/form-associated.cjs +1 -1
  129. package/bundled/form-associated.js +165 -327
  130. package/bundled/form-element.cjs +1 -1
  131. package/bundled/form-element.js +33 -55
  132. package/bundled/host-semantics.cjs +1 -1
  133. package/bundled/host-semantics.js +46 -69
  134. package/bundled/key-codes.cjs +1 -1
  135. package/bundled/key-codes.js +4 -16
  136. package/bundled/linkable.cjs +6 -6
  137. package/bundled/linkable.js +25 -45
  138. package/bundled/listbox.cjs +1 -1
  139. package/bundled/listbox.js +176 -368
  140. package/bundled/localized.cjs +1 -1
  141. package/bundled/localized.js +451 -564
  142. package/bundled/mixins.cjs +20 -20
  143. package/bundled/mixins.js +162 -213
  144. package/bundled/normalize.cjs +1 -1
  145. package/bundled/normalize.js +6 -6
  146. package/bundled/numbers.cjs +1 -1
  147. package/bundled/numbers.js +9 -11
  148. package/bundled/picker-field.template.cjs +23 -23
  149. package/bundled/picker-field.template.js +108 -172
  150. package/bundled/playbackRates.cjs +1 -1
  151. package/bundled/playbackRates.js +10 -10
  152. package/bundled/ref.cjs +1 -1
  153. package/bundled/ref.js +10 -14
  154. package/bundled/repeat.cjs +1 -1
  155. package/bundled/repeat.js +421 -552
  156. package/bundled/scrollIntoView.cjs +1 -1
  157. package/bundled/scrollIntoView.js +26 -32
  158. package/bundled/single-date-picker.cjs +1 -1
  159. package/bundled/single-date-picker.js +23 -38
  160. package/bundled/single-value-picker.cjs +1 -1
  161. package/bundled/single-value-picker.js +58 -86
  162. package/bundled/slider.template.cjs +13 -13
  163. package/bundled/slider.template.js +67 -78
  164. package/bundled/slottable-request.cjs +4 -4
  165. package/bundled/slottable-request.js +1937 -2904
  166. package/bundled/slotted.cjs +1 -1
  167. package/bundled/slotted.js +47 -97
  168. package/bundled/strings.cjs +1 -1
  169. package/bundled/strings.js +6 -6
  170. package/bundled/text-field.cjs +1 -1
  171. package/bundled/text-field.js +4 -4
  172. package/bundled/time-selection-picker.template.cjs +26 -26
  173. package/bundled/time-selection-picker.template.js +355 -555
  174. package/bundled/trapped-focus.cjs +1 -1
  175. package/bundled/trapped-focus.js +18 -25
  176. package/bundled/vivid-element.cjs +4 -5
  177. package/bundled/vivid-element.js +1778 -2794
  178. package/bundled/when.cjs +1 -1
  179. package/bundled/when.js +10 -10
  180. package/bundled/with-contextual-help.cjs +1 -1
  181. package/bundled/with-contextual-help.js +15 -31
  182. package/bundled/with-error-text.cjs +1 -1
  183. package/bundled/with-error-text.js +25 -38
  184. package/bundled/with-success-text.cjs +1 -1
  185. package/bundled/with-success-text.js +8 -15
  186. package/button/definition.cjs +6 -14
  187. package/button/definition.js +3 -4
  188. package/button/index.cjs +1 -1
  189. package/button/index.js +6 -2
  190. package/calendar/definition.cjs +5 -360
  191. package/calendar/definition.js +1 -353
  192. package/calendar/index.cjs +20 -20
  193. package/calendar/index.js +346 -403
  194. package/calendar-event/definition.cjs +6 -58
  195. package/calendar-event/definition.js +2 -51
  196. package/calendar-event/index.cjs +7 -7
  197. package/calendar-event/index.js +25 -41
  198. package/card/definition.cjs +6 -194
  199. package/card/definition.js +2 -187
  200. package/card/index.cjs +34 -34
  201. package/card/index.js +80 -133
  202. package/checkbox/definition.cjs +6 -210
  203. package/checkbox/definition.js +2 -203
  204. package/checkbox/index.cjs +1 -1
  205. package/checkbox/index.js +6 -2
  206. package/color-picker/definition.cjs +6 -1180
  207. package/color-picker/definition.js +2 -1173
  208. package/color-picker/index.cjs +94 -94
  209. package/color-picker/index.js +605 -742
  210. package/combobox/definition.cjs +6 -653
  211. package/combobox/definition.js +2 -646
  212. package/combobox/index.cjs +37 -37
  213. package/combobox/index.js +254 -465
  214. package/contextual-help/definition.cjs +6 -63
  215. package/contextual-help/definition.js +2 -56
  216. package/contextual-help/index.cjs +1 -1
  217. package/contextual-help/index.js +6 -2
  218. package/country/definition.cjs +6 -340
  219. package/country/definition.js +2 -333
  220. package/country/index.cjs +6 -6
  221. package/country/index.js +1209 -308
  222. package/custom-elements.json +550 -1571
  223. package/data-grid/definition.cjs +10 -2363
  224. package/data-grid/definition.js +2 -2352
  225. package/data-grid/index.cjs +61 -61
  226. package/data-grid/index.js +642 -1024
  227. package/date-picker/definition.cjs +6 -152
  228. package/date-picker/definition.js +2 -145
  229. package/date-picker/index.cjs +1 -1
  230. package/date-picker/index.js +66 -114
  231. package/date-range-picker/definition.cjs +6 -469
  232. package/date-range-picker/definition.js +2 -462
  233. package/date-range-picker/index.cjs +1 -1
  234. package/date-range-picker/index.js +218 -338
  235. package/date-time-picker/definition.cjs +6 -285
  236. package/date-time-picker/definition.js +2 -278
  237. package/date-time-picker/index.cjs +4 -4
  238. package/date-time-picker/index.js +116 -211
  239. package/dial-pad/definition.cjs +6 -469
  240. package/dial-pad/definition.js +2 -462
  241. package/dial-pad/index.cjs +42 -42
  242. package/dial-pad/index.js +195 -311
  243. package/dialog/definition.cjs +6 -350
  244. package/dialog/definition.js +2 -343
  245. package/dialog/index.cjs +28 -28
  246. package/dialog/index.js +148 -230
  247. package/divider/definition.cjs +6 -42
  248. package/divider/definition.js +2 -35
  249. package/divider/index.cjs +1 -1
  250. package/divider/index.js +5 -2
  251. package/elevation/definition.cjs +4 -11
  252. package/elevation/definition.js +2 -2
  253. package/elevation/index.cjs +1 -1
  254. package/elevation/index.js +5 -2
  255. package/empty-state/definition.cjs +6 -86
  256. package/empty-state/definition.js +2 -79
  257. package/empty-state/index.cjs +9 -9
  258. package/empty-state/index.js +28 -60
  259. package/fab/definition.cjs +6 -106
  260. package/fab/definition.js +2 -99
  261. package/fab/index.cjs +17 -17
  262. package/fab/index.js +46 -82
  263. package/file-picker/definition.cjs +6 -526
  264. package/file-picker/definition.js +2 -519
  265. package/file-picker/index.cjs +25 -25
  266. package/file-picker/index.js +246 -354
  267. package/header/definition.cjs +5 -78
  268. package/header/definition.js +1 -71
  269. package/header/index.cjs +5 -5
  270. package/header/index.js +28 -42
  271. package/icon/definition.cjs +5 -200
  272. package/icon/definition.js +1 -193
  273. package/icon/index.cjs +1 -1
  274. package/icon/index.js +5 -2
  275. package/index.cjs +350 -356
  276. package/index.js +79 -78
  277. package/layout/definition.cjs +5 -72
  278. package/layout/definition.js +1 -65
  279. package/layout/index.cjs +2 -2
  280. package/layout/index.js +10 -51
  281. package/lib/alert/alert.d.ts +0 -1
  282. package/lib/audio-player/audio-player.d.ts +0 -1
  283. package/lib/banner/banner.d.ts +0 -2
  284. package/lib/button/button.d.ts +0 -1
  285. package/lib/calendar/calendar.d.ts +0 -1
  286. package/lib/card/card.d.ts +0 -2
  287. package/lib/combobox/combobox.d.ts +1 -1
  288. package/lib/data-grid/data-grid-cell.d.ts +0 -3
  289. package/lib/data-grid/data-grid-row.d.ts +0 -3
  290. package/lib/data-grid/data-grid.d.ts +0 -1
  291. package/lib/fab/fab.d.ts +0 -1
  292. package/lib/file-picker/file-picker.d.ts +1 -1
  293. package/lib/icon/icon.d.ts +0 -2
  294. package/lib/menu/menu.d.ts +0 -1
  295. package/lib/menu-item/menu-item.d.ts +0 -1
  296. package/lib/option/option.d.ts +4 -0
  297. package/lib/pagination/pagination.d.ts +0 -7
  298. package/lib/popover/popover.d.ts +0 -5
  299. package/lib/select/select.d.ts +2 -2
  300. package/lib/split-button/split-button.d.ts +0 -2
  301. package/lib/tab/tab.d.ts +0 -2
  302. package/lib/table/table-head.d.ts +1 -0
  303. package/lib/tabs/tabs.d.ts +0 -1
  304. package/lib/tag/tag.d.ts +0 -2
  305. package/lib/text-field/text-field.d.ts +0 -1
  306. package/lib/toggletip/toggletip.d.ts +0 -1
  307. package/lib/tree-item/tree-item.d.ts +0 -2
  308. package/lib/tree-view/tree-view.d.ts +0 -1
  309. package/locales/de-DE.cjs +382 -492
  310. package/locales/de-DE.js +383 -490
  311. package/locales/en-GB.cjs +271 -382
  312. package/locales/en-GB.js +272 -380
  313. package/locales/en-US.cjs +2 -552
  314. package/locales/en-US.js +1 -549
  315. package/locales/ja-JP.cjs +376 -492
  316. package/locales/ja-JP.js +377 -490
  317. package/locales/zh-CN.cjs +378 -495
  318. package/locales/zh-CN.js +379 -493
  319. package/menu/definition.cjs +6 -394
  320. package/menu/definition.js +2 -387
  321. package/menu/index.cjs +1 -1
  322. package/menu/index.js +6 -2
  323. package/menu-item/definition.cjs +7 -14
  324. package/menu-item/definition.js +3 -3
  325. package/menu-item/index.cjs +1 -1
  326. package/menu-item/index.js +6 -2
  327. package/nav/definition.cjs +5 -27
  328. package/nav/definition.js +1 -20
  329. package/nav/index.cjs +3 -3
  330. package/nav/index.js +7 -10
  331. package/nav-disclosure/definition.cjs +6 -122
  332. package/nav-disclosure/definition.js +2 -115
  333. package/nav-disclosure/index.cjs +8 -8
  334. package/nav-disclosure/index.js +49 -86
  335. package/nav-item/definition.cjs +6 -79
  336. package/nav-item/definition.js +2 -72
  337. package/nav-item/index.cjs +2 -2
  338. package/nav-item/index.js +33 -58
  339. package/note/definition.cjs +6 -61
  340. package/note/definition.js +2 -54
  341. package/note/index.cjs +5 -5
  342. package/note/index.js +24 -38
  343. package/number-field/definition.cjs +6 -440
  344. package/number-field/definition.js +2 -433
  345. package/number-field/index.cjs +31 -31
  346. package/number-field/index.js +160 -328
  347. package/option/definition.cjs +6 -13
  348. package/option/definition.js +3 -3
  349. package/option/index.cjs +1 -1
  350. package/option/index.js +6 -2
  351. package/package.json +24 -23
  352. package/pagination/definition.cjs +6 -256
  353. package/pagination/definition.js +2 -249
  354. package/pagination/index.cjs +37 -37
  355. package/pagination/index.js +148 -188
  356. package/popover/definition.cjs +6 -363
  357. package/popover/definition.js +2 -356
  358. package/popover/index.cjs +16 -16
  359. package/popover/index.js +161 -250
  360. package/popup/definition.cjs +5 -13
  361. package/popup/definition.js +3 -4
  362. package/popup/index.cjs +1 -1
  363. package/popup/index.js +6 -2
  364. package/progress/definition.cjs +5 -87
  365. package/progress/definition.js +1 -80
  366. package/progress/index.cjs +9 -9
  367. package/progress/index.js +33 -55
  368. package/progress-ring/definition.cjs +5 -95
  369. package/progress-ring/definition.js +1 -88
  370. package/progress-ring/index.cjs +1 -1
  371. package/progress-ring/index.js +5 -2
  372. package/radio/definition.cjs +5 -231
  373. package/radio/definition.js +1 -224
  374. package/radio/index.cjs +1 -1
  375. package/radio/index.js +5 -2
  376. package/radio-group/definition.cjs +6 -361
  377. package/radio-group/definition.js +2 -354
  378. package/radio-group/index.cjs +10 -10
  379. package/radio-group/index.js +160 -242
  380. package/range-slider/definition.cjs +6 -632
  381. package/range-slider/definition.js +2 -625
  382. package/range-slider/index.cjs +41 -41
  383. package/range-slider/index.js +259 -429
  384. package/rich-text-editor/definition.cjs +32 -15609
  385. package/rich-text-editor/definition.js +2 -15576
  386. package/rich-text-editor/index.cjs +17 -17
  387. package/rich-text-editor/index.js +9061 -11419
  388. package/rich-text-view/definition.cjs +5 -171
  389. package/rich-text-view/definition.js +1 -164
  390. package/rich-text-view/index.cjs +1 -1
  391. package/rich-text-view/index.js +68 -102
  392. package/searchable-select/definition.cjs +5 -1404
  393. package/searchable-select/definition.js +2 -1398
  394. package/searchable-select/index.cjs +94 -94
  395. package/searchable-select/index.js +600 -1019
  396. package/select/definition.cjs +6 -1012
  397. package/select/definition.js +2 -1005
  398. package/select/index.cjs +1 -1
  399. package/select/index.js +6 -2
  400. package/selectable-box/definition.cjs +6 -174
  401. package/selectable-box/definition.js +2 -167
  402. package/selectable-box/index.cjs +18 -18
  403. package/selectable-box/index.js +66 -127
  404. package/side-drawer/definition.cjs +5 -130
  405. package/side-drawer/definition.js +1 -123
  406. package/side-drawer/index.cjs +7 -7
  407. package/side-drawer/index.js +47 -92
  408. package/simple-color-picker/definition.cjs +6 -216
  409. package/simple-color-picker/definition.js +2 -209
  410. package/simple-color-picker/index.cjs +15 -15
  411. package/simple-color-picker/index.js +98 -135
  412. package/slider/definition.cjs +6 -504
  413. package/slider/definition.js +2 -497
  414. package/slider/index.cjs +1 -1
  415. package/slider/index.js +6 -2
  416. package/split-button/definition.cjs +6 -176
  417. package/split-button/definition.js +2 -169
  418. package/split-button/index.cjs +15 -15
  419. package/split-button/index.js +74 -135
  420. package/status/definition.cjs +6 -76
  421. package/status/definition.js +2 -69
  422. package/status/index.cjs +10 -7
  423. package/status/index.js +38 -48
  424. package/styles/core/all.css +6 -5
  425. package/styles/core/theme.css +6 -5
  426. package/styles/core/typography.css +1 -2
  427. package/styles/tokens/theme-dark.css +17 -21
  428. package/styles/tokens/theme-light.css +17 -21
  429. package/styles/tokens/vivid-2-compat.css +1 -2
  430. package/switch/definition.cjs +6 -149
  431. package/switch/definition.js +2 -142
  432. package/switch/index.cjs +8 -8
  433. package/switch/index.js +48 -93
  434. package/tab/definition.cjs +6 -127
  435. package/tab/definition.js +2 -120
  436. package/tab/index.cjs +1 -1
  437. package/tab/index.js +6 -2
  438. package/tab-panel/definition.cjs +5 -29
  439. package/tab-panel/definition.js +1 -22
  440. package/tab-panel/index.cjs +1 -1
  441. package/tab-panel/index.js +5 -2
  442. package/table/definition.cjs +15 -168
  443. package/table/definition.js +1 -151
  444. package/table/index.cjs +20 -16
  445. package/table/index.js +36 -85
  446. package/tabs/definition.cjs +7 -469
  447. package/tabs/definition.js +2 -461
  448. package/tabs/index.cjs +11 -11
  449. package/tabs/index.js +169 -298
  450. package/tag/definition.cjs +6 -176
  451. package/tag/definition.js +2 -169
  452. package/tag/index.cjs +26 -26
  453. package/tag/index.js +65 -126
  454. package/tag-group/definition.cjs +5 -40
  455. package/tag-group/definition.js +1 -33
  456. package/tag-group/index.cjs +4 -4
  457. package/tag-group/index.js +10 -21
  458. package/text-area/definition.cjs +6 -361
  459. package/text-area/definition.js +2 -354
  460. package/text-area/index.cjs +11 -11
  461. package/text-area/index.js +153 -266
  462. package/text-field/definition.cjs +6 -433
  463. package/text-field/definition.js +2 -426
  464. package/text-field/index.cjs +1 -1
  465. package/text-field/index.js +6 -2
  466. package/time-picker/definition.cjs +7 -43
  467. package/time-picker/definition.js +3 -36
  468. package/time-picker/index.cjs +1 -1
  469. package/time-picker/index.js +24 -29
  470. package/toggletip/definition.cjs +6 -161
  471. package/toggletip/definition.js +2 -154
  472. package/toggletip/index.cjs +1 -1
  473. package/toggletip/index.js +6 -2
  474. package/tooltip/definition.cjs +6 -140
  475. package/tooltip/definition.js +2 -133
  476. package/tooltip/index.cjs +1 -1
  477. package/tooltip/index.js +6 -2
  478. package/tree-item/definition.cjs +6 -13
  479. package/tree-item/definition.js +3 -3
  480. package/tree-item/index.cjs +1 -1
  481. package/tree-item/index.js +6 -2
  482. package/tree-view/definition.cjs +6 -318
  483. package/tree-view/definition.js +2 -311
  484. package/tree-view/index.cjs +11 -11
  485. package/tree-view/index.js +145 -190
  486. package/unbundled/affix.cjs +89 -62
  487. package/unbundled/affix.js +58 -55
  488. package/unbundled/anchored.cjs +87 -94
  489. package/unbundled/anchored.js +74 -90
  490. package/unbundled/attribute-binding-behaviour.cjs +37 -43
  491. package/unbundled/attribute-binding-behaviour.js +31 -41
  492. package/unbundled/base-color-picker.cjs +226 -278
  493. package/unbundled/base-color-picker.js +214 -275
  494. package/unbundled/base-progress.cjs +63 -81
  495. package/unbundled/base-progress.js +57 -79
  496. package/unbundled/breadcrumb-item.cjs +24 -28
  497. package/unbundled/breadcrumb-item.js +18 -26
  498. package/unbundled/button.cjs +115 -175
  499. package/unbundled/button.js +109 -173
  500. package/unbundled/calendar-event.cjs +28 -41
  501. package/unbundled/calendar-event.js +22 -39
  502. package/unbundled/calendar-picker.template.cjs +620 -785
  503. package/unbundled/calendar-picker.template.js +560 -774
  504. package/unbundled/char-count.cjs +50 -80
  505. package/unbundled/char-count.js +44 -78
  506. package/unbundled/chunk.cjs +50 -0
  507. package/unbundled/chunk.js +33 -0
  508. package/unbundled/data-grid.options.cjs +80 -29
  509. package/unbundled/data-grid.options.js +51 -23
  510. package/unbundled/decorate.cjs +14 -0
  511. package/unbundled/decorate.js +9 -0
  512. package/unbundled/definition.cjs +42 -226
  513. package/unbundled/definition.js +24 -221
  514. package/unbundled/definition10.cjs +253 -0
  515. package/unbundled/definition10.js +229 -0
  516. package/unbundled/definition11.cjs +397 -0
  517. package/unbundled/definition11.js +379 -0
  518. package/unbundled/definition12.cjs +317 -0
  519. package/unbundled/definition12.js +287 -0
  520. package/unbundled/definition13.cjs +328 -0
  521. package/unbundled/definition13.js +310 -0
  522. package/unbundled/definition14.cjs +406 -0
  523. package/unbundled/definition14.js +388 -0
  524. package/unbundled/definition15.cjs +107 -0
  525. package/unbundled/definition15.js +89 -0
  526. package/unbundled/definition16.cjs +63 -0
  527. package/unbundled/definition16.js +45 -0
  528. package/unbundled/definition17.cjs +151 -0
  529. package/unbundled/definition17.js +133 -0
  530. package/unbundled/definition18.cjs +47 -0
  531. package/unbundled/definition18.js +35 -0
  532. package/unbundled/definition19.cjs +98 -0
  533. package/unbundled/definition19.js +80 -0
  534. package/unbundled/definition2.cjs +179 -401
  535. package/unbundled/definition2.js +161 -395
  536. package/unbundled/definition20.cjs +56 -0
  537. package/unbundled/definition20.js +43 -0
  538. package/unbundled/definition21.cjs +305 -0
  539. package/unbundled/definition21.js +286 -0
  540. package/unbundled/definition22.cjs +174 -0
  541. package/unbundled/definition22.js +156 -0
  542. package/unbundled/definition23.cjs +161 -0
  543. package/unbundled/definition23.js +143 -0
  544. package/unbundled/definition24.cjs +1038 -0
  545. package/unbundled/definition24.js +1020 -0
  546. package/unbundled/definition25.cjs +360 -0
  547. package/unbundled/definition25.js +342 -0
  548. package/unbundled/definition26.cjs +137 -0
  549. package/unbundled/definition26.js +119 -0
  550. package/unbundled/definition27.cjs +235 -0
  551. package/unbundled/definition27.js +211 -0
  552. package/unbundled/definition28.cjs +546 -0
  553. package/unbundled/definition28.js +528 -0
  554. package/unbundled/definition29.cjs +157 -0
  555. package/unbundled/definition29.js +139 -0
  556. package/unbundled/definition3.cjs +131 -285
  557. package/unbundled/definition3.js +113 -280
  558. package/unbundled/definition30.cjs +75 -0
  559. package/unbundled/definition30.js +57 -0
  560. package/unbundled/definition31.cjs +1265 -0
  561. package/unbundled/definition31.js +1247 -0
  562. package/unbundled/definition32.cjs +1908 -0
  563. package/unbundled/definition32.js +1866 -0
  564. package/unbundled/definition33.cjs +261 -0
  565. package/unbundled/definition33.js +183 -0
  566. package/unbundled/definition34.cjs +46 -0
  567. package/unbundled/definition34.js +33 -0
  568. package/unbundled/definition35.cjs +152 -0
  569. package/unbundled/definition35.js +134 -0
  570. package/unbundled/definition36.cjs +426 -0
  571. package/unbundled/definition36.js +408 -0
  572. package/unbundled/definition37.cjs +243 -0
  573. package/unbundled/definition37.js +225 -0
  574. package/unbundled/definition38.cjs +409 -0
  575. package/unbundled/definition38.js +391 -0
  576. package/unbundled/definition39.cjs +298 -0
  577. package/unbundled/definition39.js +280 -0
  578. package/unbundled/definition4.cjs +186 -206
  579. package/unbundled/definition4.js +162 -201
  580. package/unbundled/definition40.cjs +81 -0
  581. package/unbundled/definition40.js +63 -0
  582. package/unbundled/definition41.cjs +100 -0
  583. package/unbundled/definition41.js +82 -0
  584. package/unbundled/definition42.cjs +457 -0
  585. package/unbundled/definition42.js +439 -0
  586. package/unbundled/definition43.cjs +86 -0
  587. package/unbundled/definition43.js +68 -0
  588. package/unbundled/definition44.cjs +60 -0
  589. package/unbundled/definition44.js +41 -0
  590. package/unbundled/definition45.cjs +124 -0
  591. package/unbundled/definition45.js +106 -0
  592. package/unbundled/definition46.cjs +85 -0
  593. package/unbundled/definition46.js +67 -0
  594. package/unbundled/definition47.cjs +52 -0
  595. package/unbundled/definition47.js +31 -0
  596. package/unbundled/definition48.cjs +69 -0
  597. package/unbundled/definition48.js +51 -0
  598. package/unbundled/definition49.cjs +377 -0
  599. package/unbundled/definition49.js +359 -0
  600. package/unbundled/definition5.cjs +69 -298
  601. package/unbundled/definition5.js +44 -293
  602. package/unbundled/definition50.cjs +246 -0
  603. package/unbundled/definition50.js +228 -0
  604. package/unbundled/definition51.cjs +337 -0
  605. package/unbundled/definition51.js +319 -0
  606. package/unbundled/definition52.cjs +86 -0
  607. package/unbundled/definition52.js +67 -0
  608. package/unbundled/definition53.cjs +193 -0
  609. package/unbundled/definition53.js +174 -0
  610. package/unbundled/definition54.cjs +297 -0
  611. package/unbundled/definition54.js +279 -0
  612. package/unbundled/definition55.cjs +510 -0
  613. package/unbundled/definition55.js +492 -0
  614. package/unbundled/definition56.cjs +12728 -0
  615. package/unbundled/definition56.js +12553 -0
  616. package/unbundled/definition57.cjs +837 -0
  617. package/unbundled/definition57.js +819 -0
  618. package/unbundled/definition58.cjs +146 -0
  619. package/unbundled/definition58.js +128 -0
  620. package/unbundled/definition59.cjs +1080 -0
  621. package/unbundled/definition59.js +1062 -0
  622. package/unbundled/definition6.cjs +88 -56
  623. package/unbundled/definition6.js +69 -52
  624. package/unbundled/definition60.cjs +149 -0
  625. package/unbundled/definition60.js +131 -0
  626. package/unbundled/definition61.cjs +116 -0
  627. package/unbundled/definition61.js +97 -0
  628. package/unbundled/definition62.cjs +213 -0
  629. package/unbundled/definition62.js +195 -0
  630. package/unbundled/definition63.cjs +159 -0
  631. package/unbundled/definition63.js +141 -0
  632. package/unbundled/definition64.cjs +86 -0
  633. package/unbundled/definition64.js +68 -0
  634. package/unbundled/definition65.cjs +126 -0
  635. package/unbundled/definition65.js +107 -0
  636. package/unbundled/definition66.cjs +49 -0
  637. package/unbundled/definition66.js +28 -0
  638. package/unbundled/definition67.cjs +119 -0
  639. package/unbundled/definition67.js +101 -0
  640. package/unbundled/definition68.cjs +374 -0
  641. package/unbundled/definition68.js +349 -0
  642. package/unbundled/definition69.cjs +57 -0
  643. package/unbundled/definition69.js +38 -0
  644. package/unbundled/definition7.cjs +190 -0
  645. package/unbundled/definition7.js +166 -0
  646. package/unbundled/definition70.cjs +155 -0
  647. package/unbundled/definition70.js +137 -0
  648. package/unbundled/definition71.cjs +302 -0
  649. package/unbundled/definition71.js +284 -0
  650. package/unbundled/definition72.cjs +49 -0
  651. package/unbundled/definition72.js +38 -0
  652. package/unbundled/definition73.cjs +171 -0
  653. package/unbundled/definition73.js +147 -0
  654. package/unbundled/definition74.cjs +232 -0
  655. package/unbundled/definition74.js +213 -0
  656. package/unbundled/definition75.cjs +52241 -0
  657. package/unbundled/definition75.js +52223 -0
  658. package/unbundled/definition8.cjs +63 -0
  659. package/unbundled/definition8.js +44 -0
  660. package/unbundled/definition9.cjs +183 -0
  661. package/unbundled/definition9.js +165 -0
  662. package/unbundled/delegates-aria.cjs +90 -131
  663. package/unbundled/delegates-aria.js +77 -127
  664. package/unbundled/dialog.cjs +15 -0
  665. package/unbundled/dialog.js +10 -0
  666. package/unbundled/divider.cjs +42 -50
  667. package/unbundled/divider.js +30 -47
  668. package/unbundled/en-US.cjs +447 -0
  669. package/unbundled/en-US.js +443 -0
  670. package/unbundled/enums.cjs +166 -107
  671. package/unbundled/enums.js +95 -94
  672. package/unbundled/form-associated.cjs +408 -464
  673. package/unbundled/form-associated.js +396 -461
  674. package/unbundled/form-element.cjs +74 -83
  675. package/unbundled/form-element.js +68 -81
  676. package/unbundled/host-semantics.cjs +70 -88
  677. package/unbundled/host-semantics.js +57 -84
  678. package/unbundled/key-codes.cjs +16 -10
  679. package/unbundled/key-codes.js +5 -7
  680. package/unbundled/linkable.cjs +35 -56
  681. package/unbundled/linkable.js +27 -52
  682. package/unbundled/listbox.cjs +363 -473
  683. package/unbundled/listbox.js +357 -471
  684. package/unbundled/localized.cjs +79 -74
  685. package/unbundled/localized.js +61 -70
  686. package/unbundled/mixins.cjs +222 -225
  687. package/unbundled/mixins.js +186 -213
  688. package/unbundled/picker-field.template.cjs +188 -218
  689. package/unbundled/picker-field.template.js +165 -209
  690. package/unbundled/playbackRates.cjs +18 -11
  691. package/unbundled/playbackRates.js +13 -9
  692. package/unbundled/scrollIntoView.cjs +38 -44
  693. package/unbundled/scrollIntoView.js +33 -42
  694. package/unbundled/single-date-picker.cjs +48 -45
  695. package/unbundled/single-date-picker.js +43 -43
  696. package/unbundled/single-value-picker.cjs +106 -114
  697. package/unbundled/single-value-picker.js +101 -112
  698. package/unbundled/slider.template.cjs +107 -73
  699. package/unbundled/slider.template.js +67 -62
  700. package/unbundled/slottable-request.cjs +3114 -3503
  701. package/unbundled/slottable-request.js +2995 -3484
  702. package/unbundled/text-field.cjs +9 -5
  703. package/unbundled/text-field.js +4 -3
  704. package/unbundled/time-selection-picker.template.cjs +611 -758
  705. package/unbundled/time-selection-picker.template.js +554 -745
  706. package/unbundled/trapped-focus.cjs +45 -35
  707. package/unbundled/trapped-focus.js +34 -32
  708. package/unbundled/vivid-element.cjs +281 -273
  709. package/unbundled/vivid-element.js +239 -265
  710. package/unbundled/with-contextual-help.cjs +35 -39
  711. package/unbundled/with-contextual-help.js +29 -37
  712. package/unbundled/with-error-text.cjs +45 -55
  713. package/unbundled/with-error-text.js +39 -53
  714. package/unbundled/with-success-text.cjs +18 -22
  715. package/unbundled/with-success-text.js +12 -20
  716. package/video-player/definition.cjs +5 -69602
  717. package/video-player/definition.js +1 -69595
  718. package/video-player/index.cjs +44 -55
  719. package/video-player/index.js +23548 -35488
  720. package/visually-hidden/definition.cjs +5 -30
  721. package/visually-hidden/definition.js +1 -23
  722. package/visually-hidden/index.cjs +1 -1
  723. package/visually-hidden/index.js +5 -2
  724. package/vivid.api.json +197 -2003
  725. package/bundled/index.cjs +0 -1
  726. package/bundled/index.js +0 -6
  727. package/unbundled/_commonjsHelpers.cjs +0 -36
  728. package/unbundled/_commonjsHelpers.js +0 -32
  729. package/unbundled/index.cjs +0 -11
  730. package/unbundled/index.js +0 -9
@@ -1,2353 +1,3 @@
1
- import { VwcIconElement as Icon, iconDefinition } from '../icon/definition.js';
2
- import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
3
- import { VwcVisuallyHiddenElement as VisuallyHidden, visuallyHiddenDefinition } from '../visually-hidden/definition.js';
4
- import { html, attr, observable, RepeatDirective, normalizeBinding, Updates as Updates$1, Observable, nullableNumberConverter, children, slotted, elements, when } from '@microsoft/fast-element';
5
- import { c as commonjsGlobal } from '../unbundled/_commonjsHelpers.js';
6
- import { eventFocusIn, eventFocusOut, eventKeyDown, keyEscape, keyFunction2, keyEnter, keyEnd, keyHome, eventFocus, keyPageDown, keyPageUp, keyArrowDown, keyArrowUp, classNames, keySpace } from '@microsoft/fast-web-utilities';
7
- import { D as DataGridCellTypes, a as DataGridCellSortStates, b as DataGridRowTypes, G as GenerateHeaderOptions, c as DataGridCellRole } from '../unbundled/data-grid.options.js';
8
- import { k as keyArrowRight, a as keyArrowLeft } from '../unbundled/key-codes.js';
9
- import { H as HostSemantics, a as applyHostSemantics } from '../unbundled/host-semantics.js';
10
- import { L as Localized } from '../unbundled/localized.js';
11
-
12
- const dataGridStyles = ":host{display:block}:host([generate-header=sticky]){max-block-size:400px}.base{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base ::-webkit-scrollbar{width:4px}.base ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
13
-
14
- const dataGridRowStyles = ".base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-row-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-row-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-row-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-data-grid-row-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-data-grid-row-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-data-grid-row-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-row-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-row-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-row-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-row-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-data-grid-row-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-data-grid-row-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-data-grid-row-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-row-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:grid;width:100%;box-sizing:border-box;color:var(--vvd-color-canvas-text)}:host([row-type=sticky-header]) .base{position:sticky;z-index:9;top:0;background:var(--data-grid-row-background, var(--vvd-color-canvas))}:host([row-type=hidden-header]) .base{display:none}:host(:is([selected]):not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
15
-
16
- const dataGridCellStyles = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}:host([data-fixed]){position:sticky;z-index:5;background:var(--data-grid-cell-background, var(--vvd-color-surface-2dp))}:host([data-fixed]):before{position:absolute;z-index:1;top:0;right:0;width:1px;block-size:100%;box-shadow:4px 0 4px #0000001a,2px 0 2px #0000000d,1px 0 1px #0000000d;content:\"\";pointer-events:none}.base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-cell-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-cell-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-cell-cta-firm, var(--vvd-color-cta-600));--_connotation-color-soft: var(--vvd-data-grid-cell-cta-soft, var(--vvd-color-cta-100));--_connotation-color-faint: var(--vvd-data-grid-cell-cta-faint, var(--vvd-color-cta-50));--_connotation-color-pale: var(--vvd-data-grid-cell-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-cell-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-cell-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-cell-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-cell-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-soft: var(--vvd-data-grid-cell-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-faint: var(--vvd-data-grid-cell-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-pale: var(--vvd-data-grid-cell-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-cell-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-bottom:1px solid var(--vvd-color-neutral-300);block-size:var(--data-grid-cell-block-size, var(--_data-grid-cell-default-block-size));color:var(--_appearance-color-text);font:var(--vvd-typography-base);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:13px 14px;padding-inline:12px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}:host([cell-type=columnheader]) .base{border-color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);--_data-grid-cell-default-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_data-grid-cell-default-white-space: nowrap}:host(:not([cell-type=columnheader])) .base{--_data-grid-cell-default-block-size: 100%;--_data-grid-cell-default-white-space: normal}:host(:is([selected]):not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}.content{display:flex;overflow:hidden;align-items:center}.content[role=button]{cursor:pointer}slot:not([name]){display:block;overflow:hidden;text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space, var(--_data-grid-cell-default-white-space))}:host(:not([cell-type=columnheader][aria-sort])) slot:not([name]){inline-size:100%}.header-icon{flex-shrink:0;margin-inline-start:16px}slot[name=action-items]{display:flex;flex-shrink:0;align-items:center}.base.has-action-items slot[name=action-items]{margin-inline-start:16px}";
17
-
18
- let kernelMode;
19
- const kernelAttr = "fast-kernel";
20
- try {
21
- if (document.currentScript) {
22
- kernelMode = document.currentScript.getAttribute(kernelAttr);
23
- }
24
- else {
25
- const scripts = document.getElementsByTagName("script");
26
- const currentScript = scripts[scripts.length - 1];
27
- kernelMode = currentScript.getAttribute(kernelAttr);
28
- }
29
- }
30
- catch (e) {
31
- kernelMode = "isolate";
32
- }
33
- let KernelServiceId;
34
- switch (kernelMode) {
35
- case "share": // share the kernel across major versions
36
- KernelServiceId = Object.freeze({
37
- updateQueue: 1,
38
- observable: 2,
39
- contextEvent: 3,
40
- elementRegistry: 4,
41
- });
42
- break;
43
- case "share-v2": // only share the kernel with other v2 instances
44
- KernelServiceId = Object.freeze({
45
- updateQueue: 1.2,
46
- observable: 2.2,
47
- contextEvent: 3.2,
48
- elementRegistry: 4.2,
49
- });
50
- break;
51
- default:
52
- // fully isolate the kernel from all other FAST instances
53
- const postfix = `-${Math.random().toString(36).substring(2, 8)}`;
54
- KernelServiceId = Object.freeze({
55
- updateQueue: `1.2${postfix}`,
56
- observable: `2.2${postfix}`,
57
- contextEvent: `3.2${postfix}`,
58
- elementRegistry: `4.2${postfix}`,
59
- });
60
- break;
61
- }
62
- /**
63
- * Determines whether or not an object is a function.
64
- * @public
65
- */
66
- const isFunction = (object) => typeof object === "function";
67
- /**
68
- * Determines whether or not an object is a string.
69
- * @public
70
- */
71
- const isString = (object) => typeof object === "string";
72
- /**
73
- * A function which does nothing.
74
- * @public
75
- */
76
- const noop = () => void 0;
77
-
78
- /* eslint-disable @typescript-eslint/ban-ts-comment */
79
-
80
- (function ensureGlobalThis() {
81
- if (typeof globalThis !== "undefined") {
82
- // We're running in a modern environment.
83
- return;
84
- }
85
- // @ts-ignore
86
- if (typeof commonjsGlobal !== "undefined") {
87
- // We're running in NodeJS
88
- // @ts-ignore
89
- commonjsGlobal.globalThis = commonjsGlobal;
90
- }
91
- else if (typeof self !== "undefined") {
92
- self.globalThis = self;
93
- }
94
- else if (typeof window !== "undefined") {
95
- // We're running in the browser's main thread.
96
- window.globalThis = window;
97
- }
98
- else {
99
- // Hopefully we never get here...
100
- // Not all environments allow eval and Function. Use only as a last resort:
101
- // eslint-disable-next-line no-new-func
102
- const result = new Function("return this")();
103
- result.globalThis = result;
104
- }
105
- })();
106
- (function requestIdleCallbackPolyfill() {
107
- if ("requestIdleCallback" in globalThis) {
108
- return;
109
- }
110
- /**
111
- * A polyfill for requestIdleCallback that falls back to setTimeout.
112
- *
113
- * @param callback - The function to call when the browser is idle.
114
- * @param options - Options object that may contain a timeout property.
115
- * @returns An ID that can be used to cancel the callback.
116
- * @public
117
- */
118
- globalThis.requestIdleCallback = function requestIdleCallback(callback, options) {
119
- const start = Date.now();
120
- return setTimeout(() => {
121
- callback({
122
- didTimeout: (options === null || options === void 0 ? void 0 : options.timeout)
123
- ? Date.now() - start >= options.timeout
124
- : false,
125
- timeRemaining: () => 0,
126
- });
127
- }, 1);
128
- };
129
- /**
130
- * A polyfill for cancelIdleCallback that falls back to clearTimeout.
131
- *
132
- * @param id - The ID of the callback to cancel.
133
- * @public
134
- */
135
- globalThis.cancelIdleCallback = function cancelIdleCallback(id) {
136
- clearTimeout(id);
137
- };
138
- })();
139
-
140
- // ensure FAST global - duplicated debug.ts
141
- const propConfig = {
142
- configurable: false,
143
- enumerable: false,
144
- writable: false,
145
- };
146
- if (globalThis.FAST === void 0) {
147
- Reflect.defineProperty(globalThis, "FAST", Object.assign({ value: Object.create(null) }, propConfig));
148
- }
149
- /**
150
- * The FAST global.
151
- * @public
152
- */
153
- const FAST = globalThis.FAST;
154
- if (FAST.getById === void 0) {
155
- const storage = Object.create(null);
156
- Reflect.defineProperty(FAST, "getById", Object.assign({ value(id, initialize) {
157
- let found = storage[id];
158
- if (found === void 0) {
159
- found = initialize ? (storage[id] = initialize()) : null;
160
- }
161
- return found;
162
- } }, propConfig));
163
- }
164
- if (FAST.error === void 0) {
165
- Object.assign(FAST, {
166
- warn() { },
167
- error(code) {
168
- return new Error(`Error ${code}`);
169
- },
170
- addMessages() { },
171
- });
172
- }
173
- /**
174
- * Creates a function capable of locating metadata associated with a type.
175
- * @returns A metadata locator function.
176
- * @internal
177
- */
178
- function createMetadataLocator() {
179
- const metadataLookup = new WeakMap();
180
- return function (target) {
181
- let metadata = metadataLookup.get(target);
182
- if (metadata === void 0) {
183
- let currentTarget = Reflect.getPrototypeOf(target);
184
- while (metadata === void 0 && currentTarget !== null) {
185
- metadata = metadataLookup.get(currentTarget);
186
- currentTarget = Reflect.getPrototypeOf(currentTarget);
187
- }
188
- metadata = metadata === void 0 ? [] : metadata.slice(0);
189
- metadataLookup.set(target, metadata);
190
- }
191
- return metadata;
192
- };
193
- }
194
- /**
195
- * Makes a type noop for JSON serialization.
196
- * @param type - The type to make noop for JSON serialization.
197
- * @internal
198
- */
199
- function makeSerializationNoop(type) {
200
- type.prototype.toJSON = noop;
201
- }
202
-
203
- const createHTML = html => html;
204
- const fastTrustedType = globalThis.trustedTypes
205
- ? globalThis.trustedTypes.createPolicy("fast-html", { createHTML })
206
- : { createHTML };
207
- let defaultPolicy = Object.freeze({
208
- createHTML(value) {
209
- return fastTrustedType.createHTML(value);
210
- },
211
- protect(tagName, aspect, aspectName, sink) {
212
- return sink;
213
- },
214
- });
215
- const fastPolicy = defaultPolicy;
216
- /**
217
- * Common DOM APIs.
218
- * @public
219
- */
220
- const DOM = Object.freeze({
221
- /**
222
- * Gets the dom policy used by the templating system.
223
- */
224
- get policy() {
225
- return defaultPolicy;
226
- },
227
- /**
228
- * Sets the dom policy used by the templating system.
229
- * @param policy - The policy to set.
230
- * @remarks
231
- * This API can only be called once, for security reasons. It should be
232
- * called by the application developer at the start of their program.
233
- */
234
- setPolicy(value) {
235
- if (defaultPolicy !== fastPolicy) {
236
- throw FAST.error(1201 /* Message.onlySetDOMPolicyOnce */);
237
- }
238
- defaultPolicy = value;
239
- },
240
- /**
241
- * Sets an attribute value on an element.
242
- * @param element - The element to set the attribute value on.
243
- * @param attributeName - The attribute name to set.
244
- * @param value - The value of the attribute to set.
245
- * @remarks
246
- * If the value is `null` or `undefined`, the attribute is removed, otherwise
247
- * it is set to the provided value using the standard `setAttribute` API.
248
- */
249
- setAttribute(element, attributeName, value) {
250
- value === null || value === undefined
251
- ? element.removeAttribute(attributeName)
252
- : element.setAttribute(attributeName, value);
253
- },
254
- /**
255
- * Sets a boolean attribute value.
256
- * @param element - The element to set the boolean attribute value on.
257
- * @param attributeName - The attribute name to set.
258
- * @param value - The value of the attribute to set.
259
- * @remarks
260
- * If the value is true, the attribute is added; otherwise it is removed.
261
- */
262
- setBooleanAttribute(element, attributeName, value) {
263
- value
264
- ? element.setAttribute(attributeName, "")
265
- : element.removeAttribute(attributeName);
266
- },
267
- });
268
-
269
- /**
270
- * The default UpdateQueue.
271
- * @public
272
- */
273
- const Updates = FAST.getById(KernelServiceId.updateQueue, () => {
274
- const tasks = [];
275
- const pendingErrors = [];
276
- const rAF = globalThis.requestAnimationFrame;
277
- let updateAsync = true;
278
- function throwFirstError() {
279
- if (pendingErrors.length) {
280
- throw pendingErrors.shift();
281
- }
282
- }
283
- function tryRunTask(task) {
284
- try {
285
- task.call();
286
- }
287
- catch (error) {
288
- if (updateAsync) {
289
- pendingErrors.push(error);
290
- setTimeout(throwFirstError, 0);
291
- }
292
- else {
293
- tasks.length = 0;
294
- throw error;
295
- }
296
- }
297
- }
298
- function process() {
299
- const capacity = 1024;
300
- let index = 0;
301
- while (index < tasks.length) {
302
- tryRunTask(tasks[index]);
303
- index++;
304
- // Prevent leaking memory for long chains of recursive calls to `enqueue`.
305
- // If we call `enqueue` within a task scheduled by `enqueue`, the queue will
306
- // grow, but to avoid an O(n) walk for every task we execute, we don't
307
- // shift tasks off the queue after they have been executed.
308
- // Instead, we periodically shift 1024 tasks off the queue.
309
- if (index > capacity) {
310
- // Manually shift all values starting at the index back to the
311
- // beginning of the queue.
312
- for (let scan = 0, newLength = tasks.length - index; scan < newLength; scan++) {
313
- tasks[scan] = tasks[scan + index];
314
- }
315
- tasks.length -= index;
316
- index = 0;
317
- }
318
- }
319
- tasks.length = 0;
320
- }
321
- function enqueue(callable) {
322
- tasks.push(callable);
323
- if (tasks.length < 2) {
324
- updateAsync ? rAF(process) : process();
325
- }
326
- }
327
- return Object.freeze({
328
- enqueue,
329
- next: () => new Promise(enqueue),
330
- process,
331
- setMode: (isAsync) => (updateAsync = isAsync),
332
- });
333
- });
334
-
335
- /**
336
- * An implementation of {@link Notifier} that efficiently keeps track of
337
- * subscribers interested in a specific change notification on an
338
- * observable subject.
339
- *
340
- * @remarks
341
- * This set is optimized for the most common scenario of 1 or 2 subscribers.
342
- * With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.
343
- * If the set ever exceeds two subscribers, it upgrades to an array automatically.
344
- * @public
345
- */
346
- class SubscriberSet {
347
- /**
348
- * Creates an instance of SubscriberSet for the specified subject.
349
- * @param subject - The subject that subscribers will receive notifications from.
350
- * @param initialSubscriber - An initial subscriber to changes.
351
- */
352
- constructor(subject, initialSubscriber) {
353
- this.sub1 = void 0;
354
- this.sub2 = void 0;
355
- this.spillover = void 0;
356
- this.subject = subject;
357
- this.sub1 = initialSubscriber;
358
- }
359
- /**
360
- * Checks whether the provided subscriber has been added to this set.
361
- * @param subscriber - The subscriber to test for inclusion in this set.
362
- */
363
- has(subscriber) {
364
- return this.spillover === void 0
365
- ? this.sub1 === subscriber || this.sub2 === subscriber
366
- : this.spillover.indexOf(subscriber) !== -1;
367
- }
368
- /**
369
- * Subscribes to notification of changes in an object's state.
370
- * @param subscriber - The object that is subscribing for change notification.
371
- */
372
- subscribe(subscriber) {
373
- const spillover = this.spillover;
374
- if (spillover === void 0) {
375
- if (this.has(subscriber)) {
376
- return;
377
- }
378
- if (this.sub1 === void 0) {
379
- this.sub1 = subscriber;
380
- return;
381
- }
382
- if (this.sub2 === void 0) {
383
- this.sub2 = subscriber;
384
- return;
385
- }
386
- this.spillover = [this.sub1, this.sub2, subscriber];
387
- this.sub1 = void 0;
388
- this.sub2 = void 0;
389
- }
390
- else {
391
- const index = spillover.indexOf(subscriber);
392
- if (index === -1) {
393
- spillover.push(subscriber);
394
- }
395
- }
396
- }
397
- /**
398
- * Unsubscribes from notification of changes in an object's state.
399
- * @param subscriber - The object that is unsubscribing from change notification.
400
- */
401
- unsubscribe(subscriber) {
402
- const spillover = this.spillover;
403
- if (spillover === void 0) {
404
- if (this.sub1 === subscriber) {
405
- this.sub1 = void 0;
406
- }
407
- else if (this.sub2 === subscriber) {
408
- this.sub2 = void 0;
409
- }
410
- }
411
- else {
412
- const index = spillover.indexOf(subscriber);
413
- if (index !== -1) {
414
- spillover.splice(index, 1);
415
- }
416
- }
417
- }
418
- /**
419
- * Notifies all subscribers.
420
- * @param args - Data passed along to subscribers during notification.
421
- */
422
- notify(args) {
423
- const spillover = this.spillover;
424
- const subject = this.subject;
425
- if (spillover === void 0) {
426
- const sub1 = this.sub1;
427
- const sub2 = this.sub2;
428
- if (sub1 !== void 0) {
429
- sub1.handleChange(subject, args);
430
- }
431
- if (sub2 !== void 0) {
432
- sub2.handleChange(subject, args);
433
- }
434
- }
435
- else {
436
- for (let i = 0, ii = spillover.length; i < ii; ++i) {
437
- spillover[i].handleChange(subject, args);
438
- }
439
- }
440
- }
441
- }
442
- /**
443
- * An implementation of Notifier that allows subscribers to be notified
444
- * of individual property changes on an object.
445
- * @public
446
- */
447
- class PropertyChangeNotifier {
448
- /**
449
- * Creates an instance of PropertyChangeNotifier for the specified subject.
450
- * @param subject - The object that subscribers will receive notifications for.
451
- */
452
- constructor(subject) {
453
- this.subscribers = {};
454
- this.subjectSubscribers = null;
455
- this.subject = subject;
456
- }
457
- /**
458
- * Notifies all subscribers, based on the specified property.
459
- * @param propertyName - The property name, passed along to subscribers during notification.
460
- */
461
- notify(propertyName) {
462
- var _a, _b;
463
- (_a = this.subscribers[propertyName]) === null || _a === void 0 ? void 0 : _a.notify(propertyName);
464
- (_b = this.subjectSubscribers) === null || _b === void 0 ? void 0 : _b.notify(propertyName);
465
- }
466
- /**
467
- * Subscribes to notification of changes in an object's state.
468
- * @param subscriber - The object that is subscribing for change notification.
469
- * @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
470
- */
471
- subscribe(subscriber, propertyToWatch) {
472
- var _a, _b;
473
- let subscribers;
474
- if (propertyToWatch) {
475
- subscribers =
476
- (_a = this.subscribers[propertyToWatch]) !== null && _a !== void 0 ? _a : (this.subscribers[propertyToWatch] = new SubscriberSet(this.subject));
477
- }
478
- else {
479
- subscribers =
480
- (_b = this.subjectSubscribers) !== null && _b !== void 0 ? _b : (this.subjectSubscribers = new SubscriberSet(this.subject));
481
- }
482
- subscribers.subscribe(subscriber);
483
- }
484
- /**
485
- * Unsubscribes from notification of changes in an object's state.
486
- * @param subscriber - The object that is unsubscribing from change notification.
487
- * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
488
- */
489
- unsubscribe(subscriber, propertyToUnwatch) {
490
- var _a, _b;
491
- if (propertyToUnwatch) {
492
- (_a = this.subscribers[propertyToUnwatch]) === null || _a === void 0 ? void 0 : _a.unsubscribe(subscriber);
493
- }
494
- else {
495
- (_b = this.subjectSubscribers) === null || _b === void 0 ? void 0 : _b.unsubscribe(subscriber);
496
- }
497
- }
498
- }
499
-
500
- /**
501
- * Describes how the source's lifetime relates to its controller's lifetime.
502
- * @public
503
- */
504
- const SourceLifetime = Object.freeze({
505
- /**
506
- * The source to controller lifetime relationship is unknown.
507
- */
508
- unknown: void 0,
509
- /**
510
- * The source and controller lifetimes are coupled to one another.
511
- * They can/will be GC'd together.
512
- */
513
- coupled: 1,
514
- });
515
- /**
516
- * Common Observable APIs.
517
- * @public
518
- */
519
- FAST.getById(KernelServiceId.observable, () => {
520
- const queueUpdate = Updates.enqueue;
521
- const volatileRegex = /(:|&&|\|\||if|\?\.)/;
522
- const notifierLookup = new WeakMap();
523
- let watcher = void 0;
524
- let createArrayObserver = (array) => {
525
- throw FAST.error(1101 /* Message.needsArrayObservation */);
526
- };
527
- function getNotifier(source) {
528
- var _a;
529
- let found = (_a = source.$fastController) !== null && _a !== void 0 ? _a : notifierLookup.get(source);
530
- if (found === void 0) {
531
- Array.isArray(source)
532
- ? (found = createArrayObserver(source))
533
- : notifierLookup.set(source, (found = new PropertyChangeNotifier(source)));
534
- }
535
- return found;
536
- }
537
- const getAccessors = createMetadataLocator();
538
- class DefaultObservableAccessor {
539
- constructor(name) {
540
- this.name = name;
541
- this.field = `_${name}`;
542
- this.callback = `${name}Changed`;
543
- }
544
- getValue(source) {
545
- if (watcher !== void 0) {
546
- watcher.watch(source, this.name);
547
- }
548
- return source[this.field];
549
- }
550
- setValue(source, newValue) {
551
- const field = this.field;
552
- const oldValue = source[field];
553
- if (oldValue !== newValue) {
554
- source[field] = newValue;
555
- const callback = source[this.callback];
556
- if (isFunction(callback)) {
557
- callback.call(source, oldValue, newValue);
558
- }
559
- getNotifier(source).notify(this.name);
560
- }
561
- }
562
- }
563
- class ExpressionNotifierImplementation extends SubscriberSet {
564
- constructor(expression, initialSubscriber, isVolatileBinding = false) {
565
- super(expression, initialSubscriber);
566
- this.expression = expression;
567
- this.isVolatileBinding = isVolatileBinding;
568
- this.needsRefresh = true;
569
- this.needsQueue = true;
570
- this.isAsync = true;
571
- this.first = this;
572
- this.last = null;
573
- this.propertySource = void 0;
574
- this.propertyName = void 0;
575
- this.notifier = void 0;
576
- this.next = void 0;
577
- }
578
- setMode(isAsync) {
579
- this.isAsync = this.needsQueue = isAsync;
580
- }
581
- bind(controller) {
582
- this.controller = controller;
583
- const value = this.observe(controller.source, controller.context);
584
- if (!controller.isBound && this.requiresUnbind(controller)) {
585
- controller.onUnbind(this);
586
- }
587
- return value;
588
- }
589
- requiresUnbind(controller) {
590
- return (controller.sourceLifetime !== SourceLifetime.coupled ||
591
- this.first !== this.last ||
592
- this.first.propertySource !== controller.source);
593
- }
594
- unbind(controller) {
595
- this.dispose();
596
- }
597
- observe(source, context) {
598
- if (this.needsRefresh && this.last !== null) {
599
- this.dispose();
600
- }
601
- const previousWatcher = watcher;
602
- watcher = this.needsRefresh ? this : void 0;
603
- this.needsRefresh = this.isVolatileBinding;
604
- let result;
605
- try {
606
- result = this.expression(source, context);
607
- }
608
- finally {
609
- watcher = previousWatcher;
610
- }
611
- return result;
612
- }
613
- // backwards compat with v1 kernel
614
- disconnect() {
615
- this.dispose();
616
- }
617
- dispose() {
618
- if (this.last !== null) {
619
- let current = this.first;
620
- while (current !== void 0) {
621
- current.notifier.unsubscribe(this, current.propertyName);
622
- current = current.next;
623
- }
624
- this.last = null;
625
- this.needsRefresh = this.needsQueue = this.isAsync;
626
- }
627
- }
628
- watch(propertySource, propertyName) {
629
- const prev = this.last;
630
- const notifier = getNotifier(propertySource);
631
- const current = prev === null ? this.first : {};
632
- current.propertySource = propertySource;
633
- current.propertyName = propertyName;
634
- current.notifier = notifier;
635
- notifier.subscribe(this, propertyName);
636
- if (prev !== null) {
637
- if (!this.needsRefresh) {
638
- // Declaring the variable prior to assignment below circumvents
639
- // a bug in Angular's optimization process causing infinite recursion
640
- // of this watch() method. Details https://github.com/microsoft/fast/issues/4969
641
- let prevValue;
642
- watcher = void 0;
643
- /* eslint-disable-next-line */
644
- prevValue = prev.propertySource[prev.propertyName];
645
- /* eslint-disable-next-line */
646
- watcher = this;
647
- if (propertySource === prevValue) {
648
- this.needsRefresh = true;
649
- }
650
- }
651
- prev.next = current;
652
- }
653
- this.last = current;
654
- }
655
- handleChange() {
656
- if (this.needsQueue) {
657
- this.needsQueue = false;
658
- queueUpdate(this);
659
- }
660
- else if (!this.isAsync) {
661
- this.call();
662
- }
663
- }
664
- call() {
665
- if (this.last !== null) {
666
- this.needsQueue = this.isAsync;
667
- this.notify(this);
668
- }
669
- }
670
- *records() {
671
- let next = this.first;
672
- while (next !== void 0) {
673
- yield next;
674
- next = next.next;
675
- }
676
- }
677
- }
678
- makeSerializationNoop(ExpressionNotifierImplementation);
679
- return Object.freeze({
680
- /**
681
- * @internal
682
- * @param factory - The factory used to create array observers.
683
- */
684
- setArrayObserverFactory(factory) {
685
- createArrayObserver = factory;
686
- },
687
- /**
688
- * Gets a notifier for an object or Array.
689
- * @param source - The object or Array to get the notifier for.
690
- */
691
- getNotifier,
692
- /**
693
- * Records a property change for a source object.
694
- * @param source - The object to record the change against.
695
- * @param propertyName - The property to track as changed.
696
- */
697
- track(source, propertyName) {
698
- watcher && watcher.watch(source, propertyName);
699
- },
700
- /**
701
- * Notifies watchers that the currently executing property getter or function is volatile
702
- * with respect to its observable dependencies.
703
- */
704
- trackVolatile() {
705
- watcher && (watcher.needsRefresh = true);
706
- },
707
- /**
708
- * Notifies subscribers of a source object of changes.
709
- * @param source - the object to notify of changes.
710
- * @param args - The change args to pass to subscribers.
711
- */
712
- notify(source, args) {
713
- /* eslint-disable-next-line @typescript-eslint/no-use-before-define */
714
- getNotifier(source).notify(args);
715
- },
716
- /**
717
- * Defines an observable property on an object or prototype.
718
- * @param target - The target object to define the observable on.
719
- * @param nameOrAccessor - The name of the property to define as observable;
720
- * or a custom accessor that specifies the property name and accessor implementation.
721
- */
722
- defineProperty(target, nameOrAccessor) {
723
- if (isString(nameOrAccessor)) {
724
- nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);
725
- }
726
- getAccessors(target).push(nameOrAccessor);
727
- Reflect.defineProperty(target, nameOrAccessor.name, {
728
- enumerable: true,
729
- get() {
730
- return nameOrAccessor.getValue(this);
731
- },
732
- set(newValue) {
733
- nameOrAccessor.setValue(this, newValue);
734
- },
735
- });
736
- },
737
- /**
738
- * Finds all the observable accessors defined on the target,
739
- * including its prototype chain.
740
- * @param target - The target object to search for accessor on.
741
- */
742
- getAccessors,
743
- /**
744
- * Creates a {@link ExpressionNotifier} that can watch the
745
- * provided {@link Expression} for changes.
746
- * @param expression - The binding to observe.
747
- * @param initialSubscriber - An initial subscriber to changes in the binding value.
748
- * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
749
- */
750
- binding(expression, initialSubscriber, isVolatileBinding = this.isVolatileBinding(expression)) {
751
- return new ExpressionNotifierImplementation(expression, initialSubscriber, isVolatileBinding);
752
- },
753
- /**
754
- * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
755
- * on every evaluation of the value.
756
- * @param expression - The binding to inspect.
757
- */
758
- isVolatileBinding(expression) {
759
- return volatileRegex.test(expression.toString());
760
- },
761
- });
762
- });
763
- const contextEvent = FAST.getById(KernelServiceId.contextEvent, () => {
764
- let current = null;
765
- return {
766
- get() {
767
- return current;
768
- },
769
- set(event) {
770
- current = event;
771
- },
772
- };
773
- });
774
- /**
775
- * Provides additional contextual information available to behaviors and expressions.
776
- * @public
777
- */
778
- const ExecutionContext = Object.freeze({
779
- /**
780
- * A default execution context.
781
- */
782
- default: {
783
- index: 0,
784
- length: 0,
785
- get event() {
786
- return ExecutionContext.getEvent();
787
- },
788
- eventDetail() {
789
- return this.event.detail;
790
- },
791
- eventTarget() {
792
- return this.event.target;
793
- },
794
- },
795
- /**
796
- * Gets the current event.
797
- * @returns An event object.
798
- */
799
- getEvent() {
800
- return contextEvent.get();
801
- },
802
- /**
803
- * Sets the current event.
804
- * @param event - An event object.
805
- */
806
- setEvent(event) {
807
- contextEvent.set(event);
808
- },
809
- });
810
-
811
- const marker = `fast-${Math.random().toString(36).substring(2, 8)}`;
812
- let id = 0;
813
- /** @internal */
814
- const nextId = () => `${marker}-${++id}`;
815
-
816
- /**
817
- * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
818
- * control ViewBehaviors.
819
- * @public
820
- */
821
- const ViewBehaviorOrchestrator = Object.freeze({
822
- /**
823
- * Creates a ViewBehaviorOrchestrator.
824
- * @param source - The source to to associate behaviors with.
825
- * @returns A ViewBehaviorOrchestrator.
826
- */
827
- create(source) {
828
- const behaviors = [];
829
- const targets = {};
830
- let unbindables = null;
831
- let isConnected = false;
832
- return {
833
- source,
834
- context: ExecutionContext.default,
835
- targets,
836
- get isBound() {
837
- return isConnected;
838
- },
839
- addBehaviorFactory(factory, target) {
840
- var _a, _b, _c, _d;
841
- const compiled = factory;
842
- compiled.id = (_a = compiled.id) !== null && _a !== void 0 ? _a : nextId();
843
- compiled.targetNodeId = (_b = compiled.targetNodeId) !== null && _b !== void 0 ? _b : nextId();
844
- compiled.targetTagName = (_c = target.tagName) !== null && _c !== void 0 ? _c : null;
845
- compiled.policy = (_d = compiled.policy) !== null && _d !== void 0 ? _d : DOM.policy;
846
- this.addTarget(compiled.targetNodeId, target);
847
- this.addBehavior(compiled.createBehavior());
848
- },
849
- addTarget(nodeId, target) {
850
- targets[nodeId] = target;
851
- },
852
- addBehavior(behavior) {
853
- behaviors.push(behavior);
854
- if (isConnected) {
855
- behavior.bind(this);
856
- }
857
- },
858
- onUnbind(unbindable) {
859
- if (unbindables === null) {
860
- unbindables = [];
861
- }
862
- unbindables.push(unbindable);
863
- },
864
- connectedCallback(controller) {
865
- if (!isConnected) {
866
- isConnected = true;
867
- behaviors.forEach(x => x.bind(this));
868
- }
869
- },
870
- disconnectedCallback(controller) {
871
- if (isConnected) {
872
- isConnected = false;
873
- if (unbindables !== null) {
874
- unbindables.forEach(x => x.unbind(this));
875
- }
876
- }
877
- },
878
- };
879
- },
880
- });
881
-
882
- var __defProp$2 = Object.defineProperty;
883
- var __decorateClass$2 = (decorators, target, key, kind) => {
884
- var result = void 0 ;
885
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
886
- if (decorator = decorators[i])
887
- result = (decorator(target, key, result) ) || result;
888
- if (result) __defProp$2(target, key, result);
889
- return result;
890
- };
891
- const defaultCellContentsTemplate = html`
892
- <template>
893
- ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
894
- </template>
895
- `;
896
- const defaultHeaderCellContentsTemplate = html`
897
- <template>
898
- ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
899
- </template>
900
- `;
901
- class DataGridCell extends Localized(HostSemantics(VividElement)) {
902
- constructor() {
903
- super(...arguments);
904
- // eslint-disable-next-line @repo/repo/no-attribute-default-value
905
- this.cellType = DataGridCellTypes.default;
906
- this.rowData = null;
907
- this.columnDefinition = null;
908
- this.isActiveCell = false;
909
- this.customCellView = null;
910
- this.updateCellStyle = () => {
911
- if (this.gridColumn && !this.gridColumn.includes("undefined")) {
912
- this.style.gridColumn = this.gridColumn;
913
- } else {
914
- this.style.removeProperty("grid-column");
915
- }
916
- };
917
- this._selectable = false;
918
- this.selected = false;
919
- /**
920
- * Indicates the selected status.
921
- *
922
- * @deprecated For setting selected state, please use `selected` property instead.
923
- * @public
924
- * HTML Attribute: aria-selected
925
- */
926
- this.ariaSelected = null;
927
- /**
928
- * Indicates the sort status.
929
- *
930
- * @deprecated To set the sorting visual style please use `sortDirection` property.
931
- * @public
932
- * HTML Attribute: aria-sort
933
- */
934
- this.ariaSort = null;
935
- }
936
- /**
937
- * @internal
938
- */
939
- cellTypeChanged() {
940
- if (this.$fastController.isConnected) {
941
- this.updateCellView();
942
- }
943
- }
944
- /**
945
- * @internal
946
- */
947
- gridColumnChanged() {
948
- if (this.$fastController.isConnected) {
949
- this.updateCellStyle();
950
- }
951
- }
952
- /**
953
- * @internal
954
- */
955
- columnDefinitionChanged(_oldValue, _newValue) {
956
- if (this.$fastController.isConnected) {
957
- this.updateCellView();
958
- }
959
- }
960
- /**
961
- * Updates the fixed column style
962
- * @internal
963
- */
964
- updateFixedStyle() {
965
- if (this.fixedPosition !== void 0) {
966
- this.setAttribute("data-fixed", "");
967
- this.style.left = this.fixedPosition;
968
- } else {
969
- this.removeAttribute("data-fixed");
970
- this.style.removeProperty("left");
971
- }
972
- }
973
- /**
974
- * Sets the fixed state and position for this cell
975
- * @internal
976
- */
977
- setFixedPosition(position) {
978
- this.fixedPosition = position;
979
- this.updateFixedStyle();
980
- }
981
- /**
982
- * @internal
983
- */
984
- connectedCallback() {
985
- super.connectedCallback();
986
- this.addEventListener(eventFocusIn, this.handleFocusin);
987
- this.addEventListener(eventFocusOut, this.handleFocusout);
988
- this.addEventListener(eventKeyDown, this.handleKeydown);
989
- this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
990
- this.updateCellView();
991
- this.updateCellStyle();
992
- this.updateFixedStyle();
993
- }
994
- /**
995
- * @internal
996
- */
997
- disconnectedCallback() {
998
- super.disconnectedCallback();
999
- this.removeEventListener(eventFocusIn, this.handleFocusin);
1000
- this.removeEventListener(
1001
- eventFocusOut,
1002
- this.handleFocusout
1003
- );
1004
- this.removeEventListener(eventKeyDown, this.handleKeydown);
1005
- this.disconnectCellView();
1006
- }
1007
- handleFocusin(_) {
1008
- this.shadowRoot.querySelector(".base").classList.add("active");
1009
- if (this.isActiveCell) {
1010
- return;
1011
- }
1012
- this.isActiveCell = true;
1013
- switch (this.cellType) {
1014
- case DataGridCellTypes.columnHeader:
1015
- if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
1016
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1017
- /* v8 ignore else -- @preserve */
1018
- if (focusTarget !== null) {
1019
- focusTarget.focus();
1020
- }
1021
- }
1022
- break;
1023
- default:
1024
- if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
1025
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1026
- /* v8 ignore else -- @preserve */
1027
- if (focusTarget !== null) {
1028
- focusTarget.focus();
1029
- }
1030
- }
1031
- break;
1032
- }
1033
- this.$emit("cell-focused", this);
1034
- }
1035
- handleFocusout(_) {
1036
- this.shadowRoot.querySelector(".base").classList.remove("active");
1037
- /* v8 ignore else -- @preserve */
1038
- if (this !== document.activeElement && !this.contains(document.activeElement)) {
1039
- this.isActiveCell = false;
1040
- }
1041
- }
1042
- handleKeydown(e) {
1043
- if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) {
1044
- return;
1045
- }
1046
- switch (e.key) {
1047
- case keyEnter:
1048
- case keyFunction2:
1049
- if (this.contains(document.activeElement) && document.activeElement !== this) {
1050
- return;
1051
- }
1052
- switch (this.cellType) {
1053
- case DataGridCellTypes.columnHeader: {
1054
- if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
1055
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1056
- /* v8 ignore else -- @preserve */
1057
- if (focusTarget !== null) {
1058
- focusTarget.focus();
1059
- }
1060
- e.preventDefault();
1061
- }
1062
- break;
1063
- }
1064
- default: {
1065
- if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
1066
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1067
- /* v8 ignore else -- @preserve */
1068
- if (focusTarget !== null) {
1069
- focusTarget.focus();
1070
- }
1071
- e.preventDefault();
1072
- }
1073
- break;
1074
- }
1075
- }
1076
- break;
1077
- case keyEscape: {
1078
- /* v8 ignore else -- @preserve */
1079
- if (this.contains(document.activeElement) && document.activeElement !== this) {
1080
- this.focus();
1081
- e.preventDefault();
1082
- }
1083
- break;
1084
- }
1085
- }
1086
- }
1087
- updateCellView() {
1088
- this.disconnectCellView();
1089
- if (this.columnDefinition === null) {
1090
- return;
1091
- }
1092
- switch (this.cellType) {
1093
- case DataGridCellTypes.columnHeader:
1094
- if (this.columnDefinition.headerCellTemplate !== void 0) {
1095
- this.customCellView = this.columnDefinition.headerCellTemplate.render(
1096
- this,
1097
- this
1098
- );
1099
- } else {
1100
- this.customCellView = defaultHeaderCellContentsTemplate.render(
1101
- this,
1102
- this
1103
- );
1104
- }
1105
- break;
1106
- case DataGridCellTypes.rowHeader:
1107
- case DataGridCellTypes.default:
1108
- if (this.columnDefinition.cellTemplate !== void 0) {
1109
- this.customCellView = this.columnDefinition.cellTemplate.render(
1110
- this,
1111
- this
1112
- );
1113
- } else {
1114
- this.customCellView = defaultCellContentsTemplate.render(this, this);
1115
- }
1116
- break;
1117
- }
1118
- if (!this.columnDefinition?.sortable) {
1119
- this.sortDirection = void 0;
1120
- } else if (this.columnDefinition.sortDirection) {
1121
- this.sortDirection = this.columnDefinition.sortDirection;
1122
- } else {
1123
- this.sortDirection = DataGridCellSortStates.none;
1124
- }
1125
- }
1126
- disconnectCellView() {
1127
- if (this.customCellView !== null) {
1128
- this.customCellView.dispose();
1129
- this.customCellView = null;
1130
- }
1131
- }
1132
- /**
1133
- * @internal
1134
- */
1135
- ariaSelectedChanged(prevValue, newValue) {
1136
- super.ariaSelectedChanged(prevValue, newValue);
1137
- this._selectable = newValue !== null;
1138
- this.selected = newValue === "true";
1139
- }
1140
- /**
1141
- * @internal
1142
- */
1143
- ariaSortChanged(oldValue, newValue) {
1144
- super.ariaSortChanged(oldValue, newValue);
1145
- if (newValue === null) {
1146
- this.sortDirection = void 0;
1147
- return;
1148
- }
1149
- this.sortDirection = newValue;
1150
- }
1151
- #getColumnDataKey() {
1152
- return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
1153
- }
1154
- /**
1155
- * @internal
1156
- */
1157
- _handleInteraction() {
1158
- const isHeaderCell = this.cellType === "columnheader";
1159
- const isSortable = isHeaderCell && this.sortDirection !== void 0;
1160
- if (isSortable) {
1161
- this.$emit("sort", {
1162
- columnDataKey: this.#getColumnDataKey(),
1163
- sortDirection: this.sortDirection
1164
- });
1165
- }
1166
- const hasInternalFocusQueue = isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue;
1167
- if (!hasInternalFocusQueue) {
1168
- this.$emit("cell-click", {
1169
- cell: this,
1170
- row: this.parentElement,
1171
- isHeaderCell,
1172
- columnDataKey: this.#getColumnDataKey()
1173
- });
1174
- }
1175
- return true;
1176
- }
1177
- }
1178
- __decorateClass$2([
1179
- attr({ attribute: "cell-type" })
1180
- ], DataGridCell.prototype, "cellType");
1181
- __decorateClass$2([
1182
- attr({ attribute: "grid-column" })
1183
- ], DataGridCell.prototype, "gridColumn");
1184
- __decorateClass$2([
1185
- observable
1186
- ], DataGridCell.prototype, "rowData");
1187
- __decorateClass$2([
1188
- observable
1189
- ], DataGridCell.prototype, "columnDefinition");
1190
- __decorateClass$2([
1191
- observable
1192
- ], DataGridCell.prototype, "_selectable");
1193
- __decorateClass$2([
1194
- attr({ mode: "boolean" })
1195
- ], DataGridCell.prototype, "selected");
1196
- __decorateClass$2([
1197
- attr({ attribute: "sort-direction" })
1198
- ], DataGridCell.prototype, "sortDirection");
1199
- __decorateClass$2([
1200
- observable
1201
- ], DataGridCell.prototype, "_actionItemsSlottedContent");
1202
-
1203
- var __defProp$1 = Object.defineProperty;
1204
- var __decorateClass$1 = (decorators, target, key, kind) => {
1205
- var result = void 0 ;
1206
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1207
- if (decorator = decorators[i])
1208
- result = (decorator(target, key, result) ) || result;
1209
- if (result) __defProp$1(target, key, result);
1210
- return result;
1211
- };
1212
- class DataGridRow extends HostSemantics(VividElement) {
1213
- constructor() {
1214
- super(...arguments);
1215
- // eslint-disable-next-line @repo/repo/no-attribute-default-value
1216
- this.rowType = DataGridRowTypes.default;
1217
- this.rowData = null;
1218
- this.columnDefinitions = null;
1219
- this.behaviorOrchestrator = null;
1220
- /**
1221
- * @internal
1222
- */
1223
- this.focusColumnIndex = 0;
1224
- this.updateRowStyle = () => {
1225
- this.style.gridTemplateColumns = this.gridTemplateColumns;
1226
- };
1227
- /**
1228
- * Indicates the selected status.
1229
- *
1230
- * @deprecated
1231
- * @public
1232
- * HTML Attribute: aria-selected
1233
- */
1234
- this.ariaSelected = null;
1235
- this._selectable = false;
1236
- this.selected = false;
1237
- }
1238
- /**
1239
- * @internal
1240
- */
1241
- gridTemplateColumnsChanged() {
1242
- if (this.$fastController.isConnected) {
1243
- this.updateRowStyle();
1244
- }
1245
- }
1246
- /**
1247
- * @internal
1248
- */
1249
- rowTypeChanged() {
1250
- if (this.$fastController.isConnected) {
1251
- this.updateItemTemplate();
1252
- }
1253
- }
1254
- /**
1255
- * @internal
1256
- */
1257
- cellItemTemplateChanged() {
1258
- this.updateItemTemplate();
1259
- }
1260
- /**
1261
- * @internal
1262
- */
1263
- headerCellItemTemplateChanged() {
1264
- this.updateItemTemplate();
1265
- }
1266
- /**
1267
- * @internal
1268
- */
1269
- connectedCallback() {
1270
- super.connectedCallback();
1271
- /* v8 ignore else -- @preserve */
1272
- if (this.behaviorOrchestrator === null) {
1273
- this.updateItemTemplate();
1274
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1275
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1276
- this.behaviorOrchestrator.addBehaviorFactory(
1277
- new RepeatDirective(
1278
- normalizeBinding((x) => x.columnDefinitions),
1279
- normalizeBinding((x) => x.activeCellItemTemplate),
1280
- { positioning: true }
1281
- ),
1282
- this.appendChild(document.createComment(""))
1283
- );
1284
- }
1285
- this.addEventListener("cell-focused", this.handleCellFocus);
1286
- this.addEventListener(eventFocusOut, this.handleFocusout);
1287
- this.addEventListener(eventKeyDown, this.handleKeydown);
1288
- this.updateRowStyle();
1289
- }
1290
- /**
1291
- * @internal
1292
- */
1293
- disconnectedCallback() {
1294
- super.disconnectedCallback();
1295
- this.removeEventListener("cell-focused", this.handleCellFocus);
1296
- this.removeEventListener(
1297
- eventFocusOut,
1298
- this.handleFocusout
1299
- );
1300
- this.removeEventListener(eventKeyDown, this.handleKeydown);
1301
- }
1302
- handleFocusout(_) {
1303
- /* v8 ignore else -- @preserve */
1304
- if (!this.contains(document.activeElement)) {
1305
- this.focusColumnIndex = 0;
1306
- }
1307
- }
1308
- handleCellFocus(e) {
1309
- this.focusColumnIndex = this.cellElements.indexOf(e.target);
1310
- this.$emit("row-focused", this);
1311
- }
1312
- handleKeydown(e) {
1313
- if (e.defaultPrevented) {
1314
- return;
1315
- }
1316
- let newFocusColumnIndex = 0;
1317
- switch (e.key) {
1318
- case keyArrowLeft:
1319
- newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
1320
- this.cellElements[newFocusColumnIndex].focus();
1321
- e.preventDefault();
1322
- break;
1323
- case keyArrowRight:
1324
- newFocusColumnIndex = Math.min(
1325
- this.cellElements.length - 1,
1326
- this.focusColumnIndex + 1
1327
- );
1328
- this.cellElements[newFocusColumnIndex].focus();
1329
- e.preventDefault();
1330
- break;
1331
- case keyHome:
1332
- if (!e.ctrlKey) {
1333
- this.cellElements[0].focus();
1334
- e.preventDefault();
1335
- }
1336
- break;
1337
- case keyEnd:
1338
- if (!e.ctrlKey) {
1339
- this.cellElements[this.cellElements.length - 1].focus();
1340
- e.preventDefault();
1341
- }
1342
- break;
1343
- }
1344
- }
1345
- updateItemTemplate() {
1346
- this.activeCellItemTemplate = this.rowType === DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
1347
- }
1348
- /**
1349
- * @internal
1350
- */
1351
- ariaSelectedChanged(oldValue, newValue) {
1352
- super.ariaSelectedChanged(oldValue, newValue);
1353
- this._selectable = newValue !== null;
1354
- this.selected = newValue === "true";
1355
- }
1356
- }
1357
- // @ts-expect-error Type is incorrectly non-optional
1358
- __decorateClass$1([
1359
- attr({ attribute: "grid-template-columns" })
1360
- ], DataGridRow.prototype, "gridTemplateColumns");
1361
- __decorateClass$1([
1362
- attr({ attribute: "row-type" })
1363
- ], DataGridRow.prototype, "rowType");
1364
- __decorateClass$1([
1365
- observable
1366
- ], DataGridRow.prototype, "rowData");
1367
- __decorateClass$1([
1368
- observable
1369
- ], DataGridRow.prototype, "columnDefinitions");
1370
- __decorateClass$1([
1371
- observable
1372
- ], DataGridRow.prototype, "cellItemTemplate");
1373
- __decorateClass$1([
1374
- observable
1375
- ], DataGridRow.prototype, "headerCellItemTemplate");
1376
- __decorateClass$1([
1377
- observable
1378
- ], DataGridRow.prototype, "rowIndex");
1379
- __decorateClass$1([
1380
- observable
1381
- ], DataGridRow.prototype, "activeCellItemTemplate");
1382
- __decorateClass$1([
1383
- observable
1384
- ], DataGridRow.prototype, "defaultCellItemTemplate");
1385
- __decorateClass$1([
1386
- observable
1387
- ], DataGridRow.prototype, "defaultHeaderCellItemTemplate");
1388
- __decorateClass$1([
1389
- observable
1390
- ], DataGridRow.prototype, "cellElements");
1391
- __decorateClass$1([
1392
- observable
1393
- ], DataGridRow.prototype, "_selectable");
1394
- __decorateClass$1([
1395
- attr({ mode: "boolean" })
1396
- ], DataGridRow.prototype, "selected");
1397
-
1398
- var __defProp = Object.defineProperty;
1399
- var __decorateClass = (decorators, target, key, kind) => {
1400
- var result = void 0 ;
1401
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1402
- if (decorator = decorators[i])
1403
- result = (decorator(target, key, result) ) || result;
1404
- if (result) __defProp(target, key, result);
1405
- return result;
1406
- };
1407
- const DataGridSelectionMode = {
1408
- none: "none",
1409
- singleRow: "single-row",
1410
- multiRow: "multi-row",
1411
- singleCell: "single-cell",
1412
- multiCell: "multi-cell"
1413
- };
1414
- const _DataGrid = class _DataGrid extends VividElement {
1415
- constructor() {
1416
- super();
1417
- this.noTabbing = false;
1418
- // eslint-disable-next-line @repo/repo/no-attribute-default-value
1419
- this.generateHeader = GenerateHeaderOptions.default;
1420
- this.rowsData = [];
1421
- this.columnDefinitions = null;
1422
- this.focusRowIndex = 0;
1423
- this.focusColumnIndex = 0;
1424
- /**
1425
- * @internal
1426
- */
1427
- this.fixedColumnsPositions = [];
1428
- this.behaviorOrchestrator = null;
1429
- this.generatedHeader = null;
1430
- this.isUpdatingFocus = false;
1431
- this.pendingFocusUpdate = false;
1432
- this.rowindexUpdateQueued = false;
1433
- this.columnDefinitionsStale = true;
1434
- this.generatedGridTemplateColumns = "";
1435
- this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
1436
- if (this.rowElements.length === 0) {
1437
- this.focusRowIndex = 0;
1438
- this.focusColumnIndex = 0;
1439
- return;
1440
- }
1441
- const focusRowIndex = Math.max(
1442
- 0,
1443
- Math.min(this.rowElements.length - 1, rowIndex)
1444
- );
1445
- const focusRow = this.rowElements[focusRowIndex];
1446
- const cells = focusRow.querySelectorAll(
1447
- '[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"], [data-vvd-component="data-grid-cell"]'
1448
- );
1449
- const focusColumnIndex = Math.max(
1450
- 0,
1451
- Math.min(cells.length - 1, columnIndex)
1452
- );
1453
- const focusTarget = cells[focusColumnIndex];
1454
- if (scrollIntoView && this.scrollHeight !== this.clientHeight && (focusRowIndex < this.focusRowIndex && this.scrollTop > 0 || focusRowIndex > this.focusRowIndex && this.scrollTop < this.scrollHeight - this.clientHeight)) {
1455
- focusTarget.scrollIntoView({ block: "center", inline: "center" });
1456
- }
1457
- focusTarget.focus();
1458
- };
1459
- this.onChildListChange = (mutations, _) => {
1460
- /* v8 ignore else -- @preserve */
1461
- if (mutations && mutations.length) {
1462
- mutations.forEach((mutation) => {
1463
- mutation.addedNodes.forEach((newNode) => {
1464
- if (newNode.nodeType === 1 && (newNode.getAttribute("role") === "row" || newNode.getAttribute("row-type") === "default")) {
1465
- newNode.columnDefinitions = this.columnDefinitions;
1466
- }
1467
- });
1468
- });
1469
- this.queueRowIndexUpdate();
1470
- }
1471
- };
1472
- this.queueRowIndexUpdate = () => {
1473
- if (!this.rowindexUpdateQueued) {
1474
- this.rowindexUpdateQueued = true;
1475
- Updates$1.enqueue(this.updateRowIndexes);
1476
- }
1477
- };
1478
- this.updateRowIndexes = () => {
1479
- let newGridTemplateColumns = this.gridTemplateColumns;
1480
- if (newGridTemplateColumns === void 0) {
1481
- if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
1482
- const firstRow = this.rowElements[0];
1483
- this.generatedGridTemplateColumns = new Array(
1484
- firstRow.cellElements.length
1485
- ).fill("1fr").join(" ");
1486
- }
1487
- newGridTemplateColumns = this.generatedGridTemplateColumns;
1488
- }
1489
- this.rowElements.forEach((element, index) => {
1490
- const thisRow = element;
1491
- thisRow.rowIndex = index;
1492
- thisRow.gridTemplateColumns = newGridTemplateColumns;
1493
- if (this.columnDefinitionsStale) {
1494
- thisRow.columnDefinitions = this.columnDefinitions;
1495
- }
1496
- });
1497
- this.rowindexUpdateQueued = false;
1498
- this.columnDefinitionsStale = false;
1499
- };
1500
- this.#handleKeypress = (e) => {
1501
- if (e.key === "Enter" || e.key === " ") {
1502
- this.#handleClick(e);
1503
- }
1504
- };
1505
- this.#handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
1506
- if (target.getAttribute("role") !== "gridcell" || target.getAttribute("cell-type") !== "default")
1507
- return;
1508
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
1509
- this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
1510
- return;
1511
- }
1512
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
1513
- this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
1514
- }
1515
- };
1516
- this.#handleCellSelection = ({
1517
- target,
1518
- ctrlKey,
1519
- shiftKey,
1520
- metaKey
1521
- }) => {
1522
- const cell = target;
1523
- if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
1524
- cell.selected = !this.#selectedCells.includes(cell);
1525
- } else {
1526
- const cacheTargetSelection = cell.selected;
1527
- this._resetSelection(true);
1528
- cell.selected = !cacheTargetSelection;
1529
- }
1530
- };
1531
- this.#handleRowSelection = ({
1532
- target,
1533
- ctrlKey,
1534
- shiftKey,
1535
- metaKey
1536
- }) => {
1537
- const row = target.parentNode;
1538
- if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
1539
- row.selected = !this.#selectedRows.includes(row);
1540
- } else {
1541
- const cacheTargetSelection = row.selected;
1542
- this._resetSelection(true);
1543
- row.selected = !cacheTargetSelection;
1544
- }
1545
- };
1546
- this.#changeHandler = {
1547
- handleChange(dataGrid, propertyName) {
1548
- /* v8 ignore else -- @preserve */
1549
- if (propertyName === "columnDefinitions") {
1550
- /* v8 ignore else -- @preserve */
1551
- if (dataGrid.$fastController.isConnected) {
1552
- dataGrid.toggleGeneratedHeader();
1553
- }
1554
- }
1555
- }
1556
- };
1557
- /**
1558
- * @internal
1559
- */
1560
- this._resetSelection = (clear = false) => {
1561
- const cells = Array.from(
1562
- this.querySelectorAll('[role="gridcell"], [cell-type="default"]')
1563
- );
1564
- const rows = Array.from(
1565
- this.querySelectorAll('[role="row"], [row-type="default"]')
1566
- );
1567
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
1568
- for (const cell of cells) {
1569
- cell._selectable = true;
1570
- cell.selected = clear ? false : cell.selected || false;
1571
- }
1572
- for (const row of rows) {
1573
- row._selectable = false;
1574
- row.selected = false;
1575
- }
1576
- }
1577
- if (this.selectionMode === DataGridSelectionMode.none) {
1578
- for (const element of [...cells, ...rows]) {
1579
- element._selectable = false;
1580
- element.selected = false;
1581
- }
1582
- }
1583
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
1584
- for (const cell of cells) {
1585
- cell._selectable = false;
1586
- cell.selected = false;
1587
- }
1588
- for (const row of rows) {
1589
- row._selectable = true;
1590
- row.selected = clear ? false : row.selected || false;
1591
- }
1592
- }
1593
- };
1594
- this.addEventListener("click", this.#handleClick);
1595
- this.addEventListener("keydown", this.#handleKeypress);
1596
- }
1597
- /**
1598
- * generates a gridTemplateColumns based on columndata array
1599
- */
1600
- static generateTemplateColumns(columnDefinitions) {
1601
- let templateColumns = "";
1602
- columnDefinitions.forEach((_) => {
1603
- templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
1604
- });
1605
- return templateColumns;
1606
- }
1607
- /**
1608
- * @internal
1609
- */
1610
- noTabbingChanged() {
1611
- if (this.$fastController.isConnected) {
1612
- this.#setTabIndex();
1613
- }
1614
- }
1615
- #setTabIndex() {
1616
- this.setAttribute(
1617
- "tabIndex",
1618
- this.noTabbing || this.contains(document.activeElement) ? "-1" : "0"
1619
- );
1620
- }
1621
- /**
1622
- * @internal
1623
- */
1624
- generateHeaderChanged() {
1625
- if (this.$fastController.isConnected) {
1626
- this.toggleGeneratedHeader();
1627
- }
1628
- }
1629
- /**
1630
- * @internal
1631
- */
1632
- gridTemplateColumnsChanged() {
1633
- /* v8 ignore if -- @preserve */
1634
- if (this.$fastController.isConnected) {
1635
- this.updateRowIndexes();
1636
- if (this.fixedColumns && this.fixedColumns > 0) {
1637
- this.applyFixedColumns();
1638
- }
1639
- }
1640
- }
1641
- /**
1642
- * @internal
1643
- */
1644
- rowsDataChanged() {
1645
- if (this.columnDefinitions === null && this.rowsData.length > 0) {
1646
- this.columnDefinitions = _DataGrid.generateColumns(this.rowsData[0]);
1647
- }
1648
- if (this.$fastController.isConnected) {
1649
- this.toggleGeneratedHeader();
1650
- }
1651
- }
1652
- /**
1653
- * @internal
1654
- */
1655
- columnDefinitionsChanged() {
1656
- if (this.columnDefinitions === null) {
1657
- this.generatedGridTemplateColumns = "";
1658
- return;
1659
- }
1660
- this.generatedGridTemplateColumns = _DataGrid.generateTemplateColumns(
1661
- this.columnDefinitions
1662
- );
1663
- /* v8 ignore if -- @preserve */
1664
- if (this.$fastController.isConnected) {
1665
- this.columnDefinitionsStale = true;
1666
- this.queueRowIndexUpdate();
1667
- }
1668
- }
1669
- /**
1670
- * @internal
1671
- */
1672
- headerCellItemTemplateChanged() {
1673
- /* v8 ignore if -- @preserve */
1674
- if (this.$fastController.isConnected) {
1675
- if (this.generatedHeader !== null) {
1676
- this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
1677
- }
1678
- }
1679
- }
1680
- /**
1681
- * @internal
1682
- */
1683
- focusRowIndexChanged() {
1684
- if (this.$fastController.isConnected) {
1685
- this.queueFocusUpdate();
1686
- }
1687
- }
1688
- /**
1689
- * @internal
1690
- */
1691
- focusColumnIndexChanged() {
1692
- if (this.$fastController.isConnected) {
1693
- this.queueFocusUpdate();
1694
- }
1695
- }
1696
- /**
1697
- * @internal
1698
- */
1699
- fixedColumnsChanged() {
1700
- /* v8 ignore if -- @preserve */
1701
- if (this.$fastController.isConnected) {
1702
- this.applyFixedColumns();
1703
- this.setupResizeObserver();
1704
- }
1705
- }
1706
- /**
1707
- * @internal
1708
- */
1709
- setupResizeObserver() {
1710
- if (this.resizeObserver) {
1711
- this.resizeObserver.disconnect();
1712
- this.resizeObserver = void 0;
1713
- }
1714
- if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
1715
- this.resizeObserver = new ResizeObserver(() => {
1716
- this.applyFixedColumns();
1717
- });
1718
- this.resizeObserver.observe(this);
1719
- }
1720
- }
1721
- /**
1722
- * @internal
1723
- */
1724
- connectedCallback() {
1725
- super.connectedCallback();
1726
- /* v8 ignore else -- @preserve */
1727
- if (this.rowItemTemplate === void 0) {
1728
- this.rowItemTemplate = this.defaultRowItemTemplate;
1729
- }
1730
- /* v8 ignore else -- @preserve */
1731
- if (this.behaviorOrchestrator === null) {
1732
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1733
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1734
- this.behaviorOrchestrator.addBehaviorFactory(
1735
- new RepeatDirective(
1736
- normalizeBinding((x) => x.rowsData),
1737
- normalizeBinding((x) => x.rowItemTemplate),
1738
- { positioning: true }
1739
- ),
1740
- this.appendChild(document.createComment(""))
1741
- );
1742
- }
1743
- this.toggleGeneratedHeader();
1744
- this.addEventListener("row-focused", this.handleRowFocus);
1745
- this.addEventListener(eventFocus, this.handleFocus);
1746
- this.addEventListener(eventKeyDown, this.handleKeydown);
1747
- this.addEventListener(eventFocusOut, this.handleFocusOut);
1748
- this.observer = new MutationObserver(this.onChildListChange);
1749
- this.observer.observe(this, { childList: true });
1750
- this.setupResizeObserver();
1751
- Updates$1.enqueue(this.queueRowIndexUpdate);
1752
- this.#setTabIndex();
1753
- Observable.getNotifier(this).subscribe(
1754
- this.#changeHandler,
1755
- "columnDefinitions"
1756
- );
1757
- }
1758
- /**
1759
- * @internal
1760
- */
1761
- disconnectedCallback() {
1762
- super.disconnectedCallback();
1763
- this.removeEventListener("row-focused", this.handleRowFocus);
1764
- this.removeEventListener(eventFocus, this.handleFocus);
1765
- this.removeEventListener(eventKeyDown, this.handleKeydown);
1766
- this.removeEventListener(
1767
- eventFocusOut,
1768
- this.handleFocusOut
1769
- );
1770
- this.observer.disconnect();
1771
- if (this.resizeObserver) {
1772
- this.resizeObserver.disconnect();
1773
- this.resizeObserver = void 0;
1774
- }
1775
- this.generatedHeader = null;
1776
- Observable.getNotifier(this).unsubscribe(
1777
- this.#changeHandler,
1778
- "columnDefinitions"
1779
- );
1780
- }
1781
- /**
1782
- * @internal
1783
- */
1784
- handleRowFocus(e) {
1785
- this.isUpdatingFocus = true;
1786
- const focusRow = e.target;
1787
- this.focusRowIndex = this.rowElements.indexOf(focusRow);
1788
- this.focusColumnIndex = focusRow.focusColumnIndex;
1789
- this.setAttribute("tabIndex", "-1");
1790
- this.isUpdatingFocus = false;
1791
- }
1792
- /**
1793
- * @internal
1794
- */
1795
- handleFocus(_) {
1796
- this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
1797
- }
1798
- /**
1799
- * @internal
1800
- */
1801
- handleFocusOut(e) {
1802
- if (e.relatedTarget === null || !this.contains(e.relatedTarget)) {
1803
- this.setAttribute("tabIndex", this.noTabbing ? "-1" : "0");
1804
- }
1805
- }
1806
- /**
1807
- * @internal
1808
- */
1809
- handleKeydown(e) {
1810
- if (e.defaultPrevented) {
1811
- return;
1812
- }
1813
- let newFocusRowIndex;
1814
- const maxIndex = this.rowElements.length - 1;
1815
- const currentGridBottom = this.offsetHeight + this.scrollTop;
1816
- const lastRow = this.rowElements[maxIndex];
1817
- switch (e.key) {
1818
- case keyArrowUp:
1819
- e.preventDefault();
1820
- this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
1821
- break;
1822
- case keyArrowDown:
1823
- e.preventDefault();
1824
- this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
1825
- break;
1826
- case keyPageUp:
1827
- e.preventDefault();
1828
- if (this.rowElements.length === 0) {
1829
- this.focusOnCell(0, 0, false);
1830
- break;
1831
- }
1832
- if (this.focusRowIndex === 0) {
1833
- this.focusOnCell(0, this.focusColumnIndex, false);
1834
- return;
1835
- }
1836
- newFocusRowIndex = this.focusRowIndex - 1;
1837
- for (newFocusRowIndex; newFocusRowIndex >= 0; newFocusRowIndex--) {
1838
- const thisRow = this.rowElements[newFocusRowIndex];
1839
- if (thisRow.offsetTop < this.scrollTop) {
1840
- this.scrollTop = thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
1841
- break;
1842
- }
1843
- }
1844
- this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
1845
- break;
1846
- case keyPageDown:
1847
- e.preventDefault();
1848
- if (this.rowElements.length === 0) {
1849
- this.focusOnCell(0, 0, false);
1850
- break;
1851
- }
1852
- if (this.focusRowIndex >= maxIndex || lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
1853
- this.focusOnCell(maxIndex, this.focusColumnIndex, false);
1854
- return;
1855
- }
1856
- newFocusRowIndex = this.focusRowIndex + 1;
1857
- for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
1858
- const thisRow = this.rowElements[newFocusRowIndex];
1859
- if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
1860
- let stickyHeaderOffset = 0;
1861
- if (this.generateHeader === GenerateHeaderOptions.sticky && this.generatedHeader !== null) {
1862
- stickyHeaderOffset = this.generatedHeader.clientHeight;
1863
- }
1864
- this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
1865
- break;
1866
- }
1867
- }
1868
- this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
1869
- break;
1870
- case keyHome: {
1871
- /* v8 ignore else -- @preserve */
1872
- if (e.ctrlKey) {
1873
- e.preventDefault();
1874
- this.focusOnCell(0, 0, true);
1875
- }
1876
- break;
1877
- }
1878
- case keyEnd: {
1879
- /* v8 ignore else -- @preserve */
1880
- if (e.ctrlKey && this.columnDefinitions !== null) {
1881
- e.preventDefault();
1882
- this.focusOnCell(
1883
- this.rowElements.length - 1,
1884
- this.columnDefinitions.length - 1,
1885
- true
1886
- );
1887
- }
1888
- break;
1889
- }
1890
- }
1891
- }
1892
- queueFocusUpdate() {
1893
- if (this.isUpdatingFocus && this.contains(document.activeElement)) {
1894
- return;
1895
- }
1896
- if (this.pendingFocusUpdate === false) {
1897
- this.pendingFocusUpdate = true;
1898
- Updates$1.enqueue(() => this.updateFocus());
1899
- }
1900
- }
1901
- updateFocus() {
1902
- this.pendingFocusUpdate = false;
1903
- this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
1904
- }
1905
- toggleGeneratedHeader() {
1906
- if (this.generatedHeader !== null) {
1907
- this.removeChild(this.generatedHeader);
1908
- this.generatedHeader = null;
1909
- }
1910
- if (this.generateHeader !== GenerateHeaderOptions.none && this.columnDefinitions !== null) {
1911
- const generatedHeaderElement = document.createElement(
1912
- this.rowElementTag
1913
- );
1914
- this.generatedHeader = generatedHeaderElement;
1915
- this.generatedHeader.columnDefinitions = this.columnDefinitions;
1916
- this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
1917
- this.generatedHeader.rowType = this.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
1918
- /* v8 ignore else -- @preserve */
1919
- if (this.firstChild !== null) {
1920
- this.insertBefore(generatedHeaderElement, this.firstChild);
1921
- }
1922
- return;
1923
- }
1924
- }
1925
- /**
1926
- *
1927
- *
1928
- * @internal
1929
- */
1930
- slottedRowElementsChanged(_oldValue, _newValue) {
1931
- this._resetSelection();
1932
- }
1933
- get #selectedRows() {
1934
- return this.rowElements.filter((row) => row.selected);
1935
- }
1936
- get #selectedCells() {
1937
- return this.rowElements.reduce((acc, row) => {
1938
- const rowChildren = Array.from(row.children);
1939
- const selectedCells = rowChildren.filter(
1940
- (cell) => cell.selected
1941
- );
1942
- return acc.concat(selectedCells);
1943
- }, []);
1944
- }
1945
- selectionModeChanged(oldValue) {
1946
- if (oldValue === void 0) {
1947
- Updates$1.enqueue(this._resetSelection);
1948
- return;
1949
- }
1950
- this._resetSelection(true);
1951
- }
1952
- #handleKeypress;
1953
- #handleClick;
1954
- #handleCellSelection;
1955
- #handleRowSelection;
1956
- #changeHandler;
1957
- static generateColumns(rowData) {
1958
- return Object.keys(rowData).map((property, index) => {
1959
- return {
1960
- columnDataKey: property,
1961
- gridColumn: `${index}`
1962
- };
1963
- });
1964
- }
1965
- /**
1966
- * @internal
1967
- */
1968
- applyFixedColumns() {
1969
- if (!this.fixedColumns || this.fixedColumns <= 0) {
1970
- this.clearFixedColumns();
1971
- return;
1972
- }
1973
- this.calculateFixedColumnPositions();
1974
- this.applyFixedColumnStyling();
1975
- }
1976
- /**
1977
- * Applies fixed columns styling using cached positions
1978
- * @internal
1979
- */
1980
- applyFixedColumnStyling() {
1981
- this.rowElements.forEach((row) => {
1982
- const cells = row.querySelectorAll(
1983
- '[role="cell"], [role="gridcell"], [role="columnheader"], [cell-type="default"], [cell-type="columnheader"]'
1984
- );
1985
- this.fixedColumnsPositions.forEach((position, index) => {
1986
- /* v8 ignore else -- @preserve */
1987
- if (index < cells.length) {
1988
- const gridCell = cells[index];
1989
- /* v8 ignore else -- @preserve */
1990
- if (typeof gridCell.setFixedPosition === "function") {
1991
- gridCell.setFixedPosition(`${position}px`);
1992
- }
1993
- }
1994
- });
1995
- });
1996
- }
1997
- /**
1998
- * Calculates and caches fixed columns positions based on current layout
1999
- * @internal
2000
- */
2001
- calculateFixedColumnPositions() {
2002
- this.fixedColumnsPositions = [];
2003
- if (this.rowElements.length === 0) return;
2004
- const cells = this.rowElements[0].querySelectorAll(
2005
- '[role="cell"], [role="gridcell"], [role="columnheader"], [cell-type="default"], [cell-type="columnheader"]'
2006
- );
2007
- let accumulator = 0;
2008
- for (let i = 0; i < Math.min(this.fixedColumns, cells.length); i++) {
2009
- this.fixedColumnsPositions.push(accumulator);
2010
- accumulator += cells[i].offsetWidth;
2011
- }
2012
- }
2013
- /**
2014
- * Clears all fixed columns state and styling
2015
- * @internal
2016
- */
2017
- clearFixedColumns() {
2018
- if (this.rowElements.length === 0) {
2019
- this.fixedColumnsPositions = [];
2020
- return;
2021
- }
2022
- this.rowElements.forEach((row) => {
2023
- const cells = row.querySelectorAll(
2024
- '[role="cell"], [role="gridcell"], [role="columnheader"], [cell-type="default"], [cell-type="columnheader"]'
2025
- );
2026
- this.fixedColumnsPositions.forEach((_, index) => {
2027
- /* v8 ignore else -- @preserve */
2028
- if (index < cells.length) {
2029
- const gridCell = cells[index];
2030
- /* v8 ignore else -- @preserve */
2031
- if (typeof gridCell.setFixedPosition === "function") {
2032
- gridCell.setFixedPosition(void 0);
2033
- }
2034
- }
2035
- });
2036
- });
2037
- this.fixedColumnsPositions = [];
2038
- }
2039
- };
2040
- __decorateClass([
2041
- attr({ attribute: "no-tabbing", mode: "boolean" })
2042
- ], _DataGrid.prototype, "noTabbing");
2043
- __decorateClass([
2044
- attr({ attribute: "generate-header" })
2045
- ], _DataGrid.prototype, "generateHeader");
2046
- // @ts-expect-error Type is incorrectly non-optional
2047
- __decorateClass([
2048
- attr({ attribute: "grid-template-columns" })
2049
- ], _DataGrid.prototype, "gridTemplateColumns");
2050
- __decorateClass([
2051
- observable
2052
- ], _DataGrid.prototype, "rowsData");
2053
- __decorateClass([
2054
- observable
2055
- ], _DataGrid.prototype, "columnDefinitions");
2056
- __decorateClass([
2057
- observable
2058
- ], _DataGrid.prototype, "rowItemTemplate");
2059
- __decorateClass([
2060
- observable
2061
- ], _DataGrid.prototype, "cellItemTemplate");
2062
- __decorateClass([
2063
- observable
2064
- ], _DataGrid.prototype, "headerCellItemTemplate");
2065
- __decorateClass([
2066
- observable
2067
- ], _DataGrid.prototype, "focusRowIndex");
2068
- __decorateClass([
2069
- observable
2070
- ], _DataGrid.prototype, "focusColumnIndex");
2071
- __decorateClass([
2072
- attr({ attribute: "fixed-columns", converter: nullableNumberConverter })
2073
- ], _DataGrid.prototype, "fixedColumns");
2074
- __decorateClass([
2075
- observable
2076
- ], _DataGrid.prototype, "defaultRowItemTemplate");
2077
- __decorateClass([
2078
- observable
2079
- ], _DataGrid.prototype, "rowElementTag");
2080
- __decorateClass([
2081
- observable
2082
- ], _DataGrid.prototype, "rowElements");
2083
- __decorateClass([
2084
- observable
2085
- ], _DataGrid.prototype, "slottedRowElements");
2086
- __decorateClass([
2087
- attr({ attribute: "selection-mode" })
2088
- ], _DataGrid.prototype, "selectionMode");
2089
- let DataGrid = _DataGrid;
2090
-
2091
- function createRowItemTemplate(context) {
2092
- const rowTag = context.tagFor(DataGridRow);
2093
- return html`
2094
- <${rowTag}
2095
- :rowData="${(x) => x}"
2096
- :cellItemTemplate="${(_, c) => c.parent.cellItemTemplate}"
2097
- :headerCellItemTemplate="${(_, c) => c.parent.headerCellItemTemplate}"
2098
- ></${rowTag}>
2099
- `;
2100
- }
2101
- function getMultiSelectAriaState(x) {
2102
- return x.selectionMode === void 0 || x.selectionMode === DataGridSelectionMode.none ? null : x.selectionMode.includes("multi") ? "true" : "false";
2103
- }
2104
- function setHeaderRow(x) {
2105
- if (x.columnDefinitions === null) {
2106
- const headerRow = x.querySelector(
2107
- '[cell-type="columnheader"]'
2108
- )?.parentElement;
2109
- if (x.generateHeader === GenerateHeaderOptions.default && (headerRow?.getAttribute("row-type") === DataGridRowTypes.header || headerRow?.getAttribute("row-type") === DataGridRowTypes.stickyHeader)) {
2110
- return;
2111
- }
2112
- if (headerRow) {
2113
- const rowType = x.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
2114
- headerRow.setAttribute("row-type", rowType);
2115
- }
2116
- }
2117
- }
2118
- function handleColumnSort(_, { event }) {
2119
- event.stopPropagation();
2120
- }
2121
- const DataGridTemplate = (context) => {
2122
- const rowItemTemplate = createRowItemTemplate(context);
2123
- const rowTag = context.tagFor(DataGridRow, true);
2124
- return html`
2125
- <template
2126
- aria-multiselectable="${getMultiSelectAriaState}"
2127
- role="grid"
2128
- tabindex="0"
2129
- @sort="${handleColumnSort}"
2130
- :rowElementTag="${() => rowTag}"
2131
- :defaultRowItemTemplate="${rowItemTemplate}"
2132
- ${children({
2133
- property: "rowElements",
2134
- filter: elements("[role=row],[data-vvd-component=data-grid-row]")
2135
- })}
2136
- >
2137
- <div class="base">
2138
- ${setHeaderRow}
2139
- <slot ${slotted("slottedRowElements")}></slot>
2140
- </div>
2141
- </template>
2142
- `;
2143
- };
2144
-
2145
- function calculateAriaSelectedValue$1(x) {
2146
- if (x._selectable && x.selected) return "true";
2147
- if (x._selectable && !x.selected) return "false";
2148
- return null;
2149
- }
2150
- function createCellItemTemplate(context) {
2151
- const cellTag = context.tagFor(DataGridCell);
2152
- return html`
2153
- <${cellTag}
2154
- cell-type="${(x) => x.isRowHeader ? "rowheader" : void 0}"
2155
- grid-column="${(_, c) => c.index + 1}"
2156
- :rowData="${(_, c) => c.parent.rowData}"
2157
- :columnDefinition="${(x) => x}"
2158
- selected="${(_, c) => c.parent.ariaSelected === "true" ? true : null}"
2159
- ></${cellTag}>
2160
- `;
2161
- }
2162
- function createHeaderCellItemTemplate(context) {
2163
- const cellTag = context.tagFor(DataGridCell);
2164
- return html`
2165
- <${cellTag}
2166
- cell-type="columnheader"
2167
- grid-column="${(_, c) => c.index + 1}"
2168
- :columnDefinition="${(x) => x}"
2169
- ></${cellTag}>
2170
- `;
2171
- }
2172
- const DataGridRowTemplate = (context) => {
2173
- const cellItemTemplate = createCellItemTemplate(context);
2174
- const headerCellItemTemplate = createHeaderCellItemTemplate(context);
2175
- const getBaseClasses = (x) => classNames("base", ["selected", !!x.selected]);
2176
- return html`
2177
- <template
2178
- ${applyHostSemantics({
2179
- role: "row",
2180
- ariaSelected: calculateAriaSelectedValue$1
2181
- })}
2182
- class="${(x) => x.rowType !== "default" ? x.rowType : ""}"
2183
- :defaultCellItemTemplate="${cellItemTemplate}"
2184
- :defaultHeaderCellItemTemplate="${headerCellItemTemplate}"
2185
- ${children({
2186
- property: "cellElements",
2187
- filter: elements(
2188
- '[role="cell"],[role="gridcell"],[role="columnheader"],[role="rowheader"],[data-vvd-component="data-grid-cell"]'
2189
- )
2190
- })}
2191
- >
2192
- <div
2193
- class="${getBaseClasses}"
2194
- style="grid-template-columns: ${(x) => x.gridTemplateColumns};"
2195
- >
2196
- <slot ${slotted("slottedCellElements")}></slot>
2197
- </div>
2198
- </template>
2199
- `;
2200
- };
2201
-
2202
- function shouldShowSortIcons(x) {
2203
- return x.cellType === "columnheader" && x.sortDirection !== void 0 && x.sortDirection !== DataGridCellSortStates.other;
2204
- }
2205
- function getSortIcon(x) {
2206
- if (x.sortDirection === DataGridCellSortStates.ascending) {
2207
- return "sort-asc-solid";
2208
- }
2209
- if (x.sortDirection === DataGridCellSortStates.descending) {
2210
- return "sort-desc-solid";
2211
- }
2212
- return "sort-solid";
2213
- }
2214
- function calculateAriaSelectedValue(x) {
2215
- if (x._selectable && x.selected) return "true";
2216
- if (x._selectable && !x.selected) return "false";
2217
- return null;
2218
- }
2219
- function renderSortIcons(c) {
2220
- const iconTag = c.tagFor(Icon);
2221
- return html`
2222
- ${when(
2223
- shouldShowSortIcons,
2224
- html`
2225
- <${iconTag} class="header-icon" name="${getSortIcon}"></${iconTag}>
2226
- `
2227
- )}
2228
- `;
2229
- }
2230
- function shouldAnnounceSortState(x) {
2231
- return x.cellType === DataGridCellTypes.columnHeader && x.sortDirection !== void 0;
2232
- }
2233
- function getSortStateKey(x) {
2234
- return x.sortDirection ?? DataGridCellSortStates.none;
2235
- }
2236
- function getLocalizedSortStatus(x) {
2237
- const direction = getSortStateKey(x);
2238
- const sortStatus = x.locale.dataGrid.cell.sortStatus;
2239
- return sortStatus?.[direction];
2240
- }
2241
- function getLocalizedSortInstruction(x) {
2242
- const direction = getSortStateKey(x);
2243
- const sortInstruction = x.locale.dataGrid.cell.sortInstruction;
2244
- return sortInstruction?.[direction];
2245
- }
2246
- function getSortAnnouncement(x) {
2247
- return [getLocalizedSortStatus(x), getLocalizedSortInstruction(x)].filter((part) => !!part).join(" ").trim();
2248
- }
2249
- function handleKeyDown(x, e) {
2250
- if (e.key === keyEnter || e.key === keySpace) {
2251
- const target = e.target;
2252
- if (target.closest('[slot="action-items"]')) return true;
2253
- x._handleInteraction();
2254
- }
2255
- return true;
2256
- }
2257
- function handleClick(x, e) {
2258
- const target = e.target;
2259
- if (target.closest('[slot="action-items"]')) return true;
2260
- x._handleInteraction();
2261
- return true;
2262
- }
2263
- const DataGridCellTemplate = (context) => {
2264
- const visuallyHiddenTagName = context.tagFor(VisuallyHidden);
2265
- const getBaseClasses = ({
2266
- selected,
2267
- _actionItemsSlottedContent
2268
- }) => classNames(
2269
- "base",
2270
- ["selected", !!selected],
2271
- ["has-action-items", Boolean(_actionItemsSlottedContent?.length)]
2272
- );
2273
- return html`
2274
- <template
2275
- tabindex="-1"
2276
- ${applyHostSemantics({
2277
- role: (x) => DataGridCellRole[x.cellType] ?? DataGridCellRole.default,
2278
- ariaSelected: calculateAriaSelectedValue,
2279
- ariaSort: (x) => x.sortDirection ?? null
2280
- })}
2281
- @click="${(x, c) => handleClick(x, c.event)}"
2282
- @keydown="${(x, c) => handleKeyDown(x, c.event)}"
2283
- >
2284
- <div class="${getBaseClasses}">
2285
- <div
2286
- class="content"
2287
- role="${(x) => shouldShowSortIcons(x) ? "button" : void 0}"
2288
- >
2289
- ${(x) => x.selected ? html`<${visuallyHiddenTagName}
2290
- data-announcement="selection"
2291
- >
2292
- ${(x2) => x2.locale.dataGrid.cell.selected}
2293
- </${visuallyHiddenTagName}>` : null}
2294
- <slot></slot>
2295
- ${when(
2296
- shouldShowSortIcons,
2297
- html`<${visuallyHiddenTagName}
2298
- data-announcement="button-role"
2299
- >
2300
- ${(x) => x.locale.dataGrid.cell.button}
2301
- </${visuallyHiddenTagName}>
2302
- `
2303
- )}
2304
- ${when(
2305
- shouldAnnounceSortState,
2306
- html`<${visuallyHiddenTagName}
2307
- aria-live="polite"
2308
- data-announcement="sort-state"
2309
- >
2310
- ${getSortAnnouncement}
2311
- </${visuallyHiddenTagName}>`
2312
- )}
2313
- ${(_) => renderSortIcons(context)}
2314
- </div>
2315
- <slot
2316
- name="action-items"
2317
- ${slotted("_actionItemsSlottedContent")}
2318
- ></slot>
2319
- </div>
2320
- </template>
2321
- `;
2322
- };
2323
-
2324
- const dataGridCellDefinition = defineVividComponent(
2325
- "data-grid-cell",
2326
- DataGridCell,
2327
- DataGridCellTemplate,
2328
- [iconDefinition, visuallyHiddenDefinition],
2329
- {
2330
- styles: dataGridCellStyles
2331
- }
2332
- );
2333
- const dataGridRowDefinition = defineVividComponent(
2334
- "data-grid-row",
2335
- DataGridRow,
2336
- DataGridRowTemplate,
2337
- [dataGridCellDefinition],
2338
- {
2339
- styles: dataGridRowStyles
2340
- }
2341
- );
2342
- const dataGridDefinition = defineVividComponent(
2343
- "data-grid",
2344
- DataGrid,
2345
- DataGridTemplate,
2346
- [dataGridRowDefinition],
2347
- {
2348
- styles: dataGridStyles
2349
- }
2350
- );
2351
- const registerDataGrid = createRegisterFunction(dataGridDefinition);
2352
-
1
+ import "../unbundled/definition2.js";
2
+ import { a as DataGrid, i as registerDataGrid, n as dataGridDefinition, o as DataGridRow, r as dataGridRowDefinition, s as DataGridCell, t as dataGridCellDefinition } from "../unbundled/definition32.js";
2353
3
  export { DataGridCell as VwcDataGridCellElement, DataGrid as VwcDataGridElement, DataGridRow as VwcDataGridRowElement, dataGridCellDefinition, dataGridDefinition, dataGridRowDefinition, registerDataGrid };