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
@@ -1,4 +1,4 @@
1
- import { HandlerEvent } from "@godown/element";
1
+ import type { HandlerEvent } from "@godown/element";
2
2
  import { godown } from "@godown/element/decorators/godown.js";
3
3
  import { part } from "@godown/element/decorators/part.js";
4
4
  import { styles } from "@godown/element/decorators/styles.js";
@@ -45,6 +45,9 @@ const protoName = "select";
45
45
  *
46
46
  * Input will filter the element.
47
47
  *
48
+ * @fires input - Fires when the input value changes.
49
+ * @fires change - Fires when the input value changes.
50
+ * @fires select - Fires when select an option.
48
51
  * @slot - Options.
49
52
  * @category input
50
53
  */
@@ -105,34 +108,36 @@ class Select extends Input {
105
108
  private _store: { value: string; text: string; }[] = [];
106
109
 
107
110
  protected render(): TemplateResult<1> {
108
- return html`<div part="root" ${
111
+ return html`<div
112
+ part="root"
113
+ ${
109
114
  attr({
110
115
  ...this.observedRecord,
111
116
  direction: this.direction || this.autoDirection,
112
117
  })
113
- } class="input-field">
114
- ${[
118
+ }
119
+ class="input-field"
120
+ >
121
+ ${[
115
122
  this._renderPrefix(),
116
123
  html`<input
117
- part="input"
118
- dir="${ifDefined(this.dir)}"
119
- id="${this.makeId}"
120
- .value="${this.text}"
121
- type="${this.type}"
122
- placeholder="${this.placeholder || nothing}"
123
- ?autofocus="${this.autofocus}"
124
- autocapitalize="${this.autocapitalize || nothing}"
125
- autocomplete="${this.autocomplete || nothing}"
126
- ?disabled="${this.disabled}"
127
- @focus="${this._handleFocus}"
128
- @input="${this._handleInput}"
129
- >`,
124
+ part="input"
125
+ dir="${ifDefined(this.dir)}"
126
+ id="${this.makeId}"
127
+ .value="${this.text}"
128
+ type="${this.type}"
129
+ placeholder="${this.placeholder || nothing}"
130
+ ?autofocus="${this.autofocus}"
131
+ autocapitalize="${this.autocapitalize || nothing}"
132
+ autocomplete="${this.autocomplete || nothing}"
133
+ ?disabled="${this.disabled}"
134
+ @focus="${this._handleFocus}"
135
+ @input="${this._handleInput}"
136
+ >`,
130
137
  html`<label for="${this.makeId}" part="suffix">
131
- <i part="icon">${svgCaretDown()}</i>
132
- </label>`,
133
- html`<label for="${this.makeId}" part="content">
134
- ${htmlSlot()}
135
- </label>`,
138
+ <i part="icon">${svgCaretDown()}</i>
139
+ </label>`,
140
+ html`<label for="${this.makeId}" part="content"> ${htmlSlot()} </label>`,
136
141
  ]}
137
142
  </div>`;
138
143
  }
@@ -227,7 +232,7 @@ class Select extends Input {
227
232
  operation = 1;
228
233
  }
229
234
  }
230
- this.dispatchEvent(new CustomEvent("change", { detail: this.namevalue() }));
235
+ this.dispatchEvent(new CustomEvent("select", { detail: this.value, composed: true }));
231
236
  this.filter();
232
237
  return operation;
233
238
  }
@@ -257,7 +262,8 @@ class Select extends Input {
257
262
  }
258
263
  const s = this._input.value;
259
264
  this.filter(this.multiple ? betweenAt(this._input.selectionStart, s, ",") : s);
260
- this.dispatchEvent(new CustomEvent("input", { detail: this.namevalue() }));
265
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
266
+ this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
261
267
  }
262
268
 
263
269
  focus(options?: FocusOptions): void {
@@ -277,3 +283,4 @@ class Select extends Input {
277
283
  }
278
284
 
279
285
  export default Select;
286
+ export { Select };
@@ -111,9 +111,11 @@ class Skeleton extends GlobalStyle {
111
111
  return htmlSlot();
112
112
  }
113
113
  return html`<div part="root" ${attr(this.observedRecord)}>
114
- ${this.type === "image" ? iconPhoto() : ""}
115
- ${htmlSlot("loading")}</div>`;
114
+ ${this.type === "image" ? iconPhoto() : ""}
115
+ ${htmlSlot("loading")}
116
+ </div>`;
116
117
  }
117
118
  }
118
119
 
119
120
  export default Skeleton;
121
+ export { Skeleton };
@@ -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 { classList } from "@godown/element/directives/class-list.js";
5
- import { type HandlerEvent } from "@godown/element/element.js";
5
+ import type { HandlerEvent } from "@godown/element/element.js";
6
6
  import { css, html, nothing, type TemplateResult } from "lit";
7
7
  import { property, state } from "lit/decorators.js";
8
8
 
@@ -27,6 +27,10 @@ const loop = <T>(len: number, fn: (index?: number) => T) => {
27
27
  *
28
28
  * Delete: will move the focus box forward until the first and no inputs for each.
29
29
  *
30
+ * @fires input - Fires when the input value changes.
31
+ * @fires change - Fires when the input value changes.
32
+ * @fires focus - Fires when the input is focused.
33
+ * @fires blur - Fires when the input is blurred.
30
34
  * @category input
31
35
  */
32
36
  @godown(protoName)
@@ -99,12 +103,17 @@ class Split extends SuperInput {
99
103
 
100
104
  protected render(): TemplateResult<1> {
101
105
  return html`<div part="root" ${attr(this.observedRecord)}>
102
- ${
103
- loop(this.len, (index: number) =>
104
- html`<span part="input-box"
105
- @click="${this.disabled ? null : () => this.focusAt(index)}"
106
- class="${classList({ focus: this.current === index }) || nothing}"
107
- >${this.currentValue[index]}</span>`)
106
+ ${
107
+ loop(
108
+ this.len,
109
+ (index: number) =>
110
+ html`<span
111
+ part="input-box"
112
+ @click="${this.disabled ? null : () => this.focusAt(index)}"
113
+ class="${classList({ focus: this.current === index }) || nothing}"
114
+ >${this.currentValue[index]}</span
115
+ >`,
116
+ )
108
117
  }
109
118
  <input
110
119
  part="input"
@@ -115,8 +124,7 @@ class Split extends SuperInput {
115
124
  /* Ensure that input always has a value of length this.len */
116
125
  this.value.padStart(this.len, " ")}"
117
126
  >
118
- </div>
119
- `;
127
+ </div> `;
120
128
  }
121
129
 
122
130
  connectedCallback(): void {
@@ -133,8 +141,7 @@ class Split extends SuperInput {
133
141
  this.fillInput(e.data);
134
142
  this.value = this.currentValue.join("");
135
143
 
136
- this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
137
- this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
144
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
138
145
  }
139
146
 
140
147
  /**
@@ -204,12 +211,14 @@ class Split extends SuperInput {
204
211
  focusAt(i: number): void {
205
212
  this.current = i;
206
213
  this._input.focus();
214
+ this.dispatchEvent(new CustomEvent("focus", { detail: i, bubbles: true, composed: true }));
207
215
  }
208
216
 
209
217
  blur(): void {
210
218
  this._input.blur();
211
219
  this.current = -1;
212
220
  super.blur();
221
+ this.dispatchEvent(new CustomEvent("blur", { bubbles: true, composed: true }));
213
222
  }
214
223
 
215
224
  reset(): void {
@@ -16,6 +16,7 @@ const cssScope = scopePrefix(protoName);
16
16
  * The switch is rectangular by default,
17
17
  * set the round property to rounded switch.
18
18
  *
19
+ * @fires change - Fires when the switch is switched.
19
20
  * @category input
20
21
  */
21
22
  @godown(protoName)
@@ -40,7 +41,7 @@ const cssScope = scopePrefix(protoName);
40
41
  }
41
42
 
42
43
  [part=root],
43
- span {
44
+ [part=handle] {
44
45
  transition: var(${cssScope}-transition);
45
46
  }
46
47
 
@@ -50,14 +51,14 @@ const cssScope = scopePrefix(protoName);
50
51
  height: inherit;
51
52
  }
52
53
 
53
- input {
54
+ [part=input] {
54
55
  opacity: 0;
55
56
  width: 100%;
56
57
  height: 100%;
57
58
  appearance: none;
58
59
  }
59
60
 
60
- span {
61
+ [part=handle] {
61
62
  height: 100%;
62
63
  display: inline-flex;
63
64
  align-items: center;
@@ -74,7 +75,7 @@ const cssScope = scopePrefix(protoName);
74
75
  background: var(${cssGlobalVars.passive});
75
76
  }
76
77
 
77
- :host([checked]) span {
78
+ :host([checked]) [part=handle] {
78
79
  left: 50%;
79
80
  }
80
81
 
@@ -86,7 +87,7 @@ const cssScope = scopePrefix(protoName);
86
87
  background: var(${cssGlobalVars.passive});
87
88
  }
88
89
 
89
- .round span{
90
+ .round [part=handle] {
90
91
  --size: var(${cssScope}-handle-size);
91
92
  border-radius: 100%;
92
93
  background: var(--godown--input-control);
@@ -135,10 +136,7 @@ class Switch extends SuperInput {
135
136
  protected _input: HTMLInputElement;
136
137
 
137
138
  protected render(): TemplateResult<1> {
138
- return html`<div part="root"
139
- ${attr(this.observedRecord)}
140
- class="${this.round ? "round" : "rect"}"
141
- >
139
+ return html`<div part="root" ${attr(this.observedRecord)} class="${this.round ? "round" : "rect"}">
142
140
  <input
143
141
  part="input"
144
142
  @change="${this._handleChange}"
@@ -169,7 +167,6 @@ class Switch extends SuperInput {
169
167
 
170
168
  protected _handleChange(): void {
171
169
  this.checked = this._input.checked;
172
- this.dispatchEvent(new CustomEvent("input", { detail: this.checked, bubbles: true, composed: true }));
173
170
  this.dispatchEvent(new CustomEvent("change", { detail: this.checked, composed: true }));
174
171
  }
175
172
 
@@ -179,3 +176,4 @@ class Switch extends SuperInput {
179
176
  }
180
177
 
181
178
  export default Switch;
179
+ export { Switch };
@@ -18,7 +18,8 @@ const cssScope = scopePrefix(protoName);
18
18
  * @category display
19
19
  */
20
20
  @godown(protoName)
21
- @styles(css`
21
+ @styles(
22
+ css`
22
23
  :host {
23
24
  ${cssScope}--color: currentColor;
24
25
  ${cssScope}--color-hover: currentColor;
@@ -65,7 +66,8 @@ const cssScope = scopePrefix(protoName);
65
66
  background-clip: text;
66
67
  -webkit-background-clip: text;
67
68
  }
68
- `)
69
+ `,
70
+ )
69
71
  class Text extends GlobalStyle {
70
72
  /**
71
73
  * Underline behavior.
@@ -80,14 +82,11 @@ class Text extends GlobalStyle {
80
82
  clip = false;
81
83
 
82
84
  protected render(): TemplateResult<1> {
83
- return html`<span
84
- part="root"
85
- ${attr(this.observedRecord)}
86
- class="${classList(this.underline)}"
87
- >
85
+ return html`<span part="root" ${attr(this.observedRecord)} class="${classList(this.underline)}">
88
86
  ${htmlSlot()}
89
87
  </span>`;
90
88
  }
91
89
  }
92
90
 
93
91
  export default Text;
92
+ export { Text };
@@ -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 fmtime from "fmtime";
5
- import { css, html, type PropertyValues, TemplateResult } from "lit";
5
+ import { css, html, type PropertyValues, type TemplateResult } from "lit";
6
6
  import { property } from "lit/decorators.js";
7
7
 
8
8
  import { GlobalStyle } from "../core/global-style.js";
@@ -12,6 +12,7 @@ const protoName = "time";
12
12
  /**
13
13
  * {@linkcode Time} renders a formatting time.
14
14
  *
15
+ * @fires time - Fires when the time changes.
15
16
  * @category display
16
17
  */
17
18
  @godown(protoName)
@@ -50,9 +51,7 @@ class Time extends GlobalStyle {
50
51
  protected timeoutId: number;
51
52
 
52
53
  protected render(): TemplateResult<1> {
53
- return html`<span part="root" ${attr(this.observedRecord)}>
54
- ${fmtime(this.format, this.time, this.escape)}
55
- </span>`;
54
+ return html`<span part="root" ${attr(this.observedRecord)}>${fmtime(this.format, this.time, this.escape)}</span>`;
56
55
  }
57
56
 
58
57
  protected firstUpdated(): void {
@@ -76,9 +75,11 @@ class Time extends GlobalStyle {
76
75
 
77
76
  startTimeout(): number {
78
77
  return window.setInterval(() => {
78
+ this.dispatchEvent(new CustomEvent("time", { detail: this.time, composed: true }));
79
79
  this.time = new Date(this.time.getTime() + (this.gap || this.timeout));
80
80
  }, Math.abs(this.timeout));
81
81
  }
82
82
  }
83
83
 
84
84
  export default Time;
85
+ export { Time };
@@ -126,25 +126,21 @@ class Tooltip extends SuperOpenable {
126
126
  protected render(): TemplateResult<1> {
127
127
  const align = Tooltip.aligns[this.align] || "inherit";
128
128
  const isFocusable = this.type === "focus";
129
- return html`<div
129
+ return html`<div
130
130
  part="root"
131
131
  ${attr(this.observedRecord)}
132
132
  tabindex="${isFocusable ? 0 : -1}"
133
- @focus="${isFocusable ? () => this.open = true : null}"
134
- @blur="${isFocusable ? () => this.open = false : null}"
135
- @mouseenter="${isFocusable ? null : () => this.open = true}"
136
- @mouseleave="${isFocusable ? null : () => this.open = false}"
137
- style="justify-content:${align};align-items:${align}">
133
+ @focus="${isFocusable ? () => (this.open = true) : null}"
134
+ @blur="${isFocusable ? () => (this.open = false) : null}"
135
+ @mouseenter="${isFocusable ? null : () => (this.open = true)}"
136
+ @mouseleave="${isFocusable ? null : () => (this.open = false)}"
137
+ style="justify-content:${align};align-items:${align}"
138
+ >
138
139
  ${htmlSlot()}
139
- <div part="tip">
140
- ${
141
- this.tip
142
- ? html`<span class="passive">${this.tip}</span>`
143
- : htmlSlot("tip")
144
- }
145
- </div>
140
+ <div part="tip">${this.tip ? html`<span class="passive">${this.tip}</span>` : htmlSlot("tip")}</div>
146
141
  </div>`;
147
142
  }
148
143
  }
149
144
 
150
145
  export default Tooltip;
146
+ export { Tooltip };
@@ -4,7 +4,7 @@ import { attr } from "@godown/element/directives/attr.js";
4
4
  import { classList } from "@godown/element/directives/class-list.js";
5
5
  import { htmlSlot } from "@godown/element/directives/html-slot.js";
6
6
  import { random } from "@godown/element/tools/lib.js";
7
- import { css, html, type PropertyValueMap, TemplateResult } from "lit";
7
+ import { css, html, type PropertyValueMap, type TemplateResult } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
9
 
10
10
  import { GlobalStyle, scopePrefix } from "../core/global-style.js";
@@ -18,7 +18,8 @@ const cssScope = scopePrefix(protoName);
18
18
  * @category effect
19
19
  */
20
20
  @godown(protoName)
21
- @styles(css`
21
+ @styles(
22
+ css`
22
23
  :host {
23
24
  ${cssScope}--cursor-width: .05em;
24
25
  }
@@ -50,7 +51,8 @@ const cssScope = scopePrefix(protoName);
50
51
  .hidden {
51
52
  visibility: hidden;
52
53
  }
53
- `)
54
+ `,
55
+ )
54
56
  class Typewriter extends GlobalStyle {
55
57
  /**
56
58
  * Raw text.
@@ -157,3 +159,4 @@ class Typewriter extends GlobalStyle {
157
159
  }
158
160
 
159
161
  export default Typewriter;
162
+ export { Typewriter };
@@ -1,12 +1,9 @@
1
1
  import { type Gradients, presetsRGB } from "@godown/colors/presets-rgb.js";
2
2
  import { travel } from "@godown/colors/travel.js";
3
3
  import GodownElement from "@godown/element";
4
- import GodownConfig from "@godown/element/config.js";
5
4
  import { joinProperties } from "@godown/element/tools/css.js";
6
5
  import { trim } from "@godown/element/tools/lib.js";
7
- import { css, CSSResult, unsafeCSS } from "lit";
8
-
9
- GodownElement.godownConfig ||= new GodownConfig();
6
+ import { css, type CSSResult, unsafeCSS } from "lit";
10
7
 
11
8
  export class GlobalStyle extends GodownElement {
12
9
  }
@@ -18,7 +15,7 @@ export function scopePrefix(scope: string, len = 1): CSSResult {
18
15
  }
19
16
 
20
17
  export function variablePrefix(variable: string): CSSResult {
21
- return unsafeCSS("--" + variable);
18
+ return unsafeCSS(`--${variable}`);
22
19
  }
23
20
 
24
21
  export const cssGlobalVars: {
@@ -101,5 +98,5 @@ GlobalStyle.styles = [
101
98
  all: inherit;
102
99
  display: revert;
103
100
  }
104
- `,
101
+ `,
105
102
  ];
@@ -7,25 +7,27 @@ import { ifDefined } from "lit/directives/if-defined.js";
7
7
 
8
8
  import { GlobalStyle } from "./global-style.js";
9
9
 
10
- @styles(css`
11
- :host {
12
- display: inline-block;
13
- color: currentColor;
14
- text-decoration: none;
15
- cursor: default;
16
- }
10
+ @styles(
11
+ css`
12
+ :host {
13
+ display: inline-block;
14
+ color: currentColor;
15
+ text-decoration: none;
16
+ cursor: default;
17
+ }
17
18
 
18
- :host([href]) {
19
- cursor: pointer;
20
- }
19
+ :host([href]) {
20
+ cursor: pointer;
21
+ }
21
22
 
22
- [part=root] {
23
- width: 100%;
24
- color: inherit;
25
- display: inline-block;
26
- text-decoration: inherit;
27
- }
28
- `)
23
+ [part=root] {
24
+ width: 100%;
25
+ color: inherit;
26
+ display: inline-block;
27
+ text-decoration: inherit;
28
+ }
29
+ `,
30
+ )
29
31
  class SuperAnchor extends GlobalStyle {
30
32
  /**
31
33
  * A element href.
@@ -39,11 +41,13 @@ class SuperAnchor extends GlobalStyle {
39
41
  target: "_blank" | "_self" | "_parent" | "_top" = "_self";
40
42
 
41
43
  protected render(): TemplateResult<1> {
42
- return html`<a part="root"
44
+ return html`<a
45
+ part="root"
43
46
  ${attr(this.observedRecord)}
44
47
  href="${ifDefined(this.href)}"
45
48
  target="${this.target}"
46
- @click=${this._handleClick}>
49
+ @click=${this._handleClick}
50
+ >
47
51
  ${htmlSlot()}
48
52
  </a>`;
49
53
  }
@@ -1,7 +1,7 @@
1
1
  import { part } from "@godown/element/decorators/part.js";
2
2
  import { styles } from "@godown/element/decorators/styles.js";
3
3
  import { htmlSlot } from "@godown/element/directives/index.js";
4
- import { type HandlerEvent } from "@godown/element/element.js";
4
+ import type { HandlerEvent } from "@godown/element/element.js";
5
5
  import iconEyeSlashFill from "@godown/f7-icon/icons/eye-slash-fill.js";
6
6
  import { css, html, type TemplateResult } from "lit";
7
7
  import { property } from "lit/decorators.js";
@@ -9,46 +9,46 @@ import { property } from "lit/decorators.js";
9
9
  import { cssGlobalVars, GlobalStyle } from "./global-style.js";
10
10
 
11
11
  const fieldStyle = css`
12
- .input-field {
13
- display: flex;
14
- position: relative;
15
- align-items: center;
16
- border-radius: inherit;
17
- height: inherit;
18
- }
12
+ .input-field {
13
+ display: flex;
14
+ position: relative;
15
+ align-items: center;
16
+ border-radius: inherit;
17
+ height: inherit;
18
+ }
19
19
 
20
- .input-field [part=input] {
21
- background: transparent;
22
- height: 100%;
23
- width: 100%;
24
- color: inherit;
25
- padding: 0 var(${cssGlobalVars.input}-space);
26
- }
20
+ .input-field [part=input] {
21
+ background: transparent;
22
+ height: 100%;
23
+ width: 100%;
24
+ color: inherit;
25
+ padding: 0 var(${cssGlobalVars.input}-space);
26
+ }
27
27
 
28
- .input-field:focus-within,
29
- .input-field.outline {
30
- box-shadow: var(${cssGlobalVars.input}-box-shadow);
31
- }
28
+ .input-field:focus-within,
29
+ .input-field.outline {
30
+ box-shadow: var(${cssGlobalVars.input}-box-shadow);
31
+ }
32
32
 
33
- .input-field [part=icon] {
34
- display: flex;
35
- align-items: center;
36
- justify-content: center;
37
- }
33
+ .input-field [part=icon] {
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ }
38
38
 
39
- .input-field [part=prefix],
40
- .input-field [part=suffix] {
41
- height: 100%;
42
- display: flex;
43
- }
39
+ .input-field [part=prefix],
40
+ .input-field [part=suffix] {
41
+ height: 100%;
42
+ display: flex;
43
+ }
44
44
 
45
- .input-field [part=suffix] [part=icon] {
46
- padding-inline-end: var(${cssGlobalVars.input}-space);
47
- }
45
+ .input-field [part=suffix] [part=icon] {
46
+ padding-inline-end: var(${cssGlobalVars.input}-space);
47
+ }
48
48
 
49
- .input-field [part=prefix] [part=icon] {
50
- padding-inline-start: var(${cssGlobalVars.input}-space);
51
- }
49
+ .input-field [part=prefix] [part=icon] {
50
+ padding-inline-start: var(${cssGlobalVars.input}-space);
51
+ }
52
52
  `;
53
53
 
54
54
  const inputStyle = css`
@@ -148,6 +148,7 @@ class SuperInput extends GlobalStyle {
148
148
  composed: true,
149
149
  }),
150
150
  );
151
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
151
152
  this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
152
153
  }
153
154
 
@@ -1,4 +1,4 @@
1
- import { type PropertyValueMap } from "lit";
1
+ import type { PropertyValueMap } from "lit";
2
2
  import { property } from "lit/decorators.js";
3
3
 
4
4
  import { GlobalStyle } from "./global-style.js";
@@ -25,7 +25,7 @@ class SuperOpenable extends GlobalStyle {
25
25
  protected updated(changedProperties: PropertyValueMap<this>): void {
26
26
  const open = changedProperties.get("open");
27
27
  if (open !== undefined) {
28
- this.dispatchEvent(new CustomEvent("change", { detail: this.open }));
28
+ this.dispatchEvent(new CustomEvent("change", { detail: this.open, composed: true }));
29
29
  }
30
30
  }
31
31
 
package/switch.js CHANGED
@@ -1,2 +1,2 @@
1
- import e from"./components/switch.js";e.define();export{e as default};
1
+ import o from"./components/switch.js";export{Switch}from"./components/switch.js";o.define();export{o as default};
2
2
  //# sourceMappingURL=switch.js.map
package/switch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sources":["src/switch.ts"],"sourcesContent":null,"names":["Switch","define"],"mappings":"sCAEAA,EAAOC"}
1
+ {"version":3,"file":"switch.js","sources":["src/switch.ts"],"sourcesContent":null,"names":["Switch","define"],"mappings":"iFAEAA,EAAOC"}
package/text.js CHANGED
@@ -1,2 +1,2 @@
1
- import e from"./components/text.js";e.define();export{e as default};
1
+ import t from"./components/text.js";export{Text}from"./components/text.js";t.define();export{t as default};
2
2
  //# sourceMappingURL=text.js.map
package/text.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sources":["src/text.ts"],"sourcesContent":null,"names":["Text","define"],"mappings":"oCAEAA,EAAKC"}
1
+ {"version":3,"file":"text.js","sources":["src/text.ts"],"sourcesContent":null,"names":["Text","define"],"mappings":"2EAEAA,EAAKC"}
package/time.js CHANGED
@@ -1,2 +1,2 @@
1
- import e from"./components/time.js";e.define();export{e as default};
1
+ import e from"./components/time.js";export{Time}from"./components/time.js";e.define();export{e as default};
2
2
  //# sourceMappingURL=time.js.map
package/time.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"time.js","sources":["src/time.ts"],"sourcesContent":null,"names":["Time","define"],"mappings":"oCAEAA,EAAKC"}
1
+ {"version":3,"file":"time.js","sources":["src/time.ts"],"sourcesContent":null,"names":["Time","define"],"mappings":"2EAEAA,EAAKC"}
package/tooltip.js CHANGED
@@ -1,2 +1,2 @@
1
- import o from"./components/tooltip.js";o.define();export{o as default};
1
+ import o from"./components/tooltip.js";export{Tooltip}from"./components/tooltip.js";o.define();export{o as default};
2
2
  //# sourceMappingURL=tooltip.js.map
package/tooltip.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["src/tooltip.ts"],"sourcesContent":null,"names":["Tooltip","define"],"mappings":"uCAEAA,EAAQC"}
1
+ {"version":3,"file":"tooltip.js","sources":["src/tooltip.ts"],"sourcesContent":null,"names":["Tooltip","define"],"mappings":"oFAEAA,EAAQC"}
package/typewriter.js CHANGED
@@ -1,2 +1,2 @@
1
- import e from"./components/typewriter.js";e.define();export{e as default};
1
+ import e from"./components/typewriter.js";export{Typewriter}from"./components/typewriter.js";e.define();export{e as default};
2
2
  //# sourceMappingURL=typewriter.js.map
package/typewriter.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"typewriter.js","sources":["src/typewriter.ts"],"sourcesContent":null,"names":["Typewriter","define"],"mappings":"0CAEAA,EAAWC"}
1
+ {"version":3,"file":"typewriter.js","sources":["src/typewriter.ts"],"sourcesContent":null,"names":["Typewriter","define"],"mappings":"6FAEAA,EAAWC"}