godown 3.0.0 → 3.0.1

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 (246) 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.map +1 -1
  37. package/components/dialog.js +1 -1
  38. package/components/dialog.js.map +1 -1
  39. package/components/divider.d.ts.map +1 -1
  40. package/components/divider.js +1 -1
  41. package/components/divider.js.map +1 -1
  42. package/components/dragbox.d.ts.map +1 -1
  43. package/components/dragbox.js +1 -1
  44. package/components/dragbox.js.map +1 -1
  45. package/components/flex.d.ts.map +1 -1
  46. package/components/flex.js.map +1 -1
  47. package/components/form.d.ts.map +1 -1
  48. package/components/form.js.map +1 -1
  49. package/components/grid.d.ts.map +1 -1
  50. package/components/grid.js.map +1 -1
  51. package/components/heading.d.ts.map +1 -1
  52. package/components/heading.js +1 -1
  53. package/components/heading.js.map +1 -1
  54. package/components/input.d.ts.map +1 -1
  55. package/components/input.js +1 -1
  56. package/components/input.js.map +1 -1
  57. package/components/layout.d.ts.map +1 -1
  58. package/components/layout.js +1 -1
  59. package/components/layout.js.map +1 -1
  60. package/components/link.js.map +1 -1
  61. package/components/progress.d.ts.map +1 -1
  62. package/components/progress.js +1 -1
  63. package/components/progress.js.map +1 -1
  64. package/components/range.d.ts.map +1 -1
  65. package/components/range.js +1 -1
  66. package/components/range.js.map +1 -1
  67. package/components/rotate.d.ts.map +1 -1
  68. package/components/rotate.js +1 -1
  69. package/components/rotate.js.map +1 -1
  70. package/components/router.d.ts +20 -25
  71. package/components/router.d.ts.map +1 -1
  72. package/components/router.js +1 -1
  73. package/components/router.js.map +1 -1
  74. package/components/select.d.ts.map +1 -1
  75. package/components/select.js +1 -1
  76. package/components/select.js.map +1 -1
  77. package/components/skeleton.d.ts.map +1 -1
  78. package/components/skeleton.js +1 -1
  79. package/components/skeleton.js.map +1 -1
  80. package/components/split.d.ts.map +1 -1
  81. package/components/split.js +1 -1
  82. package/components/split.js.map +1 -1
  83. package/components/switch.d.ts.map +1 -1
  84. package/components/switch.js +1 -1
  85. package/components/switch.js.map +1 -1
  86. package/components/text.d.ts.map +1 -1
  87. package/components/text.js +1 -1
  88. package/components/text.js.map +1 -1
  89. package/components/time.d.ts.map +1 -1
  90. package/components/time.js.map +1 -1
  91. package/components/tooltip.d.ts.map +1 -1
  92. package/components/tooltip.js +1 -1
  93. package/components/tooltip.js.map +1 -1
  94. package/components/typewriter.d.ts.map +1 -1
  95. package/components/typewriter.js +1 -1
  96. package/components/typewriter.js.map +1 -1
  97. package/core/global-style.d.ts.map +1 -1
  98. package/core/global-style.js +1 -1
  99. package/core/global-style.js.map +1 -1
  100. package/core/super-anchor.d.ts.map +1 -1
  101. package/core/super-anchor.js +1 -1
  102. package/core/super-anchor.js.map +1 -1
  103. package/core/super-input.d.ts.map +1 -1
  104. package/core/super-input.js +1 -1
  105. package/core/super-input.js.map +1 -1
  106. package/core/super-openable.d.ts.map +1 -1
  107. package/core/super-openable.js.map +1 -1
  108. package/custom-elements.json +1 -1
  109. package/dev/components/alert.d.ts.map +1 -1
  110. package/dev/components/alert.js +82 -69
  111. package/dev/components/alert.js.map +1 -1
  112. package/dev/components/avatar.d.ts.map +1 -1
  113. package/dev/components/avatar.js +52 -36
  114. package/dev/components/avatar.js.map +1 -1
  115. package/dev/components/badge.d.ts.map +1 -1
  116. package/dev/components/badge.js +57 -50
  117. package/dev/components/badge.js.map +1 -1
  118. package/dev/components/breath.d.ts.map +1 -1
  119. package/dev/components/breath.js +20 -14
  120. package/dev/components/breath.js.map +1 -1
  121. package/dev/components/button.d.ts.map +1 -1
  122. package/dev/components/button.js +13 -10
  123. package/dev/components/button.js.map +1 -1
  124. package/dev/components/card.d.ts.map +1 -1
  125. package/dev/components/card.js +40 -35
  126. package/dev/components/card.js.map +1 -1
  127. package/dev/components/carousel.d.ts.map +1 -1
  128. package/dev/components/carousel.js +63 -43
  129. package/dev/components/carousel.js.map +1 -1
  130. package/dev/components/details.d.ts.map +1 -1
  131. package/dev/components/details.js +72 -61
  132. package/dev/components/details.js.map +1 -1
  133. package/dev/components/dialog.d.ts.map +1 -1
  134. package/dev/components/dialog.js +61 -57
  135. package/dev/components/dialog.js.map +1 -1
  136. package/dev/components/divider.d.ts.map +1 -1
  137. package/dev/components/divider.js +28 -23
  138. package/dev/components/divider.js.map +1 -1
  139. package/dev/components/dragbox.d.ts.map +1 -1
  140. package/dev/components/dragbox.js +19 -17
  141. package/dev/components/dragbox.js.map +1 -1
  142. package/dev/components/flex.d.ts.map +1 -1
  143. package/dev/components/flex.js +16 -11
  144. package/dev/components/flex.js.map +1 -1
  145. package/dev/components/form.d.ts.map +1 -1
  146. package/dev/components/form.js +4 -4
  147. package/dev/components/form.js.map +1 -1
  148. package/dev/components/grid.d.ts.map +1 -1
  149. package/dev/components/grid.js +16 -11
  150. package/dev/components/grid.js.map +1 -1
  151. package/dev/components/heading.d.ts.map +1 -1
  152. package/dev/components/heading.js +62 -40
  153. package/dev/components/heading.js.map +1 -1
  154. package/dev/components/input.d.ts.map +1 -1
  155. package/dev/components/input.js +32 -24
  156. package/dev/components/input.js.map +1 -1
  157. package/dev/components/layout.d.ts.map +1 -1
  158. package/dev/components/layout.js +43 -30
  159. package/dev/components/layout.js.map +1 -1
  160. package/dev/components/link.js +1 -1
  161. package/dev/components/link.js.map +1 -1
  162. package/dev/components/progress.d.ts.map +1 -1
  163. package/dev/components/progress.js +51 -42
  164. package/dev/components/progress.js.map +1 -1
  165. package/dev/components/range.d.ts.map +1 -1
  166. package/dev/components/range.js +33 -30
  167. package/dev/components/range.js.map +1 -1
  168. package/dev/components/rotate.d.ts.map +1 -1
  169. package/dev/components/rotate.js +12 -5
  170. package/dev/components/rotate.js.map +1 -1
  171. package/dev/components/router.d.ts +20 -25
  172. package/dev/components/router.d.ts.map +1 -1
  173. package/dev/components/router.js +17 -17
  174. package/dev/components/router.js.map +1 -1
  175. package/dev/components/select.d.ts.map +1 -1
  176. package/dev/components/select.js +65 -57
  177. package/dev/components/select.js.map +1 -1
  178. package/dev/components/skeleton.d.ts.map +1 -1
  179. package/dev/components/skeleton.js +65 -61
  180. package/dev/components/skeleton.js.map +1 -1
  181. package/dev/components/split.d.ts.map +1 -1
  182. package/dev/components/split.js +66 -58
  183. package/dev/components/split.js.map +1 -1
  184. package/dev/components/switch.d.ts.map +1 -1
  185. package/dev/components/switch.js +88 -79
  186. package/dev/components/switch.js.map +1 -1
  187. package/dev/components/text.d.ts.map +1 -1
  188. package/dev/components/text.js +51 -45
  189. package/dev/components/text.js.map +1 -1
  190. package/dev/components/time.d.ts.map +1 -1
  191. package/dev/components/time.js +13 -2
  192. package/dev/components/time.js.map +1 -1
  193. package/dev/components/tooltip.d.ts.map +1 -1
  194. package/dev/components/tooltip.js +31 -23
  195. package/dev/components/tooltip.js.map +1 -1
  196. package/dev/components/typewriter.d.ts.map +1 -1
  197. package/dev/components/typewriter.js +35 -27
  198. package/dev/components/typewriter.js.map +1 -1
  199. package/dev/core/global-style.d.ts.map +1 -1
  200. package/dev/core/global-style.js +9 -9
  201. package/dev/core/global-style.js.map +1 -1
  202. package/dev/core/super-anchor.d.ts.map +1 -1
  203. package/dev/core/super-anchor.js +27 -26
  204. package/dev/core/super-anchor.js.map +1 -1
  205. package/dev/core/super-input.d.ts.map +1 -1
  206. package/dev/core/super-input.js +83 -68
  207. package/dev/core/super-input.js.map +1 -1
  208. package/dev/core/super-openable.d.ts.map +1 -1
  209. package/dev/core/super-openable.js +1 -2
  210. package/dev/core/super-openable.js.map +1 -1
  211. package/package.json +5 -5
  212. package/src/components/alert.ts +84 -75
  213. package/src/components/avatar.ts +54 -40
  214. package/src/components/badge.ts +68 -65
  215. package/src/components/breath.ts +23 -19
  216. package/src/components/button.ts +14 -11
  217. package/src/components/card.ts +42 -40
  218. package/src/components/carousel.ts +65 -47
  219. package/src/components/details.ts +74 -65
  220. package/src/components/dialog.ts +64 -62
  221. package/src/components/divider.ts +33 -30
  222. package/src/components/dragbox.ts +22 -22
  223. package/src/components/flex.ts +31 -28
  224. package/src/components/form.ts +7 -9
  225. package/src/components/grid.ts +31 -28
  226. package/src/components/heading.ts +67 -49
  227. package/src/components/input.ts +37 -31
  228. package/src/components/layout.ts +45 -34
  229. package/src/components/link.ts +1 -1
  230. package/src/components/progress.ts +53 -46
  231. package/src/components/range.ts +58 -52
  232. package/src/components/rotate.ts +15 -10
  233. package/src/components/router.ts +40 -45
  234. package/src/components/select.ts +74 -70
  235. package/src/components/skeleton.ts +67 -65
  236. package/src/components/split.ts +73 -69
  237. package/src/components/switch.ts +90 -83
  238. package/src/components/text.ts +53 -49
  239. package/src/components/time.ts +14 -3
  240. package/src/components/tooltip.ts +32 -24
  241. package/src/components/typewriter.ts +37 -31
  242. package/src/core/global-style.ts +11 -12
  243. package/src/core/super-anchor.ts +29 -30
  244. package/src/core/super-input.ts +86 -73
  245. package/src/core/super-openable.ts +2 -8
  246. package/web-types.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godown",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Non Composite Web Components Library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -33,8 +33,8 @@
33
33
  "lit": "^3.0.0",
34
34
  "tslib": "^2.7.0",
35
35
  "@godown/colors": "^1.0.0",
36
- "@godown/element": "^1.0.0",
37
- "@godown/f7-icon": "^1.0.0"
36
+ "@godown/f7-icon": "^1.0.0",
37
+ "@godown/element": "^1.0.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
@@ -55,8 +55,8 @@
55
55
  "clean": "tsc --build tsconfig.prod.json --clean",
56
56
  "build": "tsc && tsx build.ts",
57
57
  "build:ts": "tsc",
58
- "fmt": "dprint fmt",
59
- "lint": "eslint . --fix",
58
+ "fmt": "prettier src --write",
59
+ "lint": "biome lint",
60
60
  "manifest": "tsx manifest.ts"
61
61
  }
62
62
  }
@@ -5,12 +5,12 @@ import iconInfoCircle from "@godown/f7-icon/icons/info-circle.js";
5
5
  import iconLightbulb from "@godown/f7-icon/icons/lightbulb.js";
6
6
  import iconQuestionCircle from "@godown/f7-icon/icons/question-circle.js";
7
7
  import iconSlashCircle from "@godown/f7-icon/icons/slash-circle.js";
8
- import iconXmark from "@godown/f7-icon/icons/xmark.js";
9
8
  import iconXmarkCircle from "@godown/f7-icon/icons/xmark-circle.js";
10
- import { css, html, type TemplateResult } from "lit";
9
+ import iconXmark from "@godown/f7-icon/icons/xmark.js";
10
+ import { type TemplateResult, css, html } from "lit";
11
11
  import { property } from "lit/decorators.js";
12
12
 
13
- import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
13
+ import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
14
14
 
15
15
  const protoName = "alert";
16
16
  const cssScope = scopePrefix(protoName);
@@ -110,74 +110,72 @@ const calls = {
110
110
  * @category feedback
111
111
  */
112
112
  @godown(protoName)
113
- @styles(
114
- css`
115
- :host,
116
- :where(:host([contents]) [part=root]) {
117
- border-radius: var(${cssScope}--border-radius);
118
- ${cssScope}--border-radius: .25em;
119
- ${cssScope}--border-width: .075em;
120
- ${cssScope}--blockquote-width: .2em;
121
- ${cssScope}--padding: .5em;
122
- display: block;
123
- width: 100%;
124
- }
113
+ @styles(css`
114
+ :host,
115
+ :where(:host([contents]) [part="root"]) {
116
+ border-radius: var(${cssScope}--border-radius);
117
+ ${cssScope}--border-radius: .25em;
118
+ ${cssScope}--border-width: .075em;
119
+ ${cssScope}--blockquote-width: .2em;
120
+ ${cssScope}--padding: .5em;
121
+ display: block;
122
+ width: 100%;
123
+ }
125
124
 
126
- [part=root] {
127
- --color: var(${cssScope}--color);
128
- color: var(--color);
129
- width: 100%;
130
- transition: 0.25s;
131
- display: flex;
132
- justify-content: space-between;
133
- padding: var(${cssScope}--padding);
134
- border-radius: inherit;
135
- border: var(${cssScope}--border-width) solid var(--color);
136
- background: var(${cssScope}--background);
137
- }
125
+ [part="root"] {
126
+ --color: var(${cssScope}--color);
127
+ color: var(--color);
128
+ width: 100%;
129
+ transition: 0.25s;
130
+ display: flex;
131
+ justify-content: space-between;
132
+ padding: var(${cssScope}--padding);
133
+ border-radius: inherit;
134
+ border: var(${cssScope}--border-width) solid var(--color);
135
+ background: var(${cssScope}--background);
136
+ }
138
137
 
139
- [variant=blockquote] {
140
- border-radius: 0;
141
- border-left: var(${cssScope}--blockquote-width) solid var(--color);
142
- border-bottom: none;
143
- border-right: none;
144
- border-top: none;
145
- background: transparent;
146
- }
138
+ [variant="blockquote"] {
139
+ border-radius: 0;
140
+ border-left: var(${cssScope}--blockquote-width) solid var(--color);
141
+ border-bottom: none;
142
+ border-right: none;
143
+ border-top: none;
144
+ background: transparent;
145
+ }
147
146
 
148
- [part=content] {
149
- color: var(--color);
150
- }
147
+ [part="content"] {
148
+ color: var(--color);
149
+ }
151
150
 
152
- [part=root] {
153
- display: grid;
154
- align-items: center;
155
- grid-template-columns: auto 1fr auto;
156
- grid-template-rows: auto 1fr;
157
- }
151
+ [part="root"] {
152
+ display: grid;
153
+ align-items: center;
154
+ grid-template-columns: auto 1fr auto;
155
+ grid-template-rows: auto 1fr;
156
+ }
158
157
 
159
- [part=title] {
160
- line-height: 2em;
161
- }
158
+ [part="title"] {
159
+ line-height: 2em;
160
+ }
162
161
 
163
- [part=icon] {
164
- display: inline-grid;
165
- align-items: center;
166
- height: 2em;
167
- }
162
+ [part="icon"] {
163
+ display: inline-grid;
164
+ align-items: center;
165
+ height: 2em;
166
+ }
168
167
 
169
- [part=icon] svg {
170
- margin-right: .5em;
171
- width: 1.25em;
172
- height: 1.25em;
173
- }
168
+ [part="icon"] svg {
169
+ margin-right: 0.5em;
170
+ width: 1.25em;
171
+ height: 1.25em;
172
+ }
174
173
 
175
- [part=content] {
176
- grid-row: span 2 / span 2;
177
- line-height: 1.5em;
178
- }
179
- `,
180
- )
174
+ [part="content"] {
175
+ grid-row: span 2 / span 2;
176
+ line-height: 1.5em;
177
+ }
178
+ `)
181
179
  class Alert extends GlobalStyle {
182
180
  /**
183
181
  * If it is a legal value, the icon and preset color will be rendered.
@@ -241,19 +239,30 @@ class Alert extends GlobalStyle {
241
239
  protected render(): TemplateResult<1> {
242
240
  const color = calls[this.call]?.color || this.color;
243
241
  const icon = this.call ? calls[this.call].icon() : htmlSlot("icon");
244
- return html`<div part="root" ${attr(this.observedRecord)}>
245
- <div part="icon">${icon}</div>
246
- <div part="content">
247
- <strong part="title">${this.title || htmlSlot("title")}</strong>
248
- ${this.content || htmlSlot()}
242
+ return html`
243
+ <div
244
+ part="root"
245
+ ${attr(this.observedRecord)}
246
+ >
247
+ <div part="icon">${icon}</div>
248
+ <div part="content">
249
+ <strong part="title">${this.title || htmlSlot("title")}</strong>
250
+ ${this.content || htmlSlot()}
251
+ </div>
252
+ ${this.hideClose || this.variant === "blockquote"
253
+ ? ""
254
+ : html`
255
+ <div
256
+ part="close"
257
+ tabindex="0"
258
+ @click="${this.close}"
259
+ >
260
+ ${iconXmark()}
261
+ </div>
262
+ `}
263
+ ${htmlStyle(this.variant === "dark" ? darkStyles[color] : lightStyles[color])}
249
264
  </div>
250
- ${
251
- !this.hideClose && this.variant !== "blockquote"
252
- ? html`<div part="close" tabindex="0" @click="${this.close}">${iconXmark()}</div>`
253
- : ""
254
- }
255
- ${htmlStyle(this.variant === "light" ? lightStyles[color] : darkStyles[color])}
256
- </div>`;
265
+ `;
257
266
  }
258
267
 
259
268
  close(): void {
@@ -1,5 +1,5 @@
1
1
  import { attr, godown, htmlSlot, omit, 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 { GlobalStyle, scopePrefix } from "../core/global-style.js";
@@ -17,47 +17,45 @@ const cssScope = scopePrefix(protoName);
17
17
  * @category display
18
18
  */
19
19
  @godown(protoName)
20
- @styles(
21
- css`
22
- :host {
23
- ${cssScope}--size: 2em;
24
- width: var(${cssScope}--size);
25
- height: var(${cssScope}--size);
26
- vertical-align: bottom;
27
- }
20
+ @styles(css`
21
+ :host {
22
+ ${cssScope}--size: 2em;
23
+ width: var(${cssScope}--size);
24
+ height: var(${cssScope}--size);
25
+ vertical-align: bottom;
26
+ }
28
27
 
29
- :host,
30
- [part=root] {
31
- display: inline-flex;
32
- }
28
+ :host,
29
+ [part="root"] {
30
+ display: inline-flex;
31
+ }
33
32
 
34
- :host([contents]) [part=root] {
35
- display: inline-flex;
36
- width: inherit;
37
- height: inherit;
38
- }
33
+ :host([contents]) [part="root"] {
34
+ display: inline-flex;
35
+ width: inherit;
36
+ height: inherit;
37
+ }
39
38
 
40
- :host([round]) {
41
- border-radius:50%;
42
- }
39
+ :host([round]) {
40
+ border-radius: 50%;
41
+ }
43
42
 
44
- [part=image] {
45
- width: 100%;
46
- height: 100%;
47
- object-fit: cover;
48
- }
43
+ [part="image"] {
44
+ width: 100%;
45
+ height: 100%;
46
+ object-fit: cover;
47
+ }
49
48
 
50
- [part=root] {
51
- overflow: hidden;
52
- position: relative;
53
- border-radius: inherit;
54
- width: 100%;
55
- height: 100%;
56
- align-items: center;
57
- justify-content: center;
58
- }
59
- `,
60
- )
49
+ [part="root"] {
50
+ overflow: hidden;
51
+ position: relative;
52
+ border-radius: inherit;
53
+ width: 100%;
54
+ height: 100%;
55
+ align-items: center;
56
+ justify-content: center;
57
+ }
58
+ `)
61
59
  class Avatar extends GlobalStyle {
62
60
  /**
63
61
  * Image src.
@@ -78,15 +76,31 @@ class Avatar extends GlobalStyle {
78
76
  round = false;
79
77
 
80
78
  protected render(): TemplateResult<1> {
81
- return html`<div part="root" ${attr(omit(this.observedRecord, "src"))}>${this._renderAvatar()}</div>`;
79
+ return html`
80
+ <div
81
+ part="root"
82
+ ${attr(omit(this.observedRecord, "src"))}
83
+ >
84
+ ${this._renderAvatar()}
85
+ </div>
86
+ `;
82
87
  }
83
88
 
84
89
  private _renderAvatar() {
85
90
  if (this.src) {
86
- return html`<img part="image" src="${this.src}" @error=${this._handleError} alt="${this.name}" />`;
91
+ return html`
92
+ <img
93
+ part="image"
94
+ src="${this.src}"
95
+ alt="${this.name}"
96
+ @error=${this._handleError}
97
+ />
98
+ `;
87
99
  }
88
100
  if (this.name) {
89
- return html`<span part="name">${this.format()}</span>`;
101
+ return html`
102
+ <span part="name">${this.format()}</span>
103
+ `;
90
104
  }
91
105
  return htmlSlot();
92
106
  }
@@ -1,8 +1,8 @@
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
- import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
5
+ import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
6
6
 
7
7
  type Position = "top-right" | "top-left" | "bottom-right" | "bottom-left";
8
8
 
@@ -16,61 +16,59 @@ const cssScope = scopePrefix(protoName);
16
16
  * @category display
17
17
  */
18
18
  @godown(protoName)
19
- @styles(
20
- css`
21
- :host {
22
- ${cssScope}--background: var(${cssGlobalVars.active});
23
- ${cssScope}--offset: 0%;
24
- ${cssScope}--offset-x: var(${cssScope}--offset);
25
- ${cssScope}--offset-y: var(${cssScope}--offset);
26
- }
27
-
28
- :host,
29
- :host([contents]) [part=root] {
30
- display: inline-block;
31
- }
32
-
33
- [part=root] {
34
- position: relative;
35
- }
36
-
37
- [part=badge] {
38
- position: absolute;
39
- font-size: 75%;
40
- padding: 0 0.5em;
41
- user-select: none;
42
- border-radius: calc(infinity * 1px);
43
- transform: translate(-50%, -50%);
44
- left: var(--left);
45
- top: var(--top);
46
- background: var(${cssScope}--background);
47
- }
48
-
49
- [part=badge]:empty {
50
- width: 0.5em;
51
- height: 0.5em;
52
- font-size: 100%;
53
- padding: 0;
54
- border-radius: 50%;
55
- }
56
-
57
- [position^=top] {
58
- --top: calc(0% + var(${cssScope}--offset-y));
59
- }
60
-
61
- [position$=right] {
62
- --left: calc(100% - var(${cssScope}--offset-x));
63
- }
64
-
65
- [position^=bottom] {
66
- --top: calc(100% - var(${cssScope}--offset-y));
67
- }
68
-
69
- [position$=left] {
70
- --left: calc(0% + var(${cssScope}--offset-x));
71
- }
72
- `,
73
- )
19
+ @styles(css`
20
+ :host {
21
+ ${cssScope}--background: var(${cssGlobalVars.active});
22
+ ${cssScope}--offset: 0%;
23
+ ${cssScope}--offset-x: var(${cssScope}--offset);
24
+ ${cssScope}--offset-y: var(${cssScope}--offset);
25
+ }
26
+
27
+ :host,
28
+ :host([contents]) [part="root"] {
29
+ display: inline-block;
30
+ }
31
+
32
+ [part="root"] {
33
+ position: relative;
34
+ }
35
+
36
+ [part="badge"] {
37
+ position: absolute;
38
+ font-size: 75%;
39
+ padding: 0 0.5em;
40
+ user-select: none;
41
+ border-radius: calc(infinity * 1px);
42
+ transform: translate(-50%, -50%);
43
+ left: var(--left);
44
+ top: var(--top);
45
+ background: var(${cssScope}--background);
46
+ }
47
+
48
+ [part="badge"]:empty {
49
+ width: 0.5em;
50
+ height: 0.5em;
51
+ font-size: 100%;
52
+ padding: 0;
53
+ border-radius: 50%;
54
+ }
55
+
56
+ [position^="top"] {
57
+ --top: calc(0% + var(${cssScope}--offset-y));
58
+ }
59
+
60
+ [position$="right"] {
61
+ --left: calc(100% - var(${cssScope}--offset-x));
62
+ }
63
+
64
+ [position^="bottom"] {
65
+ --top: calc(100% - var(${cssScope}--offset-y));
66
+ }
67
+
68
+ [position$="left"] {
69
+ --left: calc(0% + var(${cssScope}--offset-x));
70
+ }
71
+ `)
74
72
  class Badge extends GlobalStyle {
75
73
  @property()
76
74
  position: Position = "top-right";
@@ -92,14 +90,19 @@ class Badge extends GlobalStyle {
92
90
  }
93
91
 
94
92
  render(): TemplateResult<1> {
95
- return html`<div part="root" ${attr(this.observedRecord)}>
96
- ${htmlSlot()}
97
- ${
98
- this.value || this.dot
99
- ? html`<div part="badge">${this.dot ? "" : this.formatValue(this.value)}</div>`
100
- : ""
101
- }
102
- </div>`;
93
+ return html`
94
+ <div
95
+ part="root"
96
+ ${attr(this.observedRecord)}
97
+ >
98
+ ${htmlSlot()}
99
+ ${this.value || this.dot
100
+ ? html`
101
+ <div part="badge">${this.dot ? "" : this.formatValue(this.value)}</div>
102
+ `
103
+ : ""}
104
+ </div>
105
+ `;
103
106
  }
104
107
  }
105
108
 
@@ -1,8 +1,8 @@
1
1
  import { attr, godown, htmlStyle, 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 defineName = "breath";
8
8
  const cssScope = scopePrefix(defineName);
@@ -48,11 +48,11 @@ const cssScope = scopePrefix(defineName);
48
48
  }
49
49
 
50
50
  :host,
51
- :host([contents]) [part=root] {
51
+ :host([contents]) [part="root"] {
52
52
  display: flex;
53
53
  }
54
54
 
55
- [part=root] {
55
+ [part="root"] {
56
56
  display: contents;
57
57
  }
58
58
 
@@ -108,16 +108,23 @@ class Breath extends GlobalStyle {
108
108
 
109
109
  protected render(): TemplateResult<1> {
110
110
  const texts = this.getTexts();
111
- return html`<div part="root" ${attr(this.observedRecord)}>
112
- ${[texts.map(this.renderText), htmlStyle(this._computeStyle(texts.length))]}
113
- </div>`;
111
+ return html`
112
+ <div
113
+ part="root"
114
+ ${attr(this.observedRecord)}
115
+ >
116
+ ${[texts.map(this.renderText), htmlStyle(this._computeStyle(texts.length))]}
117
+ </div>
118
+ `;
114
119
  }
115
120
 
116
121
  protected renderText(text: string): TemplateResult<1> {
117
- return html`<span class="rel">
118
- <span class="nocolor">${text}</span>
119
- <span class="colorful">${text}</span>
120
- </span>`;
122
+ return html`
123
+ <span class="rel">
124
+ <span class="nocolor">${text}</span>
125
+ <span class="colorful">${text}</span>
126
+ </span>
127
+ `;
121
128
  }
122
129
 
123
130
  protected getTexts(): string[] {
@@ -129,16 +136,13 @@ class Breath extends GlobalStyle {
129
136
  const duration = this.parseDuration() || len * 2 + 2;
130
137
  let style1 = "";
131
138
  for (let number = 1; number <= len; number++) {
132
- const delay = -duration / len * (len - number + 1);
139
+ const delay = (-duration / len) * (len - number + 1);
133
140
  const defaultNumber = ((number - 1) % 3) + 1;
134
- style1 +=
135
- `.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
141
+ style1 += `.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
136
142
  }
137
- return (
138
- `.colorful{animation-duration:${duration}s;}@keyframes colorfulN{0%,${gap * 3}%{opacity:0;}${gap}%,${
139
- gap * 2
140
- }%{opacity:1;}}${style1}`
141
- );
143
+ return `.colorful{animation-duration:${duration}s;}@keyframes colorfulN{0%,${gap * 3}%{opacity:0;}${gap}%,${
144
+ gap * 2
145
+ }%{opacity:1;}}${style1}`;
142
146
  }
143
147
 
144
148
  protected parseDuration(): number | undefined {
@@ -1,8 +1,8 @@
1
1
  import { attr, constructCSSObject, godown, htmlSlot, htmlStyle, part, styles, toVar } 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 = "button";
8
8
  const cssScope = scopePrefix(protoName);
@@ -106,7 +106,7 @@ const colors: Record<Colors, string> = constructCSSObject(
106
106
 
107
107
  :host([ghost]) {
108
108
  ${cssScope}--modal-background: var(${cssScope}--ghost-color);
109
- box-shadow:inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
109
+ box-shadow: inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
110
110
  color: var(${cssScope}--ghost-color);
111
111
  background: transparent;
112
112
  }
@@ -137,11 +137,11 @@ const colors: Record<Colors, string> = constructCSSObject(
137
137
  cursor: pointer;
138
138
  }
139
139
 
140
- :host([contents]) [part=root] {
140
+ :host([contents]) [part="root"] {
141
141
  width: fit-content;
142
142
  }
143
143
 
144
- [part=root] {
144
+ [part="root"] {
145
145
  width: 100%;
146
146
  height: 100%;
147
147
  overflow: hidden;
@@ -152,7 +152,7 @@ const colors: Record<Colors, string> = constructCSSObject(
152
152
  transition-duration: inherit;
153
153
  }
154
154
 
155
- [part=content] {
155
+ [part="content"] {
156
156
  padding: var(${cssScope}--padding);
157
157
  }
158
158
 
@@ -228,12 +228,15 @@ class Button extends GlobalStyle {
228
228
 
229
229
  protected render(): TemplateResult<1> {
230
230
  const color = this.nextColor();
231
- return html`<div part="root" ${attr(this.observedRecord)}>
232
- <span part="modal-root"></span>
233
- <div part="content">
234
- ${[this.content || htmlSlot(), htmlStyle(colors[color])]}
231
+ return html`
232
+ <div
233
+ part="root"
234
+ ${attr(this.observedRecord)}
235
+ >
236
+ <span part="modal-root"></span>
237
+ <div part="content">${[this.content || htmlSlot(), htmlStyle(colors[color])]}</div>
235
238
  </div>
236
- </div>`;
239
+ `;
237
240
  }
238
241
 
239
242
  focus(): void {