godown 3.0.0 → 3.0.2

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 (251) hide show
  1. package/build/godown+lit.iife.js +12 -12
  2. package/build/godown+lit.iife.js.map +1 -1
  3. package/build/godown+lit.js +12 -12
  4. package/build/godown+lit.js.map +1 -1
  5. package/build/godown+lit.umd.js +12 -12
  6. package/build/godown+lit.umd.js.map +1 -1
  7. package/build/godown.iife.js +11 -11
  8. package/build/godown.js +11 -11
  9. package/build/godown.js.map +1 -1
  10. package/build/godown.umd.js +11 -11
  11. package/build/godown.umd.js.map +1 -1
  12. package/components/alert.d.ts.map +1 -1
  13. package/components/alert.js +1 -1
  14. package/components/alert.js.map +1 -1
  15. package/components/avatar.d.ts.map +1 -1
  16. package/components/avatar.js +1 -1
  17. package/components/avatar.js.map +1 -1
  18. package/components/badge.d.ts.map +1 -1
  19. package/components/badge.js +1 -1
  20. package/components/badge.js.map +1 -1
  21. package/components/breath.d.ts.map +1 -1
  22. package/components/breath.js +1 -1
  23. package/components/breath.js.map +1 -1
  24. package/components/button.d.ts.map +1 -1
  25. package/components/button.js +1 -1
  26. package/components/button.js.map +1 -1
  27. package/components/card.d.ts.map +1 -1
  28. package/components/card.js +1 -1
  29. package/components/card.js.map +1 -1
  30. package/components/carousel.d.ts.map +1 -1
  31. package/components/carousel.js +1 -1
  32. package/components/carousel.js.map +1 -1
  33. package/components/details.d.ts.map +1 -1
  34. package/components/details.js +1 -1
  35. package/components/details.js.map +1 -1
  36. package/components/dialog.d.ts +3 -2
  37. package/components/dialog.d.ts.map +1 -1
  38. package/components/dialog.js +1 -1
  39. package/components/dialog.js.map +1 -1
  40. package/components/divider.d.ts.map +1 -1
  41. package/components/divider.js +1 -1
  42. package/components/divider.js.map +1 -1
  43. package/components/dragbox.d.ts.map +1 -1
  44. package/components/dragbox.js +1 -1
  45. package/components/dragbox.js.map +1 -1
  46. package/components/flex.d.ts.map +1 -1
  47. package/components/flex.js.map +1 -1
  48. package/components/form.d.ts.map +1 -1
  49. package/components/form.js.map +1 -1
  50. package/components/grid.d.ts.map +1 -1
  51. package/components/grid.js.map +1 -1
  52. package/components/heading.d.ts.map +1 -1
  53. package/components/heading.js +1 -1
  54. package/components/heading.js.map +1 -1
  55. package/components/input.d.ts.map +1 -1
  56. package/components/input.js +1 -1
  57. package/components/input.js.map +1 -1
  58. package/components/layout.d.ts.map +1 -1
  59. package/components/layout.js +1 -1
  60. package/components/layout.js.map +1 -1
  61. package/components/link.js.map +1 -1
  62. package/components/progress.d.ts.map +1 -1
  63. package/components/progress.js +1 -1
  64. package/components/progress.js.map +1 -1
  65. package/components/range.d.ts.map +1 -1
  66. package/components/range.js +1 -1
  67. package/components/range.js.map +1 -1
  68. package/components/rotate.d.ts.map +1 -1
  69. package/components/rotate.js +1 -1
  70. package/components/rotate.js.map +1 -1
  71. package/components/router.d.ts +21 -26
  72. package/components/router.d.ts.map +1 -1
  73. package/components/router.js +1 -1
  74. package/components/router.js.map +1 -1
  75. package/components/select.d.ts.map +1 -1
  76. package/components/select.js +1 -1
  77. package/components/select.js.map +1 -1
  78. package/components/skeleton.d.ts.map +1 -1
  79. package/components/skeleton.js +1 -1
  80. package/components/skeleton.js.map +1 -1
  81. package/components/split.d.ts.map +1 -1
  82. package/components/split.js +1 -1
  83. package/components/split.js.map +1 -1
  84. package/components/switch.d.ts.map +1 -1
  85. package/components/switch.js +1 -1
  86. package/components/switch.js.map +1 -1
  87. package/components/text.d.ts.map +1 -1
  88. package/components/text.js +1 -1
  89. package/components/text.js.map +1 -1
  90. package/components/time.d.ts.map +1 -1
  91. package/components/time.js.map +1 -1
  92. package/components/tooltip.d.ts.map +1 -1
  93. package/components/tooltip.js +1 -1
  94. package/components/tooltip.js.map +1 -1
  95. package/components/typewriter.d.ts.map +1 -1
  96. package/components/typewriter.js +1 -1
  97. package/components/typewriter.js.map +1 -1
  98. package/core/global-style.d.ts.map +1 -1
  99. package/core/global-style.js +1 -1
  100. package/core/global-style.js.map +1 -1
  101. package/core/super-anchor.d.ts.map +1 -1
  102. package/core/super-anchor.js +1 -1
  103. package/core/super-anchor.js.map +1 -1
  104. package/core/super-input.d.ts +1 -0
  105. package/core/super-input.d.ts.map +1 -1
  106. package/core/super-input.js +1 -1
  107. package/core/super-input.js.map +1 -1
  108. package/core/super-openable.d.ts.map +1 -1
  109. package/core/super-openable.js.map +1 -1
  110. package/custom-elements.json +1 -1
  111. package/dev/components/alert.d.ts.map +1 -1
  112. package/dev/components/alert.js +82 -69
  113. package/dev/components/alert.js.map +1 -1
  114. package/dev/components/avatar.d.ts.map +1 -1
  115. package/dev/components/avatar.js +52 -36
  116. package/dev/components/avatar.js.map +1 -1
  117. package/dev/components/badge.d.ts.map +1 -1
  118. package/dev/components/badge.js +57 -50
  119. package/dev/components/badge.js.map +1 -1
  120. package/dev/components/breath.d.ts.map +1 -1
  121. package/dev/components/breath.js +20 -14
  122. package/dev/components/breath.js.map +1 -1
  123. package/dev/components/button.d.ts.map +1 -1
  124. package/dev/components/button.js +13 -13
  125. package/dev/components/button.js.map +1 -1
  126. package/dev/components/card.d.ts.map +1 -1
  127. package/dev/components/card.js +40 -35
  128. package/dev/components/card.js.map +1 -1
  129. package/dev/components/carousel.d.ts.map +1 -1
  130. package/dev/components/carousel.js +63 -43
  131. package/dev/components/carousel.js.map +1 -1
  132. package/dev/components/details.d.ts.map +1 -1
  133. package/dev/components/details.js +72 -61
  134. package/dev/components/details.js.map +1 -1
  135. package/dev/components/dialog.d.ts +3 -2
  136. package/dev/components/dialog.d.ts.map +1 -1
  137. package/dev/components/dialog.js +63 -65
  138. package/dev/components/dialog.js.map +1 -1
  139. package/dev/components/divider.d.ts.map +1 -1
  140. package/dev/components/divider.js +28 -23
  141. package/dev/components/divider.js.map +1 -1
  142. package/dev/components/dragbox.d.ts.map +1 -1
  143. package/dev/components/dragbox.js +19 -17
  144. package/dev/components/dragbox.js.map +1 -1
  145. package/dev/components/flex.d.ts.map +1 -1
  146. package/dev/components/flex.js +16 -11
  147. package/dev/components/flex.js.map +1 -1
  148. package/dev/components/form.d.ts.map +1 -1
  149. package/dev/components/form.js +4 -4
  150. package/dev/components/form.js.map +1 -1
  151. package/dev/components/grid.d.ts.map +1 -1
  152. package/dev/components/grid.js +16 -11
  153. package/dev/components/grid.js.map +1 -1
  154. package/dev/components/heading.d.ts.map +1 -1
  155. package/dev/components/heading.js +62 -40
  156. package/dev/components/heading.js.map +1 -1
  157. package/dev/components/input.d.ts.map +1 -1
  158. package/dev/components/input.js +32 -24
  159. package/dev/components/input.js.map +1 -1
  160. package/dev/components/layout.d.ts.map +1 -1
  161. package/dev/components/layout.js +43 -30
  162. package/dev/components/layout.js.map +1 -1
  163. package/dev/components/link.js +1 -1
  164. package/dev/components/link.js.map +1 -1
  165. package/dev/components/progress.d.ts.map +1 -1
  166. package/dev/components/progress.js +51 -42
  167. package/dev/components/progress.js.map +1 -1
  168. package/dev/components/range.d.ts.map +1 -1
  169. package/dev/components/range.js +33 -30
  170. package/dev/components/range.js.map +1 -1
  171. package/dev/components/rotate.d.ts.map +1 -1
  172. package/dev/components/rotate.js +12 -5
  173. package/dev/components/rotate.js.map +1 -1
  174. package/dev/components/router.d.ts +21 -26
  175. package/dev/components/router.d.ts.map +1 -1
  176. package/dev/components/router.js +22 -18
  177. package/dev/components/router.js.map +1 -1
  178. package/dev/components/select.d.ts.map +1 -1
  179. package/dev/components/select.js +65 -57
  180. package/dev/components/select.js.map +1 -1
  181. package/dev/components/skeleton.d.ts.map +1 -1
  182. package/dev/components/skeleton.js +65 -61
  183. package/dev/components/skeleton.js.map +1 -1
  184. package/dev/components/split.d.ts.map +1 -1
  185. package/dev/components/split.js +66 -58
  186. package/dev/components/split.js.map +1 -1
  187. package/dev/components/switch.d.ts.map +1 -1
  188. package/dev/components/switch.js +88 -79
  189. package/dev/components/switch.js.map +1 -1
  190. package/dev/components/text.d.ts.map +1 -1
  191. package/dev/components/text.js +51 -45
  192. package/dev/components/text.js.map +1 -1
  193. package/dev/components/time.d.ts.map +1 -1
  194. package/dev/components/time.js +13 -2
  195. package/dev/components/time.js.map +1 -1
  196. package/dev/components/tooltip.d.ts.map +1 -1
  197. package/dev/components/tooltip.js +31 -23
  198. package/dev/components/tooltip.js.map +1 -1
  199. package/dev/components/typewriter.d.ts.map +1 -1
  200. package/dev/components/typewriter.js +35 -27
  201. package/dev/components/typewriter.js.map +1 -1
  202. package/dev/core/global-style.d.ts.map +1 -1
  203. package/dev/core/global-style.js +9 -9
  204. package/dev/core/global-style.js.map +1 -1
  205. package/dev/core/super-anchor.d.ts.map +1 -1
  206. package/dev/core/super-anchor.js +27 -26
  207. package/dev/core/super-anchor.js.map +1 -1
  208. package/dev/core/super-input.d.ts +1 -0
  209. package/dev/core/super-input.d.ts.map +1 -1
  210. package/dev/core/super-input.js +87 -69
  211. package/dev/core/super-input.js.map +1 -1
  212. package/dev/core/super-openable.d.ts.map +1 -1
  213. package/dev/core/super-openable.js +1 -2
  214. package/dev/core/super-openable.js.map +1 -1
  215. package/package.json +3 -3
  216. package/src/components/alert.ts +84 -75
  217. package/src/components/avatar.ts +54 -40
  218. package/src/components/badge.ts +68 -65
  219. package/src/components/breath.ts +23 -19
  220. package/src/components/button.ts +14 -14
  221. package/src/components/card.ts +42 -40
  222. package/src/components/carousel.ts +65 -47
  223. package/src/components/details.ts +74 -65
  224. package/src/components/dialog.ts +69 -66
  225. package/src/components/divider.ts +33 -30
  226. package/src/components/dragbox.ts +22 -22
  227. package/src/components/flex.ts +31 -28
  228. package/src/components/form.ts +7 -9
  229. package/src/components/grid.ts +31 -28
  230. package/src/components/heading.ts +67 -49
  231. package/src/components/input.ts +37 -31
  232. package/src/components/layout.ts +45 -34
  233. package/src/components/link.ts +1 -1
  234. package/src/components/progress.ts +53 -46
  235. package/src/components/range.ts +58 -52
  236. package/src/components/rotate.ts +15 -10
  237. package/src/components/router.ts +46 -46
  238. package/src/components/select.ts +74 -70
  239. package/src/components/skeleton.ts +67 -65
  240. package/src/components/split.ts +73 -69
  241. package/src/components/switch.ts +90 -83
  242. package/src/components/text.ts +53 -49
  243. package/src/components/time.ts +14 -3
  244. package/src/components/tooltip.ts +32 -24
  245. package/src/components/typewriter.ts +37 -31
  246. package/src/core/global-style.ts +11 -12
  247. package/src/core/super-anchor.ts +29 -30
  248. package/src/core/super-input.ts +91 -74
  249. package/src/core/super-openable.ts +2 -8
  250. package/vscode.html-custom-data.json +1 -1
  251. package/web-types.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import { attr, godown, htmlSlot, styles } from "@godown/element";
2
2
  import iconPhoto from "@godown/f7-icon/icons/photo.js";
3
- import { css, html, type TemplateResult } from "lit";
3
+ import { type TemplateResult, css, html } from "lit";
4
4
  import { property, state } from "lit/decorators.js";
5
5
 
6
- import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
6
+ import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
7
7
 
8
8
  const protoName = "skeleton";
9
9
  const cssScope = scopePrefix(protoName);
@@ -16,73 +16,71 @@ const cssScope = scopePrefix(protoName);
16
16
  * @category feedback
17
17
  */
18
18
  @godown(protoName)
19
- @styles(
20
- css`
21
- :host {
22
- ${cssScope}--from: var(${cssGlobalVars._colors.darkgray[9]});
23
- ${cssScope}--to: var(${cssGlobalVars._colors.darkgray[7]});
24
- ${cssScope}--deg: 95deg;
25
- ${cssScope}--duration: 1.5s;
26
- ${cssScope}--icon-size: 5em;
27
- ${cssScope}--icon-margin: .25em;
28
- color: var(${cssGlobalVars._colors.darkgray[5]});
29
- background: var(${cssScope}--from);
30
- min-height: 1.5em;
31
- width: 100%;
32
- flex-shrink: 0;
33
- display: block;
34
- overflow: hidden;
35
- }
19
+ @styles(css`
20
+ :host {
21
+ ${cssScope}--from: var(${cssGlobalVars._colors.darkgray[9]});
22
+ ${cssScope}--to: var(${cssGlobalVars._colors.darkgray[7]});
23
+ ${cssScope}--deg: 95deg;
24
+ ${cssScope}--duration: 1.5s;
25
+ ${cssScope}--icon-size: 5em;
26
+ ${cssScope}--icon-margin: .25em;
27
+ color: var(${cssGlobalVars._colors.darkgray[5]});
28
+ background: var(${cssScope}--from);
29
+ min-height: 1.5em;
30
+ width: 100%;
31
+ flex-shrink: 0;
32
+ display: block;
33
+ overflow: hidden;
34
+ }
36
35
 
37
- [part=root] {
38
- height: 100%;
39
- min-height: inherit;
40
- text-align: center;
41
- animation: var(${cssScope}--duration) ease-in-out 0s infinite none running;
42
- }
36
+ [part="root"] {
37
+ height: 100%;
38
+ min-height: inherit;
39
+ text-align: center;
40
+ animation: var(${cssScope}--duration) ease-in-out 0s infinite none running;
41
+ }
43
42
 
44
- svg {
45
- --size:var(${cssScope}--icon-size);
46
- font-size: var(--size);
47
- margin: calc(var(--size) * 0.05);
48
- }
43
+ svg {
44
+ --size: var(${cssScope}--icon-size);
45
+ font-size: var(--size);
46
+ margin: calc(var(--size) * 0.05);
47
+ }
49
48
 
50
- [animation=position] {
51
- background-image: linear-gradient(
52
- var(${cssScope}--deg),
53
- var(${cssScope}--from) 36%,
54
- var(${cssScope}--to) 50%,
55
- var(${cssScope}--from) 64%
56
- );
57
- background-color: transparent;
58
- background-size: 200% 100%;
59
- animation-name: po;
60
- }
49
+ [animation="position"] {
50
+ background-image: linear-gradient(
51
+ var(${cssScope}--deg),
52
+ var(${cssScope}--from) 36%,
53
+ var(${cssScope}--to) 50%,
54
+ var(${cssScope}--from) 64%
55
+ );
56
+ background-color: transparent;
57
+ background-size: 200% 100%;
58
+ animation-name: po;
59
+ }
61
60
 
62
- @keyframes po {
63
- from {
64
- background-position: 150% center;
65
- }
66
- to {
67
- background-position: -50% center;
68
- }
61
+ @keyframes po {
62
+ from {
63
+ background-position: 150% center;
69
64
  }
70
-
71
- [animation=opacity] {
72
- animation-name: op;
73
- animation-direction: alternate;
65
+ to {
66
+ background-position: -50% center;
74
67
  }
68
+ }
75
69
 
76
- @keyframes op {
77
- 50% {
78
- opacity: 0.25;
79
- }
80
- to {
81
- opacity: 1;
82
- }
70
+ [animation="opacity"] {
71
+ animation-name: op;
72
+ animation-direction: alternate;
73
+ }
74
+
75
+ @keyframes op {
76
+ 50% {
77
+ opacity: 0.25;
78
+ }
79
+ to {
80
+ opacity: 1;
83
81
  }
84
- `,
85
- )
82
+ }
83
+ `)
86
84
  class Skeleton extends GlobalStyle {
87
85
  /**
88
86
  * If "image", render a image placeholder.
@@ -107,10 +105,14 @@ class Skeleton extends GlobalStyle {
107
105
  if (!this.loading) {
108
106
  return htmlSlot();
109
107
  }
110
- return html`<div part="root" ${attr(this.observedRecord)}>
111
- ${this.type === "image" ? iconPhoto() : ""}
112
- ${htmlSlot("loading")}
113
- </div>`;
108
+ return html`
109
+ <div
110
+ part="root"
111
+ ${attr(this.observedRecord)}
112
+ >
113
+ ${this.type === "image" ? iconPhoto() : ""} ${htmlSlot("loading")}
114
+ </div>
115
+ `;
114
116
  }
115
117
  }
116
118
 
@@ -1,5 +1,5 @@
1
- import { attr, classList, godown, type HandlerEvent, styles } from "@godown/element";
2
- import { css, html, nothing, type TemplateResult } from "lit";
1
+ import { type HandlerEvent, attr, classList, godown, styles } from "@godown/element";
2
+ import { type TemplateResult, css, html, nothing } from "lit";
3
3
  import { property, state } from "lit/decorators.js";
4
4
 
5
5
  import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
@@ -30,54 +30,52 @@ const loop = <T>(len: number, fn: (index?: number) => T) => {
30
30
  * @category input
31
31
  */
32
32
  @godown(protoName)
33
- @styles(
34
- css`
35
- :host {
36
- color: var(${cssGlobalVars.foreground});
37
- display: block;
38
- border-radius: 1px;
39
- width: fit-content;
40
- ${cssScope}--size: 1.45em;
41
- ${cssScope}--gap: .25em;
42
- }
33
+ @styles(css`
34
+ :host {
35
+ color: var(${cssGlobalVars.foreground});
36
+ display: block;
37
+ border-radius: 1px;
38
+ width: fit-content;
39
+ ${cssScope}--size: 1.45em;
40
+ ${cssScope}--gap: .25em;
41
+ }
43
42
 
44
- :host([contents]) [part=root] {
45
- width: fit-content;
46
- }
43
+ :host([contents]) [part="root"] {
44
+ width: fit-content;
45
+ }
47
46
 
48
- [part=root] {
49
- gap: var(${cssScope}--gap);
50
- width: 100%;
51
- position: relative;
52
- vertical-align: top;
53
- display: flex;
54
- justify-content: space-between;
55
- border-radius: inherit;
56
- }
47
+ [part="root"] {
48
+ gap: var(${cssScope}--gap);
49
+ width: 100%;
50
+ position: relative;
51
+ vertical-align: top;
52
+ display: flex;
53
+ justify-content: space-between;
54
+ border-radius: inherit;
55
+ }
57
56
 
58
- [part=input-box] {
59
- width: var(${cssScope}--size);
60
- height: var(${cssScope}--size);
61
- vertical-align: top;
62
- text-align: center;
63
- background-color: var(${cssGlobalVars.input}-background);
64
- border-radius: inherit;
65
- }
57
+ [part="input-box"] {
58
+ width: var(${cssScope}--size);
59
+ height: var(${cssScope}--size);
60
+ vertical-align: top;
61
+ text-align: center;
62
+ background-color: var(${cssGlobalVars.input}-background);
63
+ border-radius: inherit;
64
+ }
66
65
 
67
- [part=input] {
68
- width: 100%;
69
- height: 100%;
70
- opacity: 0;
71
- background: none;
72
- position: absolute;
73
- z-index: -1;
74
- }
66
+ [part="input"] {
67
+ width: 100%;
68
+ height: 100%;
69
+ opacity: 0;
70
+ background: none;
71
+ position: absolute;
72
+ z-index: -1;
73
+ }
75
74
 
76
- .focus {
77
- box-shadow: var(${cssGlobalVars.input}-box-shadow);
78
- }
79
- `,
80
- )
75
+ .focus {
76
+ box-shadow: var(${cssGlobalVars.input}-box-shadow);
77
+ }
78
+ `)
81
79
  class Split extends SuperInput {
82
80
  /**
83
81
  * The number of input boxes.
@@ -98,29 +96,35 @@ class Split extends SuperInput {
98
96
  currentValue: (string | void)[] = [];
99
97
 
100
98
  protected render(): TemplateResult<1> {
101
- return html`<div part="root" ${attr(this.observedRecord)}>
102
- ${
103
- loop(
104
- this.len,
105
- (index: number) =>
106
- html`<span
107
- part="input-box"
108
- @click="${this.disabled ? null : () => this.focusAt(index)}"
109
- class="${classList({ focus: this.current === index }) || nothing}"
110
- >${this.currentValue[index]}</span
111
- >`,
112
- )
113
- }
114
- <input
115
- part="input"
116
- id="${this.makeId}"
117
- @blur=${this.blur}
118
- @input="${this._handleInput}"
119
- .value="${
120
- /* Ensure that input always has a value of length this.len */
121
- this.value.padStart(this.len, " ")}"
99
+ return html`
100
+ <div
101
+ part="root"
102
+ ${attr(this.observedRecord)}
122
103
  >
123
- </div> `;
104
+ ${loop(
105
+ this.len,
106
+ (index: number) => html`
107
+ <span
108
+ part="input-box"
109
+ class="${classList({ focus: this.current === index })}"
110
+ @click="${this.disabled ? null : () => this.focusAt(index)}"
111
+ >
112
+ ${this.currentValue[index]}
113
+ </span>
114
+ `,
115
+ )}
116
+ <input
117
+ part="input"
118
+ id="${this.makeId}"
119
+ @blur=${this.blur}
120
+ @input="${this._handleInput}"
121
+ .value="${
122
+ /* Ensure that input always has a value of length this.len */
123
+ this.value.padStart(this.len, " ")
124
+ }"
125
+ />
126
+ </div>
127
+ `;
124
128
  }
125
129
 
126
130
  connectedCallback(): void {
@@ -168,8 +172,8 @@ class Split extends SuperInput {
168
172
  // go to before
169
173
 
170
174
  this.currentValue[this.current - 1] = null;
171
- const lastNotNull = this.currentValue.findLastIndex(a => a !== null);
172
- this.current = this.current - 1 < 0 ? lastNotNull < 0 ? 0 : lastNotNull : this.current - 1;
175
+ const lastNotNull = this.currentValue.findLastIndex((a) => a !== null);
176
+ this.current = this.current - 1 < 0 ? (lastNotNull < 0 ? 0 : lastNotNull) : this.current - 1;
173
177
  }
174
178
  return;
175
179
  }
@@ -1,5 +1,5 @@
1
1
  import { attr, godown, styles } from "@godown/element";
2
- import { css, html, type TemplateResult } from "lit";
2
+ import { type TemplateResult, css, html } from "lit";
3
3
  import { property, query } from "lit/decorators.js";
4
4
 
5
5
  import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
@@ -18,87 +18,85 @@ const cssScope = scopePrefix(protoName);
18
18
  * @category input
19
19
  */
20
20
  @godown(protoName)
21
- @styles(
22
- css`
23
- :host,
24
- :host([contents]) [part=root] {
25
- width: var(${cssScope}-width);
26
- height: var(${cssScope}-height);
27
- display: inline-block;
28
- }
21
+ @styles(css`
22
+ :host,
23
+ :host([contents]) [part="root"] {
24
+ width: var(${cssScope}-width);
25
+ height: var(${cssScope}-height);
26
+ display: inline-block;
27
+ }
29
28
 
30
- :host {
31
- ${cssScope}-width: 3em;
32
- ${cssScope}-height: calc(var(${cssScope}-width) / 2);
33
- ${cssScope}-handle-size: 1.25em;
34
- ${cssScope}-handle-space: .125em;
35
- ${cssScope}-transition: .2s ease-in-out;
36
- background: var(${cssGlobalVars.input}-background);
37
- vertical-align: bottom;
38
- border-radius: 0;
39
- }
29
+ :host {
30
+ ${cssScope}-width: 3em;
31
+ ${cssScope}-height: calc(var(${cssScope}-width) / 2);
32
+ ${cssScope}-handle-size: 1.25em;
33
+ ${cssScope}-handle-space: .125em;
34
+ ${cssScope}-transition: .2s ease-in-out;
35
+ background: var(${cssGlobalVars.input}-background);
36
+ vertical-align: bottom;
37
+ border-radius: 0;
38
+ }
40
39
 
41
- [part=root],
42
- [part=handle] {
43
- transition: var(${cssScope}-transition);
44
- }
40
+ [part="root"],
41
+ [part="handle"] {
42
+ transition: var(${cssScope}-transition);
43
+ }
45
44
 
46
- [part=root] {
47
- border-radius: inherit;
48
- position: relative;
49
- height: inherit;
50
- }
51
-
52
- [part=input] {
53
- opacity: 0;
54
- width: 100%;
55
- height: 100%;
56
- appearance: none;
57
- }
45
+ [part="root"] {
46
+ border-radius: inherit;
47
+ position: relative;
48
+ height: inherit;
49
+ }
58
50
 
59
- [part=handle] {
60
- height: 100%;
61
- display: inline-flex;
62
- align-items: center;
63
- justify-content: center;
64
- position: absolute;
65
- left: 0;
66
- width: 50%;
67
- pointer-events: none;
68
- border-radius: inherit;
69
- }
51
+ [part="input"] {
52
+ opacity: 0;
53
+ width: 100%;
54
+ height: 100%;
55
+ appearance: none;
56
+ }
70
57
 
71
- :host([round]) {
72
- border-radius: calc(var(${cssScope}-height) / 2);
73
- background: var(${cssGlobalVars.passive});
74
- }
58
+ [part="handle"] {
59
+ height: 100%;
60
+ display: inline-flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ position: absolute;
64
+ left: 0;
65
+ width: 50%;
66
+ pointer-events: none;
67
+ border-radius: inherit;
68
+ }
75
69
 
76
- :host([checked]) [part=handle] {
77
- left: 50%;
78
- }
70
+ :host([round]) {
71
+ border-radius: calc(var(${cssScope}-height) / 2);
72
+ background: var(${cssGlobalVars.passive});
73
+ }
79
74
 
80
- .rect .true {
81
- background: var(${cssGlobalVars.active});
82
- }
75
+ :host([checked]) [part="handle"] {
76
+ left: 50%;
77
+ }
83
78
 
84
- .rect .false {
85
- background: var(${cssGlobalVars.passive});
86
- }
79
+ .rect .true {
80
+ background: var(${cssGlobalVars.active});
81
+ }
87
82
 
88
- .round [part=handle] {
89
- --size: var(${cssScope}-handle-size);
90
- border-radius: 100%;
91
- background: var(--godown--input-control);
92
- width: var(--size);
93
- height: var(--size);
94
- margin: var(${cssScope}-handle-space);
95
- }
83
+ .rect .false {
84
+ background: var(${cssGlobalVars.passive});
85
+ }
96
86
 
97
- :host([checked]) .round {
98
- background: var(${cssGlobalVars.active});
99
- }
100
- `,
101
- )
87
+ .round [part="handle"] {
88
+ --size: var(${cssScope}-handle-size);
89
+ border-radius: 100%;
90
+ background: var(--godown--input-control);
91
+ width: var(--size);
92
+ height: var(--size);
93
+ margin: var(${cssScope}-handle-space);
94
+ }
95
+
96
+ :host([checked]) .round {
97
+ background: var(${cssGlobalVars.active});
98
+ }
99
+ `)
102
100
  class Switch extends SuperInput {
103
101
  /**
104
102
  * Display rounded.
@@ -134,18 +132,27 @@ class Switch extends SuperInput {
134
132
  protected _input: HTMLInputElement;
135
133
 
136
134
  protected render(): TemplateResult<1> {
137
- return html`<div part="root" ${attr(this.observedRecord)} class="${this.round ? "round" : "rect"}">
138
- <input
139
- part="input"
140
- @change="${this._handleChange}"
141
- ?disabled="${this.disabled}"
142
- ?checked="${this.checked}"
143
- name="${this.name}"
144
- id="${this.makeId}"
145
- type="checkbox"
135
+ return html`
136
+ <div
137
+ part="root"
138
+ ${attr(this.observedRecord)}
139
+ class="${this.round ? "round" : "rect"}"
146
140
  >
147
- <span part="handle" class="${this.checked}"></span>
148
- </div>`;
141
+ <input
142
+ part="input"
143
+ type="checkbox"
144
+ ?disabled="${this.disabled}"
145
+ ?checked="${this.checked}"
146
+ name="${this.name}"
147
+ id="${this.makeId}"
148
+ @change="${this._handleChange}"
149
+ />
150
+ <span
151
+ part="handle"
152
+ class="${this.checked}"
153
+ ></span>
154
+ </div>
155
+ `;
149
156
  }
150
157
 
151
158
  reset(): void {
@@ -1,8 +1,8 @@
1
1
  import { attr, classList, godown, htmlSlot, styles } from "@godown/element";
2
- import { css, html, type TemplateResult } from "lit";
2
+ import { type TemplateResult, css, html } from "lit";
3
3
  import { property } from "lit/decorators.js";
4
4
 
5
- import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
5
+ import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
6
6
 
7
7
  const protoName = "text";
8
8
 
@@ -14,56 +14,54 @@ const cssScope = scopePrefix(protoName);
14
14
  * @category display
15
15
  */
16
16
  @godown(protoName)
17
- @styles(
18
- css`
19
- :host {
20
- ${cssScope}--color: currentColor;
21
- ${cssScope}--color-hover: currentColor;
22
- ${cssScope}--color-active: currentColor;
23
- display: inline-block;
24
- text-overflow: ellipsis;
25
- overflow-wrap: break-word;
26
- }
17
+ @styles(css`
18
+ :host {
19
+ ${cssScope}--color: currentColor;
20
+ ${cssScope}--color-hover: currentColor;
21
+ ${cssScope}--color-active: currentColor;
22
+ display: inline-block;
23
+ text-overflow: ellipsis;
24
+ overflow-wrap: break-word;
25
+ }
27
26
 
28
- [part=root] {
29
- white-space: nowrap;
30
- width: 100%;
31
- vertical-align: bottom;
32
- display: inline-block;
33
- text-overflow: inherit;
34
- overflow-wrap: inherit;
35
- overflow: hidden;
36
- color: var(${cssScope}--color);
37
- }
27
+ [part="root"] {
28
+ white-space: nowrap;
29
+ width: 100%;
30
+ vertical-align: bottom;
31
+ display: inline-block;
32
+ text-overflow: inherit;
33
+ overflow-wrap: inherit;
34
+ overflow: hidden;
35
+ color: var(${cssScope}--color);
36
+ }
38
37
 
39
- [part=root]:hover {
40
- color: var(${cssScope}--color-hover, var(${cssScope}--color));
41
- }
38
+ [part="root"]:hover {
39
+ color: var(${cssScope}--color-hover, var(${cssScope}--color));
40
+ }
42
41
 
43
- [part=root]:active {
44
- color: var(${cssScope}--color-active, var(${cssScope}--color));
45
- }
42
+ [part="root"]:active {
43
+ color: var(${cssScope}--color-active, var(${cssScope}--color));
44
+ }
46
45
 
47
- .hover:hover,
48
- .active:active,
49
- .always {
50
- text-decoration: underline;
51
- }
46
+ .hover:hover,
47
+ .active:active,
48
+ .always {
49
+ text-decoration: underline;
50
+ }
52
51
 
53
- .none {
54
- text-decoration: none;
55
- }
52
+ .none {
53
+ text-decoration: none;
54
+ }
56
55
 
57
- [clip] {
58
- background: var(${cssGlobalVars.clipBackground});
59
- display: inline-block;
60
- color: transparent;
61
- -webkit-text-fill-color: transparent;
62
- background-clip: text;
63
- -webkit-background-clip: text;
64
- }
65
- `,
66
- )
56
+ [clip] {
57
+ background: var(${cssGlobalVars.clipBackground});
58
+ display: inline-block;
59
+ color: transparent;
60
+ -webkit-text-fill-color: transparent;
61
+ background-clip: text;
62
+ -webkit-background-clip: text;
63
+ }
64
+ `)
67
65
  class Text extends GlobalStyle {
68
66
  /**
69
67
  * Underline behavior.
@@ -78,9 +76,15 @@ class Text extends GlobalStyle {
78
76
  clip = false;
79
77
 
80
78
  protected render(): TemplateResult<1> {
81
- return html`<span part="root" ${attr(this.observedRecord)} class="${classList(this.underline)}">
82
- ${htmlSlot()}
83
- </span>`;
79
+ return html`
80
+ <span
81
+ part="root"
82
+ ${attr(this.observedRecord)}
83
+ class="${classList(this.underline)}"
84
+ >
85
+ ${htmlSlot()}
86
+ </span>
87
+ `;
84
88
  }
85
89
  }
86
90