@shortfuse/materialdesignweb 0.8.0 → 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 (394) hide show
  1. package/README.md +32 -24
  2. package/bin/mdw-css.js +1 -1
  3. package/components/Badge.js +12 -5
  4. package/components/Body.js +3 -0
  5. package/components/BottomAppBar.js +1 -8
  6. package/components/BottomSheet.js +424 -0
  7. package/components/Box.js +11 -49
  8. package/components/Button.js +61 -82
  9. package/components/Card.js +56 -61
  10. package/components/Checkbox.js +7 -25
  11. package/components/CheckboxIcon.js +10 -28
  12. package/components/Chip.js +13 -11
  13. package/components/Dialog.js +49 -98
  14. package/components/Display.js +55 -0
  15. package/components/Fab.js +83 -17
  16. package/components/FabContainer.js +48 -0
  17. package/components/FilterChip.js +34 -32
  18. package/components/Grid.js +176 -0
  19. package/components/Headline.js +5 -28
  20. package/components/Icon.js +54 -69
  21. package/components/IconButton.js +71 -120
  22. package/components/Input.js +669 -83
  23. package/components/InputChip.js +161 -0
  24. package/components/Label.js +3 -0
  25. package/components/List.js +1 -5
  26. package/components/ListItem.js +39 -23
  27. package/components/ListOption.js +79 -62
  28. package/components/Listbox.js +19 -10
  29. package/components/Menu.js +8 -18
  30. package/components/MenuItem.js +25 -26
  31. package/components/NavBar.js +53 -19
  32. package/components/NavDrawer.js +15 -15
  33. package/components/NavDrawerItem.js +2 -4
  34. package/components/NavItem.js +40 -33
  35. package/components/NavRail.js +23 -21
  36. package/components/NavRailItem.js +5 -2
  37. package/components/Page.js +105 -0
  38. package/components/Pane.js +18 -0
  39. package/components/Popup.js +17 -8
  40. package/components/Radio.js +2 -5
  41. package/components/RadioIcon.js +10 -14
  42. package/components/Ripple.js +11 -7
  43. package/components/Root.js +209 -0
  44. package/components/Scrim.js +87 -0
  45. package/components/Search.js +12 -20
  46. package/components/SegmentedButton.js +33 -36
  47. package/components/SegmentedButtonGroup.js +9 -3
  48. package/components/Select.js +6 -7
  49. package/components/Shape.js +5 -65
  50. package/components/SideSheet.js +308 -0
  51. package/components/Slider.js +71 -34
  52. package/components/Snackbar.js +22 -16
  53. package/components/SnackbarContainer.js +42 -0
  54. package/components/Surface.js +15 -10
  55. package/components/Switch.js +3 -16
  56. package/components/SwitchIcon.js +40 -32
  57. package/components/Tab.js +57 -38
  58. package/components/TabContent.js +1 -0
  59. package/components/TabList.js +60 -32
  60. package/components/TabPanel.js +1 -1
  61. package/components/Table.js +116 -0
  62. package/components/TextArea.js +16 -15
  63. package/components/Title.js +4 -9
  64. package/components/Tooltip.js +43 -21
  65. package/components/TopAppBar.js +56 -78
  66. package/constants/shapes.js +36 -0
  67. package/constants/typography.js +127 -0
  68. package/core/Composition.js +354 -192
  69. package/core/CompositionAdapter.js +11 -12
  70. package/core/CustomElement.js +588 -236
  71. package/core/css.js +117 -12
  72. package/core/customTypes.js +120 -25
  73. package/core/dom.js +17 -11
  74. package/core/jsonMergePatch.js +12 -10
  75. package/core/observe.js +298 -253
  76. package/core/optimizations.js +9 -9
  77. package/core/template.js +14 -57
  78. package/dist/index.min.js +85 -115
  79. package/dist/index.min.js.map +4 -4
  80. package/dist/meta.json +1 -1
  81. package/dom/HTMLOptionsCollectionProxy.js +106 -0
  82. package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
  83. package/loaders/theme.js +12 -0
  84. package/mixins/AriaReflectorMixin.js +53 -13
  85. package/mixins/AriaToolbarMixin.js +3 -0
  86. package/mixins/ControlMixin.js +76 -33
  87. package/mixins/DelegatesFocusMixin.js +54 -0
  88. package/mixins/DensityMixin.js +2 -2
  89. package/mixins/ElevationMixin.js +62 -0
  90. package/mixins/FlexableMixin.js +66 -37
  91. package/mixins/FormAssociatedMixin.js +60 -8
  92. package/mixins/HyperlinkMixin.js +66 -0
  93. package/mixins/InputMixin.js +205 -32
  94. package/mixins/KeyboardNavMixin.js +8 -6
  95. package/mixins/NavigationListenerMixin.js +33 -0
  96. package/mixins/PopupMixin.js +176 -208
  97. package/mixins/ResizeObserverMixin.js +16 -4
  98. package/mixins/RippleMixin.js +8 -6
  99. package/mixins/ScrollListenerMixin.js +1 -1
  100. package/mixins/SemiStickyMixin.js +44 -98
  101. package/mixins/ShapeMaskedMixin.js +117 -0
  102. package/mixins/ShapeMixin.js +22 -204
  103. package/mixins/StateMixin.js +70 -34
  104. package/mixins/TextFieldMixin.js +107 -143
  105. package/mixins/ThemableMixin.js +44 -56
  106. package/mixins/TooltipTriggerMixin.js +291 -359
  107. package/mixins/TouchTargetMixin.js +1 -1
  108. package/mixins/TypographyMixin.js +121 -0
  109. package/package.json +110 -74
  110. package/services/rtl.js +10 -0
  111. package/services/svgAlias.js +17 -0
  112. package/{theming/index.js → services/theme.js} +24 -174
  113. package/types/bin/mdw-css.d.ts +3 -0
  114. package/types/bin/mdw-css.d.ts.map +1 -0
  115. package/types/components/Badge.d.ts +39 -0
  116. package/types/components/Badge.d.ts.map +1 -0
  117. package/types/components/Body.d.ts +29 -0
  118. package/types/components/Body.d.ts.map +1 -0
  119. package/types/components/BottomAppBar.d.ts +73 -0
  120. package/types/components/BottomAppBar.d.ts.map +1 -0
  121. package/types/components/BottomSheet.d.ts +109 -0
  122. package/types/components/BottomSheet.d.ts.map +1 -0
  123. package/types/components/Box.d.ts +16 -0
  124. package/types/components/Box.d.ts.map +1 -0
  125. package/types/components/Button.d.ts +714 -0
  126. package/types/components/Button.d.ts.map +1 -0
  127. package/types/components/Card.d.ts +412 -0
  128. package/types/components/Card.d.ts.map +1 -0
  129. package/types/components/Checkbox.d.ts +205 -0
  130. package/types/components/Checkbox.d.ts.map +1 -0
  131. package/types/components/CheckboxIcon.d.ts +44 -0
  132. package/types/components/CheckboxIcon.d.ts.map +1 -0
  133. package/types/components/Chip.d.ts +1425 -0
  134. package/types/components/Chip.d.ts.map +1 -0
  135. package/types/components/Dialog.d.ts +286 -0
  136. package/types/components/Dialog.d.ts.map +1 -0
  137. package/types/components/DialogActions.d.ts +4 -0
  138. package/types/components/DialogActions.d.ts.map +1 -0
  139. package/types/components/Display.d.ts +45 -0
  140. package/types/components/Display.d.ts.map +1 -0
  141. package/types/components/Divider.d.ts +10 -0
  142. package/types/components/Divider.d.ts.map +1 -0
  143. package/types/components/Fab.d.ts +741 -0
  144. package/types/components/Fab.d.ts.map +1 -0
  145. package/types/components/FabContainer.d.ts +10 -0
  146. package/types/components/FabContainer.d.ts.map +1 -0
  147. package/types/components/FilterChip.d.ts +4283 -0
  148. package/types/components/FilterChip.d.ts.map +1 -0
  149. package/types/components/Grid.d.ts +37 -0
  150. package/types/components/Grid.d.ts.map +1 -0
  151. package/types/components/Headline.d.ts +47 -0
  152. package/types/components/Headline.d.ts.map +1 -0
  153. package/types/components/Icon.d.ts +103 -0
  154. package/types/components/Icon.d.ts.map +1 -0
  155. package/types/components/IconButton.d.ts +1486 -0
  156. package/types/components/IconButton.d.ts.map +1 -0
  157. package/types/components/Input.d.ts +51288 -0
  158. package/types/components/Input.d.ts.map +1 -0
  159. package/types/components/InputChip.d.ts +243 -0
  160. package/types/components/InputChip.d.ts.map +1 -0
  161. package/types/components/Label.d.ts +29 -0
  162. package/types/components/Label.d.ts.map +1 -0
  163. package/types/components/List.d.ts +31 -0
  164. package/types/components/List.d.ts.map +1 -0
  165. package/types/components/ListItem.d.ts +349 -0
  166. package/types/components/ListItem.d.ts.map +1 -0
  167. package/types/components/ListOption.d.ts +1493 -0
  168. package/types/components/ListOption.d.ts.map +1 -0
  169. package/types/components/Listbox.d.ts +12012 -0
  170. package/types/components/Listbox.d.ts.map +1 -0
  171. package/types/components/Menu.d.ts +119 -0
  172. package/types/components/Menu.d.ts.map +1 -0
  173. package/types/components/MenuItem.d.ts +3109 -0
  174. package/types/components/MenuItem.d.ts.map +1 -0
  175. package/types/components/NavBar.d.ts +18 -0
  176. package/types/components/NavBar.d.ts.map +1 -0
  177. package/types/components/NavBarItem.d.ts +186 -0
  178. package/types/components/NavBarItem.d.ts.map +1 -0
  179. package/types/components/NavDrawer.d.ts +108 -0
  180. package/types/components/NavDrawer.d.ts.map +1 -0
  181. package/types/components/NavDrawerItem.d.ts +186 -0
  182. package/types/components/NavDrawerItem.d.ts.map +1 -0
  183. package/types/components/NavItem.d.ts +190 -0
  184. package/types/components/NavItem.d.ts.map +1 -0
  185. package/types/components/NavRail.d.ts +109 -0
  186. package/types/components/NavRail.d.ts.map +1 -0
  187. package/types/components/NavRailItem.d.ts +186 -0
  188. package/types/components/NavRailItem.d.ts.map +1 -0
  189. package/types/components/Page.d.ts +24 -0
  190. package/types/components/Page.d.ts.map +1 -0
  191. package/types/components/Pane.d.ts +44 -0
  192. package/types/components/Pane.d.ts.map +1 -0
  193. package/types/components/Popup.d.ts +76 -0
  194. package/types/components/Popup.d.ts.map +1 -0
  195. package/types/components/Progress.d.ts +19 -0
  196. package/types/components/Progress.d.ts.map +1 -0
  197. package/types/components/Radio.d.ts +199 -0
  198. package/types/components/Radio.d.ts.map +1 -0
  199. package/types/components/RadioIcon.d.ts +46 -0
  200. package/types/components/RadioIcon.d.ts.map +1 -0
  201. package/types/components/Ripple.d.ts +34 -0
  202. package/types/components/Ripple.d.ts.map +1 -0
  203. package/types/components/Root.d.ts +68 -0
  204. package/types/components/Root.d.ts.map +1 -0
  205. package/types/components/Scrim.d.ts +6 -0
  206. package/types/components/Scrim.d.ts.map +1 -0
  207. package/types/components/Search.d.ts +16 -0
  208. package/types/components/Search.d.ts.map +1 -0
  209. package/types/components/SegmentedButton.d.ts +718 -0
  210. package/types/components/SegmentedButton.d.ts.map +1 -0
  211. package/types/components/SegmentedButtonGroup.d.ts +44 -0
  212. package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
  213. package/types/components/Select.d.ts +1361 -0
  214. package/types/components/Select.d.ts.map +1 -0
  215. package/types/components/Shape.d.ts +10 -0
  216. package/types/components/Shape.d.ts.map +1 -0
  217. package/types/components/SideSheet.d.ts +106 -0
  218. package/types/components/SideSheet.d.ts.map +1 -0
  219. package/types/components/Slider.d.ts +382 -0
  220. package/types/components/Slider.d.ts.map +1 -0
  221. package/types/components/Snackbar.d.ts +65 -0
  222. package/types/components/Snackbar.d.ts.map +1 -0
  223. package/types/components/SnackbarContainer.d.ts +6 -0
  224. package/types/components/SnackbarContainer.d.ts.map +1 -0
  225. package/types/components/Surface.d.ts +45 -0
  226. package/types/components/Surface.d.ts.map +1 -0
  227. package/types/components/Switch.d.ts +183 -0
  228. package/types/components/Switch.d.ts.map +1 -0
  229. package/types/components/SwitchIcon.d.ts +169 -0
  230. package/types/components/SwitchIcon.d.ts.map +1 -0
  231. package/types/components/Tab.d.ts +879 -0
  232. package/types/components/Tab.d.ts.map +1 -0
  233. package/types/components/TabContent.d.ts +122 -0
  234. package/types/components/TabContent.d.ts.map +1 -0
  235. package/types/components/TabList.d.ts +6266 -0
  236. package/types/components/TabList.d.ts.map +1 -0
  237. package/types/components/TabPanel.d.ts +28 -0
  238. package/types/components/TabPanel.d.ts.map +1 -0
  239. package/types/components/Table.d.ts +2 -0
  240. package/types/components/Table.d.ts.map +1 -0
  241. package/types/components/TextArea.d.ts +1394 -0
  242. package/types/components/TextArea.d.ts.map +1 -0
  243. package/types/components/Title.d.ts +47 -0
  244. package/types/components/Title.d.ts.map +1 -0
  245. package/types/components/Tooltip.d.ts +49 -0
  246. package/types/components/Tooltip.d.ts.map +1 -0
  247. package/types/components/TopAppBar.d.ts +130 -0
  248. package/types/components/TopAppBar.d.ts.map +1 -0
  249. package/types/constants/colorKeywords.d.ts +2 -0
  250. package/types/constants/colorKeywords.d.ts.map +1 -0
  251. package/types/constants/shapes.d.ts +38 -0
  252. package/types/constants/shapes.d.ts.map +1 -0
  253. package/types/constants/typography.d.ts +212 -0
  254. package/types/constants/typography.d.ts.map +1 -0
  255. package/types/core/Composition.d.ts +252 -0
  256. package/types/core/Composition.d.ts.map +1 -0
  257. package/types/core/CompositionAdapter.d.ts +92 -0
  258. package/types/core/CompositionAdapter.d.ts.map +1 -0
  259. package/types/core/CustomElement.d.ts +302 -0
  260. package/types/core/CustomElement.d.ts.map +1 -0
  261. package/types/core/css.d.ts +44 -0
  262. package/types/core/css.d.ts.map +1 -0
  263. package/types/core/customTypes.d.ts +26 -0
  264. package/types/core/customTypes.d.ts.map +1 -0
  265. package/types/core/dom.d.ts +32 -0
  266. package/types/core/dom.d.ts.map +1 -0
  267. package/types/core/jsonMergePatch.d.ts +31 -0
  268. package/types/core/jsonMergePatch.d.ts.map +1 -0
  269. package/types/core/observe.d.ts +113 -0
  270. package/types/core/observe.d.ts.map +1 -0
  271. package/types/core/optimizations.d.ts +7 -0
  272. package/types/core/optimizations.d.ts.map +1 -0
  273. package/types/core/template.d.ts +47 -0
  274. package/types/core/template.d.ts.map +1 -0
  275. package/types/core/uid.d.ts +6 -0
  276. package/types/core/uid.d.ts.map +1 -0
  277. package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
  278. package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
  279. package/types/index.d.ts +88 -0
  280. package/types/index.d.ts.map +1 -0
  281. package/types/loaders/palette.d.ts +2 -0
  282. package/types/loaders/palette.d.ts.map +1 -0
  283. package/types/loaders/theme.d.ts +2 -0
  284. package/types/loaders/theme.d.ts.map +1 -0
  285. package/types/mixins/AriaReflectorMixin.d.ts +23 -0
  286. package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
  287. package/types/mixins/AriaToolbarMixin.d.ts +32 -0
  288. package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
  289. package/types/mixins/ControlMixin.d.ts +124 -0
  290. package/types/mixins/ControlMixin.d.ts.map +1 -0
  291. package/types/mixins/DelegatesFocusMixin.d.ts +5 -0
  292. package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
  293. package/types/mixins/DensityMixin.d.ts +5 -0
  294. package/types/mixins/DensityMixin.d.ts.map +1 -0
  295. package/types/mixins/ElevationMixin.d.ts +33 -0
  296. package/types/mixins/ElevationMixin.d.ts.map +1 -0
  297. package/types/mixins/FlexableMixin.d.ts +13 -0
  298. package/types/mixins/FlexableMixin.d.ts.map +1 -0
  299. package/types/mixins/FormAssociatedMixin.d.ts +122 -0
  300. package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
  301. package/types/mixins/HyperlinkMixin.d.ts +22 -0
  302. package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
  303. package/types/mixins/InputMixin.d.ts +179 -0
  304. package/types/mixins/InputMixin.d.ts.map +1 -0
  305. package/types/mixins/KeyboardNavMixin.d.ts +47 -0
  306. package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
  307. package/types/mixins/NavigationListenerMixin.d.ts +8 -0
  308. package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
  309. package/types/mixins/PopupMixin.d.ts +82 -0
  310. package/types/mixins/PopupMixin.d.ts.map +1 -0
  311. package/types/mixins/RTLObserverMixin.d.ts +7 -0
  312. package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
  313. package/types/mixins/ResizeObserverMixin.d.ts +12 -0
  314. package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
  315. package/types/mixins/RippleMixin.d.ts +92 -0
  316. package/types/mixins/RippleMixin.d.ts.map +1 -0
  317. package/types/mixins/ScrollListenerMixin.d.ts +41 -0
  318. package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
  319. package/types/mixins/SemiStickyMixin.d.ts +50 -0
  320. package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
  321. package/types/mixins/ShapeMaskedMixin.d.ts +9 -0
  322. package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
  323. package/types/mixins/ShapeMixin.d.ts +38 -0
  324. package/types/mixins/ShapeMixin.d.ts.map +1 -0
  325. package/types/mixins/StateMixin.d.ts +27 -0
  326. package/types/mixins/StateMixin.d.ts.map +1 -0
  327. package/types/mixins/TextFieldMixin.d.ts +1354 -0
  328. package/types/mixins/TextFieldMixin.d.ts.map +1 -0
  329. package/types/mixins/ThemableMixin.d.ts +9 -0
  330. package/types/mixins/ThemableMixin.d.ts.map +1 -0
  331. package/types/mixins/TooltipTriggerMixin.d.ts +106 -0
  332. package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
  333. package/types/mixins/TouchTargetMixin.d.ts +3 -0
  334. package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
  335. package/types/mixins/TypographyMixin.d.ts +17 -0
  336. package/types/mixins/TypographyMixin.d.ts.map +1 -0
  337. package/types/services/rtl.d.ts +3 -0
  338. package/types/services/rtl.d.ts.map +1 -0
  339. package/types/services/svgAlias.d.ts +13 -0
  340. package/types/services/svgAlias.d.ts.map +1 -0
  341. package/types/services/theme.d.ts +45 -0
  342. package/types/services/theme.d.ts.map +1 -0
  343. package/types/utils/cli.d.ts +3 -0
  344. package/types/utils/cli.d.ts.map +1 -0
  345. package/types/utils/function.d.ts +3 -0
  346. package/types/utils/function.d.ts.map +1 -0
  347. package/types/utils/jsx-runtime.d.ts +20 -0
  348. package/types/utils/jsx-runtime.d.ts.map +1 -0
  349. package/types/utils/material-color/blend.d.ts +34 -0
  350. package/types/utils/material-color/blend.d.ts.map +1 -0
  351. package/types/utils/material-color/hct/Cam16.d.ts +142 -0
  352. package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
  353. package/types/utils/material-color/hct/Hct.d.ts +93 -0
  354. package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
  355. package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
  356. package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
  357. package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
  358. package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
  359. package/types/utils/material-color/helper.d.ts +8 -0
  360. package/types/utils/material-color/helper.d.ts.map +1 -0
  361. package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
  362. package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
  363. package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
  364. package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
  365. package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
  366. package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
  367. package/types/utils/material-color/utils/color.d.ts +172 -0
  368. package/types/utils/material-color/utils/color.d.ts.map +1 -0
  369. package/types/utils/material-color/utils/math.d.ts +94 -0
  370. package/types/utils/material-color/utils/math.d.ts.map +1 -0
  371. package/types/utils/pixelmatch.d.ts +22 -0
  372. package/types/utils/pixelmatch.d.ts.map +1 -0
  373. package/types/utils/popup.d.ts +106 -0
  374. package/types/utils/popup.d.ts.map +1 -0
  375. package/types/utils/searchParams.d.ts +3 -0
  376. package/types/utils/searchParams.d.ts.map +1 -0
  377. package/types/utils/svg.d.ts +7 -0
  378. package/types/utils/svg.d.ts.map +1 -0
  379. package/utils/material-color/scheme/Scheme.js +1 -1
  380. package/utils/pixelmatch.js +360 -0
  381. package/utils/popup.js +86 -10
  382. package/utils/searchParams.js +19 -0
  383. package/components/ExtendedFab.js +0 -32
  384. package/components/Layout.js +0 -504
  385. package/components/Nav.js +0 -38
  386. package/core/DomAdapter.js +0 -586
  387. package/core/ICustomElement.d.ts +0 -291
  388. package/core/ICustomElement.js +0 -1
  389. package/core/test.js +0 -126
  390. package/core/typings.d.ts +0 -142
  391. package/core/typings.js +0 -1
  392. package/mixins/SurfaceMixin.js +0 -127
  393. package/theming/loader.js +0 -22
  394. /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
@@ -1,504 +0,0 @@
1
- /* https://m3.material.io/foundations/layout/applying-layout/window-size-classes */
2
-
3
- import CustomElement from '../core/CustomElement.js';
4
- import { ELEMENT_STYLER_TYPE } from '../core/customTypes.js';
5
-
6
- export default CustomElement
7
- .extend()
8
- .observe({
9
- navBar: 'string',
10
- navRail: 'string',
11
- navDrawer: 'string',
12
- oneFlexible: 'boolean',
13
- oneFixed: 'boolean',
14
- twoFlexible: 'boolean',
15
- twoFixed: 'boolean',
16
- paneTwoActive: 'boolean',
17
- paneOneColumns: 'integer',
18
- paneTwoColumns: 'integer',
19
- padding: 'integer',
20
- panes: 'integer',
21
- _touchDeltaX: 'integer',
22
- _touchStartX: 'integer',
23
- _navDrawerTranslateX: {
24
- empty: '-100%',
25
- },
26
- _navDrawerDuration: {
27
- empty: 0,
28
- },
29
- })
30
- .observe({
31
- hasTwo: {
32
- type: 'boolean',
33
- reflect: 'write',
34
- get({ twoFlexible, twoFixed }) {
35
- return twoFlexible || twoFixed;
36
- },
37
- },
38
- singlePane: {
39
- type: 'boolean',
40
- reflect: 'write',
41
- get({ oneFlexible, oneFixed, twoFlexible, twoFixed }) {
42
- return (oneFlexible || oneFixed) && !(twoFlexible || twoFixed);
43
- },
44
- },
45
- _navDrawerStyle: {
46
- ...ELEMENT_STYLER_TYPE,
47
- get({ _navDrawerTranslateX, _navDrawerDuration }) {
48
- return {
49
- target: 'slot-nav-drawer',
50
- styles: {
51
- transform: `translateX(${_navDrawerTranslateX})`,
52
- },
53
- timing: {
54
- duration: _navDrawerDuration,
55
- },
56
- };
57
- },
58
- },
59
- })
60
- .set({
61
- /** @type {Map<string, MediaQueryList>} */
62
- registeredMediaQueries: null,
63
- refreshedOpenStatesFlag: false,
64
- _windowResizeListener: null,
65
- })
66
- /* Slots should follow tab order */
67
- .html`
68
- <slot id=slot-nav-drawer name=nav-drawer state={navDrawer}></slot>
69
- <div id=scrim state={navDrawer}></div>
70
- <slot id=slot-nav-rail name=nav-rail state={navRail}></slot>
71
- <slot id=slot-app-bar name=app-bar></slot>
72
- <slot id=slot class="pane pane1" columns={paneOneColumns} slotted={oneFlexible}></slot>
73
- <slot id=slot-fixed name=fixed class="pane pane1" columns={paneOneColumns} slotted={oneFixed} ></slot>
74
- <slot id=slot-two name=two class="pane pane2" panes={panes} columns={paneTwoColumns} slotted={twoFlexible}></slot>
75
- <slot id=slot-two-fixed name=two-fixed class="pane pane2" panes={panes} columns={paneTwoColumns} slotted={twoFixed} ></slot>
76
- <slot id=slot-nav-bar name=nav-bar state={navBar}></slot>
77
- `
78
- .methods({
79
- refreshLayoutValues() {
80
- /**
81
- * Prefer content to navigation (eg: Don't shrink content for nav)
82
- * Prefer 2nd pane always
83
- * Breakpoints ( x = 16, | = 24 )
84
- * - Nav Pane1 Pane2 Columns Nav Detail Content Width Use?
85
- * - Modal 4col x 0 x 0 0 0 0 YES
86
- * - Rail 4col 80 x 360 x 80 0 360 472 NO
87
- * - Modal 8col x 600 x 0 0 600 632 YES
88
- * - Modal 8col | 600 | 0 0 600 648 YES
89
- * - Rail 8col 80 | 600 | 80 0 600 728 YES
90
- * - Drawer 4col 360 | 360 | 360 0 360 768 NO
91
- * - Modal 4col 4col | 360 | 360 | 360 360 720 792 YES
92
- * - Modal Fixed 4col | 360 | 360 | 360 360 720 792 YES
93
- * - Rail 4col 4col 80 | 360 | 360 | 80 360 720 872 YES
94
- * - Rail Fixed 4col 80 | 360 | 360 | 80 360 720 872 YES
95
- * - Modal 12col | 840 | 0 0 840 888 If Single Pane + No Rail
96
- * - Rail 12col 80 | 840 | 80 0 840 968 If Single Pane
97
- * - Drawer 8col 360 | 600 | 360 0 600 1008 NO (Loses Content)
98
- * - Modal Fixed 8col | 360 | 600 | 0 600 960 1032 If No Rail
99
- * - Rail Fixed 8col 80 | 360 | 600 | 80 600 960 1112 YES
100
- * - Drawer 4col 4col 360 | 360 | 360 | 360 360 720 1152 NO (Modal 4/4 has more content)
101
- * - Drawer Fixed 4col 360 | 360 | 360 | 360 360 720 1152 NO (Modal F/8 has more content)
102
- * - Drawer 12col 360 | 840 | 360 0 840 1248 If Single Pane
103
- * - Modal 8col 8col | 600 | 600 | 0 600 1200 1272 *If No Rail
104
- * - Modal Fixed 12col | 360 | 840 | 0 840 1200 1272 *If No Rail
105
- * - Rail 8col 8col 80 | 600 | 600 | 80 600 1200 1352 YES
106
- * - Rail Fixed 12col 80 | 360 | 840 | 80 840 1200 1352 YES
107
- * - Drawer Fixed 8col 360 | 360 | 600 | 360 600 960 1392 *If No Rail
108
- * - Drawer 8col 8col 360 | 600 | 600 | 360 600 720 1632 *If No Rail
109
- * - Drawer Fixed 12col 360 | 360 | 840 | 360 840 1200 1632 YES
110
- * - Modal 12col 12col | 840 | 840 | 0 840 1680 1752 If No Rail + No Nav Drawer
111
- * - Rail 12col 12col 80 | 840 | 840 | 80 840 1680 1832 If No Drawer
112
- * - Drawer 12col 12col 360 | 840 | 840 | 360 840 1680 2112 YES
113
- */
114
-
115
- /**
116
- * SORTED + FILTERED
117
- * - Nav Pane1 Pane2 Columns Nav Detail Content Width
118
- * - Modal 4col x 0 x 0 0 0 0
119
- * - Modal 8col x 600 x 0 0 600 632
120
- * - Modal 8col | 600 | 0 0 600 648
121
- * - Modal 12col | 840 | 0 0 840 888
122
- * - Rail 8col 80 | 600 | 80 0 600 728
123
- * - Rail 12col 80 | 840 | 80 0 840 968
124
- * - Drawer 12col 360 | 840 | 360 0 840 1248
125
- * - Modal 4col 4col | 360 | 360 | 0 360 720 792
126
- * - Modal 8col 8col | 600 | 600 | 0 600 1200 1272
127
- * - Modal 12col 12col | 840 | 840 | 0 840 1680 1752
128
- * - Modal Fixed 4col | 360 | 360 | 0 360 720 792
129
- * - Modal Fixed 8col | 360 | 600 | 0 600 960 1032
130
- * - Modal Fixed 12col | 360 | 840 | 0 840 1200 1272
131
- * - Drawer 8col 8col 360 | 600 | 600 | 360 600 720 1632
132
- * - Drawer Fixed 8col 360 | 360 | 600 | 360 600 960 1392
133
- * - Rail 4col 4col 80 | 360 | 360 | 80 360 720 872
134
- * - Rail 8col 8col 80 | 600 | 600 | 80 600 1200 1352
135
- * - Rail 12col 12col 80 | 840 | 840 | 80 840 1680 1832
136
- * - Rail Fixed 4col 80 | 360 | 360 | 80 360 720 872
137
- * - Rail Fixed 8col 80 | 360 | 600 | 80 600 960 1112
138
- * - Rail Fixed 12col 80 | 360 | 840 | 80 840 1200 1352
139
- * - Drawer 12col 12col 360 | 840 | 840 | 360 840 1680 2112
140
- * - Drawer Fixed 12col 360 | 360 | 840 | 360 840 1200 1632
141
- */
142
-
143
- const { innerWidth } = window;
144
- /** @type {[number, 'modal'|'rail'|'drawer', 4|8|12|'fixed', number, number][]} */
145
- const breakpointTable = [
146
- [1632, 'drawer', 'fixed', 12, 24],
147
- [2112, 'drawer', 12, 12, 24],
148
- [1352, 'rail', 'fixed', 12, 24],
149
- [1112, 'rail', 'fixed', 8, 24],
150
- [872, 'rail', 'fixed', 4, 24],
151
- [1832, 'rail', 12, 12, 24],
152
- [1352, 'rail', 8, 8, 24],
153
- [872, 'rail', 4, 4, 24],
154
- [1392, 'drawer', 'fixed', 8, 24],
155
- [1632, 'drawer', 8, 8, 24],
156
- [1272, 'modal', 'fixed', 12, 24],
157
- [1032, 'modal', 'fixed', 8, 24],
158
- [792, 'modal', 'fixed', 4, 24],
159
- [1752, 'modal', 12, 12, 24],
160
- [1272, 'modal', 8, 8, 24],
161
- [792, 'modal', 4, 4, 24],
162
- [1248, 'drawer', 12, 0, 24],
163
- [960, 'rail', 12, 0, 24],
164
- [728, 'rail', 8, 0, 24],
165
- [888, 'modal', 12, 0, 24],
166
- [648, 'modal', 8, 0, 24],
167
- [632, 'modal', 8, 0, 16],
168
- [0, 'modal', 4, 0, 16],
169
- ];
170
- breakpointTable.some(([minWidth, nav, column1, column2, padding]) => {
171
- if (innerWidth < minWidth) return false;
172
- if (column2 && !this.hasTwo) return false;
173
- if (nav === 'rail') {
174
- if (!this.navRail) return false;
175
- this.navRail = 'fixed';
176
- if (this.navDrawer) this.navDrawer = 'closed';
177
- if (this.navBar) this.navBar = 'closed';
178
- } else if (nav === 'drawer') {
179
- if (!this.navDrawer) return false;
180
- if (this.navRail) this.navRail = 'closed';
181
- if (this.navBar) this.navBar = 'closed';
182
- this.navDrawer = 'fixed';
183
- } else {
184
- if (this.navRail) this.navRail = 'closed';
185
- if (this.navDrawer) this.navDrawer = 'closed';
186
- if (this.navBar) this.navBar = 'open';
187
- }
188
- this.padding = padding;
189
- if (column2) {
190
- this.panes = 2;
191
- if (this.oneFixed) {
192
- this.paneOneColumns = 4;
193
- this.paneTwoColumns = column2;
194
- } else if (this.twoFixed) {
195
- this.paneOneColumns = column2;
196
- this.paneTwoColumns = 4;
197
- }
198
- } else {
199
- this.panes = 1;
200
- this.paneOneColumns = /** @type {number} */ (column1);
201
- this.paneTwoColumns = this.hasTwo
202
- ? /** @type {number} */ (column1)
203
- : null;
204
- }
205
- return true;
206
- });
207
- },
208
- checkTouchFinished() {
209
- if (this.navDrawer !== 'open') return;
210
- const { _touchDeltaX, refs } = this;
211
- const clientWidth = refs.slotNavDrawer.clientWidth;
212
- const visibility = (_touchDeltaX + clientWidth) / clientWidth;
213
- if (visibility < 0.5) {
214
- this._navDrawerTranslateX = '-100%';
215
- this._navDrawerDuration = 200 * visibility;
216
- this.navDrawer = 'closed';
217
- } else {
218
- this._navDrawerTranslateX = '0';
219
- this._navDrawerDuration = 200 * (0.5 * visibility);
220
- }
221
- },
222
- })
223
- .events({
224
- '~touchstart'(event) {
225
- if (this.navDrawer !== 'open') return;
226
- if (!event.touches.length) return;
227
- let [{ clientX, pageX }] = event.touches;
228
- clientX ??= pageX - window.scrollX; // Safari
229
- this._touchStartX = clientX;
230
- },
231
- '~touchmove'({ touches }) {
232
- if (this.navDrawer !== 'open') return;
233
- if (!touches.length) return;
234
- let [{ clientX, pageX }] = touches;
235
- clientX ??= pageX - window.scrollX; // Safari
236
- const delta = Math.min(clientX - this._touchStartX, 0);
237
-
238
- this._touchDeltaX = delta;
239
- this._navDrawerTranslateX = `${delta}px`;
240
- this._navDrawerDuration = 0;
241
- },
242
- touchcancel: 'checkTouchFinished',
243
- '~touchend': 'checkTouchFinished',
244
- })
245
- .rootEvents({
246
- slotchange({ target }) {
247
- const slotElement = /** @type HTMLSlotElement */ (target);
248
- const slotted = slotElement.assignedElements().length > 0;
249
- switch (slotElement.name) {
250
- case 'nav-rail':
251
- this.navRail = slotted ? 'closed' : null;
252
- break;
253
- case 'nav-bar':
254
- this.navBar = slotted ? 'closed' : null;
255
- break;
256
- case 'nav-drawer':
257
- this.navDrawer = slotted ? 'closed' : null;
258
- break;
259
- case 'fixed':
260
- this.oneFixed = slotted;
261
- break;
262
- case 'two':
263
- this.twoFlexible = slotted;
264
- break;
265
- case 'two-fixed':
266
- this.twoFixed = slotted;
267
- break;
268
- default:
269
- this.oneFlexible = slotted;
270
- break;
271
- }
272
- this.refreshLayoutValues();
273
- },
274
- })
275
- .childEvents({
276
- scrim: {
277
- click() {
278
- this.navDrawer = 'closed';
279
- },
280
- },
281
- })
282
- .on({
283
- navDrawerChanged(previous, current) {
284
- this._navDrawerTranslateX = current === 'closed' ? '-100%' : '0';
285
- this._navDrawerDuration = current === 'fixed' ? 0 : 200;
286
- },
287
- connected() {
288
- this._windowResizeListener = this.refreshLayoutValues.bind(this);
289
- window.addEventListener('resize', this._windowResizeListener);
290
- },
291
- disconnected() {
292
- window.removeEventListener('resize', this._windowResizeListener);
293
- },
294
- })
295
- .css`
296
- :host {
297
- --mdw-grid__columns: 4;
298
- --mdw-content__max-width: 1040px;
299
- --mdw-content__padding: 16px;
300
- --mdw-layout__spacer-width: 24px;
301
- --mdw-layout__nav-drawer__ratio: 0;
302
- --mdw-layout__nav-drawer-width: 360px;
303
- --mdw-layout__nav-rail__ratio: 0;
304
- --mdw-layout__nav-rail-width: 80px;
305
- --mdw-layout__pane1-width: minmax(0, 1fr);
306
- --mdw-layout__pane2-width: 0;
307
- --mdw-layout__window-padding: 16px;
308
-
309
- display: grid;
310
- grid-template-rows: auto 1fr auto;
311
- grid-template-columns:
312
- calc(var(--mdw-layout__nav-drawer-width) * var(--mdw-layout__nav-drawer__ratio))
313
- calc(var(--mdw-layout__nav-rail-width) * var(--mdw-layout__nav-rail__ratio))
314
- var(--mdw-layout__window-padding)
315
- var(--mdw-layout__pane1-width)
316
- var(--mdw-layout__window-padding)
317
- var(--mdw-layout__pane2-width) 0;
318
- grid-template-areas:
319
- "nav-drawer nav-rail app-bar app-bar app-bar pane2 ."
320
- "nav-drawer nav-rail . pane1 . pane2 ."
321
- "nav-drawer nav-rail nav-bar nav-bar nav-bar nav-bar .";
322
- overflow-x: clip;
323
-
324
- font: var(--mdw-typescale__body-large__font);
325
- letter-spacing: var(--mdw-typescale__body-large__letter-spacing);
326
- }
327
-
328
- :host(:where([pane-two-active])) {
329
- grid-template-areas:
330
- "nav-drawer nav-rail app-bar app-bar app-bar pane1 ."
331
- "nav-drawer nav-rail . pane2 . pane1 ."
332
- "nav-drawer nav-rail nav-bar nav-bar nav-bar nav-bar .";
333
- }
334
-
335
- :host(:where([panes="2"])) {
336
- --mdw-content__max-width: auto;
337
- --mdw-layout__pane2-width: 1fr;
338
- grid-template-columns:
339
- calc(var(--mdw-layout__nav-drawer-width) * var(--mdw-layout__nav-drawer__ratio))
340
- calc(var(--mdw-layout__nav-rail-width) * var(--mdw-layout__nav-rail__ratio))
341
- var(--mdw-layout__window-padding)
342
- var(--mdw-layout__pane1-width)
343
- var(--mdw-layout__spacer-width)
344
- var(--mdw-layout__pane2-width)
345
- var(--mdw-layout__window-padding);
346
-
347
- grid-template-areas:
348
- "nav-drawer nav-rail app-bar app-bar app-bar pane2 ."
349
- "nav-drawer nav-rail . pane1 . pane2 ."
350
- "nav-drawer nav-rail nav-bar nav-bar nav-bar nav-bar .";
351
- }
352
-
353
- :host(:where([nav-rail="fixed"])) {
354
- --mdw-layout__nav-rail__ratio: 1;
355
- }
356
-
357
- :host(:where([nav-drawer="fixed"])) {
358
- --mdw-layout__nav-drawer__ratio: 1;
359
- }
360
-
361
- :host(:where([padding="24"])) {
362
- --mdw-layout__window-padding: 24px;
363
- --mdw-content__padding: 24px;
364
- }
365
-
366
- :host(:where([panes="2"][one-fixed])) {
367
- --mdw-layout__pane1-width: 360px;
368
- }
369
-
370
- :host(:where([panes="2"][two-fixed])) {
371
- --mdw-layout__pane2-width: 360px;
372
- }
373
-
374
- #scrim {
375
- position:fixed;
376
- inset: 0;
377
-
378
- pointer-events: none;
379
-
380
- opacity: 0;
381
- z-index: 25;
382
-
383
- background-color: rgb(var(--mdw-color__scrim));
384
-
385
- transition: opacity 200ms;
386
- }
387
-
388
- #scrim[state="open"] {
389
- pointer-events: auto;
390
-
391
- opacity: 0.38;
392
- }
393
-
394
- .pane {
395
- overflow: visible;
396
- }
397
-
398
- .pane[columns="8"] {
399
- /* stylelint-disable-next-line rule-selector-property-disallowed-list */
400
- --mdw-grid__columns: 8;
401
- }
402
-
403
- .pane[columns="12"] {
404
- /* stylelint-disable-next-line rule-selector-property-disallowed-list */
405
- --mdw-grid__columns: 12;
406
- }
407
-
408
- .pane1 {
409
- grid-area: pane1;
410
-
411
- box-sizing: content-box;
412
- inline-size: 100%;
413
- max-inline-size: var(--mdw-content__max-width, auto);
414
- margin-inline: auto;
415
- }
416
-
417
- .pane1[slotted] {
418
- display: block;
419
- }
420
-
421
- .pane2 {
422
- --mdw-content__padding: 0;
423
- grid-area: pane2;
424
-
425
- visibility: hidden;
426
- }
427
-
428
- .pane2[active] {
429
- inset-inline-end: 0;
430
-
431
- box-sizing: border-box;
432
- inline-size: 100%;
433
- padding-inline: var(--mdw-content__padding);
434
-
435
- visibility: visible;
436
- }
437
-
438
- .pane2[slotted] {
439
- display: block;
440
- }
441
-
442
- .pane2[panes="2"] {
443
- position: sticky;
444
- inset: 0;
445
-
446
- overflow-y: auto;
447
-
448
- block-size: 100vh;
449
-
450
- visibility: visible;
451
- }
452
-
453
- #slot-app-bar {
454
- display: contents; /* Allow sticky */
455
-
456
- z-index: 2;
457
- }
458
-
459
- #slot-nav-bar {
460
- display: contents;
461
- grid-area: nav-bar;
462
- }
463
-
464
- #slot-nav-bar[state="closed"] {
465
- display: none;
466
- }
467
-
468
- #slot-nav-rail {
469
- display: none;
470
- grid-area: nav-rail;
471
-
472
- z-index: 3;
473
- }
474
-
475
- #slot-nav-rail[state="fixed"] {
476
- display: block;
477
- }
478
-
479
- #slot-nav-drawer {
480
- position: fixed;
481
-
482
- display: block;
483
- grid-area: nav-drawer;
484
-
485
- /** Initially hidden */
486
- transform: translateX(-100%);
487
- visibility: hidden;
488
- z-index: 26;
489
-
490
- transition-delay: 0s, 200ms;
491
- transition-duration: 200ms, 0s;
492
- transition-property: transform, visibility;
493
- transition-timing-function: cubic-bezier(0.3, 0, 0.8, 0.15);
494
- }
495
-
496
- #slot-nav-drawer:is([state="open"],[state="fixed"]) {
497
- transform: translateX(0);
498
- visibility: visible;
499
-
500
- transition-delay: 0s, 0s;
501
- transition-timing-function: cubic-bezier(0.05, 0.7, 0.1, 1);
502
- }
503
- `
504
- .autoRegister('mdw-layout');
package/components/Nav.js DELETED
@@ -1,38 +0,0 @@
1
- import NavItem from './NavItem.js';
2
- import Surface from './Surface.js';
3
-
4
- export default Surface
5
- .extend()
6
- .css`
7
- /* https://m3.material.io/components/navigation-bar/specs */
8
- /* https://m3.material.io/components/navigation-drawer/specs */
9
- /* https://m3.material.io/components/navigation-rail/specs */
10
-
11
- :host {
12
- --mdw-ink: var(--mdw-color__on-surface);
13
- --mdw-bg: var(--mdw-color__surface);
14
-
15
- z-index:2;
16
-
17
- color: rgb(var(--mdw-ink));
18
-
19
- font: var(--mdw-typescale__label-medium__font);
20
- letter-spacing: var(--mdw-typescale__label-medium__letter-spacing);
21
- }
22
- `
23
- .set({
24
- elevated: true,
25
- color: 'surface',
26
- })
27
- .events({
28
- '~click'(event) {
29
- // Abort if not child
30
- if (event.target === this) return;
31
- if (event.target instanceof NavItem === false) return;
32
- for (const el of this.querySelectorAll('*')) {
33
- if (el instanceof NavItem === false) continue;
34
- el.active = (el === event.target);
35
- }
36
- },
37
- })
38
- .autoRegister('mdw-nav');