@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
@@ -1,97 +1,25 @@
1
+ import { attemptFocus, isRtl } from '../core/dom.js';
2
+ import { canAnchorPopup } from '../utils/popup.js';
3
+
4
+ import DelegatesFocusMixin from './DelegatesFocusMixin.js';
5
+ import '../components/Scrim.js';
6
+ import ResizeObserverMixin from './ResizeObserverMixin.js';
7
+
8
+ const supportsHTMLDialogElement = typeof HTMLDialogElement !== 'undefined';
9
+
10
+ /** @typedef {import('../utils/popup.js').DOMRectLike} DOMRectLike */
11
+
1
12
  /**
2
13
  * @typedef {Object} PopupStack
3
- * @prop {Element} element
4
- * @prop {Element} previousFocus
14
+ * @prop {InstanceType<ReturnType<typeof PopupMixin>>} element
15
+ * @prop {HTMLElement} previousFocus
5
16
  * @prop {boolean} [centered=false]
6
17
  * @prop {Record<string, any>} [state]
7
18
  * @prop {Record<string, any>} [previousState]
8
- * @prop {MouseEvent|PointerEvent|HTMLElement|Element} [originalEvent]
9
19
  * @prop {any} [pendingResizeOperation]
10
20
  * @prop {window['history']['scrollRestoration']} [scrollRestoration]
11
21
  */
12
22
 
13
- import CustomElement from '../core/CustomElement.js';
14
- import { attemptFocus } from '../core/dom.js';
15
- import { canAnchorPopup } from '../utils/popup.js';
16
-
17
- CustomElement
18
- .extend()
19
- .observe({
20
- hidden: 'boolean',
21
- })
22
- .html`<div id=scroll-blocker></div>`
23
- .css`
24
- :host {
25
- position: fixed;
26
- inset: 0;
27
-
28
- display: block;
29
- overflow: overlay;
30
-
31
- overscroll-behavior: none;
32
- overscroll-behavior: contain;
33
- scrollbar-color: transparent transparent;
34
- scrollbar-width: thin;
35
-
36
- opacity: 0;
37
-
38
- z-index: 23;
39
-
40
- background-color: rgb(var(--mdw-color__scrim));
41
-
42
- animation: fade-in 200ms forwards ease-out;
43
-
44
- will-change: opacity;
45
- }
46
-
47
- :host([hidden]) {
48
- animation-name: fade-out;
49
- animation-timing-function: ease-in;
50
- }
51
-
52
- :host([invisible]) {
53
- background: transparent;
54
- }
55
-
56
- #scroll-blocker {
57
- position: absolute;
58
- top: 0;
59
- left: 0;
60
-
61
- display: block;
62
-
63
- height: 200%;
64
- width: 200%;
65
- }
66
-
67
- @keyframes fade-in {
68
- from {
69
- opacity: 0;
70
- }
71
-
72
- to {
73
- opacity: 0.38;
74
- }
75
- }
76
-
77
- @keyframes fade-out {
78
- from {
79
- opacity: 0.38;
80
- }
81
-
82
- to {
83
- opacity: 0;
84
- }
85
- }
86
- `
87
- .events({
88
- animationend() {
89
- if (this.hidden) this.remove();
90
- },
91
- })
92
- .autoRegister('mdw-scrim');
93
-
94
- const supportsHTMLDialogElement = typeof HTMLDialogElement !== 'undefined';
95
23
  /** @type {PopupStack[]} */
96
24
  const OPEN_POPUPS = [];
97
25
 
@@ -99,17 +27,20 @@ const OPEN_POPUPS = [];
99
27
  * @return {void}
100
28
  */
101
29
  function onWindowResize() {
102
- const lastOpenPopup = OPEN_POPUPS.at(-1);
103
- if (!lastOpenPopup || !lastOpenPopup.originalEvent) {
104
- return;
30
+ // Fire in popup order
31
+ for (const { element } of OPEN_POPUPS) {
32
+ element.updatePopupPosition();
105
33
  }
106
- if (lastOpenPopup.pendingResizeOperation) {
107
- cancelAnimationFrame(lastOpenPopup.pendingResizeOperation);
34
+ }
35
+
36
+ /**
37
+ * Prevent focus being given to elements via mouse nav back
38
+ * @param {MouseEvent} event
39
+ */
40
+ function onNavMouseDown(event) {
41
+ if (event.button === 3) {
42
+ event.preventDefault();
108
43
  }
109
- lastOpenPopup.pendingResizeOperation = requestAnimationFrame(() => {
110
- lastOpenPopup.element.updatePopupPosition(lastOpenPopup.originalEvent);
111
- lastOpenPopup.pendingResizeOperation = null;
112
- });
113
44
  }
114
45
 
115
46
  /**
@@ -141,78 +72,101 @@ function onBeforeUnload(event) {
141
72
  }
142
73
 
143
74
  /**
75
+ * Provides positioning, modal behavior, and history-aware popup/dialog support.
144
76
  * @param {typeof import('../core/CustomElement.js').default} Base
145
77
  */
146
78
  export default function PopupMixin(Base) {
147
79
  return Base
80
+ .mixin(DelegatesFocusMixin)
81
+ .mixin(ResizeObserverMixin)
148
82
  .observe({
83
+ /** Whether the popup is currently open */
149
84
  open: 'boolean',
85
+ /** When true the popup behaves as a blocking modal */
150
86
  modal: 'boolean',
151
- _isNativeModal: 'boolean',
87
+ /** Use the native HTMLDialogElement when available */
88
+ native: 'boolean',
89
+ /** Allow internal content to scroll when true */
152
90
  scrollable: 'boolean',
91
+ /** When true, match the popup width to the source element */
153
92
  matchSourceWidth: 'boolean',
93
+ /** Internal: current resolved flow used for positioning */
154
94
  _currentFlow: 'string',
155
95
  flow: {
156
96
  type: 'string',
157
97
  /** @type {'corner'|'adjacent'|'overflow'|'vcenter'|'hcenter'|'center'} */
158
98
  value: null,
159
99
  },
100
+ /** Margin between popup and viewport/anchor (px) */
101
+ popupMargin: 'float',
160
102
  })
161
103
  .set({
104
+ /** Whether to push/pop history entries when opening the popup */
105
+ useHistory: true,
106
+ /** Optional return value for dialog-like popups */
162
107
  returnValue: '',
163
- delegatesFocus: true,
108
+ /** Internal: true while closing is in-progress */
164
109
  _closing: false,
110
+ /** Internal: whether to show a scrim (overlay) for modal popups */
165
111
  _useScrim: false,
112
+ /**
113
+ * Source that triggered the popup
114
+ * @type {MouseEvent|PointerEvent|HTMLElement|Event}
115
+ */
116
+ _source: null,
117
+ /**
118
+ * Anchor used for positioning
119
+ * @type {MouseEvent|PointerEvent|HTMLElement|Event}
120
+ */
121
+ _anchor: null,
166
122
  })
167
123
  .define({
168
124
  _dialog() {
169
125
  return /** @type {HTMLDialogElement} */ (this.refs.dialog);
170
126
  },
171
127
  })
128
+ .expressions({
129
+ _ariaHidden({ open }) {
130
+ return (open ? 'false' : 'true');
131
+ },
132
+ })
172
133
  .methods({
173
134
  /**
174
- * @param {DOMRect|Element} [anchor]
135
+ * @param {DOMRectLike|Element} [anchor]
175
136
  * @return {void}
176
137
  */
177
- updatePopupPosition(anchor) {
138
+ updatePopupPosition(anchor = this._anchor) {
178
139
  const flow = this._currentFlow ?? this.flow;
179
- this.style.setProperty('min-width', 'none');
180
- this.style.setProperty('min-height', 'none');
181
- this.style.setProperty('width', 'auto');
182
- this.style.setProperty('height', 'auto');
183
- this.style.setProperty('max-width', 'none');
184
- this.style.setProperty('max-height', 'none');
185
- this.style.setProperty('top', '0');
186
- this.style.setProperty('left', '0');
187
- this.style.setProperty('--mdw-popup__x-offset', '0');
188
- this.style.setProperty('--mdw-popup__y-offset', '0');
189
-
190
- const layoutElement = this._isNativeModal ? this._dialog : this;
191
- layoutElement.style.setProperty('width', 'auto');
192
- layoutElement.style.setProperty('height', 'auto');
140
+ Object.assign(this.style, {
141
+ top: '0',
142
+ left: '0',
143
+ right: 'auto',
144
+ bottom: 'auto',
145
+ maxWidth: null,
146
+ maxHeight: null,
147
+ });
148
+
149
+ const layoutElement = this.native ? this._dialog : this;
150
+ Object.assign(layoutElement.style, { width: 'auto', height: 'auto' });
193
151
 
194
152
  const width = (anchor && this.matchSourceWidth)
195
- ? anchor.clientWidth
153
+ ? /** @type {Element} */ (anchor).clientWidth
196
154
  : 56 * Math.ceil(layoutElement.clientWidth / 56);
197
155
 
198
- this.style.setProperty('width', `${width}px`);
156
+ layoutElement.style.setProperty('width', `${width}px`);
199
157
 
200
158
  const height = layoutElement.clientHeight;
201
- layoutElement.style.removeProperty('width');
202
- layoutElement.style.removeProperty('height');
159
+ Object.assign(layoutElement.style, { height: null });
203
160
 
204
- const initialRect = this.getBoundingClientRect();
205
161
  /** @type {import('../utils/popup.js').CanAnchorPopUpOptions} */
206
162
  const anchorOptions = {
207
- anchor: anchor == null
208
- ? this.getBoundingClientRect()
209
- : (anchor instanceof Element ? anchor.getBoundingClientRect() : anchor),
163
+ anchor,
210
164
  width,
211
165
  height,
212
- margin: 0,
166
+ margin: this.popupMargin ?? (window.innerWidth < 648 ? 16 : 24),
213
167
  };
214
168
 
215
- const isPageRTL = (getComputedStyle(this).direction === 'rtl');
169
+ const isPageRTL = isRtl(this);
216
170
  const xStart = isPageRTL ? 'right' : 'left';
217
171
  const xEnd = isPageRTL ? 'left' : 'right';
218
172
 
@@ -272,8 +226,7 @@ export default function PopupMixin(Base) {
272
226
  * - Open from center 9i █·
273
227
  */
274
228
 
275
- /** @type {import('../utils/popup.js').CanAnchorPopUpOptions[]} */
276
- const preferences = [
229
+ const preferences = /** @type {import('../utils/popup.js').CanAnchorPopUpOptions[]} */ ([
277
230
  ((flow ?? 'corner') === 'corner') ? [
278
231
  { clientY: 'bottom', clientX: xStart },
279
232
  { clientY: 'bottom', clientX: xEnd },
@@ -303,7 +256,7 @@ export default function PopupMixin(Base) {
303
256
  ((flow ?? 'center') === 'center') ? [
304
257
  { clientY: 'center', clientX: 'center', directionX: 'center', directionY: 'center' },
305
258
  ] : [],
306
- ].flat();
259
+ ].flat());
307
260
 
308
261
  let anchorResult;
309
262
  for (const preference of preferences) {
@@ -317,16 +270,18 @@ export default function PopupMixin(Base) {
317
270
  if (result.visibility === 1) break;
318
271
  }
319
272
 
320
- this.style.setProperty('top', `${anchorResult.top - initialRect.y}px`);
321
- this.style.setProperty('left', `${anchorResult.left - initialRect.x}px`);
322
- this.style.setProperty('min-width', `${anchorResult.right - anchorResult.left}px`);
323
- this.style.setProperty('min-height', `${anchorResult.bottom - anchorResult.top}px`);
324
- this.style.removeProperty('width');
325
- this.style.removeProperty('height');
326
- this.style.setProperty('max-width', `${anchorResult.right - anchorResult.left}px`);
327
- this.style.setProperty('max-height', `${anchorResult.bottom - anchorResult.top}px`);
328
- this.style.setProperty('transform-origin', `${anchorResult.transformOriginY} ${anchorResult.transformOriginX}`);
329
- this.scrollIntoView();
273
+ let { maxWidth, maxHeight } = anchorResult.styles;
274
+ if (maxWidth || maxHeight) {
275
+ const styles = window.getComputedStyle(this);
276
+ if (styles.maxWidth) {
277
+ maxWidth = `min(${maxWidth}, ${styles.maxWidth})`;
278
+ }
279
+ if (styles.maxHeight) {
280
+ maxHeight = `min(${maxHeight}, ${styles.maxHeight})`;
281
+ }
282
+ }
283
+ Object.assign(this.style, { ...anchorResult.styles, maxWidth, maxHeight });
284
+ // this.scrollIntoView();
330
285
  },
331
286
  /**
332
287
  * @param {Event & {currentTarget: HTMLSlotElement}} event
@@ -348,19 +303,27 @@ export default function PopupMixin(Base) {
348
303
  showPopup(source, focus = true, flow = null) {
349
304
  if (this.open) return false;
350
305
  this.open = true;
306
+ this._source = source;
307
+ this._anchor = source;
351
308
 
352
- // SCRIM
309
+ const { scrim } = this.refs;
353
310
  if (this._useScrim) {
354
- document.body.append(this.refs.scrim);
355
- this.refs.scrim.hidden = false;
311
+ if (this.native) {
312
+ document.body.append(scrim);
313
+ } else {
314
+ this.before(scrim);
315
+ }
316
+ scrim.hidden = false;
356
317
  } else {
357
- this.refs.scrim.remove();
318
+ scrim.remove();
358
319
  }
359
320
 
360
- const previousFocus = source instanceof HTMLElement ? source : document.activeElement;
321
+ const previousFocus = source instanceof HTMLElement
322
+ ? source
323
+ : /** @type {HTMLElement} */(document.activeElement);
361
324
 
362
- if (supportsHTMLDialogElement && focus) {
363
- // Calling show will force focus which is not intended for non-modals
325
+ if (supportsHTMLDialogElement && focus // Calling show will force focus which is not intended for non-modals
326
+ && !this._dialog.open) {
364
327
  this._dialog.show();
365
328
  }
366
329
 
@@ -368,41 +331,50 @@ export default function PopupMixin(Base) {
368
331
 
369
332
  // Short first, then move
370
333
  // Native modals can fail update bounds on Chrome
334
+ // @ts-ignore `updatePopupPosition` has runtime check
371
335
  this.updatePopupPosition(source);
372
336
 
373
- const newState = { hash: Math.random().toString(36).slice(2, 18) };
374
- let previousState = null;
337
+ let newState;
338
+ let scrollRestoration;
339
+ let previousState;
340
+ if (this.useHistory) {
341
+ newState = { hash: Math.random().toString(36).slice(2, 18) };
342
+
343
+ if (!window.history.state) {
344
+ // Create new previous state
345
+ window.history.replaceState({
346
+ hash: Math.random().toString(36).slice(2, 18),
347
+ }, document.title);
348
+ }
349
+ previousState = window.history.state;
350
+
351
+ scrollRestoration = window.history.scrollRestoration;
375
352
 
376
- if (!window.history.state) {
377
- // Create new previous state
378
- window.history.replaceState({
379
- hash: Math.random().toString(36).slice(2, 18),
380
- }, document.title);
353
+ window.history.scrollRestoration = 'manual';
354
+ window.history.pushState(newState, document.title);
355
+ window.addEventListener('popstate', onPopState);
356
+ window.addEventListener('beforeunload', onBeforeUnload);
381
357
  }
382
- previousState = window.history.state;
383
358
 
384
- const scrollRestoration = window.history.scrollRestoration;
385
- window.history.scrollRestoration = 'manual';
386
- window.history.pushState(newState, document.title);
387
- console.debug('Popup pushed page');
388
- window.addEventListener('popstate', onPopState);
389
- window.addEventListener('beforeunload', onBeforeUnload);
359
+ window.addEventListener('mousedown', onNavMouseDown, { capture: true });
390
360
 
391
361
  window.addEventListener('resize', onWindowResize);
392
362
  window.addEventListener('scroll', onWindowResize);
363
+ if (window.visualViewport) {
364
+ window.visualViewport.addEventListener('resize', onWindowResize);
365
+ window.visualViewport.addEventListener('scroll', onWindowResize);
366
+ }
393
367
 
394
368
  OPEN_POPUPS.push({
395
369
  element: this,
396
370
  previousFocus,
397
371
  state: newState,
398
372
  previousState,
399
- originalEvent: source,
400
373
  scrollRestoration,
401
374
  });
402
375
 
403
376
  // Overrideable
404
377
  if (focus) {
405
- console.log('focusing!');
406
378
  this.focus();
407
379
  }
408
380
 
@@ -419,7 +391,7 @@ export default function PopupMixin(Base) {
419
391
  this.modal = true;
420
392
  if (supportsHTMLDialogElement) {
421
393
  this._dialog.showModal();
422
- this._isNativeModal = true;
394
+ this.native = true;
423
395
  }
424
396
  return this.showPopup(source, focus, flow);
425
397
  },
@@ -445,14 +417,15 @@ export default function PopupMixin(Base) {
445
417
  close(returnValue = undefined, returnFocus = true) {
446
418
  if (!this.open) return false;
447
419
  if (this._closing) return false;
420
+ this._source = null;
448
421
  this._closing = true;
449
422
  this.modal = false;
450
423
 
451
424
  // SCRIM
452
425
  this.refs.scrim.hidden = true;
453
426
 
454
- if (this._isNativeModal) {
455
- this._isNativeModal = false;
427
+ if (this.native) {
428
+ this.native = false;
456
429
  } else {
457
430
  const main = document.querySelector('main');
458
431
  if (main) {
@@ -465,7 +438,8 @@ export default function PopupMixin(Base) {
465
438
  // Closing a native dialog will return focus automatically.
466
439
  this._dialog.close();
467
440
  if (!attemptFocus(previousFocus, { preventScroll: true })) {
468
- document.activeElement?.blur?.();
441
+ const currentlyFocused = /** @type {SVGElement|HTMLElement} */ (document.activeElement);
442
+ currentlyFocused?.blur?.();
469
443
  }
470
444
  } else {
471
445
  this._dialog.returnValue = returnValue;
@@ -481,43 +455,50 @@ export default function PopupMixin(Base) {
481
455
  for (let i = len - 1; i >= 0; i--) {
482
456
  const entry = OPEN_POPUPS[i];
483
457
  if (entry.element === this) {
484
- if (entry.state && window.history
485
- && window.history.state && entry.state.hash === window.history.state.hash) {
486
- window.removeEventListener('popstate', onPopState);
487
- window.history.back();
488
- // Back does not set state immediately
489
- // Needed to track submenu
490
- // TODO: use window.history.go(indexDelta) instead for Safari (not Webkit) submenu support
491
- window.history.replaceState(entry.previousState, document.title);
492
- window.history.scrollRestoration = entry.scrollRestoration || 'auto';
493
- window.addEventListener('popstate', onPopState);
494
- } else {
495
- console.warn('Menu state mismatch?', entry, window.history.state);
458
+ if (this.useHistory) {
459
+ if (entry.state && window.history
460
+ && window.history.state && entry.state.hash === window.history.state.hash) {
461
+ window.removeEventListener('popstate', onPopState);
462
+ window.history.back();
463
+ // Back does not set state immediately
464
+ // Needed to track submenu
465
+ // TODO: use window.history.go(indexDelta) instead for Safari (not Webkit) submenu support
466
+ window.history.replaceState(entry.previousState, document.title);
467
+ window.history.scrollRestoration = entry.scrollRestoration || 'auto';
468
+ window.addEventListener('popstate', onPopState);
469
+ } else {
470
+ console.warn('Menu state mismatch?', entry, window.history.state);
471
+ }
496
472
  }
497
473
  if (returnFocus) {
498
- console.log('not returning focus');
474
+ // console.log('not returning focus');
499
475
  entry.previousFocus?.focus?.({ preventScroll: true });
500
476
  }
501
477
  OPEN_POPUPS.splice(i, 1);
502
478
  break;
503
479
  } else if (this.contains(entry.element)) {
504
- console.debug('Closing submenu first');
480
+ // console.debug('Closing submenu first');
505
481
  entry.element.close(false);
506
- console.debug('Sub menu closed. Continuing...');
482
+ // console.debug('Sub menu closed. Continuing...');
507
483
  }
508
484
  }
509
485
  if (!OPEN_POPUPS.length) {
510
486
  window.removeEventListener('popstate', onPopState);
511
487
  window.removeEventListener('beforeunload', onBeforeUnload);
512
488
  window.removeEventListener('resize', onWindowResize);
513
- console.debug('All menus closed');
489
+ window.removeEventListener('mousedown', onNavMouseDown, { capture: true });
490
+ // console.debug('All menus closed');
514
491
  }
515
492
  this._closing = false;
516
493
  return true;
517
494
  },
518
495
  })
519
- .expressions({
520
- _ariaHidden({ open }) { return (open ? 'false' : 'true'); },
496
+
497
+ .overrides({
498
+ onResizeObserved(entry) {
499
+ if (!this.open || this._closing) return;
500
+ this.updatePopupPosition();
501
+ },
521
502
  })
522
503
  .html`
523
504
  <mdw-scrim id=scrim tabindex=-1 aria-hidden=true></mdw-scrim>
@@ -529,19 +510,25 @@ export default function PopupMixin(Base) {
529
510
  .css`
530
511
  /* https://m3.material.io/components/dialogs/specs */
531
512
 
513
+ :host([popover]) {
514
+ margin: 0;
515
+ border: 0;
516
+ padding: 0;
517
+ }
518
+
519
+ :host(::backdrop) {
520
+ display: none;
521
+ }
522
+
532
523
  :host {
533
524
  --mdw-popup__expand-duration: var(--mdw-motion-expand-duration, 250ms);
534
525
  --mdw-popup__simple-duration: var(--mdw-motion-simple-duration, 100ms);
535
526
  --mdw-popup__standard-easing: var(--mdw-motion-standard-easing, cubic-bezier(0.4, 0.0, 0.2, 1));
536
527
  --mdw-popup__deceleration-easing: var(--mdw-motion-deceleration-easing, cubic-bezier(0.0, 0.0, 0.2, 1));
537
528
  --mdw-popup__fade-in-duration: var(--mdw-motion-fade-in-duration, 150ms);
538
- --mdw-popup__x-offset: -50%;
539
- --mdw-popup__y-offset: -50%;
540
529
 
541
530
  --mdw-shape__size: 28px;
542
531
 
543
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__3);
544
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
545
532
  /* padding-inline: 12px; */
546
533
 
547
534
  --mdw-bg: var(--mdw-color__surface);
@@ -549,10 +536,8 @@ export default function PopupMixin(Base) {
549
536
 
550
537
  position: fixed;
551
538
 
552
- /* stylelint-disable-next-line liberty/use-logical-spec */
553
- top: 50%;
554
- /* stylelint-disable-next-line liberty/use-logical-spec */
555
- left: 50%;
539
+ inset-block-start: 0;
540
+ inset-inline-start: 0;
556
541
  align-self: center;
557
542
  justify-self: center;
558
543
 
@@ -569,15 +554,14 @@ export default function PopupMixin(Base) {
569
554
  inline-size: auto;
570
555
  min-inline-size: none;
571
556
  max-inline-size: 100vw;
572
-
573
-
557
+
558
+ outline: none; /* Older Chromium Builds */
559
+
574
560
  pointer-events: none;
575
561
 
576
562
  opacity: 0;
563
+ transform: scale(0);
577
564
 
578
- transform: translateX(var(--mdw-popup__x-offset)) translateY(var(--mdw-popup__y-offset)) scale(0) ;
579
- /* visiblity:hidden still registers events, hide from pointer with scale(0) */
580
- transform-origin: top center;
581
565
  visibility: hidden;
582
566
  z-index: 24;
583
567
 
@@ -586,30 +570,30 @@ export default function PopupMixin(Base) {
586
570
  font: var(--mdw-type__font);
587
571
  letter-spacing: var(--mdw-type__letter-spacing);
588
572
 
589
- transition-delay: 0s, 200ms, 200ms;
590
- transition-duration: 200ms, 0s, 0s;
591
- transition-property: opacity, transform, visibility;
573
+ transition-delay: 200ms, 0s;
574
+ transition-duration: 0s, 200ms, 200ms;
575
+ transition-property: visibility, opacity, transform;
592
576
  transition-timing-function: ease-out;
593
577
 
594
- will-change: display, transform;
595
- will-change: opacity;
578
+ will-change: visibility, opacity, transform;
596
579
 
597
580
  }
598
581
 
599
582
  :host([open]) {
600
- pointer-events: auto;
583
+ pointer-events: inherit;
601
584
 
602
585
  opacity: 1;
603
586
 
604
- transform: translateX(var(--mdw-popup__x-offset)) translateY(var(--mdw-popup__y-offset)) scale(1);
605
- visibility: visible;
587
+ transform: none;
588
+ visibility: inherit;
606
589
 
607
590
  transition-delay: 0s;
608
- transition-duration: 0s;
609
591
  transition-timing-function: ease-in;
610
592
  }
611
593
 
612
-
594
+ :host([native][open]) {
595
+ opacity: 0;
596
+ }
613
597
 
614
598
  #dialog {
615
599
  position: static;
@@ -625,17 +609,16 @@ export default function PopupMixin(Base) {
625
609
  place-items: inherit;
626
610
 
627
611
  box-sizing: border-box;
628
-
629
612
  block-size: inherit;
630
-
631
-
632
613
  flex: inherit;
633
614
  margin:0;
634
615
  border: none;
635
616
  padding: inherit;
636
617
  padding: 0;
637
618
 
638
- pointer-events: auto;
619
+ pointer-events: inherit;
620
+
621
+ filter: inherit;
639
622
 
640
623
  opacity: 1;
641
624
 
@@ -650,6 +633,16 @@ export default function PopupMixin(Base) {
650
633
 
651
634
  }
652
635
 
636
+ :host([color]) {
637
+ background-color: rgb(var(--mdw-bg));
638
+ color: rgb(var(--mdw-ink));
639
+ }
640
+
641
+ :host(:is([color="none"],[color="transparent"])) {
642
+ background-color: transparent;
643
+ color: inherit;
644
+ }
645
+
653
646
  :host([scrollable]) {
654
647
  overflow-y:auto;
655
648
  }
@@ -681,10 +674,14 @@ export default function PopupMixin(Base) {
681
674
  flex: inherit;
682
675
  padding: inherit;
683
676
 
684
- pointer-events: auto;
677
+ pointer-events: inherit;
685
678
 
679
+ filter: inherit;
686
680
  transform: inherit;
687
681
  visibility: inherit;
682
+
683
+ background-color: inherit;
684
+ border-radius: inherit;
688
685
  }
689
686
 
690
687
  #dialog[scrollable][open] {
@@ -697,10 +694,10 @@ export default function PopupMixin(Base) {
697
694
 
698
695
  place-items: inherit;
699
696
 
700
- height: 100%;
701
- max-height: none;
702
- width: 100%;
703
- max-width: none;
697
+ block-size: 100%;
698
+ max-block-size: none;
699
+ inline-size: 100%;
700
+ max-inline-size: none;
704
701
 
705
702
  flex: 1;
706
703
  }
@@ -710,12 +707,12 @@ export default function PopupMixin(Base) {
710
707
  #dialog[scrollable][open]:modal {
711
708
  overflow:auto;
712
709
 
713
- height:100%;
714
- min-height: none;
715
- max-height: inherit;
716
- width:100%;
717
- min-width: none;
718
- max-width: inherit;
710
+ block-size:100%;
711
+ min-block-size: none;
712
+ max-block-size: inherit;
713
+ inline-size:100%;
714
+ min-inline-size: none;
715
+ max-inline-size: inherit;
719
716
  flex: inherit;
720
717
  padding: inherit;
721
718
  }
@@ -738,7 +735,7 @@ export default function PopupMixin(Base) {
738
735
  '~click'(event) {
739
736
  // Track if click on backdrop
740
737
  if (event.target !== event.currentTarget) return;
741
- if (!this._isNativeModal) return;
738
+ if (!this.native) return;
742
739
  if (event.offsetX >= 0 && event.offsetX < event.currentTarget.offsetWidth
743
740
  && event.offsetY >= 0 && event.offsetY < event.currentTarget.offsetHeight) return;
744
741
  const cancelEvent = new Event('cancel', { cancelable: true });