godown 3.0.0-canary.10 → 3.0.0-canary.12

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 (390) hide show
  1. package/README.md +3 -3
  2. package/alert.d.ts +1 -0
  3. package/alert.d.ts.map +1 -1
  4. package/avatar.d.ts +1 -0
  5. package/avatar.d.ts.map +1 -1
  6. package/button.d.ts +1 -0
  7. package/button.d.ts.map +1 -1
  8. package/card.d.ts +1 -0
  9. package/card.d.ts.map +1 -1
  10. package/carousel.d.ts +1 -0
  11. package/carousel.d.ts.map +1 -1
  12. package/components/alert.d.ts +2 -1
  13. package/components/alert.d.ts.map +1 -1
  14. package/components/alert.js +6 -8
  15. package/components/alert.js.map +1 -1
  16. package/components/avatar.d.ts +2 -1
  17. package/components/avatar.d.ts.map +1 -1
  18. package/components/avatar.js +8 -5
  19. package/components/avatar.js.map +1 -1
  20. package/components/breath.d.ts +3 -2
  21. package/components/breath.d.ts.map +1 -1
  22. package/components/breath.js +6 -5
  23. package/components/breath.js.map +1 -1
  24. package/components/button.d.ts +5 -3
  25. package/components/button.d.ts.map +1 -1
  26. package/components/button.js +20 -3
  27. package/components/button.js.map +1 -1
  28. package/components/card.d.ts +2 -1
  29. package/components/card.d.ts.map +1 -1
  30. package/components/card.js +5 -4
  31. package/components/card.js.map +1 -1
  32. package/components/carousel.d.ts +3 -1
  33. package/components/carousel.d.ts.map +1 -1
  34. package/components/carousel.js +17 -11
  35. package/components/carousel.js.map +1 -1
  36. package/components/details.d.ts +2 -1
  37. package/components/details.d.ts.map +1 -1
  38. package/components/details.js +3 -2
  39. package/components/details.js.map +1 -1
  40. package/components/dialog.d.ts +2 -2
  41. package/components/dialog.d.ts.map +1 -1
  42. package/components/dialog.js +5 -3
  43. package/components/dialog.js.map +1 -1
  44. package/components/divider.d.ts +2 -3
  45. package/components/divider.d.ts.map +1 -1
  46. package/components/divider.js +5 -6
  47. package/components/divider.js.map +1 -1
  48. package/components/dragbox.d.ts +2 -1
  49. package/components/dragbox.d.ts.map +1 -1
  50. package/components/dragbox.js +4 -2
  51. package/components/dragbox.js.map +1 -1
  52. package/components/flex.d.ts +2 -1
  53. package/components/flex.d.ts.map +1 -1
  54. package/components/flex.js +5 -4
  55. package/components/flex.js.map +1 -1
  56. package/components/form.d.ts +2 -1
  57. package/components/form.d.ts.map +1 -1
  58. package/components/form.js.map +1 -1
  59. package/components/grid.d.ts +2 -1
  60. package/components/grid.d.ts.map +1 -1
  61. package/components/grid.js +5 -4
  62. package/components/grid.js.map +1 -1
  63. package/components/input.d.ts +2 -1
  64. package/components/input.d.ts.map +1 -1
  65. package/components/input.js +3 -2
  66. package/components/input.js.map +1 -1
  67. package/components/layout.d.ts +2 -1
  68. package/components/layout.d.ts.map +1 -1
  69. package/components/layout.js +6 -6
  70. package/components/layout.js.map +1 -1
  71. package/components/link.d.ts +4 -0
  72. package/components/link.d.ts.map +1 -1
  73. package/components/link.js +10 -1
  74. package/components/link.js.map +1 -1
  75. package/components/progress.d.ts +2 -1
  76. package/components/progress.d.ts.map +1 -1
  77. package/components/progress.js +5 -4
  78. package/components/progress.js.map +1 -1
  79. package/components/range.d.ts +3 -2
  80. package/components/range.d.ts.map +1 -1
  81. package/components/range.js +8 -7
  82. package/components/range.js.map +1 -1
  83. package/components/rotate.d.ts +2 -1
  84. package/components/rotate.d.ts.map +1 -1
  85. package/components/rotate.js +1 -1
  86. package/components/rotate.js.map +1 -1
  87. package/components/router.d.ts +9 -9
  88. package/components/router.d.ts.map +1 -1
  89. package/components/router.js.map +1 -1
  90. package/components/select.d.ts +2 -1
  91. package/components/select.d.ts.map +1 -1
  92. package/components/select.js +11 -5
  93. package/components/select.js.map +1 -1
  94. package/components/skeleton.d.ts +2 -1
  95. package/components/skeleton.d.ts.map +1 -1
  96. package/components/skeleton.js +5 -4
  97. package/components/skeleton.js.map +1 -1
  98. package/components/split.d.ts +2 -1
  99. package/components/split.d.ts.map +1 -1
  100. package/components/split.js +4 -3
  101. package/components/split.js.map +1 -1
  102. package/components/switch.d.ts +2 -1
  103. package/components/switch.d.ts.map +1 -1
  104. package/components/switch.js +4 -3
  105. package/components/switch.js.map +1 -1
  106. package/components/text.d.ts +2 -1
  107. package/components/text.d.ts.map +1 -1
  108. package/components/text.js +9 -6
  109. package/components/text.js.map +1 -1
  110. package/components/time.d.ts +2 -2
  111. package/components/time.d.ts.map +1 -1
  112. package/components/time.js +3 -2
  113. package/components/time.js.map +1 -1
  114. package/components/tooltip.d.ts +2 -1
  115. package/components/tooltip.d.ts.map +1 -1
  116. package/components/tooltip.js +4 -3
  117. package/components/tooltip.js.map +1 -1
  118. package/components/typewriter.d.ts +2 -2
  119. package/components/typewriter.d.ts.map +1 -1
  120. package/components/typewriter.js +4 -5
  121. package/components/typewriter.js.map +1 -1
  122. package/core/global-style.d.ts.map +1 -1
  123. package/core/global-style.js +1 -1
  124. package/core/global-style.js.map +1 -1
  125. package/core/super-anchor.d.ts +2 -1
  126. package/core/super-anchor.d.ts.map +1 -1
  127. package/core/super-anchor.js +4 -3
  128. package/core/super-anchor.js.map +1 -1
  129. package/core/super-input.d.ts +3 -2
  130. package/core/super-input.d.ts.map +1 -1
  131. package/core/super-input.js +10 -4
  132. package/core/super-input.js.map +1 -1
  133. package/core/super-openable.d.ts.map +1 -1
  134. package/core/super-openable.js +1 -1
  135. package/core/super-openable.js.map +1 -1
  136. package/custom-elements.json +1 -1
  137. package/details.d.ts +1 -0
  138. package/details.d.ts.map +1 -1
  139. package/dev/alert.d.ts +1 -0
  140. package/dev/alert.d.ts.map +1 -1
  141. package/dev/alert.js +1 -0
  142. package/dev/alert.js.map +1 -1
  143. package/dev/avatar.d.ts +1 -0
  144. package/dev/avatar.d.ts.map +1 -1
  145. package/dev/avatar.js +1 -0
  146. package/dev/avatar.js.map +1 -1
  147. package/dev/button.d.ts +1 -0
  148. package/dev/button.d.ts.map +1 -1
  149. package/dev/button.js +1 -0
  150. package/dev/button.js.map +1 -1
  151. package/dev/card.d.ts +1 -0
  152. package/dev/card.d.ts.map +1 -1
  153. package/dev/card.js +1 -0
  154. package/dev/card.js.map +1 -1
  155. package/dev/carousel.d.ts +1 -0
  156. package/dev/carousel.d.ts.map +1 -1
  157. package/dev/carousel.js +1 -0
  158. package/dev/carousel.js.map +1 -1
  159. package/dev/components/alert.d.ts +2 -1
  160. package/dev/components/alert.d.ts.map +1 -1
  161. package/dev/components/alert.js +12 -10
  162. package/dev/components/alert.js.map +1 -1
  163. package/dev/components/avatar.d.ts +2 -1
  164. package/dev/components/avatar.d.ts.map +1 -1
  165. package/dev/components/avatar.js +21 -7
  166. package/dev/components/avatar.js.map +1 -1
  167. package/dev/components/breath.d.ts +3 -2
  168. package/dev/components/breath.d.ts.map +1 -1
  169. package/dev/components/breath.js +17 -5
  170. package/dev/components/breath.js.map +1 -1
  171. package/dev/components/button.d.ts +5 -3
  172. package/dev/components/button.d.ts.map +1 -1
  173. package/dev/components/button.js +23 -2
  174. package/dev/components/button.js.map +1 -1
  175. package/dev/components/card.d.ts +2 -1
  176. package/dev/components/card.d.ts.map +1 -1
  177. package/dev/components/card.js +8 -5
  178. package/dev/components/card.js.map +1 -1
  179. package/dev/components/carousel.d.ts +3 -1
  180. package/dev/components/carousel.d.ts.map +1 -1
  181. package/dev/components/carousel.js +27 -13
  182. package/dev/components/carousel.js.map +1 -1
  183. package/dev/components/details.d.ts +2 -1
  184. package/dev/components/details.d.ts.map +1 -1
  185. package/dev/components/details.js +8 -3
  186. package/dev/components/details.js.map +1 -1
  187. package/dev/components/dialog.d.ts +2 -2
  188. package/dev/components/dialog.d.ts.map +1 -1
  189. package/dev/components/dialog.js +12 -10
  190. package/dev/components/dialog.js.map +1 -1
  191. package/dev/components/divider.d.ts +2 -3
  192. package/dev/components/divider.d.ts.map +1 -1
  193. package/dev/components/divider.js +19 -7
  194. package/dev/components/divider.js.map +1 -1
  195. package/dev/components/dragbox.d.ts +2 -1
  196. package/dev/components/dragbox.d.ts.map +1 -1
  197. package/dev/components/dragbox.js +9 -1
  198. package/dev/components/dragbox.js.map +1 -1
  199. package/dev/components/flex.d.ts +2 -1
  200. package/dev/components/flex.d.ts.map +1 -1
  201. package/dev/components/flex.js +16 -4
  202. package/dev/components/flex.js.map +1 -1
  203. package/dev/components/form.d.ts +2 -1
  204. package/dev/components/form.d.ts.map +1 -1
  205. package/dev/components/form.js.map +1 -1
  206. package/dev/components/grid.d.ts +2 -1
  207. package/dev/components/grid.d.ts.map +1 -1
  208. package/dev/components/grid.js +16 -4
  209. package/dev/components/grid.js.map +1 -1
  210. package/dev/components/input.d.ts +2 -1
  211. package/dev/components/input.d.ts.map +1 -1
  212. package/dev/components/input.js +2 -1
  213. package/dev/components/input.js.map +1 -1
  214. package/dev/components/layout.d.ts +2 -1
  215. package/dev/components/layout.d.ts.map +1 -1
  216. package/dev/components/layout.js +13 -6
  217. package/dev/components/layout.js.map +1 -1
  218. package/dev/components/link.d.ts +4 -0
  219. package/dev/components/link.d.ts.map +1 -1
  220. package/dev/components/link.js +10 -1
  221. package/dev/components/link.js.map +1 -1
  222. package/dev/components/progress.d.ts +2 -1
  223. package/dev/components/progress.d.ts.map +1 -1
  224. package/dev/components/progress.js +7 -2
  225. package/dev/components/progress.js.map +1 -1
  226. package/dev/components/range.d.ts +3 -2
  227. package/dev/components/range.d.ts.map +1 -1
  228. package/dev/components/range.js +27 -22
  229. package/dev/components/range.js.map +1 -1
  230. package/dev/components/rotate.d.ts +2 -1
  231. package/dev/components/rotate.d.ts.map +1 -1
  232. package/dev/components/rotate.js +1 -1
  233. package/dev/components/rotate.js.map +1 -1
  234. package/dev/components/router.d.ts +9 -9
  235. package/dev/components/router.d.ts.map +1 -1
  236. package/dev/components/router.js.map +1 -1
  237. package/dev/components/select.d.ts +2 -1
  238. package/dev/components/select.d.ts.map +1 -1
  239. package/dev/components/select.js +18 -7
  240. package/dev/components/select.js.map +1 -1
  241. package/dev/components/skeleton.d.ts +2 -1
  242. package/dev/components/skeleton.d.ts.map +1 -1
  243. package/dev/components/skeleton.js +4 -3
  244. package/dev/components/skeleton.js.map +1 -1
  245. package/dev/components/split.d.ts +2 -1
  246. package/dev/components/split.d.ts.map +1 -1
  247. package/dev/components/split.js +15 -11
  248. package/dev/components/split.js.map +1 -1
  249. package/dev/components/switch.d.ts +2 -1
  250. package/dev/components/switch.d.ts.map +1 -1
  251. package/dev/components/switch.js +15 -14
  252. package/dev/components/switch.js.map +1 -1
  253. package/dev/components/text.d.ts +2 -1
  254. package/dev/components/text.d.ts.map +1 -1
  255. package/dev/components/text.js +8 -4
  256. package/dev/components/text.js.map +1 -1
  257. package/dev/components/time.d.ts +2 -2
  258. package/dev/components/time.d.ts.map +1 -1
  259. package/dev/components/time.js +5 -2
  260. package/dev/components/time.js.map +1 -1
  261. package/dev/components/tooltip.d.ts +2 -1
  262. package/dev/components/tooltip.d.ts.map +1 -1
  263. package/dev/components/tooltip.js +24 -12
  264. package/dev/components/tooltip.js.map +1 -1
  265. package/dev/components/typewriter.d.ts +2 -2
  266. package/dev/components/typewriter.d.ts.map +1 -1
  267. package/dev/components/typewriter.js +11 -4
  268. package/dev/components/typewriter.js.map +1 -1
  269. package/dev/core/global-style.d.ts.map +1 -1
  270. package/dev/core/global-style.js +10 -1
  271. package/dev/core/global-style.js.map +1 -1
  272. package/dev/core/super-anchor.d.ts +2 -1
  273. package/dev/core/super-anchor.d.ts.map +1 -1
  274. package/dev/core/super-anchor.js +8 -5
  275. package/dev/core/super-anchor.js.map +1 -1
  276. package/dev/core/super-input.d.ts +3 -2
  277. package/dev/core/super-input.d.ts.map +1 -1
  278. package/dev/core/super-input.js +13 -5
  279. package/dev/core/super-input.js.map +1 -1
  280. package/dev/core/super-openable.d.ts.map +1 -1
  281. package/dev/core/super-openable.js +1 -1
  282. package/dev/core/super-openable.js.map +1 -1
  283. package/dev/details.d.ts +1 -0
  284. package/dev/details.d.ts.map +1 -1
  285. package/dev/details.js +1 -0
  286. package/dev/details.js.map +1 -1
  287. package/dev/dialog.d.ts +1 -0
  288. package/dev/dialog.d.ts.map +1 -1
  289. package/dev/dialog.js +1 -0
  290. package/dev/dialog.js.map +1 -1
  291. package/dev/divider.d.ts +1 -0
  292. package/dev/divider.d.ts.map +1 -1
  293. package/dev/divider.js +1 -0
  294. package/dev/divider.js.map +1 -1
  295. package/dev/dragbox.d.ts +1 -0
  296. package/dev/dragbox.d.ts.map +1 -1
  297. package/dev/dragbox.js +1 -0
  298. package/dev/dragbox.js.map +1 -1
  299. package/dev/flex.d.ts +1 -0
  300. package/dev/flex.d.ts.map +1 -1
  301. package/dev/flex.js +1 -0
  302. package/dev/flex.js.map +1 -1
  303. package/dev/form.d.ts +1 -0
  304. package/dev/form.d.ts.map +1 -1
  305. package/dev/form.js +1 -0
  306. package/dev/form.js.map +1 -1
  307. package/dev/grid.d.ts +1 -0
  308. package/dev/grid.d.ts.map +1 -1
  309. package/dev/grid.js +1 -0
  310. package/dev/grid.js.map +1 -1
  311. package/dev/layout.d.ts.map +1 -1
  312. package/dev/progress.d.ts.map +1 -1
  313. package/dev/router.d.ts.map +1 -1
  314. package/dev/split.d.ts +1 -1
  315. package/dev/split.d.ts.map +1 -1
  316. package/dev/typewriter.d.ts +1 -0
  317. package/dev/typewriter.d.ts.map +1 -1
  318. package/dev/typewriter.js +1 -0
  319. package/dev/typewriter.js.map +1 -1
  320. package/dialog.d.ts +1 -0
  321. package/dialog.d.ts.map +1 -1
  322. package/divider.d.ts +1 -0
  323. package/divider.d.ts.map +1 -1
  324. package/dragbox.d.ts +1 -0
  325. package/dragbox.d.ts.map +1 -1
  326. package/flex.d.ts +1 -0
  327. package/flex.d.ts.map +1 -1
  328. package/form.d.ts +1 -0
  329. package/form.d.ts.map +1 -1
  330. package/grid.d.ts +1 -0
  331. package/grid.d.ts.map +1 -1
  332. package/layout.d.ts.map +1 -1
  333. package/package.json +9 -5
  334. package/progress.d.ts.map +1 -1
  335. package/router.d.ts.map +1 -1
  336. package/split.d.ts +1 -1
  337. package/split.d.ts.map +1 -1
  338. package/src/alert.ts +2 -0
  339. package/src/avatar.ts +2 -0
  340. package/src/button.ts +2 -0
  341. package/src/card.ts +2 -0
  342. package/src/carousel.ts +2 -0
  343. package/src/components/alert.ts +18 -16
  344. package/src/components/avatar.ts +25 -11
  345. package/src/components/breath.ts +22 -10
  346. package/src/components/button.ts +21 -15
  347. package/src/components/card.ts +9 -6
  348. package/src/components/carousel.ts +36 -21
  349. package/src/components/details.ts +10 -5
  350. package/src/components/dialog.ts +19 -18
  351. package/src/components/divider.ts +19 -7
  352. package/src/components/dragbox.ts +16 -9
  353. package/src/components/flex.ts +17 -5
  354. package/src/components/form.ts +4 -4
  355. package/src/components/grid.ts +17 -5
  356. package/src/components/input.ts +5 -4
  357. package/src/components/layout.ts +15 -8
  358. package/src/components/link.ts +10 -2
  359. package/src/components/progress.ts +9 -4
  360. package/src/components/range.ts +44 -45
  361. package/src/components/rotate.ts +9 -6
  362. package/src/components/router.ts +27 -19
  363. package/src/components/select.ts +31 -20
  364. package/src/components/skeleton.ts +6 -5
  365. package/src/components/split.ts +23 -19
  366. package/src/components/switch.ts +20 -19
  367. package/src/components/text.ts +7 -9
  368. package/src/components/time.ts +12 -9
  369. package/src/components/tooltip.ts +26 -14
  370. package/src/components/typewriter.ts +19 -14
  371. package/src/core/global-style.ts +23 -4
  372. package/src/core/super-anchor.ts +11 -8
  373. package/src/core/super-input.ts +23 -21
  374. package/src/core/super-openable.ts +5 -5
  375. package/src/details.ts +2 -0
  376. package/src/dialog.ts +2 -0
  377. package/src/divider.ts +2 -0
  378. package/src/dragbox.ts +2 -0
  379. package/src/flex.ts +2 -0
  380. package/src/form.ts +2 -0
  381. package/src/grid.ts +2 -0
  382. package/src/layout.ts +1 -0
  383. package/src/progress.ts +1 -0
  384. package/src/router.ts +1 -0
  385. package/src/split.ts +1 -1
  386. package/src/typewriter.ts +2 -0
  387. package/typewriter.d.ts +1 -0
  388. package/typewriter.d.ts.map +1 -1
  389. package/vscode.html-custom-data.json +1 -1
  390. package/web-types.json +1 -1
@@ -1,8 +1,9 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
+ import { attr } from "@godown/element/directives/attr.js";
3
4
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
4
5
  import iconPhoto from "@godown/f7-icon/icons/photo.js";
5
- import { css, html } from "lit";
6
+ import { css, html, type TemplateResult } from "lit";
6
7
  import { property, state } from "lit/decorators.js";
7
8
 
8
9
  import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
@@ -49,7 +50,7 @@ const cssScope = scopePrefix(protoName);
49
50
  margin: calc(var(--size) * 0.05);
50
51
  }
51
52
 
52
- .position {
53
+ [animation=position] {
53
54
  background-image: linear-gradient(
54
55
  var(${cssScope}--deg),
55
56
  var(${cssScope}--from) 36%,
@@ -70,7 +71,7 @@ const cssScope = scopePrefix(protoName);
70
71
  }
71
72
  }
72
73
 
73
- .opacity {
74
+ [animation=opacity] {
74
75
  animation-name: op;
75
76
  animation-direction: alternate;
76
77
  }
@@ -105,11 +106,11 @@ class Skeleton extends GlobalStyle {
105
106
  @state()
106
107
  loading = true;
107
108
 
108
- protected render() {
109
+ protected render(): TemplateResult<1> {
109
110
  if (!this.loading) {
110
111
  return htmlSlot();
111
112
  }
112
- return html`<div part="root" class="${this.animation}">
113
+ return html`<div part="root" ${attr(this.observedRecord)}>
113
114
  ${this.type === "image" ? iconPhoto() : ""}
114
115
  ${htmlSlot("loading")}</div>`;
115
116
  }
@@ -1,8 +1,9 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
+ import { attr } from "@godown/element/directives/attr.js";
3
4
  import { classList } from "@godown/element/directives/class-list.js";
4
5
  import { type HandlerEvent } from "@godown/element/element.js";
5
- import { css, html, nothing } from "lit";
6
+ import { css, html, nothing, type TemplateResult } from "lit";
6
7
  import { property, state } from "lit/decorators.js";
7
8
 
8
9
  import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
@@ -40,12 +41,16 @@ const loop = <T>(len: number, fn: (index?: number) => T) => {
40
41
  ${cssScope}--gap: .25em;
41
42
  }
42
43
 
44
+ :host([contents]) [part=root] {
45
+ width: fit-content;
46
+ }
47
+
43
48
  [part=root] {
44
49
  gap: var(${cssScope}--gap);
45
50
  width: 100%;
46
51
  position: relative;
47
52
  vertical-align: top;
48
- display: inline-flex;
53
+ display: flex;
49
54
  justify-content: space-between;
50
55
  border-radius: inherit;
51
56
  }
@@ -92,9 +97,8 @@ class Split extends SuperInput {
92
97
  @state()
93
98
  currentValue: (string | void)[] = [];
94
99
 
95
- protected render() {
96
- return html`
97
- <div part="root">
100
+ protected render(): TemplateResult<1> {
101
+ return html`<div part="root" ${attr(this.observedRecord)}>
98
102
  ${
99
103
  loop(this.len, (index: number) =>
100
104
  html`<span part="input-box"
@@ -102,16 +106,16 @@ class Split extends SuperInput {
102
106
  class="${classList({ focus: this.current === index }) || nothing}"
103
107
  >${this.currentValue[index]}</span>`)
104
108
  }
105
- <input
106
- part="input"
107
- id="${this.makeId}"
108
- @blur=${this.blur}
109
- @input="${this._handleInput}"
110
- .value="${
109
+ <input
110
+ part="input"
111
+ id="${this.makeId}"
112
+ @blur=${this.blur}
113
+ @input="${this._handleInput}"
114
+ .value="${
111
115
  /* Ensure that input always has a value of length this.len */
112
116
  this.value.padStart(this.len, " ")}"
113
- >
114
- </div>
117
+ >
118
+ </div>
115
119
  `;
116
120
  }
117
121
 
@@ -120,7 +124,7 @@ class Split extends SuperInput {
120
124
  this.reset();
121
125
  }
122
126
 
123
- protected _handleInput(e: HandlerEvent<HTMLInputElement, InputEvent>) {
127
+ protected _handleInput(e: HandlerEvent<HTMLInputElement, InputEvent>): void {
124
128
  e.stopPropagation();
125
129
  if (this.compositing) {
126
130
  return;
@@ -149,7 +153,7 @@ class Split extends SuperInput {
149
153
  *
150
154
  * @param data Input event data.
151
155
  */
152
- protected fillInput(data: string | null) {
156
+ protected fillInput(data: string | null): void {
153
157
  if (data === null) {
154
158
  // delete
155
159
 
@@ -192,23 +196,23 @@ class Split extends SuperInput {
192
196
  }
193
197
  }
194
198
 
195
- focus() {
199
+ focus(): void {
196
200
  this.focusAt(this.current);
197
201
  super.focus();
198
202
  }
199
203
 
200
- focusAt(i: number) {
204
+ focusAt(i: number): void {
201
205
  this.current = i;
202
206
  this._input.focus();
203
207
  }
204
208
 
205
- blur() {
209
+ blur(): void {
206
210
  this._input.blur();
207
211
  this.current = -1;
208
212
  super.blur();
209
213
  }
210
214
 
211
- reset() {
215
+ reset(): void {
212
216
  this.current = -1;
213
217
  this.value = this.default;
214
218
  this.currentValue = this.value.split("").concat(Array(this.len - this.value.length).fill(null));
@@ -1,6 +1,7 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
- import { css, html } from "lit";
3
+ import { attr } from "@godown/element/directives/attr.js";
4
+ import { css, html, type TemplateResult } from "lit";
4
5
  import { property, query } from "lit/decorators.js";
5
6
 
6
7
  import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
@@ -20,6 +21,13 @@ const cssScope = scopePrefix(protoName);
20
21
  @godown(protoName)
21
22
  @styles(
22
23
  css`
24
+ :host,
25
+ :host([contents]) [part=root] {
26
+ width: var(${cssScope}-width);
27
+ height: var(${cssScope}-height);
28
+ display: inline-block;
29
+ }
30
+
23
31
  :host {
24
32
  ${cssScope}-width: 3em;
25
33
  ${cssScope}-height: calc(var(${cssScope}-width) / 2);
@@ -27,9 +35,6 @@ const cssScope = scopePrefix(protoName);
27
35
  ${cssScope}-handle-space: .125em;
28
36
  ${cssScope}-transition: .2s ease-in-out;
29
37
  background: var(${cssGlobalVars.input}-background);
30
- width: var(${cssScope}-width);
31
- height: var(${cssScope}-height);
32
- display: inline-block;
33
38
  vertical-align: bottom;
34
39
  border-radius: 0;
35
40
  }
@@ -44,14 +49,10 @@ const cssScope = scopePrefix(protoName);
44
49
  position: relative;
45
50
  height: inherit;
46
51
  }
47
-
48
- [part=root],
49
- input {
50
- width: 100%;
51
- }
52
-
52
+
53
53
  input {
54
54
  opacity: 0;
55
+ width: 100%;
55
56
  height: 100%;
56
57
  appearance: none;
57
58
  }
@@ -70,6 +71,7 @@ const cssScope = scopePrefix(protoName);
70
71
 
71
72
  :host([round]) {
72
73
  border-radius: calc(var(${cssScope}-height) / 2);
74
+ background: var(${cssGlobalVars.passive});
73
75
  }
74
76
 
75
77
  :host([checked]) span {
@@ -93,10 +95,6 @@ const cssScope = scopePrefix(protoName);
93
95
  margin: var(${cssScope}-handle-space);
94
96
  }
95
97
 
96
- .round {
97
- background: var(${cssGlobalVars.passive});
98
- }
99
-
100
98
  :host([checked]) .round {
101
99
  background: var(${cssGlobalVars.active});
102
100
  }
@@ -136,8 +134,11 @@ class Switch extends SuperInput {
136
134
  @query("input")
137
135
  protected _input: HTMLInputElement;
138
136
 
139
- protected render() {
140
- return html`<div part="root" class="${this.round ? "round" : "rect"}">
137
+ protected render(): TemplateResult<1> {
138
+ return html`<div part="root"
139
+ ${attr(this.observedRecord)}
140
+ class="${this.round ? "round" : "rect"}"
141
+ >
141
142
  <input
142
143
  part="input"
143
144
  @change="${this._handleChange}"
@@ -151,12 +152,12 @@ class Switch extends SuperInput {
151
152
  </div>`;
152
153
  }
153
154
 
154
- reset() {
155
+ reset(): void {
155
156
  this.checked = this.default === "true";
156
157
  this._input.checked = this.checked;
157
158
  }
158
159
 
159
- connectedCallback() {
160
+ connectedCallback(): void {
160
161
  super.connectedCallback();
161
162
  if (this.checked) {
162
163
  this.default = "true";
@@ -166,7 +167,7 @@ class Switch extends SuperInput {
166
167
  }
167
168
  }
168
169
 
169
- protected _handleChange() {
170
+ protected _handleChange(): void {
170
171
  this.checked = this._input.checked;
171
172
  this.dispatchEvent(new CustomEvent("input", { detail: this.checked, bubbles: true, composed: true }));
172
173
  this.dispatchEvent(new CustomEvent("change", { detail: this.checked, composed: true }));
@@ -1,8 +1,9 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
+ import { attr } from "@godown/element/directives/attr.js";
3
4
  import { classList } from "@godown/element/directives/class-list.js";
4
5
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
5
- import { css, html } from "lit";
6
+ import { css, html, type TemplateResult } from "lit";
6
7
  import { property } from "lit/decorators.js";
7
8
 
8
9
  import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
@@ -56,7 +57,7 @@ const cssScope = scopePrefix(protoName);
56
57
  text-decoration: none;
57
58
  }
58
59
 
59
- .clip{
60
+ [clip] {
60
61
  background: var(${cssGlobalVars.clipBackground});
61
62
  display: inline-block;
62
63
  color: transparent;
@@ -76,16 +77,13 @@ class Text extends GlobalStyle {
76
77
  * Set background-clip to text.
77
78
  */
78
79
  @property({ type: Boolean })
79
- clip: boolean;
80
+ clip = false;
80
81
 
81
- protected render() {
82
+ protected render(): TemplateResult<1> {
82
83
  return html`<span
83
84
  part="root"
84
- class="${
85
- classList(this.underline, {
86
- clip: this.clip,
87
- })
88
- }"
85
+ ${attr(this.observedRecord)}
86
+ class="${classList(this.underline)}"
89
87
  >
90
88
  ${htmlSlot()}
91
89
  </span>`;
@@ -1,7 +1,8 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
+ import { attr } from "@godown/element/directives/attr.js";
3
4
  import fmtime from "fmtime";
4
- import { css, type PropertyValues } from "lit";
5
+ import { css, html, type PropertyValues, TemplateResult } from "lit";
5
6
  import { property } from "lit/decorators.js";
6
7
 
7
8
  import { GlobalStyle } from "../core/global-style.js";
@@ -32,27 +33,29 @@ class Time extends GlobalStyle {
32
33
  * Time.
33
34
  */
34
35
  @property({ type: Object })
35
- time = new Date();
36
+ time: Date = new Date();
36
37
 
37
38
  /**
38
39
  * If there is a value, update every gap or timeout.
39
40
  */
40
41
  @property({ type: Number })
41
- timeout;
42
+ timeout: any;
42
43
 
43
44
  /**
44
45
  * The number of milliseconds that change with each update.
45
46
  */
46
47
  @property({ type: Number })
47
- gap;
48
+ gap: any;
48
49
 
49
50
  protected timeoutId: number;
50
51
 
51
- protected render(): string {
52
- return fmtime(this.format, this.time, this.escape);
52
+ protected render(): TemplateResult<1> {
53
+ return html`<span part="root" ${attr(this.observedRecord)}>
54
+ ${fmtime(this.format, this.time, this.escape)}
55
+ </span>`;
53
56
  }
54
57
 
55
- protected firstUpdated() {
58
+ protected firstUpdated(): void {
56
59
  if (this.timeout) {
57
60
  this.timeoutId = this.startTimeout();
58
61
  }
@@ -67,11 +70,11 @@ class Time extends GlobalStyle {
67
70
  }
68
71
  }
69
72
 
70
- disconnectedCallback() {
73
+ disconnectedCallback(): void {
71
74
  clearInterval(this.timeoutId);
72
75
  }
73
76
 
74
- startTimeout() {
77
+ startTimeout(): number {
75
78
  return window.setInterval(() => {
76
79
  this.time = new Date(this.time.getTime() + (this.gap || this.timeout));
77
80
  }, Math.abs(this.timeout));
@@ -1,7 +1,8 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
+ import { attr } from "@godown/element/directives/attr.js";
3
4
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
4
- import { css, html } from "lit";
5
+ import { css, html, type TemplateResult } from "lit";
5
6
  import { property } from "lit/decorators.js";
6
7
 
7
8
  import { scopePrefix } from "../core/global-style.js";
@@ -24,12 +25,15 @@ const cssScope = scopePrefix(protoName);
24
25
  css`
25
26
  :host {
26
27
  ${cssScope}--tip-background: inherit;
27
- display: inline-block;
28
28
  width: fit-content;
29
29
  }
30
+
31
+ :host,
32
+ [part=root] {
33
+ display: inline-flex;
34
+ }
30
35
 
31
36
  [part=root] {
32
- display: flex;
33
37
  position: relative;
34
38
  transition: inherit;
35
39
  border-radius: inherit;
@@ -51,18 +55,25 @@ const cssScope = scopePrefix(protoName);
51
55
  .passive {
52
56
  background: var(${cssScope}--tip-background);
53
57
  }
58
+
59
+ [propagation] [part=tip] {
60
+ pointer-events: none;
61
+ }
54
62
  `,
55
63
  css`
56
- [direction^=top] {
64
+ [direction^=top] [part=tip] {
57
65
  bottom: 100%;
58
66
  }
59
- [direction^=bottom] {
67
+
68
+ [direction^=bottom] [part=tip] {
60
69
  top: 100%;
61
70
  }
62
- [direction$=right] {
71
+
72
+ [direction$=right] [part=tip] {
63
73
  left: 100%;
64
74
  }
65
- [direction$=left] {
75
+
76
+ [direction$=left] [part=tip] {
66
77
  right: 100%;
67
78
  }
68
79
  `,
@@ -112,10 +123,12 @@ class Tooltip extends SuperOpenable {
112
123
  "flex-end": "flex-end",
113
124
  };
114
125
 
115
- protected render() {
126
+ protected render(): TemplateResult<1> {
116
127
  const align = Tooltip.aligns[this.align] || "inherit";
117
128
  const isFocusable = this.type === "focus";
118
- return html`<div part="root"
129
+ return html`<div
130
+ part="root"
131
+ ${attr(this.observedRecord)}
119
132
  tabindex="${isFocusable ? 0 : -1}"
120
133
  @focus="${isFocusable ? () => this.open = true : null}"
121
134
  @blur="${isFocusable ? () => this.open = false : null}"
@@ -123,14 +136,13 @@ class Tooltip extends SuperOpenable {
123
136
  @mouseleave="${isFocusable ? null : () => this.open = false}"
124
137
  style="justify-content:${align};align-items:${align}">
125
138
  ${htmlSlot()}
126
- <div part="tip"
127
- direction="${this.direction}"
128
- style="pointer-events:${this.propagation ? "none" : "all"}">
129
- ${
139
+ <div part="tip">
140
+ ${
130
141
  this.tip
131
142
  ? html`<span class="passive">${this.tip}</span>`
132
143
  : htmlSlot("tip")
133
- }</div>
144
+ }
145
+ </div>
134
146
  </div>`;
135
147
  }
136
148
  }
@@ -1,9 +1,10 @@
1
1
  import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
+ import { attr } from "@godown/element/directives/attr.js";
3
4
  import { classList } from "@godown/element/directives/class-list.js";
4
5
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
5
6
  import { random } from "@godown/element/tools/lib.js";
6
- import { css, html, type PropertyValueMap } from "lit";
7
+ import { css, html, type PropertyValueMap, TemplateResult } from "lit";
7
8
  import { property, query, state } from "lit/decorators.js";
8
9
 
9
10
  import { GlobalStyle, scopePrefix } from "../core/global-style.js";
@@ -20,7 +21,11 @@ const cssScope = scopePrefix(protoName);
20
21
  @styles(css`
21
22
  :host {
22
23
  ${cssScope}--cursor-width: .05em;
23
- white-space: nowrap;
24
+ }
25
+
26
+ :host,
27
+ :host([contents]) [part=root] {
28
+ display: inline-block;
24
29
  }
25
30
 
26
31
  i {
@@ -103,19 +108,19 @@ class Typewriter extends GlobalStyle {
103
108
  /**
104
109
  * {@linkcode Typewriter.text} length.
105
110
  */
106
- get len() {
111
+ get len(): number {
107
112
  return this.text.length;
108
113
  }
109
114
 
110
- protected render() {
111
- return html`${htmlSlot()}${this.content}<i part="cursor" class="${
112
- classList({
113
- hidden: this.ended,
114
- })
115
- }"></i>`;
115
+ protected render(): TemplateResult<1> {
116
+ return html`<div part="root" ${attr(this.observedRecord)}>
117
+ ${htmlSlot()}
118
+ ${this.content}
119
+ <i part="cursor" class="${classList({ hidden: this.ended })}"></i>
120
+ </div>`;
116
121
  }
117
122
 
118
- protected firstUpdated() {
123
+ protected firstUpdated(): void {
119
124
  if (!this.text) {
120
125
  this.text = this._slot?.assignedNodes()[0]?.textContent.trim() || "";
121
126
  }
@@ -124,13 +129,13 @@ class Typewriter extends GlobalStyle {
124
129
  }
125
130
  }
126
131
 
127
- protected updated(changedProperties: PropertyValueMap<this>) {
132
+ protected updated(changedProperties: PropertyValueMap<this>): void {
128
133
  if (changedProperties.has("index")) {
129
134
  this.dispatchEvent(new CustomEvent(this.index === this.len ? "done" : "write", { detail: this.content }));
130
135
  }
131
136
  }
132
137
 
133
- write(at = this.index) {
138
+ write(at: number = this.index): void {
134
139
  this.content = this.text.slice(0, at + 1);
135
140
  const timeout = this.delay || random(this.max, this.min);
136
141
  this.timeoutID = window.setTimeout(() => {
@@ -142,11 +147,11 @@ class Typewriter extends GlobalStyle {
142
147
  }, timeout);
143
148
  }
144
149
 
145
- stop() {
150
+ stop(): void {
146
151
  clearTimeout(this.timeoutID);
147
152
  }
148
153
 
149
- end() {
154
+ end(): void {
150
155
  this.ended = true;
151
156
  }
152
157
  }
@@ -13,15 +13,25 @@ export class GlobalStyle extends GodownElement {
13
13
 
14
14
  const cssvar = trim(GlobalStyle.godownConfig.prefix, "-");
15
15
 
16
- export function scopePrefix(scope: string, len = 1) {
16
+ export function scopePrefix(scope: string, len = 1): CSSResult {
17
17
  return variablePrefix(cssvar + "-".repeat(len) + scope);
18
18
  }
19
19
 
20
- export function variablePrefix(variable: string) {
20
+ export function variablePrefix(variable: string): CSSResult {
21
21
  return unsafeCSS("--" + variable);
22
22
  }
23
23
 
24
- export const cssGlobalVars = {
24
+ export const cssGlobalVars: {
25
+ foreground: CSSResult;
26
+ background: CSSResult;
27
+ clipBackground: CSSResult;
28
+ active: CSSResult;
29
+ passive: CSSResult;
30
+ _colors: PresetsGradientsCSSResult;
31
+ input: CSSResult;
32
+ white: CSSResult;
33
+ black: CSSResult;
34
+ } = {
25
35
  foreground: scopePrefix("foreground", 2),
26
36
  background: scopePrefix("background", 2),
27
37
  clipBackground: scopePrefix("clip-background", 2),
@@ -82,5 +92,14 @@ GlobalStyle.styles = [
82
92
  svg {
83
93
  user-select: none;
84
94
  }
85
- `,
95
+
96
+ :host([contents]) {
97
+ display: contents;
98
+ }
99
+
100
+ :where(:host([contents]) [part=root]) {
101
+ all: inherit;
102
+ display: revert;
103
+ }
104
+ `,
86
105
  ];
@@ -1,6 +1,7 @@
1
1
  import { styles } from "@godown/element/decorators/index.js";
2
+ import { attr } from "@godown/element/directives/attr.js";
2
3
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
3
- import { css, html } from "lit";
4
+ import { css, html, type TemplateResult } from "lit";
4
5
  import { property } from "lit/decorators.js";
5
6
  import { ifDefined } from "lit/directives/if-defined.js";
6
7
 
@@ -18,13 +19,11 @@ import { GlobalStyle } from "./global-style.js";
18
19
  cursor: pointer;
19
20
  }
20
21
 
21
- a {
22
+ [part=root] {
22
23
  width: 100%;
23
- display: flex;
24
24
  color: inherit;
25
+ display: inline-block;
25
26
  text-decoration: inherit;
26
- justify-content: space-between;
27
- align-items: center;
28
27
  }
29
28
  `)
30
29
  class SuperAnchor extends GlobalStyle {
@@ -39,14 +38,18 @@ class SuperAnchor extends GlobalStyle {
39
38
  @property()
40
39
  target: "_blank" | "_self" | "_parent" | "_top" = "_self";
41
40
 
42
- protected render() {
43
- return html`<a part="root" href="${ifDefined(this.href)}" target="${this.target}" @click=${this._handleClick}>
41
+ protected render(): TemplateResult<1> {
42
+ return html`<a part="root"
43
+ ${attr(this.observedRecord)}
44
+ href="${ifDefined(this.href)}"
45
+ target="${this.target}"
46
+ @click=${this._handleClick}>
44
47
  ${htmlSlot()}
45
48
  </a>`;
46
49
  }
47
50
 
48
51
  // eslint-disable-next-line
49
- protected _handleClick(_: MouseEvent) {}
52
+ protected _handleClick(_: MouseEvent): void {}
50
53
  }
51
54
 
52
55
  export default SuperAnchor;