@omicronenergy/oscd-ui 0.0.6 → 0.0.7

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 (464) hide show
  1. package/app-bar/OscdAppBar.d.ts +3 -3
  2. package/app-bar/OscdAppBar.js +12 -10
  3. package/app-bar/OscdAppBar.js.map +1 -1
  4. package/button/OscdFilledButton.js +2 -2
  5. package/button/OscdFilledButton.js.map +1 -1
  6. package/button/OscdOutlinedButton.js +1 -1
  7. package/button/OscdOutlinedButton.js.map +1 -1
  8. package/button/OscdTextButton.js +1 -1
  9. package/button/OscdTextButton.js.map +1 -1
  10. package/button/oscd-outlined-button.d.ts +1 -1
  11. package/button/oscd-outlined-button.js.map +1 -1
  12. package/dialog/OscdDialog.js +1 -1
  13. package/dialog/OscdDialog.js.map +1 -1
  14. package/divider/OscdDivider.js +1 -1
  15. package/divider/OscdDivider.js.map +1 -1
  16. package/elevation/OscdElevation.d.ts +1 -2
  17. package/elevation/OscdElevation.js +3 -4
  18. package/elevation/OscdElevation.js.map +1 -1
  19. package/elevation/_elevation.scss +6 -0
  20. package/elevation/internal/_elevation.scss +176 -0
  21. package/elevation/internal/elevation-styles.css +1 -0
  22. package/elevation/internal/elevation-styles.css.map +1 -0
  23. package/elevation/internal/elevation-styles.d.ts +1 -0
  24. package/elevation/internal/elevation-styles.js +10 -0
  25. package/elevation/internal/elevation-styles.js.map +1 -0
  26. package/elevation/internal/elevation-styles.scss +10 -0
  27. package/elevation/internal/elevation.d.ts +13 -0
  28. package/elevation/internal/elevation.js +21 -0
  29. package/elevation/internal/elevation.js.map +1 -0
  30. package/field/OscdFilledField.js +1 -1
  31. package/field/OscdFilledField.js.map +1 -1
  32. package/field/OscdOutlinedField.js +1 -1
  33. package/field/OscdOutlinedField.js.map +1 -1
  34. package/focus/OscdFocusRing.d.ts +5 -0
  35. package/focus/OscdFocusRing.js +6 -0
  36. package/focus/OscdFocusRing.js.map +1 -0
  37. package/focus/_focus-ring.scss +6 -0
  38. package/focus/internal/_focus-ring.scss +113 -0
  39. package/focus/internal/focus-ring-styles.css +1 -0
  40. package/focus/internal/focus-ring-styles.css.map +1 -0
  41. package/focus/internal/focus-ring-styles.d.ts +1 -0
  42. package/focus/internal/focus-ring-styles.js +10 -0
  43. package/focus/internal/focus-ring-styles.js.map +1 -0
  44. package/focus/internal/focus-ring-styles.scss +10 -0
  45. package/focus/internal/focus-ring.d.ts +39 -0
  46. package/focus/internal/focus-ring.js +101 -0
  47. package/focus/internal/focus-ring.js.map +1 -0
  48. package/focus/oscd-focus-ring.d.ts +21 -0
  49. package/focus/oscd-focus-ring.js +23 -0
  50. package/focus/oscd-focus-ring.js.map +1 -0
  51. package/icon/OscdIcon.js +1 -1
  52. package/icon/OscdIcon.js.map +1 -1
  53. package/iconbutton/OscdFilledIconButton.js +1 -1
  54. package/iconbutton/OscdFilledIconButton.js.map +1 -1
  55. package/iconbutton/OscdFilledTonalIconButton.js +1 -1
  56. package/iconbutton/OscdFilledTonalIconButton.js.map +1 -1
  57. package/iconbutton/OscdIconButton.js +1 -1
  58. package/iconbutton/OscdIconButton.js.map +1 -1
  59. package/iconbutton/OscdOutlinedIconButton.js +1 -1
  60. package/iconbutton/OscdOutlinedIconButton.js.map +1 -1
  61. package/internal/aria/aria.d.ts +103 -0
  62. package/internal/aria/aria.js +81 -0
  63. package/internal/aria/aria.js.map +1 -0
  64. package/internal/aria/delegate.d.ts +54 -0
  65. package/internal/aria/delegate.js +176 -0
  66. package/internal/aria/delegate.js.map +1 -0
  67. package/internal/controller/attachable-controller.d.ts +114 -0
  68. package/internal/controller/attachable-controller.js +121 -0
  69. package/internal/controller/attachable-controller.js.map +1 -0
  70. package/internal/controller/form-submitter.d.ts +70 -0
  71. package/internal/controller/form-submitter.js +69 -0
  72. package/internal/controller/form-submitter.js.map +1 -0
  73. package/internal/controller/is-rtl.d.ts +14 -0
  74. package/internal/controller/is-rtl.js +18 -0
  75. package/internal/controller/is-rtl.js.map +1 -0
  76. package/internal/controller/string-converter.d.ts +9 -0
  77. package/internal/controller/string-converter.js +14 -0
  78. package/internal/controller/string-converter.js.map +1 -0
  79. package/internal/events/dispatch-hooks.d.ts +85 -0
  80. package/internal/events/dispatch-hooks.js +151 -0
  81. package/internal/events/dispatch-hooks.js.map +1 -0
  82. package/internal/events/form-label-activation.d.ts +55 -0
  83. package/internal/events/form-label-activation.js +96 -0
  84. package/internal/events/form-label-activation.js.map +1 -0
  85. package/internal/events/redispatch-event.d.ts +27 -0
  86. package/internal/events/redispatch-event.js +40 -0
  87. package/internal/events/redispatch-event.js.map +1 -0
  88. package/internal/motion/_animation.scss +33 -0
  89. package/internal/motion/animation.d.ts +80 -0
  90. package/internal/motion/animation.js +101 -0
  91. package/internal/motion/animation.js.map +1 -0
  92. package/internal/sass/_string-ext.scss +195 -0
  93. package/internal/sass/_var.scss +237 -0
  94. package/labs/badge/OscdBadge.d.ts +14 -0
  95. package/labs/badge/OscdBadge.js +15 -0
  96. package/labs/badge/OscdBadge.js.map +1 -0
  97. package/labs/badge/_badge.scss +6 -0
  98. package/labs/badge/internal/_badge.scss +76 -0
  99. package/labs/badge/internal/badge-styles.css +1 -0
  100. package/labs/badge/internal/badge-styles.css.map +1 -0
  101. package/labs/badge/internal/badge-styles.d.ts +1 -0
  102. package/labs/badge/internal/badge-styles.js +10 -0
  103. package/labs/badge/internal/badge-styles.js.map +1 -0
  104. package/labs/badge/internal/badge-styles.scss +10 -0
  105. package/labs/badge/internal/badge.d.ts +13 -0
  106. package/labs/badge/internal/badge.js +28 -0
  107. package/labs/badge/internal/badge.js.map +1 -0
  108. package/labs/badge/oscd-badge.d.ts +19 -0
  109. package/labs/badge/oscd-badge.js +21 -0
  110. package/labs/badge/oscd-badge.js.map +1 -0
  111. package/labs/behaviors/constraint-validation.d.ts +133 -0
  112. package/labs/behaviors/constraint-validation.js +131 -0
  113. package/labs/behaviors/constraint-validation.js.map +1 -0
  114. package/labs/behaviors/element-internals.d.ts +45 -0
  115. package/labs/behaviors/element-internals.js +46 -0
  116. package/labs/behaviors/element-internals.js.map +1 -0
  117. package/labs/behaviors/focusable.d.ts +39 -0
  118. package/labs/behaviors/focusable.js +87 -0
  119. package/labs/behaviors/focusable.js.map +1 -0
  120. package/labs/behaviors/form-associated.d.ts +199 -0
  121. package/labs/behaviors/form-associated.js +175 -0
  122. package/labs/behaviors/form-associated.js.map +1 -0
  123. package/labs/behaviors/mixin.d.ts +54 -0
  124. package/labs/behaviors/mixin.js +7 -0
  125. package/labs/behaviors/mixin.js.map +1 -0
  126. package/labs/behaviors/on-report-validity.d.ts +71 -0
  127. package/labs/behaviors/on-report-validity.js +289 -0
  128. package/labs/behaviors/on-report-validity.js.map +1 -0
  129. package/labs/behaviors/validators/checkbox-validator.d.ts +35 -0
  130. package/labs/behaviors/validators/checkbox-validator.js +34 -0
  131. package/labs/behaviors/validators/checkbox-validator.js.map +1 -0
  132. package/labs/behaviors/validators/radio-validator.d.ts +38 -0
  133. package/labs/behaviors/validators/radio-validator.js +67 -0
  134. package/labs/behaviors/validators/radio-validator.js.map +1 -0
  135. package/labs/behaviors/validators/select-validator.d.ts +35 -0
  136. package/labs/behaviors/validators/select-validator.js +35 -0
  137. package/labs/behaviors/validators/select-validator.js.map +1 -0
  138. package/labs/behaviors/validators/text-field-validator.d.ts +110 -0
  139. package/labs/behaviors/validators/text-field-validator.js +156 -0
  140. package/labs/behaviors/validators/text-field-validator.js.map +1 -0
  141. package/labs/behaviors/validators/validator.d.ts +96 -0
  142. package/labs/behaviors/validators/validator.js +73 -0
  143. package/labs/behaviors/validators/validator.js.map +1 -0
  144. package/labs/card/OscdElevatedCard.d.ts +20 -0
  145. package/labs/card/OscdElevatedCard.js +23 -0
  146. package/labs/card/OscdElevatedCard.js.map +1 -0
  147. package/labs/card/OscdFilledCard.d.ts +20 -0
  148. package/labs/card/OscdFilledCard.js +23 -0
  149. package/labs/card/OscdFilledCard.js.map +1 -0
  150. package/labs/card/OscdOutlinedCard.d.ts +20 -0
  151. package/labs/card/OscdOutlinedCard.js +23 -0
  152. package/labs/card/OscdOutlinedCard.js.map +1 -0
  153. package/labs/card/_elevated-card.scss +6 -0
  154. package/labs/card/_filled-card.scss +6 -0
  155. package/labs/card/_outlined-card.scss +6 -0
  156. package/labs/card/demo/demo.d.ts +7 -0
  157. package/labs/card/demo/demo.js +13 -0
  158. package/labs/card/demo/demo.js.map +1 -0
  159. package/labs/card/demo/stories.d.ts +15 -0
  160. package/labs/card/demo/stories.js +104 -0
  161. package/labs/card/demo/stories.js.map +1 -0
  162. package/labs/card/internal/_elevated-card.scss +35 -0
  163. package/labs/card/internal/_filled-card.scss +35 -0
  164. package/labs/card/internal/_outlined-card.scss +40 -0
  165. package/labs/card/internal/_shared.scss +62 -0
  166. package/labs/card/internal/card.d.ts +12 -0
  167. package/labs/card/internal/card.js +21 -0
  168. package/labs/card/internal/card.js.map +1 -0
  169. package/labs/card/internal/elevated-styles.css +1 -0
  170. package/labs/card/internal/elevated-styles.css.map +1 -0
  171. package/labs/card/internal/elevated-styles.d.ts +1 -0
  172. package/labs/card/internal/elevated-styles.js +10 -0
  173. package/labs/card/internal/elevated-styles.js.map +1 -0
  174. package/labs/card/internal/elevated-styles.scss +10 -0
  175. package/labs/card/internal/filled-styles.css +1 -0
  176. package/labs/card/internal/filled-styles.css.map +1 -0
  177. package/labs/card/internal/filled-styles.d.ts +1 -0
  178. package/labs/card/internal/filled-styles.js +10 -0
  179. package/labs/card/internal/filled-styles.js.map +1 -0
  180. package/labs/card/internal/filled-styles.scss +10 -0
  181. package/labs/card/internal/outlined-styles.css +1 -0
  182. package/labs/card/internal/outlined-styles.css.map +1 -0
  183. package/labs/card/internal/outlined-styles.d.ts +1 -0
  184. package/labs/card/internal/outlined-styles.js +10 -0
  185. package/labs/card/internal/outlined-styles.js.map +1 -0
  186. package/labs/card/internal/outlined-styles.scss +10 -0
  187. package/labs/card/internal/shared-styles.css +1 -0
  188. package/labs/card/internal/shared-styles.css.map +1 -0
  189. package/labs/card/internal/shared-styles.d.ts +1 -0
  190. package/labs/card/internal/shared-styles.js +10 -0
  191. package/labs/card/internal/shared-styles.js.map +1 -0
  192. package/labs/card/internal/shared-styles.scss +10 -0
  193. package/labs/card/oscd-elevated-card.d.ts +20 -0
  194. package/labs/card/oscd-elevated-card.js +23 -0
  195. package/labs/card/oscd-elevated-card.js.map +1 -0
  196. package/labs/card/oscd-filled-card.d.ts +25 -0
  197. package/labs/card/oscd-filled-card.js +28 -0
  198. package/labs/card/oscd-filled-card.js.map +1 -0
  199. package/labs/card/oscd-outlined-card.d.ts +20 -0
  200. package/labs/card/oscd-outlined-card.js +23 -0
  201. package/labs/card/oscd-outlined-card.js.map +1 -0
  202. package/list/OscdList.js +1 -1
  203. package/list/OscdList.js.map +1 -1
  204. package/list/OscdListItem.d.ts +4 -0
  205. package/list/OscdListItem.js +13 -1
  206. package/list/OscdListItem.js.map +1 -1
  207. package/menu/OscdMenu.js +1 -1
  208. package/menu/OscdMenu.js.map +1 -1
  209. package/menu/OscdMenuItem.js +1 -1
  210. package/menu/OscdMenuItem.js.map +1 -1
  211. package/navigation-drawer/OscdNavigationDrawer.js +2 -2
  212. package/navigation-drawer/OscdNavigationDrawer.js.map +1 -1
  213. package/navigation-drawer/OscdNavigationDrawerHeader.js +2 -2
  214. package/navigation-drawer/OscdNavigationDrawerHeader.js.map +1 -1
  215. package/package.json +76 -110
  216. package/radio/OscdRadio.d.ts +31 -0
  217. package/radio/OscdRadio.js +27 -0
  218. package/radio/OscdRadio.js.map +1 -0
  219. package/radio/demo/demo.d.ts +7 -0
  220. package/radio/demo/demo.js +14 -0
  221. package/radio/demo/demo.js.map +1 -0
  222. package/radio/demo/stories.d.ts +13 -0
  223. package/radio/demo/stories.js +97 -0
  224. package/radio/demo/stories.js.map +1 -0
  225. package/radio/internal/_radio.scss +198 -0
  226. package/radio/internal/radio-styles.css +1 -0
  227. package/radio/internal/radio-styles.css.map +1 -0
  228. package/radio/internal/radio-styles.d.ts +1 -0
  229. package/radio/internal/radio-styles.js +10 -0
  230. package/radio/internal/radio-styles.js.map +1 -0
  231. package/radio/internal/radio-styles.scss +10 -0
  232. package/radio/internal/radio.d.ts +59 -0
  233. package/radio/internal/radio.js +175 -0
  234. package/radio/internal/radio.js.map +1 -0
  235. package/radio/internal/single-selection-controller.d.ts +80 -0
  236. package/radio/internal/single-selection-controller.js +199 -0
  237. package/radio/internal/single-selection-controller.js.map +1 -0
  238. package/radio/oscd-radio.d.ts +32 -0
  239. package/radio/oscd-radio.js +34 -0
  240. package/radio/oscd-radio.js.map +1 -0
  241. package/ripple/OscdRipple.d.ts +5 -0
  242. package/ripple/OscdRipple.js +6 -0
  243. package/ripple/OscdRipple.js.map +1 -0
  244. package/ripple/_ripple.scss +6 -0
  245. package/ripple/internal/_ripple.scss +92 -0
  246. package/ripple/internal/ripple-styles.css +1 -0
  247. package/ripple/internal/ripple-styles.css.map +1 -0
  248. package/ripple/internal/ripple-styles.d.ts +1 -0
  249. package/ripple/internal/ripple-styles.js +10 -0
  250. package/ripple/internal/ripple-styles.js.map +1 -0
  251. package/ripple/internal/ripple-styles.scss +10 -0
  252. package/ripple/internal/ripple.d.ts +76 -0
  253. package/ripple/internal/ripple.js +425 -0
  254. package/ripple/internal/ripple.js.map +1 -0
  255. package/ripple/oscd-ripple.d.ts +29 -0
  256. package/ripple/oscd-ripple.js +31 -0
  257. package/ripple/oscd-ripple.js.map +1 -0
  258. package/select/OscdFilledSelect.js +1 -1
  259. package/select/OscdFilledSelect.js.map +1 -1
  260. package/select/OscdOutlinedSelect.js +1 -1
  261. package/select/OscdOutlinedSelect.js.map +1 -1
  262. package/select/OscdSelectOption.js +1 -1
  263. package/select/OscdSelectOption.js.map +1 -1
  264. package/tabs/OscdPrimaryTab.js +1 -1
  265. package/tabs/OscdPrimaryTab.js.map +1 -1
  266. package/tabs/OscdSecondaryTab.js +1 -1
  267. package/tabs/OscdSecondaryTab.js.map +1 -1
  268. package/tabs/OscdTabs.js +1 -1
  269. package/tabs/OscdTabs.js.map +1 -1
  270. package/textfield/OscdFilledTextField.js +5 -2
  271. package/textfield/OscdFilledTextField.js.map +1 -1
  272. package/textfield/OscdOutlinedTextField.js +5 -2
  273. package/textfield/OscdOutlinedTextField.js.map +1 -1
  274. package/tokens/_index.scss +66 -0
  275. package/tokens/_md-comp-assist-chip.scss +153 -0
  276. package/tokens/_md-comp-badge.scss +39 -0
  277. package/tokens/_md-comp-checkbox.scss +156 -0
  278. package/tokens/_md-comp-circular-progress.scss +79 -0
  279. package/tokens/_md-comp-dialog.scss +112 -0
  280. package/tokens/_md-comp-divider.scss +43 -0
  281. package/tokens/_md-comp-elevated-button.scss +143 -0
  282. package/tokens/_md-comp-elevated-card.scss +80 -0
  283. package/tokens/_md-comp-elevation.scss +48 -0
  284. package/tokens/_md-comp-fab-branded.scss +155 -0
  285. package/tokens/_md-comp-fab.scss +296 -0
  286. package/tokens/_md-comp-filled-button.scss +143 -0
  287. package/tokens/_md-comp-filled-card.scss +80 -0
  288. package/tokens/_md-comp-filled-field.scss +293 -0
  289. package/tokens/_md-comp-filled-icon-button.scss +119 -0
  290. package/tokens/_md-comp-filled-select.scss +198 -0
  291. package/tokens/_md-comp-filled-text-field.scss +200 -0
  292. package/tokens/_md-comp-filled-tonal-button.scss +143 -0
  293. package/tokens/_md-comp-filled-tonal-icon-button.scss +123 -0
  294. package/tokens/_md-comp-filter-chip.scss +265 -0
  295. package/tokens/_md-comp-focus-ring.scss +78 -0
  296. package/tokens/_md-comp-full-screen-dialog.scss +25 -0
  297. package/tokens/_md-comp-icon-button.scss +94 -0
  298. package/tokens/_md-comp-icon.scss +46 -0
  299. package/tokens/_md-comp-input-chip.scss +247 -0
  300. package/tokens/_md-comp-item.scss +88 -0
  301. package/tokens/_md-comp-linear-progress.scss +64 -0
  302. package/tokens/_md-comp-list-item.scss +173 -0
  303. package/tokens/_md-comp-list.scss +44 -0
  304. package/tokens/_md-comp-menu-item.scss +125 -0
  305. package/tokens/_md-comp-menu.scss +59 -0
  306. package/tokens/_md-comp-navigation-bar.scss +44 -0
  307. package/tokens/_md-comp-navigation-drawer.scss +44 -0
  308. package/tokens/_md-comp-outlined-button.scss +139 -0
  309. package/tokens/_md-comp-outlined-card.scss +86 -0
  310. package/tokens/_md-comp-outlined-field.scss +268 -0
  311. package/tokens/_md-comp-outlined-icon-button.scss +117 -0
  312. package/tokens/_md-comp-outlined-segmented-button.scss +123 -0
  313. package/tokens/_md-comp-outlined-select.scss +186 -0
  314. package/tokens/_md-comp-outlined-text-field.scss +187 -0
  315. package/tokens/_md-comp-primary-tab.scss +160 -0
  316. package/tokens/_md-comp-radio.scss +86 -0
  317. package/tokens/_md-comp-ripple.scss +48 -0
  318. package/tokens/_md-comp-secondary-tab.scss +158 -0
  319. package/tokens/_md-comp-slider.scss +117 -0
  320. package/tokens/_md-comp-suggestion-chip.scss +157 -0
  321. package/tokens/_md-comp-switch.scss +187 -0
  322. package/tokens/_md-comp-test-table.scss +43 -0
  323. package/tokens/_md-comp-text-button.scss +132 -0
  324. package/tokens/_md-ref-palette.scss +112 -0
  325. package/tokens/_md-ref-typeface.scss +46 -0
  326. package/tokens/_md-sys-color.scss +119 -0
  327. package/tokens/_md-sys-elevation.scss +31 -0
  328. package/tokens/_md-sys-motion.scss +12 -0
  329. package/tokens/_md-sys-shape.scss +102 -0
  330. package/tokens/_md-sys-state.scss +12 -0
  331. package/tokens/_md-sys-typescale.scss +149 -0
  332. package/tokens/internal/_shape.scss +93 -0
  333. package/tokens/internal/_validate.scss +109 -0
  334. package/tokens/v0_192/_index.scss +107 -0
  335. package/tokens/v0_192/_md-comp-assist-chip.scss +111 -0
  336. package/tokens/v0_192/_md-comp-badge.scss +61 -0
  337. package/tokens/v0_192/_md-comp-banner.scss +76 -0
  338. package/tokens/v0_192/_md-comp-bottom-app-bar.scss +36 -0
  339. package/tokens/v0_192/_md-comp-carousel-item.scss +66 -0
  340. package/tokens/v0_192/_md-comp-checkbox.scss +129 -0
  341. package/tokens/v0_192/_md-comp-circular-progress-indicator.scss +41 -0
  342. package/tokens/v0_192/_md-comp-data-table.scss +99 -0
  343. package/tokens/v0_192/_md-comp-date-input-modal.scss +90 -0
  344. package/tokens/v0_192/_md-comp-date-picker-docked.scss +247 -0
  345. package/tokens/v0_192/_md-comp-date-picker-modal.scss +306 -0
  346. package/tokens/v0_192/_md-comp-dialog.scss +124 -0
  347. package/tokens/v0_192/_md-comp-divider.scss +28 -0
  348. package/tokens/v0_192/_md-comp-elevated-button.scss +92 -0
  349. package/tokens/v0_192/_md-comp-elevated-card.scss +60 -0
  350. package/tokens/v0_192/_md-comp-extended-fab-branded.scss +89 -0
  351. package/tokens/v0_192/_md-comp-extended-fab-primary.scss +97 -0
  352. package/tokens/v0_192/_md-comp-extended-fab-secondary.scss +98 -0
  353. package/tokens/v0_192/_md-comp-extended-fab-surface.scss +93 -0
  354. package/tokens/v0_192/_md-comp-extended-fab-tertiary.scss +98 -0
  355. package/tokens/v0_192/_md-comp-fab-branded-large.scss +63 -0
  356. package/tokens/v0_192/_md-comp-fab-branded.scss +63 -0
  357. package/tokens/v0_192/_md-comp-fab-primary-large.scss +68 -0
  358. package/tokens/v0_192/_md-comp-fab-primary-small.scss +68 -0
  359. package/tokens/v0_192/_md-comp-fab-primary.scss +68 -0
  360. package/tokens/v0_192/_md-comp-fab-secondary-large.scss +69 -0
  361. package/tokens/v0_192/_md-comp-fab-secondary-small.scss +69 -0
  362. package/tokens/v0_192/_md-comp-fab-secondary.scss +69 -0
  363. package/tokens/v0_192/_md-comp-fab-surface-large.scss +67 -0
  364. package/tokens/v0_192/_md-comp-fab-surface-small.scss +67 -0
  365. package/tokens/v0_192/_md-comp-fab-surface.scss +67 -0
  366. package/tokens/v0_192/_md-comp-fab-tertiary-large.scss +69 -0
  367. package/tokens/v0_192/_md-comp-fab-tertiary-small.scss +69 -0
  368. package/tokens/v0_192/_md-comp-fab-tertiary.scss +69 -0
  369. package/tokens/v0_192/_md-comp-filled-autocomplete.scss +239 -0
  370. package/tokens/v0_192/_md-comp-filled-button.scss +92 -0
  371. package/tokens/v0_192/_md-comp-filled-card.scss +62 -0
  372. package/tokens/v0_192/_md-comp-filled-icon-button.scss +83 -0
  373. package/tokens/v0_192/_md-comp-filled-menu-button.scss +101 -0
  374. package/tokens/v0_192/_md-comp-filled-select.scss +273 -0
  375. package/tokens/v0_192/_md-comp-filled-text-field.scss +193 -0
  376. package/tokens/v0_192/_md-comp-filled-tonal-button.scss +102 -0
  377. package/tokens/v0_192/_md-comp-filled-tonal-icon-button.scss +90 -0
  378. package/tokens/v0_192/_md-comp-filter-chip.scss +210 -0
  379. package/tokens/v0_192/_md-comp-full-screen-dialog.scss +114 -0
  380. package/tokens/v0_192/_md-comp-icon-button.scss +74 -0
  381. package/tokens/v0_192/_md-comp-input-chip.scss +187 -0
  382. package/tokens/v0_192/_md-comp-linear-progress-indicator.scss +43 -0
  383. package/tokens/v0_192/_md-comp-list.scss +255 -0
  384. package/tokens/v0_192/_md-comp-menu.scss +44 -0
  385. package/tokens/v0_192/_md-comp-navigation-bar.scss +115 -0
  386. package/tokens/v0_192/_md-comp-navigation-drawer.scss +165 -0
  387. package/tokens/v0_192/_md-comp-navigation-rail.scss +119 -0
  388. package/tokens/v0_192/_md-comp-outlined-autocomplete.scss +229 -0
  389. package/tokens/v0_192/_md-comp-outlined-button.scss +87 -0
  390. package/tokens/v0_192/_md-comp-outlined-card.scss +66 -0
  391. package/tokens/v0_192/_md-comp-outlined-icon-button.scss +83 -0
  392. package/tokens/v0_192/_md-comp-outlined-menu-button.scss +97 -0
  393. package/tokens/v0_192/_md-comp-outlined-segmented-button.scss +115 -0
  394. package/tokens/v0_192/_md-comp-outlined-select.scss +263 -0
  395. package/tokens/v0_192/_md-comp-outlined-text-field.scss +174 -0
  396. package/tokens/v0_192/_md-comp-plain-tooltip.scss +58 -0
  397. package/tokens/v0_192/_md-comp-primary-navigation-tab.scss +124 -0
  398. package/tokens/v0_192/_md-comp-radio-button.scss +71 -0
  399. package/tokens/v0_192/_md-comp-rich-tooltip.scss +122 -0
  400. package/tokens/v0_192/_md-comp-scrim.scss +28 -0
  401. package/tokens/v0_192/_md-comp-search-bar.scss +100 -0
  402. package/tokens/v0_192/_md-comp-search-view.scss +94 -0
  403. package/tokens/v0_192/_md-comp-secondary-navigation-tab.scss +87 -0
  404. package/tokens/v0_192/_md-comp-sheet-bottom.scss +46 -0
  405. package/tokens/v0_192/_md-comp-sheet-floating.scss +35 -0
  406. package/tokens/v0_192/_md-comp-sheet-side.scss +94 -0
  407. package/tokens/v0_192/_md-comp-slider.scss +118 -0
  408. package/tokens/v0_192/_md-comp-snackbar.scss +130 -0
  409. package/tokens/v0_192/_md-comp-standard-menu-button.scss +101 -0
  410. package/tokens/v0_192/_md-comp-suggestion-chip.scss +127 -0
  411. package/tokens/v0_192/_md-comp-switch.scss +141 -0
  412. package/tokens/v0_192/_md-comp-text-button.scss +80 -0
  413. package/tokens/v0_192/_md-comp-time-input.scss +220 -0
  414. package/tokens/v0_192/_md-comp-time-picker.scss +267 -0
  415. package/tokens/v0_192/_md-comp-top-app-bar-large.scss +64 -0
  416. package/tokens/v0_192/_md-comp-top-app-bar-medium.scss +64 -0
  417. package/tokens/v0_192/_md-comp-top-app-bar-small-centered.scss +71 -0
  418. package/tokens/v0_192/_md-comp-top-app-bar-small.scss +67 -0
  419. package/tokens/v0_192/_md-ref-palette.scss +109 -0
  420. package/tokens/v0_192/_md-ref-typeface.scss +23 -0
  421. package/tokens/v0_192/_md-sys-color.scss +135 -0
  422. package/tokens/v0_192/_md-sys-elevation.scss +24 -0
  423. package/tokens/v0_192/_md-sys-motion.scss +55 -0
  424. package/tokens/v0_192/_md-sys-shape.scss +33 -0
  425. package/tokens/v0_192/_md-sys-state.scss +22 -0
  426. package/tokens/v0_192/_md-sys-typescale.scss +286 -0
  427. package/tokens/v0_192/index.test.css +1 -0
  428. package/tokens/v0_192/index.test.css.map +1 -0
  429. package/tokens/v0_192/index.test.scss +584 -0
  430. package/tokens/v0_192/lib.test.css +1 -0
  431. package/tokens/v0_192/lib.test.css.map +1 -0
  432. package/tokens/v0_192/lib.test.scss +663 -0
  433. package/utils/storybook/getStorybookHelpers.js +0 -1
  434. package/utils/storybook/getStorybookHelpers.js.map +1 -1
  435. package/utils/storybook/scopedWcDecorator.js +1 -0
  436. package/utils/storybook/scopedWcDecorator.js.map +1 -1
  437. package/utils/storybook/stories/components/knob-ui-components.d.ts +103 -0
  438. package/utils/storybook/stories/components/knob-ui-components.js +414 -0
  439. package/utils/storybook/stories/components/knob-ui-components.js.map +1 -0
  440. package/utils/storybook/stories/components/stories-renderer.d.ts +40 -0
  441. package/utils/storybook/stories/components/stories-renderer.js +204 -0
  442. package/utils/storybook/stories/components/stories-renderer.js.map +1 -0
  443. package/utils/storybook/stories/components/story-knob-panel.d.ts +53 -0
  444. package/utils/storybook/stories/components/story-knob-panel.js +333 -0
  445. package/utils/storybook/stories/components/story-knob-panel.js.map +1 -0
  446. package/utils/storybook/stories/components/story-renderer.d.ts +27 -0
  447. package/utils/storybook/stories/components/story-renderer.js +84 -0
  448. package/utils/storybook/stories/components/story-renderer.js.map +1 -0
  449. package/utils/storybook/stories/index.d.ts +8 -0
  450. package/utils/storybook/stories/index.js +11 -0
  451. package/utils/storybook/stories/index.js.map +1 -0
  452. package/utils/storybook/stories/knobs.d.ts +143 -0
  453. package/utils/storybook/stories/knobs.js +177 -0
  454. package/utils/storybook/stories/knobs.js.map +1 -0
  455. package/utils/storybook/stories/material-collection.d.ts +75 -0
  456. package/utils/storybook/stories/material-collection.js +59 -0
  457. package/utils/storybook/stories/material-collection.js.map +1 -0
  458. package/utils/storybook/stories/story.d.ts +85 -0
  459. package/utils/storybook/stories/story.js +142 -0
  460. package/utils/storybook/stories/story.js.map +1 -0
  461. package/utils/storybook/stories/theme-loader.d.ts +13 -0
  462. package/utils/storybook/stories/theme-loader.js +43 -0
  463. package/utils/storybook/stories/theme-loader.js.map +1 -0
  464. package/utils/storybook/themingDecorator.d.ts +15 -2
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Re-dispatches an event from the provided element.
8
+ *
9
+ * This function is useful for forwarding non-composed events, such as `change`
10
+ * events.
11
+ *
12
+ * @example
13
+ * class MyInput extends LitElement {
14
+ * render() {
15
+ * return html`<input @change=${this.redispatchEvent}>`;
16
+ * }
17
+ *
18
+ * protected redispatchEvent(event: Event) {
19
+ * redispatchEvent(this, event);
20
+ * }
21
+ * }
22
+ *
23
+ * @param element The element to dispatch the event from.
24
+ * @param event The event to re-dispatch.
25
+ * @return Whether or not the event was dispatched (if cancelable).
26
+ */
27
+ export function redispatchEvent(element, event) {
28
+ // For bubbling events in SSR light DOM (or composed), stop their propagation
29
+ // and dispatch the copy.
30
+ if (event.bubbles && (!element.shadowRoot || event.composed)) {
31
+ event.stopPropagation();
32
+ }
33
+ const copy = Reflect.construct(event.constructor, [event.type, event]);
34
+ const dispatched = element.dispatchEvent(copy);
35
+ if (!dispatched) {
36
+ event.preventDefault();
37
+ }
38
+ return dispatched;
39
+ }
40
+ //# sourceMappingURL=redispatch-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redispatch-event.js","sourceRoot":"","sources":["redispatch-event.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB,EAAE,KAAY;IAC5D,6EAA6E;IAC7E,yBAAyB;IACzB,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7D,KAAK,CAAC,eAAe,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,KAAK,CAAC,cAAc,EAAE,CAAC;IACzB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Re-dispatches an event from the provided element.\n *\n * This function is useful for forwarding non-composed events, such as `change`\n * events.\n *\n * @example\n * class MyInput extends LitElement {\n * render() {\n * return html`<input @change=${this.redispatchEvent}>`;\n * }\n *\n * protected redispatchEvent(event: Event) {\n * redispatchEvent(this, event);\n * }\n * }\n *\n * @param element The element to dispatch the event from.\n * @param event The event to re-dispatch.\n * @return Whether or not the event was dispatched (if cancelable).\n */\nexport function redispatchEvent(element: Element, event: Event) {\n // For bubbling events in SSR light DOM (or composed), stop their propagation\n // and dispatch the copy.\n if (event.bubbles && (!element.shadowRoot || event.composed)) {\n event.stopPropagation();\n }\n\n const copy = Reflect.construct(event.constructor, [event.type, event]);\n const dispatched = element.dispatchEvent(copy);\n if (!dispatched) {\n event.preventDefault();\n }\n\n return dispatched;\n}\n"]}
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2021 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ $standard-easing: cubic-bezier(0.4, 0, 0.2, 1);
7
+ $acceleration-easing: cubic-bezier(0.4, 0, 1, 1);
8
+ $deceleration-easing: cubic-bezier(0, 0, 0.2, 1);
9
+ $sharp-easing: cubic-bezier(0.4, 0, 0.6, 1);
10
+
11
+ @function standard($name, $duration, $delay: null) {
12
+ @return _animation($name, $duration, $standard-easing, $delay);
13
+ }
14
+
15
+ @function acceleration($name, $duration, $delay: null) {
16
+ @return _animation($name, $duration, $acceleration-easing, $delay);
17
+ }
18
+
19
+ @function deceleration($name, $duration, $delay: null) {
20
+ @return _animation($name, $duration, $deceleration-easing, $delay);
21
+ }
22
+
23
+ @function sharp($name, $duration, $delay: null) {
24
+ @return _animation($name, $duration, $sharp-easing, $delay);
25
+ }
26
+
27
+ @function _animation($name, $duration, $easing, $delay) {
28
+ @if $delay {
29
+ @return $name $duration $easing $delay;
30
+ }
31
+
32
+ @return $name $duration $easing;
33
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Easing functions to use for web animations.
8
+ *
9
+ * **NOTE:** `EASING.EMPHASIZED` is approximated with unknown accuracy.
10
+ *
11
+ * TODO(b/241113345): replace with tokens
12
+ */
13
+ export declare const EASING: {
14
+ readonly STANDARD: "cubic-bezier(0.2, 0, 0, 1)";
15
+ readonly STANDARD_ACCELERATE: "cubic-bezier(.3,0,1,1)";
16
+ readonly STANDARD_DECELERATE: "cubic-bezier(0,0,0,1)";
17
+ readonly EMPHASIZED: "cubic-bezier(.3,0,0,1)";
18
+ readonly EMPHASIZED_ACCELERATE: "cubic-bezier(.3,0,.8,.15)";
19
+ readonly EMPHASIZED_DECELERATE: "cubic-bezier(.05,.7,.1,1)";
20
+ };
21
+ /**
22
+ * A signal that is used for abortable tasks.
23
+ */
24
+ export interface AnimationSignal {
25
+ /**
26
+ * Starts the abortable task. Any previous tasks started with this instance
27
+ * will be aborted.
28
+ *
29
+ * @return An `AbortSignal` for the current task.
30
+ */
31
+ start(): AbortSignal;
32
+ /**
33
+ * Complete the current task.
34
+ */
35
+ finish(): void;
36
+ }
37
+ /**
38
+ * Creates an `AnimationSignal` that can be used to cancel a previous task.
39
+ *
40
+ * @example
41
+ * class MyClass {
42
+ * private labelAnimationSignal = createAnimationSignal();
43
+ *
44
+ * private async animateLabel() {
45
+ * // Start of the task. Previous tasks will be canceled.
46
+ * const signal = this.labelAnimationSignal.start();
47
+ *
48
+ * // Do async work...
49
+ * if (signal.aborted) {
50
+ * // Use AbortSignal to check if a request was made to abort after some
51
+ * // asynchronous work.
52
+ * return;
53
+ * }
54
+ *
55
+ * const animation = this.animate(...);
56
+ * // Add event listeners to be notified when the task should be canceled.
57
+ * signal.addEventListener('abort', () => {
58
+ * animation.cancel();
59
+ * });
60
+ *
61
+ * animation.addEventListener('finish', () => {
62
+ * // Tell the signal that the current task is finished.
63
+ * this.labelAnimationSignal.finish();
64
+ * });
65
+ * }
66
+ * }
67
+ *
68
+ * @return An `AnimationSignal`.
69
+ */
70
+ export declare function createAnimationSignal(): AnimationSignal;
71
+ /**
72
+ * Returns a function which can be used to throttle function calls
73
+ * mapped to a key via a given function that should produce a promise that
74
+ * determines the throttle amount (defaults to requestAnimationFrame).
75
+ */
76
+ export declare function createThrottle(): (key: string | undefined, cb: (...args: unknown[]) => unknown, timeout?: () => Promise<void>) => Promise<void>;
77
+ /**
78
+ * Parses an number in milliseconds from a css time value
79
+ */
80
+ export declare function msFromTimeCSSValue(value: string): number;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Easing functions to use for web animations.
8
+ *
9
+ * **NOTE:** `EASING.EMPHASIZED` is approximated with unknown accuracy.
10
+ *
11
+ * TODO(b/241113345): replace with tokens
12
+ */
13
+ export const EASING = {
14
+ STANDARD: 'cubic-bezier(0.2, 0, 0, 1)',
15
+ STANDARD_ACCELERATE: 'cubic-bezier(.3,0,1,1)',
16
+ STANDARD_DECELERATE: 'cubic-bezier(0,0,0,1)',
17
+ EMPHASIZED: 'cubic-bezier(.3,0,0,1)',
18
+ EMPHASIZED_ACCELERATE: 'cubic-bezier(.3,0,.8,.15)',
19
+ EMPHASIZED_DECELERATE: 'cubic-bezier(.05,.7,.1,1)',
20
+ };
21
+ /**
22
+ * Creates an `AnimationSignal` that can be used to cancel a previous task.
23
+ *
24
+ * @example
25
+ * class MyClass {
26
+ * private labelAnimationSignal = createAnimationSignal();
27
+ *
28
+ * private async animateLabel() {
29
+ * // Start of the task. Previous tasks will be canceled.
30
+ * const signal = this.labelAnimationSignal.start();
31
+ *
32
+ * // Do async work...
33
+ * if (signal.aborted) {
34
+ * // Use AbortSignal to check if a request was made to abort after some
35
+ * // asynchronous work.
36
+ * return;
37
+ * }
38
+ *
39
+ * const animation = this.animate(...);
40
+ * // Add event listeners to be notified when the task should be canceled.
41
+ * signal.addEventListener('abort', () => {
42
+ * animation.cancel();
43
+ * });
44
+ *
45
+ * animation.addEventListener('finish', () => {
46
+ * // Tell the signal that the current task is finished.
47
+ * this.labelAnimationSignal.finish();
48
+ * });
49
+ * }
50
+ * }
51
+ *
52
+ * @return An `AnimationSignal`.
53
+ */
54
+ export function createAnimationSignal() {
55
+ // The current animation's AbortController
56
+ let animationAbortController = null;
57
+ return {
58
+ start() {
59
+ // Tell the previous animation to cancel.
60
+ animationAbortController?.abort();
61
+ // Set up a new AbortController for the current animation.
62
+ animationAbortController = new AbortController();
63
+ // Provide the AbortSignal so that the caller can check aborted status
64
+ // and add listeners.
65
+ return animationAbortController.signal;
66
+ },
67
+ finish() {
68
+ animationAbortController = null;
69
+ },
70
+ };
71
+ }
72
+ /**
73
+ * Returns a function which can be used to throttle function calls
74
+ * mapped to a key via a given function that should produce a promise that
75
+ * determines the throttle amount (defaults to requestAnimationFrame).
76
+ */
77
+ export function createThrottle() {
78
+ const stack = new Set();
79
+ return async (key = '', cb, timeout = async () => {
80
+ await new Promise(requestAnimationFrame);
81
+ }) => {
82
+ if (!stack.has(key)) {
83
+ stack.add(key);
84
+ await timeout();
85
+ if (stack.has(key)) {
86
+ stack.delete(key);
87
+ cb();
88
+ }
89
+ }
90
+ };
91
+ }
92
+ /**
93
+ * Parses an number in milliseconds from a css time value
94
+ */
95
+ export function msFromTimeCSSValue(value) {
96
+ const match = value.trim().match(/([\d.]+)(\s*s$)?/);
97
+ const time = match?.[1];
98
+ const seconds = match?.[2];
99
+ return Number(time ?? 0) * (seconds ? 1000 : 1);
100
+ }
101
+ //# sourceMappingURL=animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation.js","sourceRoot":"","sources":["animation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,QAAQ,EAAE,4BAA4B;IACtC,mBAAmB,EAAE,wBAAwB;IAC7C,mBAAmB,EAAE,uBAAuB;IAC5C,UAAU,EAAE,wBAAwB;IACpC,qBAAqB,EAAE,2BAA2B;IAClD,qBAAqB,EAAE,2BAA2B;CAC1C,CAAC;AAmBX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,qBAAqB;IACnC,0CAA0C;IAC1C,IAAI,wBAAwB,GAA2B,IAAI,CAAC;IAE5D,OAAO;QACL,KAAK;YACH,yCAAyC;YACzC,wBAAwB,EAAE,KAAK,EAAE,CAAC;YAClC,0DAA0D;YAC1D,wBAAwB,GAAG,IAAI,eAAe,EAAE,CAAC;YACjD,sEAAsE;YACtE,qBAAqB;YACrB,OAAO,wBAAwB,CAAC,MAAM,CAAC;QACzC,CAAC;QACD,MAAM;YACJ,wBAAwB,GAAG,IAAI,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACxB,OAAO,KAAK,EACV,GAAG,GAAG,EAAE,EACR,EAAmC,EACnC,OAAO,GAAG,KAAK,IAAI,EAAE;QACnB,MAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,CAAC,EACD,EAAE;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACf,MAAM,OAAO,EAAE,CAAC;YAChB,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAClB,EAAE,EAAE,CAAC;YACP,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Easing functions to use for web animations.\n *\n * **NOTE:** `EASING.EMPHASIZED` is approximated with unknown accuracy.\n *\n * TODO(b/241113345): replace with tokens\n */\nexport const EASING = {\n STANDARD: 'cubic-bezier(0.2, 0, 0, 1)',\n STANDARD_ACCELERATE: 'cubic-bezier(.3,0,1,1)',\n STANDARD_DECELERATE: 'cubic-bezier(0,0,0,1)',\n EMPHASIZED: 'cubic-bezier(.3,0,0,1)',\n EMPHASIZED_ACCELERATE: 'cubic-bezier(.3,0,.8,.15)',\n EMPHASIZED_DECELERATE: 'cubic-bezier(.05,.7,.1,1)',\n} as const;\n\n/**\n * A signal that is used for abortable tasks.\n */\nexport interface AnimationSignal {\n /**\n * Starts the abortable task. Any previous tasks started with this instance\n * will be aborted.\n *\n * @return An `AbortSignal` for the current task.\n */\n start(): AbortSignal;\n /**\n * Complete the current task.\n */\n finish(): void;\n}\n\n/**\n * Creates an `AnimationSignal` that can be used to cancel a previous task.\n *\n * @example\n * class MyClass {\n * private labelAnimationSignal = createAnimationSignal();\n *\n * private async animateLabel() {\n * // Start of the task. Previous tasks will be canceled.\n * const signal = this.labelAnimationSignal.start();\n *\n * // Do async work...\n * if (signal.aborted) {\n * // Use AbortSignal to check if a request was made to abort after some\n * // asynchronous work.\n * return;\n * }\n *\n * const animation = this.animate(...);\n * // Add event listeners to be notified when the task should be canceled.\n * signal.addEventListener('abort', () => {\n * animation.cancel();\n * });\n *\n * animation.addEventListener('finish', () => {\n * // Tell the signal that the current task is finished.\n * this.labelAnimationSignal.finish();\n * });\n * }\n * }\n *\n * @return An `AnimationSignal`.\n */\nexport function createAnimationSignal(): AnimationSignal {\n // The current animation's AbortController\n let animationAbortController: AbortController | null = null;\n\n return {\n start() {\n // Tell the previous animation to cancel.\n animationAbortController?.abort();\n // Set up a new AbortController for the current animation.\n animationAbortController = new AbortController();\n // Provide the AbortSignal so that the caller can check aborted status\n // and add listeners.\n return animationAbortController.signal;\n },\n finish() {\n animationAbortController = null;\n },\n };\n}\n\n/**\n * Returns a function which can be used to throttle function calls\n * mapped to a key via a given function that should produce a promise that\n * determines the throttle amount (defaults to requestAnimationFrame).\n */\nexport function createThrottle() {\n const stack = new Set();\n return async (\n key = '',\n cb: (...args: unknown[]) => unknown,\n timeout = async () => {\n await new Promise(requestAnimationFrame);\n },\n ) => {\n if (!stack.has(key)) {\n stack.add(key);\n await timeout();\n if (stack.has(key)) {\n stack.delete(key);\n cb();\n }\n }\n };\n}\n\n/**\n * Parses an number in milliseconds from a css time value\n */\nexport function msFromTimeCSSValue(value: string) {\n const match = value.trim().match(/([\\d.]+)(\\s*s$)?/);\n const time = match?.[1];\n const seconds = match?.[2];\n return Number(time ?? 0) * (seconds ? 1000 : 1);\n}\n"]}
@@ -0,0 +1,195 @@
1
+ //
2
+ // Copyright 2021 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ // go/keep-sorted start
7
+ @use 'sass:list';
8
+ @use 'sass:string';
9
+ // go/keep-sorted end
10
+
11
+ /// Checks if a string starts with a given prefix.
12
+ ///
13
+ /// @example - scss
14
+ /// @debug has-prefix('var(--foo)', 'var('); // true
15
+ ///
16
+ /// @param {String} $string - The string to test.
17
+ /// @param {String} $prefix - The prefix to check.
18
+ /// @return {Boolean} True if the string starts with the given prefix.
19
+ @function has-prefix($string, $prefix) {
20
+ @return string.slice($string, 1, string.length($prefix)) == $prefix;
21
+ }
22
+
23
+ /// Checks if a string ends with a given suffix.
24
+ ///
25
+ /// @example - scss
26
+ /// @debug has-suffix('var(--foo)', ')'); // true
27
+ ///
28
+ /// @param {String} $string - The string to test.
29
+ /// @param {String} $suffix - The suffix to check.
30
+ /// @return {Boolean} True if the string ends with the given suffix.
31
+ @function has-suffix($string, $suffix) {
32
+ @return string.slice($string, -1 * string.length($suffix)) == $suffix;
33
+ }
34
+
35
+ /// Trims a repeating prefix from the start of a string.
36
+ ///
37
+ /// @example - scss
38
+ /// @debug trim-repeating-prefix(' foo bar ', ' '); // "foo bar "
39
+ ///
40
+ /// @param {String} $string - The string to trim.
41
+ /// @param {String} $prefix - The repeating prefix string to trim.
42
+ /// @return {String} The string with the prefix trimmed from the start.
43
+ @function trim-repeating-prefix($string, $prefix) {
44
+ @while has-prefix($string, $prefix) {
45
+ $string: trim-prefix($string, $prefix);
46
+ }
47
+
48
+ @return $string;
49
+ }
50
+
51
+ /// Trims a prefix from the start of a string.
52
+ ///
53
+ /// @example - scss
54
+ /// @debug trim-prefix('var(--foo)', 'var('); // "--foo)"
55
+ ///
56
+ /// @param {String} $string - The string to trim.
57
+ /// @param {String} $prefix - The prefix string to trim.
58
+ /// @return {String} The string with the prefix trimmed from the start.
59
+ @function trim-prefix($string, $prefix) {
60
+ @if has-prefix($string, $prefix) {
61
+ $string: string.slice($string, string.length($prefix) + 1);
62
+ }
63
+
64
+ @return $string;
65
+ }
66
+
67
+ /// Trims a repeating suffix from the end of a string.
68
+ ///
69
+ /// @example - scss
70
+ /// @debug trim-repeating-suffix(' foo bar ', ' '); // " foo bar"
71
+ /// @debug trim-repeating-suffix('var(--foo)', ')'); // "var(--foo"
72
+ ///
73
+ /// @param {String} $string - The string to trim.
74
+ /// @param {String} $suffix - The repeating suffix string to trim.
75
+ /// @return {String} The string with the suffix trimmed from the end.
76
+ @function trim-repeating-suffix($string, $suffix) {
77
+ @while has-suffix($string, $suffix) {
78
+ $string: trim-suffix($string, $suffix);
79
+ }
80
+
81
+ @return $string;
82
+ }
83
+
84
+ /// Trims a suffix from the end of a string.
85
+ ///
86
+ /// @example - scss
87
+ /// @debug trim-suffix('var(--foo)', ')'); // "var(--foo"
88
+ ///
89
+ /// @param {String} $string - The string to trim.
90
+ /// @param {String} $suffix - The suffix string to trim.
91
+ /// @return {String} The string with the suffix trimmed from the end.
92
+ @function trim-suffix($string, $suffix) {
93
+ @if has-suffix($string, $suffix) {
94
+ $string: string.slice($string, 1, -1 * string.length($suffix) - 1);
95
+ }
96
+
97
+ @return $string;
98
+ }
99
+
100
+ /// Trims a repeating prefix and suffix from the start and end of a string.
101
+ ///
102
+ /// If a suffix is not provided, the prefix is used as the suffix to trim.
103
+ ///
104
+ /// @example - scss
105
+ /// @debug trim-repeating(' foo bar ', ' '); // "foo bar"
106
+ ///
107
+ /// @param {String} $string - The string to trim.
108
+ /// @param {String} $prefix - The repeating prefix string to trim.
109
+ /// @param {String} $suffix [$prefix] - The repeating suffix string to trim.
110
+ /// @return {String} The string with the prefix and suffix trimmed.
111
+ @function trim-repeating($string, $prefix, $suffix: $prefix) {
112
+ @return trim-repeating-prefix(
113
+ trim-repeating-suffix($string, $suffix),
114
+ $prefix
115
+ );
116
+ }
117
+
118
+ /// Trims a prefix and suffix from the start and end of a string.
119
+ ///
120
+ /// If a suffix is not provided, the prefix is used as the suffix to trim.
121
+ ///
122
+ /// @example - scss
123
+ /// @debug trim('var(--foo)', 'var(', ')'); // "--foo"
124
+ ///
125
+ /// @param {String} $string - The string to trim.
126
+ /// @param {String} $prefix - The prefix string to trim.
127
+ /// @param {String} $suffix [$prefix] - The suffix string to trim.
128
+ /// @return {String} The string with the prefix and suffix trimmed.
129
+ @function trim($string, $prefix, $suffix: $prefix) {
130
+ @return trim-prefix(trim-suffix($string, $suffix), $prefix);
131
+ }
132
+
133
+ /// Returns a new string with the first match of a pattern replaced by a
134
+ /// replacement.
135
+ ///
136
+ /// @example - scss
137
+ /// @debug trim('foo bar baz', 'bar', 'quux'); // "foo quux baz"
138
+ ///
139
+ /// @param {String} $string - The string to be searched.
140
+ /// @param {String} $pattern - The pattern to search for.
141
+ /// @param {String} $replacement - The value to replace the pattern.
142
+ /// @return {String} The string with the first match of pattern replaced by the
143
+ /// replacement or the initial string itself.
144
+ @function replace($string, $pattern, $replacement) {
145
+ $pattern-index: string.index($string, $pattern);
146
+ @if not $pattern-index {
147
+ @return $string;
148
+ }
149
+
150
+ $before: string.slice($string, 1, $pattern-index - 1);
151
+ $after: string.slice($string, string.length($pattern) + $pattern-index);
152
+
153
+ @return $before + $replacement + $after;
154
+ }
155
+
156
+ /// Divides a string into an ordered list of substrings.
157
+ ///
158
+ /// @example - scss
159
+ /// @debug split("1px 2px 3px 4px"); // (1px 2px 3px 4px)
160
+ /// @debug split("1px, 2px, 3px, 4px"); // (1px 2px 3px 4px)
161
+ /// @debug split("1px/2px/3px/4px"); // (1px 2px 3px 4px)
162
+ ///
163
+ /// @param {String} $str - The string to split
164
+ /// @return {List} The list of substrings
165
+ @function split($str) {
166
+ $list: ();
167
+ $item: '';
168
+ // list separator precedence is comma, slash, space
169
+ $separator: ' ';
170
+ @if string.index($str, ',') {
171
+ $separator: ',';
172
+ } @else if string.index($str, '/') {
173
+ $separator: '/';
174
+ }
175
+ @for $i from 1 through string.length($str) {
176
+ $chr: string.slice($str, $i, $i);
177
+ @if $chr == $separator {
178
+ @if $item != '' {
179
+ // remove surrounding whitespace
180
+ $item: string.unquote(trim($item, ' '));
181
+ $list: list.append($list, $item);
182
+ }
183
+ $item: '';
184
+ } @else {
185
+ $item: $item + $chr;
186
+ }
187
+ }
188
+ // append final item
189
+ @if $item != '' {
190
+ // remove surrounding whitespace
191
+ $item: string.unquote(trim($item, ' '));
192
+ $list: list.append($list, $item);
193
+ }
194
+ @return $list;
195
+ }