@shortfuse/materialdesignweb 0.8.0 → 0.9.1

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 (405) hide show
  1. package/README.md +50 -198
  2. package/bin/mdw-css.js +1 -1
  3. package/components/Badge.js +15 -5
  4. package/components/Body.js +7 -0
  5. package/components/BottomAppBar.js +7 -10
  6. package/components/BottomSheet.js +472 -0
  7. package/components/Box.js +11 -49
  8. package/components/Button.js +81 -82
  9. package/components/Card.js +74 -62
  10. package/components/Checkbox.js +15 -25
  11. package/components/CheckboxIcon.js +19 -31
  12. package/components/Chip.js +18 -13
  13. package/components/Dialog.js +70 -100
  14. package/components/DialogActions.js +4 -0
  15. package/components/Display.js +64 -0
  16. package/components/Divider.js +5 -0
  17. package/components/Fab.js +94 -17
  18. package/components/FabContainer.js +57 -0
  19. package/components/FilterChip.js +43 -32
  20. package/components/Grid.js +187 -0
  21. package/components/Headline.js +9 -28
  22. package/components/Icon.js +80 -71
  23. package/components/IconButton.js +77 -120
  24. package/components/Input.js +745 -86
  25. package/components/InputChip.js +193 -0
  26. package/components/Label.js +7 -0
  27. package/components/List.js +11 -5
  28. package/components/ListItem.js +92 -23
  29. package/components/ListOption.js +143 -65
  30. package/components/Listbox.js +57 -17
  31. package/components/Menu.js +39 -27
  32. package/components/MenuItem.js +49 -36
  33. package/components/NavBar.js +66 -21
  34. package/components/NavBarItem.js +5 -0
  35. package/components/NavDrawer.js +33 -16
  36. package/components/NavDrawerItem.js +7 -4
  37. package/components/NavItem.js +61 -34
  38. package/components/NavRail.js +32 -21
  39. package/components/NavRailItem.js +10 -2
  40. package/components/Page.js +119 -0
  41. package/components/Pane.js +24 -0
  42. package/components/Popup.js +23 -8
  43. package/components/Progress.js +25 -5
  44. package/components/Radio.js +8 -7
  45. package/components/RadioIcon.js +24 -15
  46. package/components/Ripple.js +25 -7
  47. package/components/Root.js +225 -0
  48. package/components/Scrim.js +95 -0
  49. package/components/Search.js +30 -25
  50. package/components/SegmentedButton.js +53 -40
  51. package/components/SegmentedButtonGroup.js +15 -12
  52. package/components/Select.js +19 -10
  53. package/components/Shape.js +10 -66
  54. package/components/SideSheet.js +337 -0
  55. package/components/Slider.js +93 -36
  56. package/components/Snackbar.js +52 -20
  57. package/components/SnackbarContainer.js +51 -0
  58. package/components/Surface.js +20 -10
  59. package/components/Switch.js +21 -18
  60. package/components/SwitchIcon.js +62 -33
  61. package/components/Tab.js +78 -38
  62. package/components/TabContent.js +33 -12
  63. package/components/TabList.js +95 -34
  64. package/components/TabPanel.js +10 -1
  65. package/components/Table.js +151 -0
  66. package/components/TextArea.js +48 -16
  67. package/components/Title.js +8 -9
  68. package/components/Tooltip.js +51 -22
  69. package/components/TopAppBar.js +71 -78
  70. package/constants/shapes.js +36 -0
  71. package/constants/typography.js +127 -0
  72. package/core/Composition.js +391 -201
  73. package/core/CompositionAdapter.js +35 -18
  74. package/core/CustomElement.js +634 -254
  75. package/core/css.js +117 -12
  76. package/core/customTypes.js +161 -49
  77. package/core/dom.js +18 -11
  78. package/core/jsonMergePatch.js +27 -11
  79. package/core/observe.js +308 -256
  80. package/core/optimizations.js +9 -9
  81. package/core/template.js +14 -57
  82. package/dist/CustomElement.min.js +2 -0
  83. package/dist/CustomElement.min.js.map +7 -0
  84. package/dist/core/CustomElement.min.js +2 -0
  85. package/dist/core/CustomElement.min.js.map +7 -0
  86. package/dist/index.min.js +85 -115
  87. package/dist/index.min.js.map +4 -4
  88. package/dist/meta.json +1 -1
  89. package/dom/HTMLOptionsCollectionProxy.js +108 -0
  90. package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
  91. package/loaders/theme.js +12 -0
  92. package/mixins/AriaReflectorMixin.js +64 -15
  93. package/mixins/AriaToolbarMixin.js +6 -0
  94. package/mixins/ControlMixin.js +79 -33
  95. package/mixins/DelegatesFocusMixin.js +62 -0
  96. package/mixins/DensityMixin.js +7 -3
  97. package/mixins/ElevationMixin.js +61 -0
  98. package/mixins/FlexableMixin.js +87 -39
  99. package/mixins/FormAssociatedMixin.js +76 -10
  100. package/mixins/HyperlinkMixin.js +76 -0
  101. package/mixins/InputMixin.js +227 -32
  102. package/mixins/KeyboardNavMixin.js +11 -7
  103. package/mixins/NavigationListenerMixin.js +33 -0
  104. package/mixins/PopupMixin.js +216 -219
  105. package/mixins/RTLObserverMixin.js +2 -0
  106. package/mixins/ResizeObserverMixin.js +18 -4
  107. package/mixins/RippleMixin.js +11 -7
  108. package/mixins/ScrollListenerMixin.js +14 -2
  109. package/mixins/SemiStickyMixin.js +51 -98
  110. package/mixins/ShapeMaskedMixin.js +125 -0
  111. package/mixins/ShapeMixin.js +30 -203
  112. package/mixins/StateMixin.js +74 -34
  113. package/mixins/TextFieldMixin.js +128 -145
  114. package/mixins/ThemableMixin.js +57 -56
  115. package/mixins/TooltipTriggerMixin.js +305 -359
  116. package/mixins/TouchTargetMixin.js +5 -2
  117. package/mixins/TypographyMixin.js +128 -0
  118. package/package.json +125 -81
  119. package/services/rtl.js +10 -0
  120. package/services/svgAlias.js +17 -0
  121. package/{theming/index.js → services/theme.js} +25 -176
  122. package/types/bin/mdw-css.d.ts +3 -0
  123. package/types/bin/mdw-css.d.ts.map +1 -0
  124. package/types/components/Badge.d.ts +39 -0
  125. package/types/components/Badge.d.ts.map +1 -0
  126. package/types/components/Body.d.ts +29 -0
  127. package/types/components/Body.d.ts.map +1 -0
  128. package/types/components/BottomAppBar.d.ts +72 -0
  129. package/types/components/BottomAppBar.d.ts.map +1 -0
  130. package/types/components/BottomSheet.d.ts +135 -0
  131. package/types/components/BottomSheet.d.ts.map +1 -0
  132. package/types/components/Box.d.ts +16 -0
  133. package/types/components/Box.d.ts.map +1 -0
  134. package/types/components/Button.d.ts +245 -0
  135. package/types/components/Button.d.ts.map +1 -0
  136. package/types/components/Card.d.ts +147 -0
  137. package/types/components/Card.d.ts.map +1 -0
  138. package/types/components/Checkbox.d.ts +207 -0
  139. package/types/components/Checkbox.d.ts.map +1 -0
  140. package/types/components/CheckboxIcon.d.ts +44 -0
  141. package/types/components/CheckboxIcon.d.ts.map +1 -0
  142. package/types/components/Chip.d.ts +248 -0
  143. package/types/components/Chip.d.ts.map +1 -0
  144. package/types/components/Dialog.d.ts +103 -0
  145. package/types/components/Dialog.d.ts.map +1 -0
  146. package/types/components/DialogActions.d.ts +4 -0
  147. package/types/components/DialogActions.d.ts.map +1 -0
  148. package/types/components/Display.d.ts +46 -0
  149. package/types/components/Display.d.ts.map +1 -0
  150. package/types/components/Divider.d.ts +10 -0
  151. package/types/components/Divider.d.ts.map +1 -0
  152. package/types/components/Fab.d.ts +273 -0
  153. package/types/components/Fab.d.ts.map +1 -0
  154. package/types/components/FabContainer.d.ts +10 -0
  155. package/types/components/FabContainer.d.ts.map +1 -0
  156. package/types/components/FilterChip.d.ts +256 -0
  157. package/types/components/FilterChip.d.ts.map +1 -0
  158. package/types/components/Grid.d.ts +38 -0
  159. package/types/components/Grid.d.ts.map +1 -0
  160. package/types/components/Headline.d.ts +46 -0
  161. package/types/components/Headline.d.ts.map +1 -0
  162. package/types/components/Icon.d.ts +55 -0
  163. package/types/components/Icon.d.ts.map +1 -0
  164. package/types/components/IconButton.d.ts +284 -0
  165. package/types/components/IconButton.d.ts.map +1 -0
  166. package/types/components/Input.d.ts +2528 -0
  167. package/types/components/Input.d.ts.map +1 -0
  168. package/types/components/InputChip.d.ts +85 -0
  169. package/types/components/InputChip.d.ts.map +1 -0
  170. package/types/components/Label.d.ts +29 -0
  171. package/types/components/Label.d.ts.map +1 -0
  172. package/types/components/List.d.ts +35 -0
  173. package/types/components/List.d.ts.map +1 -0
  174. package/types/components/ListItem.d.ts +124 -0
  175. package/types/components/ListItem.d.ts.map +1 -0
  176. package/types/components/ListOption.d.ts +158 -0
  177. package/types/components/ListOption.d.ts.map +1 -0
  178. package/types/components/Listbox.d.ts +763 -0
  179. package/types/components/Listbox.d.ts.map +1 -0
  180. package/types/components/Menu.d.ts +130 -0
  181. package/types/components/Menu.d.ts.map +1 -0
  182. package/types/components/MenuItem.d.ts +232 -0
  183. package/types/components/MenuItem.d.ts.map +1 -0
  184. package/types/components/NavBar.d.ts +20 -0
  185. package/types/components/NavBar.d.ts.map +1 -0
  186. package/types/components/NavBarItem.d.ts +97 -0
  187. package/types/components/NavBarItem.d.ts.map +1 -0
  188. package/types/components/NavDrawer.d.ts +107 -0
  189. package/types/components/NavDrawer.d.ts.map +1 -0
  190. package/types/components/NavDrawerItem.d.ts +97 -0
  191. package/types/components/NavDrawerItem.d.ts.map +1 -0
  192. package/types/components/NavItem.d.ts +99 -0
  193. package/types/components/NavItem.d.ts.map +1 -0
  194. package/types/components/NavRail.d.ts +108 -0
  195. package/types/components/NavRail.d.ts.map +1 -0
  196. package/types/components/NavRailItem.d.ts +97 -0
  197. package/types/components/NavRailItem.d.ts.map +1 -0
  198. package/types/components/Page.d.ts +25 -0
  199. package/types/components/Page.d.ts.map +1 -0
  200. package/types/components/Pane.d.ts +44 -0
  201. package/types/components/Pane.d.ts.map +1 -0
  202. package/types/components/Popup.d.ts +78 -0
  203. package/types/components/Popup.d.ts.map +1 -0
  204. package/types/components/Progress.d.ts +21 -0
  205. package/types/components/Progress.d.ts.map +1 -0
  206. package/types/components/Radio.d.ts +201 -0
  207. package/types/components/Radio.d.ts.map +1 -0
  208. package/types/components/RadioIcon.d.ts +46 -0
  209. package/types/components/RadioIcon.d.ts.map +1 -0
  210. package/types/components/Ripple.d.ts +35 -0
  211. package/types/components/Ripple.d.ts.map +1 -0
  212. package/types/components/Root.d.ts +68 -0
  213. package/types/components/Root.d.ts.map +1 -0
  214. package/types/components/Scrim.d.ts +6 -0
  215. package/types/components/Scrim.d.ts.map +1 -0
  216. package/types/components/Search.d.ts +516 -0
  217. package/types/components/Search.d.ts.map +1 -0
  218. package/types/components/SegmentedButton.d.ts +252 -0
  219. package/types/components/SegmentedButton.d.ts.map +1 -0
  220. package/types/components/SegmentedButtonGroup.d.ts +43 -0
  221. package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
  222. package/types/components/Select.d.ts +158 -0
  223. package/types/components/Select.d.ts.map +1 -0
  224. package/types/components/Shape.d.ts +10 -0
  225. package/types/components/Shape.d.ts.map +1 -0
  226. package/types/components/SideSheet.d.ts +111 -0
  227. package/types/components/SideSheet.d.ts.map +1 -0
  228. package/types/components/Slider.d.ts +203 -0
  229. package/types/components/Slider.d.ts.map +1 -0
  230. package/types/components/Snackbar.d.ts +73 -0
  231. package/types/components/Snackbar.d.ts.map +1 -0
  232. package/types/components/SnackbarContainer.d.ts +6 -0
  233. package/types/components/SnackbarContainer.d.ts.map +1 -0
  234. package/types/components/Surface.d.ts +45 -0
  235. package/types/components/Surface.d.ts.map +1 -0
  236. package/types/components/Switch.d.ts +187 -0
  237. package/types/components/Switch.d.ts.map +1 -0
  238. package/types/components/SwitchIcon.d.ts +61 -0
  239. package/types/components/SwitchIcon.d.ts.map +1 -0
  240. package/types/components/Tab.d.ts +139 -0
  241. package/types/components/Tab.d.ts.map +1 -0
  242. package/types/components/TabContent.d.ts +124 -0
  243. package/types/components/TabContent.d.ts.map +1 -0
  244. package/types/components/TabList.d.ts +1111 -0
  245. package/types/components/TabList.d.ts.map +1 -0
  246. package/types/components/TabPanel.d.ts +28 -0
  247. package/types/components/TabPanel.d.ts.map +1 -0
  248. package/types/components/Table.d.ts +25 -0
  249. package/types/components/Table.d.ts.map +1 -0
  250. package/types/components/TextArea.d.ts +201 -0
  251. package/types/components/TextArea.d.ts.map +1 -0
  252. package/types/components/Title.d.ts +46 -0
  253. package/types/components/Title.d.ts.map +1 -0
  254. package/types/components/Tooltip.d.ts +49 -0
  255. package/types/components/Tooltip.d.ts.map +1 -0
  256. package/types/components/TopAppBar.d.ts +129 -0
  257. package/types/components/TopAppBar.d.ts.map +1 -0
  258. package/types/constants/colorKeywords.d.ts +2 -0
  259. package/types/constants/colorKeywords.d.ts.map +1 -0
  260. package/types/constants/shapes.d.ts +38 -0
  261. package/types/constants/shapes.d.ts.map +1 -0
  262. package/types/constants/typography.d.ts +212 -0
  263. package/types/constants/typography.d.ts.map +1 -0
  264. package/types/core/Composition.d.ts +260 -0
  265. package/types/core/Composition.d.ts.map +1 -0
  266. package/types/core/CompositionAdapter.d.ts +114 -0
  267. package/types/core/CompositionAdapter.d.ts.map +1 -0
  268. package/types/core/CustomElement.d.ts +304 -0
  269. package/types/core/CustomElement.d.ts.map +1 -0
  270. package/types/core/css.d.ts +44 -0
  271. package/types/core/css.d.ts.map +1 -0
  272. package/types/core/customTypes.d.ts +22 -0
  273. package/types/core/customTypes.d.ts.map +1 -0
  274. package/types/core/dom.d.ts +32 -0
  275. package/types/core/dom.d.ts.map +1 -0
  276. package/types/core/jsonMergePatch.d.ts +31 -0
  277. package/types/core/jsonMergePatch.d.ts.map +1 -0
  278. package/types/core/observe.d.ts +114 -0
  279. package/types/core/observe.d.ts.map +1 -0
  280. package/types/core/optimizations.d.ts +7 -0
  281. package/types/core/optimizations.d.ts.map +1 -0
  282. package/types/core/template.d.ts +47 -0
  283. package/types/core/template.d.ts.map +1 -0
  284. package/types/core/uid.d.ts +6 -0
  285. package/types/core/uid.d.ts.map +1 -0
  286. package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
  287. package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
  288. package/types/index.d.ts +88 -0
  289. package/types/index.d.ts.map +1 -0
  290. package/types/loaders/palette.d.ts +2 -0
  291. package/types/loaders/palette.d.ts.map +1 -0
  292. package/types/loaders/theme.d.ts +2 -0
  293. package/types/loaders/theme.d.ts.map +1 -0
  294. package/types/mixins/AriaReflectorMixin.d.ts +31 -0
  295. package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
  296. package/types/mixins/AriaToolbarMixin.d.ts +34 -0
  297. package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
  298. package/types/mixins/ControlMixin.d.ts +124 -0
  299. package/types/mixins/ControlMixin.d.ts.map +1 -0
  300. package/types/mixins/DelegatesFocusMixin.d.ts +13 -0
  301. package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
  302. package/types/mixins/DensityMixin.d.ts +8 -0
  303. package/types/mixins/DensityMixin.d.ts.map +1 -0
  304. package/types/mixins/ElevationMixin.d.ts +32 -0
  305. package/types/mixins/ElevationMixin.d.ts.map +1 -0
  306. package/types/mixins/FlexableMixin.d.ts +14 -0
  307. package/types/mixins/FlexableMixin.d.ts.map +1 -0
  308. package/types/mixins/FormAssociatedMixin.d.ts +123 -0
  309. package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
  310. package/types/mixins/HyperlinkMixin.d.ts +25 -0
  311. package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
  312. package/types/mixins/InputMixin.d.ts +173 -0
  313. package/types/mixins/InputMixin.d.ts.map +1 -0
  314. package/types/mixins/KeyboardNavMixin.d.ts +46 -0
  315. package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
  316. package/types/mixins/NavigationListenerMixin.d.ts +8 -0
  317. package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
  318. package/types/mixins/PopupMixin.d.ts +98 -0
  319. package/types/mixins/PopupMixin.d.ts.map +1 -0
  320. package/types/mixins/RTLObserverMixin.d.ts +8 -0
  321. package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
  322. package/types/mixins/ResizeObserverMixin.d.ts +13 -0
  323. package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
  324. package/types/mixins/RippleMixin.d.ts +94 -0
  325. package/types/mixins/RippleMixin.d.ts.map +1 -0
  326. package/types/mixins/ScrollListenerMixin.d.ts +46 -0
  327. package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
  328. package/types/mixins/SemiStickyMixin.d.ts +50 -0
  329. package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
  330. package/types/mixins/ShapeMaskedMixin.d.ts +12 -0
  331. package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
  332. package/types/mixins/ShapeMixin.d.ts +39 -0
  333. package/types/mixins/ShapeMixin.d.ts.map +1 -0
  334. package/types/mixins/StateMixin.d.ts +29 -0
  335. package/types/mixins/StateMixin.d.ts.map +1 -0
  336. package/types/mixins/TextFieldMixin.d.ts +153 -0
  337. package/types/mixins/TextFieldMixin.d.ts.map +1 -0
  338. package/types/mixins/ThemableMixin.d.ts +10 -0
  339. package/types/mixins/ThemableMixin.d.ts.map +1 -0
  340. package/types/mixins/TooltipTriggerMixin.d.ts +114 -0
  341. package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
  342. package/types/mixins/TouchTargetMixin.d.ts +6 -0
  343. package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
  344. package/types/mixins/TypographyMixin.d.ts +20 -0
  345. package/types/mixins/TypographyMixin.d.ts.map +1 -0
  346. package/types/services/rtl.d.ts +3 -0
  347. package/types/services/rtl.d.ts.map +1 -0
  348. package/types/services/svgAlias.d.ts +13 -0
  349. package/types/services/svgAlias.d.ts.map +1 -0
  350. package/types/services/theme.d.ts +45 -0
  351. package/types/services/theme.d.ts.map +1 -0
  352. package/types/utils/cli.d.ts +3 -0
  353. package/types/utils/cli.d.ts.map +1 -0
  354. package/types/utils/function.d.ts +3 -0
  355. package/types/utils/function.d.ts.map +1 -0
  356. package/types/utils/jsx-runtime.d.ts +20 -0
  357. package/types/utils/jsx-runtime.d.ts.map +1 -0
  358. package/types/utils/material-color/blend.d.ts +34 -0
  359. package/types/utils/material-color/blend.d.ts.map +1 -0
  360. package/types/utils/material-color/hct/Cam16.d.ts +142 -0
  361. package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
  362. package/types/utils/material-color/hct/Hct.d.ts +93 -0
  363. package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
  364. package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
  365. package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
  366. package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
  367. package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
  368. package/types/utils/material-color/helper.d.ts +8 -0
  369. package/types/utils/material-color/helper.d.ts.map +1 -0
  370. package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
  371. package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
  372. package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
  373. package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
  374. package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
  375. package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
  376. package/types/utils/material-color/utils/color.d.ts +172 -0
  377. package/types/utils/material-color/utils/color.d.ts.map +1 -0
  378. package/types/utils/material-color/utils/math.d.ts +94 -0
  379. package/types/utils/material-color/utils/math.d.ts.map +1 -0
  380. package/types/utils/pixelmatch.d.ts +22 -0
  381. package/types/utils/pixelmatch.d.ts.map +1 -0
  382. package/types/utils/popup.d.ts +106 -0
  383. package/types/utils/popup.d.ts.map +1 -0
  384. package/types/utils/searchParams.d.ts +3 -0
  385. package/types/utils/searchParams.d.ts.map +1 -0
  386. package/types/utils/svg.d.ts +7 -0
  387. package/types/utils/svg.d.ts.map +1 -0
  388. package/utils/jsx-runtime.js +9 -4
  389. package/utils/material-color/scheme/Scheme.js +1 -1
  390. package/utils/pixelmatch.js +363 -0
  391. package/utils/popup.js +86 -10
  392. package/utils/searchParams.js +22 -0
  393. package/components/Button.md +0 -61
  394. package/components/ExtendedFab.js +0 -32
  395. package/components/Layout.js +0 -504
  396. package/components/Nav.js +0 -38
  397. package/core/DomAdapter.js +0 -586
  398. package/core/ICustomElement.d.ts +0 -291
  399. package/core/ICustomElement.js +0 -1
  400. package/core/test.js +0 -126
  401. package/core/typings.d.ts +0 -142
  402. package/core/typings.js +0 -1
  403. package/mixins/SurfaceMixin.js +0 -127
  404. package/theming/loader.js +0 -22
  405. /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
@@ -0,0 +1,363 @@
1
+ /**
2
+ * @license ISC License
3
+ * Copyright (c) 2019, Mapbox
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software for any purpose
6
+ * with or without fee is hereby granted, provided that the above copyright notice
7
+ * and this permission notice appear in all copies.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11
+ * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
13
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
15
+ * THIS SOFTWARE.
16
+ */
17
+
18
+ /** @enum {Object} */
19
+ const DEFAULT_OPTIONS = {
20
+ /* matching threshold (0 to 1); smaller is more sensitive */
21
+ threshold: 0.1,
22
+ /* whether to skip anti-aliasing detection */
23
+ includeAA: false,
24
+ /** opacity of original image in diff output */
25
+ alpha: 0.1,
26
+ /* color of anti-aliased pixels in diff output */
27
+ /** @type {[number,number,number]} */
28
+ aaColor: [255, 255, 0],
29
+ /** @type {[number,number,number]} */
30
+ diffColor: [255, 0, 0], // color of different pixels in diff output
31
+ /**
32
+ * whether to detect dark on light differences between img1 and img2 and set
33
+ * an alternative color to differentiate between the two
34
+ * @type {[number,number,number]}
35
+ */
36
+ diffColorAlt: null,
37
+ /** draw the diff over a transparent background (a mask) */
38
+ diffMask: false,
39
+ };
40
+
41
+ /**
42
+ * @param {ArrayBufferView} arr
43
+ */
44
+ function isPixelData(arr) {
45
+ // work around instanceof Uint8Array not working properly in some Jest environments
46
+ // @ts-ignore Bad typings
47
+ return ArrayBuffer.isView(arr) && (arr).constructor.BYTES_PER_ELEMENT === 1;
48
+ }
49
+
50
+ /**
51
+ * Check if a pixel has 3+ adjacent pixels of the same color.
52
+ * @param {ArrayLike<number>} img
53
+ * @param {number} x1
54
+ * @param {number} y1
55
+ * @param {number} width
56
+ * @param {number} height
57
+ */
58
+ function hasManySiblings(img, x1, y1, width, height) {
59
+ const x0 = Math.max(x1 - 1, 0);
60
+ const y0 = Math.max(y1 - 1, 0);
61
+ const x2 = Math.min(x1 + 1, width - 1);
62
+ const y2 = Math.min(y1 + 1, height - 1);
63
+ const pos = (y1 * width + x1) * 4;
64
+ let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
65
+
66
+ // go through 8 adjacent pixels
67
+ for (let x = x0; x <= x2; x++) {
68
+ for (let y = y0; y <= y2; y++) {
69
+ if (x === x1 && y === y1) continue;
70
+
71
+ const pos2 = 4 * (y * width + x);
72
+ if (img[pos] === img[pos2]
73
+ && img[pos + 1] === img[pos2 + 1]
74
+ && img[pos + 2] === img[pos2 + 2]
75
+ && img[pos + 3] === img[pos2 + 3]) zeroes++;
76
+
77
+ if (zeroes > 2) return true;
78
+ }
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ /**
85
+ * blend semi-transparent color with white
86
+ * @param {number} color
87
+ * @param {number} alpha
88
+ */
89
+ function blend(color, alpha) {
90
+ return 255 + (color - 255) * alpha;
91
+ }
92
+
93
+ /**
94
+ * Returns Y from RGB=>YIQ
95
+ * @param {number} red
96
+ * @param {number} green
97
+ * @param {number} blue
98
+ */
99
+ function yFromRGBToYIQ(red, green, blue) {
100
+ return (0.298_895_31 * red) + (0.586_622_47 * green) + (0.114_482_23 * blue);
101
+ }
102
+
103
+ /**
104
+ * Returns I from RGB=>YIQ
105
+ * @param {number} red
106
+ * @param {number} green
107
+ * @param {number} blue
108
+ */
109
+ function iFromRGBToYIQ(red, green, blue) {
110
+ return (0.595_977_99 * red) + (-0.274_176_1 * green) + (-0.321_801_89 * blue);
111
+ }
112
+
113
+ /**
114
+ * Returns Q from RGB=>YIQ
115
+ * @param {number} red
116
+ * @param {number} green
117
+ * @param {number} blue
118
+ * @return {number}
119
+ */
120
+ function qFromRGBToYIQ(red, green, blue) {
121
+ return (0.211_470_17 * red) + (-0.522_617_11 * green) + (0.311_146_94 * blue);
122
+ }
123
+
124
+ /**
125
+ * Returns YIQ from RGB
126
+ * @param {number} red
127
+ * @param {number} green
128
+ * @param {number} blue
129
+ * @return {{y:number, i:number, q:number}}
130
+ */
131
+ function yiqFromRGB(red, green, blue) {
132
+ return {
133
+ y: yFromRGBToYIQ(red, green, blue),
134
+ i: iFromRGBToYIQ(red, green, blue),
135
+ q: qFromRGBToYIQ(red, green, blue),
136
+ };
137
+ }
138
+
139
+ /**
140
+ * calculate color difference according to the paper "Measuring perceived color
141
+ * difference using YIQ NTSC transmission color space in mobile applications"
142
+ * by Y. Kotsarenko and F. Ramos
143
+ * @param {ArrayLike<number>} img1
144
+ * @param {ArrayLike<number>} img2
145
+ * @param {number} k
146
+ * @param {number} m
147
+ * @param {boolean} [yOnly]
148
+ * @return {number}
149
+ */
150
+ function colorDelta(img1, img2, k, m, yOnly) {
151
+ let r1 = img1[k + 0];
152
+ let g1 = img1[k + 1];
153
+ let b1 = img1[k + 2];
154
+ let a1 = img1[k + 3];
155
+
156
+ let r2 = img2[m + 0];
157
+ let g2 = img2[m + 1];
158
+ let b2 = img2[m + 2];
159
+ let a2 = img2[m + 3];
160
+
161
+ if (a1 === a2 && r1 === r2 && g1 === g2 && b1 === b2) return 0;
162
+
163
+ if (a1 < 255) {
164
+ a1 /= 255;
165
+ r1 = blend(r1, a1);
166
+ g1 = blend(g1, a1);
167
+ b1 = blend(b1, a1);
168
+ }
169
+
170
+ if (a2 < 255) {
171
+ a2 /= 255;
172
+ r2 = blend(r2, a2);
173
+ g2 = blend(g2, a2);
174
+ b2 = blend(b2, a2);
175
+ }
176
+
177
+ if (yOnly) {
178
+ return yFromRGBToYIQ(r1, g1, b1) - yFromRGBToYIQ(r2, g2, b2);
179
+ }
180
+
181
+ const { y: y1, i: i1, q: q1 } = yiqFromRGB(r1, g1, b1);
182
+ const { y: y2, i: i2, q: q2 } = yiqFromRGB(r2, g2, b2);
183
+
184
+ const y = y1 - y2;
185
+ const i = i1 - i2;
186
+ const q = q1 - q2;
187
+
188
+ const delta = (0.5053 * y * y) + (0.299 * i * i) + (0.1957 * q * q);
189
+
190
+ // encode whether the pixel lightens or darkens in the sign
191
+ return y1 > y2 ? -delta : delta;
192
+ }
193
+
194
+ /**
195
+ * @param {Uint8Array|Uint8ClampedArray} destination
196
+ * @param {number} index
197
+ * @param {number} red
198
+ * @param {number} green
199
+ * @param {number} blue
200
+ * @return {void}
201
+ */
202
+ function drawPixel(destination, index, red, green, blue) {
203
+ destination[index + 0] = red;
204
+ destination[index + 1] = green;
205
+ destination[index + 2] = blue;
206
+ destination[index + 3] = 255;
207
+ }
208
+
209
+ /**
210
+ * @param {Uint8Array|Uint8ClampedArray} source
211
+ * @param {number} index
212
+ * @param {number} alpha
213
+ * @param {Uint8Array|Uint8ClampedArray} destination
214
+ */
215
+ function drawGrayPixel(source, index, alpha, destination) {
216
+ const red = source[index + 0];
217
+ const green = source[index + 1];
218
+ const blue = source[index + 2];
219
+ const val = blend(yFromRGBToYIQ(red, green, blue), (alpha * source[index + 3]) / 255);
220
+ drawPixel(destination, index, val, val, val);
221
+ }
222
+
223
+ /**
224
+ * Check if a pixel is likely a part of anti-aliasing;
225
+ *
226
+ * Based on "Anti-aliased Pixel and Intensity Slope Detector" paper by V.
227
+ * Vysniauskas, 2009
228
+ * @param {ArrayLike<number>} img
229
+ * @param {number} x1
230
+ * @param {number} y1
231
+ * @param {number} width
232
+ * @param {number} height
233
+ * @param {ArrayLike<number>} img2
234
+ */
235
+ function antialiased(img, x1, y1, width, height, img2) {
236
+ const x0 = Math.max(x1 - 1, 0);
237
+ const y0 = Math.max(y1 - 1, 0);
238
+ const x2 = Math.min(x1 + 1, width - 1);
239
+ const y2 = Math.min(y1 + 1, height - 1);
240
+ const pos = (y1 * width + x1) * 4;
241
+ let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
242
+ let min = 0;
243
+ let max = 0;
244
+ let minX; let minY; let maxX; let
245
+ maxY;
246
+
247
+ // go through 8 adjacent pixels
248
+ for (let x = x0; x <= x2; x++) {
249
+ for (let y = y0; y <= y2; y++) {
250
+ if (x === x1 && y === y1) continue;
251
+
252
+ // brightness delta between the center pixel and adjacent one
253
+ const delta = colorDelta(img, img, pos, (y * width + x) * 4, true);
254
+
255
+ // count the number of equal, darker and brighter adjacent pixels
256
+ if (delta === 0) {
257
+ zeroes++;
258
+ // if found more than 2 equal siblings, it's definitely not anti-aliasing
259
+ if (zeroes > 2) return false;
260
+
261
+ // remember the darkest pixel
262
+ } else if (delta < min) {
263
+ min = delta;
264
+ minX = x;
265
+ minY = y;
266
+
267
+ // remember the brightest pixel
268
+ } else if (delta > max) {
269
+ max = delta;
270
+ maxX = x;
271
+ maxY = y;
272
+ }
273
+ }
274
+ }
275
+
276
+ // if there are no both darker and brighter pixels among siblings, it's not anti-aliasing
277
+ if (min === 0 || max === 0) return false;
278
+
279
+ // if either the darkest or the brightest pixel has 3+ equal siblings in both images
280
+ // (definitely not anti-aliased), this pixel is anti-aliased
281
+ return (hasManySiblings(img, minX, minY, width, height)
282
+ && hasManySiblings(img2, minX, minY, width, height))
283
+ || (hasManySiblings(img, maxX, maxY, width, height)
284
+ && hasManySiblings(img2, maxX, maxY, width, height));
285
+ }
286
+
287
+ /**
288
+ * @param {Uint8Array|Uint8ClampedArray} img1
289
+ * @param {Uint8Array|Uint8ClampedArray} img2
290
+ * @param {Uint8Array|Uint8ClampedArray} output
291
+ * @param {number} width
292
+ * @param {number} height
293
+ * @param {typeof DEFAULT_OPTIONS} [options]
294
+ * @return {number}
295
+ */
296
+ export function pixelmatch(img1, img2, output, width, height, options) {
297
+ if (!isPixelData(img1) || !isPixelData(img2) || (output && !isPixelData(output))) {
298
+ throw new Error('Image data: Uint8Array, Uint8ClampedArray or Buffer expected.');
299
+ }
300
+
301
+ if (img1.length !== img2.length || (output && output.length !== img1.length)) {
302
+ // throw new Error('Image sizes do not match.');
303
+ return Number.POSITIVE_INFINITY;
304
+ }
305
+
306
+ if (img1.length !== width * height * 4) {
307
+ // throw new Error('Image data size does not match width/height.');
308
+ return Number.POSITIVE_INFINITY;
309
+ }
310
+ options = { ...DEFAULT_OPTIONS, ...options };
311
+
312
+ // check if images are identical
313
+ const len = width * height;
314
+ const a32 = new Uint32Array(img1.buffer, img1.byteOffset, len);
315
+ const b32 = new Uint32Array(img2.buffer, img2.byteOffset, len);
316
+ let identical = true;
317
+
318
+ for (let i = 0; i < len; i++) {
319
+ if (a32[i] !== b32[i]) { identical = false; break; }
320
+ }
321
+ if (identical) { // fast path if identical
322
+ if (output && !options.diffMask) {
323
+ for (let i = 0; i < len; i++) drawGrayPixel(img1, 4 * i, options.alpha, output);
324
+ }
325
+ return 0;
326
+ }
327
+
328
+ // maximum acceptable square distance between two colors;
329
+ // 35215 is the maximum possible value for the YIQ difference metric
330
+ const maxDelta = 35_215 * options.threshold * options.threshold;
331
+ let diff = 0;
332
+
333
+ // compare each pixel of one image against the other one
334
+ for (let y = 0; y < height; y++) {
335
+ for (let x = 0; x < width; x++) {
336
+ const pos = (y * width + x) * 4;
337
+
338
+ // squared YUV distance between colors at this pixel position, negative if the img2 pixel is darker
339
+ const delta = colorDelta(img1, img2, pos, pos);
340
+
341
+ // the color difference is above the threshold
342
+ if (Math.abs(delta) > maxDelta) {
343
+ // check it's a real rendering difference or just anti-aliasing
344
+ if (!options.includeAA && (antialiased(img1, x, y, width, height, img2)
345
+ || antialiased(img2, x, y, width, height, img1))) {
346
+ // one of the pixels is anti-aliasing; draw as yellow and do not count as difference
347
+ // note that we do not include such pixels in a mask
348
+ if (output && !options.diffMask) drawPixel(output, pos, ...options.aaColor);
349
+ } else {
350
+ // found substantial difference not caused by anti-aliasing; draw it as such
351
+ if (output) {
352
+ drawPixel(output, pos, ...(delta < 0 && (options.diffColorAlt || options.diffColor)));
353
+ }
354
+ diff++;
355
+ }
356
+ } else if (output // pixels are similar; draw background as grayscale image blended with white
357
+ && !options.diffMask) drawGrayPixel(img1, pos, options.alpha, output);
358
+ }
359
+ }
360
+
361
+ // return the number of different pixels
362
+ return diff;
363
+ }
package/utils/popup.js CHANGED
@@ -1,11 +1,21 @@
1
+ /**
2
+ * @typedef {Object} DOMRectLike
3
+ * @prop {number} left
4
+ * @prop {number} right
5
+ * @prop {number} top
6
+ * @prop {number} bottom
7
+ * @prop {number} width
8
+ * @prop {number} height
9
+ */
10
+
1
11
  /**
2
12
  * @typedef {Object} CanAnchorPopUpOptions
3
- * @prop {Element|DOMRect} [anchor]
13
+ * @prop {Element|DOMRectLike} [anchor]
4
14
  * @prop {number|'left'|'center'|'right'} [clientX]
5
15
  * @prop {number|'top'|'center'|'bottom'} [clientY]
6
16
  * @prop {number} [pageX]
7
17
  * @prop {number} [pageY]
8
- * @prop {Element|DOMRect} [popup]
18
+ * @prop {Element|{width:number, height:number}} [popup]
9
19
  * @prop {number} [width]
10
20
  * @prop {number} [height]
11
21
  * @prop {number} [offsetX] Offset from anchor
@@ -19,9 +29,24 @@
19
29
  /** @param {CanAnchorPopUpOptions} options */
20
30
  export function canAnchorPopup(options) {
21
31
  let { pageX, pageY, directionX, directionY } = options;
32
+ const pageWidth = document.documentElement.clientWidth;
33
+ const pageHeight = document.documentElement.clientHeight;
22
34
  if (pageX == null || pageY == null) {
23
35
  const { clientX, clientY, anchor } = options;
24
- const rect = anchor instanceof Element ? anchor.getBoundingClientRect() : anchor;
36
+ let rect;
37
+ if (anchor) {
38
+ rect = anchor instanceof Element ? anchor.getBoundingClientRect() : anchor;
39
+ } else {
40
+ rect = {
41
+ left: 0,
42
+ width: pageWidth,
43
+ right: pageWidth,
44
+ top: 0,
45
+ bottom: pageHeight,
46
+ height: pageHeight,
47
+ };
48
+ }
49
+
25
50
  if (pageX == null) {
26
51
  switch (clientX) {
27
52
  case 'left':
@@ -72,7 +97,7 @@ export function canAnchorPopup(options) {
72
97
  height = popup.clientHeight;
73
98
  } else {
74
99
  width = popup.width;
75
- height = popup.width;
100
+ height = popup.height;
76
101
  }
77
102
  }
78
103
 
@@ -81,42 +106,84 @@ export function canAnchorPopup(options) {
81
106
  let bottom;
82
107
  let left;
83
108
  const margin = options.margin ?? 0;
84
- const pageTop = margin;
85
- const pageBottom = document.documentElement.clientHeight - margin;
86
- const pageRight = document.documentElement.clientWidth - margin;
87
- const pageLeft = margin;
109
+
110
+ let pageTop = margin;
111
+ let pageBottom = -margin;
112
+ let pageLeft = margin;
113
+ let pageRight = -margin;
114
+
115
+ if (window.visualViewport) {
116
+ pageTop += window.visualViewport.offsetTop;
117
+ pageBottom += window.visualViewport.offsetTop + window.visualViewport.height;
118
+ pageLeft += window.visualViewport.offsetLeft;
119
+ pageRight += window.visualViewport.offsetLeft + window.visualViewport.width;
120
+ } else {
121
+ pageBottom += pageHeight;
122
+ pageRight += pageWidth;
123
+ }
88
124
 
89
125
  const offsetX = options.offsetX ?? 0;
90
126
  const offsetY = options.offsetY ?? 0;
91
127
  pageX += offsetX;
92
128
  pageY += offsetY;
93
129
 
130
+ let cssTop = 'auto';
131
+ let cssRight = 'auto';
132
+ let cssBottom = 'auto';
133
+ let cssLeft = 'auto';
134
+ let maxHeight = null;
135
+ let maxWidth = null;
136
+
94
137
  switch (directionY) {
95
138
  case 'up':
96
139
  bottom = Math.min(pageY, pageBottom);
97
140
  top = Math.max(bottom - height, pageTop);
141
+ cssBottom = `${pageHeight - bottom}px`;
142
+ if (top === pageTop) {
143
+ maxHeight = `${bottom - pageTop}px`;
144
+ }
98
145
  break;
99
146
  case 'center':
100
147
  top = Math.max(pageY - height / 2, pageTop);
101
148
  bottom = Math.min(pageY + height / 2, pageBottom);
149
+ cssTop = `${top}px`;
150
+ if (bottom === pageBottom) {
151
+ maxHeight = `${pageBottom - pageTop}px`;
152
+ }
102
153
  break;
103
154
  default:
104
155
  top = Math.max(pageY, pageTop);
105
156
  bottom = Math.min(top + height, pageBottom);
157
+ cssTop = `${top}px`;
158
+ if (bottom === pageBottom) {
159
+ maxHeight = `${pageBottom - top}px`;
160
+ }
106
161
  }
107
162
 
108
163
  switch (directionX) {
109
164
  case 'left':
110
165
  right = Math.min(pageX, pageRight);
111
166
  left = Math.max(right - width, pageLeft);
167
+ cssRight = `${pageWidth - right}px`;
168
+ if (left === pageLeft) {
169
+ maxWidth = `${right - pageLeft}px`;
170
+ }
112
171
  break;
113
172
  case 'center':
114
173
  left = Math.max(pageX - width / 2, pageLeft);
115
174
  right = Math.min(pageX + width / 2, pageRight);
175
+ cssLeft = `${left}px`;
176
+ if (right === pageRight) {
177
+ maxWidth = `${pageRight - pageLeft}px`;
178
+ }
116
179
  break;
117
180
  default:
118
181
  left = Math.max(pageX, pageLeft);
119
182
  right = Math.min(left + width, pageRight);
183
+ cssLeft = `${left}px`;
184
+ if (right === pageRight) {
185
+ maxWidth = `${pageRight - left}px`;
186
+ }
120
187
  }
121
188
 
122
189
  // compute area
@@ -125,6 +192,8 @@ export function canAnchorPopup(options) {
125
192
 
126
193
  const visibility = realSize / fullSize;
127
194
 
195
+ const transformOriginX = directionX === 'center' ? 'center' : (directionX === 'left' ? 'right' : 'left');
196
+ const transformOriginY = directionY === 'center' ? 'center' : (directionY === 'up' ? 'bottom' : 'top');
128
197
  return {
129
198
  ...options,
130
199
  top,
@@ -132,7 +201,14 @@ export function canAnchorPopup(options) {
132
201
  bottom,
133
202
  left,
134
203
  visibility,
135
- transformOriginX: directionX === 'center' ? 'center' : (directionX === 'left' ? 'right' : 'left'),
136
- transformOriginY: directionY === 'center' ? 'center' : (directionY === 'up' ? 'bottom' : 'top'),
204
+ styles: {
205
+ top: cssTop,
206
+ bottom: cssBottom,
207
+ left: cssLeft,
208
+ right: cssRight,
209
+ maxWidth,
210
+ maxHeight,
211
+ transformOrigin: `${transformOriginY} ${transformOriginX}`,
212
+ },
137
213
  };
138
214
  }
@@ -0,0 +1,22 @@
1
+ /** @type {URLSearchParams} */
2
+ let currentSearchParams = null;
3
+
4
+ /** @return {URLSearchParams} */
5
+ export function getCurrentSearchParams() {
6
+ if (!currentSearchParams) {
7
+ let url;
8
+ try {
9
+ url = import.meta.url;
10
+ } catch {}
11
+ if (!url) {
12
+ try {
13
+ url = /** @type {HTMLScriptElement} */ (document.currentScript).src;
14
+ } catch {}
15
+ }
16
+ if (!url) {
17
+ return new URLSearchParams();
18
+ }
19
+ currentSearchParams = new URL(url).searchParams;
20
+ }
21
+ return currentSearchParams;
22
+ }
@@ -1,61 +0,0 @@
1
- # Syntax
2
-
3
-
4
- ## Elevated
5
- ```html
6
- <mdw-button elevated>Elevated</mdw-button>
7
- <mdw-button disabled elevated>Elevated (disabled)</mdw-button>
8
- <mdw-button elevated icon=search>Elevated icon</mdw-button>
9
- <mdw-button elevated color=surface ink=tertiary>Elevated Surface-Tertiary</mdw-button>
10
- ```
11
-
12
- ## Filled
13
- ```html
14
- <mdw-button filled>Filled button</mdw-button>
15
- <mdw-button disabled filled>Filled button (Disabled)</mdw-button>
16
- ```
17
-
18
- ## Filled Tonal
19
- ```html
20
- <mdw-button filled=tonal>Filled tonal button</mdw-button>
21
- <mdw-button disabled filled=tonal>Filled tonal button (Disabled)</mdw-button>
22
- <mdw-button filled=tonal icon=search>Filled tonal button</mdw-button>
23
- ```
24
-
25
- ## Outlined
26
- ```html
27
- <mdw-button outlined>Outlined</mdw-button>
28
- <mdw-button outlined icon=add>Outlined icon</mdw-button>
29
- <mdw-button outlinedsurface icon=add>Outlined surface icon</mdw-button>
30
- <mdw-button disabled outlined>Outlined (Disabled)</mdw-button>
31
- <mdw-button disabled outlined icon=add>Outlined icon (Disabled)</mdw-button>
32
- ```
33
-
34
- ## Text
35
- ```html
36
- <mdw-button>Text</mdw-button>
37
- <mdw-button ink=tertiary icon=add>Tertiary</mdw-button>
38
- <mdw-button ink=tertiary disabled>Text (Disabled)</mdw-button>
39
- <mdw-button ink=primary disabled icon=add>Icon text (Disabled)</mdw-button>
40
- ```
41
-
42
- ## Custom
43
- ```html
44
- <mdw-button ink=yellow>Custom text</mdw-button>
45
- <mdw-button elevated ink=yellow>Custom elevated</mdw-button>
46
- <mdw-button filled color=yellow>Custom filled</mdw-button>
47
- <mdw-button filled=tonal icon=add color=yellow-container>Custom tonal</mdw-button>
48
- <mdw-button outlined ink=yellow>Custom outlined</mdw-button>
49
- <mdw-button disabled outlined>Outlined (Disabled)</mdw-button>
50
- <mdw-button disabled outlined icon=add>Outlined icon (Disabled)</mdw-button>
51
- <mdw-button disabled ink=yellow>Custom text</mdw-button>
52
- <mdw-button disabled elevated=yellow>Custom elevated</mdw-button>
53
- <mdw-button disabled filled color=yellow>Custom filled</mdw-button>
54
- <mdw-button disabled filled=tonal icon=add color=yellow-container>Custom tonal</mdw-button>
55
- ```
56
-
57
- ```js
58
- import Button from "components/Button.js";
59
-
60
- Button.register()
61
- ```
@@ -1,32 +0,0 @@
1
- import Button from './Button.js';
2
-
3
- export default Button
4
- .extend()
5
- .css`
6
- /* https://m3.material.io/components/extended-fab/specs */
7
-
8
- :host {
9
- --mdw-bg: var(--mdw-color__surface-container-high);
10
- --mdw-ink: var(--mdw-color__primary);
11
- --mdw-shape__size: 16px;
12
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__3);
13
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__4);
14
- min-inline-size: 48px;
15
- padding: calc(16px + (var(--mdw-density) * 2px));
16
- }
17
-
18
- #icon {
19
- font-size: 24px;
20
- }
21
-
22
- :host(:where([lowered])) {
23
- --mdw-bg: var(--mdw-color__surface-container-low);
24
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
25
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
26
- }
27
- `
28
- .observe({
29
- filled: { empty: 'tonal' },
30
- elevated: { type: 'boolean', empty: true },
31
- })
32
- .autoRegister('mdw-extended-fab');