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