@universal-material/web 3.0.7 → 3.0.9

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 (364) hide show
  1. package/.editorconfig +8 -0
  2. package/.eleventy.cjs +21 -0
  3. package/.eslintignore +6 -0
  4. package/.eslintrc.json +98 -0
  5. package/.prettierrc.json +7 -0
  6. package/.vscode/extensions.json +9 -0
  7. package/CHANGELOG.md +98 -0
  8. package/LICENSE +28 -0
  9. package/docs/.nojekyll +0 -0
  10. package/docs/api/index.html +149 -0
  11. package/docs/docs.css +185 -0
  12. package/docs/examples/index.html +75 -0
  13. package/docs/examples/name-property/index.html +65 -0
  14. package/docs/index.html +75 -0
  15. package/docs/install/index.html +53 -0
  16. package/docs/prism-okaidia.css +123 -0
  17. package/docs/src/_api-section.pug +27 -0
  18. package/docs/src/_layout.pug +182 -0
  19. package/docs/src/components/button-set/alignment.html +29 -0
  20. package/docs/src/components/button-set/stack.html +5 -0
  21. package/docs/src/components/button-set/usage.html +35 -0
  22. package/docs/src/components/button-set.pug +16 -0
  23. package/docs/src/components/cards/card-media.html +39 -0
  24. package/docs/src/components/cards/card-with-actions.html +38 -0
  25. package/docs/src/components/cards/simple-card.html +3 -0
  26. package/docs/src/components/cards.pug +15 -0
  27. package/docs/src/components/checkbox/usage.html +33 -0
  28. package/docs/src/components/checkbox.pug +7 -0
  29. package/docs/src/components/chips/chip-input.html +73 -0
  30. package/docs/src/components/chips/default-chips.html +25 -0
  31. package/docs/src/components/chips/elevated-chips.html +25 -0
  32. package/docs/src/components/chips/selected-chips.html +50 -0
  33. package/docs/src/components/chips.pug +16 -0
  34. package/docs/src/components/common-buttons/anchor-buttons.html +6 -0
  35. package/docs/src/components/common-buttons/buttons-icons.html +24 -0
  36. package/docs/src/components/common-buttons/buttons-trailing-icons.html +25 -0
  37. package/docs/src/components/common-buttons/buttons-variants.html +6 -0
  38. package/docs/src/components/common-buttons/filled-colors.html +4 -0
  39. package/docs/src/components/common-buttons.pug +22 -0
  40. package/docs/src/components/data-tables/simple-table.html +47 -0
  41. package/docs/src/components/data-tables/table-footer.html +59 -0
  42. package/docs/src/components/data-tables/table-header.html +43 -0
  43. package/docs/src/components/data-tables.pug +15 -0
  44. package/docs/src/components/datepicker.pug +133 -0
  45. package/docs/src/components/dialogs/example.html +44 -0
  46. package/docs/src/components/dialogs.pug +19 -0
  47. package/docs/src/components/dividers/no-margin.html +7 -0
  48. package/docs/src/components/dividers/usage.html +7 -0
  49. package/docs/src/components/dividers.pug +13 -0
  50. package/docs/src/components/dropdown-menus/down-end.html +10 -0
  51. package/docs/src/components/dropdown-menus/down-left.html +10 -0
  52. package/docs/src/components/dropdown-menus/down-right.html +10 -0
  53. package/docs/src/components/dropdown-menus/down-start.html +10 -0
  54. package/docs/src/components/dropdown-menus/down.html +10 -0
  55. package/docs/src/components/dropdown-menus/up-end.html +10 -0
  56. package/docs/src/components/dropdown-menus/up-left.html +10 -0
  57. package/docs/src/components/dropdown-menus/up-right.html +10 -0
  58. package/docs/src/components/dropdown-menus/up-start.html +10 -0
  59. package/docs/src/components/dropdown-menus/up.html +10 -0
  60. package/docs/src/components/expansion-panel.pug +33 -0
  61. package/docs/src/components/fab/button-colors.html +18 -0
  62. package/docs/src/components/fab/button-sizes.html +11 -0
  63. package/docs/src/components/fab/extended-buttons.html +18 -0
  64. package/docs/src/components/fab/floating-action-area.html +5 -0
  65. package/docs/src/components/fab/floating-menu.html +10 -0
  66. package/docs/src/components/fab/lowered-buttons.html +6 -0
  67. package/docs/src/components/fab.pug +25 -0
  68. package/docs/src/components/icon-buttons/anchor-buttons.html +15 -0
  69. package/docs/src/components/icon-buttons/buttons-variants.html +15 -0
  70. package/docs/src/components/icon-buttons/toggle-buttons-manual.html +44 -0
  71. package/docs/src/components/icon-buttons/toggle-buttons.html +48 -0
  72. package/docs/src/components/icon-buttons.pug +18 -0
  73. package/docs/src/components/lists/list-avatars.html +14 -0
  74. package/docs/src/components/lists/list-custom-dividers.html +23 -0
  75. package/docs/src/components/lists/list-dividers.html +17 -0
  76. package/docs/src/components/lists/list-dynamic.html +26 -0
  77. package/docs/src/components/lists/list-hover.html +17 -0
  78. package/docs/src/components/lists/list-icons.html +17 -0
  79. package/docs/src/components/lists/list-indexed.html +123 -0
  80. package/docs/src/components/lists/list-sections.html +16 -0
  81. package/docs/src/components/lists/list-three-lines.html +20 -0
  82. package/docs/src/components/lists/list-two-lines.html +20 -0
  83. package/docs/src/components/lists/list-with-action.html +26 -0
  84. package/docs/src/components/lists/list-with-activated-item.html +17 -0
  85. package/docs/src/components/lists/simple-list.html +17 -0
  86. package/docs/src/components/lists.pug +94 -0
  87. package/docs/src/components/menus.pug +55 -0
  88. package/docs/src/components/progress/circular-progress.html +13 -0
  89. package/docs/src/components/progress/determinate-progress.html +3 -0
  90. package/docs/src/components/progress/indeterminate-progress.html +3 -0
  91. package/docs/src/components/progress/progress-color.html +3 -0
  92. package/docs/src/components/progress.pug +18 -0
  93. package/docs/src/components/ripple/usage.html +9 -0
  94. package/docs/src/components/ripple.pug +10 -0
  95. package/docs/src/components/selection-controls/checkbox.html +22 -0
  96. package/docs/src/components/selection-controls/radio-button.html +36 -0
  97. package/docs/src/components/selection-controls/switch.html +12 -0
  98. package/docs/src/components/selection-controls.pug +13 -0
  99. package/docs/src/components/sliders/example.html +42 -0
  100. package/docs/src/components/sliders.pug +7 -0
  101. package/docs/src/components/snackbar/example.html +35 -0
  102. package/docs/src/components/snackbars.pug +21 -0
  103. package/docs/src/components/steppers.pug +57 -0
  104. package/docs/src/components/tabs/example.html +45 -0
  105. package/docs/src/components/tabs.pug +8 -0
  106. package/docs/src/components/text-fields.pug +88 -0
  107. package/docs/src/components/toolbars/simple-toolbar.html +33 -0
  108. package/docs/src/components/toolbars.pug +7 -0
  109. package/docs/src/content/typography/example.html +15 -0
  110. package/docs/src/content/typography.pug +8 -0
  111. package/docs/src/css/docs.scss +189 -0
  112. package/docs/src/index.pug +10 -0
  113. package/docs/src/js/docs.js +161 -0
  114. package/docs/src/js/universal-material.js +757 -0
  115. package/docs/src/js/universal-material.js.map +1 -0
  116. package/docs/src/js/universal-material.min.js +17 -0
  117. package/docs/src/js/universal-material.min.js.map +1 -0
  118. package/docs/src/layout/grid.pug +15 -0
  119. package/docs/src/utilities/background-colors/common-colors.html +7 -0
  120. package/docs/src/utilities/background-colors/theme-colors.html +16 -0
  121. package/docs/src/utilities/background-colors.pug +10 -0
  122. package/docs/src/utilities/text-and-background-colors/common-colors.html +80 -0
  123. package/docs/src/utilities/text-and-background-colors/theme-colors.html +208 -0
  124. package/docs/src/utilities/text-and-background-colors.pug +10 -0
  125. package/docs/src/utilities/text-colors/common-colors.html +12 -0
  126. package/docs/src/utilities/text-colors/emphasis-colors.html +26 -0
  127. package/docs/src/utilities/text-colors/theme-colors.html +37 -0
  128. package/docs/src/utilities/text-colors.pug +13 -0
  129. package/gulpfile.js +225 -0
  130. package/index.html +11 -0
  131. package/package.json +1 -1
  132. package/rollup.config.js +42 -0
  133. package/src/_utils.scss +20 -0
  134. package/src/_variables.scss +68 -0
  135. package/src/button/button-base.styles.scss +75 -0
  136. package/src/button/button-base.ts +147 -0
  137. package/src/button/button-set.styles.scss +35 -0
  138. package/src/button/button-set.ts +33 -0
  139. package/src/button/button.styles.scss +97 -0
  140. package/src/button/button.ts +64 -0
  141. package/src/button/fab.styles.scss +90 -0
  142. package/src/button/fab.ts +55 -0
  143. package/src/button/icon-button.styles.scss +74 -0
  144. package/src/button/icon-button.ts +72 -0
  145. package/src/card/card-content.styles.scss +11 -0
  146. package/src/card/card-content.ts +45 -0
  147. package/src/card/card-media.styles.scss +9 -0
  148. package/src/card/card-media.ts +24 -0
  149. package/src/card/card.styles.scss +27 -0
  150. package/src/card/card.ts +37 -0
  151. package/src/checkbox/checkbox.ts +77 -0
  152. package/src/container/container.styles.scss +39 -0
  153. package/src/container/container.ts +24 -0
  154. package/src/divider/divider.styles.scss +13 -0
  155. package/src/divider/divider.ts +21 -0
  156. package/src/elevation/elevation.styles.scss +31 -0
  157. package/src/elevation/elevation.ts +17 -0
  158. package/{index.js → src/index.ts} +1 -1
  159. package/src/ripple/ripple.styles.scss +80 -0
  160. package/src/ripple/ripple.ts +150 -0
  161. package/src/shared/base.styles.scss +5 -0
  162. package/src/table/table-body.styles.scss +9 -0
  163. package/src/table/table-body.ts +21 -0
  164. package/src/table/table-cell.styles.scss +9 -0
  165. package/src/table/table-cell.ts +21 -0
  166. package/src/table/table-head.styles.scss +9 -0
  167. package/src/table/table-head.ts +21 -0
  168. package/src/table/table-header-cell.styles.scss +10 -0
  169. package/src/table/table-header-cell.ts +21 -0
  170. package/src/table/table-row.styles.scss +3 -0
  171. package/src/table/table-row.ts +21 -0
  172. package/src/table/table.styles.scss +12 -0
  173. package/{table/table.js → src/table/table.ts} +15 -6
  174. package/src/theme/color.ts +6 -0
  175. package/src/theme/css-var-builder.ts +36 -0
  176. package/{theme/index.js → src/theme/index.ts} +0 -1
  177. package/src/theme/neutral-colors.ts +21 -0
  178. package/src/theme/rgb-color.ts +19 -0
  179. package/src/theme/theme-builder.ts +201 -0
  180. package/{theme/theme-color.d.ts → src/theme/theme-color.ts} +3 -2
  181. package/tsconfig.json +36 -0
  182. package/web-dev-server.config.js +25 -0
  183. package/web-test-runner.config.js +120 -0
  184. package/button/button-base.d.ts +0 -43
  185. package/button/button-base.d.ts.map +0 -1
  186. package/button/button-base.js +0 -152
  187. package/button/button-base.js.map +0 -1
  188. package/button/button-base.styles.d.ts +0 -2
  189. package/button/button-base.styles.d.ts.map +0 -1
  190. package/button/button-base.styles.js +0 -75
  191. package/button/button-base.styles.js.map +0 -1
  192. package/button/button-set.d.ts +0 -20
  193. package/button/button-set.d.ts.map +0 -1
  194. package/button/button-set.js +0 -38
  195. package/button/button-set.js.map +0 -1
  196. package/button/button-set.styles.d.ts +0 -2
  197. package/button/button-set.styles.d.ts.map +0 -1
  198. package/button/button-set.styles.js +0 -39
  199. package/button/button-set.styles.js.map +0 -1
  200. package/button/button.d.ts +0 -34
  201. package/button/button.d.ts.map +0 -1
  202. package/button/button.js +0 -64
  203. package/button/button.js.map +0 -1
  204. package/button/button.styles.d.ts +0 -2
  205. package/button/button.styles.d.ts.map +0 -1
  206. package/button/button.styles.js +0 -94
  207. package/button/button.styles.js.map +0 -1
  208. package/button/fab.d.ts +0 -31
  209. package/button/fab.d.ts.map +0 -1
  210. package/button/fab.js +0 -63
  211. package/button/fab.js.map +0 -1
  212. package/button/fab.styles.d.ts +0 -2
  213. package/button/fab.styles.d.ts.map +0 -1
  214. package/button/fab.styles.js +0 -89
  215. package/button/fab.styles.js.map +0 -1
  216. package/button/icon-button.d.ts +0 -35
  217. package/button/icon-button.d.ts.map +0 -1
  218. package/button/icon-button.js +0 -79
  219. package/button/icon-button.js.map +0 -1
  220. package/button/icon-button.styles.d.ts +0 -2
  221. package/button/icon-button.styles.d.ts.map +0 -1
  222. package/button/icon-button.styles.js +0 -70
  223. package/button/icon-button.styles.js.map +0 -1
  224. package/card/card-content.d.ts +0 -13
  225. package/card/card-content.d.ts.map +0 -1
  226. package/card/card-content.js +0 -44
  227. package/card/card-content.js.map +0 -1
  228. package/card/card-content.styles.d.ts +0 -2
  229. package/card/card-content.styles.d.ts.map +0 -1
  230. package/card/card-content.styles.js +0 -15
  231. package/card/card-content.styles.js.map +0 -1
  232. package/card/card-media.d.ts +0 -12
  233. package/card/card-media.d.ts.map +0 -1
  234. package/card/card-media.js +0 -29
  235. package/card/card-media.js.map +0 -1
  236. package/card/card-media.styles.d.ts +0 -2
  237. package/card/card-media.styles.d.ts.map +0 -1
  238. package/card/card-media.styles.js +0 -13
  239. package/card/card-media.styles.js.map +0 -1
  240. package/card/card.d.ts +0 -19
  241. package/card/card.d.ts.map +0 -1
  242. package/card/card.js +0 -40
  243. package/card/card.js.map +0 -1
  244. package/card/card.styles.d.ts +0 -2
  245. package/card/card.styles.d.ts.map +0 -1
  246. package/card/card.styles.js +0 -28
  247. package/card/card.styles.js.map +0 -1
  248. package/checkbox/checkbox.d.ts +0 -16
  249. package/checkbox/checkbox.d.ts.map +0 -1
  250. package/checkbox/checkbox.js +0 -75
  251. package/checkbox/checkbox.js.map +0 -1
  252. package/container/container.d.ts +0 -13
  253. package/container/container.d.ts.map +0 -1
  254. package/container/container.js +0 -23
  255. package/container/container.js.map +0 -1
  256. package/container/container.styles.d.ts +0 -2
  257. package/container/container.styles.d.ts.map +0 -1
  258. package/container/container.styles.js +0 -43
  259. package/container/container.styles.js.map +0 -1
  260. package/custom-elements.json +0 -3706
  261. package/divider/divider.d.ts +0 -14
  262. package/divider/divider.d.ts.map +0 -1
  263. package/divider/divider.js +0 -27
  264. package/divider/divider.js.map +0 -1
  265. package/divider/divider.styles.d.ts +0 -2
  266. package/divider/divider.styles.d.ts.map +0 -1
  267. package/divider/divider.styles.js +0 -15
  268. package/divider/divider.styles.js.map +0 -1
  269. package/elevation/elevation.d.ts +0 -11
  270. package/elevation/elevation.d.ts.map +0 -1
  271. package/elevation/elevation.js +0 -21
  272. package/elevation/elevation.js.map +0 -1
  273. package/elevation/elevation.styles.d.ts +0 -2
  274. package/elevation/elevation.styles.d.ts.map +0 -1
  275. package/elevation/elevation.styles.js +0 -28
  276. package/elevation/elevation.styles.js.map +0 -1
  277. package/index.d.ts +0 -27
  278. package/index.d.ts.map +0 -1
  279. package/index.js.map +0 -1
  280. package/ripple/ripple.d.ts +0 -25
  281. package/ripple/ripple.d.ts.map +0 -1
  282. package/ripple/ripple.js +0 -119
  283. package/ripple/ripple.js.map +0 -1
  284. package/ripple/ripple.styles.d.ts +0 -2
  285. package/ripple/ripple.styles.d.ts.map +0 -1
  286. package/ripple/ripple.styles.js +0 -74
  287. package/ripple/ripple.styles.js.map +0 -1
  288. package/shared/base.styles.d.ts +0 -2
  289. package/shared/base.styles.d.ts.map +0 -1
  290. package/shared/base.styles.js +0 -9
  291. package/shared/base.styles.js.map +0 -1
  292. package/table/table-body.d.ts +0 -11
  293. package/table/table-body.d.ts.map +0 -1
  294. package/table/table-body.js +0 -21
  295. package/table/table-body.js.map +0 -1
  296. package/table/table-body.styles.d.ts +0 -2
  297. package/table/table-body.styles.d.ts.map +0 -1
  298. package/table/table-body.styles.js +0 -11
  299. package/table/table-body.styles.js.map +0 -1
  300. package/table/table-cell.d.ts +0 -11
  301. package/table/table-cell.d.ts.map +0 -1
  302. package/table/table-cell.js +0 -21
  303. package/table/table-cell.js.map +0 -1
  304. package/table/table-cell.styles.d.ts +0 -2
  305. package/table/table-cell.styles.d.ts.map +0 -1
  306. package/table/table-cell.styles.js +0 -11
  307. package/table/table-cell.styles.js.map +0 -1
  308. package/table/table-head.d.ts +0 -11
  309. package/table/table-head.d.ts.map +0 -1
  310. package/table/table-head.js +0 -21
  311. package/table/table-head.js.map +0 -1
  312. package/table/table-head.styles.d.ts +0 -2
  313. package/table/table-head.styles.d.ts.map +0 -1
  314. package/table/table-head.styles.js +0 -11
  315. package/table/table-head.styles.js.map +0 -1
  316. package/table/table-header-cell.d.ts +0 -11
  317. package/table/table-header-cell.d.ts.map +0 -1
  318. package/table/table-header-cell.js +0 -21
  319. package/table/table-header-cell.js.map +0 -1
  320. package/table/table-header-cell.styles.d.ts +0 -2
  321. package/table/table-header-cell.styles.d.ts.map +0 -1
  322. package/table/table-header-cell.styles.js +0 -12
  323. package/table/table-header-cell.styles.js.map +0 -1
  324. package/table/table-row.d.ts +0 -11
  325. package/table/table-row.d.ts.map +0 -1
  326. package/table/table-row.js +0 -21
  327. package/table/table-row.js.map +0 -1
  328. package/table/table-row.styles.d.ts +0 -2
  329. package/table/table-row.styles.d.ts.map +0 -1
  330. package/table/table-row.styles.js +0 -7
  331. package/table/table-row.styles.js.map +0 -1
  332. package/table/table.d.ts +0 -16
  333. package/table/table.d.ts.map +0 -1
  334. package/table/table.js.map +0 -1
  335. package/table/table.styles.d.ts +0 -2
  336. package/table/table.styles.d.ts.map +0 -1
  337. package/table/table.styles.js +0 -16
  338. package/table/table.styles.js.map +0 -1
  339. package/theme/color.d.ts +0 -7
  340. package/theme/color.d.ts.map +0 -1
  341. package/theme/color.js +0 -2
  342. package/theme/color.js.map +0 -1
  343. package/theme/css-var-builder.d.ts +0 -9
  344. package/theme/css-var-builder.d.ts.map +0 -1
  345. package/theme/css-var-builder.js +0 -25
  346. package/theme/css-var-builder.js.map +0 -1
  347. package/theme/index.d.ts +0 -2
  348. package/theme/index.d.ts.map +0 -1
  349. package/theme/index.js.map +0 -1
  350. package/theme/neutral-colors.d.ts +0 -4
  351. package/theme/neutral-colors.d.ts.map +0 -1
  352. package/theme/neutral-colors.js +0 -19
  353. package/theme/neutral-colors.js.map +0 -1
  354. package/theme/rgb-color.d.ts +0 -9
  355. package/theme/rgb-color.d.ts.map +0 -1
  356. package/theme/rgb-color.js +0 -13
  357. package/theme/rgb-color.js.map +0 -1
  358. package/theme/theme-builder.d.ts +0 -27
  359. package/theme/theme-builder.d.ts.map +0 -1
  360. package/theme/theme-builder.js +0 -146
  361. package/theme/theme-builder.js.map +0 -1
  362. package/theme/theme-color.d.ts.map +0 -1
  363. package/theme/theme-color.js +0 -2
  364. package/theme/theme-color.js.map +0 -1
package/gulpfile.js ADDED
@@ -0,0 +1,225 @@
1
+ import gulp from 'gulp';
2
+ import notify from 'gulp-notify';
3
+ import gulpPug from 'gulp-pug';
4
+ import gulpSass from 'gulp-sass';
5
+ import { encode } from 'html-entities';
6
+ import * as fs from 'node:fs';
7
+ import { rollup } from 'rollup';
8
+ import * as dartSass from 'sass';
9
+ import through2 from 'through2';
10
+ import { Project, SyntaxKind } from 'ts-morph';
11
+
12
+ import rollupConfig from './rollup.config.js';
13
+
14
+ const sass = gulpSass(dartSass);
15
+
16
+ const pugDocs = () => {
17
+ return gulp
18
+ .src(["./docs/src/**/*.pug", "!./docs/src/_*.pug"])
19
+ .pipe(gulpPug({
20
+ data: {
21
+ debug: true,
22
+ version:
23
+ "<%= pkg.version + '.' + pkg.build %>"
24
+ },
25
+ filters: {
26
+ exampleCode: text =>
27
+ `
28
+ <u-card-content>${text}</u-card-content>
29
+ <u-card-content class="example-card-code" slot="after-content">
30
+ <pre><code class="language-html">${encode(text, {level: 'html5'})}</code></pre>
31
+ </u-card-content>`,
32
+ escape: text =>
33
+ encode(text, {level: 'html5'})
34
+ },
35
+ doctype: 'html',
36
+ pretty: true
37
+ }).on("error", notify.onError(function(error) {
38
+ return "An error occurred while compiling pug.\nLook in the console for details.\n" + error;
39
+ })))
40
+ .pipe(gulp.dest("./docs/dist")); // tell gulp our output folder
41
+ }
42
+
43
+ const docsCopyJs = () =>
44
+ gulp
45
+ .src(["./dist/**/*"])
46
+ .pipe(gulp.dest('docs/dist/js'));
47
+
48
+ const docsBundle = async () => {
49
+ const bundle = await rollup(rollupConfig);
50
+ await bundle.write({
51
+ file: './docs/dist/js/index.js'
52
+ })
53
+ }
54
+
55
+ const watchDocs = () => {
56
+ gulp.watch(['./docs/src/**/*.pug', './docs/src/**/*.html'], pugDocs);
57
+ gulp.watch(['./dist/**/*'], docsCopyJs);
58
+ gulp.watch(['./src/**/*.ts', '!./src/**/*.styles.ts'], docsPugApis);
59
+ }
60
+
61
+ const docsPugApis = cb => {
62
+
63
+ console.log('Generating APIs model....');
64
+
65
+ const project = new Project();
66
+ project.addSourceFilesAtPaths('src/**/*.ts');
67
+
68
+ const apis = {};
69
+
70
+ for (const sourceFile of project.getSourceFiles()) {
71
+
72
+ if (sourceFile.getFilePath().includes('node_modules')) {
73
+ continue;
74
+ }
75
+
76
+ for (const classDeclaration of sourceFile.getClasses()) {
77
+
78
+ if (classDeclaration.isAbstract()) {
79
+ continue;
80
+ }
81
+
82
+ const classInfo = [];
83
+
84
+ setClassInfo(classDeclaration, classInfo);
85
+
86
+ if (!classInfo.length) {
87
+ continue;
88
+ }
89
+
90
+ const className = classDeclaration.getName();
91
+ const apiName = `${className[2].toLowerCase()}${className.slice(3)}`;
92
+ apis[apiName] = classInfo;
93
+ }
94
+ }
95
+
96
+ fs.writeFile('./docs/src/_apis.pug', `- var apis = ${JSON.stringify(apis)}`, err => {
97
+ if (err) {
98
+ console.error(err);
99
+ cb(err);
100
+ return;
101
+ }
102
+
103
+ cb()
104
+ console.log('Done.');
105
+ });
106
+ };
107
+
108
+ const sassToTs = () =>
109
+ gulp
110
+ .src(['./src/**/*.scss', '!./src/styles/**/*.scss'])
111
+ .pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
112
+ .pipe(through2({objectMode: true}, (file, enc, cb) => {
113
+ let content = file.contents.toString();
114
+ content = content.replaceAll(/^(.)/gm, ' $1');
115
+
116
+ const newContent = `import { css } from 'lit';
117
+
118
+ export const styles = css \`
119
+ ${content}
120
+ \`;
121
+ `
122
+
123
+ file.contents = new Buffer(newContent);
124
+ file.path = file.path.replace('.css', '.ts')
125
+ return cb(null, file);
126
+ }))
127
+ .pipe(gulp.dest('./src'));
128
+
129
+ function getAttributeName(property) {
130
+ const decorators = property.getDecorators();
131
+ const propertyDecorator = decorators.find(d => d.getName() === 'property');
132
+
133
+ if (!propertyDecorator) {
134
+ return null;
135
+ }
136
+
137
+ const optionsArgument = propertyDecorator.getArguments()[0];
138
+
139
+ if (!optionsArgument) {
140
+ return property.getName();
141
+ }
142
+
143
+ return optionsArgument.getProperty('attribute')
144
+ ?.getInitializer()
145
+ ?.getText()
146
+ ?.replaceAll(`'`, '') ?? property.getName();
147
+ }
148
+
149
+ function getJsDocsDescription(property) {
150
+ const jsDocs = property.getJsDocs()[0];
151
+
152
+ if (!jsDocs) {
153
+ return null;
154
+ }
155
+
156
+ let description = encode(jsDocs.getDescription())
157
+ .replaceAll(/`(.+?)`/g, '<code>$1</code>')
158
+ .replaceAll(/_(.+?)_/g, '<em>$1</em>')
159
+ .trimStart();
160
+
161
+ const linkTag = jsDocs
162
+ .getTags()
163
+ .find(t => t.getTagName() === 'link');
164
+
165
+ if (!linkTag) {
166
+ return description;
167
+ }
168
+
169
+ const link = linkTag.getComment().trim();
170
+
171
+ return `${description}
172
+
173
+ <a href="${link}" target="_blank">${link}</a>`;
174
+ }
175
+
176
+ function setClassInfo(classDeclaration, classInfo) {
177
+
178
+ if (!classDeclaration || classDeclaration.getSourceFile().getFilePath().includes('node_modules')) {
179
+ return;
180
+ }
181
+
182
+ for (const property of classDeclaration.getProperties().concat(classDeclaration.getGetAccessors())) {
183
+
184
+ const propertyName = property.getName();
185
+
186
+ if (property.isStatic()
187
+ || property.hasModifier(SyntaxKind.PrivateKeyword)
188
+ || property.hasModifier(SyntaxKind.ProtectedKeyword)
189
+ || propertyName.startsWith('#')) {
190
+ continue;
191
+ }
192
+
193
+ const attributeName = getAttributeName(property);
194
+
195
+ const description = getJsDocsDescription(property);
196
+ const typeText = property.getType().getText();
197
+
198
+ classInfo.push({
199
+ type: typeText.includes('|')
200
+ ? 'string'
201
+ : typeText,
202
+ attribute: attributeName,
203
+ default: property.getInitializer
204
+ ? property.getInitializer()?.getText() ?? 'undefined'
205
+ : null,
206
+ name: propertyName.startsWith('_')
207
+ ? null
208
+ : propertyName,
209
+ description: description
210
+ });
211
+ }
212
+
213
+ setClassInfo(classDeclaration.getBaseClass(), classInfo);
214
+ }
215
+
216
+ gulp.task('docs:pug:apis', docsPugApis);
217
+ gulp.task('docs:pug', pugDocs);
218
+ gulp.task('docs:js', docsCopyJs);
219
+ gulp.task('docs:bundle', docsBundle);
220
+ gulp.task('docs:watch', gulp.series(docsPugApis, gulp.parallel(pugDocs, docsCopyJs, watchDocs)));
221
+
222
+ gulp.task('sass:sass-to-ts', sassToTs);
223
+ gulp.task('sass:sass-to-ts:watch', () => gulp.watch('./src/**/*.scss', sassToTs));
224
+
225
+ gulp.task('docs', gulp.series(docsPugApis, gulp.parallel(pugDocs, docsBundle)));
package/index.html ADDED
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title>Lit Starter Kit</title>
7
+ </head>
8
+ <body>
9
+ <a href="/dev/index.html">Component Demo</a>
10
+ </body>
11
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-material/web",
3
- "version": "3.0.7",
3
+ "version": "3.0.9",
4
4
  "description": "Material web components",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+
7
+ import resolve from '@rollup/plugin-node-resolve';
8
+ import replace from '@rollup/plugin-replace';
9
+ import summary from 'rollup-plugin-summary';
10
+ import { terser } from 'rollup-plugin-terser';
11
+
12
+ export default {
13
+ input: './dist/index.js',
14
+ output: {
15
+ file: './docs/dist/js/index.js',
16
+ format: 'esm',
17
+ },
18
+ onwarn(warning) {
19
+ if (warning.code !== 'THIS_IS_UNDEFINED') {
20
+ console.error(`(!) ${warning.message}`);
21
+ }
22
+ },
23
+ plugins: [
24
+ replace({'Reflect.decorate': 'undefined'}),
25
+ resolve(),
26
+ /**
27
+ * This minification setup serves the static site generation.
28
+ * For bundling and minification, check the README.md file.
29
+ */
30
+ terser({
31
+ ecma: 2021,
32
+ module: true,
33
+ warnings: true,
34
+ mangle: {
35
+ properties: {
36
+ regex: /^__/,
37
+ },
38
+ },
39
+ }),
40
+ summary(),
41
+ ],
42
+ };
@@ -0,0 +1,20 @@
1
+ @use "sass:map";
2
+
3
+ @import "variables";
4
+
5
+ @function get-color-var($name) {
6
+ @return var(--u-color-#{$name}, map.get($colors, $name));
7
+ }
8
+
9
+ @function get-color-rgb-var($name) {
10
+ @return var(--u-color-#{$name}-rgb, map.get($rgb-colors, $name));
11
+ }
12
+
13
+
14
+ @function get-font-weight-var($name) {
15
+ @return var(--u-font-weight-#{$name}, map.get($font-weights, $name));
16
+ }
17
+
18
+ @function get-shaper-corner-var($name) {
19
+ @return var(--u-shape-corner-#{$name}, map.get($shape-corner, $name));
20
+ }
@@ -0,0 +1,68 @@
1
+ @use "sass:map";
2
+
3
+ $awesome-cubic-bezier: cubic-bezier(.19, 1, .22, 1) !default;
4
+
5
+ $rgb-colors: (
6
+ primary: unquote("103, 80, 164"),
7
+ on-primary: unquote("255, 255, 255"),
8
+ primary-container: unquote("234, 221, 255"),
9
+ on-primary-container: unquote("33, 0, 93"),
10
+ secondary: unquote("98, 91, 113"),
11
+ secondary-container: unquote("232, 222, 248"),
12
+ on-secondary-container: unquote("29, 25, 43"),
13
+ on-secondary: unquote("255, 255, 255"),
14
+ tertiary: unquote("125, 82, 96"),
15
+ on-tertiary: unquote("255, 255, 255"),
16
+ tertiary-container: unquote("255, 216, 228"),
17
+ on-tertiary-container: unquote("49, 17, 29"),
18
+ error: unquote("179, 38, 30"),
19
+ on-error: unquote("255, 255, 255"),
20
+ error-container: unquote("249, 222, 220"),
21
+ on-error-container: unquote("65, 14, 11"),
22
+ surface: unquote("254, 247, 255"),
23
+ on-surface: unquote("29, 27, 32"),
24
+ surface-variant: unquote("231, 224, 236"),
25
+ on-surface-variant: unquote("73, 69, 79"),
26
+ surface-container-highest: unquote("230, 224, 233"),
27
+ surface-container-high: unquote("236, 230, 240"),
28
+ surface-container: unquote("243, 237, 247"),
29
+ surface-container-low: unquote("247, 242, 250"),
30
+ surface-container-lowest: unquote("255, 255, 255"),
31
+ inverse-surface: unquote("50, 47, 53"),
32
+ inverse-on-surface: unquote("245, 239, 247"),
33
+ outline: unquote("121, 116, 126"),
34
+ outline-variant: unquote("202, 196, 208"),
35
+ shadow: unquote("0, 0, 0")
36
+ );
37
+
38
+ $colors: ();
39
+
40
+ @each $name, $value in $rgb-colors {
41
+ $colors: map.set($colors, $name, unquote("rgb(#{$value})"));
42
+ }
43
+
44
+ $spacings: (
45
+ var(sm, 8px),
46
+ var(md, 16px),
47
+ var(lg, 24px),
48
+ var(xl, 40px),
49
+ );
50
+
51
+ $font-weights: (
52
+ thin: 100,
53
+ light: 300,
54
+ regular: 400,
55
+ medium: 500,
56
+ bold: 700,
57
+ bolder: 900,
58
+ );
59
+
60
+ $shape-corner: (
61
+ none: 0,
62
+ extra-small: 4px,
63
+ small: 8px,
64
+ medium: 12px,
65
+ large: 16px,
66
+ extra-large: 28px,
67
+ full: 9999px
68
+ );
@@ -0,0 +1,75 @@
1
+ @import '../utils';
2
+
3
+ :host {
4
+ --_color-primary: #{get-color-var(primary)};
5
+
6
+ -webkit-tap-highlight-color: transparent;
7
+
8
+ display: inline-flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ vertical-align: baseline;
12
+ position: relative;
13
+ white-space: nowrap;
14
+ font-family: var(--u-font-family-base, system-ui);
15
+ transition: color 150ms ease-in-out, background-color 150ms ease-in-out;
16
+ }
17
+
18
+ :host([disabled]) {
19
+ --u-elevation-level: 0 !important;
20
+ background-color: var(--u-button-disabled-background-color, rgba(#{get-color-rgb-var(on-surface)}, .12)) !important;
21
+ color: var(--u-button-disabled-text-color, rgba(#{get-color-rgb-var(on-surface)}, .38)) !important;
22
+ }
23
+
24
+ :host([disabled]) .button {
25
+ cursor: default;
26
+ }
27
+
28
+ * {
29
+ color: inherit;
30
+ }
31
+
32
+ u-elevation {
33
+ z-index: -1;
34
+ }
35
+
36
+ .button {
37
+ cursor: pointer;
38
+ position: absolute;
39
+ inset: 0;
40
+ font-family: inherit;
41
+ border-radius: inherit;
42
+ color: inherit;
43
+ border: none;
44
+ margin: 0;
45
+ padding: 0;
46
+ text-align: center;
47
+ white-space: nowrap;
48
+ background: transparent;
49
+ user-select: none;
50
+ text-decoration: none;
51
+ outline: 0;
52
+ z-index: 0;
53
+ }
54
+
55
+ .button:focus-visible {
56
+ animation: offset-pulse 400ms ease;
57
+ animation-fill-mode: forwards;
58
+ outline-offset: 2px;
59
+ }
60
+
61
+ ::slotted([slot=icon]) {
62
+ display: inline-block;
63
+ }
64
+
65
+ @keyframes offset-pulse {
66
+ 0% {
67
+ outline: 4px solid var(--_color-primary);
68
+ }
69
+ 50% {
70
+ outline: 8px solid var(--_color-primary);
71
+ }
72
+ 100% {
73
+ outline: 4px solid var(--_color-primary);
74
+ }
75
+ }
@@ -0,0 +1,147 @@
1
+ import { html, HTMLTemplateResult, LitElement, nothing } from 'lit';
2
+ import { property, query } from 'lit/decorators.js';
3
+
4
+ import '../elevation/elevation.js';
5
+ import '../ripple/ripple.js';
6
+ import { UmRipple } from '../ripple/ripple';
7
+
8
+ export abstract class UmButtonBase extends LitElement {
9
+
10
+ static readonly formAssociated = true;
11
+
12
+ /**
13
+ * Whether the button is disabled or not.
14
+ */
15
+ @property({type: Boolean, reflect: true}) disabled = false;
16
+
17
+ /**
18
+ * The URL that the link button points to.
19
+ */
20
+ @property() href = '';
21
+
22
+ /**
23
+ * Where to display the linked `href` URL for a link button. Common options
24
+ * include `_blank` to open in a new tab.
25
+ */
26
+ @property() target: string = '';
27
+
28
+ @property() type: string = 'submit';
29
+
30
+ @property({reflect: true}) value: string = '';
31
+ @property() name: string | undefined;
32
+
33
+ @query('.button') private readonly buttonElement!: HTMLElement;
34
+ @query('u-ripple') private readonly ripple!: UmRipple;
35
+
36
+ /**
37
+ * The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)
38
+ * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form
39
+ */
40
+ @property()
41
+ get form(): HTMLFormElement | null {
42
+ return this.#elementInternals.form;
43
+ }
44
+
45
+ readonly #elementInternals: ElementInternals;
46
+
47
+ constructor() {
48
+ super();
49
+ this.#elementInternals = this.attachInternals();
50
+ }
51
+
52
+ protected override render() {
53
+ return this.href
54
+ ? this.renderLink()
55
+ : this.renderButton();
56
+ }
57
+
58
+ private renderButton() {
59
+
60
+ return html`
61
+ <button
62
+ id="button"
63
+ class="button"
64
+ ?disabled=${this.disabled}
65
+ aria-label="${this.getAriaLabel()}"
66
+ type="button">
67
+ <u-ripple ?disabled=${this.disabled}></u-ripple>
68
+ <u-elevation></u-elevation>
69
+ </button>
70
+ ${this.renderContent()}`;
71
+ }
72
+
73
+ private renderLink() {
74
+
75
+ return html`<a
76
+ id="link"
77
+ class="button"
78
+ href=${this.disabled ? nothing : this.href}
79
+ aria-disabled=${this.disabled || nothing}
80
+ aria-label="${this.getAriaLabel()}"
81
+ target=${this.target || nothing}>
82
+ <u-elevation></u-elevation>
83
+ <u-ripple ?disabled=${this.disabled}></u-ripple>
84
+ </a>
85
+ ${this.renderContent()}`;
86
+ }
87
+
88
+ protected abstract renderContent(): HTMLTemplateResult;
89
+
90
+ override connectedCallback() {
91
+ super.connectedCallback();
92
+
93
+ this.addEventListener('click', this.innerHandleClick);
94
+ }
95
+
96
+ override disconnectedCallback() {
97
+ super.disconnectedCallback();
98
+
99
+ this.removeEventListener('click', this.innerHandleClick);
100
+ }
101
+
102
+ override focus() {
103
+ this.buttonElement?.focus();
104
+ }
105
+
106
+ override blur() {
107
+ this.buttonElement?.blur();
108
+ }
109
+
110
+ protected getAriaLabel(): string | null | typeof nothing {
111
+ return this.ariaLabel || nothing;
112
+ }
113
+
114
+ private innerHandleClick(event: UIEvent): void {
115
+
116
+ if (this.disabled) {
117
+ return;
118
+ }
119
+
120
+ if (event.detail === 0) {
121
+ this.ripple.createRipple();
122
+ }
123
+
124
+ this.handleClick(event);
125
+
126
+ if (this.type === 'button' || !!this.href) {
127
+ return;
128
+ }
129
+
130
+ if (!this.form) {
131
+ return;
132
+ }
133
+
134
+ this.#elementInternals.setFormValue(this.value);
135
+
136
+ if (this.type === 'submit') {
137
+ this.form.requestSubmit();
138
+ return;
139
+ }
140
+
141
+ this.form.reset();
142
+ }
143
+
144
+ protected handleClick(_: UIEvent): void {
145
+
146
+ }
147
+ }
@@ -0,0 +1,35 @@
1
+ :host {
2
+ display: flex;
3
+ gap: 8px;
4
+ align-items: center;
5
+ flex-wrap: wrap;
6
+ }
7
+
8
+ :host([align=start]) {
9
+ justify-content: flex-start;
10
+ }
11
+
12
+ :host([align=center]) {
13
+ justify-content: center;
14
+ }
15
+
16
+ :host([align=end]) {
17
+ justify-content: flex-end;
18
+ }
19
+
20
+ :host([stack][align=start]) {
21
+ align-items: flex-start;
22
+ }
23
+
24
+ :host([stack][align=center]) {
25
+ align-items: center;
26
+ }
27
+
28
+ :host([stack][align=end]) {
29
+ align-items: flex-end;
30
+ }
31
+
32
+ :host([stack]) {
33
+ flex-direction: column;
34
+ justify-content: flex-start;
35
+ }
@@ -0,0 +1,33 @@
1
+ import { html, HTMLTemplateResult, LitElement } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ import { styles } from './button-set.styles';
5
+
6
+ export type UmButtonSetAlignment = 'start' | 'center' | 'end';
7
+
8
+ @customElement('u-button-set')
9
+ export class UmButtonSet extends LitElement {
10
+
11
+ static override styles = styles;
12
+
13
+ /**
14
+ * Set the alignment of the buttons at the `start`, `center` or at the `end`.
15
+ */
16
+ @property({reflect: true}) align: UmButtonSetAlignment = 'end';
17
+
18
+ /**
19
+ * Whether to render the buttons stacked or not
20
+ */
21
+ @property({type: Boolean, reflect: true}) stack = false;
22
+
23
+ override render(): HTMLTemplateResult {
24
+ return html`
25
+ <slot></slot>`;
26
+ }
27
+ }
28
+
29
+ declare global {
30
+ interface HTMLElementTagNameMap {
31
+ 'u-button-set': UmButtonSet;
32
+ }
33
+ }