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,6 +1,6 @@
1
1
  import { attr, godown, styles } from "@godown/element";
2
2
  import fmtime from "fmtime";
3
- import { css, html, type PropertyValues, type TemplateResult } from "lit";
3
+ import { type PropertyValues, type TemplateResult, css, html } from "lit";
4
4
  import { property } from "lit/decorators.js";
5
5
 
6
6
  import { GlobalStyle } from "../core/global-style.js";
@@ -14,7 +14,11 @@ const protoName = "time";
14
14
  * @category display
15
15
  */
16
16
  @godown(protoName)
17
- @styles(css`:host{text-align: center;}`)
17
+ @styles(css`
18
+ :host {
19
+ text-align: center;
20
+ }
21
+ `)
18
22
  class Time extends GlobalStyle {
19
23
  /**
20
24
  * Escape symbol.
@@ -49,7 +53,14 @@ class Time extends GlobalStyle {
49
53
  protected timeoutId: number;
50
54
 
51
55
  protected render(): TemplateResult<1> {
52
- return html`<span part="root" ${attr(this.observedRecord)}>${fmtime(this.format, this.time, this.escape)}</span>`;
56
+ return html`
57
+ <span
58
+ part="root"
59
+ ${attr(this.observedRecord)}
60
+ >
61
+ ${fmtime(this.format, this.time, this.escape)}
62
+ </span>
63
+ `;
53
64
  }
54
65
 
55
66
  protected firstUpdated(): void {
@@ -1,5 +1,5 @@
1
1
  import { attr, 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
5
  import { scopePrefix } from "../core/global-style.js";
@@ -24,19 +24,19 @@ const cssScope = scopePrefix(protoName);
24
24
  ${cssScope}--tip-background: inherit;
25
25
  width: fit-content;
26
26
  }
27
-
27
+
28
28
  :host,
29
- [part=root] {
29
+ [part="root"] {
30
30
  display: inline-flex;
31
31
  }
32
32
 
33
- [part=root] {
33
+ [part="root"] {
34
34
  position: relative;
35
35
  transition: inherit;
36
36
  border-radius: inherit;
37
37
  }
38
38
 
39
- [part=tip] {
39
+ [part="tip"] {
40
40
  width: fit-content;
41
41
  height: fit-content;
42
42
  position: absolute;
@@ -45,7 +45,7 @@ const cssScope = scopePrefix(protoName);
45
45
  user-select: none;
46
46
  }
47
47
 
48
- :host([open]) [part=tip] {
48
+ :host([open]) [part="tip"] {
49
49
  visibility: visible;
50
50
  }
51
51
 
@@ -53,24 +53,24 @@ const cssScope = scopePrefix(protoName);
53
53
  background: var(${cssScope}--tip-background);
54
54
  }
55
55
 
56
- [propagation] [part=tip] {
56
+ [propagation] [part="tip"] {
57
57
  pointer-events: none;
58
58
  }
59
59
  `,
60
60
  css`
61
- [direction^=top] [part=tip] {
61
+ [direction^="top"] [part="tip"] {
62
62
  bottom: 100%;
63
63
  }
64
64
 
65
- [direction^=bottom] [part=tip] {
65
+ [direction^="bottom"] [part="tip"] {
66
66
  top: 100%;
67
67
  }
68
68
 
69
- [direction$=right] [part=tip] {
69
+ [direction$="right"] [part="tip"] {
70
70
  left: 100%;
71
71
  }
72
72
 
73
- [direction$=left] [part=tip] {
73
+ [direction$="left"] [part="tip"] {
74
74
  right: 100%;
75
75
  }
76
76
  `,
@@ -123,19 +123,27 @@ class Tooltip extends SuperOpenable {
123
123
  protected render(): TemplateResult<1> {
124
124
  const align = Tooltip.aligns[this.align] || "inherit";
125
125
  const isFocusable = this.type === "focus";
126
- return html`<div
127
- part="root"
128
- ${attr(this.observedRecord)}
129
- tabindex="${isFocusable ? 0 : -1}"
130
- @focus="${isFocusable ? () => (this.open = true) : null}"
131
- @blur="${isFocusable ? () => (this.open = false) : null}"
132
- @mouseenter="${isFocusable ? null : () => (this.open = true)}"
133
- @mouseleave="${isFocusable ? null : () => (this.open = false)}"
134
- style="justify-content:${align};align-items:${align}"
135
- >
136
- ${htmlSlot()}
137
- <div part="tip">${this.tip ? html`<span class="passive">${this.tip}</span>` : htmlSlot("tip")}</div>
138
- </div>`;
126
+ return html`
127
+ <div
128
+ part="root"
129
+ ${attr(this.observedRecord)}
130
+ tabindex="${isFocusable ? 0 : -1}"
131
+ @focus="${isFocusable ? () => (this.open = true) : null}"
132
+ @blur="${isFocusable ? () => (this.open = false) : null}"
133
+ @mouseenter="${isFocusable ? null : () => (this.open = true)}"
134
+ @mouseleave="${isFocusable ? null : () => (this.open = false)}"
135
+ style="justify-content:${align};align-items:${align}"
136
+ >
137
+ ${htmlSlot()}
138
+ <div part="tip">
139
+ ${this.tip
140
+ ? html`
141
+ <span class="passive">${this.tip}</span>
142
+ `
143
+ : htmlSlot("tip")}
144
+ </div>
145
+ </div>
146
+ `;
139
147
  }
140
148
  }
141
149
 
@@ -1,5 +1,5 @@
1
1
  import { attr, godown, htmlSlot, random, styles } from "@godown/element";
2
- import { css, html, type PropertyValueMap, type TemplateResult } from "lit";
2
+ import { type PropertyValueMap, type TemplateResult, css, html } from "lit";
3
3
  import { property, query, state } from "lit/decorators.js";
4
4
 
5
5
  import { GlobalStyle, scopePrefix } from "../core/global-style.js";
@@ -13,37 +13,35 @@ const cssScope = scopePrefix(protoName);
13
13
  * @category effect
14
14
  */
15
15
  @godown(protoName)
16
- @styles(
17
- css`
18
- :host {
19
- ${cssScope}--cursor-width: .05em;
20
- }
16
+ @styles(css`
17
+ :host {
18
+ ${cssScope}--cursor-width: .05em;
19
+ }
21
20
 
22
- :host,
23
- :host([contents]) [part="root"] {
24
- display: inline-block;
25
- }
21
+ :host,
22
+ :host([contents]) [part="root"] {
23
+ display: inline-block;
24
+ }
26
25
 
27
- i {
28
- border-right: var(${cssScope}--cursor-width) solid;
29
- margin-left: 0.02em;
30
- animation: s 1.5s steps(1) infinite;
31
- }
26
+ i {
27
+ border-right: var(${cssScope}--cursor-width) solid;
28
+ margin-left: 0.02em;
29
+ animation: s 1.5s steps(1) infinite;
30
+ }
32
31
 
33
- @keyframes s {
34
- 0% {
35
- border-color: currentColor;
36
- }
37
- 50% {
38
- border-color: transparent;
39
- }
32
+ @keyframes s {
33
+ 0% {
34
+ border-color: currentColor;
40
35
  }
41
-
42
- slot {
43
- display: none;
36
+ 50% {
37
+ border-color: transparent;
44
38
  }
45
- `,
46
- )
39
+ }
40
+
41
+ slot {
42
+ display: none;
43
+ }
44
+ `)
47
45
  class Typewriter extends GlobalStyle {
48
46
  /**
49
47
  * Raw text.
@@ -97,10 +95,18 @@ class Typewriter extends GlobalStyle {
97
95
  }
98
96
 
99
97
  protected render(): TemplateResult<1> {
100
- return html`<div part="root" ${attr(this.observedRecord)}>
101
- ${htmlSlot()} ${this.contentInternal}
102
- <i part="cursor" ?hidden="${this.ended}"></i>
103
- </div>`;
98
+ return html`
99
+ <div
100
+ part="root"
101
+ ${attr(this.observedRecord)}
102
+ >
103
+ ${htmlSlot()} ${this.contentInternal}
104
+ <i
105
+ part="cursor"
106
+ ?hidden="${this.ended}"
107
+ ></i>
108
+ </div>
109
+ `;
104
110
  }
105
111
 
106
112
  protected firstUpdated(): void {
@@ -1,10 +1,9 @@
1
1
  import { type Gradients, presetsRGB } from "@godown/colors/presets-rgb.js";
2
2
  import { travel } from "@godown/colors/travel.js";
3
3
  import { GodownElement, joinProperties, trim } from "@godown/element";
4
- import { css, type CSSResult, unsafeCSS } from "lit";
4
+ import { type CSSResult, css, unsafeCSS } from "lit";
5
5
 
6
- export class GlobalStyle extends GodownElement {
7
- }
6
+ export class GlobalStyle extends GodownElement {}
8
7
 
9
8
  const cssvar = trim(GlobalStyle.godownConfig.prefix, "-");
10
9
 
@@ -41,25 +40,25 @@ export const cssGlobalVars: {
41
40
  type PresetsGradientsCSSResult = Record<keyof typeof presetsRGB, Gradients<CSSResult>>;
42
41
  GlobalStyle.styles = [
43
42
  unsafeCSS(
44
- ":host{"
45
- + `${cssGlobalVars.black}:rgb(0 0 0);`
46
- + `${cssGlobalVars.white}:rgb(255 255 255);`
47
- + travel((key, gradient, rgb) => {
43
+ ":host{" +
44
+ `${cssGlobalVars.black}:rgb(0 0 0);` +
45
+ `${cssGlobalVars.white}:rgb(255 255 255);` +
46
+ travel((key, gradient, rgb) => {
48
47
  cssGlobalVars._colors[key] ||= [] as any;
49
48
  cssGlobalVars._colors[key].push(unsafeCSS(scopePrefix("color", 2) + "-" + key + "-" + gradient));
50
49
  const endKey = `-${key}-${gradient}`;
51
50
  const colorKey = scopePrefix("color", 2) + endKey;
52
51
  return `${colorKey}:rgb(${rgb});`;
53
- }, presetsRGB).join("")
54
- + joinProperties({
52
+ }, presetsRGB).join("") +
53
+ joinProperties({
55
54
  [cssGlobalVars.background + ""]: `var(${cssGlobalVars._colors.darkgray[9]})`,
56
55
  [cssGlobalVars.foreground + ""]: `var(${cssGlobalVars._colors.lightgray[0]})`,
57
56
  [cssGlobalVars.active + ""]: `var(${cssGlobalVars._colors.blue[6]})`,
58
57
  [cssGlobalVars.passive + ""]: `var(${cssGlobalVars._colors.darkgray[6]})`,
59
58
  [cssGlobalVars.clipBackground + ""]:
60
59
  `linear-gradient(to bottom, var(${cssGlobalVars.foreground}), var(${cssGlobalVars.passive}))`,
61
- })
62
- + "}",
60
+ }) +
61
+ "}",
63
62
  ),
64
63
  css`
65
64
  * {
@@ -92,7 +91,7 @@ GlobalStyle.styles = [
92
91
  display: contents;
93
92
  }
94
93
 
95
- :where(:host([contents]) [part=root]) {
94
+ :where(:host([contents]) [part="root"]) {
96
95
  all: inherit;
97
96
  display: revert;
98
97
  }
@@ -1,30 +1,28 @@
1
1
  import { attr, htmlSlot, styles } from "@godown/element";
2
- import { css, html, nothing, type TemplateResult } from "lit";
2
+ import { type TemplateResult, css, html, nothing } from "lit";
3
3
  import { property } from "lit/decorators.js";
4
4
 
5
5
  import { GlobalStyle } from "./global-style.js";
6
6
 
7
- @styles(
8
- css`
9
- :host {
10
- display: inline-block;
11
- color: currentColor;
12
- text-decoration: none;
13
- cursor: default;
14
- }
7
+ @styles(css`
8
+ :host {
9
+ display: inline-block;
10
+ color: currentColor;
11
+ text-decoration: none;
12
+ cursor: default;
13
+ }
15
14
 
16
- :host([href]) {
17
- cursor: pointer;
18
- }
15
+ :host([href]) {
16
+ cursor: pointer;
17
+ }
19
18
 
20
- [part=root] {
21
- width: 100%;
22
- color: inherit;
23
- display: inline-block;
24
- text-decoration: inherit;
25
- }
26
- `,
27
- )
19
+ [part="root"] {
20
+ width: 100%;
21
+ color: inherit;
22
+ display: inline-block;
23
+ text-decoration: inherit;
24
+ }
25
+ `)
28
26
  class SuperAnchor extends GlobalStyle {
29
27
  /**
30
28
  * A element href.
@@ -38,18 +36,19 @@ class SuperAnchor extends GlobalStyle {
38
36
  target: "_blank" | "_self" | "_parent" | "_top" = "_self";
39
37
 
40
38
  protected render(): TemplateResult<1> {
41
- return html`<a
42
- part="root"
43
- ${attr(this.observedRecord)}
44
- href="${this.href || nothing}"
45
- target="${this.target}"
46
- @click=${this._handleClick}
47
- >
48
- ${htmlSlot()}
49
- </a>`;
39
+ return html`
40
+ <a
41
+ part="root"
42
+ ${attr(this.observedRecord)}
43
+ href="${this.href || nothing}"
44
+ target="${this.target}"
45
+ @click=${this._handleClick}
46
+ >
47
+ ${htmlSlot()}
48
+ </a>
49
+ `;
50
50
  }
51
51
 
52
- // eslint-disable-next-line
53
52
  protected _handleClick(_: MouseEvent): void {}
54
53
  }
55
54
 
@@ -1,79 +1,79 @@
1
- import { type HandlerEvent, htmlSlot, part, styles } from "@godown/element";
1
+ import { type HandlerEvent, htmlSlot, omit, part, styles } from "@godown/element";
2
2
  import iconEyeSlashFill from "@godown/f7-icon/icons/eye-slash-fill.js";
3
- import { css, html, type TemplateResult } from "lit";
3
+ import { type TemplateResult, css, html } from "lit";
4
4
  import { property } from "lit/decorators.js";
5
5
 
6
- import { cssGlobalVars, GlobalStyle } from "./global-style.js";
6
+ import { GlobalStyle, cssGlobalVars } from "./global-style.js";
7
7
 
8
8
  const fieldStyle = css`
9
- .input-field {
10
- display: flex;
11
- position: relative;
12
- align-items: center;
13
- border-radius: inherit;
14
- height: inherit;
15
- }
9
+ .input-field {
10
+ display: flex;
11
+ position: relative;
12
+ align-items: center;
13
+ border-radius: inherit;
14
+ height: inherit;
15
+ }
16
16
 
17
- .input-field [part=input] {
18
- background: transparent;
19
- height: 100%;
20
- width: 100%;
21
- color: inherit;
22
- padding: 0 var(${cssGlobalVars.input}-space);
23
- }
17
+ .input-field [part="input"] {
18
+ background: transparent;
19
+ height: 100%;
20
+ width: 100%;
21
+ color: inherit;
22
+ padding: 0 var(${cssGlobalVars.input}-space);
23
+ }
24
24
 
25
- .input-field:focus-within,
26
- .input-field.outline {
27
- box-shadow: var(${cssGlobalVars.input}-box-shadow);
28
- }
25
+ .input-field:focus-within,
26
+ .input-field.outline {
27
+ box-shadow: var(${cssGlobalVars.input}-box-shadow);
28
+ }
29
29
 
30
- .input-field [part=icon] {
31
- display: flex;
32
- align-items: center;
33
- justify-content: center;
34
- }
30
+ .input-field [part="icon"] {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ }
35
35
 
36
- .input-field [part=prefix],
37
- .input-field [part=suffix] {
38
- height: 100%;
39
- display: flex;
40
- }
36
+ .input-field [part="prefix"],
37
+ .input-field [part="suffix"] {
38
+ height: 100%;
39
+ display: flex;
40
+ }
41
41
 
42
- .input-field [part=suffix] [part=icon] {
43
- padding-inline-end: var(${cssGlobalVars.input}-space);
44
- }
42
+ .input-field [part="suffix"] [part="icon"] {
43
+ padding-inline-end: var(${cssGlobalVars.input}-space);
44
+ }
45
45
 
46
- .input-field [part=prefix] [part=icon] {
47
- padding-inline-start: var(${cssGlobalVars.input}-space);
48
- }
46
+ .input-field [part="prefix"] [part="icon"] {
47
+ padding-inline-start: var(${cssGlobalVars.input}-space);
48
+ }
49
49
  `;
50
50
 
51
51
  const inputStyle = css`
52
- :host {
53
- ${cssGlobalVars.input}-width: 10em;
54
- ${cssGlobalVars.input}-height: 1.6em;
55
- ${cssGlobalVars.input}-space: 0.2em;
56
- ${cssGlobalVars.input}-background: var(${cssGlobalVars.background});
57
- ${cssGlobalVars.input}-control: var(${cssGlobalVars.foreground});
58
- ${cssGlobalVars.input}-control-edge: var(${cssGlobalVars.active});
59
- ${cssGlobalVars.input}-radius: 0.2em;
60
- ${cssGlobalVars.input}-box-shadow: 0px 0px 0px .1em var(${cssGlobalVars.active});
61
- border-radius: var(${cssGlobalVars.input}-radius);
62
- }
52
+ :host {
53
+ ${cssGlobalVars.input}-width: 10em;
54
+ ${cssGlobalVars.input}-height: 1.6em;
55
+ ${cssGlobalVars.input}-space: 0.2em;
56
+ ${cssGlobalVars.input}-background: var(${cssGlobalVars.background});
57
+ ${cssGlobalVars.input}-control: var(${cssGlobalVars.foreground});
58
+ ${cssGlobalVars.input}-control-edge: var(${cssGlobalVars.active});
59
+ ${cssGlobalVars.input}-radius: 0.2em;
60
+ ${cssGlobalVars.input}-box-shadow: 0px 0px 0px .1em var(${cssGlobalVars.active});
61
+ border-radius: var(${cssGlobalVars.input}-radius);
62
+ }
63
63
 
64
- :host([disabled]) {
65
- cursor: not-allowed;
66
- filter: brightness(0.85);
67
- }
64
+ :host([disabled]) {
65
+ cursor: not-allowed;
66
+ filter: brightness(0.85);
67
+ }
68
68
 
69
- input:disabled {
70
- cursor: inherit;
71
- }
69
+ input:disabled {
70
+ cursor: inherit;
71
+ }
72
72
 
73
- input::-ms-reveal,
74
- input::-ms-clear {
75
- display: none;
76
- }
73
+ input::-ms-reveal,
74
+ input::-ms-clear {
75
+ display: none;
76
+ }
77
77
  `;
78
78
 
79
79
  @styles(fieldStyle, inputStyle)
@@ -97,6 +97,10 @@ class SuperInput extends GlobalStyle {
97
97
  @property()
98
98
  value: any;
99
99
 
100
+ get observedRecord(): Record<string, any> {
101
+ return omit(super.observedRecord, "default", "value");
102
+ }
103
+
100
104
  /**
101
105
  * default property records the default or initial value and is used to reset the input.
102
106
  */
@@ -161,7 +165,7 @@ class SuperInput extends GlobalStyle {
161
165
 
162
166
  protected _compositionInit(): void {
163
167
  if (this._input) {
164
- this.events.add(this._input, "compositionstart", () => this.compositing = true);
168
+ this.events.add(this._input, "compositionstart", () => (this.compositing = true));
165
169
  this.events.add(this._input, "compositionend", (e: HandlerEvent<HTMLInputElement>) => {
166
170
  this.compositing = false;
167
171
  this._handleInput(e);
@@ -184,24 +188,37 @@ class SuperInput extends GlobalStyle {
184
188
  }
185
189
 
186
190
  protected _renderPrefix(): TemplateResult<1> {
187
- return html`<label for=${this.makeId} part="prefix">
188
- ${htmlSlot("prefix")}</label>`;
191
+ return html`
192
+ <label
193
+ for=${this.makeId}
194
+ part="prefix"
195
+ >
196
+ ${htmlSlot("prefix")}
197
+ </label>
198
+ `;
189
199
  }
190
200
 
191
201
  protected _renderSuffix(): TemplateResult<1> {
192
202
  const PASSWORD = "password";
193
- return html`<label for=${this.makeId} part="suffix">${
194
- this.type === "password"
195
- ? html`
196
- <i
197
- part="icon"
198
- @mousedown="${() => this._changeInputType("text")}"
199
- @mouseup="${() => this._changeInputType(PASSWORD)}"
200
- @mouseleave="${() => this._changeInputType(PASSWORD)}"
201
- >${iconEyeSlashFill()}</i>`
202
- : htmlSlot("suffix")
203
- }
204
- </label>`;
203
+ return html`
204
+ <label
205
+ for=${this.makeId}
206
+ part="suffix"
207
+ >
208
+ ${this.type === "password"
209
+ ? html`
210
+ <i
211
+ part="icon"
212
+ @mousedown="${() => this._changeInputType("text")}"
213
+ @mouseup="${() => this._changeInputType(PASSWORD)}"
214
+ @mouseleave="${() => this._changeInputType(PASSWORD)}"
215
+ >
216
+ ${iconEyeSlashFill()}
217
+ </i>
218
+ `
219
+ : htmlSlot("suffix")}
220
+ </label>
221
+ `;
205
222
  }
206
223
  }
207
224
 
@@ -10,7 +10,7 @@ class SuperOpenable extends GlobalStyle {
10
10
  @property({ type: Boolean, reflect: true })
11
11
  open = false;
12
12
 
13
- toggle(to: boolean = (!this.open) satisfies boolean): void {
13
+ toggle(to: boolean = !this.open satisfies boolean): void {
14
14
  this.open = to;
15
15
  }
16
16
 
@@ -29,7 +29,6 @@ class SuperOpenable extends GlobalStyle {
29
29
  }
30
30
  }
31
31
 
32
- // eslint-disable-next-line
33
32
  protected _handelClick(_: MouseEvent): void {
34
33
  this.toggle();
35
34
  }
@@ -41,11 +40,6 @@ export type Direction4 = "left" | "right" | "top" | "bottom";
41
40
 
42
41
  export type Direction5 = Direction4 | "center";
43
42
 
44
- export type Direction8 =
45
- | Direction4
46
- | "top-left"
47
- | "top-right"
48
- | "bottom-left"
49
- | "bottom-right";
43
+ export type Direction8 = Direction4 | "top-left" | "top-right" | "bottom-left" | "bottom-right";
50
44
 
51
45
  export type Direction9 = Direction8 | Direction5;