@shortfuse/materialdesignweb 0.7.6 → 0.9.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 (412) hide show
  1. package/README.md +87 -90
  2. package/bin/mdw-css.js +1 -1
  3. package/components/Badge.js +14 -7
  4. package/components/Body.js +3 -0
  5. package/components/BottomAppBar.js +4 -13
  6. package/components/BottomSheet.js +424 -0
  7. package/components/Box.js +20 -28
  8. package/components/Button.js +85 -79
  9. package/components/Button.md +9 -9
  10. package/components/Card.js +60 -72
  11. package/components/Checkbox.js +33 -42
  12. package/components/CheckboxIcon.js +11 -29
  13. package/components/Chip.js +13 -11
  14. package/components/Dialog.js +214 -394
  15. package/components/DialogActions.js +2 -2
  16. package/components/Display.js +55 -0
  17. package/components/Divider.js +3 -3
  18. package/components/Fab.js +83 -18
  19. package/components/FabContainer.js +48 -0
  20. package/components/FilterChip.js +35 -33
  21. package/components/Grid.js +176 -0
  22. package/components/Headline.js +5 -28
  23. package/components/Icon.js +61 -76
  24. package/components/IconButton.js +72 -126
  25. package/components/Input.js +859 -1
  26. package/components/InputChip.js +161 -0
  27. package/components/Label.js +3 -0
  28. package/components/List.js +4 -6
  29. package/components/ListItem.js +46 -30
  30. package/components/ListOption.js +86 -53
  31. package/components/Listbox.js +248 -0
  32. package/components/Menu.js +69 -528
  33. package/components/MenuItem.js +33 -36
  34. package/components/NavBar.js +49 -86
  35. package/components/NavDrawer.js +16 -15
  36. package/components/NavDrawerItem.js +4 -5
  37. package/components/NavItem.js +58 -41
  38. package/components/NavRail.js +30 -20
  39. package/components/NavRailItem.js +8 -3
  40. package/components/Page.js +105 -0
  41. package/components/Pane.js +11 -274
  42. package/components/Popup.js +29 -0
  43. package/components/Progress.js +24 -23
  44. package/components/Radio.js +40 -36
  45. package/components/RadioIcon.js +12 -16
  46. package/components/Ripple.js +13 -10
  47. package/components/Root.js +209 -0
  48. package/components/Scrim.js +87 -0
  49. package/components/Search.js +77 -0
  50. package/components/SegmentedButton.js +33 -45
  51. package/components/SegmentedButtonGroup.js +25 -13
  52. package/components/Select.js +10 -11
  53. package/components/Shape.js +5 -65
  54. package/components/SideSheet.js +308 -0
  55. package/components/Slider.js +108 -78
  56. package/components/Snackbar.js +26 -21
  57. package/components/SnackbarContainer.js +42 -0
  58. package/components/Surface.js +17 -12
  59. package/components/Switch.js +45 -24
  60. package/components/SwitchIcon.js +49 -39
  61. package/components/Tab.js +64 -43
  62. package/components/TabContent.js +5 -3
  63. package/components/TabList.js +62 -34
  64. package/components/TabPanel.js +11 -8
  65. package/components/Table.js +116 -0
  66. package/components/TextArea.js +54 -50
  67. package/components/Title.js +4 -9
  68. package/components/Tooltip.js +44 -22
  69. package/components/TopAppBar.js +68 -172
  70. package/constants/shapes.js +36 -0
  71. package/constants/typography.js +127 -0
  72. package/core/Composition.js +1164 -645
  73. package/core/CompositionAdapter.js +314 -0
  74. package/core/CustomElement.js +701 -286
  75. package/core/css.js +121 -15
  76. package/core/customTypes.js +157 -40
  77. package/core/dom.js +17 -11
  78. package/{utils → core}/jsonMergePatch.js +42 -18
  79. package/core/observe.js +343 -244
  80. package/core/optimizations.js +23 -0
  81. package/core/template.js +19 -56
  82. package/core/uid.js +13 -0
  83. package/dist/index.min.js +85 -184
  84. package/dist/index.min.js.map +4 -4
  85. package/dist/meta.json +1 -1
  86. package/dom/HTMLOptionsCollectionProxy.js +106 -0
  87. package/loaders/palette.js +13 -0
  88. package/loaders/theme.js +12 -0
  89. package/mixins/AriaReflectorMixin.js +53 -14
  90. package/mixins/AriaToolbarMixin.js +5 -3
  91. package/mixins/ControlMixin.js +92 -41
  92. package/mixins/DelegatesFocusMixin.js +54 -0
  93. package/mixins/DensityMixin.js +2 -3
  94. package/mixins/ElevationMixin.js +62 -0
  95. package/mixins/FlexableMixin.js +67 -39
  96. package/mixins/FormAssociatedMixin.js +71 -16
  97. package/mixins/HyperlinkMixin.js +66 -0
  98. package/mixins/InputMixin.js +205 -39
  99. package/mixins/KeyboardNavMixin.js +22 -7
  100. package/mixins/NavigationListenerMixin.js +33 -0
  101. package/mixins/PopupMixin.js +725 -0
  102. package/mixins/RTLObserverMixin.js +0 -1
  103. package/mixins/ResizeObserverMixin.js +16 -5
  104. package/mixins/RippleMixin.js +11 -10
  105. package/mixins/ScrollListenerMixin.js +42 -33
  106. package/mixins/SemiStickyMixin.js +97 -0
  107. package/mixins/ShapeMaskedMixin.js +117 -0
  108. package/mixins/ShapeMixin.js +17 -194
  109. package/mixins/StateMixin.js +80 -39
  110. package/mixins/TextFieldMixin.js +139 -183
  111. package/mixins/ThemableMixin.js +71 -161
  112. package/mixins/TooltipTriggerMixin.js +292 -366
  113. package/mixins/TouchTargetMixin.js +5 -4
  114. package/mixins/TypographyMixin.js +121 -0
  115. package/package.json +111 -71
  116. package/services/rtl.js +10 -0
  117. package/services/svgAlias.js +17 -0
  118. package/{theming/index.js → services/theme.js} +25 -175
  119. package/types/bin/mdw-css.d.ts +3 -0
  120. package/types/bin/mdw-css.d.ts.map +1 -0
  121. package/types/components/Badge.d.ts +39 -0
  122. package/types/components/Badge.d.ts.map +1 -0
  123. package/types/components/Body.d.ts +29 -0
  124. package/types/components/Body.d.ts.map +1 -0
  125. package/types/components/BottomAppBar.d.ts +73 -0
  126. package/types/components/BottomAppBar.d.ts.map +1 -0
  127. package/types/components/BottomSheet.d.ts +109 -0
  128. package/types/components/BottomSheet.d.ts.map +1 -0
  129. package/types/components/Box.d.ts +16 -0
  130. package/types/components/Box.d.ts.map +1 -0
  131. package/types/components/Button.d.ts +714 -0
  132. package/types/components/Button.d.ts.map +1 -0
  133. package/types/components/Card.d.ts +412 -0
  134. package/types/components/Card.d.ts.map +1 -0
  135. package/types/components/Checkbox.d.ts +205 -0
  136. package/types/components/Checkbox.d.ts.map +1 -0
  137. package/types/components/CheckboxIcon.d.ts +44 -0
  138. package/types/components/CheckboxIcon.d.ts.map +1 -0
  139. package/types/components/Chip.d.ts +1425 -0
  140. package/types/components/Chip.d.ts.map +1 -0
  141. package/types/components/Dialog.d.ts +286 -0
  142. package/types/components/Dialog.d.ts.map +1 -0
  143. package/types/components/DialogActions.d.ts +4 -0
  144. package/types/components/DialogActions.d.ts.map +1 -0
  145. package/types/components/Display.d.ts +45 -0
  146. package/types/components/Display.d.ts.map +1 -0
  147. package/types/components/Divider.d.ts +10 -0
  148. package/types/components/Divider.d.ts.map +1 -0
  149. package/types/components/Fab.d.ts +741 -0
  150. package/types/components/Fab.d.ts.map +1 -0
  151. package/types/components/FabContainer.d.ts +10 -0
  152. package/types/components/FabContainer.d.ts.map +1 -0
  153. package/types/components/FilterChip.d.ts +4283 -0
  154. package/types/components/FilterChip.d.ts.map +1 -0
  155. package/types/components/Grid.d.ts +37 -0
  156. package/types/components/Grid.d.ts.map +1 -0
  157. package/types/components/Headline.d.ts +47 -0
  158. package/types/components/Headline.d.ts.map +1 -0
  159. package/types/components/Icon.d.ts +103 -0
  160. package/types/components/Icon.d.ts.map +1 -0
  161. package/types/components/IconButton.d.ts +1486 -0
  162. package/types/components/IconButton.d.ts.map +1 -0
  163. package/types/components/Input.d.ts +51288 -0
  164. package/types/components/Input.d.ts.map +1 -0
  165. package/types/components/InputChip.d.ts +243 -0
  166. package/types/components/InputChip.d.ts.map +1 -0
  167. package/types/components/Label.d.ts +29 -0
  168. package/types/components/Label.d.ts.map +1 -0
  169. package/types/components/List.d.ts +31 -0
  170. package/types/components/List.d.ts.map +1 -0
  171. package/types/components/ListItem.d.ts +349 -0
  172. package/types/components/ListItem.d.ts.map +1 -0
  173. package/types/components/ListOption.d.ts +1493 -0
  174. package/types/components/ListOption.d.ts.map +1 -0
  175. package/types/components/Listbox.d.ts +12012 -0
  176. package/types/components/Listbox.d.ts.map +1 -0
  177. package/types/components/Menu.d.ts +119 -0
  178. package/types/components/Menu.d.ts.map +1 -0
  179. package/types/components/MenuItem.d.ts +3109 -0
  180. package/types/components/MenuItem.d.ts.map +1 -0
  181. package/types/components/NavBar.d.ts +18 -0
  182. package/types/components/NavBar.d.ts.map +1 -0
  183. package/types/components/NavBarItem.d.ts +186 -0
  184. package/types/components/NavBarItem.d.ts.map +1 -0
  185. package/types/components/NavDrawer.d.ts +108 -0
  186. package/types/components/NavDrawer.d.ts.map +1 -0
  187. package/types/components/NavDrawerItem.d.ts +186 -0
  188. package/types/components/NavDrawerItem.d.ts.map +1 -0
  189. package/types/components/NavItem.d.ts +190 -0
  190. package/types/components/NavItem.d.ts.map +1 -0
  191. package/types/components/NavRail.d.ts +109 -0
  192. package/types/components/NavRail.d.ts.map +1 -0
  193. package/types/components/NavRailItem.d.ts +186 -0
  194. package/types/components/NavRailItem.d.ts.map +1 -0
  195. package/types/components/Page.d.ts +24 -0
  196. package/types/components/Page.d.ts.map +1 -0
  197. package/types/components/Pane.d.ts +44 -0
  198. package/types/components/Pane.d.ts.map +1 -0
  199. package/types/components/Popup.d.ts +76 -0
  200. package/types/components/Popup.d.ts.map +1 -0
  201. package/types/components/Progress.d.ts +19 -0
  202. package/types/components/Progress.d.ts.map +1 -0
  203. package/types/components/Radio.d.ts +199 -0
  204. package/types/components/Radio.d.ts.map +1 -0
  205. package/types/components/RadioIcon.d.ts +46 -0
  206. package/types/components/RadioIcon.d.ts.map +1 -0
  207. package/types/components/Ripple.d.ts +34 -0
  208. package/types/components/Ripple.d.ts.map +1 -0
  209. package/types/components/Root.d.ts +68 -0
  210. package/types/components/Root.d.ts.map +1 -0
  211. package/types/components/Scrim.d.ts +6 -0
  212. package/types/components/Scrim.d.ts.map +1 -0
  213. package/types/components/Search.d.ts +16 -0
  214. package/types/components/Search.d.ts.map +1 -0
  215. package/types/components/SegmentedButton.d.ts +718 -0
  216. package/types/components/SegmentedButton.d.ts.map +1 -0
  217. package/types/components/SegmentedButtonGroup.d.ts +44 -0
  218. package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
  219. package/types/components/Select.d.ts +1361 -0
  220. package/types/components/Select.d.ts.map +1 -0
  221. package/types/components/Shape.d.ts +10 -0
  222. package/types/components/Shape.d.ts.map +1 -0
  223. package/types/components/SideSheet.d.ts +106 -0
  224. package/types/components/SideSheet.d.ts.map +1 -0
  225. package/types/components/Slider.d.ts +382 -0
  226. package/types/components/Slider.d.ts.map +1 -0
  227. package/types/components/Snackbar.d.ts +65 -0
  228. package/types/components/Snackbar.d.ts.map +1 -0
  229. package/types/components/SnackbarContainer.d.ts +6 -0
  230. package/types/components/SnackbarContainer.d.ts.map +1 -0
  231. package/types/components/Surface.d.ts +45 -0
  232. package/types/components/Surface.d.ts.map +1 -0
  233. package/types/components/Switch.d.ts +183 -0
  234. package/types/components/Switch.d.ts.map +1 -0
  235. package/types/components/SwitchIcon.d.ts +169 -0
  236. package/types/components/SwitchIcon.d.ts.map +1 -0
  237. package/types/components/Tab.d.ts +879 -0
  238. package/types/components/Tab.d.ts.map +1 -0
  239. package/types/components/TabContent.d.ts +122 -0
  240. package/types/components/TabContent.d.ts.map +1 -0
  241. package/types/components/TabList.d.ts +6266 -0
  242. package/types/components/TabList.d.ts.map +1 -0
  243. package/types/components/TabPanel.d.ts +28 -0
  244. package/types/components/TabPanel.d.ts.map +1 -0
  245. package/types/components/Table.d.ts +2 -0
  246. package/types/components/Table.d.ts.map +1 -0
  247. package/types/components/TextArea.d.ts +1394 -0
  248. package/types/components/TextArea.d.ts.map +1 -0
  249. package/types/components/Title.d.ts +47 -0
  250. package/types/components/Title.d.ts.map +1 -0
  251. package/types/components/Tooltip.d.ts +49 -0
  252. package/types/components/Tooltip.d.ts.map +1 -0
  253. package/types/components/TopAppBar.d.ts +130 -0
  254. package/types/components/TopAppBar.d.ts.map +1 -0
  255. package/types/constants/colorKeywords.d.ts +2 -0
  256. package/types/constants/colorKeywords.d.ts.map +1 -0
  257. package/types/constants/shapes.d.ts +38 -0
  258. package/types/constants/shapes.d.ts.map +1 -0
  259. package/types/constants/typography.d.ts +212 -0
  260. package/types/constants/typography.d.ts.map +1 -0
  261. package/types/core/Composition.d.ts +252 -0
  262. package/types/core/Composition.d.ts.map +1 -0
  263. package/types/core/CompositionAdapter.d.ts +92 -0
  264. package/types/core/CompositionAdapter.d.ts.map +1 -0
  265. package/types/core/CustomElement.d.ts +302 -0
  266. package/types/core/CustomElement.d.ts.map +1 -0
  267. package/types/core/css.d.ts +44 -0
  268. package/types/core/css.d.ts.map +1 -0
  269. package/types/core/customTypes.d.ts +26 -0
  270. package/types/core/customTypes.d.ts.map +1 -0
  271. package/types/core/dom.d.ts +32 -0
  272. package/types/core/dom.d.ts.map +1 -0
  273. package/types/core/jsonMergePatch.d.ts +31 -0
  274. package/types/core/jsonMergePatch.d.ts.map +1 -0
  275. package/types/core/observe.d.ts +113 -0
  276. package/types/core/observe.d.ts.map +1 -0
  277. package/types/core/optimizations.d.ts +7 -0
  278. package/types/core/optimizations.d.ts.map +1 -0
  279. package/types/core/template.d.ts +47 -0
  280. package/types/core/template.d.ts.map +1 -0
  281. package/types/core/uid.d.ts +6 -0
  282. package/types/core/uid.d.ts.map +1 -0
  283. package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
  284. package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
  285. package/types/index.d.ts +88 -0
  286. package/types/index.d.ts.map +1 -0
  287. package/types/loaders/palette.d.ts +2 -0
  288. package/types/loaders/palette.d.ts.map +1 -0
  289. package/types/loaders/theme.d.ts +2 -0
  290. package/types/loaders/theme.d.ts.map +1 -0
  291. package/types/mixins/AriaReflectorMixin.d.ts +23 -0
  292. package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
  293. package/types/mixins/AriaToolbarMixin.d.ts +32 -0
  294. package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
  295. package/types/mixins/ControlMixin.d.ts +124 -0
  296. package/types/mixins/ControlMixin.d.ts.map +1 -0
  297. package/types/mixins/DelegatesFocusMixin.d.ts +5 -0
  298. package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
  299. package/types/mixins/DensityMixin.d.ts +5 -0
  300. package/types/mixins/DensityMixin.d.ts.map +1 -0
  301. package/types/mixins/ElevationMixin.d.ts +33 -0
  302. package/types/mixins/ElevationMixin.d.ts.map +1 -0
  303. package/types/mixins/FlexableMixin.d.ts +13 -0
  304. package/types/mixins/FlexableMixin.d.ts.map +1 -0
  305. package/types/mixins/FormAssociatedMixin.d.ts +122 -0
  306. package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
  307. package/types/mixins/HyperlinkMixin.d.ts +22 -0
  308. package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
  309. package/types/mixins/InputMixin.d.ts +179 -0
  310. package/types/mixins/InputMixin.d.ts.map +1 -0
  311. package/types/mixins/KeyboardNavMixin.d.ts +47 -0
  312. package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
  313. package/types/mixins/NavigationListenerMixin.d.ts +8 -0
  314. package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
  315. package/types/mixins/PopupMixin.d.ts +82 -0
  316. package/types/mixins/PopupMixin.d.ts.map +1 -0
  317. package/types/mixins/RTLObserverMixin.d.ts +7 -0
  318. package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
  319. package/types/mixins/ResizeObserverMixin.d.ts +12 -0
  320. package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
  321. package/types/mixins/RippleMixin.d.ts +92 -0
  322. package/types/mixins/RippleMixin.d.ts.map +1 -0
  323. package/types/mixins/ScrollListenerMixin.d.ts +41 -0
  324. package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
  325. package/types/mixins/SemiStickyMixin.d.ts +50 -0
  326. package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
  327. package/types/mixins/ShapeMaskedMixin.d.ts +9 -0
  328. package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
  329. package/types/mixins/ShapeMixin.d.ts +38 -0
  330. package/types/mixins/ShapeMixin.d.ts.map +1 -0
  331. package/types/mixins/StateMixin.d.ts +27 -0
  332. package/types/mixins/StateMixin.d.ts.map +1 -0
  333. package/types/mixins/TextFieldMixin.d.ts +1354 -0
  334. package/types/mixins/TextFieldMixin.d.ts.map +1 -0
  335. package/types/mixins/ThemableMixin.d.ts +9 -0
  336. package/types/mixins/ThemableMixin.d.ts.map +1 -0
  337. package/types/mixins/TooltipTriggerMixin.d.ts +106 -0
  338. package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
  339. package/types/mixins/TouchTargetMixin.d.ts +3 -0
  340. package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
  341. package/types/mixins/TypographyMixin.d.ts +17 -0
  342. package/types/mixins/TypographyMixin.d.ts.map +1 -0
  343. package/types/services/rtl.d.ts +3 -0
  344. package/types/services/rtl.d.ts.map +1 -0
  345. package/types/services/svgAlias.d.ts +13 -0
  346. package/types/services/svgAlias.d.ts.map +1 -0
  347. package/types/services/theme.d.ts +45 -0
  348. package/types/services/theme.d.ts.map +1 -0
  349. package/types/utils/cli.d.ts +3 -0
  350. package/types/utils/cli.d.ts.map +1 -0
  351. package/types/utils/function.d.ts +3 -0
  352. package/types/utils/function.d.ts.map +1 -0
  353. package/types/utils/jsx-runtime.d.ts +20 -0
  354. package/types/utils/jsx-runtime.d.ts.map +1 -0
  355. package/types/utils/material-color/blend.d.ts +34 -0
  356. package/types/utils/material-color/blend.d.ts.map +1 -0
  357. package/types/utils/material-color/hct/Cam16.d.ts +142 -0
  358. package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
  359. package/types/utils/material-color/hct/Hct.d.ts +93 -0
  360. package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
  361. package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
  362. package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
  363. package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
  364. package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
  365. package/types/utils/material-color/helper.d.ts +8 -0
  366. package/types/utils/material-color/helper.d.ts.map +1 -0
  367. package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
  368. package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
  369. package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
  370. package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
  371. package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
  372. package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
  373. package/types/utils/material-color/utils/color.d.ts +172 -0
  374. package/types/utils/material-color/utils/color.d.ts.map +1 -0
  375. package/types/utils/material-color/utils/math.d.ts +94 -0
  376. package/types/utils/material-color/utils/math.d.ts.map +1 -0
  377. package/types/utils/pixelmatch.d.ts +22 -0
  378. package/types/utils/pixelmatch.d.ts.map +1 -0
  379. package/types/utils/popup.d.ts +106 -0
  380. package/types/utils/popup.d.ts.map +1 -0
  381. package/types/utils/searchParams.d.ts +3 -0
  382. package/types/utils/searchParams.d.ts.map +1 -0
  383. package/types/utils/svg.d.ts +7 -0
  384. package/types/utils/svg.d.ts.map +1 -0
  385. package/utils/{hct → material-color}/blend.js +8 -10
  386. package/utils/{hct → material-color/hct}/Cam16.js +196 -69
  387. package/utils/{hct → material-color/hct}/Hct.js +61 -19
  388. package/utils/{hct → material-color/hct}/ViewingConditions.js +3 -3
  389. package/utils/{hct → material-color/hct}/hctSolver.js +9 -16
  390. package/utils/{hct → material-color}/helper.js +11 -18
  391. package/utils/{hct → material-color/palettes}/CorePalette.js +79 -19
  392. package/utils/{hct → material-color/palettes}/TonalPalette.js +12 -4
  393. package/utils/material-color/scheme/Scheme.js +376 -0
  394. package/utils/{hct/colorUtils.js → material-color/utils/color.js} +61 -1
  395. package/utils/pixelmatch.js +360 -0
  396. package/utils/popup.js +127 -30
  397. package/utils/searchParams.js +19 -0
  398. package/components/ExtendedFab.js +0 -36
  399. package/components/Layout.js +0 -35
  400. package/components/ListSelect.js +0 -220
  401. package/components/Nav.js +0 -40
  402. package/components/Option.js +0 -91
  403. package/core/ICustomElement.d.ts +0 -291
  404. package/core/ICustomElement.js +0 -1
  405. package/core/identify.js +0 -40
  406. package/core/typings.d.ts +0 -136
  407. package/core/typings.js +0 -1
  408. package/mixins/SurfaceMixin.js +0 -181
  409. package/theming/loader.js +0 -22
  410. package/utils/hct/Scheme.js +0 -587
  411. /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
  412. /package/utils/{hct/mathUtils.js → material-color/utils/math.js} +0 -0
@@ -1,12 +1,13 @@
1
1
  /** @param {typeof import('../core/CustomElement.js').default} Base */
2
2
  export default function TouchTargetMixin(Base) {
3
3
  return Base
4
- .extend()
5
- .html/* html */`<div id=touch-target class=touch-target></div>`
4
+ .html`<div id=touch-target class=touch-target></div>`
6
5
  .css`
6
+ /* stylelint-disable liberty/use-logical-spec */
7
7
  .touch-target {
8
8
  position: absolute;
9
- inset: 50%;
9
+ top: 50%;
10
+ left: 50%;
10
11
  /* --mdw-device-pixel-ratio: 1; */
11
12
 
12
13
  block-size: 100%;
@@ -25,7 +26,7 @@ export default function TouchTargetMixin(Base) {
25
26
  pointer-events: auto;
26
27
 
27
28
  transform: translateX(-50%) translateY(-50%);
28
- visibility: visible;
29
+ visibility: inherit;
29
30
  z-index: 1;
30
31
 
31
32
  border-radius: inherit;
@@ -0,0 +1,121 @@
1
+ import DelegatesFocusMixin from './DelegatesFocusMixin.js';
2
+
3
+ /**
4
+ * @param {string} input
5
+ * @return {string}
6
+ */
7
+ function parseSize(input) {
8
+ if (!input) return '';
9
+ if (input.includes('px')) return input;
10
+ if (input.includes('em')) return input;
11
+ if (input.includes('ex')) return input;
12
+ return `calc(${input.replace('sp', '')} * 0.0625rem)`;
13
+ }
14
+
15
+ /** @param {typeof import('../core/CustomElement.js').default} Base */
16
+ export default function TypographyMixin(Base) {
17
+ return Base
18
+ .mixin(DelegatesFocusMixin)
19
+ .observe({
20
+ textPadding: 'string',
21
+ textPaddingTop: 'string',
22
+ textLeading: 'string',
23
+ textPaddingBottom: 'string',
24
+ })
25
+ .observe({
26
+ _computedTextPaddingTop({ textPaddingTop, textPadding }) {
27
+ return parseSize(textPaddingTop ?? textPadding);
28
+ },
29
+ _computedTextPaddingBottom({ textPaddingBottom, textPadding }) {
30
+ return parseSize(textPaddingBottom ?? textPadding);
31
+ },
32
+ _computedTextLeading({ textLeading }) {
33
+ return parseSize(textLeading);
34
+ },
35
+ })
36
+ .observe({
37
+ _beforeStyle({ _computedTextPaddingTop, _computedTextLeading }) {
38
+ if (_computedTextLeading) {
39
+ return `margin-top:${_computedTextLeading}`;
40
+ }
41
+ if (_computedTextPaddingTop) {
42
+ return `margin-top:${_computedTextPaddingTop}`;
43
+ }
44
+ return '';
45
+ },
46
+ _afterStyle({ _computedTextPaddingBottom }) {
47
+ if (_computedTextPaddingBottom) {
48
+ return `vertical-align:calc(-1em + (-1 * ${_computedTextPaddingBottom}));`;
49
+ }
50
+ return '';
51
+ },
52
+ })
53
+ .html`
54
+ <div id=wrapper style={_wrapperStyle} before={!!_beforeStyle} after={!!_afterStyle}
55
+ ><span id=before mdw-if={!!_beforeStyle} style={_beforeStyle} text-leading={textLeading}></span
56
+ ><span id=content before={!!_beforeStyle} after={!!_afterStyle}><span id=after mdw-if={!!_afterStyle} style={_afterStyle}></span></span
57
+ ></div>
58
+ `
59
+ .recompose(({ refs: { content, slot } }) => {
60
+ content.prepend(slot);
61
+ })
62
+ .css`
63
+ :host {
64
+ display: block;
65
+ }
66
+
67
+ :host(:where([text-padding],[text-padding-top],[text-padding-bottom])) {
68
+ display: flex;
69
+ }
70
+
71
+ #wrapper {
72
+ display: contents;
73
+
74
+ }
75
+
76
+ #wrapper:where([before], [after]) {
77
+ display: flex;
78
+ align-items: baseline; /* Allows growing element upwards without affecting text selection */
79
+
80
+ }
81
+
82
+ #wrapper[before] {
83
+ margin-block-start: -1em;
84
+ }
85
+
86
+ #wrapper[after] {
87
+ margin-block-end: -1em;
88
+ }
89
+
90
+ #before {
91
+ display: inline-block;
92
+
93
+ block-size: 1.4ex; /* Estimate */
94
+ padding-block-start: 1em; /* Padding to be cropped by wrapper */
95
+ }
96
+ @supports(height:1cap) {
97
+ #before {
98
+ block-size: 1cap;
99
+ }
100
+ }
101
+
102
+ #before[text-leading] {
103
+ block-size: 0;
104
+ }
105
+
106
+ #content {
107
+ display: contents;
108
+ }
109
+
110
+ #content:where([before], [after]) {
111
+ display: block;
112
+ }
113
+
114
+ #after {
115
+ display: inline-block;
116
+
117
+ padding-block-end: 1em; /* Padding to be cropped by wrapper */
118
+ }
119
+
120
+ `;
121
+ }
package/package.json CHANGED
@@ -1,96 +1,136 @@
1
1
  {
2
- "name": "@shortfuse/materialdesignweb",
3
- "version": "0.7.6",
4
- "description": "Material Design for Web",
5
- "type": "module",
2
+ "author": "Carlos Lopez Jr. <clshortfuse@gmail.com> (https://shortfuse.org/)",
6
3
  "bin": {
7
4
  "mdw-css": "./bin/mdw-css.js"
8
5
  },
9
- "scripts": {
10
- "prepublishOnly": "node build/esbuild.js index.js --outdir=dist --minify --metafile --production",
11
- "predocs": "node bin/mdw-css.js --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/theme.css",
12
- "predocs-alt": "node bin/mdw-css.js --color=a46750 --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/alt-theme.css",
13
- "docs": "node build/esbuild.js docs/demo.js --outdir=docs --minify --metafile",
14
- "watch": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile",
15
- "serve": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile --serve --live",
16
- "pretest": "eslint --ignore-path .gitignore",
17
- "test": "web-test-runner \"test/**/*.test.js\" --node-resolve",
18
- "test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --watch"
19
- },
20
6
  "browser": "dist/index.min.js",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/clshortfuse/materialdesignweb.git"
24
- },
25
- "keywords": [
26
- "material",
27
- "design",
28
- "web",
29
- "materialyou",
30
- "md3",
31
- "web-components"
32
- ],
33
- "files": [
34
- "/bin",
35
- "/dist",
36
- "/components",
37
- "/core",
38
- "/theming",
39
- "/mixins",
40
- "/utils"
41
- ],
42
- "exports": {
43
- "/components": "./components",
44
- "/core": "./core",
45
- "/theming": "./theming",
46
- "/mixins": "./mixins",
47
- "/utils": "./utils"
48
- },
49
- "author": "Carlos Lopez Jr. <clshortfuse@gmail.com> (https://shortfuse.org/)",
50
- "license": "ISC",
51
- "sideEffects": [
52
- "./polyfills.js",
53
- "./components/*.js",
54
- "./utils/metadata.js",
55
- "./theming/loader.js",
56
- "./docs/demo/*.js"
57
- ],
58
7
  "bugs": {
59
8
  "url": "https://github.com/clshortfuse/materialdesignweb/issues"
60
9
  },
61
- "homepage": "https://github.com/clshortfuse/materialdesignweb#readme",
10
+ "description": "Material Design for Web",
62
11
  "devDependencies": {
12
+ "@babel/preset-env": "^7.22.9",
63
13
  "@esm-bundle/chai": "^4.3.4-fix.0",
14
+ "@playwright/test": "^1.36.1",
15
+ "@rollup/plugin-babel": "^6.0.3",
16
+ "@rollup/plugin-node-resolve": "^15.1.0",
17
+ "@rollup/plugin-terser": "^0.4.3",
18
+ "@stylistic/stylelint-plugin": "^3.0.0",
19
+ "@types/clean-css": "^4.2.6",
64
20
  "@types/html-minifier-terser": "^7.0.0",
65
21
  "@types/mocha": "^10.0.1",
66
22
  "@types/tap": "^15.0.7",
67
- "@typescript-eslint/eslint-plugin": "^5.30.7",
68
- "@typescript-eslint/parser": "^5.30.7",
69
- "@web/test-runner": "^0.15.2",
70
- "@web/test-runner-playwright": "^0.9.0",
23
+ "@typescript-eslint/eslint-plugin": "^7.3.1",
24
+ "@typescript-eslint/parser": "^7.3.1",
25
+ "@web/test-runner": "^0.18.1",
26
+ "@web/test-runner-commands": "^0.9.0",
27
+ "@web/test-runner-playwright": "^0.11.0",
71
28
  "acorn": "^8.8.2",
72
29
  "acorn-walk": "^8.2.0",
73
- "browserslist-to-esbuild": "^1.1.1",
74
- "c8": "^7.12.0",
30
+ "browserslist-to-esbuild": "^2.1.1",
31
+ "clean-css": "^5.3.2",
75
32
  "element-internals-polyfill": "^1.1.11",
76
- "esbuild": "^0.17.12",
77
- "eslint": "^8.24.0",
33
+ "esbuild": "^0.20.2",
34
+ "esbuild-postcss": "^0.0.4",
35
+ "eslint": "^8.45.0",
78
36
  "eslint-config-airbnb-base": "^15.0.0",
79
- "eslint-plugin-compat": "^4.0.2",
80
- "eslint-plugin-github": "^4.3.5",
81
37
  "eslint-plugin-import": "^2.27.5",
82
- "eslint-plugin-jsdoc": "^40.0.3",
38
+ "eslint-plugin-jsdoc": "^48.2.1",
83
39
  "eslint-plugin-sort-class-members": "^1.15.2",
84
- "eslint-plugin-unicorn": "^46.0.0",
40
+ "eslint-plugin-unicorn": "^51.0.1",
85
41
  "html-minifier-terser": "^7.1.0",
86
42
  "http-server": "^14.1.1",
87
43
  "magic-string": "^0.30.0",
88
- "postcss-styled": "^0.34.0",
89
- "postcss-styled-syntax": "^0.4.0",
90
- "stylelint": "^15.2.0",
91
- "stylelint-no-unsupported-browser-features": "github:clshortfuse/stylelint-no-unsupported-browser-features#0a51157",
44
+ "playwright": "^1.32.2",
45
+ "postcss-jsx": "^0.36.4",
46
+ "rollup-plugin-output-size": "^1.2.1",
47
+ "rollup-plugin-serve": "^2.0.2",
48
+ "stylelint": "^16.8.1",
49
+ "stylelint-no-unsupported-browser-features": "^8.0.1",
92
50
  "stylelint-order": "^6.0.2",
93
51
  "stylelint-use-logical-spec": "^5.0.0",
94
- "typescript": "^5.0.2"
95
- }
52
+ "typescript": "^5.4.2"
53
+ },
54
+ "exports": {
55
+ "./constants/*": "./constants/*",
56
+ "./components/*": "./components/*",
57
+ "./core/*": "./core/*",
58
+ "./dom/*": "./dom/*",
59
+ "./loaders/*": "./loaders/*",
60
+ "./mixins/*": "./mixins/*",
61
+ "./services/*": "./services/*",
62
+ "./utils/*": "./utils/*"
63
+ },
64
+ "files": [
65
+ "/bin",
66
+ "/dist",
67
+ "/constants",
68
+ "/components",
69
+ "/core",
70
+ "/dom",
71
+ "/loaders",
72
+ "/mixins",
73
+ "/services",
74
+ "/types",
75
+ "/utils"
76
+ ],
77
+ "homepage": "https://github.com/clshortfuse/materialdesignweb#readme",
78
+ "keywords": [
79
+ "material",
80
+ "design",
81
+ "web",
82
+ "materialyou",
83
+ "md3",
84
+ "web-components"
85
+ ],
86
+ "license": "ISC",
87
+ "name": "@shortfuse/materialdesignweb",
88
+ "overrides": {
89
+ "stylelint-no-unsupported-browser-features": {
90
+ "doiuse": "^6.0.2"
91
+ }
92
+ },
93
+ "repository": {
94
+ "type": "git",
95
+ "url": "git+https://github.com/clshortfuse/materialdesignweb.git"
96
+ },
97
+ "scripts": {
98
+ "docs": "node build/esbuild.js docs/demo.js --outdir=docs --minify --metafile",
99
+ "docs:rollup": "rollup -c build/rollup.config.js docs/demo.js --dir=docs --compact",
100
+ "predocs": "node bin/mdw-css.js --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/theme.css",
101
+ "predocs-alt": "node bin/mdw-css.js --color=a46750 --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/alt-theme.css",
102
+ "prepublishOnly": "node build/esbuild.js index.js --outdir=dist --minify --metafile --production",
103
+ "pretest": "eslint --ignore-path .gitignore",
104
+ "serve": "node build/esbuild.js docs/demo.js --outdir=docs --metafile --serve --live --tree-shaking=true",
105
+ "serve:rollup": "rollup -c build/rollup.config.js docs/demo.js --dir=docs --watch --environment SERVE",
106
+ "test": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit --concurrency 1",
107
+ "test:custom": "web-test-runner \"test/**/*.test.js\" --node-resolve --concurrency 1",
108
+ "test:chromium": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers chromium",
109
+ "test:firefox": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers firefox --concurrency 1",
110
+ "test:webkit": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers webkit",
111
+ "test:screenshot": "web-test-runner \"test/screenshot/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit --concurrency 1",
112
+ "test:spec": "web-test-runner \"test/spec/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit",
113
+ "test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --concurrency 1 --watch",
114
+ "test:path": "web-test-runner --node-resolve --playwright --browsers chromium firefox webkit --concurrency 1",
115
+ "types": "rm -Rf types && tsc --emitDeclarationOnly",
116
+ "watch": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile",
117
+ "sample": "node build/esbuild.js docs/sample/sample.js --outdir=docs/sample --watch --metafile --serve --live",
118
+ "benchmark": "node build/esbuild.js docs/benchmark/main.js --outdir=docs/benchmark --minify --production --metafile --serve --watch"
119
+ },
120
+ "sideEffects": [
121
+ "./components/*.js",
122
+ "./loaders/*.js",
123
+ "./polyfills/*.js",
124
+ "./docs/custom.js",
125
+ "./docs/demo/*.js"
126
+ ],
127
+ "type": "module",
128
+ "typesVersions": {
129
+ "*": {
130
+ "*": [
131
+ "types/*"
132
+ ]
133
+ }
134
+ },
135
+ "version": "0.9.0"
96
136
  }
@@ -0,0 +1,10 @@
1
+ import { addGlobalCss } from '../core/css.js';
2
+
3
+ let globalStylesLoaded = false;
4
+
5
+ /** @return {void} */
6
+ export function loadGlobalStyles() {
7
+ if (globalStylesLoaded) return;
8
+ addGlobalCss('html[dir="rtl"]{--mdw-dir: -1;}');
9
+ globalStylesLoaded = true;
10
+ }
@@ -0,0 +1,17 @@
1
+ /** @type {Map<string, {path:string, viewBox:string}>} */
2
+ export const svgAliasMap = new Map();
3
+ export const unaliased = new Set();
4
+
5
+ /**
6
+ * @param {string} name
7
+ * @param {string} path
8
+ * @param {string} [viewBox]
9
+ */
10
+ export function addSVGAlias(name, path, viewBox = '0 0 24 24') {
11
+ name = name.toLowerCase();
12
+ if (path) {
13
+ svgAliasMap.set(name, { path, viewBox });
14
+ } else {
15
+ svgAliasMap.delete(name);
16
+ }
17
+ }
@@ -1,7 +1,25 @@
1
- import { COLOR_KEYWORDS } from '../utils/color_keywords.js';
2
- import { getScheme } from '../utils/hct/helper.js';
1
+ import { COLOR_KEYWORDS } from '../constants/colorKeywords.js';
2
+ import { SHAPE_ROUNDED_DEFAULT } from '../constants/shapes.js';
3
+ import { TYPOGRAPHY_DEFAULT } from '../constants/typography.js';
4
+ import { getScheme } from '../utils/material-color/helper.js';
3
5
  import { svgToCSSURL } from '../utils/svg.js';
4
6
 
7
+ export const PALETTES = [
8
+ 'primary',
9
+ 'secondary',
10
+ 'tertiary',
11
+ 'error',
12
+ 'surface',
13
+ ];
14
+
15
+ export const TYPE_STYLES = [
16
+ 'display',
17
+ 'headline',
18
+ 'title',
19
+ 'label',
20
+ 'body',
21
+ ];
22
+
5
23
  /**
6
24
  * @typedef {Object} ThemeOptions
7
25
  * @prop {string} [color]
@@ -71,174 +89,6 @@ function getShapeEdgesSVGs() {
71
89
  ].join('');
72
90
  }
73
91
 
74
- const CIRCLE_PATH = 'M0 12A12 12 0 1012 0 12 12 0 000 12Z';
75
- // const SQUIRCLE_PATH = 'M12 24C17.2583 24 20.1815 24 22.0908 22.0908 24 20.1815 24 17.2583 24 12 24 6.7417 24 3.8185 22.0908 1.9092 20.1815-0 17.2583-0 12-0 6.7417-0 3.8185-0 1.9092 1.9092-0 3.8185-0 6.7417-0 12-0 17.2583-0 20.1815 1.9092 22.0908 3.8185 24 6.7417 24 12 24Z';
76
- const DIAMOND_PATH = 'M 0 12 12 0 24 12 12 24 Z';
77
- const SQUIRCLE_PATH = 'M12 24C17.2583 24 20.1815 24 22.0908 22.0908 24 20.1815 24 17.2583 24 12 24 6.7417 24 3.8185 22.0908 1.9092 20.1815-0 17.2583-0 12-0 6.7417-0 3.8185-0 1.9092 1.9092-0 3.8185-0 6.7417-0 12-0 17.2583-0 20.1815 1.9092 22.0908 3.8185 24 6.7417 24 12 24Z';
78
- const HALF_NOTCH_PATH = 'M0 6H6V0H18V6H24V18H18V24H6V18H0Z';
79
-
80
- const SHAPE_ROUNDED_DEFAULT = {
81
- size: {
82
- extraSmall: '4px',
83
- small: '8px',
84
- medium: '12px',
85
- large: '16px',
86
- extraLarge: '28px',
87
- full: '32px',
88
- },
89
- /** @type {string?} */
90
- mask: CIRCLE_PATH, // CIRCLE_PATH
91
- convex: false,
92
- };
93
-
94
- const SHAPE_CUT_DEFAULT = {
95
- ...SHAPE_ROUNDED_DEFAULT,
96
- size: {
97
- extraSmall: '4px',
98
- small: '8px',
99
- medium: '12px',
100
- large: '16px',
101
- extraLarge: '28px',
102
- full: '32px',
103
- },
104
- mask: DIAMOND_PATH,
105
- };
106
-
107
- const SHAPE_SQUIRCLE_DEFAULT = {
108
- ...SHAPE_ROUNDED_DEFAULT,
109
- mask: SQUIRCLE_PATH,
110
- };
111
-
112
- const SP = 1 / 16;
113
-
114
- const TYPOGRAPHY_DEFAULT = {
115
- face: {
116
- brand: '"Roboto Medium", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", Helvetica, "Segoe UI", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
117
- plain: '"Roboto Regular", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", Helvetica, "Segoe UI", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
118
- weight: {
119
- regular: 400,
120
- medium: 500,
121
- },
122
- },
123
- scale: {
124
- display: {
125
- large: {
126
- fontFamily: 'var(--mdw-typeface__brand)',
127
- lineHeight: 64,
128
- fontSize: 57,
129
- letterSpacing: 0,
130
- weight: 'var(--mdw-typeface__weight-regular)',
131
- },
132
- medium: {
133
- fontFamily: 'var(--mdw-typeface__brand)',
134
- lineHeight: 52,
135
- fontSize: 45,
136
- letterSpacing: 0,
137
- weight: 'var(--mdw-typeface__weight-regular)',
138
- },
139
- small: {
140
- fontFamily: 'var(--mdw-typeface__brand)',
141
- lineHeight: 44,
142
- fontSize: 36,
143
- letterSpacing: 0,
144
- weight: 'var(--mdw-typeface__weight-regular)',
145
- },
146
- },
147
- headline: {
148
- large: {
149
- fontFamily: 'var(--mdw-typeface__brand)',
150
- lineHeight: 40,
151
- fontSize: 32,
152
- letterSpacing: 0,
153
- weight: 'var(--mdw-typeface__weight-regular)',
154
- },
155
- medium: {
156
- fontFamily: 'var(--mdw-typeface__brand)',
157
- lineHeight: 36,
158
- fontSize: 28,
159
- letterSpacing: 0,
160
- weight: 'var(--mdw-typeface__weight-regular)',
161
- },
162
- small: {
163
- fontFamily: 'var(--mdw-typeface__brand)',
164
- lineHeight: 32,
165
- fontSize: 24,
166
- letterSpacing: 0,
167
- weight: 'var(--mdw-typeface__weight-regular)',
168
- },
169
- },
170
- title: {
171
- large: {
172
- fontFamily: 'var(--mdw-typeface__brand)',
173
- lineHeight: 28,
174
- fontSize: 22,
175
- letterSpacing: 0,
176
- weight: 'var(--mdw-typeface__weight-medium)', // Figma style has regular
177
- },
178
- medium: {
179
- fontFamily: 'var(--mdw-typeface__plain)',
180
- lineHeight: 24,
181
- fontSize: 16,
182
- letterSpacing: 0.15,
183
- weight: 'var(--mdw-typeface__weight-medium)',
184
- },
185
- small: {
186
- fontFamily: 'var(--mdw-typeface__plain)',
187
- lineHeight: 20,
188
- fontSize: 14,
189
- letterSpacing: 0.1,
190
- weight: 'var(--mdw-typeface__weight-medium)',
191
- },
192
- },
193
- label: {
194
- large: {
195
- fontFamily: 'var(--mdw-typeface__plain)',
196
- lineHeight: 20,
197
- fontSize: 14,
198
- letterSpacing: 0.1,
199
- weight: 'var(--mdw-typeface__weight-medium)',
200
- },
201
- medium: {
202
- fontFamily: 'var(--mdw-typeface__plain)',
203
- lineHeight: 16,
204
- fontSize: 12,
205
- letterSpacing: 0.5,
206
- weight: 'var(--mdw-typeface__weight-medium)',
207
- },
208
- small: {
209
- fontFamily: 'var(--mdw-typeface__plain)',
210
- lineHeight: 16,
211
- fontSize: 11,
212
- letterSpacing: 0.5,
213
- weight: 'var(--mdw-typeface__weight-medium)',
214
- },
215
- },
216
- body: {
217
- large: {
218
- fontFamily: 'var(--mdw-typeface__plain)',
219
- lineHeight: 24,
220
- fontSize: 16,
221
- letterSpacing: 0.5, // Figma text has 0.15
222
- weight: 'var(--mdw-typeface__weight-regular)',
223
- },
224
- medium: {
225
- fontFamily: 'var(--mdw-typeface__plain)',
226
- lineHeight: 20,
227
- fontSize: 14,
228
- letterSpacing: 0.25,
229
- weight: 'var(--mdw-typeface__weight-regular)',
230
- },
231
- small: {
232
- fontFamily: 'var(--mdw-typeface__brand)',
233
- lineHeight: 16,
234
- fontSize: 12,
235
- letterSpacing: 0.4,
236
- weight: 'var(--mdw-typeface__weight-regular)',
237
- },
238
- },
239
- },
240
- };
241
-
242
92
  /**
243
93
  * @param {typeof TYPOGRAPHY_DEFAULT} config
244
94
  * @return {string}
@@ -359,7 +209,7 @@ export function generateTypographyGlobalCSS() {
359
209
  }
360
210
 
361
211
  /**
362
- * @param {typeof SHAPE_ROUNDED_DEFAULT} config
212
+ * @param {typeof SHAPE_ROUNDED_DEFAULT} [config]
363
213
  * @return {string}
364
214
  */
365
215
  export function generateShapeCSS(config = SHAPE_ROUNDED_DEFAULT) {
@@ -436,14 +286,14 @@ export function setupTheme({ color = '#6750A4', custom = [], lightness = 'auto'
436
286
  * @return {ThemeOptions}
437
287
  */
438
288
  export function themeOptionsFromSearchParams(searchParams) {
439
- const color = searchParams.get('color') || '#6750A4';
289
+ const color = searchParams?.get('color') || '#6750A4';
440
290
 
441
291
  /** @type {[string,string?][]} */
442
- const custom = searchParams.getAll('custom')
292
+ const custom = searchParams?.getAll('custom')
443
293
  .flatMap((c) => c.split(','))
444
- .map((c) => c.split(':'));
294
+ .map((c) => c.split(':')) ?? [];
445
295
 
446
- const lightness = searchParams.get('lightness') ?? 'auto';
296
+ const lightness = searchParams?.get('lightness') ?? 'auto';
447
297
  return { color, custom, lightness };
448
298
  }
449
299
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=mdw-css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdw-css.d.ts","sourceRoot":"","sources":["../../bin/mdw-css.js"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ declare const _default: typeof CustomElement & import("../core/CustomElement.js").Class<{
2
+ disabled: boolean;
3
+ focused: boolean;
4
+ hovered: boolean;
5
+ pressed: boolean;
6
+ _lastInteraction: "key" | "mouse" | "touch" | "pen";
7
+ _hovered: boolean;
8
+ _focused: boolean;
9
+ _focusedSynthetic: boolean;
10
+ _keyPressed: boolean;
11
+ _keyReleased: boolean;
12
+ _pointerPressed: boolean;
13
+ stateLayer: boolean;
14
+ }, any[]> & import("../core/CustomElement.js").Class<{
15
+ disabledState: boolean;
16
+ hoveredState: boolean;
17
+ focusedState: boolean;
18
+ pressedState: boolean;
19
+ touchedState: boolean;
20
+ pointedState: boolean;
21
+ }, any[]> & import("../core/CustomElement.js").Class<{
22
+ stateTargetElement: HTMLElement;
23
+ }, any[]> & import("../core/CustomElement.js").Class<{
24
+ color: string;
25
+ ink: string;
26
+ typeStyle: string;
27
+ }, any[]> & import("../core/CustomElement.js").Class<{
28
+ shapeTop: boolean;
29
+ shapeBottom: boolean;
30
+ shapeStart: boolean;
31
+ shapeEnd: boolean;
32
+ shapeStyle: string;
33
+ outlined: boolean;
34
+ }, any[]> & import("../core/CustomElement.js").Class<{
35
+ density: number;
36
+ }, any[]>;
37
+ export default _default;
38
+ import CustomElement from '../core/CustomElement.js';
39
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../components/Badge.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA0B,0BAA0B"}