@vonage/vivid 3.0.0-next.7 → 3.0.0-test.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 (390) hide show
  1. package/accordion/index.js +61 -0
  2. package/accordion-item/index.js +125 -0
  3. package/badge/index.js +64 -0
  4. package/banner/index.js +212 -0
  5. package/breadcrumb/index.js +100 -0
  6. package/breadcrumb-item/index.js +55 -0
  7. package/button/index.js +761 -0
  8. package/calendar/index.js +1521 -0
  9. package/elevation/index.js +31 -0
  10. package/focus/index.js +3 -0
  11. package/icon/index.js +34 -0
  12. package/{src/index.ts → index.d.ts} +2 -2
  13. package/index.js +32 -0
  14. package/layout/index.js +53 -0
  15. package/lib/accordion/accordion.d.ts +9 -0
  16. package/lib/accordion/accordion.template.d.ts +4 -0
  17. package/lib/accordion/index.d.ts +2 -0
  18. package/lib/accordion-item/accordion-item.d.ts +13 -0
  19. package/lib/accordion-item/accordion-item.template.d.ts +4 -0
  20. package/lib/accordion-item/index.d.ts +3 -0
  21. package/lib/badge/badge.d.ts +17 -0
  22. package/lib/badge/badge.template.d.ts +4 -0
  23. package/lib/badge/index.d.ts +3 -0
  24. package/lib/banner/banner.d.ts +20 -0
  25. package/lib/banner/banner.template.d.ts +6 -0
  26. package/lib/banner/index.d.ts +2 -0
  27. package/lib/breadcrumb/breadcrumb.d.ts +3 -0
  28. package/lib/breadcrumb/index.d.ts +2 -0
  29. package/lib/breadcrumb-item/breadcrumb-item.d.ts +5 -0
  30. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +4 -0
  31. package/lib/breadcrumb-item/index.d.ts +3 -0
  32. package/lib/button/button.d.ts +17 -0
  33. package/lib/button/button.template.d.ts +4 -0
  34. package/lib/button/index.d.ts +21 -0
  35. package/lib/calendar/calendar.d.ts +11 -0
  36. package/lib/calendar/calendar.template.d.ts +4 -0
  37. package/lib/calendar/helpers/calendar.date-functions.d.ts +2 -0
  38. package/lib/calendar/helpers/calendar.event-context.d.ts +6 -0
  39. package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +9 -0
  40. package/lib/calendar/index.d.ts +3 -0
  41. package/{src/lib/components.ts → lib/components.d.ts} +16 -16
  42. package/lib/elevation/elevation.d.ts +4 -0
  43. package/lib/elevation/elevation.template.d.ts +4 -0
  44. package/lib/elevation/index.d.ts +2 -0
  45. package/lib/enums.d.ts +45 -0
  46. package/lib/focus/focus.d.ts +3 -0
  47. package/lib/focus/focus.template.d.ts +4 -0
  48. package/lib/focus/index.d.ts +2 -0
  49. package/lib/icon/icon.d.ts +11 -0
  50. package/lib/icon/icon.placeholder.d.ts +1 -0
  51. package/lib/icon/icon.template.d.ts +4 -0
  52. package/lib/icon/index.d.ts +2 -0
  53. package/lib/layout/index.d.ts +2 -0
  54. package/lib/layout/layout.d.ts +16 -0
  55. package/lib/layout/layout.template.d.ts +4 -0
  56. package/lib/popup/index.d.ts +4 -0
  57. package/lib/popup/popup.d.ts +17 -0
  58. package/lib/popup/popup.template.d.ts +4 -0
  59. package/lib/progress/index.d.ts +2 -0
  60. package/lib/progress/progress.d.ts +9 -0
  61. package/lib/progress/progress.template.d.ts +5 -0
  62. package/lib/progress-ring/index.d.ts +2 -0
  63. package/lib/progress-ring/progress-ring.d.ts +6 -0
  64. package/lib/progress-ring/progress-ring.template.d.ts +4 -0
  65. package/lib/side-drawer/index.d.ts +2 -0
  66. package/lib/side-drawer/side-drawer.d.ts +8 -0
  67. package/lib/side-drawer/side-drawer.template.d.ts +4 -0
  68. package/lib/sidenav-item/index.d.ts +3 -0
  69. package/lib/sidenav-item/sidenav-item.d.ts +6 -0
  70. package/lib/sidenav-item/sidenav-item.template.d.ts +4 -0
  71. package/lib/text/index.d.ts +2 -0
  72. package/lib/text/text.d.ts +10 -0
  73. package/lib/text/text.template.d.ts +4 -0
  74. package/lib/text-anchor/index.d.ts +2 -0
  75. package/lib/text-anchor/text-anchor.d.ts +7 -0
  76. package/lib/text-anchor/text-anchor.template.d.ts +4 -0
  77. package/lib/tooltip/index.d.ts +3 -0
  78. package/lib/tooltip/tooltip.d.ts +8 -0
  79. package/lib/tooltip/tooltip.template.d.ts +4 -0
  80. package/package.json +13 -3
  81. package/popup/index.js +2065 -0
  82. package/progress/index.js +98 -0
  83. package/progress-ring/index.js +76 -0
  84. package/shared/_has.js +58 -0
  85. package/shared/affix.js +29 -0
  86. package/shared/anchor.js +78 -0
  87. package/shared/apply-mixins.js +22 -0
  88. package/shared/aria-global.js +156 -0
  89. package/shared/base-progress.js +65 -0
  90. package/shared/breadcrumb-item.js +25 -0
  91. package/shared/class-names.js +15 -0
  92. package/shared/design-system/index.d.ts +3 -0
  93. package/shared/es.object.assign.js +68 -0
  94. package/shared/icon.js +1393 -0
  95. package/shared/index.js +4998 -0
  96. package/shared/index2.js +21 -0
  97. package/shared/patterns/affix.d.ts +9 -0
  98. package/{src/shared/patterns/index.ts → shared/patterns/index.d.ts} +1 -1
  99. package/shared/slotted.js +119 -0
  100. package/shared/style-inject.es.js +28 -0
  101. package/shared/text-anchor.js +21 -0
  102. package/shared/text-anchor.template.js +54 -0
  103. package/shared/web.dom-collections.iterator.js +1479 -0
  104. package/shared/when.js +15 -0
  105. package/side-drawer/index.js +81 -0
  106. package/sidenav-item/index.js +38 -0
  107. package/styles/fonts/spezia.css +23 -0
  108. package/styles/themes/dark.css +205 -0
  109. package/styles/themes/light.css +205 -0
  110. package/text/index.js +45 -0
  111. package/text-anchor/index.js +19 -0
  112. package/tooltip/index.js +65 -0
  113. package/.babelrc +0 -3
  114. package/.eslintrc.json +0 -70
  115. package/.stylelintrc.json +0 -8
  116. package/CHANGELOG.json +0 -343
  117. package/CHANGELOG.md +0 -45
  118. package/jest.config.cjs +0 -20
  119. package/playwright.config.dev.ts +0 -21
  120. package/playwright.config.ts +0 -34
  121. package/project.json +0 -122
  122. package/rollup.config.prod.ts +0 -50
  123. package/setupJestTests.js +0 -17
  124. package/src/lib/accordion/README.md +0 -55
  125. package/src/lib/accordion/accordion.scss +0 -10
  126. package/src/lib/accordion/accordion.spec.ts +0 -91
  127. package/src/lib/accordion/accordion.template.ts +0 -23
  128. package/src/lib/accordion/accordion.ts +0 -49
  129. package/src/lib/accordion/index.ts +0 -14
  130. package/src/lib/accordion/ui.test.ts +0 -37
  131. package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Chrome-Stable-darwin.png +0 -0
  132. package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Chrome-Stable-linux.png +0 -0
  133. package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Firefox-darwin.png +0 -0
  134. package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Firefox-linux.png +0 -0
  135. package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Safari-darwin.png +0 -0
  136. package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Safari-linux.png +0 -0
  137. package/src/lib/accordion-item/README.md +0 -113
  138. package/src/lib/accordion-item/accordion-item.scss +0 -91
  139. package/src/lib/accordion-item/accordion-item.spec.ts +0 -103
  140. package/src/lib/accordion-item/accordion-item.template.ts +0 -62
  141. package/src/lib/accordion-item/accordion-item.ts +0 -67
  142. package/src/lib/accordion-item/index.ts +0 -14
  143. package/src/lib/accordion-item/partials/variables.scss +0 -1
  144. package/src/lib/accordion-item/ui.test.ts +0 -37
  145. package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Chrome-Stable-darwin.png +0 -0
  146. package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Chrome-Stable-linux.png +0 -0
  147. package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Firefox-darwin.png +0 -0
  148. package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Firefox-linux.png +0 -0
  149. package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Safari-darwin.png +0 -0
  150. package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Safari-linux.png +0 -0
  151. package/src/lib/badge/README.md +0 -112
  152. package/src/lib/badge/badge.scss +0 -64
  153. package/src/lib/badge/badge.spec.ts +0 -114
  154. package/src/lib/badge/badge.template.ts +0 -36
  155. package/src/lib/badge/badge.ts +0 -97
  156. package/src/lib/badge/index.ts +0 -23
  157. package/src/lib/badge/ui.test.ts +0 -28
  158. package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Chrome-Stable-darwin.png +0 -0
  159. package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Chrome-Stable-linux.png +0 -0
  160. package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Firefox-darwin.png +0 -0
  161. package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Firefox-linux.png +0 -0
  162. package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Safari-darwin.png +0 -0
  163. package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Safari-linux.png +0 -0
  164. package/src/lib/banner/README.md +0 -117
  165. package/src/lib/banner/banner.scss +0 -71
  166. package/src/lib/banner/banner.spec.ts +0 -355
  167. package/src/lib/banner/banner.template.ts +0 -61
  168. package/src/lib/banner/banner.ts +0 -77
  169. package/src/lib/banner/index.ts +0 -14
  170. package/src/lib/banner/ui.test.ts +0 -64
  171. package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Chrome-Stable-darwin.png +0 -0
  172. package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Chrome-Stable-linux.png +0 -0
  173. package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Firefox-darwin.png +0 -0
  174. package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Firefox-linux.png +0 -0
  175. package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Safari-darwin.png +0 -0
  176. package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Safari-linux.png +0 -0
  177. package/src/lib/breadcrumb/README.md +0 -25
  178. package/src/lib/breadcrumb/breadcrumb.scss +0 -3
  179. package/src/lib/breadcrumb/breadcrumb.spec.ts +0 -78
  180. package/src/lib/breadcrumb/breadcrumb.ts +0 -10
  181. package/src/lib/breadcrumb/index.ts +0 -13
  182. package/src/lib/breadcrumb/ui.test.ts +0 -36
  183. package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Chrome-Stable-darwin.png +0 -0
  184. package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Chrome-Stable-linux.png +0 -0
  185. package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Firefox-darwin.png +0 -0
  186. package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Firefox-linux.png +0 -0
  187. package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Safari-darwin.png +0 -0
  188. package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Safari-linux.png +0 -0
  189. package/src/lib/breadcrumb-item/README.md +0 -40
  190. package/src/lib/breadcrumb-item/breadcrumb-item.scss +0 -28
  191. package/src/lib/breadcrumb-item/breadcrumb-item.spec.ts +0 -192
  192. package/src/lib/breadcrumb-item/breadcrumb-item.template.ts +0 -37
  193. package/src/lib/breadcrumb-item/breadcrumb-item.ts +0 -15
  194. package/src/lib/breadcrumb-item/index.ts +0 -16
  195. package/src/lib/breadcrumb-item/ui.test.ts +0 -38
  196. package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Chrome-Stable-darwin.png +0 -0
  197. package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Chrome-Stable-linux.png +0 -0
  198. package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Firefox-darwin.png +0 -0
  199. package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Firefox-linux.png +0 -0
  200. package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Safari-darwin.png +0 -0
  201. package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Safari-linux.png +0 -0
  202. package/src/lib/button/README.md +0 -120
  203. package/src/lib/button/button.scss +0 -142
  204. package/src/lib/button/button.spec.ts +0 -131
  205. package/src/lib/button/button.template.ts +0 -89
  206. package/src/lib/button/button.ts +0 -95
  207. package/src/lib/button/index.ts +0 -25
  208. package/src/lib/button/partials/variables.scss +0 -2
  209. package/src/lib/button/ui.test.ts +0 -32
  210. package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Chrome-Stable-darwin.png +0 -0
  211. package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Chrome-Stable-linux.png +0 -0
  212. package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Firefox-darwin.png +0 -0
  213. package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Firefox-linux.png +0 -0
  214. package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Safari-darwin.png +0 -0
  215. package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Safari-linux.png +0 -0
  216. package/src/lib/calendar/README.md +0 -70
  217. package/src/lib/calendar/calendar.scss +0 -176
  218. package/src/lib/calendar/calendar.spec.ts +0 -341
  219. package/src/lib/calendar/calendar.template.ts +0 -93
  220. package/src/lib/calendar/calendar.ts +0 -139
  221. package/src/lib/calendar/helpers/calendar.date-functions.ts +0 -31
  222. package/src/lib/calendar/helpers/calendar.event-context.ts +0 -72
  223. package/src/lib/calendar/helpers/calendar.keyboard-interactions.ts +0 -65
  224. package/src/lib/calendar/index.ts +0 -16
  225. package/src/lib/calendar/partials/_variables.scss +0 -15
  226. package/src/lib/calendar/ui.test.ts +0 -32
  227. package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Chrome-Stable-darwin.png +0 -0
  228. package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Chrome-Stable-linux.png +0 -0
  229. package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Firefox-darwin.png +0 -0
  230. package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Firefox-linux.png +0 -0
  231. package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Safari-darwin.png +0 -0
  232. package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Safari-linux.png +0 -0
  233. package/src/lib/components.spec.ts +0 -7
  234. package/src/lib/elevation/README.md +0 -99
  235. package/src/lib/elevation/elevation.scss +0 -15
  236. package/src/lib/elevation/elevation.spec.ts +0 -55
  237. package/src/lib/elevation/elevation.template.ts +0 -26
  238. package/src/lib/elevation/elevation.ts +0 -17
  239. package/src/lib/elevation/index.ts +0 -17
  240. package/src/lib/elevation/partials/_elevation.mixin.scss +0 -4
  241. package/src/lib/elevation/ui.test.ts +0 -32
  242. package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Chrome-Stable-darwin.png +0 -0
  243. package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Chrome-Stable-linux.png +0 -0
  244. package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Firefox-darwin.png +0 -0
  245. package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Firefox-linux.png +0 -0
  246. package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Safari-darwin.png +0 -0
  247. package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Safari-linux.png +0 -0
  248. package/src/lib/enums.ts +0 -55
  249. package/src/lib/focus/README.md +0 -1
  250. package/src/lib/focus/focus.scss +0 -17
  251. package/src/lib/focus/focus.template.ts +0 -16
  252. package/src/lib/focus/focus.ts +0 -10
  253. package/src/lib/focus/index.ts +0 -21
  254. package/src/lib/focus/partials/variables.scss +0 -2
  255. package/src/lib/icon/README.md +0 -70
  256. package/src/lib/icon/__snapshots__/icon.spec.ts.snap +0 -16
  257. package/src/lib/icon/icon.placeholder.ts +0 -12
  258. package/src/lib/icon/icon.scss +0 -52
  259. package/src/lib/icon/icon.spec.ts +0 -106
  260. package/src/lib/icon/icon.template.ts +0 -23
  261. package/src/lib/icon/icon.ts +0 -93
  262. package/src/lib/icon/index.ts +0 -14
  263. package/src/lib/layout/README.md +0 -154
  264. package/src/lib/layout/index.ts +0 -18
  265. package/src/lib/layout/layout.scss +0 -40
  266. package/src/lib/layout/layout.spec.ts +0 -73
  267. package/src/lib/layout/layout.template.ts +0 -29
  268. package/src/lib/layout/layout.ts +0 -46
  269. package/src/lib/layout/partials/_functions.scss +0 -15
  270. package/src/lib/layout/partials/_mixins.scss +0 -5
  271. package/src/lib/layout/partials/_variables.scss +0 -23
  272. package/src/lib/layout/ui.test.ts +0 -32
  273. package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Chrome-Stable-darwin.png +0 -0
  274. package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Chrome-Stable-linux.png +0 -0
  275. package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Firefox-darwin.png +0 -0
  276. package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Firefox-linux.png +0 -0
  277. package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Safari-darwin.png +0 -0
  278. package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Safari-linux.png +0 -0
  279. package/src/lib/popup/README.md +0 -261
  280. package/src/lib/popup/index.ts +0 -21
  281. package/src/lib/popup/popup.scss +0 -43
  282. package/src/lib/popup/popup.spec.ts +0 -265
  283. package/src/lib/popup/popup.template.ts +0 -41
  284. package/src/lib/popup/popup.ts +0 -158
  285. package/src/lib/popup/ui.test.ts +0 -111
  286. package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Chrome-Stable-darwin.png +0 -0
  287. package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Chrome-Stable-linux.png +0 -0
  288. package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Firefox-darwin.png +0 -0
  289. package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Firefox-linux.png +0 -0
  290. package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Safari-darwin.png +0 -0
  291. package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Safari-linux.png +0 -0
  292. package/src/lib/progress/README.md +0 -107
  293. package/src/lib/progress/index.ts +0 -14
  294. package/src/lib/progress/progress.scss +0 -133
  295. package/src/lib/progress/progress.spec.ts +0 -173
  296. package/src/lib/progress/progress.template.ts +0 -62
  297. package/src/lib/progress/progress.ts +0 -25
  298. package/src/lib/progress/ui.test.ts +0 -70
  299. package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Chrome-Stable-darwin.png +0 -0
  300. package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Chrome-Stable-linux.png +0 -0
  301. package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Firefox-darwin.png +0 -0
  302. package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Firefox-linux.png +0 -0
  303. package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Safari-darwin.png +0 -0
  304. package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Safari-linux.png +0 -0
  305. package/src/lib/progress-ring/README.md +0 -90
  306. package/src/lib/progress-ring/index.ts +0 -15
  307. package/src/lib/progress-ring/progress-ring.scss +0 -75
  308. package/src/lib/progress-ring/progress-ring.spec.ts +0 -139
  309. package/src/lib/progress-ring/progress-ring.template.ts +0 -82
  310. package/src/lib/progress-ring/progress-ring.ts +0 -18
  311. package/src/lib/progress-ring/ui.test.ts +0 -35
  312. package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Chrome-Stable-darwin.png +0 -0
  313. package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Chrome-Stable-linux.png +0 -0
  314. package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Firefox-darwin.png +0 -0
  315. package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Firefox-linux.png +0 -0
  316. package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Safari-darwin.png +0 -0
  317. package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Safari-linux.png +0 -0
  318. package/src/lib/side-drawer/README.md +0 -304
  319. package/src/lib/side-drawer/index.ts +0 -16
  320. package/src/lib/side-drawer/partials/variables.scss +0 -6
  321. package/src/lib/side-drawer/side-drawer.scss +0 -109
  322. package/src/lib/side-drawer/side-drawer.spec.ts +0 -118
  323. package/src/lib/side-drawer/side-drawer.template.ts +0 -51
  324. package/src/lib/side-drawer/side-drawer.ts +0 -58
  325. package/src/lib/side-drawer/ui.test.ts +0 -102
  326. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Chrome-Stable-darwin.png +0 -0
  327. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Chrome-Stable-linux.png +0 -0
  328. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Firefox-darwin.png +0 -0
  329. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Firefox-linux.png +0 -0
  330. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Safari-darwin.png +0 -0
  331. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Safari-linux.png +0 -0
  332. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Chrome-Stable-darwin.png +0 -0
  333. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Chrome-Stable-linux.png +0 -0
  334. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Firefox-darwin.png +0 -0
  335. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Firefox-linux.png +0 -0
  336. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Safari-darwin.png +0 -0
  337. package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Safari-linux.png +0 -0
  338. package/src/lib/sidenav-item/README.md +0 -41
  339. package/src/lib/sidenav-item/index.ts +0 -20
  340. package/src/lib/sidenav-item/sidenav-item.scss +0 -51
  341. package/src/lib/sidenav-item/sidenav-item.spec.ts +0 -64
  342. package/src/lib/sidenav-item/sidenav-item.template.ts +0 -25
  343. package/src/lib/sidenav-item/sidenav-item.ts +0 -15
  344. package/src/lib/sidenav-item/ui.test.ts +0 -32
  345. package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Chrome-Stable-darwin.png +0 -0
  346. package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Chrome-Stable-linux.png +0 -0
  347. package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Firefox-darwin.png +0 -0
  348. package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Firefox-linux.png +0 -0
  349. package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Safari-darwin.png +0 -0
  350. package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Safari-linux.png +0 -0
  351. package/src/lib/text/README.md +0 -119
  352. package/src/lib/text/index.ts +0 -14
  353. package/src/lib/text/text.scss +0 -92
  354. package/src/lib/text/text.spec.ts +0 -54
  355. package/src/lib/text/text.template.ts +0 -28
  356. package/src/lib/text/text.ts +0 -55
  357. package/src/lib/text/ui.test.ts +0 -39
  358. package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Chrome-Stable-darwin.png +0 -0
  359. package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Chrome-Stable-linux.png +0 -0
  360. package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Firefox-darwin.png +0 -0
  361. package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Firefox-linux.png +0 -0
  362. package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Safari-darwin.png +0 -0
  363. package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Safari-linux.png +0 -0
  364. package/src/lib/text-anchor/README.md +0 -5
  365. package/src/lib/text-anchor/index.ts +0 -12
  366. package/src/lib/text-anchor/text-anchor.spec.ts +0 -153
  367. package/src/lib/text-anchor/text-anchor.template.ts +0 -66
  368. package/src/lib/text-anchor/text-anchor.ts +0 -22
  369. package/src/lib/tooltip/README.md +0 -132
  370. package/src/lib/tooltip/index.ts +0 -16
  371. package/src/lib/tooltip/partials/variables.scss +0 -1
  372. package/src/lib/tooltip/tooltip.scss +0 -18
  373. package/src/lib/tooltip/tooltip.spec.ts +0 -70
  374. package/src/lib/tooltip/tooltip.template.ts +0 -30
  375. package/src/lib/tooltip/tooltip.ts +0 -44
  376. package/src/lib/tooltip/ui.test.ts +0 -53
  377. package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Chrome-Stable-darwin.png +0 -0
  378. package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Chrome-Stable-linux.png +0 -0
  379. package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Firefox-darwin.png +0 -0
  380. package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Firefox-linux.png +0 -0
  381. package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Safari-darwin.png +0 -0
  382. package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Safari-linux.png +0 -0
  383. package/src/shared/design-system/index.ts +0 -12
  384. package/src/shared/patterns/affix.ts +0 -56
  385. package/src/types/extract-gfm.d.ts +0 -5
  386. package/src/types/style.d.ts +0 -4
  387. package/src/visual-tests/visual-tests-utils.ts +0 -76
  388. package/tsconfig.json +0 -36
  389. package/tsconfig.lib.json +0 -11
  390. package/tsconfig.spec.json +0 -16
@@ -0,0 +1,1521 @@
1
+ import '../elevation/index.js';
2
+ import { e as emptyArray, O as Observable, S as SubscriberSet, D as DOM, H as HTMLDirective, f as HTMLView, F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
3
+ import { s as styleInject } from '../shared/style-inject.es.js';
4
+ import '../shared/web.dom-collections.iterator.js';
5
+ import '../shared/es.object.assign.js';
6
+ import { b as _has, _ as _curry1, a as _curry2 } from '../shared/_has.js';
7
+ import '../shared/class-names.js';
8
+
9
+ /** @internal */
10
+ function newSplice(index, removed, addedCount) {
11
+ return {
12
+ index: index,
13
+ removed: removed,
14
+ addedCount: addedCount,
15
+ };
16
+ }
17
+ const EDIT_LEAVE = 0;
18
+ const EDIT_UPDATE = 1;
19
+ const EDIT_ADD = 2;
20
+ const EDIT_DELETE = 3;
21
+ // Note: This function is *based* on the computation of the Levenshtein
22
+ // "edit" distance. The one change is that "updates" are treated as two
23
+ // edits - not one. With Array splices, an update is really a delete
24
+ // followed by an add. By retaining this, we optimize for "keeping" the
25
+ // maximum array items in the original array. For example:
26
+ //
27
+ // 'xxxx123' -> '123yyyy'
28
+ //
29
+ // With 1-edit updates, the shortest path would be just to update all seven
30
+ // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
31
+ // leaves the substring '123' intact.
32
+ function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {
33
+ // "Deletion" columns
34
+ const rowCount = oldEnd - oldStart + 1;
35
+ const columnCount = currentEnd - currentStart + 1;
36
+ const distances = new Array(rowCount);
37
+ let north;
38
+ let west;
39
+ // "Addition" rows. Initialize null column.
40
+ for (let i = 0; i < rowCount; ++i) {
41
+ distances[i] = new Array(columnCount);
42
+ distances[i][0] = i;
43
+ }
44
+ // Initialize null row
45
+ for (let j = 0; j < columnCount; ++j) {
46
+ distances[0][j] = j;
47
+ }
48
+ for (let i = 1; i < rowCount; ++i) {
49
+ for (let j = 1; j < columnCount; ++j) {
50
+ if (current[currentStart + j - 1] === old[oldStart + i - 1]) {
51
+ distances[i][j] = distances[i - 1][j - 1];
52
+ }
53
+ else {
54
+ north = distances[i - 1][j] + 1;
55
+ west = distances[i][j - 1] + 1;
56
+ distances[i][j] = north < west ? north : west;
57
+ }
58
+ }
59
+ }
60
+ return distances;
61
+ }
62
+ // This starts at the final weight, and walks "backward" by finding
63
+ // the minimum previous weight recursively until the origin of the weight
64
+ // matrix.
65
+ function spliceOperationsFromEditDistances(distances) {
66
+ let i = distances.length - 1;
67
+ let j = distances[0].length - 1;
68
+ let current = distances[i][j];
69
+ const edits = [];
70
+ while (i > 0 || j > 0) {
71
+ if (i === 0) {
72
+ edits.push(EDIT_ADD);
73
+ j--;
74
+ continue;
75
+ }
76
+ if (j === 0) {
77
+ edits.push(EDIT_DELETE);
78
+ i--;
79
+ continue;
80
+ }
81
+ const northWest = distances[i - 1][j - 1];
82
+ const west = distances[i - 1][j];
83
+ const north = distances[i][j - 1];
84
+ let min;
85
+ if (west < north) {
86
+ min = west < northWest ? west : northWest;
87
+ }
88
+ else {
89
+ min = north < northWest ? north : northWest;
90
+ }
91
+ if (min === northWest) {
92
+ if (northWest === current) {
93
+ edits.push(EDIT_LEAVE);
94
+ }
95
+ else {
96
+ edits.push(EDIT_UPDATE);
97
+ current = northWest;
98
+ }
99
+ i--;
100
+ j--;
101
+ }
102
+ else if (min === west) {
103
+ edits.push(EDIT_DELETE);
104
+ i--;
105
+ current = west;
106
+ }
107
+ else {
108
+ edits.push(EDIT_ADD);
109
+ j--;
110
+ current = north;
111
+ }
112
+ }
113
+ edits.reverse();
114
+ return edits;
115
+ }
116
+ function sharedPrefix(current, old, searchLength) {
117
+ for (let i = 0; i < searchLength; ++i) {
118
+ if (current[i] !== old[i]) {
119
+ return i;
120
+ }
121
+ }
122
+ return searchLength;
123
+ }
124
+ function sharedSuffix(current, old, searchLength) {
125
+ let index1 = current.length;
126
+ let index2 = old.length;
127
+ let count = 0;
128
+ while (count < searchLength && current[--index1] === old[--index2]) {
129
+ count++;
130
+ }
131
+ return count;
132
+ }
133
+ function intersect(start1, end1, start2, end2) {
134
+ // Disjoint
135
+ if (end1 < start2 || end2 < start1) {
136
+ return -1;
137
+ }
138
+ // Adjacent
139
+ if (end1 === start2 || end2 === start1) {
140
+ return 0;
141
+ }
142
+ // Non-zero intersect, span1 first
143
+ if (start1 < start2) {
144
+ if (end1 < end2) {
145
+ return end1 - start2; // Overlap
146
+ }
147
+ return end2 - start2; // Contained
148
+ }
149
+ // Non-zero intersect, span2 first
150
+ if (end2 < end1) {
151
+ return end2 - start1; // Overlap
152
+ }
153
+ return end1 - start1; // Contained
154
+ }
155
+ /**
156
+ * Splice Projection functions:
157
+ *
158
+ * A splice map is a representation of how a previous array of items
159
+ * was transformed into a new array of items. Conceptually it is a list of
160
+ * tuples of
161
+ *
162
+ * <index, removed, addedCount>
163
+ *
164
+ * which are kept in ascending index order of. The tuple represents that at
165
+ * the |index|, |removed| sequence of items were removed, and counting forward
166
+ * from |index|, |addedCount| items were added.
167
+ */
168
+ /**
169
+ * @internal
170
+ * @remarks
171
+ * Lacking individual splice mutation information, the minimal set of
172
+ * splices can be synthesized given the previous state and final state of an
173
+ * array. The basic approach is to calculate the edit distance matrix and
174
+ * choose the shortest path through it.
175
+ *
176
+ * Complexity: O(l * p)
177
+ * l: The length of the current array
178
+ * p: The length of the old array
179
+ */
180
+ function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) {
181
+ let prefixCount = 0;
182
+ let suffixCount = 0;
183
+ const minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
184
+ if (currentStart === 0 && oldStart === 0) {
185
+ prefixCount = sharedPrefix(current, old, minLength);
186
+ }
187
+ if (currentEnd === current.length && oldEnd === old.length) {
188
+ suffixCount = sharedSuffix(current, old, minLength - prefixCount);
189
+ }
190
+ currentStart += prefixCount;
191
+ oldStart += prefixCount;
192
+ currentEnd -= suffixCount;
193
+ oldEnd -= suffixCount;
194
+ if (currentEnd - currentStart === 0 && oldEnd - oldStart === 0) {
195
+ return emptyArray;
196
+ }
197
+ if (currentStart === currentEnd) {
198
+ const splice = newSplice(currentStart, [], 0);
199
+ while (oldStart < oldEnd) {
200
+ splice.removed.push(old[oldStart++]);
201
+ }
202
+ return [splice];
203
+ }
204
+ else if (oldStart === oldEnd) {
205
+ return [newSplice(currentStart, [], currentEnd - currentStart)];
206
+ }
207
+ const ops = spliceOperationsFromEditDistances(calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
208
+ const splices = [];
209
+ let splice = void 0;
210
+ let index = currentStart;
211
+ let oldIndex = oldStart;
212
+ for (let i = 0; i < ops.length; ++i) {
213
+ switch (ops[i]) {
214
+ case EDIT_LEAVE:
215
+ if (splice !== void 0) {
216
+ splices.push(splice);
217
+ splice = void 0;
218
+ }
219
+ index++;
220
+ oldIndex++;
221
+ break;
222
+ case EDIT_UPDATE:
223
+ if (splice === void 0) {
224
+ splice = newSplice(index, [], 0);
225
+ }
226
+ splice.addedCount++;
227
+ index++;
228
+ splice.removed.push(old[oldIndex]);
229
+ oldIndex++;
230
+ break;
231
+ case EDIT_ADD:
232
+ if (splice === void 0) {
233
+ splice = newSplice(index, [], 0);
234
+ }
235
+ splice.addedCount++;
236
+ index++;
237
+ break;
238
+ case EDIT_DELETE:
239
+ if (splice === void 0) {
240
+ splice = newSplice(index, [], 0);
241
+ }
242
+ splice.removed.push(old[oldIndex]);
243
+ oldIndex++;
244
+ break;
245
+ // no default
246
+ }
247
+ }
248
+ if (splice !== void 0) {
249
+ splices.push(splice);
250
+ }
251
+ return splices;
252
+ }
253
+ const $push = Array.prototype.push;
254
+ function mergeSplice(splices, index, removed, addedCount) {
255
+ const splice = newSplice(index, removed, addedCount);
256
+ let inserted = false;
257
+ let insertionOffset = 0;
258
+ for (let i = 0; i < splices.length; i++) {
259
+ const current = splices[i];
260
+ current.index += insertionOffset;
261
+ if (inserted) {
262
+ continue;
263
+ }
264
+ const intersectCount = intersect(splice.index, splice.index + splice.removed.length, current.index, current.index + current.addedCount);
265
+ if (intersectCount >= 0) {
266
+ // Merge the two splices
267
+ splices.splice(i, 1);
268
+ i--;
269
+ insertionOffset -= current.addedCount - current.removed.length;
270
+ splice.addedCount += current.addedCount - intersectCount;
271
+ const deleteCount = splice.removed.length + current.removed.length - intersectCount;
272
+ if (!splice.addedCount && !deleteCount) {
273
+ // merged splice is a noop. discard.
274
+ inserted = true;
275
+ }
276
+ else {
277
+ let currentRemoved = current.removed;
278
+ if (splice.index < current.index) {
279
+ // some prefix of splice.removed is prepended to current.removed.
280
+ const prepend = splice.removed.slice(0, current.index - splice.index);
281
+ $push.apply(prepend, currentRemoved);
282
+ currentRemoved = prepend;
283
+ }
284
+ if (splice.index + splice.removed.length >
285
+ current.index + current.addedCount) {
286
+ // some suffix of splice.removed is appended to current.removed.
287
+ const append = splice.removed.slice(current.index + current.addedCount - splice.index);
288
+ $push.apply(currentRemoved, append);
289
+ }
290
+ splice.removed = currentRemoved;
291
+ if (current.index < splice.index) {
292
+ splice.index = current.index;
293
+ }
294
+ }
295
+ }
296
+ else if (splice.index < current.index) {
297
+ // Insert splice here.
298
+ inserted = true;
299
+ splices.splice(i, 0, splice);
300
+ i++;
301
+ const offset = splice.addedCount - splice.removed.length;
302
+ current.index += offset;
303
+ insertionOffset += offset;
304
+ }
305
+ }
306
+ if (!inserted) {
307
+ splices.push(splice);
308
+ }
309
+ }
310
+ function createInitialSplices(changeRecords) {
311
+ const splices = [];
312
+ for (let i = 0, ii = changeRecords.length; i < ii; i++) {
313
+ const record = changeRecords[i];
314
+ mergeSplice(splices, record.index, record.removed, record.addedCount);
315
+ }
316
+ return splices;
317
+ }
318
+ /** @internal */
319
+ function projectArraySplices(array, changeRecords) {
320
+ let splices = [];
321
+ const initialSplices = createInitialSplices(changeRecords);
322
+ for (let i = 0, ii = initialSplices.length; i < ii; ++i) {
323
+ const splice = initialSplices[i];
324
+ if (splice.addedCount === 1 && splice.removed.length === 1) {
325
+ if (splice.removed[0] !== array[splice.index]) {
326
+ splices.push(splice);
327
+ }
328
+ continue;
329
+ }
330
+ splices = splices.concat(calcSplices(array, splice.index, splice.index + splice.addedCount, splice.removed, 0, splice.removed.length));
331
+ }
332
+ return splices;
333
+ }
334
+
335
+ let arrayObservationEnabled = false;
336
+ function adjustIndex(changeRecord, array) {
337
+ let index = changeRecord.index;
338
+ const arrayLength = array.length;
339
+ if (index > arrayLength) {
340
+ index = arrayLength - changeRecord.addedCount;
341
+ }
342
+ else if (index < 0) {
343
+ index =
344
+ arrayLength + changeRecord.removed.length + index - changeRecord.addedCount;
345
+ }
346
+ if (index < 0) {
347
+ index = 0;
348
+ }
349
+ changeRecord.index = index;
350
+ return changeRecord;
351
+ }
352
+ class ArrayObserver extends SubscriberSet {
353
+ constructor(source) {
354
+ super(source);
355
+ this.oldCollection = void 0;
356
+ this.splices = void 0;
357
+ this.needsQueue = true;
358
+ this.call = this.flush;
359
+ Reflect.defineProperty(source, "$fastController", {
360
+ value: this,
361
+ enumerable: false,
362
+ });
363
+ }
364
+ addSplice(splice) {
365
+ if (this.splices === void 0) {
366
+ this.splices = [splice];
367
+ }
368
+ else {
369
+ this.splices.push(splice);
370
+ }
371
+ if (this.needsQueue) {
372
+ this.needsQueue = false;
373
+ DOM.queueUpdate(this);
374
+ }
375
+ }
376
+ reset(oldCollection) {
377
+ this.oldCollection = oldCollection;
378
+ if (this.needsQueue) {
379
+ this.needsQueue = false;
380
+ DOM.queueUpdate(this);
381
+ }
382
+ }
383
+ flush() {
384
+ const splices = this.splices;
385
+ const oldCollection = this.oldCollection;
386
+ if (splices === void 0 && oldCollection === void 0) {
387
+ return;
388
+ }
389
+ this.needsQueue = true;
390
+ this.splices = void 0;
391
+ this.oldCollection = void 0;
392
+ const finalSplices = oldCollection === void 0
393
+ ? projectArraySplices(this.source, splices)
394
+ : calcSplices(this.source, 0, this.source.length, oldCollection, 0, oldCollection.length);
395
+ this.notify(finalSplices);
396
+ }
397
+ }
398
+ /* eslint-disable prefer-rest-params */
399
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
400
+ /**
401
+ * Enables the array observation mechanism.
402
+ * @remarks
403
+ * Array observation is enabled automatically when using the
404
+ * {@link RepeatDirective}, so calling this API manually is
405
+ * not typically necessary.
406
+ * @public
407
+ */
408
+ function enableArrayObservation() {
409
+ if (arrayObservationEnabled) {
410
+ return;
411
+ }
412
+ arrayObservationEnabled = true;
413
+ Observable.setArrayObserverFactory((collection) => {
414
+ return new ArrayObserver(collection);
415
+ });
416
+ const proto = Array.prototype;
417
+ // Don't patch Array if it has already been patched
418
+ // by another copy of fast-element.
419
+ if (proto.$fastPatch) {
420
+ return;
421
+ }
422
+ Reflect.defineProperty(proto, "$fastPatch", {
423
+ value: 1,
424
+ enumerable: false,
425
+ });
426
+ const pop = proto.pop;
427
+ const push = proto.push;
428
+ const reverse = proto.reverse;
429
+ const shift = proto.shift;
430
+ const sort = proto.sort;
431
+ const splice = proto.splice;
432
+ const unshift = proto.unshift;
433
+ proto.pop = function () {
434
+ const notEmpty = this.length > 0;
435
+ const methodCallResult = pop.apply(this, arguments);
436
+ const o = this.$fastController;
437
+ if (o !== void 0 && notEmpty) {
438
+ o.addSplice(newSplice(this.length, [methodCallResult], 0));
439
+ }
440
+ return methodCallResult;
441
+ };
442
+ proto.push = function () {
443
+ const methodCallResult = push.apply(this, arguments);
444
+ const o = this.$fastController;
445
+ if (o !== void 0) {
446
+ o.addSplice(adjustIndex(newSplice(this.length - arguments.length, [], arguments.length), this));
447
+ }
448
+ return methodCallResult;
449
+ };
450
+ proto.reverse = function () {
451
+ let oldArray;
452
+ const o = this.$fastController;
453
+ if (o !== void 0) {
454
+ o.flush();
455
+ oldArray = this.slice();
456
+ }
457
+ const methodCallResult = reverse.apply(this, arguments);
458
+ if (o !== void 0) {
459
+ o.reset(oldArray);
460
+ }
461
+ return methodCallResult;
462
+ };
463
+ proto.shift = function () {
464
+ const notEmpty = this.length > 0;
465
+ const methodCallResult = shift.apply(this, arguments);
466
+ const o = this.$fastController;
467
+ if (o !== void 0 && notEmpty) {
468
+ o.addSplice(newSplice(0, [methodCallResult], 0));
469
+ }
470
+ return methodCallResult;
471
+ };
472
+ proto.sort = function () {
473
+ let oldArray;
474
+ const o = this.$fastController;
475
+ if (o !== void 0) {
476
+ o.flush();
477
+ oldArray = this.slice();
478
+ }
479
+ const methodCallResult = sort.apply(this, arguments);
480
+ if (o !== void 0) {
481
+ o.reset(oldArray);
482
+ }
483
+ return methodCallResult;
484
+ };
485
+ proto.splice = function () {
486
+ const methodCallResult = splice.apply(this, arguments);
487
+ const o = this.$fastController;
488
+ if (o !== void 0) {
489
+ o.addSplice(adjustIndex(newSplice(+arguments[0], methodCallResult, arguments.length > 2 ? arguments.length - 2 : 0), this));
490
+ }
491
+ return methodCallResult;
492
+ };
493
+ proto.unshift = function () {
494
+ const methodCallResult = unshift.apply(this, arguments);
495
+ const o = this.$fastController;
496
+ if (o !== void 0) {
497
+ o.addSplice(adjustIndex(newSplice(0, [], arguments.length), this));
498
+ }
499
+ return methodCallResult;
500
+ };
501
+ }
502
+ /* eslint-enable prefer-rest-params */
503
+ /* eslint-enable @typescript-eslint/explicit-function-return-type */
504
+
505
+ const defaultRepeatOptions = Object.freeze({
506
+ positioning: false,
507
+ recycle: true,
508
+ });
509
+ function bindWithoutPositioning(view, items, index, context) {
510
+ view.bind(items[index], context);
511
+ }
512
+ function bindWithPositioning(view, items, index, context) {
513
+ const childContext = Object.create(context);
514
+ childContext.index = index;
515
+ childContext.length = items.length;
516
+ view.bind(items[index], childContext);
517
+ }
518
+ /**
519
+ * A behavior that renders a template for each item in an array.
520
+ * @public
521
+ */
522
+ class RepeatBehavior {
523
+ /**
524
+ * Creates an instance of RepeatBehavior.
525
+ * @param location - The location in the DOM to render the repeat.
526
+ * @param itemsBinding - The array to render.
527
+ * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
528
+ * @param templateBinding - The template to render for each item.
529
+ * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
530
+ * @param options - Options used to turn on special repeat features.
531
+ */
532
+ constructor(location, itemsBinding, isItemsBindingVolatile, templateBinding, isTemplateBindingVolatile, options) {
533
+ this.location = location;
534
+ this.itemsBinding = itemsBinding;
535
+ this.templateBinding = templateBinding;
536
+ this.options = options;
537
+ this.source = null;
538
+ this.views = [];
539
+ this.items = null;
540
+ this.itemsObserver = null;
541
+ this.originalContext = void 0;
542
+ this.childContext = void 0;
543
+ this.bindView = bindWithoutPositioning;
544
+ this.itemsBindingObserver = Observable.binding(itemsBinding, this, isItemsBindingVolatile);
545
+ this.templateBindingObserver = Observable.binding(templateBinding, this, isTemplateBindingVolatile);
546
+ if (options.positioning) {
547
+ this.bindView = bindWithPositioning;
548
+ }
549
+ }
550
+ /**
551
+ * Bind this behavior to the source.
552
+ * @param source - The source to bind to.
553
+ * @param context - The execution context that the binding is operating within.
554
+ */
555
+ bind(source, context) {
556
+ this.source = source;
557
+ this.originalContext = context;
558
+ this.childContext = Object.create(context);
559
+ this.childContext.parent = source;
560
+ this.childContext.parentContext = this.originalContext;
561
+ this.items = this.itemsBindingObserver.observe(source, this.originalContext);
562
+ this.template = this.templateBindingObserver.observe(source, this.originalContext);
563
+ this.observeItems(true);
564
+ this.refreshAllViews();
565
+ }
566
+ /**
567
+ * Unbinds this behavior from the source.
568
+ * @param source - The source to unbind from.
569
+ */
570
+ unbind() {
571
+ this.source = null;
572
+ this.items = null;
573
+ if (this.itemsObserver !== null) {
574
+ this.itemsObserver.unsubscribe(this);
575
+ }
576
+ this.unbindAllViews();
577
+ this.itemsBindingObserver.disconnect();
578
+ this.templateBindingObserver.disconnect();
579
+ }
580
+ /** @internal */
581
+ handleChange(source, args) {
582
+ if (source === this.itemsBinding) {
583
+ this.items = this.itemsBindingObserver.observe(this.source, this.originalContext);
584
+ this.observeItems();
585
+ this.refreshAllViews();
586
+ }
587
+ else if (source === this.templateBinding) {
588
+ this.template = this.templateBindingObserver.observe(this.source, this.originalContext);
589
+ this.refreshAllViews(true);
590
+ }
591
+ else {
592
+ this.updateViews(args);
593
+ }
594
+ }
595
+ observeItems(force = false) {
596
+ if (!this.items) {
597
+ this.items = emptyArray;
598
+ return;
599
+ }
600
+ const oldObserver = this.itemsObserver;
601
+ const newObserver = (this.itemsObserver = Observable.getNotifier(this.items));
602
+ const hasNewObserver = oldObserver !== newObserver;
603
+ if (hasNewObserver && oldObserver !== null) {
604
+ oldObserver.unsubscribe(this);
605
+ }
606
+ if (hasNewObserver || force) {
607
+ newObserver.subscribe(this);
608
+ }
609
+ }
610
+ updateViews(splices) {
611
+ const childContext = this.childContext;
612
+ const views = this.views;
613
+ const totalRemoved = [];
614
+ const bindView = this.bindView;
615
+ let removeDelta = 0;
616
+ for (let i = 0, ii = splices.length; i < ii; ++i) {
617
+ const splice = splices[i];
618
+ const removed = splice.removed;
619
+ totalRemoved.push(...views.splice(splice.index + removeDelta, removed.length));
620
+ removeDelta -= splice.addedCount;
621
+ }
622
+ const items = this.items;
623
+ const template = this.template;
624
+ for (let i = 0, ii = splices.length; i < ii; ++i) {
625
+ const splice = splices[i];
626
+ let addIndex = splice.index;
627
+ const end = addIndex + splice.addedCount;
628
+ for (; addIndex < end; ++addIndex) {
629
+ const neighbor = views[addIndex];
630
+ const location = neighbor ? neighbor.firstChild : this.location;
631
+ const view = this.options.recycle && totalRemoved.length > 0
632
+ ? totalRemoved.shift()
633
+ : template.create();
634
+ views.splice(addIndex, 0, view);
635
+ bindView(view, items, addIndex, childContext);
636
+ view.insertBefore(location);
637
+ }
638
+ }
639
+ for (let i = 0, ii = totalRemoved.length; i < ii; ++i) {
640
+ totalRemoved[i].dispose();
641
+ }
642
+ if (this.options.positioning) {
643
+ for (let i = 0, ii = views.length; i < ii; ++i) {
644
+ const currentContext = views[i].context;
645
+ currentContext.length = ii;
646
+ currentContext.index = i;
647
+ }
648
+ }
649
+ }
650
+ refreshAllViews(templateChanged = false) {
651
+ const items = this.items;
652
+ const childContext = this.childContext;
653
+ const template = this.template;
654
+ const location = this.location;
655
+ const bindView = this.bindView;
656
+ let itemsLength = items.length;
657
+ let views = this.views;
658
+ let viewsLength = views.length;
659
+ if (itemsLength === 0 || templateChanged) {
660
+ // all views need to be removed
661
+ HTMLView.disposeContiguousBatch(views);
662
+ viewsLength = 0;
663
+ }
664
+ if (viewsLength === 0) {
665
+ // all views need to be created
666
+ this.views = views = new Array(itemsLength);
667
+ for (let i = 0; i < itemsLength; ++i) {
668
+ const view = template.create();
669
+ bindView(view, items, i, childContext);
670
+ views[i] = view;
671
+ view.insertBefore(location);
672
+ }
673
+ }
674
+ else {
675
+ // attempt to reuse existing views with new data
676
+ let i = 0;
677
+ for (; i < itemsLength; ++i) {
678
+ if (i < viewsLength) {
679
+ const view = views[i];
680
+ bindView(view, items, i, childContext);
681
+ }
682
+ else {
683
+ const view = template.create();
684
+ bindView(view, items, i, childContext);
685
+ views.push(view);
686
+ view.insertBefore(location);
687
+ }
688
+ }
689
+ const removed = views.splice(i, viewsLength - i);
690
+ for (i = 0, itemsLength = removed.length; i < itemsLength; ++i) {
691
+ removed[i].dispose();
692
+ }
693
+ }
694
+ }
695
+ unbindAllViews() {
696
+ const views = this.views;
697
+ for (let i = 0, ii = views.length; i < ii; ++i) {
698
+ views[i].unbind();
699
+ }
700
+ }
701
+ }
702
+ /**
703
+ * A directive that configures list rendering.
704
+ * @public
705
+ */
706
+ class RepeatDirective extends HTMLDirective {
707
+ /**
708
+ * Creates an instance of RepeatDirective.
709
+ * @param itemsBinding - The binding that provides the array to render.
710
+ * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
711
+ * @param options - Options used to turn on special repeat features.
712
+ */
713
+ constructor(itemsBinding, templateBinding, options) {
714
+ super();
715
+ this.itemsBinding = itemsBinding;
716
+ this.templateBinding = templateBinding;
717
+ this.options = options;
718
+ /**
719
+ * Creates a placeholder string based on the directive's index within the template.
720
+ * @param index - The index of the directive within the template.
721
+ */
722
+ this.createPlaceholder = DOM.createBlockPlaceholder;
723
+ enableArrayObservation();
724
+ this.isItemsBindingVolatile = Observable.isVolatileBinding(itemsBinding);
725
+ this.isTemplateBindingVolatile = Observable.isVolatileBinding(templateBinding);
726
+ }
727
+ /**
728
+ * Creates a behavior for the provided target node.
729
+ * @param target - The node instance to create the behavior for.
730
+ */
731
+ createBehavior(target) {
732
+ return new RepeatBehavior(target, this.itemsBinding, this.isItemsBindingVolatile, this.templateBinding, this.isTemplateBindingVolatile, this.options);
733
+ }
734
+ }
735
+ /**
736
+ * A directive that enables list rendering.
737
+ * @param itemsBinding - The array to render.
738
+ * @param templateOrTemplateBinding - The template or a template binding used obtain a template
739
+ * to render for each item in the array.
740
+ * @param options - Options used to turn on special repeat features.
741
+ * @public
742
+ */
743
+ function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeatOptions) {
744
+ const templateBinding = typeof templateOrTemplateBinding === "function"
745
+ ? templateOrTemplateBinding
746
+ : () => templateOrTemplateBinding;
747
+ return new RepeatDirective(itemsBinding, templateBinding, options);
748
+ }
749
+
750
+ /**
751
+ * Tests whether or not an object is an array.
752
+ *
753
+ * @private
754
+ * @param {*} val The object to test.
755
+ * @return {Boolean} `true` if `val` is an array, `false` otherwise.
756
+ * @example
757
+ *
758
+ * _isArray([]); //=> true
759
+ * _isArray(null); //=> false
760
+ * _isArray({}); //=> false
761
+ */
762
+ var _isArray = Array.isArray || function _isArray(val) {
763
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
764
+ };
765
+
766
+ function _isString(x) {
767
+ return Object.prototype.toString.call(x) === '[object String]';
768
+ }
769
+
770
+ var toString = Object.prototype.toString;
771
+
772
+ var _isArguments =
773
+ /*#__PURE__*/
774
+ function () {
775
+ return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
776
+ return toString.call(x) === '[object Arguments]';
777
+ } : function _isArguments(x) {
778
+ return _has('callee', x);
779
+ };
780
+ }();
781
+
782
+ var _isArguments$1 = _isArguments;
783
+
784
+ var hasEnumBug = !
785
+ /*#__PURE__*/
786
+ {
787
+ toString: null
788
+ }.propertyIsEnumerable('toString');
789
+ var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug
790
+
791
+ var hasArgsEnumBug =
792
+ /*#__PURE__*/
793
+ function () {
794
+
795
+ return arguments.propertyIsEnumerable('length');
796
+ }();
797
+
798
+ var contains = function contains(list, item) {
799
+ var idx = 0;
800
+
801
+ while (idx < list.length) {
802
+ if (list[idx] === item) {
803
+ return true;
804
+ }
805
+
806
+ idx += 1;
807
+ }
808
+
809
+ return false;
810
+ };
811
+ /**
812
+ * Returns a list containing the names of all the enumerable own properties of
813
+ * the supplied object.
814
+ * Note that the order of the output array is not guaranteed to be consistent
815
+ * across different JS platforms.
816
+ *
817
+ * @func
818
+ * @memberOf R
819
+ * @since v0.1.0
820
+ * @category Object
821
+ * @sig {k: v} -> [k]
822
+ * @param {Object} obj The object to extract properties from
823
+ * @return {Array} An array of the object's own properties.
824
+ * @see R.keysIn, R.values
825
+ * @example
826
+ *
827
+ * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
828
+ */
829
+
830
+
831
+ var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ?
832
+ /*#__PURE__*/
833
+ _curry1(function keys(obj) {
834
+ return Object(obj) !== obj ? [] : Object.keys(obj);
835
+ }) :
836
+ /*#__PURE__*/
837
+ _curry1(function keys(obj) {
838
+ if (Object(obj) !== obj) {
839
+ return [];
840
+ }
841
+
842
+ var prop, nIdx;
843
+ var ks = [];
844
+
845
+ var checkArgsLength = hasArgsEnumBug && _isArguments$1(obj);
846
+
847
+ for (prop in obj) {
848
+ if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
849
+ ks[ks.length] = prop;
850
+ }
851
+ }
852
+
853
+ if (hasEnumBug) {
854
+ nIdx = nonEnumerableProps.length - 1;
855
+
856
+ while (nIdx >= 0) {
857
+ prop = nonEnumerableProps[nIdx];
858
+
859
+ if (_has(prop, obj) && !contains(ks, prop)) {
860
+ ks[ks.length] = prop;
861
+ }
862
+
863
+ nIdx -= 1;
864
+ }
865
+ }
866
+
867
+ return ks;
868
+ });
869
+ var keys$1 = keys;
870
+
871
+ /**
872
+ * Gives a single-word string description of the (native) type of a value,
873
+ * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
874
+ * attempt to distinguish user Object types any further, reporting them all as
875
+ * 'Object'.
876
+ *
877
+ * @func
878
+ * @memberOf R
879
+ * @since v0.8.0
880
+ * @category Type
881
+ * @sig (* -> {*}) -> String
882
+ * @param {*} val The value to test
883
+ * @return {String}
884
+ * @example
885
+ *
886
+ * R.type({}); //=> "Object"
887
+ * R.type(1); //=> "Number"
888
+ * R.type(false); //=> "Boolean"
889
+ * R.type('s'); //=> "String"
890
+ * R.type(null); //=> "Null"
891
+ * R.type([]); //=> "Array"
892
+ * R.type(/[A-z]/); //=> "RegExp"
893
+ * R.type(() => {}); //=> "Function"
894
+ * R.type(undefined); //=> "Undefined"
895
+ */
896
+
897
+ var type =
898
+ /*#__PURE__*/
899
+ _curry1(function type(val) {
900
+ return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
901
+ });
902
+
903
+ var type$1 = type;
904
+
905
+ /**
906
+ * A function that returns the `!` of its argument. It will return `true` when
907
+ * passed false-y value, and `false` when passed a truth-y one.
908
+ *
909
+ * @func
910
+ * @memberOf R
911
+ * @since v0.1.0
912
+ * @category Logic
913
+ * @sig * -> Boolean
914
+ * @param {*} a any value
915
+ * @return {Boolean} the logical inverse of passed argument.
916
+ * @see R.complement
917
+ * @example
918
+ *
919
+ * R.not(true); //=> false
920
+ * R.not(false); //=> true
921
+ * R.not(0); //=> true
922
+ * R.not(1); //=> false
923
+ */
924
+
925
+ var not =
926
+ /*#__PURE__*/
927
+ _curry1(function not(a) {
928
+ return !a;
929
+ });
930
+
931
+ var not$1 = not;
932
+
933
+ function _arrayFromIterator(iter) {
934
+ var list = [];
935
+ var next;
936
+
937
+ while (!(next = iter.next()).done) {
938
+ list.push(next.value);
939
+ }
940
+
941
+ return list;
942
+ }
943
+
944
+ function _includesWith(pred, x, list) {
945
+ var idx = 0;
946
+ var len = list.length;
947
+
948
+ while (idx < len) {
949
+ if (pred(x, list[idx])) {
950
+ return true;
951
+ }
952
+
953
+ idx += 1;
954
+ }
955
+
956
+ return false;
957
+ }
958
+
959
+ function _functionName(f) {
960
+ // String(x => x) evaluates to "x => x", so the pattern may not match.
961
+ var match = String(f).match(/^function (\w*)/);
962
+ return match == null ? '' : match[1];
963
+ }
964
+
965
+ // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
966
+ function _objectIs(a, b) {
967
+ // SameValue algorithm
968
+ if (a === b) {
969
+ // Steps 1-5, 7-10
970
+ // Steps 6.b-6.e: +0 != -0
971
+ return a !== 0 || 1 / a === 1 / b;
972
+ } else {
973
+ // Step 6.a: NaN == NaN
974
+ return a !== a && b !== b;
975
+ }
976
+ }
977
+
978
+ var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
979
+
980
+ /**
981
+ * private _uniqContentEquals function.
982
+ * That function is checking equality of 2 iterator contents with 2 assumptions
983
+ * - iterators lengths are the same
984
+ * - iterators values are unique
985
+ *
986
+ * false-positive result will be returned for comparision of, e.g.
987
+ * - [1,2,3] and [1,2,3,4]
988
+ * - [1,1,1] and [1,2,3]
989
+ * */
990
+
991
+ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
992
+ var a = _arrayFromIterator(aIterator);
993
+
994
+ var b = _arrayFromIterator(bIterator);
995
+
996
+ function eq(_a, _b) {
997
+ return _equals(_a, _b, stackA.slice(), stackB.slice());
998
+ } // if *a* array contains any element that is not included in *b*
999
+
1000
+
1001
+ return !_includesWith(function (b, aItem) {
1002
+ return !_includesWith(eq, aItem, b);
1003
+ }, b, a);
1004
+ }
1005
+
1006
+ function _equals(a, b, stackA, stackB) {
1007
+ if (_objectIs$1(a, b)) {
1008
+ return true;
1009
+ }
1010
+
1011
+ var typeA = type$1(a);
1012
+
1013
+ if (typeA !== type$1(b)) {
1014
+ return false;
1015
+ }
1016
+
1017
+ if (a == null || b == null) {
1018
+ return false;
1019
+ }
1020
+
1021
+ if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
1022
+ return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
1023
+ }
1024
+
1025
+ if (typeof a.equals === 'function' || typeof b.equals === 'function') {
1026
+ return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
1027
+ }
1028
+
1029
+ switch (typeA) {
1030
+ case 'Arguments':
1031
+ case 'Array':
1032
+ case 'Object':
1033
+ if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
1034
+ return a === b;
1035
+ }
1036
+
1037
+ break;
1038
+
1039
+ case 'Boolean':
1040
+ case 'Number':
1041
+ case 'String':
1042
+ if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
1043
+ return false;
1044
+ }
1045
+
1046
+ break;
1047
+
1048
+ case 'Date':
1049
+ if (!_objectIs$1(a.valueOf(), b.valueOf())) {
1050
+ return false;
1051
+ }
1052
+
1053
+ break;
1054
+
1055
+ case 'Error':
1056
+ return a.name === b.name && a.message === b.message;
1057
+
1058
+ case 'RegExp':
1059
+ if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
1060
+ return false;
1061
+ }
1062
+
1063
+ break;
1064
+ }
1065
+
1066
+ var idx = stackA.length - 1;
1067
+
1068
+ while (idx >= 0) {
1069
+ if (stackA[idx] === a) {
1070
+ return stackB[idx] === b;
1071
+ }
1072
+
1073
+ idx -= 1;
1074
+ }
1075
+
1076
+ switch (typeA) {
1077
+ case 'Map':
1078
+ if (a.size !== b.size) {
1079
+ return false;
1080
+ }
1081
+
1082
+ return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
1083
+
1084
+ case 'Set':
1085
+ if (a.size !== b.size) {
1086
+ return false;
1087
+ }
1088
+
1089
+ return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
1090
+
1091
+ case 'Arguments':
1092
+ case 'Array':
1093
+ case 'Object':
1094
+ case 'Boolean':
1095
+ case 'Number':
1096
+ case 'String':
1097
+ case 'Date':
1098
+ case 'Error':
1099
+ case 'RegExp':
1100
+ case 'Int8Array':
1101
+ case 'Uint8Array':
1102
+ case 'Uint8ClampedArray':
1103
+ case 'Int16Array':
1104
+ case 'Uint16Array':
1105
+ case 'Int32Array':
1106
+ case 'Uint32Array':
1107
+ case 'Float32Array':
1108
+ case 'Float64Array':
1109
+ case 'ArrayBuffer':
1110
+ break;
1111
+
1112
+ default:
1113
+ // Values of other types are only equal if identical.
1114
+ return false;
1115
+ }
1116
+
1117
+ var keysA = keys$1(a);
1118
+
1119
+ if (keysA.length !== keys$1(b).length) {
1120
+ return false;
1121
+ }
1122
+
1123
+ var extendedStackA = stackA.concat([a]);
1124
+ var extendedStackB = stackB.concat([b]);
1125
+ idx = keysA.length - 1;
1126
+
1127
+ while (idx >= 0) {
1128
+ var key = keysA[idx];
1129
+
1130
+ if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
1131
+ return false;
1132
+ }
1133
+
1134
+ idx -= 1;
1135
+ }
1136
+
1137
+ return true;
1138
+ }
1139
+
1140
+ /**
1141
+ * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
1142
+ * cyclical data structures.
1143
+ *
1144
+ * Dispatches symmetrically to the `equals` methods of both arguments, if
1145
+ * present.
1146
+ *
1147
+ * @func
1148
+ * @memberOf R
1149
+ * @since v0.15.0
1150
+ * @category Relation
1151
+ * @sig a -> b -> Boolean
1152
+ * @param {*} a
1153
+ * @param {*} b
1154
+ * @return {Boolean}
1155
+ * @example
1156
+ *
1157
+ * R.equals(1, 1); //=> true
1158
+ * R.equals(1, '1'); //=> false
1159
+ * R.equals([1, 2, 3], [1, 2, 3]); //=> true
1160
+ *
1161
+ * const a = {}; a.v = a;
1162
+ * const b = {}; b.v = b;
1163
+ * R.equals(a, b); //=> true
1164
+ */
1165
+
1166
+ var equals =
1167
+ /*#__PURE__*/
1168
+ _curry2(function equals(a, b) {
1169
+ return _equals(a, b, [], []);
1170
+ });
1171
+
1172
+ var equals$1 = equals;
1173
+
1174
+ function _isObject(x) {
1175
+ return Object.prototype.toString.call(x) === '[object Object]';
1176
+ }
1177
+
1178
+ /**
1179
+ * Returns the empty value of its argument's type. Ramda defines the empty
1180
+ * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other
1181
+ * types are supported if they define `<Type>.empty`,
1182
+ * `<Type>.prototype.empty` or implement the
1183
+ * [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid).
1184
+ *
1185
+ * Dispatches to the `empty` method of the first argument, if present.
1186
+ *
1187
+ * @func
1188
+ * @memberOf R
1189
+ * @since v0.3.0
1190
+ * @category Function
1191
+ * @sig a -> a
1192
+ * @param {*} x
1193
+ * @return {*}
1194
+ * @example
1195
+ *
1196
+ * R.empty(Just(42)); //=> Nothing()
1197
+ * R.empty([1, 2, 3]); //=> []
1198
+ * R.empty('unicorns'); //=> ''
1199
+ * R.empty({x: 1, y: 2}); //=> {}
1200
+ */
1201
+
1202
+ var empty =
1203
+ /*#__PURE__*/
1204
+ _curry1(function empty(x) {
1205
+ return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments$1(x) ? function () {
1206
+ return arguments;
1207
+ }() : void 0 // else
1208
+ ;
1209
+ });
1210
+
1211
+ var empty$1 = empty;
1212
+
1213
+ /**
1214
+ * Returns `true` if the given value is its type's empty value; `false`
1215
+ * otherwise.
1216
+ *
1217
+ * @func
1218
+ * @memberOf R
1219
+ * @since v0.1.0
1220
+ * @category Logic
1221
+ * @sig a -> Boolean
1222
+ * @param {*} x
1223
+ * @return {Boolean}
1224
+ * @see R.empty
1225
+ * @example
1226
+ *
1227
+ * R.isEmpty([1, 2, 3]); //=> false
1228
+ * R.isEmpty([]); //=> true
1229
+ * R.isEmpty(''); //=> true
1230
+ * R.isEmpty(null); //=> false
1231
+ * R.isEmpty({}); //=> true
1232
+ * R.isEmpty({length: 0}); //=> false
1233
+ */
1234
+
1235
+ var isEmpty =
1236
+ /*#__PURE__*/
1237
+ _curry1(function isEmpty(x) {
1238
+ return x != null && equals$1(x, empty$1(x));
1239
+ });
1240
+
1241
+ var isEmpty$1 = isEmpty;
1242
+
1243
+ var css_248z = "/*\n Do not edit directly\n Generated on Wed, 27 Apr 2022 11:58:36 GMT\n*/\nol {\n padding: 0;\n margin: 0;\n list-style: none;\n}\n\n[role=grid i] {\n position: relative;\n z-index: 0;\n display: grid;\n margin: auto;\n grid-template-areas: \". column-headers\" \"row-headers calendar\";\n grid-template-columns: min-content auto;\n inline-size: max(100%, 500px);\n min-inline-size: 880px;\n}\n\n.row-headers {\n display: grid;\n grid-area: row-headers;\n grid-template-rows: repeat(24, 1fr);\n margin-inline-end: 2px;\n}\n.row-headers > [role=rowheader i] {\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n}\n.row-headers > [role=rowheader i] > time {\n font: 400 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n font-size: small;\n line-height: 1;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.calendar-row {\n display: contents;\n}\n\n.calendar-grid-presentation {\n display: grid;\n overflow: hidden;\n background-color: var(--vvd-color-surface-2dp);\n border-radius: 6px;\n counter-reset: listing;\n filter: var(--vvd-shadow-surface-2dp);\n gap: 1px;\n grid-area: calendar;\n grid-auto-flow: column;\n grid-template: repeat(24, 1fr)/repeat(7, 1fr);\n}\n\n.hours {\n display: contents;\n}\n.hours > [role=listitem i] {\n position: relative;\n grid-column: 1/8;\n grid-row: var(--row);\n min-block-size: 48px;\n pointer-events: none;\n}\n.hours > [role=listitem i]:not(:first-child)::after {\n position: absolute;\n border-block-end: var(--vvd-color-neutral-20) 1px solid;\n content: \"\";\n inline-size: 100%;\n margin-block-start: -1px;\n}\n.hours > [role=listitem i]:nth-child(24n+1) {\n --row: 1;\n}\n.hours > [role=listitem i]:nth-child(24n+2) {\n --row: 2;\n}\n.hours > [role=listitem i]:nth-child(24n+3) {\n --row: 3;\n}\n.hours > [role=listitem i]:nth-child(24n+4) {\n --row: 4;\n}\n.hours > [role=listitem i]:nth-child(24n+5) {\n --row: 5;\n}\n.hours > [role=listitem i]:nth-child(24n+6) {\n --row: 6;\n}\n.hours > [role=listitem i]:nth-child(24n+7) {\n --row: 7;\n}\n.hours > [role=listitem i]:nth-child(24n+8) {\n --row: 8;\n}\n.hours > [role=listitem i]:nth-child(24n+9) {\n --row: 9;\n}\n.hours > [role=listitem i]:nth-child(24n+10) {\n --row: 10;\n}\n.hours > [role=listitem i]:nth-child(24n+11) {\n --row: 11;\n}\n.hours > [role=listitem i]:nth-child(24n+12) {\n --row: 12;\n}\n.hours > [role=listitem i]:nth-child(24n+13) {\n --row: 13;\n}\n.hours > [role=listitem i]:nth-child(24n+14) {\n --row: 14;\n}\n.hours > [role=listitem i]:nth-child(24n+15) {\n --row: 15;\n}\n.hours > [role=listitem i]:nth-child(24n+16) {\n --row: 16;\n}\n.hours > [role=listitem i]:nth-child(24n+17) {\n --row: 17;\n}\n.hours > [role=listitem i]:nth-child(24n+18) {\n --row: 18;\n}\n.hours > [role=listitem i]:nth-child(24n+19) {\n --row: 19;\n}\n.hours > [role=listitem i]:nth-child(24n+20) {\n --row: 20;\n}\n.hours > [role=listitem i]:nth-child(24n+21) {\n --row: 21;\n}\n.hours > [role=listitem i]:nth-child(24n+22) {\n --row: 22;\n}\n.hours > [role=listitem i]:nth-child(24n+23) {\n --row: 23;\n}\n.hours > [role=listitem i]:nth-child(24n+24) {\n --row: 24;\n}\n\n[role=gridcell i] {\n display: grid;\n gap: 1px;\n grid-auto-flow: column;\n}\n\n[role=gridcell i],\n[role=columnheader i],\n[role=columnheader i] [role=button i] {\n position: relative;\n}\n[role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n position: absolute;\n z-index: -1;\n background-color: var(--vvd-color-info-10);\n content: \"\";\n}\n@supports (inset: 0) {\n [role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n inset: 0;\n }\n}\n@supports not (inset: 0) {\n [role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n[role=gridcell i]:focus,\n[role=columnheader i]:focus,\n[role=columnheader i] [role=button i]:focus {\n outline: none;\n}\n[role=gridcell i]:not(:focus)::before,\n[role=columnheader i]:not(:focus)::before,\n[role=columnheader i] [role=button i]:not(:focus)::before {\n display: none;\n}\n\n.columns {\n display: contents;\n}\n.columns > [role=gridcell i] {\n position: relative;\n grid-column: var(--column);\n grid-row: 1/25;\n}\n.columns > [role=gridcell i]:nth-child(1) {\n --column: 1;\n}\n.columns > [role=gridcell i]:nth-child(2) {\n --column: 2;\n}\n.columns > [role=gridcell i]:nth-child(3) {\n --column: 3;\n}\n.columns > [role=gridcell i]:nth-child(4) {\n --column: 4;\n}\n.columns > [role=gridcell i]:nth-child(5) {\n --column: 5;\n}\n.columns > [role=gridcell i]:nth-child(6) {\n --column: 6;\n}\n.columns > [role=gridcell i]:nth-child(7) {\n --column: 7;\n}\n.columns > [role=gridcell i]:not(:first-child)::after {\n position: absolute;\n block-size: 100%;\n border-inline-end: var(--vvd-color-neutral-20) 1px solid;\n content: \"\";\n margin-inline-start: -1px;\n}\n\n.column-headers {\n display: grid;\n grid-area: column-headers;\n grid-template-columns: repeat(7, 1fr);\n}\n.column-headers [role=columnheader i] h2 {\n font: 500 condensed 20px / 28px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: grid;\n align-items: baseline;\n margin: 0;\n grid-template-columns: 1fr auto 1fr;\n}\n.column-headers [role=columnheader i] h2 > em {\n font: inherit;\n inline-size: min-content;\n}\n@supports (inset: 0) {\n .column-headers [role=columnheader i] h2 > em {\n inset-inline-start: 0;\n }\n}\n@supports not (inset: 0) {\n .column-headers [role=columnheader i] h2 > em {\n left: 0;\n }\n}\n.column-headers [role=columnheader i] h2 > small {\n font: 400 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n text-transform: uppercase;\n}";
1244
+ styleInject(css_248z);
1245
+
1246
+ const ARROW_UP = 'ArrowUp';
1247
+ const ARROW_RIGHT = 'ArrowRight';
1248
+ const ARROW_DOWN = 'ArrowDown';
1249
+ const ARROW_LEFT = 'ArrowLeft';
1250
+ function isCellOrHeader(el) {
1251
+ return el instanceof HTMLElement && (el.matches('[role="gridcell"i]') || el.matches('[role="columnheader"i]'));
1252
+ }
1253
+
1254
+ const getCellOrHeader = f => f.matches('[role="columnheader"i]') ? '[role="gridcell"i]' : '[role="columnheader"i]';
1255
+
1256
+ function getNextFocusableGridElement(key, activeElement) {
1257
+ if (activeElement.parentNode instanceof HTMLElement) {
1258
+ switch (key) {
1259
+ case ARROW_RIGHT:
1260
+ return activeElement.nextElementSibling || activeElement.parentNode.firstElementChild;
1261
+
1262
+ case ARROW_LEFT:
1263
+ return activeElement.previousElementSibling || activeElement.parentNode.lastElementChild;
1264
+
1265
+ case ARROW_UP:
1266
+ case ARROW_DOWN:
1267
+ {
1268
+ const {
1269
+ children
1270
+ } = activeElement.parentNode;
1271
+ const i = Array.from(children).indexOf(activeElement);
1272
+ return this.shadowRoot.querySelector(`${getCellOrHeader(activeElement)}:nth-child(${i + 1})`);
1273
+ }
1274
+ }
1275
+ }
1276
+ }
1277
+ function getHeaderDescendantGridCell(key, activeElement) {
1278
+ if (key !== ARROW_DOWN) {
1279
+ return;
1280
+ }
1281
+
1282
+ const header = activeElement.closest('[role="columnheader"i]');
1283
+ const columnHeaders = this.shadowRoot.querySelectorAll('[role="columnheader"i]');
1284
+ const i = Array.from(columnHeaders).indexOf(header);
1285
+ return this.shadowRoot.querySelector(`[role="gridcell"i]:nth-child(${i + 1})`);
1286
+ }
1287
+
1288
+ function getDay(el) {
1289
+ const cellOrHeader = el.closest('[role="gridcell"i], [role="columnheader"i]');
1290
+
1291
+ if (cellOrHeader) {
1292
+ const {
1293
+ parentElement
1294
+ } = cellOrHeader;
1295
+
1296
+ if (parentElement) {
1297
+ return parentElement.children && Array.from(parentElement.children).indexOf(cellOrHeader);
1298
+ }
1299
+ }
1300
+ }
1301
+
1302
+ function getHour(e, el, hours) {
1303
+ const rowHeaderOrCell = el.closest('[role="rowheader"], [role="gridcell"i]');
1304
+
1305
+ if (rowHeaderOrCell) {
1306
+ const DOMRect = rowHeaderOrCell.getBoundingClientRect();
1307
+ const offsetY = e.clientY - DOMRect.y;
1308
+ const hourHeight = DOMRect.height / hours;
1309
+ const hour = offsetY / hourHeight;
1310
+ return Math.round((hour + Number.EPSILON) * 100) / 100;
1311
+ }
1312
+ }
1313
+
1314
+ const getEventContext = function getEventContext(e) {
1315
+ if (!(e instanceof KeyboardEvent || e instanceof MouseEvent)) {
1316
+ throw new Error('Invalid event. Event must be instance of KeyboardEvent or MouseEvent');
1317
+ }
1318
+
1319
+ const [el] = e.composedPath();
1320
+
1321
+ if (!(el && el instanceof HTMLElement && this.shadowRoot.contains(el))) {
1322
+ throw new Error('Invalid event. Event must contain a target object which is a direct descendant of calendar');
1323
+ }
1324
+
1325
+ const day = getDay(el);
1326
+ let hour;
1327
+
1328
+ if (e instanceof MouseEvent) {
1329
+ hour = getHour(e, el, this._hours);
1330
+ }
1331
+
1332
+ const context = Object.assign(Object.assign({}, day != undefined && {
1333
+ day
1334
+ }), hour != undefined && {
1335
+ hour
1336
+ });
1337
+ return not$1(isEmpty$1(context)) ? context : null;
1338
+ };
1339
+
1340
+ class Calendar extends FoundationElement {
1341
+ constructor() {
1342
+ super(...arguments);
1343
+ this.hour12 = false;
1344
+ this._hours = 24;
1345
+ this._days = 7;
1346
+ this.hoursAsDatetime = Array.from({
1347
+ length: this._hours - 1
1348
+ }).fill(new Date(new Date().setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(++i)));
1349
+
1350
+ this._generateDaysArr = dateArr => {
1351
+ if (dateArr.length == this._days) {
1352
+ return dateArr;
1353
+ }
1354
+
1355
+ const lastDate = new Date(dateArr[dateArr.length - 1]);
1356
+ lastDate.setDate(lastDate.getDate() + 1);
1357
+ return this._generateDaysArr([...dateArr, lastDate]);
1358
+ };
1359
+
1360
+ this.getEventContext = getEventContext;
1361
+ }
1362
+
1363
+ arrowKeysInteractions(key) {
1364
+ const activeElement = this.shadowRoot.activeElement;
1365
+ let focusNext;
1366
+
1367
+ if (isCellOrHeader(activeElement)) {
1368
+ focusNext = getNextFocusableGridElement.call(this, key, activeElement);
1369
+ } else if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('em[role="button"i]')) {
1370
+ focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
1371
+ } else {
1372
+ focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
1373
+ }
1374
+
1375
+ this.moveTo(focusNext);
1376
+ }
1377
+
1378
+ moveTo(el) {
1379
+ const onBlur = ({
1380
+ target
1381
+ }) => target.setAttribute('tabindex', '-1');
1382
+
1383
+ el === null || el === void 0 ? void 0 : el.addEventListener('blur', onBlur, {
1384
+ once: true
1385
+ });
1386
+ el === null || el === void 0 ? void 0 : el.setAttribute('tabindex', '0');
1387
+ el === null || el === void 0 ? void 0 : el.focus();
1388
+ }
1389
+
1390
+ onKeydown({
1391
+ key
1392
+ }) {
1393
+ const isArrow = [ARROW_UP, ARROW_RIGHT, ARROW_DOWN, ARROW_LEFT].some(predefinedKey => predefinedKey == key);
1394
+
1395
+ if (isArrow) {
1396
+ this.arrowKeysInteractions(key);
1397
+ }
1398
+
1399
+ return !isArrow;
1400
+ }
1401
+
1402
+ }
1403
+
1404
+ __decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "datetime", void 0);
1405
+
1406
+ __decorate([attr({
1407
+ attribute: 'start-day'
1408
+ }), __metadata("design:type", String)], Calendar.prototype, "startDay", void 0);
1409
+
1410
+ __decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "locales", void 0);
1411
+
1412
+ __decorate([attr({
1413
+ mode: 'boolean'
1414
+ }), __metadata("design:type", Object)], Calendar.prototype, "hour12", void 0);
1415
+
1416
+ function getValidDateString(date) {
1417
+ const twoDigit = num => `0${num}`.slice(-2);
1418
+
1419
+ return `${date.getFullYear()}-${twoDigit(date.getMonth() + 1)}-${twoDigit(date.getDate())}`;
1420
+ }
1421
+ const weekdaysMap = new Map([['sunday', 0], ['monday', 1]]);
1422
+ function getFirstDateOfTheWeek(date = new Date(), startDay) {
1423
+ date = new Date(date);
1424
+ let num = weekdaysMap.get(startDay);
1425
+ num !== null && num !== void 0 ? num : num = 1;
1426
+ const day = date.getDate() - (date.getDay() + 7 - num) % 7;
1427
+ return new Date(date.setDate(day));
1428
+ }
1429
+
1430
+ let _2 = t => t,
1431
+ _t,
1432
+ _t2,
1433
+ _t3,
1434
+ _t4,
1435
+ _t5,
1436
+ _t6,
1437
+ _t7;
1438
+
1439
+ const HoursTemplate = () => {
1440
+ return html(_t || (_t = _2`
1441
+ <div class="row-headers" role="presentation">
1442
+ ${0}
1443
+ </div>`), repeat(x => x.hoursAsDatetime, html(_t2 || (_t2 = _2`<span role="rowheader">
1444
+ <time datetime="${0}">
1445
+ ${0}
1446
+ </time>
1447
+ </span>`), (x, c) => new Intl.DateTimeFormat(c.parent.locales, {
1448
+ hour: 'numeric',
1449
+ minute: 'numeric',
1450
+ hour12: false
1451
+ }).format(x), (x, c) => new Intl.DateTimeFormat(c.parent.locales, {
1452
+ hour: 'numeric',
1453
+ hour12: c.parent.hour12
1454
+ }).format(x))));
1455
+ };
1456
+
1457
+ const DaysTemplate = () => {
1458
+ return html(_t3 || (_t3 = _2`
1459
+ <div class="column-headers" role="row">
1460
+ ${0}
1461
+ </div>`), repeat(x => x._generateDaysArr([getFirstDateOfTheWeek(x.datetime, x.startDay)]), html(_t4 || (_t4 = _2`
1462
+ <div role="columnheader" tabindex="-1">
1463
+ <time datetime=${0}>
1464
+ <h2>
1465
+ <!-- TODO add to column aria-labelledby or describedby to count
1466
+ events and related day e.g. "3 events, Sunday, March 8" -->
1467
+ <em tabindex="0" role="button" aria-label=${0}>
1468
+ ${0}
1469
+ </em>
1470
+ <small aria-hidden="true">
1471
+ ${0}
1472
+ </small>
1473
+ </h2>
1474
+ </time>
1475
+ </div>`), x => getValidDateString(x), (x, c) => new Intl.DateTimeFormat(c.parent.locales, {
1476
+ weekday: 'long',
1477
+ month: 'long',
1478
+ day: 'numeric'
1479
+ }).format(x), (x, c) => new Intl.DateTimeFormat(c.parent.locales, {
1480
+ day: '2-digit'
1481
+ }).format(x), (x, c) => new Intl.DateTimeFormat(c.parent.locales, {
1482
+ weekday: 'short'
1483
+ }).format(x))));
1484
+ };
1485
+
1486
+ const ColumnTemplate = html(_t5 || (_t5 = _2`
1487
+ <div role="gridcell" tabindex="-1">
1488
+ <slot name="day-${0}"></slot>
1489
+ </div>
1490
+ `), (_, c) => c.index);
1491
+ const CalendarTemplate = () => html(_t6 || (_t6 = _2`
1492
+ <div role="grid" @keydown=${0}>
1493
+ ${0}
1494
+ <div role="row" class="calendar-row">
1495
+ ${0}
1496
+ <div class="calendar-grid-presentation" role="presentation">
1497
+ <div class="hours" role="list">
1498
+ ${0}
1499
+ </div>
1500
+ <div class="columns" role="presentation">
1501
+ ${0}
1502
+ </div>
1503
+ <slot></slot>
1504
+ </div>
1505
+ </div>
1506
+ </div>
1507
+ `), (x, c) => x.onKeydown(c.event), DaysTemplate, HoursTemplate, repeat(x => Array.from({
1508
+ length: x.hoursAsDatetime.length + 1
1509
+ }), html(_t7 || (_t7 = _2`
1510
+ <div role="listitem"></div>`))), repeat(x => Array.from(Array(x._days)), ColumnTemplate, {
1511
+ positioning: true
1512
+ }));
1513
+
1514
+ const vividCalendar = Calendar.compose({
1515
+ baseName: 'calendar',
1516
+ template: CalendarTemplate,
1517
+ styles: css_248z
1518
+ });
1519
+ designSystem.register(vividCalendar());
1520
+
1521
+ export { vividCalendar };