mdui 1.0.2 → 2.0.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 (664) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +49 -70
  3. package/components/avatar/index.d.ts +49 -0
  4. package/components/avatar/index.js +55 -0
  5. package/components/avatar/style.d.ts +1 -0
  6. package/components/avatar/style.js +2 -0
  7. package/components/avatar.d.ts +1 -0
  8. package/components/avatar.js +1 -0
  9. package/components/badge/index.d.ts +28 -0
  10. package/components/badge/index.js +41 -0
  11. package/components/badge/style.d.ts +1 -0
  12. package/components/badge/style.js +2 -0
  13. package/components/badge.d.ts +1 -0
  14. package/components/badge.js +1 -0
  15. package/components/bottom-app-bar/index.d.ts +60 -0
  16. package/components/bottom-app-bar/index.js +105 -0
  17. package/components/bottom-app-bar/style.d.ts +1 -0
  18. package/components/bottom-app-bar/style.js +2 -0
  19. package/components/bottom-app-bar.d.ts +1 -0
  20. package/components/bottom-app-bar.js +1 -0
  21. package/components/button/button-base-style.d.ts +1 -0
  22. package/components/button/button-base-style.js +2 -0
  23. package/components/button/button-base.d.ts +138 -0
  24. package/components/button/button-base.js +206 -0
  25. package/components/button/index.d.ts +64 -0
  26. package/components/button/index.js +110 -0
  27. package/components/button/style.d.ts +1 -0
  28. package/components/button/style.js +4 -0
  29. package/components/button-icon/index.d.ts +66 -0
  30. package/components/button-icon/index.js +129 -0
  31. package/components/button-icon/style.d.ts +1 -0
  32. package/components/button-icon/style.js +4 -0
  33. package/components/button-icon.d.ts +1 -0
  34. package/components/button-icon.js +1 -0
  35. package/components/button.d.ts +1 -0
  36. package/components/button.js +1 -0
  37. package/components/card/index.d.ts +49 -0
  38. package/components/card/index.js +87 -0
  39. package/components/card/style.d.ts +1 -0
  40. package/components/card/style.js +2 -0
  41. package/components/card.d.ts +1 -0
  42. package/components/card.js +1 -0
  43. package/components/checkbox/index.d.ts +130 -0
  44. package/components/checkbox/index.js +257 -0
  45. package/components/checkbox/style.d.ts +1 -0
  46. package/components/checkbox/style.js +2 -0
  47. package/components/checkbox.d.ts +1 -0
  48. package/components/checkbox.js +1 -0
  49. package/components/chip/index.d.ts +102 -0
  50. package/components/chip/index.js +243 -0
  51. package/components/chip/style.d.ts +1 -0
  52. package/components/chip/style.js +4 -0
  53. package/components/chip.d.ts +1 -0
  54. package/components/chip.js +1 -0
  55. package/components/circular-progress/index.d.ts +28 -0
  56. package/components/circular-progress/index.js +61 -0
  57. package/components/circular-progress/style.d.ts +1 -0
  58. package/components/circular-progress/style.js +2 -0
  59. package/components/circular-progress.d.ts +1 -0
  60. package/components/circular-progress.js +1 -0
  61. package/components/collapse/collapse-item-style.d.ts +1 -0
  62. package/components/collapse/collapse-item-style.js +2 -0
  63. package/components/collapse/collapse-item.d.ts +56 -0
  64. package/components/collapse/collapse-item.js +126 -0
  65. package/components/collapse/collapse-style.d.ts +1 -0
  66. package/components/collapse/collapse-style.js +2 -0
  67. package/components/collapse/collapse.d.ts +49 -0
  68. package/components/collapse/collapse.js +175 -0
  69. package/components/collapse-item.d.ts +1 -0
  70. package/components/collapse-item.js +1 -0
  71. package/components/collapse.d.ts +1 -0
  72. package/components/collapse.js +1 -0
  73. package/components/dialog/index.d.ts +99 -0
  74. package/components/dialog/index.js +307 -0
  75. package/components/dialog/style.d.ts +1 -0
  76. package/components/dialog/style.js +2 -0
  77. package/components/dialog.d.ts +1 -0
  78. package/components/dialog.js +1 -0
  79. package/components/divider/index.d.ts +30 -0
  80. package/components/divider/index.js +58 -0
  81. package/components/divider/style.d.ts +1 -0
  82. package/components/divider/style.js +2 -0
  83. package/components/divider.d.ts +1 -0
  84. package/components/divider.js +1 -0
  85. package/components/dropdown/index.d.ts +131 -0
  86. package/components/dropdown/index.js +571 -0
  87. package/components/dropdown/style.d.ts +1 -0
  88. package/components/dropdown/style.js +2 -0
  89. package/components/dropdown.d.ts +1 -0
  90. package/components/dropdown.js +1 -0
  91. package/components/fab/index.d.ts +70 -0
  92. package/components/fab/index.js +144 -0
  93. package/components/fab/style.d.ts +1 -0
  94. package/components/fab/style.js +8 -0
  95. package/components/fab.d.ts +1 -0
  96. package/components/fab.js +1 -0
  97. package/components/icon/index.d.ts +29 -0
  98. package/components/icon/index.js +57 -0
  99. package/components/icon/style.d.ts +1 -0
  100. package/components/icon/style.js +2 -0
  101. package/components/icon.d.ts +1 -0
  102. package/components/icon.js +1 -0
  103. package/components/layout/helper.d.ts +67 -0
  104. package/components/layout/helper.js +212 -0
  105. package/components/layout/layout-item-base.d.ts +17 -0
  106. package/components/layout/layout-item-base.js +45 -0
  107. package/components/layout/layout-item-style.d.ts +1 -0
  108. package/components/layout/layout-item-style.js +2 -0
  109. package/components/layout/layout-item.d.ts +37 -0
  110. package/components/layout/layout-item.js +58 -0
  111. package/components/layout/layout-main-style.d.ts +1 -0
  112. package/components/layout/layout-main-style.js +2 -0
  113. package/components/layout/layout-main.d.ts +27 -0
  114. package/components/layout/layout-main.js +46 -0
  115. package/components/layout/layout-style.d.ts +1 -0
  116. package/components/layout/layout-style.js +2 -0
  117. package/components/layout/layout.d.ts +28 -0
  118. package/components/layout/layout.js +43 -0
  119. package/components/layout-item.d.ts +1 -0
  120. package/components/layout-item.js +1 -0
  121. package/components/layout-main.d.ts +1 -0
  122. package/components/layout-main.js +1 -0
  123. package/components/layout.d.ts +1 -0
  124. package/components/layout.js +1 -0
  125. package/components/linear-progress/index.d.ts +30 -0
  126. package/components/linear-progress/index.js +48 -0
  127. package/components/linear-progress/style.d.ts +1 -0
  128. package/components/linear-progress/style.js +2 -0
  129. package/components/linear-progress.d.ts +1 -0
  130. package/components/linear-progress.js +1 -0
  131. package/components/list/list-item-style.d.ts +1 -0
  132. package/components/list/list-item-style.js +4 -0
  133. package/components/list/list-item.d.ts +111 -0
  134. package/components/list/list-item.js +186 -0
  135. package/components/list/list-style.d.ts +1 -0
  136. package/components/list/list-style.js +2 -0
  137. package/components/list/list-subheader-style.d.ts +1 -0
  138. package/components/list/list-subheader-style.js +2 -0
  139. package/components/list/list-subheader.d.ts +24 -0
  140. package/components/list/list-subheader.js +30 -0
  141. package/components/list/list.d.ts +24 -0
  142. package/components/list/list.js +27 -0
  143. package/components/list-item.d.ts +1 -0
  144. package/components/list-item.js +1 -0
  145. package/components/list-subheader.d.ts +1 -0
  146. package/components/list-subheader.js +1 -0
  147. package/components/list.d.ts +1 -0
  148. package/components/list.js +1 -0
  149. package/components/menu/menu-item-style.d.ts +1 -0
  150. package/components/menu/menu-item-style.js +2 -0
  151. package/components/menu/menu-item.d.ts +123 -0
  152. package/components/menu/menu-item.js +412 -0
  153. package/components/menu/menu-style.d.ts +1 -0
  154. package/components/menu/menu-style.js +2 -0
  155. package/components/menu/menu.d.ts +111 -0
  156. package/components/menu/menu.js +425 -0
  157. package/components/menu-item.d.ts +1 -0
  158. package/components/menu-item.js +1 -0
  159. package/components/menu.d.ts +1 -0
  160. package/components/menu.js +1 -0
  161. package/components/navigation-bar/navigation-bar-item-style.d.ts +1 -0
  162. package/components/navigation-bar/navigation-bar-item-style.js +2 -0
  163. package/components/navigation-bar/navigation-bar-item.d.ts +72 -0
  164. package/components/navigation-bar/navigation-bar-item.js +120 -0
  165. package/components/navigation-bar/navigation-bar-style.d.ts +1 -0
  166. package/components/navigation-bar/navigation-bar-style.js +2 -0
  167. package/components/navigation-bar/navigation-bar.d.ts +78 -0
  168. package/components/navigation-bar/navigation-bar.js +180 -0
  169. package/components/navigation-bar-item.d.ts +1 -0
  170. package/components/navigation-bar-item.js +1 -0
  171. package/components/navigation-bar.d.ts +1 -0
  172. package/components/navigation-bar.js +1 -0
  173. package/components/navigation-drawer/index.d.ts +84 -0
  174. package/components/navigation-drawer/index.js +365 -0
  175. package/components/navigation-drawer/style.d.ts +1 -0
  176. package/components/navigation-drawer/style.js +2 -0
  177. package/components/navigation-drawer.d.ts +1 -0
  178. package/components/navigation-drawer.js +1 -0
  179. package/components/navigation-rail/navigation-rail-item-style.d.ts +1 -0
  180. package/components/navigation-rail/navigation-rail-item-style.js +2 -0
  181. package/components/navigation-rail/navigation-rail-item.d.ts +72 -0
  182. package/components/navigation-rail/navigation-rail-item.js +128 -0
  183. package/components/navigation-rail/navigation-rail-style.d.ts +1 -0
  184. package/components/navigation-rail/navigation-rail-style.js +2 -0
  185. package/components/navigation-rail/navigation-rail.d.ts +87 -0
  186. package/components/navigation-rail/navigation-rail.js +230 -0
  187. package/components/navigation-rail-item.d.ts +1 -0
  188. package/components/navigation-rail-item.js +1 -0
  189. package/components/navigation-rail.d.ts +1 -0
  190. package/components/navigation-rail.js +1 -0
  191. package/components/radio/radio-group-style.d.ts +1 -0
  192. package/components/radio/radio-group-style.js +2 -0
  193. package/components/radio/radio-group.d.ts +103 -0
  194. package/components/radio/radio-group.js +268 -0
  195. package/components/radio/radio-style.d.ts +1 -0
  196. package/components/radio/radio-style.js +2 -0
  197. package/components/radio/radio.d.ts +71 -0
  198. package/components/radio/radio.js +144 -0
  199. package/components/radio-group.d.ts +1 -0
  200. package/components/radio-group.js +1 -0
  201. package/components/radio.d.ts +1 -0
  202. package/components/radio.js +1 -0
  203. package/components/range-slider/index.d.ts +67 -0
  204. package/components/range-slider/index.js +210 -0
  205. package/components/range-slider.d.ts +1 -0
  206. package/components/range-slider.js +1 -0
  207. package/components/ripple/index.d.ts +44 -0
  208. package/components/ripple/index.js +173 -0
  209. package/components/ripple/ripple-mixin.d.ts +28 -0
  210. package/components/ripple/ripple-mixin.js +258 -0
  211. package/components/ripple/style.d.ts +1 -0
  212. package/components/ripple/style.js +2 -0
  213. package/components/ripple.d.ts +1 -0
  214. package/components/ripple.js +1 -0
  215. package/components/segmented-button/segmented-button-group-style.d.ts +1 -0
  216. package/components/segmented-button/segmented-button-group-style.js +2 -0
  217. package/components/segmented-button/segmented-button-group.d.ts +125 -0
  218. package/components/segmented-button/segmented-button-group.js +383 -0
  219. package/components/segmented-button/segmented-button-style.d.ts +1 -0
  220. package/components/segmented-button/segmented-button-style.js +4 -0
  221. package/components/segmented-button/segmented-button.d.ts +73 -0
  222. package/components/segmented-button/segmented-button.js +160 -0
  223. package/components/segmented-button-group.d.ts +1 -0
  224. package/components/segmented-button-group.js +1 -0
  225. package/components/segmented-button.d.ts +1 -0
  226. package/components/segmented-button.js +1 -0
  227. package/components/select/index.d.ts +200 -0
  228. package/components/select/index.js +390 -0
  229. package/components/select/style.d.ts +1 -0
  230. package/components/select/style.js +2 -0
  231. package/components/select.d.ts +1 -0
  232. package/components/select.js +1 -0
  233. package/components/slider/index.d.ts +53 -0
  234. package/components/slider/index.js +128 -0
  235. package/components/slider/slider-base-style.d.ts +1 -0
  236. package/components/slider/slider-base-style.js +2 -0
  237. package/components/slider/slider-base.d.ts +92 -0
  238. package/components/slider/slider-base.js +199 -0
  239. package/components/slider/style.d.ts +1 -0
  240. package/components/slider/style.js +2 -0
  241. package/components/slider.d.ts +1 -0
  242. package/components/slider.js +1 -0
  243. package/components/snackbar/index.d.ts +98 -0
  244. package/components/snackbar/index.js +285 -0
  245. package/components/snackbar/style.d.ts +1 -0
  246. package/components/snackbar/style.js +2 -0
  247. package/components/snackbar.d.ts +1 -0
  248. package/components/snackbar.js +1 -0
  249. package/components/switch/index.d.ts +123 -0
  250. package/components/switch/index.js +245 -0
  251. package/components/switch/style.d.ts +1 -0
  252. package/components/switch/style.js +2 -0
  253. package/components/switch.d.ts +1 -0
  254. package/components/switch.js +1 -0
  255. package/components/tab-panel.d.ts +1 -0
  256. package/components/tab-panel.js +1 -0
  257. package/components/tab.d.ts +1 -0
  258. package/components/tab.js +1 -0
  259. package/components/tabs/tab-panel-style.d.ts +1 -0
  260. package/components/tabs/tab-panel-style.js +2 -0
  261. package/components/tabs/tab-panel.d.ts +36 -0
  262. package/components/tabs/tab-panel.js +52 -0
  263. package/components/tabs/tab-style.d.ts +1 -0
  264. package/components/tabs/tab-style.js +2 -0
  265. package/components/tabs/tab.d.ts +69 -0
  266. package/components/tabs/tab.js +110 -0
  267. package/components/tabs/tabs-style.d.ts +1 -0
  268. package/components/tabs/tabs-style.js +2 -0
  269. package/components/tabs/tabs.d.ts +87 -0
  270. package/components/tabs/tabs.js +221 -0
  271. package/components/tabs.d.ts +1 -0
  272. package/components/tabs.js +1 -0
  273. package/components/text-field/index.d.ts +400 -0
  274. package/components/text-field/index.js +752 -0
  275. package/components/text-field/style.d.ts +1 -0
  276. package/components/text-field/style.js +2 -0
  277. package/components/text-field.d.ts +1 -0
  278. package/components/text-field.js +1 -0
  279. package/components/tooltip/index.d.ts +140 -0
  280. package/components/tooltip/index.js +497 -0
  281. package/components/tooltip/style.d.ts +1 -0
  282. package/components/tooltip/style.js +2 -0
  283. package/components/tooltip.d.ts +1 -0
  284. package/components/tooltip.js +1 -0
  285. package/components/top-app-bar/top-app-bar-style.d.ts +1 -0
  286. package/components/top-app-bar/top-app-bar-style.js +2 -0
  287. package/components/top-app-bar/top-app-bar-title-style.d.ts +1 -0
  288. package/components/top-app-bar/top-app-bar-title-style.js +2 -0
  289. package/components/top-app-bar/top-app-bar-title.d.ts +46 -0
  290. package/components/top-app-bar/top-app-bar-title.js +76 -0
  291. package/components/top-app-bar/top-app-bar.d.ts +74 -0
  292. package/components/top-app-bar/top-app-bar.js +178 -0
  293. package/components/top-app-bar-title.d.ts +1 -0
  294. package/components/top-app-bar-title.js +1 -0
  295. package/components/top-app-bar.d.ts +1 -0
  296. package/components/top-app-bar.js +1 -0
  297. package/css-data.zh-cn.json +2819 -0
  298. package/custom-elements.json +28087 -0
  299. package/functions/alert.d.ts +80 -0
  300. package/functions/alert.js +59 -0
  301. package/functions/breakpoint.d.ts +1 -0
  302. package/functions/breakpoint.js +1 -0
  303. package/functions/confirm.d.ts +95 -0
  304. package/functions/confirm.js +68 -0
  305. package/functions/dialog.d.ts +97 -0
  306. package/functions/dialog.js +100 -0
  307. package/functions/getColorFromImage.d.ts +7 -0
  308. package/functions/getColorFromImage.js +12 -0
  309. package/functions/getTheme.d.ts +10 -0
  310. package/functions/getTheme.js +16 -0
  311. package/functions/observeResize.d.ts +2 -0
  312. package/functions/observeResize.js +1 -0
  313. package/functions/prompt.d.ts +110 -0
  314. package/functions/prompt.js +103 -0
  315. package/functions/removeColorScheme.d.ts +6 -0
  316. package/functions/removeColorScheme.js +8 -0
  317. package/functions/setColorScheme.d.ts +15 -0
  318. package/functions/setColorScheme.js +15 -0
  319. package/functions/setTheme.d.ts +10 -0
  320. package/functions/setTheme.js +16 -0
  321. package/functions/snackbar.d.ts +91 -0
  322. package/functions/snackbar.js +84 -0
  323. package/functions/throttle.d.ts +1 -0
  324. package/functions/throttle.js +1 -0
  325. package/functions/utils/colorScheme.d.ts +39 -0
  326. package/functions/utils/colorScheme.js +133 -0
  327. package/functions/utils/theme.d.ts +1 -0
  328. package/html-data.zh-cn.json +6566 -0
  329. package/jq.d.ts +1 -0
  330. package/jq.js +1 -0
  331. package/mdui.css +1 -0
  332. package/mdui.d.ts +61 -0
  333. package/mdui.esm.js +22 -0
  334. package/mdui.global.js +22 -0
  335. package/mdui.js +61 -0
  336. package/package.json +39 -68
  337. package/web-types.zh-cn.json +11728 -0
  338. package/dist/css/mdui.css +0 -13559
  339. package/dist/css/mdui.css.map +0 -1
  340. package/dist/css/mdui.min.css +0 -6
  341. package/dist/css/mdui.min.css.map +0 -1
  342. package/dist/fonts/roboto/LICENSE.txt +0 -201
  343. package/dist/fonts/roboto/Roboto-Black.woff +0 -0
  344. package/dist/fonts/roboto/Roboto-Black.woff2 +0 -0
  345. package/dist/fonts/roboto/Roboto-BlackItalic.woff +0 -0
  346. package/dist/fonts/roboto/Roboto-BlackItalic.woff2 +0 -0
  347. package/dist/fonts/roboto/Roboto-Bold.woff +0 -0
  348. package/dist/fonts/roboto/Roboto-Bold.woff2 +0 -0
  349. package/dist/fonts/roboto/Roboto-BoldItalic.woff +0 -0
  350. package/dist/fonts/roboto/Roboto-BoldItalic.woff2 +0 -0
  351. package/dist/fonts/roboto/Roboto-Light.woff +0 -0
  352. package/dist/fonts/roboto/Roboto-Light.woff2 +0 -0
  353. package/dist/fonts/roboto/Roboto-LightItalic.woff +0 -0
  354. package/dist/fonts/roboto/Roboto-LightItalic.woff2 +0 -0
  355. package/dist/fonts/roboto/Roboto-Medium.woff +0 -0
  356. package/dist/fonts/roboto/Roboto-Medium.woff2 +0 -0
  357. package/dist/fonts/roboto/Roboto-MediumItalic.woff +0 -0
  358. package/dist/fonts/roboto/Roboto-MediumItalic.woff2 +0 -0
  359. package/dist/fonts/roboto/Roboto-Regular.woff +0 -0
  360. package/dist/fonts/roboto/Roboto-Regular.woff2 +0 -0
  361. package/dist/fonts/roboto/Roboto-RegularItalic.woff +0 -0
  362. package/dist/fonts/roboto/Roboto-RegularItalic.woff2 +0 -0
  363. package/dist/fonts/roboto/Roboto-Thin.woff +0 -0
  364. package/dist/fonts/roboto/Roboto-Thin.woff2 +0 -0
  365. package/dist/fonts/roboto/Roboto-ThinItalic.woff +0 -0
  366. package/dist/fonts/roboto/Roboto-ThinItalic.woff2 +0 -0
  367. package/dist/icons/material-icons/LICENSE.txt +0 -393
  368. package/dist/icons/material-icons/MaterialIcons-Regular.ijmap +0 -1
  369. package/dist/icons/material-icons/MaterialIcons-Regular.woff +0 -0
  370. package/dist/icons/material-icons/MaterialIcons-Regular.woff2 +0 -0
  371. package/dist/js/mdui.esm.js +0 -5976
  372. package/dist/js/mdui.esm.js.map +0 -1
  373. package/dist/js/mdui.js +0 -6474
  374. package/dist/js/mdui.js.map +0 -1
  375. package/dist/js/mdui.min.js +0 -7
  376. package/dist/js/mdui.min.js.map +0 -1
  377. package/es/components/appbar/index.d.ts +0 -2
  378. package/es/components/appbar/index.js +0 -17
  379. package/es/components/bottom_nav/index.d.ts +0 -9
  380. package/es/components/bottom_nav/index.js +0 -38
  381. package/es/components/collapse/collapseAbstract.d.ts +0 -110
  382. package/es/components/collapse/collapseAbstract.js +0 -175
  383. package/es/components/collapse/customAttr.d.ts +0 -2
  384. package/es/components/collapse/customAttr.js +0 -11
  385. package/es/components/collapse/index.d.ts +0 -23
  386. package/es/components/collapse/index.js +0 -8
  387. package/es/components/dialog/alert.d.ts +0 -44
  388. package/es/components/dialog/alert.js +0 -42
  389. package/es/components/dialog/class.d.ts +0 -133
  390. package/es/components/dialog/class.js +0 -316
  391. package/es/components/dialog/confirm.d.ts +0 -54
  392. package/es/components/dialog/confirm.js +0 -55
  393. package/es/components/dialog/customAttr.d.ts +0 -4
  394. package/es/components/dialog/customAttr.js +0 -25
  395. package/es/components/dialog/dialog.d.ts +0 -91
  396. package/es/components/dialog/dialog.js +0 -101
  397. package/es/components/dialog/index.d.ts +0 -20
  398. package/es/components/dialog/index.js +0 -14
  399. package/es/components/dialog/prompt.d.ts +0 -74
  400. package/es/components/dialog/prompt.js +0 -109
  401. package/es/components/drawer/customAttr.d.ts +0 -4
  402. package/es/components/drawer/customAttr.js +0 -20
  403. package/es/components/drawer/index.d.ts +0 -111
  404. package/es/components/drawer/index.js +0 -310
  405. package/es/components/fab/customAttr.d.ts +0 -1
  406. package/es/components/fab/customAttr.js +0 -13
  407. package/es/components/fab/index.d.ts +0 -100
  408. package/es/components/fab/index.js +0 -144
  409. package/es/components/headroom/customAttr.d.ts +0 -2
  410. package/es/components/headroom/customAttr.js +0 -11
  411. package/es/components/headroom/index.d.ts +0 -120
  412. package/es/components/headroom/index.js +0 -167
  413. package/es/components/menu/customAttr.d.ts +0 -3
  414. package/es/components/menu/customAttr.js +0 -24
  415. package/es/components/menu/index.d.ts +0 -167
  416. package/es/components/menu/index.js +0 -512
  417. package/es/components/panel/customAttr.d.ts +0 -2
  418. package/es/components/panel/customAttr.js +0 -11
  419. package/es/components/panel/index.d.ts +0 -23
  420. package/es/components/panel/index.js +0 -8
  421. package/es/components/progress/spinner.d.ts +0 -16
  422. package/es/components/progress/spinner.js +0 -47
  423. package/es/components/ripple/index.d.ts +0 -25
  424. package/es/components/ripple/index.js +0 -170
  425. package/es/components/select/customAttr.d.ts +0 -2
  426. package/es/components/select/customAttr.js +0 -11
  427. package/es/components/select/index.d.ts +0 -160
  428. package/es/components/select/index.js +0 -340
  429. package/es/components/slider/index.d.ts +0 -28
  430. package/es/components/slider/index.js +0 -134
  431. package/es/components/snackbar/index.d.ts +0 -126
  432. package/es/components/snackbar/index.js +0 -217
  433. package/es/components/tab/customAttr.d.ts +0 -2
  434. package/es/components/tab/customAttr.js +0 -11
  435. package/es/components/tab/index.d.ts +0 -114
  436. package/es/components/tab/index.js +0 -266
  437. package/es/components/table/index.d.ts +0 -25
  438. package/es/components/table/index.js +0 -178
  439. package/es/components/textfield/index.d.ts +0 -28
  440. package/es/components/textfield/index.js +0 -147
  441. package/es/components/tooltip/customAttr.d.ts +0 -3
  442. package/es/components/tooltip/customAttr.js +0 -20
  443. package/es/components/tooltip/index.d.ts +0 -123
  444. package/es/components/tooltip/index.js +0 -251
  445. package/es/global/mutation.d.ts +0 -23
  446. package/es/global/mutation.js +0 -14
  447. package/es/index.d.ts +0 -36
  448. package/es/index.js +0 -36
  449. package/es/interfaces/MduiStatic.d.ts +0 -8
  450. package/es/jq.d.ts +0 -99
  451. package/es/jq.js +0 -102
  452. package/es/jq_extends/methods/mutation.d.ts +0 -11
  453. package/es/jq_extends/methods/mutation.js +0 -19
  454. package/es/jq_extends/methods/reflow.d.ts +0 -14
  455. package/es/jq_extends/methods/reflow.js +0 -7
  456. package/es/jq_extends/methods/transform.d.ts +0 -14
  457. package/es/jq_extends/methods/transform.js +0 -8
  458. package/es/jq_extends/methods/transformOrigin.d.ts +0 -14
  459. package/es/jq_extends/methods/transformOrigin.js +0 -8
  460. package/es/jq_extends/methods/transition.d.ts +0 -15
  461. package/es/jq_extends/methods/transition.js +0 -12
  462. package/es/jq_extends/methods/transitionEnd.d.ts +0 -17
  463. package/es/jq_extends/methods/transitionEnd.js +0 -23
  464. package/es/jq_extends/static/guid.d.ts +0 -18
  465. package/es/jq_extends/static/guid.js +0 -30
  466. package/es/jq_extends/static/hideOverlay.d.ts +0 -23
  467. package/es/jq_extends/static/hideOverlay.js +0 -25
  468. package/es/jq_extends/static/lockScreen.d.ts +0 -15
  469. package/es/jq_extends/static/lockScreen.js +0 -14
  470. package/es/jq_extends/static/showOverlay.d.ts +0 -23
  471. package/es/jq_extends/static/showOverlay.js +0 -27
  472. package/es/jq_extends/static/throttle.d.ts +0 -17
  473. package/es/jq_extends/static/throttle.js +0 -13
  474. package/es/jq_extends/static/unlockScreen.d.ts +0 -22
  475. package/es/jq_extends/static/unlockScreen.js +0 -13
  476. package/es/mdui.d.ts +0 -3
  477. package/es/mdui.js +0 -8
  478. package/es/utils/componentEvent.d.ts +0 -13
  479. package/es/utils/componentEvent.js +0 -37
  480. package/es/utils/dom.d.ts +0 -4
  481. package/es/utils/dom.js +0 -5
  482. package/es/utils/mutation.d.ts +0 -15
  483. package/es/utils/mutation.js +0 -24
  484. package/es/utils/parseOptions.d.ts +0 -9
  485. package/es/utils/parseOptions.js +0 -15
  486. package/es/utils/queue.d.ts +0 -18
  487. package/es/utils/queue.js +0 -26
  488. package/es/utils/touchHandler.d.ts +0 -50
  489. package/es/utils/touchHandler.js +0 -76
  490. package/src/components/appbar/index.less +0 -110
  491. package/src/components/appbar/index.ts +0 -19
  492. package/src/components/bottom_nav/index.less +0 -155
  493. package/src/components/bottom_nav/index.ts +0 -43
  494. package/src/components/button/index.less +0 -291
  495. package/src/components/card/index.less +0 -200
  496. package/src/components/chip/index.less +0 -97
  497. package/src/components/collapse/collapseAbstract.ts +0 -270
  498. package/src/components/collapse/customAttr.ts +0 -13
  499. package/src/components/collapse/index.less +0 -44
  500. package/src/components/collapse/index.ts +0 -32
  501. package/src/components/dialog/alert.less +0 -11
  502. package/src/components/dialog/alert.ts +0 -111
  503. package/src/components/dialog/class.ts +0 -432
  504. package/src/components/dialog/confirm.less +0 -11
  505. package/src/components/dialog/confirm.ts +0 -140
  506. package/src/components/dialog/customAttr.ts +0 -41
  507. package/src/components/dialog/dialog.ts +0 -224
  508. package/src/components/dialog/index.less +0 -154
  509. package/src/components/dialog/index.ts +0 -40
  510. package/src/components/dialog/prompt.less +0 -16
  511. package/src/components/dialog/prompt.ts +0 -231
  512. package/src/components/divider/index.less +0 -49
  513. package/src/components/drawer/customAttr.ts +0 -30
  514. package/src/components/drawer/index.less +0 -177
  515. package/src/components/drawer/index.ts +0 -425
  516. package/src/components/fab/customAttr.ts +0 -23
  517. package/src/components/fab/index.less +0 -158
  518. package/src/components/fab/index.ts +0 -232
  519. package/src/components/grid_list/index.less +0 -126
  520. package/src/components/headroom/customAttr.ts +0 -13
  521. package/src/components/headroom/index.less +0 -51
  522. package/src/components/headroom/index.ts +0 -275
  523. package/src/components/list/index.less +0 -347
  524. package/src/components/menu/customAttr.ts +0 -40
  525. package/src/components/menu/index.less +0 -195
  526. package/src/components/menu/index.ts +0 -725
  527. package/src/components/menu/svg/arrow_right_dark.svg +0 -1
  528. package/src/components/menu/svg/arrow_right_light.svg +0 -1
  529. package/src/components/panel/customAttr.ts +0 -13
  530. package/src/components/panel/index.less +0 -191
  531. package/src/components/panel/index.ts +0 -32
  532. package/src/components/progress/progress.less +0 -113
  533. package/src/components/progress/spinner.less +0 -198
  534. package/src/components/progress/spinner.ts +0 -75
  535. package/src/components/ripple/index.less +0 -92
  536. package/src/components/ripple/index.ts +0 -217
  537. package/src/components/select/customAttr.ts +0 -13
  538. package/src/components/select/index.less +0 -342
  539. package/src/components/select/index.ts +0 -478
  540. package/src/components/select/svg/arrow_down_dark.svg +0 -1
  541. package/src/components/select/svg/arrow_down_light.svg +0 -1
  542. package/src/components/select/svg/arrow_up_dark.svg +0 -1
  543. package/src/components/select/svg/arrow_up_light.svg +0 -1
  544. package/src/components/selection_control/checkbox.less +0 -226
  545. package/src/components/selection_control/radio.less +0 -163
  546. package/src/components/selection_control/switch.less +0 -210
  547. package/src/components/slider/index.less +0 -340
  548. package/src/components/slider/index.ts +0 -187
  549. package/src/components/snackbar/index.less +0 -133
  550. package/src/components/snackbar/index.ts +0 -367
  551. package/src/components/subheader/index.less +0 -38
  552. package/src/components/tab/customAttr.ts +0 -13
  553. package/src/components/tab/index.less +0 -195
  554. package/src/components/tab/index.ts +0 -372
  555. package/src/components/table/index.less +0 -169
  556. package/src/components/table/index.ts +0 -240
  557. package/src/components/textfield/index.less +0 -425
  558. package/src/components/textfield/index.ts +0 -217
  559. package/src/components/toolbar/index.less +0 -92
  560. package/src/components/tooltip/customAttr.ts +0 -26
  561. package/src/components/tooltip/index.less +0 -45
  562. package/src/components/tooltip/index.ts +0 -361
  563. package/src/fonts/roboto/LICENSE.txt +0 -201
  564. package/src/fonts/roboto/Roboto-Black.woff +0 -0
  565. package/src/fonts/roboto/Roboto-Black.woff2 +0 -0
  566. package/src/fonts/roboto/Roboto-BlackItalic.woff +0 -0
  567. package/src/fonts/roboto/Roboto-BlackItalic.woff2 +0 -0
  568. package/src/fonts/roboto/Roboto-Bold.woff +0 -0
  569. package/src/fonts/roboto/Roboto-Bold.woff2 +0 -0
  570. package/src/fonts/roboto/Roboto-BoldItalic.woff +0 -0
  571. package/src/fonts/roboto/Roboto-BoldItalic.woff2 +0 -0
  572. package/src/fonts/roboto/Roboto-Light.woff +0 -0
  573. package/src/fonts/roboto/Roboto-Light.woff2 +0 -0
  574. package/src/fonts/roboto/Roboto-LightItalic.woff +0 -0
  575. package/src/fonts/roboto/Roboto-LightItalic.woff2 +0 -0
  576. package/src/fonts/roboto/Roboto-Medium.woff +0 -0
  577. package/src/fonts/roboto/Roboto-Medium.woff2 +0 -0
  578. package/src/fonts/roboto/Roboto-MediumItalic.woff +0 -0
  579. package/src/fonts/roboto/Roboto-MediumItalic.woff2 +0 -0
  580. package/src/fonts/roboto/Roboto-Regular.woff +0 -0
  581. package/src/fonts/roboto/Roboto-Regular.woff2 +0 -0
  582. package/src/fonts/roboto/Roboto-RegularItalic.woff +0 -0
  583. package/src/fonts/roboto/Roboto-RegularItalic.woff2 +0 -0
  584. package/src/fonts/roboto/Roboto-Thin.woff +0 -0
  585. package/src/fonts/roboto/Roboto-Thin.woff2 +0 -0
  586. package/src/fonts/roboto/Roboto-ThinItalic.woff +0 -0
  587. package/src/fonts/roboto/Roboto-ThinItalic.woff2 +0 -0
  588. package/src/global/mutation.ts +0 -37
  589. package/src/icons/material-icons/LICENSE.txt +0 -393
  590. package/src/icons/material-icons/MaterialIcons-Regular.ijmap +0 -1
  591. package/src/icons/material-icons/MaterialIcons-Regular.woff +0 -0
  592. package/src/icons/material-icons/MaterialIcons-Regular.woff2 +0 -0
  593. package/src/index.less +0 -73
  594. package/src/index.ts +0 -39
  595. package/src/interfaces/MduiStatic.ts +0 -11
  596. package/src/jq.ts +0 -104
  597. package/src/jq_extends/methods/mutation.ts +0 -32
  598. package/src/jq_extends/methods/reflow.ts +0 -23
  599. package/src/jq_extends/methods/transform.ts +0 -24
  600. package/src/jq_extends/methods/transformOrigin.ts +0 -24
  601. package/src/jq_extends/methods/transition.ts +0 -30
  602. package/src/jq_extends/methods/transitionEnd.ts +0 -49
  603. package/src/jq_extends/static/guid.ts +0 -56
  604. package/src/jq_extends/static/hideOverlay.ts +0 -50
  605. package/src/jq_extends/static/lockScreen.ts +0 -30
  606. package/src/jq_extends/static/showOverlay.ts +0 -51
  607. package/src/jq_extends/static/throttle.ts +0 -32
  608. package/src/jq_extends/static/unlockScreen.ts +0 -36
  609. package/src/mdui.ts +0 -12
  610. package/src/styles/color.less +0 -392
  611. package/src/styles/global.less +0 -75
  612. package/src/styles/grid.less +0 -150
  613. package/src/styles/helper.less +0 -242
  614. package/src/styles/icon.less +0 -31
  615. package/src/styles/material-icons.less +0 -36
  616. package/src/styles/media.less +0 -39
  617. package/src/styles/mixin/color.less +0 -66
  618. package/src/styles/mixin/divider.less +0 -30
  619. package/src/styles/mixin/helper.less +0 -126
  620. package/src/styles/mixin/icon.less +0 -33
  621. package/src/styles/mixin/layout-theme.less +0 -14
  622. package/src/styles/mixin/media.less +0 -11
  623. package/src/styles/mixin/shadow.less +0 -17
  624. package/src/styles/mixin/typo.less +0 -149
  625. package/src/styles/mixin.less +0 -8
  626. package/src/styles/roboto.less +0 -125
  627. package/src/styles/shadow.less +0 -20
  628. package/src/styles/typo-styles.less +0 -91
  629. package/src/styles/typo.less +0 -338
  630. package/src/styles/variable/animation.less +0 -5
  631. package/src/styles/variable/color/amber.less +0 -41
  632. package/src/styles/variable/color/black.less +0 -16
  633. package/src/styles/variable/color/blue-grey.less +0 -29
  634. package/src/styles/variable/color/blue.less +0 -41
  635. package/src/styles/variable/color/brown.less +0 -29
  636. package/src/styles/variable/color/cyan.less +0 -41
  637. package/src/styles/variable/color/deep-orange.less +0 -41
  638. package/src/styles/variable/color/deep-purple.less +0 -41
  639. package/src/styles/variable/color/default.less +0 -74
  640. package/src/styles/variable/color/green.less +0 -41
  641. package/src/styles/variable/color/grey.less +0 -29
  642. package/src/styles/variable/color/indigo.less +0 -41
  643. package/src/styles/variable/color/light-blue.less +0 -41
  644. package/src/styles/variable/color/light-green.less +0 -41
  645. package/src/styles/variable/color/lime.less +0 -41
  646. package/src/styles/variable/color/orange.less +0 -41
  647. package/src/styles/variable/color/pink.less +0 -41
  648. package/src/styles/variable/color/purple.less +0 -41
  649. package/src/styles/variable/color/red.less +0 -41
  650. package/src/styles/variable/color/teal.less +0 -41
  651. package/src/styles/variable/color/transparent.less +0 -1
  652. package/src/styles/variable/color/white.less +0 -16
  653. package/src/styles/variable/color/yellow.less +0 -41
  654. package/src/styles/variable/global.less +0 -98
  655. package/src/styles/variable/shadow.less +0 -103
  656. package/src/styles/variable.less +0 -26
  657. package/src/tsconfig.json +0 -12
  658. package/src/utils/componentEvent.ts +0 -63
  659. package/src/utils/dom.ts +0 -7
  660. package/src/utils/mutation.ts +0 -41
  661. package/src/utils/parseOptions.ts +0 -23
  662. package/src/utils/queue.ts +0 -51
  663. package/src/utils/touchHandler.ts +0 -92
  664. /package/{es/interfaces/MduiStatic.js → functions/utils/theme.js} +0 -0
@@ -0,0 +1,80 @@
1
+ import '@mdui/jq/methods/on.js';
2
+ import type { Dialog } from '../components/dialog.js';
3
+ interface Options {
4
+ /**
5
+ * alert 的标题
6
+ */
7
+ headline?: string;
8
+ /**
9
+ * alert 的描述文本
10
+ */
11
+ description?: string;
12
+ /**
13
+ * alert 顶部的 Material Icons 图标名
14
+ */
15
+ icon?: string;
16
+ /**
17
+ * 是否在按下 ESC 键时,关闭 alert
18
+ */
19
+ closeOnEsc?: boolean;
20
+ /**
21
+ * 是否在点击遮罩层时,关闭 alert
22
+ */
23
+ closeOnOverlayClick?: boolean;
24
+ /**
25
+ * 确认按钮的文本
26
+ */
27
+ confirmText?: string;
28
+ /**
29
+ * 队列名称。
30
+ * 默认不启用队列,在多次调用该函数时,将同时显示多个 alert。
31
+ * 可在该参数中传入一个队列名称,具有相同队列名称的 alert 函数,将在上一个 alert 关闭后才打开下一个 alert。
32
+ * `dialog()`、`alert()`、`confirm()`、`prompt()` 这四个函数的队列名称若相同,则也将互相共用同一个队列。
33
+ */
34
+ queue?: string;
35
+ /**
36
+ * 点击确认按钮时的回调函数。
37
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
38
+ * 默认点击确认按钮后会关闭 alert;若返回值为 `false`,则不关闭 alert;若返回值为 promise,则将在 promise 被 resolve 后,关闭 alert。
39
+ * @param dialog
40
+ */
41
+ onConfirm?: (dialog: Dialog) => void | boolean | Promise<void>;
42
+ /**
43
+ * alert 开始打开时的回调函数。
44
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
45
+ * @param dialog
46
+ */
47
+ onOpen?: (dialog: Dialog) => void;
48
+ /**
49
+ * alert 打开动画完成时的回调函数。
50
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
51
+ * @param dialog
52
+ */
53
+ onOpened?: (dialog: Dialog) => void;
54
+ /**
55
+ * alert 开始关闭时的回调函数。
56
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
57
+ * @param dialog
58
+ */
59
+ onClose?: (dialog: Dialog) => void;
60
+ /**
61
+ * alert 关闭动画完成时的回调函数。
62
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
63
+ * @param dialog
64
+ */
65
+ onClosed?: (dialog: Dialog) => void;
66
+ /**
67
+ * 点击遮罩层时的回调函数。
68
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
69
+ * @param dialog
70
+ */
71
+ onOverlayClick?: (dialog: Dialog) => void;
72
+ }
73
+ /**
74
+ * 打开一个 alert,返回 Promise。
75
+ * 如果是通过点击确定按钮关闭,则返回的 promise 会被 resolve;
76
+ * 如果是通过其他方式关闭,则返回的 promise 会被 reject。
77
+ * @param options
78
+ */
79
+ export declare const alert: (options: Options) => Promise<void>;
80
+ export {};
@@ -0,0 +1,59 @@
1
+ import isPromise from 'is-promise';
2
+ import { $ } from '@mdui/jq/$.js';
3
+ import '@mdui/jq/methods/on.js';
4
+ import { isUndefined, returnTrue } from '@mdui/jq/shared/helper.js';
5
+ import { dialog as openDialog } from './dialog.js';
6
+ const defaultOptions = {
7
+ confirmText: '确定',
8
+ onConfirm: returnTrue,
9
+ };
10
+ /**
11
+ * 打开一个 alert,返回 Promise。
12
+ * 如果是通过点击确定按钮关闭,则返回的 promise 会被 resolve;
13
+ * 如果是通过其他方式关闭,则返回的 promise 会被 reject。
14
+ * @param options
15
+ */
16
+ export const alert = (options) => {
17
+ const mergedOptions = Object.assign({}, defaultOptions, options);
18
+ const properties = [
19
+ 'headline',
20
+ 'description',
21
+ 'icon',
22
+ 'closeOnEsc',
23
+ 'closeOnOverlayClick',
24
+ 'queue',
25
+ 'onOpen',
26
+ 'onOpened',
27
+ 'onClose',
28
+ 'onClosed',
29
+ 'onOverlayClick',
30
+ ];
31
+ return new Promise((resolve, reject) => {
32
+ let isResolve = false;
33
+ const dialog = openDialog({
34
+ ...Object.fromEntries(properties
35
+ .filter((key) => !isUndefined(mergedOptions[key]))
36
+ .map((key) => [key, mergedOptions[key]])),
37
+ actions: [
38
+ {
39
+ text: mergedOptions.confirmText,
40
+ onClick: (dialog) => {
41
+ const clickResult = mergedOptions.onConfirm.call(dialog, dialog);
42
+ if (isPromise(clickResult)) {
43
+ clickResult.then(() => {
44
+ isResolve = true;
45
+ });
46
+ }
47
+ else if (clickResult !== false) {
48
+ isResolve = true;
49
+ }
50
+ return clickResult;
51
+ },
52
+ },
53
+ ],
54
+ });
55
+ $(dialog).on('close', () => {
56
+ isResolve ? resolve() : reject();
57
+ });
58
+ });
59
+ };
@@ -0,0 +1 @@
1
+ export { breakpoint } from '@mdui/shared/helpers/breakpoint.js';
@@ -0,0 +1 @@
1
+ export { breakpoint } from '@mdui/shared/helpers/breakpoint.js';
@@ -0,0 +1,95 @@
1
+ import '@mdui/jq/methods/on.js';
2
+ import type { Dialog } from '../components/dialog.js';
3
+ interface Options {
4
+ /**
5
+ * confirm 的标题
6
+ */
7
+ headline?: string;
8
+ /**
9
+ * confirm 的描述文本
10
+ */
11
+ description?: string;
12
+ /**
13
+ * confirm 顶部的 Material Icons 图标名
14
+ */
15
+ icon?: string;
16
+ /**
17
+ * 是否在按下 ESC 键时,关闭 confirm
18
+ */
19
+ closeOnEsc?: boolean;
20
+ /**
21
+ * 是否在点击遮罩层时,关闭 confirm
22
+ */
23
+ closeOnOverlayClick?: boolean;
24
+ /**
25
+ * 确认按钮的文本
26
+ */
27
+ confirmText?: string;
28
+ /**
29
+ * 取消按钮的文本
30
+ */
31
+ cancelText?: string;
32
+ /**
33
+ * 是否垂直排列底部操作按钮
34
+ */
35
+ stackedActions?: boolean;
36
+ /**
37
+ * 队列名称。
38
+ * 默认不启用队列,在多次调用该函数时,将同时显示多个 confirm。
39
+ * 可在该参数中传入一个队列名称,具有相同队列名称的 confirm 函数,将在上一个 confirm 关闭后才打开下一个 confirm。
40
+ * `dialog()`、`alert()`、`confirm()`、`prompt()` 这四个函数的队列名称若相同,则也将互相共用同一个队列。
41
+ */
42
+ queue?: string;
43
+ /**
44
+ * 点击确认按钮时的回调函数。
45
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
46
+ * 默认点击确认按钮后会关闭 confirm;若返回值为 `false`,则不关闭 confirm;若返回值为 promise,则将在 promise 被 resolve 后,关闭 confirm。
47
+ * @param dialog
48
+ */
49
+ onConfirm?: (dialog: Dialog) => void | boolean | Promise<void>;
50
+ /**
51
+ * 点击取消按钮时的回调函数。
52
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
53
+ * 默认点击确认按钮后会关闭 confirm;若返回值为 `false`,则不关闭 confirm;若返回值为 promise,则将在 promise 被 resolve 后,关闭 confirm。
54
+ * @param dialog
55
+ */
56
+ onCancel?: (dialog: Dialog) => void | boolean | Promise<void>;
57
+ /**
58
+ * confirm 开始打开时的回调函数。
59
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
60
+ * @param dialog
61
+ */
62
+ onOpen?: (dialog: Dialog) => void;
63
+ /**
64
+ * confirm 打开动画完成时的回调函数。
65
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
66
+ * @param dialog
67
+ */
68
+ onOpened?: (dialog: Dialog) => void;
69
+ /**
70
+ * confirm 开始关闭时的回调函数。
71
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
72
+ * @param dialog
73
+ */
74
+ onClose?: (dialog: Dialog) => void;
75
+ /**
76
+ * confirm 关闭动画完成时的回调函数。
77
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
78
+ * @param dialog
79
+ */
80
+ onClosed?: (dialog: Dialog) => void;
81
+ /**
82
+ * 点击遮罩层时的回调函数。
83
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
84
+ * @param dialog
85
+ */
86
+ onOverlayClick?: (dialog: Dialog) => void;
87
+ }
88
+ /**
89
+ * 打开一个 confirm,返回 Promise。
90
+ * 如果是通过点击确定按钮关闭,则返回的 promise 会被 resolve;
91
+ * 如果是通过其他方式关闭,则返回的 promise 会被 reject。
92
+ * @param options
93
+ */
94
+ export declare const confirm: (options: Options) => Promise<void>;
95
+ export {};
@@ -0,0 +1,68 @@
1
+ import isPromise from 'is-promise';
2
+ import { $ } from '@mdui/jq/$.js';
3
+ import '@mdui/jq/methods/on.js';
4
+ import { isUndefined, returnTrue } from '@mdui/jq/shared/helper.js';
5
+ import { dialog as openDialog } from './dialog.js';
6
+ const defaultOptions = {
7
+ confirmText: '确定',
8
+ cancelText: '取消',
9
+ onConfirm: returnTrue,
10
+ onCancel: returnTrue,
11
+ };
12
+ /**
13
+ * 打开一个 confirm,返回 Promise。
14
+ * 如果是通过点击确定按钮关闭,则返回的 promise 会被 resolve;
15
+ * 如果是通过其他方式关闭,则返回的 promise 会被 reject。
16
+ * @param options
17
+ */
18
+ export const confirm = (options) => {
19
+ const mergedOptions = Object.assign({}, defaultOptions, options);
20
+ const properties = [
21
+ 'headline',
22
+ 'description',
23
+ 'icon',
24
+ 'closeOnEsc',
25
+ 'closeOnOverlayClick',
26
+ 'stackedActions',
27
+ 'queue',
28
+ 'onOpen',
29
+ 'onOpened',
30
+ 'onClose',
31
+ 'onClosed',
32
+ 'onOverlayClick',
33
+ ];
34
+ return new Promise((resolve, reject) => {
35
+ let isResolve = false;
36
+ const dialog = openDialog({
37
+ ...Object.fromEntries(properties
38
+ .filter((key) => !isUndefined(mergedOptions[key]))
39
+ .map((key) => [key, mergedOptions[key]])),
40
+ actions: [
41
+ {
42
+ text: mergedOptions.cancelText,
43
+ onClick: (dialog) => {
44
+ return mergedOptions.onCancel.call(dialog, dialog);
45
+ },
46
+ },
47
+ {
48
+ text: mergedOptions.confirmText,
49
+ onClick: (dialog) => {
50
+ const clickResult = mergedOptions.onConfirm.call(dialog, dialog);
51
+ if (isPromise(clickResult)) {
52
+ clickResult.then(() => {
53
+ isResolve = true;
54
+ });
55
+ }
56
+ else if (clickResult !== false) {
57
+ isResolve = true;
58
+ }
59
+ return clickResult;
60
+ },
61
+ },
62
+ ],
63
+ });
64
+ $(dialog).on('close', () => {
65
+ isResolve ? resolve() : reject();
66
+ });
67
+ });
68
+ };
@@ -0,0 +1,97 @@
1
+ import '@mdui/jq/methods/append.js';
2
+ import '@mdui/jq/methods/appendTo.js';
3
+ import '@mdui/jq/methods/on.js';
4
+ import '@mdui/jq/methods/remove.js';
5
+ import '../components/button.js';
6
+ import { Dialog } from '../components/dialog.js';
7
+ import type { JQ } from '@mdui/jq/shared/core.js';
8
+ interface Action {
9
+ /**
10
+ * 按钮文本
11
+ */
12
+ text: string;
13
+ /**
14
+ * 点击按钮时的回调函数。
15
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
16
+ * 默认点击按钮后会关闭 dialog;若返回值为 false,则不关闭 dialog;若返回值为 promise,则将在 promise 被 resolve 后,关闭 dialog。
17
+ * @param dialog
18
+ */
19
+ onClick?: (dialog: Dialog) => void | boolean | Promise<void>;
20
+ }
21
+ interface Options {
22
+ /**
23
+ * dialog 的标题
24
+ */
25
+ headline?: string;
26
+ /**
27
+ * dialog 的描述文本
28
+ */
29
+ description?: string;
30
+ /**
31
+ * dialog 中的 body 内容,可以是 HTML 字符串、DOM 元素、或 JQ 对象
32
+ */
33
+ body?: string | HTMLElement | JQ<HTMLElement>;
34
+ /**
35
+ * dialog 顶部的 Material Icons 图标名
36
+ */
37
+ icon?: string;
38
+ /**
39
+ * 是否在按下 ESC 键时,关闭 dialog
40
+ */
41
+ closeOnEsc?: boolean;
42
+ /**
43
+ * 是否在点击遮罩层时,关闭 dialog
44
+ */
45
+ closeOnOverlayClick?: boolean;
46
+ /**
47
+ * 底部操作按钮数组
48
+ */
49
+ actions?: Action[];
50
+ /**
51
+ * 是否垂直排列底部操作按钮
52
+ */
53
+ stackedActions?: boolean;
54
+ /**
55
+ * 队列名称。
56
+ * 默认不启用队列,在多次调用该函数时,将同时显示多个 dialog。
57
+ * 可在该参数中传入一个队列名称,具有相同队列名称的 dialog 函数,将在上一个 dialog 关闭后才打开下一个 dialog。
58
+ * `dialog()`、`alert()`、`confirm()`、`prompt()` 这四个函数的队列名称若相同,则也将互相共用同一个队列。
59
+ */
60
+ queue?: string;
61
+ /**
62
+ * dialog 开始打开时的回调函数。
63
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
64
+ * @param dialog
65
+ */
66
+ onOpen?: (dialog: Dialog) => void;
67
+ /**
68
+ * dialog 打开动画完成时的回调函数。
69
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
70
+ * @param dialog
71
+ */
72
+ onOpened?: (dialog: Dialog) => void;
73
+ /**
74
+ * dialog 开始关闭时的回调函数。
75
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
76
+ * @param dialog
77
+ */
78
+ onClose?: (dialog: Dialog) => void;
79
+ /**
80
+ * dialog 关闭动画完成时的回调函数。
81
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
82
+ * @param dialog
83
+ */
84
+ onClosed?: (dialog: Dialog) => void;
85
+ /**
86
+ * 点击遮罩层时的回调函数。
87
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
88
+ * @param dialog
89
+ */
90
+ onOverlayClick?: (dialog: Dialog) => void;
91
+ }
92
+ /**
93
+ * 打开一个 dialog,返回 dialog 实例
94
+ * @param options
95
+ */
96
+ export declare const dialog: (options: Options) => Dialog;
97
+ export {};
@@ -0,0 +1,100 @@
1
+ import isPromise from 'is-promise';
2
+ import { $ } from '@mdui/jq/$.js';
3
+ import '@mdui/jq/methods/append.js';
4
+ import '@mdui/jq/methods/appendTo.js';
5
+ import '@mdui/jq/methods/on.js';
6
+ import '@mdui/jq/methods/remove.js';
7
+ import { returnTrue, toKebabCase } from '@mdui/jq/shared/helper.js';
8
+ import { dequeue, queue } from '@mdui/shared/helpers/queue.js';
9
+ import '../components/button.js';
10
+ import { Dialog } from '../components/dialog.js';
11
+ const defaultAction = {
12
+ onClick: returnTrue,
13
+ };
14
+ const queueName = 'mdui.functions.dialog.';
15
+ let currentDialog = undefined;
16
+ /**
17
+ * 打开一个 dialog,返回 dialog 实例
18
+ * @param options
19
+ */
20
+ export const dialog = (options) => {
21
+ const dialog = new Dialog();
22
+ const $dialog = $(dialog);
23
+ const properties = [
24
+ 'headline',
25
+ 'description',
26
+ 'icon',
27
+ 'closeOnEsc',
28
+ 'closeOnOverlayClick',
29
+ 'stackedActions',
30
+ ];
31
+ const callbacks = ['onOpen', 'onOpened', 'onClose', 'onClosed', 'onOverlayClick'];
32
+ Object.entries(options).forEach(([key, value]) => {
33
+ // @ts-ignore
34
+ if (properties.includes(key)) {
35
+ // @ts-ignore
36
+ dialog[key] = value;
37
+ // @ts-ignore
38
+ }
39
+ else if (callbacks.includes(key)) {
40
+ const eventName = toKebabCase(key.slice(2));
41
+ $dialog.on(eventName, () => {
42
+ value.call(dialog, dialog);
43
+ });
44
+ }
45
+ });
46
+ if (options.body) {
47
+ $dialog.append(options.body);
48
+ }
49
+ if (options.actions) {
50
+ options.actions.forEach((action) => {
51
+ const mergedAction = Object.assign({}, defaultAction, action);
52
+ $(`<mdui-button
53
+ slot="action"
54
+ variant="text"
55
+ >${mergedAction.text}</mdui-button>`)
56
+ .appendTo($dialog)
57
+ .on('click', function () {
58
+ const clickResult = mergedAction.onClick.call(dialog, dialog);
59
+ if (isPromise(clickResult)) {
60
+ this.loading = true;
61
+ clickResult
62
+ .then(() => {
63
+ dialog.open = false;
64
+ })
65
+ .finally(() => {
66
+ this.loading = false;
67
+ });
68
+ }
69
+ else if (clickResult !== false) {
70
+ dialog.open = false;
71
+ }
72
+ });
73
+ });
74
+ }
75
+ $dialog.appendTo('body').on('closed', () => {
76
+ $dialog.remove();
77
+ if (options.queue) {
78
+ currentDialog = undefined;
79
+ dequeue(queueName + options.queue);
80
+ }
81
+ });
82
+ if (!options.queue) {
83
+ setTimeout(() => {
84
+ dialog.open = true;
85
+ });
86
+ }
87
+ else if (currentDialog) {
88
+ queue(queueName + options.queue, () => {
89
+ dialog.open = true;
90
+ currentDialog = dialog;
91
+ });
92
+ }
93
+ else {
94
+ setTimeout(() => {
95
+ dialog.open = true;
96
+ });
97
+ currentDialog = dialog;
98
+ }
99
+ return dialog;
100
+ };
@@ -0,0 +1,7 @@
1
+ import type { JQ } from '@mdui/jq/shared/core.js';
2
+ /**
3
+ * 根据指定的图片,提取出主色调的十六进制颜色值
4
+ * @param image `<img>` 元素的 CSS 选择器、或 `<img>` 元素、或 JQ 对象
5
+ * @return string 十六进制颜色值。例如:`#ff0000`
6
+ */
7
+ export declare const getColorFromImage: (image: string | HTMLImageElement | JQ<HTMLImageElement>) => Promise<string>;
@@ -0,0 +1,12 @@
1
+ import { sourceColorFromImage, hexFromArgb, } from '@material/material-color-utilities';
2
+ import { $ } from '@mdui/jq/$.js';
3
+ /**
4
+ * 根据指定的图片,提取出主色调的十六进制颜色值
5
+ * @param image `<img>` 元素的 CSS 选择器、或 `<img>` 元素、或 JQ 对象
6
+ * @return string 十六进制颜色值。例如:`#ff0000`
7
+ */
8
+ export const getColorFromImage = async (image) => {
9
+ const $image = $(image);
10
+ const source = await sourceColorFromImage($image[0]);
11
+ return hexFromArgb(source);
12
+ };
@@ -0,0 +1,10 @@
1
+ import type { Theme } from './utils/theme.js';
2
+ import type { JQ } from '@mdui/jq/shared/core.js';
3
+ /**
4
+ * 获取在指定元素上设置的主题。
5
+ * 未传入参数时,默认获取 `<html>` 元素上的主题。
6
+ * 元素上未设置过主题时,默认返回 `light`。
7
+ * @param target 获取该元素上的主题。可以是 CSS 选择器、DOM 元素、或 JQ 对象。默认为 `<html>` 元素
8
+ * @return Theme 当前主题,值为 `light`、`dark` 或 `auto`
9
+ */
10
+ export declare const getTheme: (target?: string | HTMLElement | JQ<HTMLElement>) => Theme;
@@ -0,0 +1,16 @@
1
+ import { $ } from '@mdui/jq/$.js';
2
+ /**
3
+ * 获取在指定元素上设置的主题。
4
+ * 未传入参数时,默认获取 `<html>` 元素上的主题。
5
+ * 元素上未设置过主题时,默认返回 `light`。
6
+ * @param target 获取该元素上的主题。可以是 CSS 选择器、DOM 元素、或 JQ 对象。默认为 `<html>` 元素
7
+ * @return Theme 当前主题,值为 `light`、`dark` 或 `auto`
8
+ */
9
+ export const getTheme = (target = document.documentElement) => {
10
+ var _a, _b;
11
+ const element = $(target)[0];
12
+ const themes = ['light', 'dark', 'auto'];
13
+ const prefix = 'mdui-theme-';
14
+ return ((_b = (_a = Array.from(element.classList)
15
+ .find((className) => themes.map((theme) => prefix + theme).includes(className))) === null || _a === void 0 ? void 0 : _a.slice(prefix.length)) !== null && _b !== void 0 ? _b : 'light');
16
+ };
@@ -0,0 +1,2 @@
1
+ export { observeResize } from '@mdui/shared/helpers/observeResize.js';
2
+ export type { ObserveResize } from '@mdui/shared/helpers/observeResize.js';
@@ -0,0 +1 @@
1
+ export { observeResize } from '@mdui/shared/helpers/observeResize.js';
@@ -0,0 +1,110 @@
1
+ import '@mdui/jq/methods/on.js';
2
+ import { TextField } from '../components/text-field.js';
3
+ import type { Dialog } from '../components/dialog.js';
4
+ interface Options {
5
+ /**
6
+ * prompt 的标题
7
+ */
8
+ headline?: string;
9
+ /**
10
+ * prompt 的描述文本
11
+ */
12
+ description?: string;
13
+ /**
14
+ * prompt 顶部的 Material Icons 图标名
15
+ */
16
+ icon?: string;
17
+ /**
18
+ * 是否在按下 ESC 键时,关闭 prompt
19
+ */
20
+ closeOnEsc?: boolean;
21
+ /**
22
+ * 是否在点击遮罩层时,关闭 prompt
23
+ */
24
+ closeOnOverlayClick?: boolean;
25
+ /**
26
+ * 确认按钮的文本
27
+ */
28
+ confirmText?: string;
29
+ /**
30
+ * 取消按钮的文本
31
+ */
32
+ cancelText?: string;
33
+ /**
34
+ * 是否垂直排列底部操作按钮
35
+ */
36
+ stackedActions?: boolean;
37
+ /**
38
+ * 队列名称。
39
+ * 默认不启用队列,在多次调用该函数时,将同时显示多个 prompt。
40
+ * 可在该参数中传入一个队列名称,具有相同队列名称的 prompt 函数,将在上一个 prompt 关闭后才打开下一个 prompt。
41
+ * `dialog()`、`alert()`、`confirm()`、`prompt()` 这四个函数的队列名称若相同,则也将互相共用同一个队列。
42
+ */
43
+ queue?: string;
44
+ /**
45
+ * 点击确认按钮时的回调函数。
46
+ * 函数参数为输入框的值和 dialog 实例,`this` 指向 dialog 实例。
47
+ * 默认点击确认按钮后会关闭 prompt;若返回值为 `false`,则不关闭 prompt;若返回值为 promise,则将在 promise 被 resolve 后,关闭 prompt。
48
+ * @param value
49
+ * @param dialog
50
+ */
51
+ onConfirm?: (value: string, dialog: Dialog) => void | boolean | Promise<void>;
52
+ /**
53
+ * 点击取消按钮时的回调函数。
54
+ * 函数参数为输入框的值和 dialog 实例,`this` 指向 dialog 实例。
55
+ * 默认点击取消按钮后会关闭 prompt;若返回值为 `false`,则不关闭 prompt;若返回值为 promise,则将在 promise 被 resolve 后,关闭 prompt。
56
+ * @param dialog
57
+ */
58
+ onCancel?: (value: string, dialog: Dialog) => void | boolean | Promise<void>;
59
+ /**
60
+ * prompt 开始打开时的回调函数。
61
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
62
+ * @param dialog
63
+ */
64
+ onOpen?: (dialog: Dialog) => void;
65
+ /**
66
+ * prompt 打开动画完成时的回调函数。
67
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
68
+ * @param dialog
69
+ */
70
+ onOpened?: (dialog: Dialog) => void;
71
+ /**
72
+ * prompt 开始关闭时的回调函数。
73
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
74
+ * @param dialog
75
+ */
76
+ onClose?: (dialog: Dialog) => void;
77
+ /**
78
+ * prompt 关闭动画完成时的回调函数。
79
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
80
+ * @param dialog
81
+ */
82
+ onClosed?: (dialog: Dialog) => void;
83
+ /**
84
+ * 点击遮罩层时的回调函数。
85
+ * 函数参数为 dialog 实例,`this` 也指向 dialog 实例。
86
+ * @param dialog
87
+ */
88
+ onOverlayClick?: (dialog: Dialog) => void;
89
+ /**
90
+ * 输入框的校验函数,参数为输入框的值。`this` 指向 TextField 实例。
91
+ * 将在浏览器原生验证 API 验证通过后,再使用该函数进行验证。
92
+ * 可以返回 `boolean` 值,为 `false` 时表示验证未通过,为 `true` 时表示验证通过。
93
+ * 也可以返回字符串,字符串不为空时表示验证未通过,同时返回的字符串将用作错误提示。
94
+ * 也可以返回 Promise,被 resolve 表示验证通过,被 reject 表示验证未通过,同时拒绝原因将用作错误提示。
95
+ * @param value
96
+ */
97
+ validator?: (value: string) => boolean | string | Promise<void>;
98
+ /**
99
+ * prompt 内部的输入框为 `<mdui-text-field>` 组件。可在该参数中设置 `<mdui-text-field>` 组件的参数。
100
+ */
101
+ textFieldOptions?: Partial<TextField>;
102
+ }
103
+ /**
104
+ * 打开一个 prompt,返回 Promise。
105
+ * 如果是通过点击确定按钮关闭,则返回的 promise 会被 resolve,resolve 的参数为输入框的值;
106
+ * 如果是通过其他方式关闭,则返回的 promise 会被 reject。
107
+ * @param options
108
+ */
109
+ export declare const prompt: (options: Options) => Promise<string>;
110
+ export {};