mdui 2.0.5 → 2.1.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 (249) hide show
  1. package/components/avatar/index.js +2 -7
  2. package/components/avatar/style.js +1 -31
  3. package/components/badge/style.js +1 -25
  4. package/components/bottom-app-bar/style.js +1 -92
  5. package/components/button/button-base-style.js +1 -28
  6. package/components/button/button-base.js +1 -8
  7. package/components/button/index.js +8 -18
  8. package/components/button/style.js +2 -111
  9. package/components/button-icon/index.js +5 -22
  10. package/components/button-icon/style.js +2 -103
  11. package/components/card/index.js +1 -5
  12. package/components/card/style.js +1 -72
  13. package/components/checkbox/index.js +7 -50
  14. package/components/checkbox/style.js +1 -131
  15. package/components/chip/index.js +9 -33
  16. package/components/chip/style.js +2 -205
  17. package/components/circular-progress/index.js +5 -39
  18. package/components/circular-progress/style.js +1 -136
  19. package/components/collapse/collapse-item-style.js +1 -21
  20. package/components/collapse/collapse-item.js +2 -10
  21. package/components/collapse/collapse-style.js +1 -5
  22. package/components/collapse/collapse.js +1 -4
  23. package/components/dialog/index.js +10 -35
  24. package/components/dialog/style.js +1 -116
  25. package/components/divider/style.js +1 -18
  26. package/components/dropdown/index.js +1 -8
  27. package/components/dropdown/style.js +1 -11
  28. package/components/fab/index.js +5 -13
  29. package/components/fab/style.js +4 -153
  30. package/components/icon/index.js +1 -5
  31. package/components/icon/style.js +1 -29
  32. package/components/layout/layout-item-style.js +1 -6
  33. package/components/layout/layout-main-style.js +1 -7
  34. package/components/layout/layout-style.js +1 -11
  35. package/components/linear-progress/index.js +2 -6
  36. package/components/linear-progress/style.js +1 -73
  37. package/components/list/list-item-style.js +2 -153
  38. package/components/list/list-item.js +8 -27
  39. package/components/list/list-style.js +1 -10
  40. package/components/list/list-subheader-style.js +1 -19
  41. package/components/menu/menu-item-style.js +1 -125
  42. package/components/menu/menu-item.js +13 -55
  43. package/components/menu/menu-style.js +1 -19
  44. package/components/menu/menu.js +1 -5
  45. package/components/navigation-bar/navigation-bar-item-style.js +1 -132
  46. package/components/navigation-bar/navigation-bar-item.js +7 -23
  47. package/components/navigation-bar/navigation-bar-style.js +1 -28
  48. package/components/navigation-bar/navigation-bar.js +1 -4
  49. package/components/navigation-drawer/index.js +1 -12
  50. package/components/navigation-drawer/style.js +1 -66
  51. package/components/navigation-rail/navigation-rail-item-style.js +1 -122
  52. package/components/navigation-rail/navigation-rail-item.js +7 -26
  53. package/components/navigation-rail/navigation-rail-style.js +1 -79
  54. package/components/navigation-rail/navigation-rail.js +1 -10
  55. package/components/radio/radio-group-style.js +1 -20
  56. package/components/radio/radio-group.js +1 -19
  57. package/components/radio/radio-style.js +1 -107
  58. package/components/radio/radio.js +5 -23
  59. package/components/range-slider/index.d.ts +1 -1
  60. package/components/range-slider/index.js +5 -53
  61. package/components/ripple/index.js +2 -5
  62. package/components/ripple/style.js +1 -96
  63. package/components/segmented-button/segmented-button-group-style.js +1 -28
  64. package/components/segmented-button/segmented-button-group.js +1 -21
  65. package/components/segmented-button/segmented-button-style.js +2 -81
  66. package/components/segmented-button/segmented-button.js +11 -27
  67. package/components/select/index.d.ts +18 -0
  68. package/components/select/index.js +42 -87
  69. package/components/select/style.js +1 -27
  70. package/components/slider/index.js +2 -33
  71. package/components/slider/slider-base-style.js +1 -173
  72. package/components/slider/slider-base.js +1 -6
  73. package/components/slider/style.js +1 -7
  74. package/components/snackbar/index.js +5 -32
  75. package/components/snackbar/style.js +1 -100
  76. package/components/switch/index.js +6 -40
  77. package/components/switch/style.js +1 -202
  78. package/components/tabs/tab-panel-style.js +1 -10
  79. package/components/tabs/tab-style.js +1 -85
  80. package/components/tabs/tab.js +4 -24
  81. package/components/tabs/tabs-style.js +1 -138
  82. package/components/tabs/tabs.js +1 -9
  83. package/components/text-field/index.d.ts +2 -0
  84. package/components/text-field/index.js +58 -163
  85. package/components/text-field/style.js +1 -362
  86. package/components/tooltip/index.js +1 -10
  87. package/components/tooltip/style.js +1 -57
  88. package/components/top-app-bar/top-app-bar-style.js +1 -78
  89. package/components/top-app-bar/top-app-bar-title-style.js +1 -81
  90. package/components/top-app-bar/top-app-bar-title.js +3 -17
  91. package/custom-elements.json +1194 -1099
  92. package/functions/alert.d.ts +2 -0
  93. package/functions/alert.js +19 -4
  94. package/functions/confirm.d.ts +4 -0
  95. package/functions/confirm.js +33 -6
  96. package/functions/getLocale.d.ts +6 -0
  97. package/functions/getLocale.js +11 -0
  98. package/functions/getTheme.d.ts +1 -1
  99. package/functions/loadLocale.d.ts +6 -0
  100. package/functions/loadLocale.js +8 -0
  101. package/functions/prompt.d.ts +4 -0
  102. package/functions/prompt.js +35 -8
  103. package/functions/removeColorScheme.js +1 -1
  104. package/functions/setColorScheme.d.ts +1 -1
  105. package/functions/setColorScheme.js +1 -1
  106. package/functions/setLocale.d.ts +6 -0
  107. package/functions/setLocale.js +11 -0
  108. package/functions/setTheme.d.ts +1 -1
  109. package/internal/localeCodes.d.ts +13 -0
  110. package/internal/localeCodes.js +144 -0
  111. package/internal/localize.d.ts +32 -0
  112. package/internal/localize.js +55 -0
  113. package/locales/ar-eg.d.ts +8 -0
  114. package/locales/ar-eg.js +12 -0
  115. package/locales/az-az.d.ts +8 -0
  116. package/locales/az-az.js +12 -0
  117. package/locales/be-by.d.ts +8 -0
  118. package/locales/be-by.js +12 -0
  119. package/locales/bg-bg.d.ts +8 -0
  120. package/locales/bg-bg.js +12 -0
  121. package/locales/bn-bd.d.ts +8 -0
  122. package/locales/bn-bd.js +12 -0
  123. package/locales/ca-es.d.ts +8 -0
  124. package/locales/ca-es.js +12 -0
  125. package/locales/cs-cz.d.ts +8 -0
  126. package/locales/cs-cz.js +12 -0
  127. package/locales/da-dk.d.ts +8 -0
  128. package/locales/da-dk.js +12 -0
  129. package/locales/de-de.d.ts +8 -0
  130. package/locales/de-de.js +12 -0
  131. package/locales/el-gr.d.ts +8 -0
  132. package/locales/el-gr.js +12 -0
  133. package/locales/en-gb.d.ts +8 -0
  134. package/locales/en-gb.js +12 -0
  135. package/locales/es-es.d.ts +8 -0
  136. package/locales/es-es.js +12 -0
  137. package/locales/et-ee.d.ts +8 -0
  138. package/locales/et-ee.js +12 -0
  139. package/locales/fa-ir.d.ts +8 -0
  140. package/locales/fa-ir.js +12 -0
  141. package/locales/fi-fi.d.ts +8 -0
  142. package/locales/fi-fi.js +12 -0
  143. package/locales/fr-be.d.ts +8 -0
  144. package/locales/fr-be.js +12 -0
  145. package/locales/fr-ca.d.ts +8 -0
  146. package/locales/fr-ca.js +12 -0
  147. package/locales/fr-fr.d.ts +8 -0
  148. package/locales/fr-fr.js +12 -0
  149. package/locales/ga-ie.d.ts +8 -0
  150. package/locales/ga-ie.js +12 -0
  151. package/locales/gl-es.d.ts +8 -0
  152. package/locales/gl-es.js +12 -0
  153. package/locales/he-il.d.ts +8 -0
  154. package/locales/he-il.js +12 -0
  155. package/locales/hi-in.d.ts +8 -0
  156. package/locales/hi-in.js +12 -0
  157. package/locales/hr-hr.d.ts +8 -0
  158. package/locales/hr-hr.js +12 -0
  159. package/locales/hu-hu.d.ts +8 -0
  160. package/locales/hu-hu.js +12 -0
  161. package/locales/hy-am.d.ts +8 -0
  162. package/locales/hy-am.js +12 -0
  163. package/locales/id-id.d.ts +8 -0
  164. package/locales/id-id.js +12 -0
  165. package/locales/is-is.d.ts +8 -0
  166. package/locales/is-is.js +12 -0
  167. package/locales/it-it.d.ts +8 -0
  168. package/locales/it-it.js +12 -0
  169. package/locales/ja-jp.d.ts +8 -0
  170. package/locales/ja-jp.js +12 -0
  171. package/locales/ka-ge.d.ts +8 -0
  172. package/locales/ka-ge.js +12 -0
  173. package/locales/kk-kz.d.ts +8 -0
  174. package/locales/kk-kz.js +12 -0
  175. package/locales/km-kh.d.ts +8 -0
  176. package/locales/km-kh.js +12 -0
  177. package/locales/kmr-iq.d.ts +8 -0
  178. package/locales/kmr-iq.js +12 -0
  179. package/locales/kn-in.d.ts +8 -0
  180. package/locales/kn-in.js +12 -0
  181. package/locales/ko-kr.d.ts +8 -0
  182. package/locales/ko-kr.js +12 -0
  183. package/locales/lt-lt.d.ts +8 -0
  184. package/locales/lt-lt.js +12 -0
  185. package/locales/lv-lv.d.ts +8 -0
  186. package/locales/lv-lv.js +12 -0
  187. package/locales/mk-mk.d.ts +8 -0
  188. package/locales/mk-mk.js +12 -0
  189. package/locales/ml-in.d.ts +8 -0
  190. package/locales/ml-in.js +12 -0
  191. package/locales/mn-mn.d.ts +8 -0
  192. package/locales/mn-mn.js +12 -0
  193. package/locales/ms-my.d.ts +8 -0
  194. package/locales/ms-my.js +12 -0
  195. package/locales/nb-no.d.ts +8 -0
  196. package/locales/nb-no.js +12 -0
  197. package/locales/ne-np.d.ts +8 -0
  198. package/locales/ne-np.js +12 -0
  199. package/locales/nl-be.d.ts +8 -0
  200. package/locales/nl-be.js +12 -0
  201. package/locales/nl-nl.d.ts +8 -0
  202. package/locales/nl-nl.js +12 -0
  203. package/locales/pl-pl.d.ts +8 -0
  204. package/locales/pl-pl.js +12 -0
  205. package/locales/pt-br.d.ts +8 -0
  206. package/locales/pt-br.js +12 -0
  207. package/locales/pt-pt.d.ts +8 -0
  208. package/locales/pt-pt.js +12 -0
  209. package/locales/ro-ro.d.ts +8 -0
  210. package/locales/ro-ro.js +12 -0
  211. package/locales/ru-ru.d.ts +8 -0
  212. package/locales/ru-ru.js +12 -0
  213. package/locales/sk-sk.d.ts +8 -0
  214. package/locales/sk-sk.js +12 -0
  215. package/locales/sl-si.d.ts +8 -0
  216. package/locales/sl-si.js +12 -0
  217. package/locales/sr-rs.d.ts +8 -0
  218. package/locales/sr-rs.js +12 -0
  219. package/locales/sv-se.d.ts +8 -0
  220. package/locales/sv-se.js +12 -0
  221. package/locales/ta-in.d.ts +8 -0
  222. package/locales/ta-in.js +12 -0
  223. package/locales/th-th.d.ts +8 -0
  224. package/locales/th-th.js +12 -0
  225. package/locales/tr-tr.d.ts +8 -0
  226. package/locales/tr-tr.js +12 -0
  227. package/locales/uk-ua.d.ts +8 -0
  228. package/locales/uk-ua.js +12 -0
  229. package/locales/ur-pk.d.ts +8 -0
  230. package/locales/ur-pk.js +12 -0
  231. package/locales/vi-vn.d.ts +8 -0
  232. package/locales/vi-vn.js +12 -0
  233. package/locales/zh-cn.d.ts +8 -0
  234. package/locales/zh-cn.js +12 -0
  235. package/locales/zh-hk.d.ts +8 -0
  236. package/locales/zh-hk.js +12 -0
  237. package/locales/zh-tw.d.ts +8 -0
  238. package/locales/zh-tw.js +12 -0
  239. package/mdui.d.ts +5 -0
  240. package/mdui.esm.js +22 -0
  241. package/mdui.global.js +22 -0
  242. package/mdui.js +3 -0
  243. package/package.json +9 -6
  244. package/web-types.en.json +91 -1
  245. package/web-types.zh-cn.json +91 -1
  246. /package/{functions/utils → internal}/colorScheme.d.ts +0 -0
  247. /package/{functions/utils → internal}/colorScheme.js +0 -0
  248. /package/{functions/utils → internal}/theme.d.ts +0 -0
  249. /package/{functions/utils → internal}/theme.js +0 -0
@@ -1,137 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const style = css `
3
- :host {
4
- position: relative;
5
- display: inline-block;
6
- width: 2.5rem;
7
- height: 2.5rem;
8
- stroke: rgb(var(--mdui-color-primary));
9
- }
10
- .progress {
11
- position: relative;
12
- display: inline-block;
13
- width: 100%;
14
- height: 100%;
15
- text-align: left;
16
- transition: opacity var(--mdui-motion-duration-medium1)
17
- var(--mdui-motion-easing-linear);
18
- }
19
- .determinate svg {
20
- transform: rotate(-90deg);
21
- fill: transparent;
22
- }
23
- .determinate .track {
24
- stroke: transparent;
25
- }
26
- .determinate .circle {
27
- stroke: inherit;
28
- transition: stroke-dashoffset var(--mdui-motion-duration-long2)
29
- var(--mdui-motion-easing-standard);
30
- }
31
- .indeterminate {
32
- font-size: 0;
33
- letter-spacing: 0;
34
- white-space: nowrap;
35
- animation: mdui-comp-circular-progress-rotate 1568ms
36
- var(--mdui-motion-easing-linear) infinite;
37
- }
38
- .indeterminate .layer,
39
- .indeterminate .circle {
40
- position: absolute;
41
- width: 100%;
42
- height: 100%;
43
- }
44
- .indeterminate .layer {
45
- animation: mdui-comp-circular-progress-layer-rotate 5332ms
46
- var(--mdui-motion-easing-standard) infinite both;
47
- }
48
- .indeterminate .circle {
49
- fill: transparent;
50
- stroke: inherit;
51
- }
52
- .indeterminate .gap-patch {
53
- position: absolute;
54
- top: 0;
55
- left: 47.5%;
56
- width: 5%;
57
- height: 100%;
58
- overflow: hidden;
59
- }
60
- .indeterminate .gap-patch .circle {
61
- left: -900%;
62
- width: 2000%;
63
- transform: rotate(180deg);
64
- }
65
- .indeterminate .clipper {
66
- position: relative;
67
- display: inline-block;
68
- width: 50%;
69
- height: 100%;
70
- overflow: hidden;
71
- }
72
- .indeterminate .clipper .circle {
73
- width: 200%;
74
- }
75
- .indeterminate .clipper.left .circle {
76
- animation: mdui-comp-circular-progress-left-spin 1333ms
77
- var(--mdui-motion-easing-standard) infinite both;
78
- }
79
- .indeterminate .clipper.right .circle {
80
- left: -100%;
81
- animation: mdui-comp-circular-progress-right-spin 1333ms
82
- var(--mdui-motion-easing-standard) infinite both;
83
- }
84
- @keyframes mdui-comp-circular-progress-rotate {
85
- to {
86
- transform: rotate(360deg);
87
- }
88
- }
89
- @keyframes mdui-comp-circular-progress-layer-rotate {
90
- 12.5% {
91
- transform: rotate(135deg);
92
- }
93
- 25% {
94
- transform: rotate(270deg);
95
- }
96
- 37.5% {
97
- transform: rotate(405deg);
98
- }
99
- 50% {
100
- transform: rotate(540deg);
101
- }
102
- 62.5% {
103
- transform: rotate(675deg);
104
- }
105
- 75% {
106
- transform: rotate(810deg);
107
- }
108
- 87.5% {
109
- transform: rotate(945deg);
110
- }
111
- 100% {
112
- transform: rotate(1080deg);
113
- }
114
- }
115
- @keyframes mdui-comp-circular-progress-left-spin {
116
- 0% {
117
- transform: rotate(265deg);
118
- }
119
- 50% {
120
- transform: rotate(130deg);
121
- }
122
- 100% {
123
- transform: rotate(265deg);
124
- }
125
- }
126
- @keyframes mdui-comp-circular-progress-right-spin {
127
- 0% {
128
- transform: rotate(-265deg);
129
- }
130
- 50% {
131
- transform: rotate(-130deg);
132
- }
133
- 100% {
134
- transform: rotate(-265deg);
135
- }
136
- }
137
- `;
2
+ export const style = css `:host{position:relative;display:inline-block;width:2.5rem;height:2.5rem;stroke:rgb(var(--mdui-color-primary))}.progress{position:relative;display:inline-block;width:100%;height:100%;text-align:left;transition:opacity var(--mdui-motion-duration-medium1) var(--mdui-motion-easing-linear)}.determinate svg{transform:rotate(-90deg);fill:transparent}.determinate .track{stroke:transparent}.determinate .circle{stroke:inherit;transition:stroke-dashoffset var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate{font-size:0;letter-spacing:0;white-space:nowrap;animation:mdui-comp-circular-progress-rotate 1568ms var(--mdui-motion-easing-linear) infinite}.indeterminate .circle,.indeterminate .layer{position:absolute;width:100%;height:100%}.indeterminate .layer{animation:mdui-comp-circular-progress-layer-rotate 5332ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .circle{fill:transparent;stroke:inherit}.indeterminate .gap-patch{position:absolute;top:0;left:47.5%;width:5%;height:100%;overflow:hidden}.indeterminate .gap-patch .circle{left:-900%;width:2000%;transform:rotate(180deg)}.indeterminate .clipper{position:relative;display:inline-block;width:50%;height:100%;overflow:hidden}.indeterminate .clipper .circle{width:200%}.indeterminate .clipper.left .circle{animation:mdui-comp-circular-progress-left-spin 1333ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .clipper.right .circle{left:-100%;animation:mdui-comp-circular-progress-right-spin 1333ms var(--mdui-motion-easing-standard) infinite both}@keyframes mdui-comp-circular-progress-rotate{to{transform:rotate(360deg)}}@keyframes mdui-comp-circular-progress-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdui-comp-circular-progress-left-spin{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes mdui-comp-circular-progress-right-spin{0%{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}100%{transform:rotate(-265deg)}}`;
@@ -1,22 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const collapseItemStyle = css `
3
- :host {
4
- display: flex;
5
- flex-direction: column;
6
- }
7
- .header {
8
- display: block;
9
- }
10
- .body {
11
- display: block;
12
- overflow: hidden;
13
- transition: height var(--mdui-motion-duration-short4)
14
- var(--mdui-motion-easing-emphasized);
15
- }
16
- .body.opened {
17
- overflow: visible;
18
- }
19
- .body.active {
20
- transition-duration: var(--mdui-motion-duration-medium4);
21
- }
22
- `;
2
+ export const collapseItemStyle = css `:host{display:flex;flex-direction:column}.header{display:block}.body{display:block;overflow:hidden;transition:height var(--mdui-motion-duration-short4) var(--mdui-motion-easing-emphasized)}.body.opened{overflow:visible}.body.active{transition-duration:var(--mdui-motion-duration-medium4)}`;
@@ -68,18 +68,10 @@ let CollapseItem = class CollapseItem extends MduiElement {
68
68
  this.updateBodyHeight();
69
69
  }
70
70
  render() {
71
- return html `<slot name="header" part="header" class="header">
72
- ${this.header}
73
- </slot>
74
- <slot
75
- part="body"
76
- class="body ${classMap({
71
+ return html `<slot name="header" part="header" class="header">${this.header}</slot><slot part="body" class="body ${classMap({
77
72
  opened: this.state === 'opened',
78
73
  active: this.active,
79
- })}"
80
- ${ref(this.bodyRef)}
81
- @transitionend=${this.onTransitionEnd}
82
- ></slot>`;
74
+ })}" ${ref(this.bodyRef)} @transitionend="${this.onTransitionEnd}"></slot>`;
83
75
  }
84
76
  onTransitionEnd(event) {
85
77
  if (event.target === this.bodyRef.value) {
@@ -1,6 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const collapseStyle = css `
3
- :host {
4
- display: block;
5
- }
6
- `;
2
+ export const collapseStyle = css `:host{display:block}`;
@@ -85,10 +85,7 @@ let Collapse = class Collapse extends MduiElement {
85
85
  this.updateItems();
86
86
  }
87
87
  render() {
88
- return html `<slot
89
- @slotchange=${this.onSlotChange}
90
- @click=${this.onClick}
91
- ></slot>`;
88
+ return html `<slot @slotchange="${this.onSlotChange}" @click="${this.onClick}"></slot>`;
92
89
  }
93
90
  setActiveKeys(activeKeys) {
94
91
  if (!arraysEqualIgnoreOrder(this.activeKeys, activeKeys)) {
@@ -15,6 +15,7 @@ import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
15
15
  import { lockScreen, unlockScreen } from '@mdui/shared/helpers/scroll.js';
16
16
  import { nothingTemplate } from '@mdui/shared/helpers/template.js';
17
17
  import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
18
+ import { offLocaleReady } from '../../internal/localize.js';
18
19
  import '../icon.js';
19
20
  import { style } from './style.js';
20
21
  /**
@@ -199,6 +200,8 @@ let Dialog = class Dialog extends MduiElement {
199
200
  disconnectedCallback() {
200
201
  super.disconnectedCallback();
201
202
  unlockScreen(this);
203
+ // alert, confirm, prompt 函数支持 localize。这里确保在组件销毁时,取消监听 localize ready 事件
204
+ offLocaleReady(this);
202
205
  }
203
206
  firstUpdated(_changedProperties) {
204
207
  super.firstUpdated(_changedProperties);
@@ -218,33 +221,11 @@ let Dialog = class Dialog extends MduiElement {
218
221
  const hasDescription = !!this.description || this.hasSlotController.test('description');
219
222
  const hasHeader = hasIcon || hasHeadline || this.hasSlotController.test('header');
220
223
  const hasBody = hasDescription || hasDefaultSlot;
221
- return html `<div
222
- ${ref(this.overlayRef)}
223
- part="overlay"
224
- class="overlay"
225
- @click=${this.onOverlayClick}
226
- tabindex="-1"
227
- ></div>
228
- <div
229
- ${ref(this.panelRef)}
230
- part="panel"
231
- class="panel ${classMap({
224
+ return html `<div ${ref(this.overlayRef)} part="overlay" class="overlay" @click="${this.onOverlayClick}" tabindex="-1"></div><div ${ref(this.panelRef)} part="panel" class="panel ${classMap({
232
225
  'has-icon': hasIcon,
233
226
  'has-description': hasDescription,
234
227
  'has-default': hasDefaultSlot,
235
- })}"
236
- tabindex="0"
237
- >
238
- ${when(hasHeader, () => html `<slot name="header" part="header" class="header">
239
- ${when(hasIcon, () => this.renderIcon())}
240
- ${when(hasHeadline, () => this.renderHeadline())}
241
- </slot>`)}
242
- ${when(hasBody, () => html `<div ${ref(this.bodyRef)} part="body" class="body">
243
- ${when(hasDescription, () => this.renderDescription())}
244
- <slot></slot>
245
- </div>`)}
246
- ${when(hasActionSlot, () => html `<slot name="action" part="action" class="action"></slot>`)}
247
- </div>`;
228
+ })}" tabindex="0">${when(hasHeader, () => html `<slot name="header" part="header" class="header">${when(hasIcon, () => this.renderIcon())} ${when(hasHeadline, () => this.renderHeadline())}</slot>`)} ${when(hasBody, () => html `<div ${ref(this.bodyRef)} part="body" class="body">${when(hasDescription, () => this.renderDescription())}<slot></slot></div>`)} ${when(hasActionSlot, () => html `<slot name="action" part="action" class="action"></slot>`)}</div>`;
248
229
  }
249
230
  onOverlayClick() {
250
231
  this.emit('overlay-click');
@@ -254,21 +235,15 @@ let Dialog = class Dialog extends MduiElement {
254
235
  this.open = false;
255
236
  }
256
237
  renderIcon() {
257
- return html `<slot name="icon" part="icon" class="icon">
258
- ${this.icon
259
- ? html `<mdui-icon name=${this.icon}></mdui-icon>`
260
- : nothingTemplate}
261
- </slot>`;
238
+ return html `<slot name="icon" part="icon" class="icon">${this.icon
239
+ ? html `<mdui-icon name="${this.icon}"></mdui-icon>`
240
+ : nothingTemplate}</slot>`;
262
241
  }
263
242
  renderHeadline() {
264
- return html `<slot name="headline" part="headline" class="headline">
265
- ${this.headline}
266
- </slot>`;
243
+ return html `<slot name="headline" part="headline" class="headline">${this.headline}</slot>`;
267
244
  }
268
245
  renderDescription() {
269
- return html `<slot name="description" part="description" class="description">
270
- ${this.description}
271
- </slot>`;
246
+ return html `<slot name="description" part="description" class="description">${this.description}</slot>`;
272
247
  }
273
248
  };
274
249
  Dialog.styles = [componentStyle, style];
@@ -1,117 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const style = css `
3
- :host {
4
- --shape-corner: var(--mdui-shape-corner-extra-large);
5
- --z-index: 2300;
6
- position: fixed;
7
- z-index: var(--z-index);
8
- display: none;
9
- align-items: center;
10
- justify-content: center;
11
- inset: 0;
12
- padding: 3rem;
13
- }
14
- ::slotted(mdui-top-app-bar[slot='header']) {
15
- position: absolute;
16
- border-top-left-radius: var(--mdui-shape-corner-extra-large);
17
- border-top-right-radius: var(--mdui-shape-corner-extra-large);
18
- background-color: rgb(var(--mdui-color-surface-container-high));
19
- }
20
- :host([fullscreen]) {
21
- --shape-corner: var(--mdui-shape-corner-none);
22
- padding: 0;
23
- }
24
- :host([fullscreen]) ::slotted(mdui-top-app-bar[slot='header']) {
25
- border-top-left-radius: var(--mdui-shape-corner-none);
26
- border-top-right-radius: var(--mdui-shape-corner-none);
27
- }
28
- .overlay {
29
- position: fixed;
30
- inset: 0;
31
- background-color: rgba(var(--mdui-color-scrim), 0.4);
32
- }
33
- .panel {
34
- position: relative;
35
- display: flex;
36
- flex-direction: column;
37
- max-height: 100%;
38
- border-radius: var(--shape-corner);
39
- outline: none;
40
- transform-origin: top;
41
- min-width: 17.5rem;
42
- max-width: 35rem;
43
- padding: 1.5rem;
44
- background-color: rgb(var(--mdui-color-surface-container-high));
45
- box-shadow: var(--mdui-elevation-level3);
46
- }
47
- :host([fullscreen]) .panel {
48
- width: 100%;
49
- max-width: 100%;
50
- height: 100%;
51
- max-height: 100%;
52
- box-shadow: var(--mdui-elevation-level0);
53
- }
54
- .header {
55
- display: flex;
56
- flex-direction: column;
57
- }
58
- .has-icon .header {
59
- align-items: center;
60
- }
61
- .icon {
62
- display: flex;
63
- color: rgb(var(--mdui-color-secondary));
64
- font-size: 1.5rem;
65
- }
66
- .icon mdui-icon,
67
- ::slotted([slot='icon']) {
68
- font-size: inherit;
69
- }
70
- .headline {
71
- display: flex;
72
- color: rgb(var(--mdui-color-on-surface));
73
- font-size: var(--mdui-typescale-headline-small-size);
74
- font-weight: var(--mdui-typescale-headline-small-weight);
75
- letter-spacing: var(--mdui-typescale-headline-small-tracking);
76
- line-height: var(--mdui-typescale-headline-small-line-height);
77
- }
78
- .icon + .headline {
79
- padding-top: 1rem;
80
- }
81
- .body {
82
- overflow: auto;
83
- }
84
- .header + .body {
85
- margin-top: 1rem;
86
- }
87
- .description {
88
- display: flex;
89
- color: rgb(var(--mdui-color-on-surface-variant));
90
- font-size: var(--mdui-typescale-body-medium-size);
91
- font-weight: var(--mdui-typescale-body-medium-weight);
92
- letter-spacing: var(--mdui-typescale-body-medium-tracking);
93
- line-height: var(--mdui-typescale-body-medium-line-height);
94
- }
95
- :host([fullscreen]) .description {
96
- color: rgb(var(--mdui-color-on-surface));
97
- }
98
- .has-description.has-default .description {
99
- margin-bottom: 1rem;
100
- }
101
- .action {
102
- display: flex;
103
- justify-content: flex-end;
104
- padding-top: 1.5rem;
105
- }
106
- .action::slotted(:not(:first-child)) {
107
- margin-left: 0.5rem;
108
- }
109
- :host([stacked-actions]) .action {
110
- flex-direction: column;
111
- align-items: end;
112
- }
113
- :host([stacked-actions]) .action::slotted(:not(:first-child)) {
114
- margin-left: 0rem;
115
- margin-top: 0.5rem;
116
- }
117
- `;
2
+ export const style = css `:host{--shape-corner:var(--mdui-shape-corner-extra-large);--z-index:2300;position:fixed;z-index:var(--z-index);display:none;align-items:center;justify-content:center;inset:0;padding:3rem}::slotted(mdui-top-app-bar[slot=header]){position:absolute;border-top-left-radius:var(--mdui-shape-corner-extra-large);border-top-right-radius:var(--mdui-shape-corner-extra-large);background-color:rgb(var(--mdui-color-surface-container-high))}:host([fullscreen]){--shape-corner:var(--mdui-shape-corner-none);padding:0}:host([fullscreen]) ::slotted(mdui-top-app-bar[slot=header]){border-top-left-radius:var(--mdui-shape-corner-none);border-top-right-radius:var(--mdui-shape-corner-none)}.overlay{position:fixed;inset:0;background-color:rgba(var(--mdui-color-scrim),.4)}.panel{position:relative;display:flex;flex-direction:column;max-height:100%;border-radius:var(--shape-corner);outline:0;transform-origin:top;min-width:17.5rem;max-width:35rem;padding:1.5rem;background-color:rgb(var(--mdui-color-surface-container-high));box-shadow:var(--mdui-elevation-level3)}:host([fullscreen]) .panel{width:100%;max-width:100%;height:100%;max-height:100%;box-shadow:var(--mdui-elevation-level0)}.header{display:flex;flex-direction:column}.has-icon .header{align-items:center}.icon{display:flex;color:rgb(var(--mdui-color-secondary));font-size:1.5rem}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit}.headline{display:flex;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-headline-small-size);font-weight:var(--mdui-typescale-headline-small-weight);letter-spacing:var(--mdui-typescale-headline-small-tracking);line-height:var(--mdui-typescale-headline-small-line-height)}.icon+.headline{padding-top:1rem}.body{overflow:auto}.header+.body{margin-top:1rem}.description{display:flex;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([fullscreen]) .description{color:rgb(var(--mdui-color-on-surface))}.has-description.has-default .description{margin-bottom:1rem}.action{display:flex;justify-content:flex-end;padding-top:1.5rem}.action::slotted(:not(:first-child)){margin-left:.5rem}:host([stacked-actions]) .action{flex-direction:column;align-items:end}:host([stacked-actions]) .action::slotted(:not(:first-child)){margin-left:0;margin-top:.5rem}`;
@@ -1,19 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const style = css `
3
- :host {
4
- display: block;
5
- height: 0.0625rem;
6
- background-color: rgb(var(--mdui-color-surface-variant));
7
- }
8
- :host([inset]) {
9
- margin-left: 1rem;
10
- }
11
- :host([middle]) {
12
- margin-left: 1rem;
13
- margin-right: 1rem;
14
- }
15
- :host([vertical]) {
16
- height: 100%;
17
- width: 0.0625rem;
18
- }
19
- `;
2
+ export const style = css `:host{display:block;height:.0625rem;background-color:rgb(var(--mdui-color-surface-variant))}:host([inset]){margin-left:1rem}:host([middle]){margin-left:1rem;margin-right:1rem}:host([vertical]){height:100%;width:.0625rem}`;
@@ -234,14 +234,7 @@ let Dropdown = class Dropdown extends MduiElement {
234
234
  });
235
235
  }
236
236
  render() {
237
- return html `<slot name="trigger" part="trigger" class="trigger"></slot>
238
- <slot
239
- ${ref(this.panelRef)}
240
- part="panel"
241
- class="panel"
242
- hidden
243
- @click=${this.onPanelClick}
244
- ></slot>`;
237
+ return html `<slot name="trigger" part="trigger" class="trigger"></slot><slot ${ref(this.panelRef)} part="panel" class="panel" hidden @click="${this.onPanelClick}"></slot>`;
245
238
  }
246
239
  /**
247
240
  * 获取 dropdown 打开、关闭动画的 CSS scaleX 或 scaleY
@@ -1,12 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const style = css `
3
- :host {
4
- --z-index: 2100;
5
- display: contents;
6
- }
7
- .panel {
8
- display: block;
9
- position: fixed;
10
- z-index: var(--z-index);
11
- }
12
- `;
2
+ export const style = css `:host{--z-index:2100;display:contents}.panel{display:block;position:fixed;z-index:var(--z-index)}`;
@@ -94,20 +94,14 @@ let Fab = class Fab extends ButtonBase {
94
94
  button: true,
95
95
  'has-icon': this.icon || this.hasSlotController.test('icon'),
96
96
  });
97
- return html `<mdui-ripple
98
- ${ref(this.rippleRef)}
99
- .noRipple=${this.noRipple}
100
- ></mdui-ripple>
101
- ${this.isButton()
97
+ return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
102
98
  ? this.renderButton({
103
99
  className,
104
100
  part: 'button',
105
101
  content: this.renderInner(),
106
102
  })
107
103
  : this.disabled || this.loading
108
- ? html `<span part="button" class="_a ${className}">
109
- ${this.renderInner()}
110
- </span>`
104
+ ? html `<span part="button" class="_a ${className}">${this.renderInner()}</span>`
111
105
  : this.renderAnchor({
112
106
  className,
113
107
  part: 'button',
@@ -121,11 +115,9 @@ let Fab = class Fab extends ButtonBase {
121
115
  if (this.loading) {
122
116
  return this.renderLoading();
123
117
  }
124
- return html `<slot name="icon" part="icon" class="icon">
125
- ${this.icon
126
- ? html `<mdui-icon name=${this.icon}></mdui-icon>`
127
- : nothingTemplate}
128
- </slot>`;
118
+ return html `<slot name="icon" part="icon" class="icon">${this.icon
119
+ ? html `<mdui-icon name="${this.icon}"></mdui-icon>`
120
+ : nothingTemplate}</slot>`;
129
121
  }
130
122
  renderInner() {
131
123
  return [this.renderIcon(), this.renderLabel()];
@@ -1,157 +1,8 @@
1
1
  import { css } from 'lit';
2
- export const style = css `
3
- /**
4
- * mdui-fab 组件。默认为 variant="primary" size="normal"
5
- */
6
- :host {
7
- --shape-corner-small: var(--mdui-shape-corner-small);
8
- --shape-corner-normal: var(--mdui-shape-corner-large);
9
- --shape-corner-large: var(--mdui-shape-corner-extra-large);
10
- position: relative;
11
- display: inline-block;
12
- overflow: hidden;
13
- text-align: center;
14
- border-radius: var(--shape-corner-normal);
15
- cursor: pointer;
16
- -webkit-tap-highlight-color: transparent;
17
- transition-property: box-shadow;
18
- transition-timing-function: var(--mdui-motion-easing-emphasized);
19
- transition-duration: var(--mdui-motion-duration-medium4);
20
- width: 3.5rem;
21
- height: 3.5rem;
22
- box-shadow: var(--mdui-elevation-level3);
23
- font-size: var(--mdui-typescale-label-large-size);
24
- font-weight: var(--mdui-typescale-label-large-weight);
25
- letter-spacing: var(--mdui-typescale-label-large-tracking);
26
- line-height: var(--mdui-typescale-label-large-line-height);
27
- }
28
- .button {
29
- padding: 0rem 1rem;
30
- }
31
- :host([size='small']) .button {
32
- padding: 0rem 0.5rem;
33
- }
34
- :host([size='large']) .button {
35
- padding: 0rem 1.875rem;
36
- }
37
- :host([lowered]) {
38
- box-shadow: var(--mdui-elevation-level1);
39
- }
40
- :host([focus-visible]) {
41
- box-shadow: var(--mdui-elevation-level3);
42
- }
43
- :host([lowered][focus-visible]) {
44
- box-shadow: var(--mdui-elevation-level1);
45
- }
46
- :host([pressed]) {
47
- box-shadow: var(--mdui-elevation-level3);
48
- }
49
- :host([lowered][pressed]) {
50
- box-shadow: var(--mdui-elevation-level1);
51
- }
52
- :host([hover]) {
53
- box-shadow: var(--mdui-elevation-level4);
54
- }
55
- :host([lowered][hover]) {
56
- box-shadow: var(--mdui-elevation-level2);
57
- }
58
- :host([variant='primary']) {
59
- color: rgb(var(--mdui-color-on-primary-container));
60
- background-color: rgb(var(--mdui-color-primary-container));
61
- --mdui-comp-ripple-state-layer-color: var(
2
+ export const style = css `:host{--shape-corner-small:var(--mdui-shape-corner-small);--shape-corner-normal:var(--mdui-shape-corner-large);--shape-corner-large:var(--mdui-shape-corner-extra-large);position:relative;display:inline-block;overflow:hidden;text-align:center;border-radius:var(--shape-corner-normal);cursor:pointer;-webkit-tap-highlight-color:transparent;transition-property:box-shadow;transition-timing-function:var(--mdui-motion-easing-emphasized);transition-duration:var(--mdui-motion-duration-medium4);width:3.5rem;height:3.5rem;box-shadow:var(--mdui-elevation-level3);font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.button{padding:0 1rem}:host([size=small]) .button{padding:0 .5rem}:host([size=large]) .button{padding:0 1.875rem}:host([lowered]){box-shadow:var(--mdui-elevation-level1)}:host([focus-visible]){box-shadow:var(--mdui-elevation-level3)}:host([lowered][focus-visible]){box-shadow:var(--mdui-elevation-level1)}:host([pressed]){box-shadow:var(--mdui-elevation-level3)}:host([lowered][pressed]){box-shadow:var(--mdui-elevation-level1)}:host([hover]){box-shadow:var(--mdui-elevation-level4)}:host([lowered][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=primary]){color:rgb(var(--mdui-color-on-primary-container));background-color:rgb(var(--mdui-color-primary-container));--mdui-comp-ripple-state-layer-color:var(
62
3
  --mdui-color-on-primary-container
63
- );
64
- }
65
- :host([variant='surface']) {
66
- color: rgb(var(--mdui-color-primary));
67
- background-color: rgb(var(--mdui-color-surface-container-high));
68
- --mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
69
- }
70
- :host([variant='surface'][lowered]) {
71
- background-color: rgb(var(--mdui-color-surface-container-low));
72
- }
73
- :host([variant='secondary']) {
74
- color: rgb(var(--mdui-color-on-secondary-container));
75
- background-color: rgb(var(--mdui-color-secondary-container));
76
- --mdui-comp-ripple-state-layer-color: var(
4
+ )}:host([variant=surface]){color:rgb(var(--mdui-color-primary));background-color:rgb(var(--mdui-color-surface-container-high));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=surface][lowered]){background-color:rgb(var(--mdui-color-surface-container-low))}:host([variant=secondary]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
77
5
  --mdui-color-on-secondary-container
78
- );
79
- }
80
- :host([variant='tertiary']) {
81
- color: rgb(var(--mdui-color-on-tertiary-container));
82
- background-color: rgb(var(--mdui-color-tertiary-container));
83
- --mdui-comp-ripple-state-layer-color: var(
6
+ )}:host([variant=tertiary]){color:rgb(var(--mdui-color-on-tertiary-container));background-color:rgb(var(--mdui-color-tertiary-container));--mdui-comp-ripple-state-layer-color:var(
84
7
  --mdui-color-on-tertiary-container
85
- );
86
- }
87
- :host([size='small']) {
88
- border-radius: var(--shape-corner-small);
89
- width: 2.5rem;
90
- height: 2.5rem;
91
- }
92
- :host([size='large']) {
93
- border-radius: var(--shape-corner-large);
94
- width: 6rem;
95
- height: 6rem;
96
- }
97
- :host([disabled]),
98
- :host([loading]) {
99
- cursor: default;
100
- pointer-events: none;
101
- }
102
- :host([disabled]) {
103
- color: rgba(var(--mdui-color-on-surface), 38%);
104
- background-color: rgba(var(--mdui-color-on-surface), 12%);
105
- box-shadow: var(--mdui-elevation-level0);
106
- }
107
- :host([extended]) {
108
- width: auto;
109
- }
110
- .label {
111
- display: inline-flex;
112
- transition: opacity var(--mdui-motion-duration-short2)
113
- var(--mdui-motion-easing-linear) var(--mdui-motion-duration-short2);
114
- padding-left: 0.25rem;
115
- padding-right: 0.25rem;
116
- }
117
- .has-icon .label {
118
- margin-left: 0.5rem;
119
- }
120
- :host([size='small']) .has-icon .label {
121
- margin-left: 0.25rem;
122
- }
123
- :host([size='large']) .has-icon .label {
124
- margin-left: 1rem;
125
- }
126
- :host(:not([extended])) .label {
127
- opacity: 0;
128
- transition-delay: 0ms;
129
- transition-duration: var(--mdui-motion-duration-short1);
130
- }
131
- :host([size='large']) .label {
132
- font-size: 1.5em;
133
- }
134
- .icon {
135
- display: inline-flex;
136
- font-size: 1.71428571em;
137
- }
138
- :host([size='large']) .icon {
139
- font-size: 2.57142857em;
140
- }
141
- .icon mdui-icon,
142
- ::slotted([slot='icon']) {
143
- font-size: inherit;
144
- }
145
- mdui-circular-progress {
146
- display: inline-flex;
147
- width: 1.5rem;
148
- height: 1.5rem;
149
- }
150
- :host([size='large']) mdui-circular-progress {
151
- width: 2.25rem;
152
- height: 2.25rem;
153
- }
154
- :host([disabled]) mdui-circular-progress {
155
- stroke: rgba(var(--mdui-color-on-surface), 38%);
156
- }
157
- `;
8
+ )}:host([size=small]){border-radius:var(--shape-corner-small);width:2.5rem;height:2.5rem}:host([size=large]){border-radius:var(--shape-corner-large);width:6rem;height:6rem}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){color:rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),12%);box-shadow:var(--mdui-elevation-level0)}:host([extended]){width:auto}.label{display:inline-flex;transition:opacity var(--mdui-motion-duration-short2) var(--mdui-motion-easing-linear) var(--mdui-motion-duration-short2);padding-left:.25rem;padding-right:.25rem}.has-icon .label{margin-left:.5rem}:host([size=small]) .has-icon .label{margin-left:.25rem}:host([size=large]) .has-icon .label{margin-left:1rem}:host(:not([extended])) .label{opacity:0;transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1)}:host([size=large]) .label{font-size:1.5em}.icon{display:inline-flex;font-size:1.71428571em}:host([size=large]) .icon{font-size:2.57142857em}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit}mdui-circular-progress{display:inline-flex;width:1.5rem;height:1.5rem}:host([size=large]) mdui-circular-progress{width:2.25rem;height:2.25rem}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`;
@@ -34,11 +34,7 @@ let Icon = class Icon extends MduiElement {
34
34
  ['sharp', 'Material Icons Sharp'],
35
35
  ['two-tone', 'Material Icons Two Tone'],
36
36
  ]);
37
- return html `<span
38
- style=${styleMap({ fontFamily: familyMap.get(variant) })}
39
- >
40
- ${name}
41
- </span>`;
37
+ return html `<span style="${styleMap({ fontFamily: familyMap.get(variant) })}">${name}</span>`;
42
38
  }
43
39
  if (this.src) {
44
40
  return html `${until(ajax({ url: this.src }).then(unsafeSVG))}`;