godown 3.0.0-canary.14 → 3.0.0-canary.16

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 (338) hide show
  1. package/alert.js +1 -1
  2. package/alert.js.map +1 -1
  3. package/avatar.js +1 -1
  4. package/avatar.js.map +1 -1
  5. package/breath.js +1 -1
  6. package/breath.js.map +1 -1
  7. package/button.js +1 -1
  8. package/button.js.map +1 -1
  9. package/card.js +1 -1
  10. package/card.js.map +1 -1
  11. package/carousel.js +1 -1
  12. package/carousel.js.map +1 -1
  13. package/components/alert.d.ts +2 -0
  14. package/components/alert.d.ts.map +1 -1
  15. package/components/alert.js +1 -1
  16. package/components/alert.js.map +1 -1
  17. package/components/avatar.d.ts +1 -0
  18. package/components/avatar.d.ts.map +1 -1
  19. package/components/avatar.js +1 -1
  20. package/components/avatar.js.map +1 -1
  21. package/components/breath.d.ts +3 -2
  22. package/components/breath.d.ts.map +1 -1
  23. package/components/breath.js +1 -1
  24. package/components/breath.js.map +1 -1
  25. package/components/button.d.ts +2 -1
  26. package/components/button.d.ts.map +1 -1
  27. package/components/button.js +1 -1
  28. package/components/card.d.ts +1 -0
  29. package/components/card.d.ts.map +1 -1
  30. package/components/card.js +1 -1
  31. package/components/card.js.map +1 -1
  32. package/components/carousel.d.ts +2 -0
  33. package/components/carousel.d.ts.map +1 -1
  34. package/components/carousel.js +1 -1
  35. package/components/carousel.js.map +1 -1
  36. package/components/details.d.ts +2 -2
  37. package/components/details.d.ts.map +1 -1
  38. package/components/details.js +1 -1
  39. package/components/details.js.map +1 -1
  40. package/components/dialog.d.ts +3 -1
  41. package/components/dialog.d.ts.map +1 -1
  42. package/components/dialog.js +1 -1
  43. package/components/dialog.js.map +1 -1
  44. package/components/divider.d.ts +1 -0
  45. package/components/divider.d.ts.map +1 -1
  46. package/components/divider.js +1 -1
  47. package/components/dragbox.d.ts +2 -1
  48. package/components/dragbox.d.ts.map +1 -1
  49. package/components/dragbox.js +1 -1
  50. package/components/dragbox.js.map +1 -1
  51. package/components/flex.d.ts +1 -0
  52. package/components/flex.d.ts.map +1 -1
  53. package/components/flex.js +1 -1
  54. package/components/flex.js.map +1 -1
  55. package/components/form.d.ts +1 -0
  56. package/components/form.d.ts.map +1 -1
  57. package/components/form.js +1 -1
  58. package/components/grid.d.ts +1 -0
  59. package/components/grid.d.ts.map +1 -1
  60. package/components/grid.js +1 -1
  61. package/components/grid.js.map +1 -1
  62. package/components/input.d.ts +3 -0
  63. package/components/input.d.ts.map +1 -1
  64. package/components/input.js +1 -1
  65. package/components/input.js.map +1 -1
  66. package/components/layout.d.ts +4 -3
  67. package/components/layout.d.ts.map +1 -1
  68. package/components/layout.js +1 -1
  69. package/components/layout.js.map +1 -1
  70. package/components/link.d.ts +1 -0
  71. package/components/link.d.ts.map +1 -1
  72. package/components/link.js +1 -1
  73. package/components/progress.d.ts +1 -0
  74. package/components/progress.d.ts.map +1 -1
  75. package/components/progress.js +1 -1
  76. package/components/progress.js.map +1 -1
  77. package/components/range.d.ts +6 -2
  78. package/components/range.d.ts.map +1 -1
  79. package/components/range.js +1 -1
  80. package/components/range.js.map +1 -1
  81. package/components/rotate.d.ts +1 -0
  82. package/components/rotate.d.ts.map +1 -1
  83. package/components/rotate.js +1 -1
  84. package/components/router.d.ts +4 -5
  85. package/components/router.d.ts.map +1 -1
  86. package/components/router.js +1 -1
  87. package/components/router.js.map +1 -1
  88. package/components/select.d.ts +5 -1
  89. package/components/select.d.ts.map +1 -1
  90. package/components/select.js +1 -1
  91. package/components/select.js.map +1 -1
  92. package/components/skeleton.d.ts +1 -0
  93. package/components/skeleton.d.ts.map +1 -1
  94. package/components/skeleton.js +1 -1
  95. package/components/skeleton.js.map +1 -1
  96. package/components/split.d.ts +5 -1
  97. package/components/split.d.ts.map +1 -1
  98. package/components/split.js +1 -1
  99. package/components/split.js.map +1 -1
  100. package/components/switch.d.ts +2 -0
  101. package/components/switch.d.ts.map +1 -1
  102. package/components/switch.js +1 -1
  103. package/components/switch.js.map +1 -1
  104. package/components/text.d.ts +1 -0
  105. package/components/text.d.ts.map +1 -1
  106. package/components/text.js +1 -1
  107. package/components/text.js.map +1 -1
  108. package/components/time.d.ts +3 -1
  109. package/components/time.d.ts.map +1 -1
  110. package/components/time.js +1 -1
  111. package/components/time.js.map +1 -1
  112. package/components/tooltip.d.ts +1 -0
  113. package/components/tooltip.d.ts.map +1 -1
  114. package/components/tooltip.js +1 -1
  115. package/components/tooltip.js.map +1 -1
  116. package/components/typewriter.d.ts +2 -1
  117. package/components/typewriter.d.ts.map +1 -1
  118. package/components/typewriter.js +1 -1
  119. package/components/typewriter.js.map +1 -1
  120. package/core/global-style.d.ts +1 -1
  121. package/core/global-style.d.ts.map +1 -1
  122. package/core/global-style.js +1 -1
  123. package/core/global-style.js.map +1 -1
  124. package/core/super-anchor.d.ts.map +1 -1
  125. package/core/super-anchor.js.map +1 -1
  126. package/core/super-input.d.ts +1 -1
  127. package/core/super-input.d.ts.map +1 -1
  128. package/core/super-input.js +1 -1
  129. package/core/super-input.js.map +1 -1
  130. package/core/super-openable.d.ts +1 -1
  131. package/core/super-openable.d.ts.map +1 -1
  132. package/core/super-openable.js +1 -1
  133. package/core/super-openable.js.map +1 -1
  134. package/custom-elements.json +1 -1
  135. package/details.js +1 -1
  136. package/details.js.map +1 -1
  137. package/dev/components/alert.d.ts +2 -0
  138. package/dev/components/alert.d.ts.map +1 -1
  139. package/dev/components/alert.js +7 -7
  140. package/dev/components/alert.js.map +1 -1
  141. package/dev/components/avatar.d.ts +1 -0
  142. package/dev/components/avatar.d.ts.map +1 -1
  143. package/dev/components/avatar.js +4 -5
  144. package/dev/components/avatar.js.map +1 -1
  145. package/dev/components/breath.d.ts +3 -2
  146. package/dev/components/breath.d.ts.map +1 -1
  147. package/dev/components/breath.js +14 -20
  148. package/dev/components/breath.js.map +1 -1
  149. package/dev/components/button.d.ts +2 -1
  150. package/dev/components/button.d.ts.map +1 -1
  151. package/dev/components/button.js +2 -1
  152. package/dev/components/button.js.map +1 -1
  153. package/dev/components/card.d.ts +1 -0
  154. package/dev/components/card.d.ts.map +1 -1
  155. package/dev/components/card.js +2 -5
  156. package/dev/components/card.js.map +1 -1
  157. package/dev/components/carousel.d.ts +2 -0
  158. package/dev/components/carousel.d.ts.map +1 -1
  159. package/dev/components/carousel.js +7 -10
  160. package/dev/components/carousel.js.map +1 -1
  161. package/dev/components/details.d.ts +2 -2
  162. package/dev/components/details.d.ts.map +1 -1
  163. package/dev/components/details.js +16 -24
  164. package/dev/components/details.js.map +1 -1
  165. package/dev/components/dialog.d.ts +3 -1
  166. package/dev/components/dialog.d.ts.map +1 -1
  167. package/dev/components/dialog.js +2 -0
  168. package/dev/components/dialog.js.map +1 -1
  169. package/dev/components/divider.d.ts +1 -0
  170. package/dev/components/divider.d.ts.map +1 -1
  171. package/dev/components/divider.js +23 -22
  172. package/dev/components/divider.js.map +1 -1
  173. package/dev/components/dragbox.d.ts +2 -1
  174. package/dev/components/dragbox.d.ts.map +1 -1
  175. package/dev/components/dragbox.js +3 -1
  176. package/dev/components/dragbox.js.map +1 -1
  177. package/dev/components/flex.d.ts +1 -0
  178. package/dev/components/flex.d.ts.map +1 -1
  179. package/dev/components/flex.js +2 -1
  180. package/dev/components/flex.js.map +1 -1
  181. package/dev/components/form.d.ts +1 -0
  182. package/dev/components/form.d.ts.map +1 -1
  183. package/dev/components/form.js +1 -0
  184. package/dev/components/form.js.map +1 -1
  185. package/dev/components/grid.d.ts +1 -0
  186. package/dev/components/grid.d.ts.map +1 -1
  187. package/dev/components/grid.js +3 -2
  188. package/dev/components/grid.js.map +1 -1
  189. package/dev/components/input.d.ts +3 -0
  190. package/dev/components/input.d.ts.map +1 -1
  191. package/dev/components/input.js +15 -12
  192. package/dev/components/input.js.map +1 -1
  193. package/dev/components/layout.d.ts +4 -3
  194. package/dev/components/layout.d.ts.map +1 -1
  195. package/dev/components/layout.js +12 -15
  196. package/dev/components/layout.js.map +1 -1
  197. package/dev/components/link.d.ts +1 -0
  198. package/dev/components/link.d.ts.map +1 -1
  199. package/dev/components/link.js +1 -0
  200. package/dev/components/link.js.map +1 -1
  201. package/dev/components/progress.d.ts +1 -0
  202. package/dev/components/progress.d.ts.map +1 -1
  203. package/dev/components/progress.js +39 -38
  204. package/dev/components/progress.js.map +1 -1
  205. package/dev/components/range.d.ts +6 -2
  206. package/dev/components/range.d.ts.map +1 -1
  207. package/dev/components/range.js +15 -17
  208. package/dev/components/range.js.map +1 -1
  209. package/dev/components/rotate.d.ts +1 -0
  210. package/dev/components/rotate.d.ts.map +1 -1
  211. package/dev/components/rotate.js +1 -0
  212. package/dev/components/rotate.js.map +1 -1
  213. package/dev/components/router.d.ts +4 -5
  214. package/dev/components/router.d.ts.map +1 -1
  215. package/dev/components/router.js +11 -18
  216. package/dev/components/router.js.map +1 -1
  217. package/dev/components/select.d.ts +5 -1
  218. package/dev/components/select.d.ts.map +1 -1
  219. package/dev/components/select.js +30 -23
  220. package/dev/components/select.js.map +1 -1
  221. package/dev/components/skeleton.d.ts +1 -0
  222. package/dev/components/skeleton.d.ts.map +1 -1
  223. package/dev/components/skeleton.js +4 -2
  224. package/dev/components/skeleton.js.map +1 -1
  225. package/dev/components/split.d.ts +5 -1
  226. package/dev/components/split.d.ts.map +1 -1
  227. package/dev/components/split.js +14 -8
  228. package/dev/components/split.js.map +1 -1
  229. package/dev/components/switch.d.ts +2 -0
  230. package/dev/components/switch.d.ts.map +1 -1
  231. package/dev/components/switch.js +8 -10
  232. package/dev/components/switch.js.map +1 -1
  233. package/dev/components/text.d.ts +1 -0
  234. package/dev/components/text.d.ts.map +1 -1
  235. package/dev/components/text.js +3 -6
  236. package/dev/components/text.js.map +1 -1
  237. package/dev/components/time.d.ts +3 -1
  238. package/dev/components/time.d.ts.map +1 -1
  239. package/dev/components/time.js +4 -3
  240. package/dev/components/time.js.map +1 -1
  241. package/dev/components/tooltip.d.ts +1 -0
  242. package/dev/components/tooltip.d.ts.map +1 -1
  243. package/dev/components/tooltip.js +9 -11
  244. package/dev/components/tooltip.js.map +1 -1
  245. package/dev/components/typewriter.d.ts +2 -1
  246. package/dev/components/typewriter.d.ts.map +1 -1
  247. package/dev/components/typewriter.js +1 -0
  248. package/dev/components/typewriter.js.map +1 -1
  249. package/dev/core/global-style.d.ts +1 -1
  250. package/dev/core/global-style.d.ts.map +1 -1
  251. package/dev/core/global-style.js +2 -4
  252. package/dev/core/global-style.js.map +1 -1
  253. package/dev/core/super-anchor.d.ts.map +1 -1
  254. package/dev/core/super-anchor.js +20 -18
  255. package/dev/core/super-anchor.js.map +1 -1
  256. package/dev/core/super-input.d.ts +1 -1
  257. package/dev/core/super-input.d.ts.map +1 -1
  258. package/dev/core/super-input.js +35 -34
  259. package/dev/core/super-input.js.map +1 -1
  260. package/dev/core/super-openable.d.ts +1 -1
  261. package/dev/core/super-openable.d.ts.map +1 -1
  262. package/dev/core/super-openable.js +1 -1
  263. package/dev/core/super-openable.js.map +1 -1
  264. package/dialog.js +1 -1
  265. package/dialog.js.map +1 -1
  266. package/divider.js +1 -1
  267. package/divider.js.map +1 -1
  268. package/dragbox.js +1 -1
  269. package/dragbox.js.map +1 -1
  270. package/flex.js +1 -1
  271. package/flex.js.map +1 -1
  272. package/form.js +1 -1
  273. package/form.js.map +1 -1
  274. package/grid.js +1 -1
  275. package/grid.js.map +1 -1
  276. package/input.js +1 -1
  277. package/input.js.map +1 -1
  278. package/layout.js +1 -1
  279. package/layout.js.map +1 -1
  280. package/link.js +1 -1
  281. package/link.js.map +1 -1
  282. package/package.json +4 -4
  283. package/progress.js +1 -1
  284. package/progress.js.map +1 -1
  285. package/range.js +1 -1
  286. package/range.js.map +1 -1
  287. package/rotate.js +1 -1
  288. package/rotate.js.map +1 -1
  289. package/router.js +1 -1
  290. package/router.js.map +1 -1
  291. package/select.js +1 -1
  292. package/select.js.map +1 -1
  293. package/skeleton.js +1 -1
  294. package/skeleton.js.map +1 -1
  295. package/src/components/alert.ts +7 -7
  296. package/src/components/avatar.ts +4 -5
  297. package/src/components/breath.ts +18 -22
  298. package/src/components/button.ts +3 -2
  299. package/src/components/card.ts +2 -5
  300. package/src/components/carousel.ts +7 -10
  301. package/src/components/details.ts +16 -24
  302. package/src/components/dialog.ts +3 -1
  303. package/src/components/divider.ts +26 -25
  304. package/src/components/dragbox.ts +4 -2
  305. package/src/components/flex.ts +5 -2
  306. package/src/components/form.ts +1 -0
  307. package/src/components/grid.ts +6 -3
  308. package/src/components/input.ts +15 -12
  309. package/src/components/layout.ts +7 -14
  310. package/src/components/link.ts +1 -0
  311. package/src/components/progress.ts +42 -39
  312. package/src/components/range.ts +15 -21
  313. package/src/components/rotate.ts +1 -0
  314. package/src/components/router.ts +15 -14
  315. package/src/components/select.ts +31 -24
  316. package/src/components/skeleton.ts +4 -2
  317. package/src/components/split.ts +20 -11
  318. package/src/components/switch.ts +8 -10
  319. package/src/components/text.ts +6 -7
  320. package/src/components/time.ts +5 -4
  321. package/src/components/tooltip.ts +9 -13
  322. package/src/components/typewriter.ts +6 -3
  323. package/src/core/global-style.ts +3 -6
  324. package/src/core/super-anchor.ts +23 -19
  325. package/src/core/super-input.ts +36 -35
  326. package/src/core/super-openable.ts +2 -2
  327. package/switch.js +1 -1
  328. package/switch.js.map +1 -1
  329. package/text.js +1 -1
  330. package/text.js.map +1 -1
  331. package/time.js +1 -1
  332. package/time.js.map +1 -1
  333. package/tooltip.js +1 -1
  334. package/tooltip.js.map +1 -1
  335. package/typewriter.js +1 -1
  336. package/typewriter.js.map +1 -1
  337. package/vscode.html-custom-data.json +1 -1
  338. package/web-types.json +1 -1
@@ -4,7 +4,7 @@ import { attr } from "@godown/element/directives/attr.js";
4
4
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
5
5
  import svgCaretDown from "@godown/f7-icon/icons/chevron-down.js";
6
6
  import { css, html, type TemplateResult } from "lit";
7
- import { property, query } from "lit/decorators.js";
7
+ import { property } from "lit/decorators.js";
8
8
 
9
9
  import { scopePrefix } from "../core/global-style.js";
10
10
  import SuperOpenable from "../core/super-openable.js";
@@ -18,7 +18,7 @@ const cssScope = scopePrefix(protoName);
18
18
  *
19
19
  * @slot summary - Details summary if no `summary` is provided.
20
20
  * @slot - Details content.
21
- * @fires change - Fired when the details is toggled.
21
+ * @fires change - Fired when the open changes.
22
22
  * @category display
23
23
  */
24
24
  @godown(protoName)
@@ -27,7 +27,6 @@ const cssScope = scopePrefix(protoName);
27
27
  :host {
28
28
  ${cssScope}--icon-deg-open: 0deg;
29
29
  ${cssScope}--icon-deg-close: 90deg;
30
- ${cssScope}--icon-deg: 0deg;
31
30
  ${cssScope}--icon-space: 0.3em;
32
31
  ${cssScope}--summary-direction: row;
33
32
  ${cssScope}--transition: .3s;
@@ -36,13 +35,13 @@ const cssScope = scopePrefix(protoName);
36
35
  transition: var(${cssScope}--transition);
37
36
  }
38
37
 
39
- dl {
38
+ [part=root] {
40
39
  height: 100%;
41
40
  position: relative;
42
41
  overflow: hidden;
43
42
  }
44
43
 
45
- dt {
44
+ [part=title] {
46
45
  height: 100%;
47
46
  display: flex;
48
47
  flex-wrap: nowrap;
@@ -52,7 +51,7 @@ const cssScope = scopePrefix(protoName);
52
51
  flex-direction: var(${cssScope}--summary-direction);
53
52
  }
54
53
 
55
- dd {
54
+ [part=details] {
56
55
  display: grid;
57
56
  overflow: hidden;
58
57
  grid-template-rows: 0fr;
@@ -60,27 +59,24 @@ const cssScope = scopePrefix(protoName);
60
59
  transition-property: grid-template-rows;
61
60
  }
62
61
 
63
- i {
64
- display: flex;
65
- backface-visibility: hidden;
66
- padding: var(${cssScope}--icon-space);
67
- transition: var(${cssScope}--transition);
68
- transform: rotate(var(${cssScope}--icon-deg));
69
- }
70
-
71
- :host([open]) dd {
62
+ :host([open]) [part=details] {
72
63
  grid-template-rows: 1fr;
73
64
  }
74
65
 
75
- :host([float]) dd {
66
+ :host([float]) [part=details] {
76
67
  top: 100%;
77
68
  position: absolute;
78
69
  }
79
70
 
80
- i {
71
+ [part=icon] {
72
+ display: flex;
73
+ backface-visibility: hidden;
74
+ padding: var(${cssScope}--icon-space);
75
+ transition: var(${cssScope}--transition);
81
76
  transform: rotate(var(${cssScope}--icon-deg-close));
82
77
  }
83
- :host([open]) i {
78
+
79
+ :host([open]) [part=icon] {
84
80
  transform: rotate(var(${cssScope}--icon-deg-open));
85
81
  }
86
82
  `,
@@ -98,15 +94,10 @@ class Details extends SuperOpenable {
98
94
  @property()
99
95
  summary = "";
100
96
 
101
- @query("dd")
102
- protected _dd: HTMLDataListElement;
103
-
104
97
  protected render(): TemplateResult<1> {
105
98
  return html`<dl part="root" ${attr(this.observedRecord)}>
106
99
  <dt part="title" @click="${this._handelClick}">
107
- <span part="summary">
108
- ${this.summary || htmlSlot("summary")}
109
- </span>
100
+ <span part="summary">${this.summary || htmlSlot("summary")}</span>
110
101
  <span>
111
102
  <i part="icon">${svgCaretDown()}</i>
112
103
  </span>
@@ -119,3 +110,4 @@ class Details extends SuperOpenable {
119
110
  }
120
111
 
121
112
  export default Details;
113
+ export { Details };
@@ -1,4 +1,4 @@
1
- import { type HandlerEvent } from "@godown/element";
1
+ import type { HandlerEvent } from "@godown/element";
2
2
  import { godown } from "@godown/element/decorators/godown.js";
3
3
  import { styles } from "@godown/element/decorators/styles.js";
4
4
  import { attr } from "@godown/element/directives/attr.js";
@@ -19,6 +19,7 @@ const cssScope = scopePrefix(protoName);
19
19
  *
20
20
  * It listens for the keydown event and also closes itself when the {@linkcode key} contained in the key is pressed.
21
21
  *
22
+ * @fires change - Fires when the open changes.
22
23
  * @category feedback
23
24
  */
24
25
  @godown(protoName)
@@ -164,3 +165,4 @@ class Dialog extends SuperOpenable {
164
165
  }
165
166
 
166
167
  export default Dialog;
168
+ export { Dialog };
@@ -15,31 +15,31 @@ const protoName = "divider";
15
15
  @godown(protoName)
16
16
  @styles(
17
17
  css`
18
- :host {
19
- width: 100%;
20
- height: .05em;
21
- margin: auto;
22
- display: block;
23
- background: currentColor;
24
- }
25
-
26
- :host([vertical]) {
27
- width: .05em;
28
- height: max(1em, 100%);
29
- }
30
-
31
- :host([contents]) [part=root] {
32
- width: 100%;
33
- height: .05em;
34
- margin: auto;
35
- display: block;
36
- background: currentColor;
37
- }
38
-
39
- [part=root] {
40
- display: contents;
41
- }
42
- `,
18
+ :host {
19
+ width: 100%;
20
+ height: .05em;
21
+ margin: auto;
22
+ display: block;
23
+ background: currentColor;
24
+ }
25
+
26
+ :host([vertical]) {
27
+ width: .05em;
28
+ height: max(1em, 100%);
29
+ }
30
+
31
+ :host([contents]) [part=root] {
32
+ width: 100%;
33
+ height: .05em;
34
+ margin: auto;
35
+ display: block;
36
+ background: currentColor;
37
+ }
38
+
39
+ [part=root] {
40
+ display: contents;
41
+ }
42
+ `,
43
43
  )
44
44
  class Divider extends GlobalStyle {
45
45
  /**
@@ -54,3 +54,4 @@ class Divider extends GlobalStyle {
54
54
  }
55
55
 
56
56
  export default Divider;
57
+ export { Divider };
@@ -2,7 +2,7 @@ import { godown } from "@godown/element/decorators/godown.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
3
  import { attr } from "@godown/element/directives/attr.js";
4
4
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
5
- import { EventListenerFunc } from "@godown/element/tools/events.js";
5
+ import type { EventListenerFunc } from "@godown/element/tools/events.js";
6
6
  import { css, html, type TemplateResult } from "lit";
7
7
  import { property } from "lit/decorators.js";
8
8
 
@@ -67,7 +67,8 @@ class Dragbox extends GlobalStyle {
67
67
  part="root"
68
68
  ${attr(this.observedRecord)}
69
69
  @mousedown="${this._handleDragStart}"
70
- @mouseup="${this._handleDragEnd}">
70
+ @mouseup="${this._handleDragEnd}"
71
+ >
71
72
  ${htmlSlot()}
72
73
  </div>`;
73
74
  }
@@ -132,3 +133,4 @@ class Dragbox extends GlobalStyle {
132
133
  }
133
134
 
134
135
  export default Dragbox;
136
+ export { Dragbox };
@@ -18,7 +18,8 @@ const protoName = "flex";
18
18
  * @category layout
19
19
  */
20
20
  @godown(protoName)
21
- @styles(css`
21
+ @styles(
22
+ css`
22
23
  :host,
23
24
  :host([contents]) [part=root] {
24
25
  display: flex;
@@ -27,7 +28,8 @@ const protoName = "flex";
27
28
  [part=root] {
28
29
  display: contents;
29
30
  }
30
- `)
31
+ `,
32
+ )
31
33
  class Flex extends GlobalStyle {
32
34
  /**
33
35
  * CSS property `flex-flow` (`flex-direction flex-wrap`).
@@ -80,3 +82,4 @@ class Flex extends GlobalStyle {
80
82
  }
81
83
 
82
84
  export default Flex;
85
+ export { Flex };
@@ -80,3 +80,4 @@ class Form<T = object> extends GlobalStyle {
80
80
  }
81
81
 
82
82
  export default Form;
83
+ export { Form };
@@ -19,7 +19,8 @@ const protoName = "grid";
19
19
  * @category layout
20
20
  */
21
21
  @godown(protoName)
22
- @styles(css`
22
+ @styles(
23
+ css`
23
24
  :host,
24
25
  :host([contents]) [part=root] {
25
26
  display: grid;
@@ -28,7 +29,8 @@ const protoName = "grid";
28
29
  [part=root] {
29
30
  display: contents;
30
31
  }
31
- `)
32
+ `,
33
+ )
32
34
  class Grid extends GlobalStyle {
33
35
  /**
34
36
  * CSS property `gap`.
@@ -66,7 +68,7 @@ class Grid extends GlobalStyle {
66
68
 
67
69
  protected render(): TemplateResult<1> {
68
70
  return html`<div part="root" ${attr(this.observedRecord)}>
69
- ${[
71
+ ${[
70
72
  htmlSlot(),
71
73
  htmlStyle(
72
74
  joinRules({
@@ -85,3 +87,4 @@ class Grid extends GlobalStyle {
85
87
  }
86
88
 
87
89
  export default Grid;
90
+ export { Grid };
@@ -14,6 +14,8 @@ const protoName = "input";
14
14
  /**
15
15
  * {@linkcode Input} renders a text input.
16
16
  *
17
+ * @fires input - Fires when the input value changes.
18
+ * @fires change - Fires when the input value changes.
17
19
  * @category input
18
20
  */
19
21
  @godown(protoName)
@@ -45,20 +47,20 @@ class Input extends SuperInput {
45
47
 
46
48
  protected render(): TemplateResult<1> {
47
49
  return html`<div part="root" ${attr(this.observedRecord)} class="${classList("input-field", this.variant)}">
48
- ${[
50
+ ${[
49
51
  this._renderPrefix(),
50
52
  html`<input
51
- part="input"
52
- type="${this.type}"
53
- id="${this.makeId}"
54
- .value="${this.value}"
55
- placeholder="${this.placeholder || nothing}"
56
- ?autofocus="${this.autofocus}"
57
- autocapitalize="${this.autocapitalize || nothing}"
58
- autocomplete="${this.autocomplete || nothing}"
59
- ?disabled="${this.disabled}"
60
- @input="${this._handleInput}"
61
- >`,
53
+ part="input"
54
+ type="${this.type}"
55
+ id="${this.makeId}"
56
+ .value="${this.value}"
57
+ placeholder="${this.placeholder || nothing}"
58
+ ?autofocus="${this.autofocus}"
59
+ autocapitalize="${this.autocapitalize || nothing}"
60
+ autocomplete="${this.autocomplete || nothing}"
61
+ ?disabled="${this.disabled}"
62
+ @input="${this._handleInput}"
63
+ >`,
62
64
  this._renderSuffix(),
63
65
  ]}
64
66
  </div>`;
@@ -71,3 +73,4 @@ class Input extends SuperInput {
71
73
  }
72
74
 
73
75
  export default Input;
76
+ export { Input };
@@ -10,7 +10,7 @@ import { GlobalStyle } from "../core/global-style.js";
10
10
  const protoName = "layout";
11
11
 
12
12
  /**
13
- * {@linkcode NavLayout} renders slot and optional top header, bottom footer.
13
+ * {@linkcode Layout} renders slot and optional top header, bottom footer.
14
14
  *
15
15
  * @slot - The main content of the layout.
16
16
  * @slot header - The header of the layout.
@@ -50,7 +50,7 @@ const protoName = "layout";
50
50
  }
51
51
  `,
52
52
  )
53
- class NavLayout extends GlobalStyle {
53
+ class Layout extends GlobalStyle {
54
54
  /**
55
55
  * If true, remove the header slot.
56
56
  */
@@ -71,19 +71,12 @@ class NavLayout extends GlobalStyle {
71
71
 
72
72
  protected render(): TemplateResult<1> {
73
73
  return html`<div part="root" ${attr(this.observedRecord)}>
74
- ${
75
- !this.noHeader
76
- ? html`<header part="header">${htmlSlot("header")}</header>`
77
- : ""
78
- }
79
- <main part="main">${htmlSlot()}</main>
80
- ${
81
- !this.noFooter
82
- ? html`<footer part="footer">${htmlSlot("footer")}</footer>`
83
- : ""
84
- }
74
+ ${!this.noHeader ? html`<header part="header">${htmlSlot("header")}</header>` : ""}
75
+ <main part="main">${htmlSlot()}</main>
76
+ ${!this.noFooter ? html`<footer part="footer">${htmlSlot("footer")}</footer>` : ""}
85
77
  </div>`;
86
78
  }
87
79
  }
88
80
 
89
- export default NavLayout;
81
+ export default Layout;
82
+ export { Layout };
@@ -44,3 +44,4 @@ class Link extends SuperAnchor {
44
44
  }
45
45
 
46
46
  export default Link;
47
+ export { Link };
@@ -15,52 +15,54 @@ const protoName = "progress";
15
15
  * @category feedback
16
16
  */
17
17
  @godown(protoName)
18
- @styles(css`
19
- :host {
20
- width: 100%;
21
- height: 0.5em;
22
- border-radius: 0.25em;
23
- background: var(${cssGlobalVars.passive});
24
- color: var(${cssGlobalVars.active});
25
- }
26
-
27
- :host,
28
- [part=root] {
29
- display: block;
30
- }
18
+ @styles(
19
+ css`
20
+ :host {
21
+ width: 100%;
22
+ height: 0.5em;
23
+ border-radius: 0.25em;
24
+ background: var(${cssGlobalVars.passive});
25
+ color: var(${cssGlobalVars.active});
26
+ }
31
27
 
32
- [part=root] {
33
- height: inherit;
34
- z-index: 1;
35
- position: relative;
36
- border-radius: inherit;
37
- }
28
+ :host,
29
+ [part=root] {
30
+ display: block;
31
+ }
38
32
 
39
- [part=value] {
40
- position: absolute;
41
- z-index: 2;
42
- top: 0;
43
- left: 0;
44
- height: 100%;
45
- border-radius: inherit;
46
- transition: all 0.3s;
47
- animation: progress 1.8s ease-in-out infinite alternate;
48
- background: currentColor;
49
- }
33
+ [part=root] {
34
+ height: inherit;
35
+ z-index: 1;
36
+ position: relative;
37
+ border-radius: inherit;
38
+ }
50
39
 
51
- @keyframes progress {
52
- from {
40
+ [part=value] {
41
+ position: absolute;
42
+ z-index: 2;
43
+ top: 0;
53
44
  left: 0;
45
+ height: 100%;
46
+ border-radius: inherit;
47
+ transition: all 0.3s;
48
+ animation: progress 1.8s ease-in-out infinite alternate;
49
+ background: currentColor;
54
50
  }
55
- to {
56
- left: 80%;
51
+
52
+ @keyframes progress {
53
+ from {
54
+ left: 0;
55
+ }
56
+ to {
57
+ left: 80%;
58
+ }
57
59
  }
58
- }
59
60
 
60
- .static [part=value] {
61
- animation: none;
62
- }
63
- `)
61
+ .static [part=value] {
62
+ animation: none;
63
+ }
64
+ `,
65
+ )
64
66
  class Progress extends GlobalStyle {
65
67
  @property({ type: Number })
66
68
  max = 1;
@@ -98,3 +100,4 @@ class Progress extends GlobalStyle {
98
100
  }
99
101
 
100
102
  export default Progress;
103
+ export { Progress };
@@ -21,6 +21,11 @@ const cssScope = scopePrefix(protoName);
21
21
  *
22
22
  * Number has 1 handle, the array has the number of its elements and the minimum is 2.
23
23
  *
24
+ * @fires input - Fires when the input value changes.
25
+ * @fires change - Fires when the input value changes.
26
+ * @fires range - Fires when the value changes.
27
+ * @fires focus - Fires when the handle is focused.
28
+ * @fires blur - Fires when the handle is blurred.
24
29
  * @category input
25
30
  */
26
31
  @godown(protoName)
@@ -218,19 +223,14 @@ class Range extends SuperInput {
218
223
  "--to": `${((to - this.min) / gap) * 100}%`,
219
224
  ...(this.range
220
225
  ? Object.fromEntries(
221
- rangeValue.map((value, index) => [
222
- `--handle-${index}`,
223
- `${((value - this.min) / gap) * 100}%`,
224
- ]),
226
+ rangeValue.map((value, index) => [`--handle-${index}`, `${((value - this.min) / gap) * 100}%`]),
225
227
  )
226
228
  : {}),
227
229
  })
228
- }"><div part="track"></div>
229
- ${
230
- this.range
231
- ? (this.value as number[]).map((_, index) => this.renderHandle(index))
232
- : this.renderHandle(0)
233
- }
230
+ }"
231
+ >
232
+ <div part="track"></div>
233
+ ${this.range ? (this.value as number[]).map((_, index) => this.renderHandle(index)) : this.renderHandle(0)}
234
234
  </div>`;
235
235
  }
236
236
 
@@ -246,7 +246,7 @@ class Range extends SuperInput {
246
246
  @blur="${this.disabled ? null : this.blurHandle}"
247
247
  style="z-index:${this._focusStack.indexOf(index) + 1};--handle:var(--${
248
248
  /* In single-handle mod or end, it is max value */
249
- (!range && end) ? `to` : `handle-${index}`})"
249
+ (!range && end) ? "to" : `handle-${index}`})"
250
250
  ></i>
251
251
  `;
252
252
  }
@@ -265,11 +265,13 @@ class Range extends SuperInput {
265
265
  if (!this._keydownEvent) {
266
266
  this._keydownEvent = this.events.add(document, "keydown", this.createKeydownEvent(index));
267
267
  }
268
+ this.dispatchEvent(new CustomEvent("focus", { detail: index }));
268
269
  }
269
270
 
270
271
  blurHandle(): void {
271
272
  this.lastFocus = undefined;
272
273
  this._keydownEvent = this.events.remove(document, "keydown", this._keydownEvent);
274
+ this.dispatchEvent(new CustomEvent("blur"));
273
275
  }
274
276
 
275
277
  protected createKeydownEvent(index: number) {
@@ -294,12 +296,6 @@ class Range extends SuperInput {
294
296
  };
295
297
  }
296
298
 
297
- protected _handleMousedownEnd(e: MouseEvent): void {
298
- this.lastFocus = 0;
299
- this.createMousedownListener(this.setEnd)(e);
300
- this.focusHandle(0);
301
- }
302
-
303
299
  createSetValue(index: number) {
304
300
  return (numberOrModifier: number | ((value: number) => number)): void => {
305
301
  const number = typeof numberOrModifier === "number"
@@ -311,13 +307,10 @@ class Range extends SuperInput {
311
307
  newValue[index] = number;
312
308
  }
313
309
  this.value = newValue;
310
+ this.dispatchEvent(new CustomEvent("range", { detail: this.value }));
314
311
  };
315
312
  }
316
313
 
317
- setEnd(value: number): void {
318
- this.createSetValue((this.value as any)?.length - 1 || 0)(value);
319
- }
320
-
321
314
  /**
322
315
  * Compute value from event.
323
316
  */
@@ -407,3 +400,4 @@ class Range extends SuperInput {
407
400
  }
408
401
 
409
402
  export default Range;
403
+ export { Range };
@@ -93,3 +93,4 @@ class Rotate extends GlobalStyle {
93
93
  }
94
94
 
95
95
  export default Rotate;
96
+ export { Rotate };
@@ -69,13 +69,7 @@ class Router extends GlobalStyle {
69
69
  * Current pathname (equals to location.pathname).
70
70
  */
71
71
  @property()
72
- pathname = "";
73
-
74
- /**
75
- * Path prefix.
76
- */
77
- @property()
78
- baseURL = "";
72
+ pathname: string;
79
73
 
80
74
  /**
81
75
  * Rendered content when there is no match.
@@ -109,6 +103,7 @@ class Router extends GlobalStyle {
109
103
 
110
104
  get routes(): (Record<string, any> & {
111
105
  path: string;
106
+ render?: (ur: ReturnType<Router["useRouter"]>) => unknown;
112
107
  component?: unknown;
113
108
  })[] {
114
109
  return this.__routes;
@@ -202,7 +197,7 @@ class Router extends GlobalStyle {
202
197
  * Get component from {@linkcode routes} by query.
203
198
  */
204
199
  fieldComponent(query?: string): unknown {
205
- query ||= this.__fieldRouteTree.search(RouteTree.split(this.pathname))?.pattern || null;
200
+ query ||= this.__fieldRouteTree.search(this.pathname)?.pattern;
206
201
  this.path = query;
207
202
 
208
203
  if (!query) {
@@ -214,26 +209,31 @@ class Router extends GlobalStyle {
214
209
  if (!route) {
215
210
  return null;
216
211
  }
212
+
213
+ if ("render" in route) {
214
+ return route.render?.(this.useRouter()) || null;
215
+ }
216
+
217
217
  return route.component;
218
218
  }
219
219
 
220
220
  /**
221
221
  * Get component from slotted elements by query.
222
222
  */
223
- slottedComponent(usedRouteTemplate?: string): TemplateResult<1> {
223
+ slottedComponent(query?: string): TemplateResult<1> {
224
224
  const slottedPaths = this._slottedNames;
225
- usedRouteTemplate ||= this.__slottedRouteTree.search(RouteTree.split(this.pathname))?.pattern || null;
226
- this.path = usedRouteTemplate;
225
+ query ||= this.__slottedRouteTree.search(this.pathname)?.pattern;
226
+ this.path = query;
227
227
 
228
- if (!usedRouteTemplate) {
228
+ if (!query) {
229
229
  return null;
230
230
  }
231
231
 
232
- this.path = slottedPaths.find((s) => s === usedRouteTemplate);
232
+ this.path = slottedPaths.find((s) => s === query);
233
233
  if (!this.path) {
234
234
  return null;
235
235
  }
236
- this.params = this.parseParams(usedRouteTemplate, this.pathname);
236
+ this.params = this.parseParams(query, this.pathname);
237
237
  return htmlSlot(this.path);
238
238
  }
239
239
 
@@ -275,3 +275,4 @@ class Router extends GlobalStyle {
275
275
  }
276
276
 
277
277
  export default Router;
278
+ export { Router };