@salesforcedevs/arch-components 1.20.17-alpha1

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 (363) hide show
  1. package/lwc.config.json +7 -0
  2. package/package.json +19 -0
  3. package/src/modules/common/context/context.html +1 -0
  4. package/src/modules/common/context/context.ts +137 -0
  5. package/src/modules/common/effectAdapter/__tests__/effectAdapter.test.ts +12 -0
  6. package/src/modules/common/effectAdapter/effectAdapter.html +1 -0
  7. package/src/modules/common/effectAdapter/effectAdapter.ts +18 -0
  8. package/src/modules/common/reflectedElement/__tests__/modules/test/select/select.html +3 -0
  9. package/src/modules/common/reflectedElement/__tests__/modules/test/select/select.ts +7 -0
  10. package/src/modules/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.html +3 -0
  11. package/src/modules/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.ts +18 -0
  12. package/src/modules/common/reflectedElement/__tests__/reflectedElement.test.ts +75 -0
  13. package/src/modules/common/reflectedElement/reflectedElement.ts +50 -0
  14. package/src/modules/common/slot/__tests__/slot.test.ts +96 -0
  15. package/src/modules/common/slot/slot.ts +20 -0
  16. package/src/modules/sa/coverage/coverage.css +35 -0
  17. package/src/modules/sa/coverage/coverage.html +15 -0
  18. package/src/modules/sa/coverage/coverage.ts +406 -0
  19. package/src/modules/sa/coverage/types.d.ts +26 -0
  20. package/src/modules/sa/expandableSection/expandableSection.css +24 -0
  21. package/src/modules/sa/expandableSection/expandableSection.html +20 -0
  22. package/src/modules/sa/expandableSection/expandableSection.stories.ts +37 -0
  23. package/src/modules/sa/expandableSection/expandableSection.ts +24 -0
  24. package/src/modules/sa/explorer/explorer.css +303 -0
  25. package/src/modules/sa/explorer/explorer.html +403 -0
  26. package/src/modules/sa/explorer/explorer.ts +664 -0
  27. package/src/modules/sa/explorer/types.d.ts +60 -0
  28. package/src/modules/sa/gallery/gallery.css +358 -0
  29. package/src/modules/sa/gallery/gallery.html +65 -0
  30. package/src/modules/sa/gallery/gallery.ts +300 -0
  31. package/src/modules/sa/gallery/types.d.ts +35 -0
  32. package/src/modules/sa/socialShare/socialShare.css +49 -0
  33. package/src/modules/sa/socialShare/socialShare.html +56 -0
  34. package/src/modules/sa/socialShare/socialShare.ts +29 -0
  35. package/src/modules/shared/a11y/a11y.ts +25 -0
  36. package/src/modules/shared/children/children.ts +29 -0
  37. package/src/modules/shared/color/color.ts +52 -0
  38. package/src/modules/shared/debounce/debounce.ts +32 -0
  39. package/src/modules/shared/dialog/dialog.ts +154 -0
  40. package/src/modules/shared/elements/__tests__/overflow.test.ts +39 -0
  41. package/src/modules/shared/elements/overflow.ts +71 -0
  42. package/src/modules/shared/fetch/fetch.ts +52 -0
  43. package/src/modules/shared/helpers/helpers.ts +141 -0
  44. package/src/modules/shared/i18n/i18n.ts +74 -0
  45. package/src/modules/shared/labels/__tests__/helpers.test.ts +107 -0
  46. package/src/modules/shared/labels/__tests__/pointHelpers.test.ts +33 -0
  47. package/src/modules/shared/labels/__tests__/timeHelpers.test.ts +89 -0
  48. package/src/modules/shared/labels/helpers.ts +23 -0
  49. package/src/modules/shared/labels/pointHelpers.ts +47 -0
  50. package/src/modules/shared/labels/timeHelpers.ts +182 -0
  51. package/src/modules/shared/labels/types.d.ts +5 -0
  52. package/src/modules/shared/logger/logger.ts +33 -0
  53. package/src/modules/shared/menu/menu.ts +239 -0
  54. package/src/modules/shared/overflow/__tests__/overflow.test.ts +39 -0
  55. package/src/modules/shared/overflow/overflow.ts +71 -0
  56. package/src/modules/shared/polling-request.ts +97 -0
  57. package/src/modules/shared/testutils.ts +118 -0
  58. package/src/modules/shared/track/track.ts +23 -0
  59. package/src/modules/shared/trailhead.ts +123 -0
  60. package/src/modules/shared/types.d.ts +1 -0
  61. package/src/modules/shared/useEffectAttr.ts +16 -0
  62. package/src/modules/shared/withState.ts +21 -0
  63. package/src/modules/tds/appLauncher/__fixtures__/index.ts +34 -0
  64. package/src/modules/tds/appLauncher/__tests__/appLauncher.test.ts +119 -0
  65. package/src/modules/tds/appLauncher/appLauncher.css +65 -0
  66. package/src/modules/tds/appLauncher/appLauncher.html +38 -0
  67. package/src/modules/tds/appLauncher/appLauncher.stories.ts +39 -0
  68. package/src/modules/tds/appLauncher/appLauncher.ts +79 -0
  69. package/src/modules/tds/appLauncher/types.ts +8 -0
  70. package/src/modules/tds/avatar/__tests__/avatar.test.ts +11 -0
  71. package/src/modules/tds/avatar/avatar.css +77 -0
  72. package/src/modules/tds/avatar/avatar.html +36 -0
  73. package/src/modules/tds/avatar/avatar.stories.ts +64 -0
  74. package/src/modules/tds/avatar/avatar.ts +50 -0
  75. package/src/modules/tds/badge/__tests__/badge.test.js +11 -0
  76. package/src/modules/tds/badge/badge.css +22 -0
  77. package/src/modules/tds/badge/badge.html +5 -0
  78. package/src/modules/tds/badge/badge.stories.ts +10 -0
  79. package/src/modules/tds/badge/badge.ts +9 -0
  80. package/src/modules/tds/button/__tests__/button.test.ts +52 -0
  81. package/src/modules/tds/button/button.css +1 -0
  82. package/src/modules/tds/button/button.html +20 -0
  83. package/src/modules/tds/button/button.stories.js +54 -0
  84. package/src/modules/tds/button/button.ts +59 -0
  85. package/src/modules/tds/buttonIcon/__tests__/buttonIcon.test.ts +17 -0
  86. package/src/modules/tds/buttonIcon/buttonIcon.css +1 -0
  87. package/src/modules/tds/buttonIcon/buttonIcon.html +12 -0
  88. package/src/modules/tds/buttonIcon/buttonIcon.stories.js +38 -0
  89. package/src/modules/tds/buttonIcon/buttonIcon.ts +6 -0
  90. package/src/modules/tds/buttonIconLink/buttonIconLink.css +1 -0
  91. package/src/modules/tds/buttonIconLink/buttonIconLink.html +14 -0
  92. package/src/modules/tds/buttonIconLink/buttonIconLink.stories.ts +32 -0
  93. package/src/modules/tds/buttonIconLink/buttonIconLink.ts +9 -0
  94. package/src/modules/tds/buttonLink/__tests__/buttonLink.test.ts +17 -0
  95. package/src/modules/tds/buttonLink/buttonLink.css +1 -0
  96. package/src/modules/tds/buttonLink/buttonLink.html +19 -0
  97. package/src/modules/tds/buttonLink/buttonLink.stories.js +24 -0
  98. package/src/modules/tds/buttonLink/buttonLink.ts +8 -0
  99. package/src/modules/tds/buttonStyles/buttonStyles.css +232 -0
  100. package/src/modules/tds/childSummary/__tests__/childSummary.test.js +99 -0
  101. package/src/modules/tds/childSummary/childSummary.css +74 -0
  102. package/src/modules/tds/childSummary/childSummary.html +38 -0
  103. package/src/modules/tds/childSummary/childSummary.stories.ts +40 -0
  104. package/src/modules/tds/childSummary/childSummary.ts +63 -0
  105. package/src/modules/tds/childSummary/types.d.ts +10 -0
  106. package/src/modules/tds/contentChildListItem/__tests__/contentChildListItem.test.ts +32 -0
  107. package/src/modules/tds/contentChildListItem/contentChildListItem.css +1 -0
  108. package/src/modules/tds/contentChildListItem/contentChildListItem.html +10 -0
  109. package/src/modules/tds/contentChildListItem/contentChildListItem.stories.ts +46 -0
  110. package/src/modules/tds/contentChildListItem/contentChildListItem.ts +34 -0
  111. package/src/modules/tds/contentIcon/contentIcon.css +47 -0
  112. package/src/modules/tds/contentIcon/contentIcon.html +15 -0
  113. package/src/modules/tds/contentIcon/contentIcon.stories.js +110 -0
  114. package/src/modules/tds/contentIcon/contentIcon.ts +66 -0
  115. package/src/modules/tds/contextAdapter/__tests__/contextAdapter.test.ts +76 -0
  116. package/src/modules/tds/contextAdapter/constants.ts +1 -0
  117. package/src/modules/tds/contextAdapter/contextAdapter.html +1 -0
  118. package/src/modules/tds/contextAdapter/contextAdapter.ts +54 -0
  119. package/src/modules/tds/dialogStyles/dialogStyles.css +90 -0
  120. package/src/modules/tds/footerLinks/__tests__/__snapshots__/footerLinks.test.ts.snap +3 -0
  121. package/src/modules/tds/footerLinks/__tests__/footerLinks.test.ts +142 -0
  122. package/src/modules/tds/footerLinks/footerLinks.css +80 -0
  123. package/src/modules/tds/footerLinks/footerLinks.html +30 -0
  124. package/src/modules/tds/footerLinks/footerLinks.ts +48 -0
  125. package/src/modules/tds/footerLinks/types.ts +11 -0
  126. package/src/modules/tds/footerMfe/footerMfe.html +3 -0
  127. package/src/modules/tds/footerMfe/footerMfe.ts +19 -0
  128. package/src/modules/tds/headerAvatar/__tests__/headerAvatar.test.ts +43 -0
  129. package/src/modules/tds/headerAvatar/headerAvatar.css +45 -0
  130. package/src/modules/tds/headerAvatar/headerAvatar.html +25 -0
  131. package/src/modules/tds/headerAvatar/headerAvatar.ts +15 -0
  132. package/src/modules/tds/headerHelpButton/__tests__/headerHelpButton.test.ts +32 -0
  133. package/src/modules/tds/headerHelpButton/headerHelpButton.css +14 -0
  134. package/src/modules/tds/headerHelpButton/headerHelpButton.html +19 -0
  135. package/src/modules/tds/headerHelpButton/headerHelpButton.ts +12 -0
  136. package/src/modules/tds/heading/__tests__/heading.test.ts +50 -0
  137. package/src/modules/tds/heading/heading.css +1 -0
  138. package/src/modules/tds/heading/heading.html +9 -0
  139. package/src/modules/tds/heading/heading.stories.ts +36 -0
  140. package/src/modules/tds/heading/heading.ts +36 -0
  141. package/src/modules/tds/icon/icon.css +28 -0
  142. package/src/modules/tds/icon/icon.html +17 -0
  143. package/src/modules/tds/icon/icon.stories.js +18 -0
  144. package/src/modules/tds/icon/icon.ts +79 -0
  145. package/src/modules/tds/input/__tests__/input.test.ts +41 -0
  146. package/src/modules/tds/input/input.css +34 -0
  147. package/src/modules/tds/input/input.html +12 -0
  148. package/src/modules/tds/input/input.stories.ts +25 -0
  149. package/src/modules/tds/input/input.ts +41 -0
  150. package/src/modules/tds/instrumentation/instrumentation.css +0 -0
  151. package/src/modules/tds/instrumentation/instrumentation.html +1 -0
  152. package/src/modules/tds/instrumentation/instrumentation.ts +113 -0
  153. package/src/modules/tds/pbCard/pbCard.css +28 -0
  154. package/src/modules/tds/pbCard/pbCard.html +21 -0
  155. package/src/modules/tds/pbCard/pbCard.ts +18 -0
  156. package/src/modules/tds/pill/__tests__/pill.test.ts +56 -0
  157. package/src/modules/tds/pill/pill.css +70 -0
  158. package/src/modules/tds/pill/pill.html +17 -0
  159. package/src/modules/tds/pill/pill.stories.ts +41 -0
  160. package/src/modules/tds/pill/pill.ts +34 -0
  161. package/src/modules/tds/progressBar/__tests__/progressBar.test.js +11 -0
  162. package/src/modules/tds/progressBar/progressBar.css +42 -0
  163. package/src/modules/tds/progressBar/progressBar.html +14 -0
  164. package/src/modules/tds/progressBar/progressBar.stories.ts +24 -0
  165. package/src/modules/tds/progressBar/progressBar.ts +14 -0
  166. package/src/modules/tds/radio/__tests__/radio.test.ts +29 -0
  167. package/src/modules/tds/radio/radio.css +89 -0
  168. package/src/modules/tds/radio/radio.html +17 -0
  169. package/src/modules/tds/radio/radio.stories.ts +31 -0
  170. package/src/modules/tds/radio/radio.ts +32 -0
  171. package/src/modules/tds/reset/reset.css +39 -0
  172. package/src/modules/tds/search/__fixtures__/index.ts +32 -0
  173. package/src/modules/tds/search/__tests__/search.test.ts +235 -0
  174. package/src/modules/tds/search/lib/__tests__/__snapshots__/listbox.test.ts.snap +115 -0
  175. package/src/modules/tds/search/lib/__tests__/listbox.test.ts +192 -0
  176. package/src/modules/tds/search/lib/listbox.ts +209 -0
  177. package/src/modules/tds/search/search.css +122 -0
  178. package/src/modules/tds/search/search.html +21 -0
  179. package/src/modules/tds/search/search.stories.ts +20 -0
  180. package/src/modules/tds/search/search.ts +107 -0
  181. package/src/modules/tds/search/types.d.ts +22 -0
  182. package/src/modules/tds/searchList/searchList.css +120 -0
  183. package/src/modules/tds/searchList/searchList.html +43 -0
  184. package/src/modules/tds/searchList/searchList.stories.ts +10 -0
  185. package/src/modules/tds/searchList/searchList.ts +53 -0
  186. package/src/modules/tds/select/__tests__/select.test.ts +150 -0
  187. package/src/modules/tds/select/select.css +42 -0
  188. package/src/modules/tds/select/select.html +24 -0
  189. package/src/modules/tds/select/select.stories.ts +59 -0
  190. package/src/modules/tds/select/select.ts +60 -0
  191. package/src/modules/tds/spinner/__tests__/spinner.test.ts +11 -0
  192. package/src/modules/tds/spinner/spinner.css +194 -0
  193. package/src/modules/tds/spinner/spinner.html +9 -0
  194. package/src/modules/tds/spinner/spinner.stories.ts +20 -0
  195. package/src/modules/tds/spinner/spinner.ts +15 -0
  196. package/src/modules/tds/styles/styles.css +24 -0
  197. package/src/modules/tds/summary/__tests__/summary.test.ts +135 -0
  198. package/src/modules/tds/summary/summary.css +135 -0
  199. package/src/modules/tds/summary/summary.html +69 -0
  200. package/src/modules/tds/summary/summary.stories.js +148 -0
  201. package/src/modules/tds/summary/summary.ts +95 -0
  202. package/src/modules/tds/tab/__tests__/tab.test.ts +25 -0
  203. package/src/modules/tds/tab/tab.css +3 -0
  204. package/src/modules/tds/tab/tab.html +5 -0
  205. package/src/modules/tds/tab/tab.ts +46 -0
  206. package/src/modules/tds/tabset/__tests__/tabset.test.ts +108 -0
  207. package/src/modules/tds/tabset/tabset.css +112 -0
  208. package/src/modules/tds/tabset/tabset.html +63 -0
  209. package/src/modules/tds/tabset/tabset.stories.ts +32 -0
  210. package/src/modules/tds/tabset/tabset.ts +232 -0
  211. package/src/modules/tds/themeProvider/themeProvider.css +502 -0
  212. package/src/modules/tds/themeProvider/themeProvider.html +3 -0
  213. package/src/modules/tds/themeProvider/themeProvider.ts +37 -0
  214. package/src/modules/tds/tile/tile.css +23 -0
  215. package/src/modules/tds/tile/tile.html +5 -0
  216. package/src/modules/tds/tile/tile.stories.js +14 -0
  217. package/src/modules/tds/tile/tile.ts +12 -0
  218. package/src/modules/tds/xsfMfeEvents/xsfMfeEvents.html +1 -0
  219. package/src/modules/tds/xsfMfeEvents/xsfMfeEvents.ts +47 -0
  220. package/src/modules/th/contextAdapter/__tests__/contextAdapter.test.ts +104 -0
  221. package/src/modules/th/contextAdapter/contextAdapter.html +1 -0
  222. package/src/modules/th/contextAdapter/contextAdapter.ts +49 -0
  223. package/src/modules/th/favoriteButton/__tests__/favoriteButton.test.ts +56 -0
  224. package/src/modules/th/favoriteButton/favoriteButton.css +3 -0
  225. package/src/modules/th/favoriteButton/favoriteButton.html +15 -0
  226. package/src/modules/th/favoriteButton/favoriteButton.stories.js +30 -0
  227. package/src/modules/th/favoriteButton/favoriteButton.ts +84 -0
  228. package/src/modules/th/favoriteButton/mocks/index.ts +12 -0
  229. package/src/modules/th/search/__fixtures__/index.ts +14 -0
  230. package/src/modules/th/search/__tests__/search.test.ts +233 -0
  231. package/src/modules/th/search/constants.ts +2 -0
  232. package/src/modules/th/search/mocks/index.ts +30 -0
  233. package/src/modules/th/search/mocks/responses.ts +54 -0
  234. package/src/modules/th/search/search.css +4 -0
  235. package/src/modules/th/search/search.html +12 -0
  236. package/src/modules/th/search/search.ts +172 -0
  237. package/src/modules/th/search/types.d.ts +29 -0
  238. package/src/modules/th/tbid/__tests__/__snapshots__/tbid.test.ts.snap +3 -0
  239. package/src/modules/th/tbid/__tests__/tbid.test.ts +242 -0
  240. package/src/modules/th/tbid/tbid.html +1 -0
  241. package/src/modules/th/tbid/tbid.stories.mdx +25 -0
  242. package/src/modules/th/tbid/tbid.ts +215 -0
  243. package/src/modules/tm/card/__tests__/card.test.ts +65 -0
  244. package/src/modules/tm/card/card.css +131 -0
  245. package/src/modules/tm/card/card.html +81 -0
  246. package/src/modules/tm/card/card.ts +269 -0
  247. package/src/modules/tm/cardBase/cardBase.css +11 -0
  248. package/src/modules/tm/cardGridA/cardGridA.css +11 -0
  249. package/src/modules/tm/cardGridA/cardGridA.html +21 -0
  250. package/src/modules/tm/cardGridA/cardGridA.stories.js +107 -0
  251. package/src/modules/tm/cardGridA/cardGridA.ts +24 -0
  252. package/src/modules/tm/cardGridB/cardGridB.css +88 -0
  253. package/src/modules/tm/cardGridB/cardGridB.html +20 -0
  254. package/src/modules/tm/cardGridB/cardGridB.stories.js +58 -0
  255. package/src/modules/tm/cardGridB/cardGridB.ts +19 -0
  256. package/src/modules/tm/cardGridC/cardGridC.css +24 -0
  257. package/src/modules/tm/cardGridC/cardGridC.html +22 -0
  258. package/src/modules/tm/cardGridC/cardGridC.stories.js +42 -0
  259. package/src/modules/tm/cardGridC/cardGridC.ts +11 -0
  260. package/src/modules/tm/cardGridD/cardGridD.css +17 -0
  261. package/src/modules/tm/cardGridD/cardGridD.html +20 -0
  262. package/src/modules/tm/cardGridD/cardGridD.stories.js +34 -0
  263. package/src/modules/tm/cardGridD/cardGridD.ts +7 -0
  264. package/src/modules/tm/cardNew/cardNew.css +31 -0
  265. package/src/modules/tm/cardNew/cardNew.html +29 -0
  266. package/src/modules/tm/cardNew/cardNew.ts +66 -0
  267. package/src/modules/tm/content/__fixtures__/index.ts +884 -0
  268. package/src/modules/tm/content/__tests__/content.test.ts +95 -0
  269. package/src/modules/tm/content/content.css +641 -0
  270. package/src/modules/tm/content/content.html +53 -0
  271. package/src/modules/tm/content/content.stories.js +14 -0
  272. package/src/modules/tm/content/content.ts +171 -0
  273. package/src/modules/tm/endCapA/__tests__/endCapA.test.ts +52 -0
  274. package/src/modules/tm/endCapA/endCapA.css +64 -0
  275. package/src/modules/tm/endCapA/endCapA.html +21 -0
  276. package/src/modules/tm/endCapA/endCapA.stories.js +37 -0
  277. package/src/modules/tm/endCapA/endCapA.ts +23 -0
  278. package/src/modules/tm/eventsA/eventsA.css +107 -0
  279. package/src/modules/tm/eventsA/eventsA.html +26 -0
  280. package/src/modules/tm/eventsA/eventsA.stories.js +51 -0
  281. package/src/modules/tm/eventsA/eventsA.ts +48 -0
  282. package/src/modules/tm/faqA/faqA.css +87 -0
  283. package/src/modules/tm/faqA/faqA.html +27 -0
  284. package/src/modules/tm/faqA/faqA.stories.js +25 -0
  285. package/src/modules/tm/faqA/faqA.ts +40 -0
  286. package/src/modules/tm/featureGridA/__tests__/featureGridA.test.ts +116 -0
  287. package/src/modules/tm/featureGridA/featureGridA.css +95 -0
  288. package/src/modules/tm/featureGridA/featureGridA.html +34 -0
  289. package/src/modules/tm/featureGridA/featureGridA.stories.js +45 -0
  290. package/src/modules/tm/featureGridA/featureGridA.ts +59 -0
  291. package/src/modules/tm/footnote/footnote.css +28 -0
  292. package/src/modules/tm/footnote/footnote.html +3 -0
  293. package/src/modules/tm/footnote/footnote.stories.js +29 -0
  294. package/src/modules/tm/footnote/footnote.ts +35 -0
  295. package/src/modules/tm/heroA/__tests__/heroA.test.ts +51 -0
  296. package/src/modules/tm/heroA/heroA.css +116 -0
  297. package/src/modules/tm/heroA/heroA.html +27 -0
  298. package/src/modules/tm/heroA/heroA.stories.js +49 -0
  299. package/src/modules/tm/heroA/heroA.ts +56 -0
  300. package/src/modules/tm/heroB/heroB.css +78 -0
  301. package/src/modules/tm/heroB/heroB.html +26 -0
  302. package/src/modules/tm/heroB/heroB.stories.js +44 -0
  303. package/src/modules/tm/heroB/heroB.ts +26 -0
  304. package/src/modules/tm/page/__tests__/page.test.ts +35 -0
  305. package/src/modules/tm/page/page.css +3 -0
  306. package/src/modules/tm/page/page.html +3 -0
  307. package/src/modules/tm/page/page.stories.js +10 -0
  308. package/src/modules/tm/page/page.ts +3 -0
  309. package/src/modules/tm/pageHeaderA/pageHeaderA.css +82 -0
  310. package/src/modules/tm/pageHeaderA/pageHeaderA.html +24 -0
  311. package/src/modules/tm/pageHeaderA/pageHeaderA.stories.js +18 -0
  312. package/src/modules/tm/pageHeaderA/pageHeaderA.ts +51 -0
  313. package/src/modules/tm/pageNavigationA/pageNavigationA.css +41 -0
  314. package/src/modules/tm/pageNavigationA/pageNavigationA.html +9 -0
  315. package/src/modules/tm/pageNavigationA/pageNavigationA.stories.js +34 -0
  316. package/src/modules/tm/pageNavigationA/pageNavigationA.ts +18 -0
  317. package/src/modules/tm/promoA/__tests__/promoA.test.ts +89 -0
  318. package/src/modules/tm/promoA/promoA.css +95 -0
  319. package/src/modules/tm/promoA/promoA.html +22 -0
  320. package/src/modules/tm/promoA/promoA.stories.js +38 -0
  321. package/src/modules/tm/promoA/promoA.ts +62 -0
  322. package/src/modules/tm/sectionA/sectionA.css +64 -0
  323. package/src/modules/tm/sectionA/sectionA.html +21 -0
  324. package/src/modules/tm/sectionA/sectionA.stories.js +18 -0
  325. package/src/modules/tm/sectionA/sectionA.ts +27 -0
  326. package/src/modules/tm/sectionSpacer/sectionSpacer.css +4 -0
  327. package/src/modules/tm/sectionSpacer/sectionSpacer.html +1 -0
  328. package/src/modules/tm/sectionSpacer/sectionSpacer.ts +3 -0
  329. package/src/modules/tm/skillsCardA/skillsCardA.css +73 -0
  330. package/src/modules/tm/skillsCardA/skillsCardA.html +37 -0
  331. package/src/modules/tm/skillsCardA/skillsCardA.ts +38 -0
  332. package/src/modules/tm/skillsGridA/skillsGridA.css +12 -0
  333. package/src/modules/tm/skillsGridA/skillsGridA.html +5 -0
  334. package/src/modules/tm/skillsGridA/skillsGridA.stories.ts +65 -0
  335. package/src/modules/tm/skillsGridA/skillsGridA.ts +3 -0
  336. package/src/modules/tm/statsA/statsA.css +26 -0
  337. package/src/modules/tm/statsA/statsA.html +10 -0
  338. package/src/modules/tm/statsA/statsA.stories.js +29 -0
  339. package/src/modules/tm/statsA/statsA.ts +20 -0
  340. package/src/modules/tm/textItem/textItem.css +53 -0
  341. package/src/modules/tm/textItem/textItem.html +18 -0
  342. package/src/modules/tm/textItem/textItem.ts +32 -0
  343. package/src/modules/tm/textItemGridA/textItemGridA.css +11 -0
  344. package/src/modules/tm/textItemGridA/textItemGridA.html +15 -0
  345. package/src/modules/tm/textItemGridA/textItemGridA.stories.js +67 -0
  346. package/src/modules/tm/textItemGridA/textItemGridA.ts +20 -0
  347. package/src/modules/tm/threeCardGrid/threeCardGrid.css +6 -0
  348. package/src/modules/tm/threeCardGrid/threeCardGrid.html +5 -0
  349. package/src/modules/tm/threeCardGrid/threeCardGrid.ts +3 -0
  350. package/src/modules/tm/trailblazersA/trailblazersA.css +70 -0
  351. package/src/modules/tm/trailblazersA/trailblazersA.html +42 -0
  352. package/src/modules/tm/trailblazersA/trailblazersA.stories.js +52 -0
  353. package/src/modules/tm/trailblazersA/trailblazersA.ts +43 -0
  354. package/src/modules/tm/utils/utils.ts +18 -0
  355. package/src/modules/tm/youtube/youtube.css +7 -0
  356. package/src/modules/tm/youtube/youtube.html +10 -0
  357. package/src/modules/tm/youtube/youtube.stories.js +15 -0
  358. package/src/modules/tm/youtube/youtube.ts +27 -0
  359. package/src/modules/ui/focusTrap/focusTrap.html +5 -0
  360. package/src/modules/ui/focusTrap/focusTrap.ts +104 -0
  361. package/src/modules/ui/focusVisible/__tests__/focusVisible.test.ts +95 -0
  362. package/src/modules/ui/focusVisible/focusVisible.html +3 -0
  363. package/src/modules/ui/focusVisible/focusVisible.ts +46 -0
@@ -0,0 +1,300 @@
1
+ import { LightningElement, api, track } from 'lwc';
2
+ import { Card } from 'tm/card';
3
+ import { FilterOption } from './types';
4
+ import { sendInteractionEvent, InteractionEventTypes } from 'shared/helpers';
5
+ import { debounce } from 'shared/debounce';
6
+
7
+ // function to get the cards array from the json payload
8
+ async function getGridCards(data: string, imageHash: string) {
9
+ const parsedData = JSON.parse(data);
10
+ // Sort the data based on the `sort` value
11
+ parsedData.sort((a: any, b: any) => a.sort - b.sort);
12
+ // load the gallery cards
13
+ return await parsedData.map((item: any) => {
14
+ const card: any = {
15
+ assistiveText: "Click here to go to this resource",
16
+ //ctaTitle: "Read More",
17
+ ctaTarget: null,
18
+ pretitleHref: null,
19
+ pretitleHrefText: null
20
+ }
21
+
22
+ // Dynamically set all other properties based on the data object
23
+ for (const prop in item) {
24
+ if (item.hasOwnProperty(prop)) {
25
+ switch (prop) {
26
+ case "url":
27
+ card.ctaHref = item[prop];
28
+ break;
29
+ default:
30
+ (card as any)[prop] = item[prop];
31
+ }
32
+ }
33
+
34
+ // Set imgSrc to thumbnail if it exists, otherwise use image
35
+ if (item.thumbnail) {
36
+ card.imgSrc = `/1/asset/immutable/s/${imageHash}${item.thumbnail}`;
37
+ } else if (item.image) {
38
+ card.imgSrc = item.image;
39
+ }
40
+ }
41
+
42
+ return card;
43
+ });
44
+ }
45
+ export default class gallery extends LightningElement {
46
+
47
+ // get the inputs from the config
48
+ _content: string | null = null;
49
+ _filterData: any;
50
+ _filterProperty: any;
51
+ _filterLabel: any;
52
+ _searchTitle: any;
53
+ _imageHash: string | null = null;
54
+ @api containerId: string = '';
55
+
56
+ // second filter drop down is optional and pulled from the json data set
57
+ _showMetaFilter = false;
58
+ _metaFilterProperty: any;
59
+ _metaFilterLabel: any;
60
+
61
+ // get the inputs from the form
62
+ _selectFilter: string = '';
63
+ _keywordFilter: string = '';
64
+ _selectMetaFilter: string = '';
65
+
66
+ // set up the outputs
67
+ allCards: Card[] = [];
68
+ filteredCards: Card[] = [];
69
+ shareUrl = window.location.href;
70
+
71
+ // prep the filters options
72
+ filterOptions: FilterOption[] = [];
73
+ metaFilterOptions: FilterOption[] = [];
74
+
75
+ // populate the filter drop down
76
+ connectedCallback() {
77
+ // Check if we're on the data model gallery page
78
+ if (this.containerId === 'data-model-gallery' && window.location.hash === '#data-model-gallery') {
79
+ window.location.href = 'https://developer.salesforce.com/docs/platform/data-models/guide/get-started.html';
80
+ }
81
+ }
82
+ get socialTitle(){
83
+ //Search title is plurar, removing last letter to make the title singular (should be a letter S)
84
+ return `${this._searchTitle.substring(0, this._searchTitle.length - 1)} Gallery`;
85
+ }
86
+
87
+ // fetch the filter data from a url
88
+ async fetchFilterData() {
89
+ try {
90
+ const response = await fetch(this._filterData);
91
+ const data = await response.json();
92
+ this.filterOptions = data as FilterOption[];
93
+ } catch (error: any) {
94
+ console.error("An error occurred getting the filter list:", error?.message || String(error));
95
+ }
96
+ }
97
+
98
+ // handle the filter selection change
99
+ filterChange(evt: { detail: string }) {
100
+ this._selectFilter = evt.detail;
101
+ this.applyFilters();
102
+ }
103
+
104
+ private sendInteractionEvent = debounce((event,target)=>{
105
+ sendInteractionEvent("Gallery Search",InteractionEventTypes.INPUT_CHANGE,event,target);
106
+ },1000);
107
+
108
+ // handle typing in the search box
109
+ keywordFilterChange(evt: InputEvent) {
110
+ const target = (evt.currentTarget as HTMLInputElement);
111
+ this.sendInteractionEvent(evt,target);
112
+ this._keywordFilter = (evt.currentTarget as HTMLInputElement).value;
113
+ this.applyFilters();
114
+ }
115
+
116
+ // handle the filter selection change
117
+ metaFilterChange(evt: { detail: string }) {
118
+ this._selectMetaFilter = evt.detail;
119
+ this.applyFilters();
120
+ }
121
+
122
+ // update the gallery based on filtering
123
+ async applyFilters() {
124
+ this.filteredCards = this.allCards.filter((card: any) => {
125
+ let isFilterMatch = (this._selectFilter === '' || (card as any)[this._filterProperty]?.toLowerCase().includes(this._selectFilter.toLocaleLowerCase()));
126
+ let isMetaMatch = ((this._showMetaFilter) ? ((this._selectMetaFilter === '' || (card as any)[this._metaFilterProperty]?.toLowerCase().includes(this._selectMetaFilter.toLocaleLowerCase()))) : true);
127
+ let isKeywordMatch = (this._keywordFilter === ''
128
+ || (card.pretitle && card.pretitle.toLowerCase().includes(this._keywordFilter.toLowerCase()))
129
+ || (card.title && card.title.toLowerCase().includes(this._keywordFilter.toLowerCase()))
130
+ || (card.description && card.description.toLowerCase().includes(this._keywordFilter.toLowerCase()))
131
+ );
132
+
133
+ if (isFilterMatch && isMetaMatch && isKeywordMatch)
134
+ return card;
135
+ });
136
+
137
+ // Update page state so that we track filters in URL params
138
+ const params = new URLSearchParams();
139
+
140
+ if (this._selectFilter !== '')
141
+ params.set(this._filterLabel, this._selectFilter);
142
+ if (this._showMetaFilter && this._selectMetaFilter !== '')
143
+ params.set(this._metaFilterLabel, this._selectMetaFilter);
144
+ if (this._keywordFilter !== '')
145
+ params.set('keywords', this._keywordFilter);
146
+
147
+ const paramsString = params.toString();
148
+ let updatedUrl = window.location.pathname;
149
+
150
+ // Update the hash to the containerId if it's been filtered or from the URL on load
151
+ const hash = this.containerId ? `#${this.containerId}` : window.location.hash.split('?')[0];
152
+
153
+ if (hash)
154
+ updatedUrl += hash;
155
+ if (paramsString)
156
+ updatedUrl += `?${paramsString}`;
157
+
158
+ history.replaceState(history.state, document.title, updatedUrl);
159
+ this.shareUrl = `${window.location.protocol}//${window.location.hostname}${updatedUrl}`;
160
+
161
+ // Scrolls to container element to keep new data in focus.
162
+ if (hash) {
163
+ const targetElement = document.querySelector(`#${this.containerId}`);
164
+ // Scroll to the target element if it exists
165
+ if (targetElement) {
166
+ targetElement.scrollIntoView({ behavior: "smooth" });
167
+ }
168
+ }
169
+ }
170
+
171
+ checkURLParams() {
172
+ // Load filters from URL params
173
+ let requireFilterUpdate = false;
174
+ const url = new URL(window.location.href.replace('#', ''));
175
+ const params = url.searchParams;
176
+ for (const [key, value] of params.entries()) {
177
+ switch (key) {
178
+ case this._filterLabel:
179
+ this._selectFilter = value;
180
+ requireFilterUpdate = true;
181
+ break;
182
+ case this._metaFilterLabel:
183
+ this._selectMetaFilter = value;
184
+ requireFilterUpdate = true;
185
+ break;
186
+ case 'keywords':
187
+ this._keywordFilter = value;
188
+ requireFilterUpdate = true;
189
+ break;
190
+ default:
191
+ break;
192
+ }
193
+ };
194
+
195
+ return requireFilterUpdate;
196
+ }
197
+
198
+ handleResetFiltersClick() {
199
+ this._selectFilter = '';
200
+ (this._showMetaFilter) ? this._selectMetaFilter = '' : true;
201
+ this._keywordFilter = '';
202
+ this.applyFilters();
203
+ }
204
+
205
+ private updateCards() {
206
+ if (this._content && this._imageHash) {
207
+ try {
208
+ getGridCards(this._content, this._imageHash).then((res) => {
209
+ this.allCards = this.filteredCards = res;
210
+ if (this._showMetaFilter) {
211
+ let typesArr = [...new Set(this.allCards.map((item: any) => (item as any).type))];
212
+ typesArr.sort((a: string, b: string) => a.localeCompare(b));
213
+ this.metaFilterOptions = typesArr.map((type: string) => ({ label: type, value: type })) as FilterOption[];
214
+ }
215
+ if (this.checkURLParams())
216
+ this.applyFilters();
217
+ });
218
+ } catch (error: any) {
219
+ console.error("An error occurred getting the cards:", error?.message || String(error));
220
+ }
221
+ }
222
+ }
223
+
224
+ // bind the config to the variables
225
+ @api
226
+ set searchtitle(value) {
227
+ if (this._searchTitle !== value) {
228
+ this._searchTitle = value;
229
+ }
230
+ }
231
+ get searchtitle() {
232
+ return this._searchTitle;
233
+ }
234
+
235
+ @api
236
+ set imageHash(value) {
237
+ this._imageHash = value;
238
+ this.updateCards();
239
+ }
240
+ get imageHash() {
241
+ return this._imageHash;
242
+ }
243
+
244
+ @api
245
+ set content(value) {
246
+ this._content = value;
247
+ this.updateCards();
248
+ }
249
+ get content() {
250
+ return this._content;
251
+ }
252
+
253
+ @api
254
+ set filter(value) {
255
+ if (this._filterData !== value) {
256
+ this._filterData = value;
257
+ if (!this._filterData.endsWith('.json')) {
258
+ this.filterOptions = JSON.parse(this._filterData) as FilterOption[];
259
+ } else {
260
+ this.fetchFilterData();
261
+ }
262
+ }
263
+ }
264
+ get filter() {
265
+ return this._filterData;
266
+ }
267
+
268
+ @api
269
+ set property(value) {
270
+ if (this._filterProperty !== value) {
271
+ this._filterProperty = value;
272
+ }
273
+ }
274
+ get property() {
275
+ return this._filterProperty;
276
+ }
277
+
278
+ @api
279
+ set label(value) {
280
+ if (this._filterLabel !== value) {
281
+ this._filterLabel = value;
282
+ }
283
+ }
284
+ get label() {
285
+ return this._filterLabel;
286
+ }
287
+
288
+ // below is for getting and setting the optional second filter
289
+ @api
290
+ set metafilters(value) {
291
+ if (this._metaFilterProperty !== value) {
292
+ this._showMetaFilter = true;
293
+ this._metaFilterProperty = value;
294
+ this._metaFilterLabel = value.charAt(0).toUpperCase() + value.slice(1);
295
+ }
296
+ }
297
+ get metafilters() {
298
+ return this._metaFilterProperty;
299
+ }
300
+ }
@@ -0,0 +1,35 @@
1
+ export type GalleryCard = {
2
+ id?: string;
3
+ pretitle: string | null;
4
+ title: string;
5
+ description: string;
6
+ image: string | null;
7
+ status?: string | null;
8
+ sort: number | null;
9
+ updated?: Date | null;
10
+ productAreas: string[];
11
+ url: string | null;
12
+ };
13
+
14
+ export type CardAttribute = string | null;
15
+ export type Card = {
16
+ assistiveText: CardAttribute;
17
+ ctaHref: CardAttribute;
18
+ ctaTarget: CardAttribute;
19
+ ctaTitle: CardAttribute;
20
+ description: CardAttribute;
21
+ imgSrc: CardAttribute;
22
+ pretitle: CardAttribute;
23
+ pretitleHref: CardAttribute;
24
+ pretitleHrefText: CardAttribute;
25
+ title: CardAttribute;
26
+ };
27
+
28
+ export type GalleryCards = {
29
+ items: Card[];
30
+ }
31
+
32
+ export type FilterOption = {
33
+ label: string;
34
+ value: string;
35
+ };
@@ -0,0 +1,49 @@
1
+ @import 'tds/reset';
2
+
3
+ :host {
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: space-between;
7
+ }
8
+
9
+ .actions {
10
+ align-items: center;
11
+ display: grid;
12
+ grid-auto-flow: column;
13
+ grid-column-gap: var(--tds-spacing-2);
14
+ }
15
+
16
+ @media screen and (max-width: 800px) {
17
+ .actions {
18
+ width: 120px;
19
+ }
20
+ }
21
+
22
+ .actions a {
23
+ margin-right: 1rem;
24
+ }
25
+ .actions a:last-of-type {
26
+ margin-right: 0;
27
+ }
28
+
29
+ .actions svg {
30
+ height: 1rem;
31
+ }
32
+
33
+ .actions svg.fill {
34
+ fill: var(--tds-color-meteorite);
35
+ }
36
+
37
+ .actions svg.fill:hover {
38
+ fill: var(--tds-color-brand);
39
+ }
40
+
41
+ .actions svg.stroke {
42
+ stroke: var(--tds-color-meteorite);
43
+ fill: var(--tds-color-meteorite);
44
+ }
45
+
46
+ .actions svg.stroke:hover {
47
+ stroke: var(--tds-color-brand);
48
+ fill: var(--tds-color-brand);
49
+ }
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="actions">
3
+ <a
4
+ onclick={handleClick}
5
+ href={shareTwitter}
6
+ target="_blank"
7
+ rel="noopener"
8
+ id="Share-on-Twitter"
9
+ name="Share on Twitter"
10
+ aria-label="Share on Twitter (opens new tab)"
11
+ class="fill"
12
+ ><svg
13
+ viewBox="0 0 18 14"
14
+ class="fill"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ >
17
+ <path
18
+ d="M17.308 2.325a7.333 7.333 0 01-2.041.52 3.396 3.396 0 001.565-1.836 7.374 7.374 0 01-2.258.808c-.33-.33-.73-.595-1.176-.775a3.767 3.767 0 00-1.412-.274 3.75 3.75 0 00-2.518.995A3.218 3.218 0 008.43 4.108c.002.254.033.507.094.755A10.658 10.658 0 014.46 3.847a9.912 9.912 0 01-3.256-2.471 3.128 3.128 0 00-.39 2.419c.205.823.738 1.544 1.494 2.017A3.678 3.678 0 01.72 5.39a.124.124 0 000 .053c.005.767.294 1.509.82 2.101.525.592 1.254 1 2.065 1.153-.326.071-.66.1-.995.087a4.39 4.39 0 01-.671 0 3.36 3.36 0 001.265 1.638c.594.412 1.31.645 2.052.666a7.475 7.475 0 01-4.413 1.423 8.92 8.92 0 01-.844-.08 10.571 10.571 0 005.445 1.49c6.526 0 10.096-5.057 10.096-9.446v-.434a6.933 6.933 0 001.767-1.717z"
19
+ ></path></svg>
20
+ </a>
21
+ <a
22
+ onclick={handleClick}
23
+ href={shareLinkedIn}
24
+ target="_blank"
25
+ rel="noopener"
26
+ id="Share-on-LinkedIn"
27
+ name="Share on LinkedIn"
28
+ aria-label="Share on LinkedIn (opens new tab)"
29
+ ><svg
30
+ viewBox="0 0 16 17"
31
+ class="fill"
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ >
34
+ <path
35
+ d="M15.923 10.187v6.428H12.51v-5.998c0-1.506-.493-2.535-1.729-2.535-.943 0-1.504.693-1.75 1.364-.09.24-.114.573-.114.908v6.261H5.503s.046-10.158 0-11.21h3.414v1.588l-.023.037h.023v-.037c.453-.762 1.263-1.852 3.076-1.852 2.246 0 3.93 1.602 3.93 5.046zM1.932 0C.764 0 0 .837 0 1.937c0 1.076.742 1.938 1.887 1.938h.022c1.19 0 1.931-.862 1.931-1.938C3.818.837 3.1 0 1.932 0zM.202 16.615h3.413V5.405H.203v11.21z"
36
+ ></path></svg>
37
+ </a>
38
+ <a
39
+ onclick={handleClick}
40
+ href={shareFacebook}
41
+ target="_blank"
42
+ rel="noopener"
43
+ id="Share-on-Facebook"
44
+ name="Share on Facebook"
45
+ aria-label="Share on Facebook (opens new tab)"
46
+ ><svg
47
+ viewBox="0 0 9 18"
48
+ class="stroke"
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ >
51
+ <path
52
+ d="M6.115 0c-2.173 0-3.66 1.5-3.66 4.23v2.363H0v3.195h2.455V18h2.926V9.788h2.45l.37-3.195H5.38V4.545c0-.922.236-1.545 1.42-1.545h1.507V.128A18.2 18.2 0 006.115 0z"
53
+ ></path></svg>
54
+ </a>
55
+ </div>
56
+ </template>
@@ -0,0 +1,29 @@
1
+ import { LightningElement, api } from 'lwc';
2
+ import { sendInteractionEvent, InteractionEventTypes } from 'shared/helpers';
3
+
4
+ export default class extends LightningElement {
5
+ @api title: string = '';
6
+ @api url: string = window.location.href;
7
+
8
+ private get shareTwitter() {
9
+ return `https://twitter.com/intent/tweet/?text=${encodeURIComponent(
10
+ this.title || ''
11
+ )}&url=${encodeURIComponent(this.url)}&via=SalesforceArchs`;
12
+ }
13
+
14
+ private get shareLinkedIn() {
15
+ return `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURI(
16
+ this.url
17
+ )}`;
18
+ }
19
+
20
+ private get shareFacebook() {
21
+ return `https://www.facebook.com/sharer/sharer.php?u=${encodeURI(
22
+ this.url
23
+ )}`;
24
+ }
25
+ handleClick(e: any){
26
+ sendInteractionEvent('Social Share Click', InteractionEventTypes.CLICK, e, e.currentTarget);
27
+
28
+ }
29
+ }
@@ -0,0 +1,25 @@
1
+ import { isDisabled, isHidden } from '@a11y/focus-trap';
2
+
3
+ export function getFocusableElements(node: Element): HTMLElement[] {
4
+ const focusableTags = new Set(
5
+ ['a', 'button', 'input', 'select', 'textarea'].map((t) =>
6
+ t.toUpperCase()
7
+ )
8
+ );
9
+ if (
10
+ focusableTags.has(node.tagName) &&
11
+ !isDisabled(node as HTMLElement) &&
12
+ !isHidden(node as HTMLElement)
13
+ )
14
+ return [node] as HTMLElement[];
15
+ if (node.shadowRoot)
16
+ return Array.from(node.shadowRoot.children).flatMap(
17
+ getFocusableElements
18
+ );
19
+ if (node instanceof HTMLSlotElement) {
20
+ let assignedElements = node.assignedElements();
21
+ if (assignedElements.length)
22
+ return assignedElements.flatMap(getFocusableElements);
23
+ }
24
+ return Array.from(node.children).flatMap(getFocusableElements);
25
+ }
@@ -0,0 +1,29 @@
1
+ import { track, LightningElement } from 'lwc';
2
+
3
+ export abstract class ChildrenElement<T> extends LightningElement {
4
+ private observer!: MutationObserver;
5
+
6
+ @track items: T[] = [];
7
+ abstract extractor: (element: Element) => T;
8
+
9
+ connectedCallback() {
10
+ this.observer = new MutationObserver(() => {
11
+ this.setItems();
12
+ });
13
+ this.observer.observe(this.template.host, {
14
+ childList: true,
15
+ subtree: true
16
+ });
17
+ this.setItems();
18
+ }
19
+
20
+ disconnectedCallback() {
21
+ this.observer.disconnect();
22
+ }
23
+
24
+ setItems() {
25
+ this.items = Array.from(this.template.host.children).map(
26
+ this.extractor
27
+ );
28
+ }
29
+ }
@@ -0,0 +1,52 @@
1
+ export function hexToRGB(h: string) {
2
+ let r = 0;
3
+ let g = 0;
4
+ let b = 0;
5
+ if (h.length == 4) {
6
+ r = +('0x' + h[1] + h[1]);
7
+ g = +('0x' + h[2] + h[2]);
8
+ b = +('0x' + h[3] + h[3]);
9
+ } else if (h.length == 7) {
10
+ r = +('0x' + h[1] + h[2]);
11
+ g = +('0x' + h[3] + h[4]);
12
+ b = +('0x' + h[5] + h[6]);
13
+ }
14
+ return [r, g, b];
15
+ }
16
+
17
+ export function RGBToHSL(r: number, g: number, b: number) {
18
+ r /= 255;
19
+ g /= 255;
20
+ b /= 255;
21
+ let cmin = Math.min(r, g, b);
22
+ let cmax = Math.max(r, g, b);
23
+ let delta = cmax - cmin;
24
+ let h = 0;
25
+ let s = 0;
26
+ let l = 0;
27
+ if (delta === 0) h = 0;
28
+ else if (cmax === r) h = ((g - b) / delta) % 6;
29
+ else if (cmax === g) h = (b - r) / delta + 2;
30
+ else h = (r - g) / delta + 4;
31
+ h = Math.round(h * 60);
32
+ if (h < 0) h += 360;
33
+ l = (cmax + cmin) / 2;
34
+ s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
35
+ s = +s.toFixed(1);
36
+ l = +l.toFixed(1);
37
+ return [h, s, l];
38
+ }
39
+
40
+ export function rgb(r: number, g: number, b: number) {
41
+ return `rgb(${r},${g},${b})`;
42
+ }
43
+
44
+ export function hsl(h: number, s: number, l: number) {
45
+ return `hsl(${h},${s * 100}%,${l * 100}%)`;
46
+ }
47
+
48
+ export function lightenHex(hex: string, by: number) {
49
+ let [r, g, b] = hexToRGB(hex);
50
+ let [h, s, l] = RGBToHSL(r, g, b);
51
+ return hsl(h, s, l + by);
52
+ }
@@ -0,0 +1,32 @@
1
+ type Procedure = (...args: any[]) => void;
2
+
3
+ type Options = {
4
+ isImmediate: boolean;
5
+ };
6
+
7
+ export function debounce<F extends Procedure>(
8
+ func: F,
9
+ waitMilliseconds = 50,
10
+ options: Options = {
11
+ isImmediate: false
12
+ }
13
+ ): F {
14
+ let timeoutId: ReturnType<typeof setTimeout> | undefined;
15
+ return function (this: any, ...args: any[]) {
16
+ const context = this;
17
+ const doLater = function () {
18
+ timeoutId = undefined;
19
+ if (!options.isImmediate) {
20
+ func.apply(context, args);
21
+ }
22
+ };
23
+ const shouldCallNow = options.isImmediate && timeoutId === undefined;
24
+ if (timeoutId !== undefined) {
25
+ clearTimeout(timeoutId);
26
+ }
27
+ timeoutId = setTimeout(doLater, waitMilliseconds);
28
+ if (shouldCallNow) {
29
+ func.apply(context, args);
30
+ }
31
+ } as any;
32
+ }