@ni/fast-foundation 0.0.2

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 (416) hide show
  1. package/README.md +58 -0
  2. package/dist/dts/accordion/accordion.d.ts +65 -0
  3. package/dist/dts/accordion/accordion.template.d.ts +8 -0
  4. package/dist/dts/accordion/index.d.ts +2 -0
  5. package/dist/dts/accordion-item/accordion-item.d.ts +76 -0
  6. package/dist/dts/accordion-item/accordion-item.template.d.ts +8 -0
  7. package/dist/dts/accordion-item/index.d.ts +2 -0
  8. package/dist/dts/anchor/anchor.d.ts +128 -0
  9. package/dist/dts/anchor/anchor.template.d.ts +8 -0
  10. package/dist/dts/anchor/index.d.ts +2 -0
  11. package/dist/dts/anchored-region/anchored-region-config.d.ts +117 -0
  12. package/dist/dts/anchored-region/anchored-region.d.ts +389 -0
  13. package/dist/dts/anchored-region/anchored-region.template.d.ts +8 -0
  14. package/dist/dts/anchored-region/index.d.ts +3 -0
  15. package/dist/dts/avatar/avatar.d.ts +62 -0
  16. package/dist/dts/avatar/avatar.template.d.ts +8 -0
  17. package/dist/dts/avatar/index.d.ts +2 -0
  18. package/dist/dts/badge/badge.d.ts +36 -0
  19. package/dist/dts/badge/badge.template.d.ts +8 -0
  20. package/dist/dts/badge/index.d.ts +2 -0
  21. package/dist/dts/breadcrumb/breadcrumb.d.ts +27 -0
  22. package/dist/dts/breadcrumb/breadcrumb.template.d.ts +8 -0
  23. package/dist/dts/breadcrumb/index.d.ts +2 -0
  24. package/dist/dts/breadcrumb-item/breadcrumb-item.d.ts +36 -0
  25. package/dist/dts/breadcrumb-item/breadcrumb-item.template.d.ts +8 -0
  26. package/dist/dts/breadcrumb-item/index.d.ts +2 -0
  27. package/dist/dts/button/button.d.ts +167 -0
  28. package/dist/dts/button/button.form-associated.d.ts +16 -0
  29. package/dist/dts/button/button.template.d.ts +8 -0
  30. package/dist/dts/button/index.d.ts +2 -0
  31. package/dist/dts/calendar/calendar.d.ts +178 -0
  32. package/dist/dts/calendar/calendar.template.d.ts +58 -0
  33. package/dist/dts/calendar/date-formatter.d.ts +124 -0
  34. package/dist/dts/calendar/index.d.ts +3 -0
  35. package/dist/dts/card/card.d.ts +10 -0
  36. package/dist/dts/card/card.template.d.ts +8 -0
  37. package/dist/dts/card/index.d.ts +2 -0
  38. package/dist/dts/checkbox/checkbox.d.ts +58 -0
  39. package/dist/dts/checkbox/checkbox.form-associated.d.ts +16 -0
  40. package/dist/dts/checkbox/checkbox.template.d.ts +8 -0
  41. package/dist/dts/checkbox/index.d.ts +2 -0
  42. package/dist/dts/combobox/combobox.d.ts +341 -0
  43. package/dist/dts/combobox/combobox.form-associated.d.ts +16 -0
  44. package/dist/dts/combobox/combobox.options.d.ts +15 -0
  45. package/dist/dts/combobox/combobox.template.d.ts +8 -0
  46. package/dist/dts/combobox/index.d.ts +3 -0
  47. package/dist/dts/data-grid/data-grid-cell.d.ts +62 -0
  48. package/dist/dts/data-grid/data-grid-cell.template.d.ts +9 -0
  49. package/dist/dts/data-grid/data-grid-row.d.ts +119 -0
  50. package/dist/dts/data-grid/data-grid-row.template.d.ts +10 -0
  51. package/dist/dts/data-grid/data-grid.d.ts +218 -0
  52. package/dist/dts/data-grid/data-grid.options.d.ts +49 -0
  53. package/dist/dts/data-grid/data-grid.template.d.ts +10 -0
  54. package/dist/dts/data-grid/index.d.ts +6 -0
  55. package/dist/dts/design-system/component-presentation.d.ts +66 -0
  56. package/dist/dts/design-system/design-system.d.ts +104 -0
  57. package/dist/dts/design-system/index.d.ts +3 -0
  58. package/dist/dts/design-system/registration-context.d.ts +106 -0
  59. package/dist/dts/design-token/custom-property-manager.d.ts +35 -0
  60. package/dist/dts/design-token/design-token.d.ts +139 -0
  61. package/dist/dts/design-token/interfaces.d.ts +31 -0
  62. package/dist/dts/di/di.d.ts +858 -0
  63. package/dist/dts/di/index.d.ts +1 -0
  64. package/dist/dts/dialog/dialog.d.ts +153 -0
  65. package/dist/dts/dialog/dialog.template.d.ts +8 -0
  66. package/dist/dts/dialog/index.d.ts +2 -0
  67. package/dist/dts/directives/reflect-attributes.d.ts +18 -0
  68. package/dist/dts/disclosure/disclosure.d.ts +59 -0
  69. package/dist/dts/disclosure/disclosure.template.d.ts +8 -0
  70. package/dist/dts/disclosure/index.d.ts +2 -0
  71. package/dist/dts/divider/divider.d.ts +28 -0
  72. package/dist/dts/divider/divider.options.d.ts +19 -0
  73. package/dist/dts/divider/divider.template.d.ts +8 -0
  74. package/dist/dts/divider/index.d.ts +2 -0
  75. package/dist/dts/flipper/flipper.d.ts +57 -0
  76. package/dist/dts/flipper/flipper.options.d.ts +13 -0
  77. package/dist/dts/flipper/flipper.template.d.ts +8 -0
  78. package/dist/dts/flipper/index.d.ts +2 -0
  79. package/dist/dts/form-associated/form-associated.d.ts +177 -0
  80. package/dist/dts/form-associated/index.d.ts +1 -0
  81. package/dist/dts/foundation-element/foundation-element.d.ts +120 -0
  82. package/dist/dts/foundation-element/index.d.ts +1 -0
  83. package/dist/dts/horizontal-scroll/horizontal-scroll.d.ts +242 -0
  84. package/dist/dts/horizontal-scroll/horizontal-scroll.template.d.ts +7 -0
  85. package/dist/dts/horizontal-scroll/index.d.ts +2 -0
  86. package/dist/dts/index-rollup.d.ts +2 -0
  87. package/dist/dts/index.d.ts +53 -0
  88. package/dist/dts/interfaces.d.ts +4 -0
  89. package/dist/dts/listbox/index.d.ts +3 -0
  90. package/dist/dts/listbox/listbox.d.ts +314 -0
  91. package/dist/dts/listbox/listbox.element.d.ts +223 -0
  92. package/dist/dts/listbox/listbox.template.d.ts +8 -0
  93. package/dist/dts/listbox-option/index.d.ts +2 -0
  94. package/dist/dts/listbox-option/listbox-option.d.ts +176 -0
  95. package/dist/dts/listbox-option/listbox-option.template.d.ts +8 -0
  96. package/dist/dts/menu/index.d.ts +2 -0
  97. package/dist/dts/menu/menu.d.ts +78 -0
  98. package/dist/dts/menu/menu.template.d.ts +8 -0
  99. package/dist/dts/menu-item/index.d.ts +2 -0
  100. package/dist/dts/menu-item/menu-item.d.ts +160 -0
  101. package/dist/dts/menu-item/menu-item.options.d.ts +29 -0
  102. package/dist/dts/menu-item/menu-item.template.d.ts +10 -0
  103. package/dist/dts/number-field/index.d.ts +2 -0
  104. package/dist/dts/number-field/number-field.d.ts +227 -0
  105. package/dist/dts/number-field/number-field.form-associated.d.ts +16 -0
  106. package/dist/dts/number-field/number-field.template.d.ts +8 -0
  107. package/dist/dts/patterns/aria-global.d.ts +189 -0
  108. package/dist/dts/patterns/index.d.ts +2 -0
  109. package/dist/dts/patterns/start-end.d.ts +65 -0
  110. package/dist/dts/picker/index.d.ts +10 -0
  111. package/dist/dts/picker/picker-list-item.d.ts +38 -0
  112. package/dist/dts/picker/picker-list-item.template.d.ts +8 -0
  113. package/dist/dts/picker/picker-list.d.ts +8 -0
  114. package/dist/dts/picker/picker-list.template.d.ts +8 -0
  115. package/dist/dts/picker/picker-menu-option.d.ts +37 -0
  116. package/dist/dts/picker/picker-menu-option.template.d.ts +8 -0
  117. package/dist/dts/picker/picker-menu.d.ts +46 -0
  118. package/dist/dts/picker/picker-menu.template.d.ts +8 -0
  119. package/dist/dts/picker/picker.d.ts +390 -0
  120. package/dist/dts/picker/picker.form-associated.d.ts +16 -0
  121. package/dist/dts/picker/picker.template.d.ts +8 -0
  122. package/dist/dts/progress/base-progress.d.ts +71 -0
  123. package/dist/dts/progress/index.d.ts +2 -0
  124. package/dist/dts/progress/progress.template.d.ts +8 -0
  125. package/dist/dts/progress-ring/index.d.ts +1 -0
  126. package/dist/dts/progress-ring/progress-ring.template.d.ts +8 -0
  127. package/dist/dts/radio/index.d.ts +2 -0
  128. package/dist/dts/radio/radio.d.ts +70 -0
  129. package/dist/dts/radio/radio.form-associated.d.ts +16 -0
  130. package/dist/dts/radio/radio.template.d.ts +8 -0
  131. package/dist/dts/radio-group/index.d.ts +2 -0
  132. package/dist/dts/radio-group/radio-group.d.ts +101 -0
  133. package/dist/dts/radio-group/radio-group.template.d.ts +8 -0
  134. package/dist/dts/search/index.d.ts +2 -0
  135. package/dist/dts/search/search.d.ts +162 -0
  136. package/dist/dts/search/search.form-associated.d.ts +16 -0
  137. package/dist/dts/search/search.template.d.ts +8 -0
  138. package/dist/dts/select/index.d.ts +3 -0
  139. package/dist/dts/select/select.d.ts +289 -0
  140. package/dist/dts/select/select.form-associated.d.ts +16 -0
  141. package/dist/dts/select/select.options.d.ts +13 -0
  142. package/dist/dts/select/select.template.d.ts +8 -0
  143. package/dist/dts/skeleton/index.d.ts +2 -0
  144. package/dist/dts/skeleton/skeleton.d.ts +47 -0
  145. package/dist/dts/skeleton/skeleton.template.d.ts +8 -0
  146. package/dist/dts/slider/index.d.ts +2 -0
  147. package/dist/dts/slider/slider-utilities.d.ts +5 -0
  148. package/dist/dts/slider/slider.d.ts +230 -0
  149. package/dist/dts/slider/slider.form-associated.d.ts +16 -0
  150. package/dist/dts/slider/slider.template.d.ts +8 -0
  151. package/dist/dts/slider-label/index.d.ts +2 -0
  152. package/dist/dts/slider-label/slider-label.d.ts +81 -0
  153. package/dist/dts/slider-label/slider-label.template.d.ts +8 -0
  154. package/dist/dts/switch/index.d.ts +2 -0
  155. package/dist/dts/switch/switch.d.ts +60 -0
  156. package/dist/dts/switch/switch.form-associated.d.ts +16 -0
  157. package/dist/dts/switch/switch.template.d.ts +8 -0
  158. package/dist/dts/tab/index.d.ts +2 -0
  159. package/dist/dts/tab/tab.d.ts +17 -0
  160. package/dist/dts/tab/tab.template.d.ts +8 -0
  161. package/dist/dts/tab-panel/index.d.ts +2 -0
  162. package/dist/dts/tab-panel/tab-panel.d.ts +10 -0
  163. package/dist/dts/tab-panel/tab-panel.template.d.ts +8 -0
  164. package/dist/dts/tabs/index.d.ts +2 -0
  165. package/dist/dts/tabs/tabs.d.ts +140 -0
  166. package/dist/dts/tabs/tabs.template.d.ts +8 -0
  167. package/dist/dts/test-utilities/fixture.d.ts +89 -0
  168. package/dist/dts/test-utilities/timeout.d.ts +4 -0
  169. package/dist/dts/text-area/index.d.ts +2 -0
  170. package/dist/dts/text-area/text-area.d.ts +149 -0
  171. package/dist/dts/text-area/text-area.form-associated.d.ts +16 -0
  172. package/dist/dts/text-area/text-area.options.d.ts +27 -0
  173. package/dist/dts/text-area/text-area.template.d.ts +8 -0
  174. package/dist/dts/text-field/index.d.ts +2 -0
  175. package/dist/dts/text-field/text-field.d.ts +166 -0
  176. package/dist/dts/text-field/text-field.form-associated.d.ts +16 -0
  177. package/dist/dts/text-field/text-field.options.d.ts +31 -0
  178. package/dist/dts/text-field/text-field.template.d.ts +8 -0
  179. package/dist/dts/toolbar/index.d.ts +2 -0
  180. package/dist/dts/toolbar/toolbar.d.ts +167 -0
  181. package/dist/dts/toolbar/toolbar.template.d.ts +9 -0
  182. package/dist/dts/tooltip/index.d.ts +2 -0
  183. package/dist/dts/tooltip/tooltip.d.ts +239 -0
  184. package/dist/dts/tooltip/tooltip.options.d.ts +69 -0
  185. package/dist/dts/tooltip/tooltip.template.d.ts +8 -0
  186. package/dist/dts/tree-item/index.d.ts +2 -0
  187. package/dist/dts/tree-item/tree-item.d.ts +141 -0
  188. package/dist/dts/tree-item/tree-item.template.d.ts +8 -0
  189. package/dist/dts/tree-view/index.d.ts +2 -0
  190. package/dist/dts/tree-view/tree-view.d.ts +99 -0
  191. package/dist/dts/tree-view/tree-view.template.d.ts +8 -0
  192. package/dist/dts/utilities/apply-mixins.d.ts +6 -0
  193. package/dist/dts/utilities/composed-contains.d.ts +12 -0
  194. package/dist/dts/utilities/composed-parent.d.ts +10 -0
  195. package/dist/dts/utilities/direction.d.ts +7 -0
  196. package/dist/dts/utilities/index.d.ts +8 -0
  197. package/dist/dts/utilities/intersection-service.d.ts +30 -0
  198. package/dist/dts/utilities/match-media-stylesheet-behavior.d.ts +124 -0
  199. package/dist/dts/utilities/property-stylesheet-behavior.d.ts +38 -0
  200. package/dist/dts/utilities/resize-observer.d.ts +31 -0
  201. package/dist/dts/utilities/root-active-element.d.ts +1 -0
  202. package/dist/dts/utilities/style/disabled.d.ts +5 -0
  203. package/dist/dts/utilities/style/display.d.ts +17 -0
  204. package/dist/dts/utilities/style/focus.d.ts +8 -0
  205. package/dist/dts/utilities/style/index.d.ts +3 -0
  206. package/dist/dts/utilities/whitespace-filter.d.ts +9 -0
  207. package/dist/esm/accordion/accordion.js +185 -0
  208. package/dist/esm/accordion/accordion.template.js +11 -0
  209. package/dist/esm/accordion/index.js +2 -0
  210. package/dist/esm/accordion-item/accordion-item.js +72 -0
  211. package/dist/esm/accordion-item/accordion-item.template.js +49 -0
  212. package/dist/esm/accordion-item/index.js +2 -0
  213. package/dist/esm/anchor/anchor.js +85 -0
  214. package/dist/esm/anchor/anchor.template.js +47 -0
  215. package/dist/esm/anchor/index.js +2 -0
  216. package/dist/esm/anchored-region/anchored-region-config.js +59 -0
  217. package/dist/esm/anchored-region/anchored-region.js +964 -0
  218. package/dist/esm/anchored-region/anchored-region.template.js +12 -0
  219. package/dist/esm/anchored-region/index.js +3 -0
  220. package/dist/esm/avatar/avatar.js +39 -0
  221. package/dist/esm/avatar/avatar.template.js +23 -0
  222. package/dist/esm/avatar/index.js +2 -0
  223. package/dist/esm/badge/badge.js +40 -0
  224. package/dist/esm/badge/badge.template.js +12 -0
  225. package/dist/esm/badge/index.js +2 -0
  226. package/dist/esm/breadcrumb/breadcrumb.js +70 -0
  227. package/dist/esm/breadcrumb/breadcrumb.template.js +14 -0
  228. package/dist/esm/breadcrumb/index.js +2 -0
  229. package/dist/esm/breadcrumb-item/breadcrumb-item.js +23 -0
  230. package/dist/esm/breadcrumb-item/breadcrumb-item.template.js +24 -0
  231. package/dist/esm/breadcrumb-item/index.js +2 -0
  232. package/dist/esm/button/button.form-associated.js +15 -0
  233. package/dist/esm/button/button.js +183 -0
  234. package/dist/esm/button/button.template.js +51 -0
  235. package/dist/esm/button/index.js +2 -0
  236. package/dist/esm/calendar/calendar.js +280 -0
  237. package/dist/esm/calendar/calendar.template.js +191 -0
  238. package/dist/esm/calendar/date-formatter.js +144 -0
  239. package/dist/esm/calendar/index.js +3 -0
  240. package/dist/esm/card/card.js +10 -0
  241. package/dist/esm/card/card.template.js +8 -0
  242. package/dist/esm/card/index.js +2 -0
  243. package/dist/esm/checkbox/checkbox.form-associated.js +15 -0
  244. package/dist/esm/checkbox/checkbox.js +75 -0
  245. package/dist/esm/checkbox/checkbox.template.js +35 -0
  246. package/dist/esm/checkbox/index.js +2 -0
  247. package/dist/esm/combobox/combobox.form-associated.js +15 -0
  248. package/dist/esm/combobox/combobox.js +587 -0
  249. package/dist/esm/combobox/combobox.options.js +10 -0
  250. package/dist/esm/combobox/combobox.template.js +66 -0
  251. package/dist/esm/combobox/index.js +3 -0
  252. package/dist/esm/data-grid/data-grid-cell.js +229 -0
  253. package/dist/esm/data-grid/data-grid-cell.template.js +23 -0
  254. package/dist/esm/data-grid/data-grid-row.js +203 -0
  255. package/dist/esm/data-grid/data-grid-row.template.js +47 -0
  256. package/dist/esm/data-grid/data-grid.js +440 -0
  257. package/dist/esm/data-grid/data-grid.options.js +31 -0
  258. package/dist/esm/data-grid/data-grid.template.js +36 -0
  259. package/dist/esm/data-grid/index.js +6 -0
  260. package/dist/esm/design-system/component-presentation.js +86 -0
  261. package/dist/esm/design-system/design-system.js +207 -0
  262. package/dist/esm/design-system/index.js +3 -0
  263. package/dist/esm/design-system/registration-context.js +1 -0
  264. package/dist/esm/design-token/custom-property-manager.js +216 -0
  265. package/dist/esm/design-token/design-token.js +657 -0
  266. package/dist/esm/design-token/interfaces.js +1 -0
  267. package/dist/esm/di/di.js +1341 -0
  268. package/dist/esm/di/index.js +1 -0
  269. package/dist/esm/dialog/dialog.js +280 -0
  270. package/dist/esm/dialog/dialog.template.js +30 -0
  271. package/dist/esm/dialog/index.js +2 -0
  272. package/dist/esm/directives/reflect-attributes.js +88 -0
  273. package/dist/esm/disclosure/disclosure.js +72 -0
  274. package/dist/esm/disclosure/disclosure.template.js +20 -0
  275. package/dist/esm/disclosure/index.js +2 -0
  276. package/dist/esm/divider/divider.js +39 -0
  277. package/dist/esm/divider/divider.options.js +14 -0
  278. package/dist/esm/divider/divider.template.js +8 -0
  279. package/dist/esm/divider/index.js +2 -0
  280. package/dist/esm/flipper/flipper.js +65 -0
  281. package/dist/esm/flipper/flipper.options.js +8 -0
  282. package/dist/esm/flipper/flipper.template.js +30 -0
  283. package/dist/esm/flipper/index.js +2 -0
  284. package/dist/esm/form-associated/form-associated.js +464 -0
  285. package/dist/esm/form-associated/index.js +1 -0
  286. package/dist/esm/foundation-element/foundation-element.js +132 -0
  287. package/dist/esm/foundation-element/index.js +1 -0
  288. package/dist/esm/horizontal-scroll/horizontal-scroll.js +380 -0
  289. package/dist/esm/horizontal-scroll/horizontal-scroll.template.js +62 -0
  290. package/dist/esm/horizontal-scroll/index.js +2 -0
  291. package/dist/esm/index-rollup.js +2 -0
  292. package/dist/esm/index.js +54 -0
  293. package/dist/esm/interfaces.js +1 -0
  294. package/dist/esm/listbox/index.js +3 -0
  295. package/dist/esm/listbox/listbox.element.js +448 -0
  296. package/dist/esm/listbox/listbox.js +528 -0
  297. package/dist/esm/listbox/listbox.template.js +27 -0
  298. package/dist/esm/listbox-option/index.js +2 -0
  299. package/dist/esm/listbox-option/listbox-option.js +200 -0
  300. package/dist/esm/listbox-option/listbox-option.template.js +25 -0
  301. package/dist/esm/menu/index.js +2 -0
  302. package/dist/esm/menu/menu.js +290 -0
  303. package/dist/esm/menu/menu.template.js +15 -0
  304. package/dist/esm/menu-item/index.js +2 -0
  305. package/dist/esm/menu-item/menu-item.js +251 -0
  306. package/dist/esm/menu-item/menu-item.options.js +26 -0
  307. package/dist/esm/menu-item/menu-item.template.js +78 -0
  308. package/dist/esm/number-field/index.js +2 -0
  309. package/dist/esm/number-field/number-field.form-associated.js +15 -0
  310. package/dist/esm/number-field/number-field.js +288 -0
  311. package/dist/esm/number-field/number-field.template.js +84 -0
  312. package/dist/esm/patterns/aria-global.js +70 -0
  313. package/dist/esm/patterns/index.js +2 -0
  314. package/dist/esm/patterns/start-end.js +84 -0
  315. package/dist/esm/picker/index.js +10 -0
  316. package/dist/esm/picker/picker-list-item.js +71 -0
  317. package/dist/esm/picker/picker-list-item.template.js +17 -0
  318. package/dist/esm/picker/picker-list.js +8 -0
  319. package/dist/esm/picker/picker-list.template.js +13 -0
  320. package/dist/esm/picker/picker-menu-option.js +61 -0
  321. package/dist/esm/picker/picker-menu-option.template.js +16 -0
  322. package/dist/esm/picker/picker-menu.js +59 -0
  323. package/dist/esm/picker/picker-menu.template.js +29 -0
  324. package/dist/esm/picker/picker.form-associated.js +15 -0
  325. package/dist/esm/picker/picker.js +759 -0
  326. package/dist/esm/picker/picker.template.js +97 -0
  327. package/dist/esm/progress/base-progress.js +69 -0
  328. package/dist/esm/progress/index.js +2 -0
  329. package/dist/esm/progress/progress.template.js +31 -0
  330. package/dist/esm/progress-ring/index.js +1 -0
  331. package/dist/esm/progress-ring/progress-ring.template.js +45 -0
  332. package/dist/esm/radio/index.js +2 -0
  333. package/dist/esm/radio/radio.form-associated.js +15 -0
  334. package/dist/esm/radio/radio.js +108 -0
  335. package/dist/esm/radio/radio.template.js +31 -0
  336. package/dist/esm/radio-group/index.js +2 -0
  337. package/dist/esm/radio-group/radio-group.js +390 -0
  338. package/dist/esm/radio-group/radio-group.template.js +29 -0
  339. package/dist/esm/search/index.js +2 -0
  340. package/dist/esm/search/search.form-associated.js +15 -0
  341. package/dist/esm/search/search.js +157 -0
  342. package/dist/esm/search/search.template.js +93 -0
  343. package/dist/esm/select/index.js +3 -0
  344. package/dist/esm/select/select.form-associated.js +15 -0
  345. package/dist/esm/select/select.js +490 -0
  346. package/dist/esm/select/select.options.js +8 -0
  347. package/dist/esm/select/select.template.js +72 -0
  348. package/dist/esm/skeleton/index.js +2 -0
  349. package/dist/esm/skeleton/skeleton.js +35 -0
  350. package/dist/esm/skeleton/skeleton.template.js +20 -0
  351. package/dist/esm/slider/index.js +2 -0
  352. package/dist/esm/slider/slider-utilities.js +11 -0
  353. package/dist/esm/slider/slider.form-associated.js +15 -0
  354. package/dist/esm/slider/slider.js +452 -0
  355. package/dist/esm/slider/slider.template.js +40 -0
  356. package/dist/esm/slider-label/index.js +2 -0
  357. package/dist/esm/slider-label/slider-label.js +158 -0
  358. package/dist/esm/slider-label/slider-label.template.js +24 -0
  359. package/dist/esm/switch/index.js +2 -0
  360. package/dist/esm/switch/switch.form-associated.js +15 -0
  361. package/dist/esm/switch/switch.js +79 -0
  362. package/dist/esm/switch/switch.template.js +37 -0
  363. package/dist/esm/tab/index.js +2 -0
  364. package/dist/esm/tab/tab.js +15 -0
  365. package/dist/esm/tab/tab.template.js +10 -0
  366. package/dist/esm/tab-panel/index.js +2 -0
  367. package/dist/esm/tab-panel/tab-panel.js +10 -0
  368. package/dist/esm/tab-panel/tab-panel.template.js +10 -0
  369. package/dist/esm/tabs/index.js +2 -0
  370. package/dist/esm/tabs/tabs.js +375 -0
  371. package/dist/esm/tabs/tabs.template.js +26 -0
  372. package/dist/esm/test-utilities/fixture.js +90 -0
  373. package/dist/esm/test-utilities/timeout.js +13 -0
  374. package/dist/esm/text-area/index.js +2 -0
  375. package/dist/esm/text-area/text-area.form-associated.js +15 -0
  376. package/dist/esm/text-area/text-area.js +146 -0
  377. package/dist/esm/text-area/text-area.options.js +22 -0
  378. package/dist/esm/text-area/text-area.template.js +64 -0
  379. package/dist/esm/text-field/index.js +2 -0
  380. package/dist/esm/text-field/text-field.form-associated.js +15 -0
  381. package/dist/esm/text-field/text-field.js +183 -0
  382. package/dist/esm/text-field/text-field.options.js +26 -0
  383. package/dist/esm/text-field/text-field.template.js +70 -0
  384. package/dist/esm/toolbar/index.js +2 -0
  385. package/dist/esm/toolbar/toolbar.js +271 -0
  386. package/dist/esm/toolbar/toolbar.template.js +37 -0
  387. package/dist/esm/tooltip/index.js +2 -0
  388. package/dist/esm/tooltip/tooltip.js +512 -0
  389. package/dist/esm/tooltip/tooltip.options.js +63 -0
  390. package/dist/esm/tooltip/tooltip.template.js +32 -0
  391. package/dist/esm/tree-item/index.js +2 -0
  392. package/dist/esm/tree-item/tree-item.js +150 -0
  393. package/dist/esm/tree-item/tree-item.template.js +52 -0
  394. package/dist/esm/tree-view/index.js +2 -0
  395. package/dist/esm/tree-view/tree-view.js +268 -0
  396. package/dist/esm/tree-view/tree-view.template.js +18 -0
  397. package/dist/esm/utilities/apply-mixins.js +20 -0
  398. package/dist/esm/utilities/composed-contains.js +22 -0
  399. package/dist/esm/utilities/composed-parent.js +23 -0
  400. package/dist/esm/utilities/direction.js +10 -0
  401. package/dist/esm/utilities/index.js +8 -0
  402. package/dist/esm/utilities/intersection-service.js +91 -0
  403. package/dist/esm/utilities/match-media-stylesheet-behavior.js +140 -0
  404. package/dist/esm/utilities/property-stylesheet-behavior.js +52 -0
  405. package/dist/esm/utilities/resize-observer.js +5 -0
  406. package/dist/esm/utilities/root-active-element.js +8 -0
  407. package/dist/esm/utilities/style/disabled.js +5 -0
  408. package/dist/esm/utilities/style/display.js +14 -0
  409. package/dist/esm/utilities/style/focus.js +9 -0
  410. package/dist/esm/utilities/style/index.js +3 -0
  411. package/dist/esm/utilities/whitespace-filter.js +13 -0
  412. package/dist/fast-foundation.d.ts +9744 -0
  413. package/dist/fast-foundation.js +19097 -0
  414. package/dist/fast-foundation.min.js +19 -0
  415. package/dist/tsdoc-metadata.json +11 -0
  416. package/package.json +101 -0
@@ -0,0 +1,964 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr, DOM, observable } from "@ni/fast-element";
3
+ import { Direction, eventResize, eventScroll } from "@ni/fast-web-utilities";
4
+ import { FoundationElement } from "../foundation-element/foundation-element.js";
5
+ import { getDirection } from "../utilities/direction.js";
6
+ import { IntersectionService } from "../utilities/intersection-service.js";
7
+ /**
8
+ * An anchored region Custom HTML Element.
9
+ *
10
+ * @slot - The default slot for the content
11
+ * @fires loaded - Fires a custom 'loaded' event when the region is loaded and visible
12
+ * @fires positionchange - Fires a custom 'positionchange' event when the position has changed
13
+ *
14
+ * @public
15
+ */
16
+ export class AnchoredRegion extends FoundationElement {
17
+ constructor() {
18
+ super(...arguments);
19
+ /**
20
+ * The HTML ID of the anchor element this region is positioned relative to
21
+ *
22
+ * @public
23
+ * @remarks
24
+ * HTML Attribute: anchor
25
+ */
26
+ this.anchor = "";
27
+ /**
28
+ * The HTML ID of the viewport element this region is positioned relative to
29
+ *
30
+ * @public
31
+ * @remarks
32
+ * HTML Attribute: anchor
33
+ */
34
+ this.viewport = "";
35
+ /**
36
+ * Sets what logic the component uses to determine horizontal placement.
37
+ * 'locktodefault' forces the default position
38
+ * 'dynamic' decides placement based on available space
39
+ * 'uncontrolled' does not control placement on the horizontal axis
40
+ *
41
+ * @public
42
+ * @remarks
43
+ * HTML Attribute: horizontal-positioning-mode
44
+ */
45
+ this.horizontalPositioningMode = "uncontrolled";
46
+ /**
47
+ * The default horizontal position of the region relative to the anchor element
48
+ *
49
+ * @public
50
+ * @remarks
51
+ * HTML Attribute: horizontal-default-position
52
+ */
53
+ this.horizontalDefaultPosition = "unset";
54
+ /**
55
+ * Whether the region remains in the viewport (ie. detaches from the anchor) on the horizontal axis
56
+ *
57
+ * @public
58
+ * @remarks
59
+ * HTML Attribute: horizontal-viewport-lock
60
+ */
61
+ this.horizontalViewportLock = false;
62
+ /**
63
+ * Whether the region overlaps the anchor on the horizontal axis
64
+ *
65
+ * @public
66
+ * @remarks
67
+ * HTML Attribute: horizontal-inset
68
+ */
69
+ this.horizontalInset = false;
70
+ /**
71
+ * Defines how the width of the region is calculated
72
+ *
73
+ * @public
74
+ * @remarks
75
+ * HTML Attribute: horizontal-scaling
76
+ */
77
+ this.horizontalScaling = "content";
78
+ /**
79
+ * Sets what logic the component uses to determine vertical placement.
80
+ * 'locktodefault' forces the default position
81
+ * 'dynamic' decides placement based on available space
82
+ * 'uncontrolled' does not control placement on the vertical axis
83
+ *
84
+ * @public
85
+ * @remarks
86
+ * HTML Attribute: vertical-positioning-mode
87
+ */
88
+ this.verticalPositioningMode = "uncontrolled";
89
+ /**
90
+ * The default vertical position of the region relative to the anchor element
91
+ *
92
+ * @public
93
+ * @remarks
94
+ * HTML Attribute: vertical-default-position
95
+ */
96
+ this.verticalDefaultPosition = "unset";
97
+ /**
98
+ * Whether the region remains in the viewport (ie. detaches from the anchor) on the vertical axis
99
+ *
100
+ * @public
101
+ * @remarks
102
+ * HTML Attribute: vertical-viewport-lock
103
+ */
104
+ this.verticalViewportLock = false;
105
+ /**
106
+ * Whether the region overlaps the anchor on the vertical axis
107
+ *
108
+ * @public
109
+ * @remarks
110
+ * HTML Attribute: vertical-inset
111
+ */
112
+ this.verticalInset = false;
113
+ /**
114
+ * Defines how the height of the region is calculated
115
+ *
116
+ * @public
117
+ * @remarks
118
+ * HTML Attribute: vertical-scaling
119
+ */
120
+ this.verticalScaling = "content";
121
+ /**
122
+ * Whether the region is positioned using css "position: fixed".
123
+ * Otherwise the region uses "position: absolute".
124
+ * Fixed placement allows the region to break out of parent containers,
125
+ *
126
+ * @public
127
+ * @remarks
128
+ * HTML Attribute: fixed-placement
129
+ */
130
+ this.fixedPlacement = false;
131
+ /**
132
+ * Defines what triggers the anchored region to revaluate positioning
133
+ *
134
+ * @public
135
+ * @remarks
136
+ * HTML Attribute: auto-update-mode
137
+ */
138
+ this.autoUpdateMode = "anchor";
139
+ /**
140
+ * The HTML element being used as the anchor
141
+ *
142
+ * @public
143
+ */
144
+ this.anchorElement = null;
145
+ /**
146
+ * The HTML element being used as the viewport
147
+ *
148
+ * @public
149
+ */
150
+ this.viewportElement = null;
151
+ /**
152
+ * indicates that an initial positioning pass on layout has completed
153
+ *
154
+ * @internal
155
+ */
156
+ this.initialLayoutComplete = false;
157
+ this.resizeDetector = null;
158
+ /**
159
+ * base offsets between the positioner's base position and the anchor's
160
+ */
161
+ this.baseHorizontalOffset = 0;
162
+ this.baseVerticalOffset = 0;
163
+ this.pendingPositioningUpdate = false;
164
+ this.pendingReset = false;
165
+ this.currentDirection = Direction.ltr;
166
+ this.regionVisible = false;
167
+ // indicates that a layout update should occur even if geometry has not changed
168
+ // used to ensure some attribute changes are applied
169
+ this.forceUpdate = false;
170
+ // defines how big a difference in pixels there must be between states to
171
+ // justify a layout update that affects the dom (prevents repeated sub-pixel corrections)
172
+ this.updateThreshold = 0.5;
173
+ /**
174
+ * update position
175
+ */
176
+ this.update = () => {
177
+ if (!this.pendingPositioningUpdate) {
178
+ this.requestPositionUpdates();
179
+ }
180
+ };
181
+ /**
182
+ * starts observers
183
+ */
184
+ this.startObservers = () => {
185
+ this.stopObservers();
186
+ if (this.anchorElement === null) {
187
+ return;
188
+ }
189
+ this.requestPositionUpdates();
190
+ if (this.resizeDetector !== null) {
191
+ this.resizeDetector.observe(this.anchorElement);
192
+ this.resizeDetector.observe(this);
193
+ }
194
+ };
195
+ /**
196
+ * get position updates
197
+ */
198
+ this.requestPositionUpdates = () => {
199
+ if (this.anchorElement === null || this.pendingPositioningUpdate) {
200
+ return;
201
+ }
202
+ AnchoredRegion.intersectionService.requestPosition(this, this.handleIntersection);
203
+ AnchoredRegion.intersectionService.requestPosition(this.anchorElement, this.handleIntersection);
204
+ if (this.viewportElement !== null) {
205
+ AnchoredRegion.intersectionService.requestPosition(this.viewportElement, this.handleIntersection);
206
+ }
207
+ this.pendingPositioningUpdate = true;
208
+ };
209
+ /**
210
+ * stops observers
211
+ */
212
+ this.stopObservers = () => {
213
+ if (this.pendingPositioningUpdate) {
214
+ this.pendingPositioningUpdate = false;
215
+ AnchoredRegion.intersectionService.cancelRequestPosition(this, this.handleIntersection);
216
+ if (this.anchorElement !== null) {
217
+ AnchoredRegion.intersectionService.cancelRequestPosition(this.anchorElement, this.handleIntersection);
218
+ }
219
+ if (this.viewportElement !== null) {
220
+ AnchoredRegion.intersectionService.cancelRequestPosition(this.viewportElement, this.handleIntersection);
221
+ }
222
+ }
223
+ if (this.resizeDetector !== null) {
224
+ this.resizeDetector.disconnect();
225
+ }
226
+ };
227
+ /**
228
+ * Gets the viewport element by id, or defaults to document root
229
+ */
230
+ this.getViewport = () => {
231
+ if (typeof this.viewport !== "string" || this.viewport === "") {
232
+ return document.documentElement;
233
+ }
234
+ return document.getElementById(this.viewport);
235
+ };
236
+ /**
237
+ * Gets the anchor element by id
238
+ */
239
+ this.getAnchor = () => {
240
+ return document.getElementById(this.anchor);
241
+ };
242
+ /**
243
+ * Handle intersections
244
+ */
245
+ this.handleIntersection = (entries) => {
246
+ if (!this.pendingPositioningUpdate) {
247
+ return;
248
+ }
249
+ this.pendingPositioningUpdate = false;
250
+ if (!this.applyIntersectionEntries(entries)) {
251
+ return;
252
+ }
253
+ this.updateLayout();
254
+ };
255
+ /**
256
+ * iterate through intersection entries and apply data
257
+ */
258
+ this.applyIntersectionEntries = (entries) => {
259
+ const regionEntry = entries.find(x => x.target === this);
260
+ const anchorEntry = entries.find(x => x.target === this.anchorElement);
261
+ const viewportEntry = entries.find(x => x.target === this.viewportElement);
262
+ if (regionEntry === undefined ||
263
+ viewportEntry === undefined ||
264
+ anchorEntry === undefined) {
265
+ return false;
266
+ }
267
+ // don't update the dom unless there is a significant difference in rect positions
268
+ if (!this.regionVisible ||
269
+ this.forceUpdate ||
270
+ this.regionRect === undefined ||
271
+ this.anchorRect === undefined ||
272
+ this.viewportRect === undefined ||
273
+ this.isRectDifferent(this.anchorRect, anchorEntry.boundingClientRect) ||
274
+ this.isRectDifferent(this.viewportRect, viewportEntry.boundingClientRect) ||
275
+ this.isRectDifferent(this.regionRect, regionEntry.boundingClientRect)) {
276
+ this.regionRect = regionEntry.boundingClientRect;
277
+ this.anchorRect = anchorEntry.boundingClientRect;
278
+ if (this.viewportElement === document.documentElement) {
279
+ this.viewportRect = new DOMRectReadOnly(viewportEntry.boundingClientRect.x +
280
+ document.documentElement.scrollLeft, viewportEntry.boundingClientRect.y +
281
+ document.documentElement.scrollTop, viewportEntry.boundingClientRect.width, viewportEntry.boundingClientRect.height);
282
+ }
283
+ else {
284
+ this.viewportRect = viewportEntry.boundingClientRect;
285
+ }
286
+ this.updateRegionOffset();
287
+ this.forceUpdate = false;
288
+ return true;
289
+ }
290
+ return false;
291
+ };
292
+ /**
293
+ * Update the offset values
294
+ */
295
+ this.updateRegionOffset = () => {
296
+ if (this.anchorRect && this.regionRect) {
297
+ this.baseHorizontalOffset =
298
+ this.baseHorizontalOffset +
299
+ (this.anchorRect.left - this.regionRect.left) +
300
+ (this.translateX - this.baseHorizontalOffset);
301
+ this.baseVerticalOffset =
302
+ this.baseVerticalOffset +
303
+ (this.anchorRect.top - this.regionRect.top) +
304
+ (this.translateY - this.baseVerticalOffset);
305
+ }
306
+ };
307
+ /**
308
+ * compare rects to see if there is enough change to justify a DOM update
309
+ */
310
+ this.isRectDifferent = (rectA, rectB) => {
311
+ if (Math.abs(rectA.top - rectB.top) > this.updateThreshold ||
312
+ Math.abs(rectA.right - rectB.right) > this.updateThreshold ||
313
+ Math.abs(rectA.bottom - rectB.bottom) > this.updateThreshold ||
314
+ Math.abs(rectA.left - rectB.left) > this.updateThreshold) {
315
+ return true;
316
+ }
317
+ return false;
318
+ };
319
+ /**
320
+ * Handle resize events
321
+ */
322
+ this.handleResize = (entries) => {
323
+ this.update();
324
+ };
325
+ /**
326
+ * resets the component
327
+ */
328
+ this.reset = () => {
329
+ if (!this.pendingReset) {
330
+ return;
331
+ }
332
+ this.pendingReset = false;
333
+ if (this.anchorElement === null) {
334
+ this.anchorElement = this.getAnchor();
335
+ }
336
+ if (this.viewportElement === null) {
337
+ this.viewportElement = this.getViewport();
338
+ }
339
+ this.currentDirection = getDirection(this);
340
+ this.startObservers();
341
+ };
342
+ /**
343
+ * Recalculate layout related state values
344
+ */
345
+ this.updateLayout = () => {
346
+ let desiredVerticalPosition = undefined;
347
+ let desiredHorizontalPosition = undefined;
348
+ if (this.horizontalPositioningMode !== "uncontrolled") {
349
+ const horizontalOptions = this.getPositioningOptions(this.horizontalInset);
350
+ if (this.horizontalDefaultPosition === "center") {
351
+ desiredHorizontalPosition = "center";
352
+ }
353
+ else if (this.horizontalDefaultPosition !== "unset") {
354
+ let dirCorrectedHorizontalDefaultPosition = this
355
+ .horizontalDefaultPosition;
356
+ if (dirCorrectedHorizontalDefaultPosition === "start" ||
357
+ dirCorrectedHorizontalDefaultPosition === "end") {
358
+ // if direction changes we reset the layout
359
+ const newDirection = getDirection(this);
360
+ if (newDirection !== this.currentDirection) {
361
+ this.currentDirection = newDirection;
362
+ this.initialize();
363
+ return;
364
+ }
365
+ if (this.currentDirection === Direction.ltr) {
366
+ dirCorrectedHorizontalDefaultPosition =
367
+ dirCorrectedHorizontalDefaultPosition === "start"
368
+ ? "left"
369
+ : "right";
370
+ }
371
+ else {
372
+ dirCorrectedHorizontalDefaultPosition =
373
+ dirCorrectedHorizontalDefaultPosition === "start"
374
+ ? "right"
375
+ : "left";
376
+ }
377
+ }
378
+ switch (dirCorrectedHorizontalDefaultPosition) {
379
+ case "left":
380
+ desiredHorizontalPosition = this.horizontalInset
381
+ ? "insetStart"
382
+ : "start";
383
+ break;
384
+ case "right":
385
+ desiredHorizontalPosition = this.horizontalInset
386
+ ? "insetEnd"
387
+ : "end";
388
+ break;
389
+ }
390
+ }
391
+ const horizontalThreshold = this.horizontalThreshold !== undefined
392
+ ? this.horizontalThreshold
393
+ : this.regionRect !== undefined
394
+ ? this.regionRect.width
395
+ : 0;
396
+ const anchorLeft = this.anchorRect !== undefined ? this.anchorRect.left : 0;
397
+ const anchorRight = this.anchorRect !== undefined ? this.anchorRect.right : 0;
398
+ const anchorWidth = this.anchorRect !== undefined ? this.anchorRect.width : 0;
399
+ const viewportLeft = this.viewportRect !== undefined ? this.viewportRect.left : 0;
400
+ const viewportRight = this.viewportRect !== undefined ? this.viewportRect.right : 0;
401
+ if (desiredHorizontalPosition === undefined ||
402
+ (!(this.horizontalPositioningMode === "locktodefault") &&
403
+ this.getAvailableSpace(desiredHorizontalPosition, anchorLeft, anchorRight, anchorWidth, viewportLeft, viewportRight) < horizontalThreshold)) {
404
+ desiredHorizontalPosition =
405
+ this.getAvailableSpace(horizontalOptions[0], anchorLeft, anchorRight, anchorWidth, viewportLeft, viewportRight) >
406
+ this.getAvailableSpace(horizontalOptions[1], anchorLeft, anchorRight, anchorWidth, viewportLeft, viewportRight)
407
+ ? horizontalOptions[0]
408
+ : horizontalOptions[1];
409
+ }
410
+ }
411
+ if (this.verticalPositioningMode !== "uncontrolled") {
412
+ const verticalOptions = this.getPositioningOptions(this.verticalInset);
413
+ if (this.verticalDefaultPosition === "center") {
414
+ desiredVerticalPosition = "center";
415
+ }
416
+ else if (this.verticalDefaultPosition !== "unset") {
417
+ switch (this.verticalDefaultPosition) {
418
+ case "top":
419
+ desiredVerticalPosition = this.verticalInset
420
+ ? "insetStart"
421
+ : "start";
422
+ break;
423
+ case "bottom":
424
+ desiredVerticalPosition = this.verticalInset ? "insetEnd" : "end";
425
+ break;
426
+ }
427
+ }
428
+ const verticalThreshold = this.verticalThreshold !== undefined
429
+ ? this.verticalThreshold
430
+ : this.regionRect !== undefined
431
+ ? this.regionRect.height
432
+ : 0;
433
+ const anchorTop = this.anchorRect !== undefined ? this.anchorRect.top : 0;
434
+ const anchorBottom = this.anchorRect !== undefined ? this.anchorRect.bottom : 0;
435
+ const anchorHeight = this.anchorRect !== undefined ? this.anchorRect.height : 0;
436
+ const viewportTop = this.viewportRect !== undefined ? this.viewportRect.top : 0;
437
+ const viewportBottom = this.viewportRect !== undefined ? this.viewportRect.bottom : 0;
438
+ if (desiredVerticalPosition === undefined ||
439
+ (!(this.verticalPositioningMode === "locktodefault") &&
440
+ this.getAvailableSpace(desiredVerticalPosition, anchorTop, anchorBottom, anchorHeight, viewportTop, viewportBottom) < verticalThreshold)) {
441
+ desiredVerticalPosition =
442
+ this.getAvailableSpace(verticalOptions[0], anchorTop, anchorBottom, anchorHeight, viewportTop, viewportBottom) >
443
+ this.getAvailableSpace(verticalOptions[1], anchorTop, anchorBottom, anchorHeight, viewportTop, viewportBottom)
444
+ ? verticalOptions[0]
445
+ : verticalOptions[1];
446
+ }
447
+ }
448
+ const nextPositionerDimension = this.getNextRegionDimension(desiredHorizontalPosition, desiredVerticalPosition);
449
+ const positionChanged = this.horizontalPosition !== desiredHorizontalPosition ||
450
+ this.verticalPosition !== desiredVerticalPosition;
451
+ this.setHorizontalPosition(desiredHorizontalPosition, nextPositionerDimension);
452
+ this.setVerticalPosition(desiredVerticalPosition, nextPositionerDimension);
453
+ this.updateRegionStyle();
454
+ if (!this.initialLayoutComplete) {
455
+ this.initialLayoutComplete = true;
456
+ this.requestPositionUpdates();
457
+ return;
458
+ }
459
+ if (!this.regionVisible) {
460
+ this.regionVisible = true;
461
+ this.style.removeProperty("pointer-events");
462
+ this.style.removeProperty("opacity");
463
+ this.classList.toggle("loaded", true);
464
+ this.$emit("loaded", this, { bubbles: false });
465
+ }
466
+ this.updatePositionClasses();
467
+ if (positionChanged) {
468
+ // emit change event
469
+ this.$emit("positionchange", this, { bubbles: false });
470
+ }
471
+ };
472
+ /**
473
+ * Updates the style string applied to the region element as well as the css classes attached
474
+ * to the root element
475
+ */
476
+ this.updateRegionStyle = () => {
477
+ this.style.width = this.regionWidth;
478
+ this.style.height = this.regionHeight;
479
+ this.style.transform = `translate(${this.translateX}px, ${this.translateY}px)`;
480
+ };
481
+ /**
482
+ * Updates the css classes that reflect the current position of the element
483
+ */
484
+ this.updatePositionClasses = () => {
485
+ this.classList.toggle("top", this.verticalPosition === "start");
486
+ this.classList.toggle("bottom", this.verticalPosition === "end");
487
+ this.classList.toggle("inset-top", this.verticalPosition === "insetStart");
488
+ this.classList.toggle("inset-bottom", this.verticalPosition === "insetEnd");
489
+ this.classList.toggle("vertical-center", this.verticalPosition === "center");
490
+ this.classList.toggle("left", this.horizontalPosition === "start");
491
+ this.classList.toggle("right", this.horizontalPosition === "end");
492
+ this.classList.toggle("inset-left", this.horizontalPosition === "insetStart");
493
+ this.classList.toggle("inset-right", this.horizontalPosition === "insetEnd");
494
+ this.classList.toggle("horizontal-center", this.horizontalPosition === "center");
495
+ };
496
+ /**
497
+ * Get horizontal positioning state based on desired position
498
+ */
499
+ this.setHorizontalPosition = (desiredHorizontalPosition, nextPositionerDimension) => {
500
+ if (desiredHorizontalPosition === undefined ||
501
+ this.regionRect === undefined ||
502
+ this.anchorRect === undefined ||
503
+ this.viewportRect === undefined) {
504
+ return;
505
+ }
506
+ let nextRegionWidth = 0;
507
+ switch (this.horizontalScaling) {
508
+ case "anchor":
509
+ case "fill":
510
+ nextRegionWidth = this.horizontalViewportLock
511
+ ? this.viewportRect.width
512
+ : nextPositionerDimension.width;
513
+ this.regionWidth = `${nextRegionWidth}px`;
514
+ break;
515
+ case "content":
516
+ nextRegionWidth = this.regionRect.width;
517
+ this.regionWidth = "unset";
518
+ break;
519
+ }
520
+ let sizeDelta = 0;
521
+ switch (desiredHorizontalPosition) {
522
+ case "start":
523
+ this.translateX = this.baseHorizontalOffset - nextRegionWidth;
524
+ if (this.horizontalViewportLock &&
525
+ this.anchorRect.left > this.viewportRect.right) {
526
+ this.translateX =
527
+ this.translateX -
528
+ (this.anchorRect.left - this.viewportRect.right);
529
+ }
530
+ break;
531
+ case "insetStart":
532
+ this.translateX =
533
+ this.baseHorizontalOffset - nextRegionWidth + this.anchorRect.width;
534
+ if (this.horizontalViewportLock &&
535
+ this.anchorRect.right > this.viewportRect.right) {
536
+ this.translateX =
537
+ this.translateX -
538
+ (this.anchorRect.right - this.viewportRect.right);
539
+ }
540
+ break;
541
+ case "insetEnd":
542
+ this.translateX = this.baseHorizontalOffset;
543
+ if (this.horizontalViewportLock &&
544
+ this.anchorRect.left < this.viewportRect.left) {
545
+ this.translateX =
546
+ this.translateX - (this.anchorRect.left - this.viewportRect.left);
547
+ }
548
+ break;
549
+ case "end":
550
+ this.translateX = this.baseHorizontalOffset + this.anchorRect.width;
551
+ if (this.horizontalViewportLock &&
552
+ this.anchorRect.right < this.viewportRect.left) {
553
+ this.translateX =
554
+ this.translateX -
555
+ (this.anchorRect.right - this.viewportRect.left);
556
+ }
557
+ break;
558
+ case "center":
559
+ sizeDelta = (this.anchorRect.width - nextRegionWidth) / 2;
560
+ this.translateX = this.baseHorizontalOffset + sizeDelta;
561
+ if (this.horizontalViewportLock) {
562
+ const regionLeft = this.anchorRect.left + sizeDelta;
563
+ const regionRight = this.anchorRect.right - sizeDelta;
564
+ if (regionLeft < this.viewportRect.left &&
565
+ !(regionRight > this.viewportRect.right)) {
566
+ this.translateX =
567
+ this.translateX - (regionLeft - this.viewportRect.left);
568
+ }
569
+ else if (regionRight > this.viewportRect.right &&
570
+ !(regionLeft < this.viewportRect.left)) {
571
+ this.translateX =
572
+ this.translateX - (regionRight - this.viewportRect.right);
573
+ }
574
+ }
575
+ break;
576
+ }
577
+ this.horizontalPosition = desiredHorizontalPosition;
578
+ };
579
+ /**
580
+ * Set vertical positioning state based on desired position
581
+ */
582
+ this.setVerticalPosition = (desiredVerticalPosition, nextPositionerDimension) => {
583
+ if (desiredVerticalPosition === undefined ||
584
+ this.regionRect === undefined ||
585
+ this.anchorRect === undefined ||
586
+ this.viewportRect === undefined) {
587
+ return;
588
+ }
589
+ let nextRegionHeight = 0;
590
+ switch (this.verticalScaling) {
591
+ case "anchor":
592
+ case "fill":
593
+ nextRegionHeight = this.verticalViewportLock
594
+ ? this.viewportRect.height
595
+ : nextPositionerDimension.height;
596
+ this.regionHeight = `${nextRegionHeight}px`;
597
+ break;
598
+ case "content":
599
+ nextRegionHeight = this.regionRect.height;
600
+ this.regionHeight = "unset";
601
+ break;
602
+ }
603
+ let sizeDelta = 0;
604
+ switch (desiredVerticalPosition) {
605
+ case "start":
606
+ this.translateY = this.baseVerticalOffset - nextRegionHeight;
607
+ if (this.verticalViewportLock &&
608
+ this.anchorRect.top > this.viewportRect.bottom) {
609
+ this.translateY =
610
+ this.translateY -
611
+ (this.anchorRect.top - this.viewportRect.bottom);
612
+ }
613
+ break;
614
+ case "insetStart":
615
+ this.translateY =
616
+ this.baseVerticalOffset - nextRegionHeight + this.anchorRect.height;
617
+ if (this.verticalViewportLock &&
618
+ this.anchorRect.bottom > this.viewportRect.bottom) {
619
+ this.translateY =
620
+ this.translateY -
621
+ (this.anchorRect.bottom - this.viewportRect.bottom);
622
+ }
623
+ break;
624
+ case "insetEnd":
625
+ this.translateY = this.baseVerticalOffset;
626
+ if (this.verticalViewportLock &&
627
+ this.anchorRect.top < this.viewportRect.top) {
628
+ this.translateY =
629
+ this.translateY - (this.anchorRect.top - this.viewportRect.top);
630
+ }
631
+ break;
632
+ case "end":
633
+ this.translateY = this.baseVerticalOffset + this.anchorRect.height;
634
+ if (this.verticalViewportLock &&
635
+ this.anchorRect.bottom < this.viewportRect.top) {
636
+ this.translateY =
637
+ this.translateY -
638
+ (this.anchorRect.bottom - this.viewportRect.top);
639
+ }
640
+ break;
641
+ case "center":
642
+ sizeDelta = (this.anchorRect.height - nextRegionHeight) / 2;
643
+ this.translateY = this.baseVerticalOffset + sizeDelta;
644
+ if (this.verticalViewportLock) {
645
+ const regionTop = this.anchorRect.top + sizeDelta;
646
+ const regionBottom = this.anchorRect.bottom - sizeDelta;
647
+ if (regionTop < this.viewportRect.top &&
648
+ !(regionBottom > this.viewportRect.bottom)) {
649
+ this.translateY =
650
+ this.translateY - (regionTop - this.viewportRect.top);
651
+ }
652
+ else if (regionBottom > this.viewportRect.bottom &&
653
+ !(regionTop < this.viewportRect.top)) {
654
+ this.translateY =
655
+ this.translateY - (regionBottom - this.viewportRect.bottom);
656
+ }
657
+ }
658
+ }
659
+ this.verticalPosition = desiredVerticalPosition;
660
+ };
661
+ /**
662
+ * Get available positions based on positioning mode
663
+ */
664
+ this.getPositioningOptions = (inset) => {
665
+ if (inset) {
666
+ return ["insetStart", "insetEnd"];
667
+ }
668
+ return ["start", "end"];
669
+ };
670
+ /**
671
+ * Get the space available for a particular relative position
672
+ */
673
+ this.getAvailableSpace = (positionOption, anchorStart, anchorEnd, anchorSpan, viewportStart, viewportEnd) => {
674
+ const spaceStart = anchorStart - viewportStart;
675
+ const spaceEnd = viewportEnd - (anchorStart + anchorSpan);
676
+ switch (positionOption) {
677
+ case "start":
678
+ return spaceStart;
679
+ case "insetStart":
680
+ return spaceStart + anchorSpan;
681
+ case "insetEnd":
682
+ return spaceEnd + anchorSpan;
683
+ case "end":
684
+ return spaceEnd;
685
+ case "center":
686
+ return Math.min(spaceStart, spaceEnd) * 2 + anchorSpan;
687
+ }
688
+ };
689
+ /**
690
+ * Get region dimensions
691
+ */
692
+ this.getNextRegionDimension = (desiredHorizontalPosition, desiredVerticalPosition) => {
693
+ const newRegionDimension = {
694
+ height: this.regionRect !== undefined ? this.regionRect.height : 0,
695
+ width: this.regionRect !== undefined ? this.regionRect.width : 0,
696
+ };
697
+ if (desiredHorizontalPosition !== undefined &&
698
+ this.horizontalScaling === "fill") {
699
+ newRegionDimension.width = this.getAvailableSpace(desiredHorizontalPosition, this.anchorRect !== undefined ? this.anchorRect.left : 0, this.anchorRect !== undefined ? this.anchorRect.right : 0, this.anchorRect !== undefined ? this.anchorRect.width : 0, this.viewportRect !== undefined ? this.viewportRect.left : 0, this.viewportRect !== undefined ? this.viewportRect.right : 0);
700
+ }
701
+ else if (this.horizontalScaling === "anchor") {
702
+ newRegionDimension.width =
703
+ this.anchorRect !== undefined ? this.anchorRect.width : 0;
704
+ }
705
+ if (desiredVerticalPosition !== undefined && this.verticalScaling === "fill") {
706
+ newRegionDimension.height = this.getAvailableSpace(desiredVerticalPosition, this.anchorRect !== undefined ? this.anchorRect.top : 0, this.anchorRect !== undefined ? this.anchorRect.bottom : 0, this.anchorRect !== undefined ? this.anchorRect.height : 0, this.viewportRect !== undefined ? this.viewportRect.top : 0, this.viewportRect !== undefined ? this.viewportRect.bottom : 0);
707
+ }
708
+ else if (this.verticalScaling === "anchor") {
709
+ newRegionDimension.height =
710
+ this.anchorRect !== undefined ? this.anchorRect.height : 0;
711
+ }
712
+ return newRegionDimension;
713
+ };
714
+ /**
715
+ * starts event listeners that can trigger auto updating
716
+ */
717
+ this.startAutoUpdateEventListeners = () => {
718
+ window.addEventListener(eventResize, this.update, { passive: true });
719
+ window.addEventListener(eventScroll, this.update, {
720
+ passive: true,
721
+ capture: true,
722
+ });
723
+ if (this.resizeDetector !== null && this.viewportElement !== null) {
724
+ this.resizeDetector.observe(this.viewportElement);
725
+ }
726
+ };
727
+ /**
728
+ * stops event listeners that can trigger auto updating
729
+ */
730
+ this.stopAutoUpdateEventListeners = () => {
731
+ window.removeEventListener(eventResize, this.update);
732
+ window.removeEventListener(eventScroll, this.update);
733
+ if (this.resizeDetector !== null && this.viewportElement !== null) {
734
+ this.resizeDetector.unobserve(this.viewportElement);
735
+ }
736
+ };
737
+ }
738
+ anchorChanged() {
739
+ if (this.initialLayoutComplete) {
740
+ this.anchorElement = this.getAnchor();
741
+ }
742
+ }
743
+ viewportChanged() {
744
+ if (this.initialLayoutComplete) {
745
+ this.viewportElement = this.getViewport();
746
+ }
747
+ }
748
+ horizontalPositioningModeChanged() {
749
+ this.requestReset();
750
+ }
751
+ horizontalDefaultPositionChanged() {
752
+ this.updateForAttributeChange();
753
+ }
754
+ horizontalViewportLockChanged() {
755
+ this.updateForAttributeChange();
756
+ }
757
+ horizontalInsetChanged() {
758
+ this.updateForAttributeChange();
759
+ }
760
+ horizontalThresholdChanged() {
761
+ this.updateForAttributeChange();
762
+ }
763
+ horizontalScalingChanged() {
764
+ this.updateForAttributeChange();
765
+ }
766
+ verticalPositioningModeChanged() {
767
+ this.requestReset();
768
+ }
769
+ verticalDefaultPositionChanged() {
770
+ this.updateForAttributeChange();
771
+ }
772
+ verticalViewportLockChanged() {
773
+ this.updateForAttributeChange();
774
+ }
775
+ verticalInsetChanged() {
776
+ this.updateForAttributeChange();
777
+ }
778
+ verticalThresholdChanged() {
779
+ this.updateForAttributeChange();
780
+ }
781
+ verticalScalingChanged() {
782
+ this.updateForAttributeChange();
783
+ }
784
+ fixedPlacementChanged() {
785
+ if (this.$fastController.isConnected &&
786
+ this.initialLayoutComplete) {
787
+ this.initialize();
788
+ }
789
+ }
790
+ autoUpdateModeChanged(prevMode, newMode) {
791
+ if (this.$fastController.isConnected &&
792
+ this.initialLayoutComplete) {
793
+ if (prevMode === "auto") {
794
+ this.stopAutoUpdateEventListeners();
795
+ }
796
+ if (newMode === "auto") {
797
+ this.startAutoUpdateEventListeners();
798
+ }
799
+ }
800
+ }
801
+ anchorElementChanged() {
802
+ this.requestReset();
803
+ }
804
+ viewportElementChanged() {
805
+ if (this.$fastController.isConnected &&
806
+ this.initialLayoutComplete) {
807
+ this.initialize();
808
+ }
809
+ }
810
+ /**
811
+ * @internal
812
+ */
813
+ connectedCallback() {
814
+ super.connectedCallback();
815
+ if (this.autoUpdateMode === "auto") {
816
+ this.startAutoUpdateEventListeners();
817
+ }
818
+ this.initialize();
819
+ }
820
+ /**
821
+ * @internal
822
+ */
823
+ disconnectedCallback() {
824
+ super.disconnectedCallback();
825
+ if (this.autoUpdateMode === "auto") {
826
+ this.stopAutoUpdateEventListeners();
827
+ }
828
+ this.stopObservers();
829
+ this.disconnectResizeDetector();
830
+ }
831
+ /**
832
+ * @internal
833
+ */
834
+ adoptedCallback() {
835
+ this.initialize();
836
+ }
837
+ /**
838
+ * destroys the instance's resize observer
839
+ */
840
+ disconnectResizeDetector() {
841
+ if (this.resizeDetector !== null) {
842
+ this.resizeDetector.disconnect();
843
+ this.resizeDetector = null;
844
+ }
845
+ }
846
+ /**
847
+ * initializes the instance's resize observer
848
+ */
849
+ initializeResizeDetector() {
850
+ this.disconnectResizeDetector();
851
+ this.resizeDetector = new window.ResizeObserver(this.handleResize);
852
+ }
853
+ /**
854
+ * react to attribute changes that don't require a reset
855
+ */
856
+ updateForAttributeChange() {
857
+ if (this.$fastController.isConnected &&
858
+ this.initialLayoutComplete) {
859
+ this.forceUpdate = true;
860
+ this.update();
861
+ }
862
+ }
863
+ /**
864
+ * fully initializes the component
865
+ */
866
+ initialize() {
867
+ this.initializeResizeDetector();
868
+ if (this.anchorElement === null) {
869
+ this.anchorElement = this.getAnchor();
870
+ }
871
+ this.requestReset();
872
+ }
873
+ /**
874
+ * Request a reset if there are currently no open requests
875
+ */
876
+ requestReset() {
877
+ if (this.$fastController.isConnected &&
878
+ this.pendingReset === false) {
879
+ this.setInitialState();
880
+ DOM.queueUpdate(() => this.reset());
881
+ this.pendingReset = true;
882
+ }
883
+ }
884
+ /**
885
+ * sets the starting configuration for component internal values
886
+ */
887
+ setInitialState() {
888
+ this.initialLayoutComplete = false;
889
+ this.regionVisible = false;
890
+ this.translateX = 0;
891
+ this.translateY = 0;
892
+ this.baseHorizontalOffset = 0;
893
+ this.baseVerticalOffset = 0;
894
+ this.viewportRect = undefined;
895
+ this.regionRect = undefined;
896
+ this.anchorRect = undefined;
897
+ this.verticalPosition = undefined;
898
+ this.horizontalPosition = undefined;
899
+ this.style.opacity = "0";
900
+ this.style.pointerEvents = "none";
901
+ this.forceUpdate = false;
902
+ this.style.position = this.fixedPlacement ? "fixed" : "absolute";
903
+ this.updatePositionClasses();
904
+ this.updateRegionStyle();
905
+ }
906
+ }
907
+ AnchoredRegion.intersectionService = new IntersectionService();
908
+ __decorate([
909
+ attr
910
+ ], AnchoredRegion.prototype, "anchor", void 0);
911
+ __decorate([
912
+ attr
913
+ ], AnchoredRegion.prototype, "viewport", void 0);
914
+ __decorate([
915
+ attr({ attribute: "horizontal-positioning-mode" })
916
+ ], AnchoredRegion.prototype, "horizontalPositioningMode", void 0);
917
+ __decorate([
918
+ attr({ attribute: "horizontal-default-position" })
919
+ ], AnchoredRegion.prototype, "horizontalDefaultPosition", void 0);
920
+ __decorate([
921
+ attr({ attribute: "horizontal-viewport-lock", mode: "boolean" })
922
+ ], AnchoredRegion.prototype, "horizontalViewportLock", void 0);
923
+ __decorate([
924
+ attr({ attribute: "horizontal-inset", mode: "boolean" })
925
+ ], AnchoredRegion.prototype, "horizontalInset", void 0);
926
+ __decorate([
927
+ attr({ attribute: "horizontal-threshold" })
928
+ ], AnchoredRegion.prototype, "horizontalThreshold", void 0);
929
+ __decorate([
930
+ attr({ attribute: "horizontal-scaling" })
931
+ ], AnchoredRegion.prototype, "horizontalScaling", void 0);
932
+ __decorate([
933
+ attr({ attribute: "vertical-positioning-mode" })
934
+ ], AnchoredRegion.prototype, "verticalPositioningMode", void 0);
935
+ __decorate([
936
+ attr({ attribute: "vertical-default-position" })
937
+ ], AnchoredRegion.prototype, "verticalDefaultPosition", void 0);
938
+ __decorate([
939
+ attr({ attribute: "vertical-viewport-lock", mode: "boolean" })
940
+ ], AnchoredRegion.prototype, "verticalViewportLock", void 0);
941
+ __decorate([
942
+ attr({ attribute: "vertical-inset", mode: "boolean" })
943
+ ], AnchoredRegion.prototype, "verticalInset", void 0);
944
+ __decorate([
945
+ attr({ attribute: "vertical-threshold" })
946
+ ], AnchoredRegion.prototype, "verticalThreshold", void 0);
947
+ __decorate([
948
+ attr({ attribute: "vertical-scaling" })
949
+ ], AnchoredRegion.prototype, "verticalScaling", void 0);
950
+ __decorate([
951
+ attr({ attribute: "fixed-placement", mode: "boolean" })
952
+ ], AnchoredRegion.prototype, "fixedPlacement", void 0);
953
+ __decorate([
954
+ attr({ attribute: "auto-update-mode" })
955
+ ], AnchoredRegion.prototype, "autoUpdateMode", void 0);
956
+ __decorate([
957
+ observable
958
+ ], AnchoredRegion.prototype, "anchorElement", void 0);
959
+ __decorate([
960
+ observable
961
+ ], AnchoredRegion.prototype, "viewportElement", void 0);
962
+ __decorate([
963
+ observable
964
+ ], AnchoredRegion.prototype, "initialLayoutComplete", void 0);