godown 3.0.0-canary.8 → 3.0.0

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 (510) hide show
  1. package/README.md +38 -9
  2. package/alert.d.ts +1 -0
  3. package/alert.d.ts.map +1 -1
  4. package/alert.js +1 -5
  5. package/alert.js.map +1 -1
  6. package/avatar.d.ts +1 -0
  7. package/avatar.d.ts.map +1 -1
  8. package/avatar.js +1 -5
  9. package/avatar.js.map +1 -1
  10. package/badge.d.ts +9 -0
  11. package/badge.d.ts.map +1 -0
  12. package/badge.js +2 -0
  13. package/badge.js.map +1 -0
  14. package/breath.js +1 -5
  15. package/breath.js.map +1 -1
  16. package/build/godown+lit.iife.js +59 -0
  17. package/build/godown+lit.iife.js.map +1 -0
  18. package/build/godown+lit.js +59 -0
  19. package/build/godown+lit.js.map +1 -0
  20. package/build/godown+lit.umd.js +59 -0
  21. package/build/godown+lit.umd.js.map +1 -0
  22. package/build/godown.iife.js +47 -0
  23. package/build/godown.js +48 -0
  24. package/build/godown.js.map +1 -0
  25. package/build/godown.umd.js +48 -0
  26. package/build/godown.umd.js.map +1 -0
  27. package/button.d.ts +1 -0
  28. package/button.d.ts.map +1 -1
  29. package/button.js +1 -5
  30. package/button.js.map +1 -1
  31. package/card.d.ts +1 -0
  32. package/card.d.ts.map +1 -1
  33. package/card.js +1 -5
  34. package/card.js.map +1 -1
  35. package/carousel.d.ts +1 -0
  36. package/carousel.d.ts.map +1 -1
  37. package/carousel.js +1 -5
  38. package/carousel.js.map +1 -1
  39. package/components/alert.d.ts +4 -1
  40. package/components/alert.d.ts.map +1 -1
  41. package/components/alert.js +1 -176
  42. package/components/alert.js.map +1 -1
  43. package/components/avatar.d.ts +8 -2
  44. package/components/avatar.d.ts.map +1 -1
  45. package/components/avatar.js +1 -61
  46. package/components/avatar.js.map +1 -1
  47. package/components/badge.d.ts +23 -0
  48. package/components/badge.d.ts.map +1 -0
  49. package/components/badge.js +2 -0
  50. package/components/badge.js.map +1 -0
  51. package/components/breath.d.ts +7 -4
  52. package/components/breath.d.ts.map +1 -1
  53. package/components/breath.js +1 -79
  54. package/components/breath.js.map +1 -1
  55. package/components/button.d.ts +19 -10
  56. package/components/button.d.ts.map +1 -1
  57. package/components/button.js +1 -165
  58. package/components/button.js.map +1 -1
  59. package/components/card.d.ts +3 -2
  60. package/components/card.d.ts.map +1 -1
  61. package/components/card.js +1 -53
  62. package/components/card.js.map +1 -1
  63. package/components/carousel.d.ts +10 -5
  64. package/components/carousel.d.ts.map +1 -1
  65. package/components/carousel.js +1 -112
  66. package/components/carousel.js.map +1 -1
  67. package/components/details.d.ts +6 -2
  68. package/components/details.d.ts.map +1 -1
  69. package/components/details.js +1 -49
  70. package/components/details.js.map +1 -1
  71. package/components/dialog.d.ts +8 -3
  72. package/components/dialog.d.ts.map +1 -1
  73. package/components/dialog.js +1 -93
  74. package/components/dialog.js.map +1 -1
  75. package/components/divider.d.ts +3 -3
  76. package/components/divider.d.ts.map +1 -1
  77. package/components/divider.js +1 -36
  78. package/components/divider.js.map +1 -1
  79. package/components/dragbox.d.ts +11 -9
  80. package/components/dragbox.d.ts.map +1 -1
  81. package/components/dragbox.js +1 -109
  82. package/components/dragbox.js.map +1 -1
  83. package/components/flex.d.ts +4 -1
  84. package/components/flex.d.ts.map +1 -1
  85. package/components/flex.js +1 -54
  86. package/components/flex.js.map +1 -1
  87. package/components/form.d.ts +3 -3
  88. package/components/form.d.ts.map +1 -1
  89. package/components/form.js +1 -77
  90. package/components/form.js.map +1 -1
  91. package/components/grid.d.ts +10 -3
  92. package/components/grid.d.ts.map +1 -1
  93. package/components/grid.js +1 -55
  94. package/components/grid.js.map +1 -1
  95. package/components/heading.d.ts +29 -0
  96. package/components/heading.d.ts.map +1 -0
  97. package/components/heading.js +2 -0
  98. package/components/heading.js.map +1 -0
  99. package/components/input.d.ts +7 -3
  100. package/components/input.d.ts.map +1 -1
  101. package/components/input.js +1 -50
  102. package/components/input.js.map +1 -1
  103. package/components/layout.d.ts +8 -9
  104. package/components/layout.d.ts.map +1 -1
  105. package/components/layout.js +1 -46
  106. package/components/layout.js.map +1 -1
  107. package/components/link.d.ts +8 -1
  108. package/components/link.d.ts.map +1 -1
  109. package/components/link.js +1 -42
  110. package/components/link.js.map +1 -1
  111. package/components/progress.d.ts +4 -11
  112. package/components/progress.d.ts.map +1 -1
  113. package/components/progress.js +1 -67
  114. package/components/progress.js.map +1 -1
  115. package/components/range.d.ts +22 -15
  116. package/components/range.d.ts.map +1 -1
  117. package/components/range.js +1 -273
  118. package/components/range.js.map +1 -1
  119. package/components/rotate.d.ts +4 -2
  120. package/components/rotate.d.ts.map +1 -1
  121. package/components/rotate.js +1 -56
  122. package/components/rotate.js.map +1 -1
  123. package/components/router.d.ts +20 -24
  124. package/components/router.d.ts.map +1 -1
  125. package/components/router.js +1 -250
  126. package/components/router.js.map +1 -1
  127. package/components/select.d.ts +8 -4
  128. package/components/select.d.ts.map +1 -1
  129. package/components/select.js +1 -212
  130. package/components/select.js.map +1 -1
  131. package/components/skeleton.d.ts +3 -1
  132. package/components/skeleton.d.ts.map +1 -1
  133. package/components/skeleton.js +1 -54
  134. package/components/skeleton.js.map +1 -1
  135. package/components/split.d.ts +25 -2
  136. package/components/split.d.ts.map +1 -1
  137. package/components/split.js +1 -128
  138. package/components/split.js.map +1 -1
  139. package/components/switch.d.ts +8 -5
  140. package/components/switch.d.ts.map +1 -1
  141. package/components/switch.js +1 -92
  142. package/components/switch.js.map +1 -1
  143. package/components/text.d.ts +3 -1
  144. package/components/text.d.ts.map +1 -1
  145. package/components/text.js +1 -43
  146. package/components/text.js.map +1 -1
  147. package/components/time.d.ts +8 -6
  148. package/components/time.d.ts.map +1 -1
  149. package/components/time.js +1 -85
  150. package/components/time.js.map +1 -1
  151. package/components/tooltip.d.ts +14 -2
  152. package/components/tooltip.d.ts.map +1 -1
  153. package/components/tooltip.js +1 -66
  154. package/components/tooltip.js.map +1 -1
  155. package/components/typewriter.d.ts +8 -14
  156. package/components/typewriter.d.ts.map +1 -1
  157. package/components/typewriter.js +1 -129
  158. package/components/typewriter.js.map +1 -1
  159. package/core/global-style.d.ts +2 -2
  160. package/core/global-style.d.ts.map +1 -1
  161. package/core/global-style.js +1 -45
  162. package/core/global-style.js.map +1 -1
  163. package/core/super-anchor.d.ts +2 -1
  164. package/core/super-anchor.d.ts.map +1 -1
  165. package/core/super-anchor.js +1 -38
  166. package/core/super-anchor.js.map +1 -1
  167. package/core/super-input.d.ts +6 -5
  168. package/core/super-input.d.ts.map +1 -1
  169. package/core/super-input.js +1 -111
  170. package/core/super-input.js.map +1 -1
  171. package/core/super-openable.d.ts +1 -1
  172. package/core/super-openable.d.ts.map +1 -1
  173. package/core/super-openable.js +1 -37
  174. package/core/super-openable.js.map +1 -1
  175. package/custom-elements.json +1 -1
  176. package/details.d.ts +1 -0
  177. package/details.d.ts.map +1 -1
  178. package/details.js +1 -5
  179. package/details.js.map +1 -1
  180. package/dev/alert.d.ts +1 -0
  181. package/dev/alert.d.ts.map +1 -1
  182. package/dev/alert.js +1 -0
  183. package/dev/alert.js.map +1 -1
  184. package/dev/avatar.d.ts +1 -0
  185. package/dev/avatar.d.ts.map +1 -1
  186. package/dev/avatar.js +1 -0
  187. package/dev/avatar.js.map +1 -1
  188. package/dev/badge.d.ts +9 -0
  189. package/dev/badge.d.ts.map +1 -0
  190. package/dev/badge.js +5 -0
  191. package/dev/badge.js.map +1 -0
  192. package/dev/button.d.ts +1 -0
  193. package/dev/button.d.ts.map +1 -1
  194. package/dev/button.js +1 -0
  195. package/dev/button.js.map +1 -1
  196. package/dev/card.d.ts +1 -0
  197. package/dev/card.d.ts.map +1 -1
  198. package/dev/card.js +1 -0
  199. package/dev/card.js.map +1 -1
  200. package/dev/carousel.d.ts +1 -0
  201. package/dev/carousel.d.ts.map +1 -1
  202. package/dev/carousel.js +1 -0
  203. package/dev/carousel.js.map +1 -1
  204. package/dev/components/alert.d.ts +4 -1
  205. package/dev/components/alert.d.ts.map +1 -1
  206. package/dev/components/alert.js +20 -23
  207. package/dev/components/alert.js.map +1 -1
  208. package/dev/components/avatar.d.ts +8 -2
  209. package/dev/components/avatar.d.ts.map +1 -1
  210. package/dev/components/avatar.js +23 -13
  211. package/dev/components/avatar.js.map +1 -1
  212. package/dev/components/badge.d.ts +23 -0
  213. package/dev/components/badge.d.ts.map +1 -0
  214. package/dev/components/badge.js +107 -0
  215. package/dev/components/badge.js.map +1 -0
  216. package/dev/components/breath.d.ts +7 -4
  217. package/dev/components/breath.d.ts.map +1 -1
  218. package/dev/components/breath.js +30 -26
  219. package/dev/components/breath.js.map +1 -1
  220. package/dev/components/button.d.ts +19 -10
  221. package/dev/components/button.d.ts.map +1 -1
  222. package/dev/components/button.js +47 -28
  223. package/dev/components/button.js.map +1 -1
  224. package/dev/components/card.d.ts +3 -2
  225. package/dev/components/card.d.ts.map +1 -1
  226. package/dev/components/card.js +23 -33
  227. package/dev/components/card.js.map +1 -1
  228. package/dev/components/carousel.d.ts +10 -5
  229. package/dev/components/carousel.d.ts.map +1 -1
  230. package/dev/components/carousel.js +33 -26
  231. package/dev/components/carousel.js.map +1 -1
  232. package/dev/components/details.d.ts +6 -2
  233. package/dev/components/details.d.ts.map +1 -1
  234. package/dev/components/details.js +24 -26
  235. package/dev/components/details.js.map +1 -1
  236. package/dev/components/dialog.d.ts +8 -3
  237. package/dev/components/dialog.d.ts.map +1 -1
  238. package/dev/components/dialog.js +21 -17
  239. package/dev/components/dialog.js.map +1 -1
  240. package/dev/components/divider.d.ts +3 -3
  241. package/dev/components/divider.d.ts.map +1 -1
  242. package/dev/components/divider.js +29 -17
  243. package/dev/components/divider.js.map +1 -1
  244. package/dev/components/dragbox.d.ts +11 -9
  245. package/dev/components/dragbox.d.ts.map +1 -1
  246. package/dev/components/dragbox.js +11 -4
  247. package/dev/components/dragbox.js.map +1 -1
  248. package/dev/components/flex.d.ts +4 -1
  249. package/dev/components/flex.d.ts.map +1 -1
  250. package/dev/components/flex.js +25 -9
  251. package/dev/components/flex.js.map +1 -1
  252. package/dev/components/form.d.ts +3 -3
  253. package/dev/components/form.d.ts.map +1 -1
  254. package/dev/components/form.js +2 -5
  255. package/dev/components/form.js.map +1 -1
  256. package/dev/components/grid.d.ts +10 -3
  257. package/dev/components/grid.d.ts.map +1 -1
  258. package/dev/components/grid.js +18 -10
  259. package/dev/components/grid.js.map +1 -1
  260. package/dev/components/heading.d.ts +29 -0
  261. package/dev/components/heading.d.ts.map +1 -0
  262. package/dev/components/heading.js +103 -0
  263. package/dev/components/heading.js.map +1 -0
  264. package/dev/components/input.d.ts +7 -3
  265. package/dev/components/input.d.ts.map +1 -1
  266. package/dev/components/input.js +18 -18
  267. package/dev/components/input.js.map +1 -1
  268. package/dev/components/layout.d.ts +8 -9
  269. package/dev/components/layout.d.ts.map +1 -1
  270. package/dev/components/layout.js +38 -25
  271. package/dev/components/layout.js.map +1 -1
  272. package/dev/components/link.d.ts +8 -1
  273. package/dev/components/link.d.ts.map +1 -1
  274. package/dev/components/link.js +15 -3
  275. package/dev/components/link.js.map +1 -1
  276. package/dev/components/progress.d.ts +4 -11
  277. package/dev/components/progress.d.ts.map +1 -1
  278. package/dev/components/progress.js +43 -49
  279. package/dev/components/progress.js.map +1 -1
  280. package/dev/components/range.d.ts +22 -15
  281. package/dev/components/range.d.ts.map +1 -1
  282. package/dev/components/range.js +56 -61
  283. package/dev/components/range.js.map +1 -1
  284. package/dev/components/rotate.d.ts +4 -2
  285. package/dev/components/rotate.d.ts.map +1 -1
  286. package/dev/components/rotate.js +3 -5
  287. package/dev/components/rotate.js.map +1 -1
  288. package/dev/components/router.d.ts +20 -24
  289. package/dev/components/router.d.ts.map +1 -1
  290. package/dev/components/router.js +23 -36
  291. package/dev/components/router.js.map +1 -1
  292. package/dev/components/select.d.ts +8 -4
  293. package/dev/components/select.d.ts.map +1 -1
  294. package/dev/components/select.js +44 -32
  295. package/dev/components/select.js.map +1 -1
  296. package/dev/components/skeleton.d.ts +3 -1
  297. package/dev/components/skeleton.d.ts.map +1 -1
  298. package/dev/components/skeleton.js +9 -9
  299. package/dev/components/skeleton.js.map +1 -1
  300. package/dev/components/split.d.ts +25 -2
  301. package/dev/components/split.d.ts.map +1 -1
  302. package/dev/components/split.js +71 -38
  303. package/dev/components/split.js.map +1 -1
  304. package/dev/components/switch.d.ts +8 -5
  305. package/dev/components/switch.d.ts.map +1 -1
  306. package/dev/components/switch.js +28 -31
  307. package/dev/components/switch.js.map +1 -1
  308. package/dev/components/text.d.ts +3 -1
  309. package/dev/components/text.d.ts.map +1 -1
  310. package/dev/components/text.js +12 -15
  311. package/dev/components/text.js.map +1 -1
  312. package/dev/components/time.d.ts +8 -6
  313. package/dev/components/time.d.ts.map +1 -1
  314. package/dev/components/time.js +8 -14
  315. package/dev/components/time.js.map +1 -1
  316. package/dev/components/tooltip.d.ts +14 -2
  317. package/dev/components/tooltip.d.ts.map +1 -1
  318. package/dev/components/tooltip.js +54 -24
  319. package/dev/components/tooltip.js.map +1 -1
  320. package/dev/components/typewriter.d.ts +8 -14
  321. package/dev/components/typewriter.d.ts.map +1 -1
  322. package/dev/components/typewriter.js +22 -37
  323. package/dev/components/typewriter.js.map +1 -1
  324. package/dev/core/global-style.d.ts +2 -2
  325. package/dev/core/global-style.d.ts.map +1 -1
  326. package/dev/core/global-style.js +18 -14
  327. package/dev/core/global-style.js.map +1 -1
  328. package/dev/core/super-anchor.d.ts +2 -1
  329. package/dev/core/super-anchor.d.ts.map +1 -1
  330. package/dev/core/super-anchor.js +25 -23
  331. package/dev/core/super-anchor.js.map +1 -1
  332. package/dev/core/super-input.d.ts +6 -5
  333. package/dev/core/super-input.d.ts.map +1 -1
  334. package/dev/core/super-input.js +43 -36
  335. package/dev/core/super-input.js.map +1 -1
  336. package/dev/core/super-openable.d.ts +1 -1
  337. package/dev/core/super-openable.d.ts.map +1 -1
  338. package/dev/core/super-openable.js +2 -2
  339. package/dev/core/super-openable.js.map +1 -1
  340. package/dev/details.d.ts +1 -0
  341. package/dev/details.d.ts.map +1 -1
  342. package/dev/details.js +1 -0
  343. package/dev/details.js.map +1 -1
  344. package/dev/dialog.d.ts +1 -0
  345. package/dev/dialog.d.ts.map +1 -1
  346. package/dev/dialog.js +1 -0
  347. package/dev/dialog.js.map +1 -1
  348. package/dev/divider.d.ts +1 -0
  349. package/dev/divider.d.ts.map +1 -1
  350. package/dev/divider.js +1 -0
  351. package/dev/divider.js.map +1 -1
  352. package/dev/dragbox.d.ts +1 -0
  353. package/dev/dragbox.d.ts.map +1 -1
  354. package/dev/dragbox.js +1 -0
  355. package/dev/dragbox.js.map +1 -1
  356. package/dev/flex.d.ts +1 -0
  357. package/dev/flex.d.ts.map +1 -1
  358. package/dev/flex.js +1 -0
  359. package/dev/flex.js.map +1 -1
  360. package/dev/form.d.ts +1 -0
  361. package/dev/form.d.ts.map +1 -1
  362. package/dev/form.js +1 -0
  363. package/dev/form.js.map +1 -1
  364. package/dev/grid.d.ts +1 -0
  365. package/dev/grid.d.ts.map +1 -1
  366. package/dev/grid.js +1 -0
  367. package/dev/grid.js.map +1 -1
  368. package/dev/heading.d.ts +9 -0
  369. package/dev/heading.d.ts.map +1 -0
  370. package/dev/heading.js +5 -0
  371. package/dev/heading.js.map +1 -0
  372. package/dev/index.d.ts +2 -0
  373. package/dev/index.d.ts.map +1 -1
  374. package/dev/index.js +2 -0
  375. package/dev/index.js.map +1 -1
  376. package/dev/layout.d.ts.map +1 -1
  377. package/dev/progress.d.ts.map +1 -1
  378. package/dev/router.d.ts.map +1 -1
  379. package/dev/split.d.ts +1 -1
  380. package/dev/split.d.ts.map +1 -1
  381. package/dev/typewriter.d.ts +1 -0
  382. package/dev/typewriter.d.ts.map +1 -1
  383. package/dev/typewriter.js +1 -0
  384. package/dev/typewriter.js.map +1 -1
  385. package/dialog.d.ts +1 -0
  386. package/dialog.d.ts.map +1 -1
  387. package/dialog.js +1 -5
  388. package/dialog.js.map +1 -1
  389. package/divider.d.ts +1 -0
  390. package/divider.d.ts.map +1 -1
  391. package/divider.js +1 -5
  392. package/divider.js.map +1 -1
  393. package/dragbox.d.ts +1 -0
  394. package/dragbox.d.ts.map +1 -1
  395. package/dragbox.js +1 -5
  396. package/dragbox.js.map +1 -1
  397. package/flex.d.ts +1 -0
  398. package/flex.d.ts.map +1 -1
  399. package/flex.js +1 -5
  400. package/flex.js.map +1 -1
  401. package/form.d.ts +1 -0
  402. package/form.d.ts.map +1 -1
  403. package/form.js +1 -5
  404. package/form.js.map +1 -1
  405. package/grid.d.ts +1 -0
  406. package/grid.d.ts.map +1 -1
  407. package/grid.js +1 -5
  408. package/grid.js.map +1 -1
  409. package/heading.d.ts +9 -0
  410. package/heading.d.ts.map +1 -0
  411. package/heading.js +2 -0
  412. package/heading.js.map +1 -0
  413. package/index.d.ts +2 -0
  414. package/index.d.ts.map +1 -1
  415. package/index.js +1 -56
  416. package/index.js.map +1 -1
  417. package/input.js +1 -5
  418. package/input.js.map +1 -1
  419. package/layout.d.ts.map +1 -1
  420. package/layout.js +1 -5
  421. package/layout.js.map +1 -1
  422. package/link.js +1 -5
  423. package/link.js.map +1 -1
  424. package/package.json +11 -6
  425. package/progress.d.ts.map +1 -1
  426. package/progress.js +1 -5
  427. package/progress.js.map +1 -1
  428. package/range.js +1 -5
  429. package/range.js.map +1 -1
  430. package/rotate.js +1 -5
  431. package/rotate.js.map +1 -1
  432. package/router.d.ts.map +1 -1
  433. package/router.js +1 -5
  434. package/router.js.map +1 -1
  435. package/select.js +1 -5
  436. package/select.js.map +1 -1
  437. package/skeleton.js +1 -5
  438. package/skeleton.js.map +1 -1
  439. package/split.d.ts +1 -1
  440. package/split.d.ts.map +1 -1
  441. package/split.js +1 -5
  442. package/split.js.map +1 -1
  443. package/src/alert.ts +2 -0
  444. package/src/avatar.ts +2 -0
  445. package/src/badge.ts +13 -0
  446. package/src/button.ts +2 -0
  447. package/src/card.ts +2 -0
  448. package/src/carousel.ts +2 -0
  449. package/src/components/alert.ts +26 -29
  450. package/src/components/avatar.ts +28 -17
  451. package/src/components/badge.ts +107 -0
  452. package/src/components/breath.ts +38 -31
  453. package/src/components/button.ts +55 -46
  454. package/src/components/card.ts +26 -34
  455. package/src/components/carousel.ts +48 -38
  456. package/src/components/details.ts +27 -28
  457. package/src/components/dialog.ts +30 -26
  458. package/src/components/divider.ts +29 -17
  459. package/src/components/dragbox.ts +25 -19
  460. package/src/components/flex.ts +26 -11
  461. package/src/components/form.ts +7 -9
  462. package/src/components/grid.ts +31 -13
  463. package/src/components/heading.ts +105 -0
  464. package/src/components/input.ts +23 -22
  465. package/src/components/layout.ts +26 -31
  466. package/src/components/link.ts +15 -4
  467. package/src/components/progress.ts +51 -52
  468. package/src/components/range.ts +82 -94
  469. package/src/components/rotate.ts +12 -11
  470. package/src/components/router.ts +59 -48
  471. package/src/components/select.ts +59 -47
  472. package/src/components/skeleton.ts +13 -11
  473. package/src/components/split.ts +90 -49
  474. package/src/components/switch.ts +38 -37
  475. package/src/components/text.ts +14 -21
  476. package/src/components/time.ts +20 -14
  477. package/src/components/tooltip.ts +54 -29
  478. package/src/components/typewriter.ts +41 -47
  479. package/src/core/global-style.ts +33 -19
  480. package/src/core/super-anchor.ts +30 -26
  481. package/src/core/super-input.ts +54 -54
  482. package/src/core/super-openable.ts +7 -7
  483. package/src/details.ts +2 -0
  484. package/src/dialog.ts +2 -0
  485. package/src/divider.ts +2 -0
  486. package/src/dragbox.ts +2 -0
  487. package/src/flex.ts +2 -0
  488. package/src/form.ts +2 -0
  489. package/src/grid.ts +2 -0
  490. package/src/heading.ts +13 -0
  491. package/src/index.ts +2 -0
  492. package/src/layout.ts +1 -0
  493. package/src/progress.ts +1 -0
  494. package/src/router.ts +1 -0
  495. package/src/split.ts +1 -1
  496. package/src/typewriter.ts +2 -0
  497. package/switch.js +1 -5
  498. package/switch.js.map +1 -1
  499. package/text.js +1 -5
  500. package/text.js.map +1 -1
  501. package/time.js +1 -5
  502. package/time.js.map +1 -1
  503. package/tooltip.js +1 -5
  504. package/tooltip.js.map +1 -1
  505. package/typewriter.d.ts +1 -0
  506. package/typewriter.d.ts.map +1 -1
  507. package/typewriter.js +1 -5
  508. package/typewriter.js.map +1 -1
  509. package/vscode.html-custom-data.json +1 -1
  510. package/web-types.json +1 -1
@@ -1,57 +1,2 @@
1
- import { __decorate } from 'tslib';
2
- import { godown } from '@godown/element/decorators/godown.js';
3
- import { part } from '@godown/element/decorators/part.js';
4
- import { styles } from '@godown/element/decorators/styles.js';
5
- import { htmlSlot } from '@godown/element/directives/html-slot.js';
6
- import { css, html } from 'lit';
7
- import { scopePrefix, GlobalStyle } from '../core/global-style.js';
8
-
9
- const protoName = "rotate";
10
- const cssScope = scopePrefix(protoName);
11
- /**
12
- * {@linkcode Rotate} Make child elements rotate.
13
- *
14
- * @category wrapper
15
- */
16
- let Rotate = class Rotate extends GlobalStyle {
17
- render() {
18
- return html `<div part="root"><div part="slot" @mousemove="${this._handleRotate}">${htmlSlot()}</div><i @mouseleave="${this.reset}"></i></div>`;
19
- }
20
- reset() {
21
- this._root.style.removeProperty("transform");
22
- this._root.style.removeProperty("transition");
23
- }
24
- _handleRotate(e) {
25
- const { rotateX, rotateY } = this._computeOffset(e);
26
- this._root.style.setProperty("transform", `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`);
27
- this._root.style.setProperty("transition", "0s");
28
- }
29
- /**
30
- * Compute offset.
31
- * ```
32
- * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`
33
- * ```
34
- * @param e Mouse move event.
35
- * @returns rotateX, rotateY
36
- */
37
- _computeOffset(e) {
38
- const { left, top, width, height } = this._root.getBoundingClientRect();
39
- const { clientX, clientY } = e;
40
- const offsetX = clientX - left;
41
- const offsetY = clientY - top;
42
- const rotateX = -(offsetY - height / 2) / height / 2;
43
- const rotateY = (offsetX - width / 2) / width / 2;
44
- return { rotateX, rotateY };
45
- }
46
- };
47
- __decorate([
48
- part("root")
49
- ], Rotate.prototype, "_root", void 0);
50
- Rotate = __decorate([
51
- godown(protoName),
52
- styles(css `:host{display:block;width:-moz-fit-content;width:fit-content;transition:all .5s ease-in-out;${cssScope}--padding:.75em;${cssScope}--offset:.5em}div{position:relative;transition:inherit;transition-property:transform}i{width:100%;height:100%;position:absolute;top:0;box-sizing:content-box;padding:var(${cssScope}--offset);margin:calc(-1 * var(${cssScope}--offset))}[part=slot]{z-index:2}`)
53
- ], Rotate);
54
- var Rotate$1 = Rotate;
55
-
56
- export { Rotate$1 as default };
1
+ import{__decorate as t}from"tslib";import{part as o,godown as e,styles as r,htmlSlot as i}from"@godown/element";import{css as s,html as n}from"lit";import{scopePrefix as a,GlobalStyle as l}from"../core/global-style.js";const d="rotate",p=a(d);let m=class Rotate extends l{render(){return n`<div part="root"><div part="slot" @mousemove="${this._handleRotate}">${i()}</div><i @mouseleave="${this.reset}"></i></div>`}reset(){this._root.style.removeProperty("transform"),this._root.style.removeProperty("transition")}_handleRotate(t){const{rotateX:o,rotateY:e}=this._computeOffset(t);this._root.style.setProperty("transform",`rotateX(${o}rad) rotateY(${e}rad)`),this._root.style.setProperty("transition","0s")}_computeOffset(t){const{left:o,top:e,width:r,height:i}=this._root.getBoundingClientRect(),{clientX:s,clientY:n}=t;return{rotateX:-(n-e-i/2)/i/2,rotateY:(s-o-r/2)/r/2}}};t([o("root")],m.prototype,"_root",void 0),m=t([e(d),r(s`:host{display:block;width:-moz-fit-content;width:fit-content;transition:all .5s ease-in-out;${p}--padding:.75em;${p}--offset:.5em}div{position:relative;transition:inherit;transition-property:transform}i{width:100%;height:100%;position:absolute;top:0;box-sizing:content-box;padding:var(${p}--offset);margin:calc(-1 * var(${p}--offset))}[part=slot]{z-index:2}`)],m);var f=m;export{m as Rotate,f as default};
57
2
  //# sourceMappingURL=rotate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rotate.js","sources":["../src/components/rotate.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;AAQA,MAAM,SAAS,GAAG,QAAQ;AAC1B,MAAM,QAAQ,GAAG,WAAW,CAAC,S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AC,IAAI,KAAK,GAAG,CAAC;AACjD,QAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;;CAE/B;AAtCE,UAAA,CAAA;IADC,IAAI,CAAC,MAAM;AACM,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAFd,MAAM,GAAA,UAAA,CAAA;IAJX,MAAM,CAAC,SAAS,CAAA;AAChB,IAAA,MAAM,CACL,GAAG,CAAA,CAAA,4FAAA,EAAgG,QAAQ,CAAA,gBAAA,EAAmB,QAAQ,CAAA,yKAAA,EAA4K,QAAQ,CAAA,+BAAA,EAAkC,QAAQ,CAAA,iCAAA,CAAqC;AAErY,CAAA,EAAA,MAAM,CAwCZ;AAEA,eAAe,MAAM;;;;"}
1
+ {"version":3,"file":"rotate.js","sources":["../src/components/rotate.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Rotate","GlobalStyle","render","html","this","_handleRotate","htmlSlot","reset","_root","style","removeProperty","e","rotateX","rotateY","_computeOffset","setProperty","left","top","width","height","getBoundingClientRect","clientX","clientY","__decorate","part","prototype","godown","styles","css","Rotate$1"],"mappings":"2NAKA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,GAW7B,IAAMG,EAAN,MAAMA,eAAeC,EAIT,MAAAC,GACR,OAAOC,CAAI,iDACsBC,KAAKC,kBAAkBC,4BACpCF,KAAKG,oBAI3B,KAAAA,GACEH,KAAKI,MAAMC,MAAMC,eAAe,aAChCN,KAAKI,MAAMC,MAAMC,eAAe,cAGxB,aAAAL,CAAcM,GACtB,MAAMC,QAAEA,EAAOC,QAAEA,GAAYT,KAAKU,eAAeH,GACjDP,KAAKI,MAAMC,MAAMM,YAAY,YAAa,WAAWH,iBAAuBC,SAC5ET,KAAKI,MAAMC,MAAMM,YAAY,aAAc,MAW7C,cAAAD,CAAeH,GAIb,MAAMK,KAAEA,EAAIC,IAAEA,EAAGC,MAAEA,EAAKC,OAAEA,GAAWf,KAAKI,MAAMY,yBAC1CC,QAAEA,EAAOC,QAAEA,GAAYX,EAM7B,MAAO,CAAEC,UAJOU,EAAUL,EAEEE,EAAS,GAAKA,EAAS,EAEjCN,SALFQ,EAAUL,EAICE,EAAQ,GAAKA,EAAQ,KAtCxCK,EAAA,CADTC,EAAK,SACsBxB,EAAAyB,UAAA,aAAA,GAFxBzB,EAAMuB,EAAA,CAJXG,EAAO7B,GACP8B,EACCC,CAAG,+FAAgG9B,oBAA2BA,6KAAoLA,mCAA0CA,uCAExVE,GA6CN,IAAA6B,EAAe7B"}
@@ -18,10 +18,12 @@ import { GlobalStyle } from "../core/global-style.js";
18
18
  *
19
19
  * If no routes are matched, the default value (no named slot) will be rendered.
20
20
  *
21
+ * @slot - Display slot when there is no match.
22
+ * @slot * - Matching slot will be displayed.
21
23
  * @category navigation
22
24
  */
23
- declare class Router<C = unknown> extends GlobalStyle {
24
- static routerInstances: Set<Router<unknown>>;
25
+ declare class Router extends GlobalStyle {
26
+ static routerInstances: Set<Router>;
25
27
  private __fieldRouteTree;
26
28
  private __slottedRouteTree;
27
29
  private __cacheRecord;
@@ -29,7 +31,7 @@ declare class Router<C = unknown> extends GlobalStyle {
29
31
  /**
30
32
  * Render result.
31
33
  */
32
- component: C | TemplateResult;
34
+ component: unknown | TemplateResult;
33
35
  /**
34
36
  * Dynamic parameters record.
35
37
  */
@@ -42,10 +44,6 @@ declare class Router<C = unknown> extends GlobalStyle {
42
44
  * Current pathname (equals to location.pathname).
43
45
  */
44
46
  pathname: string;
45
- /**
46
- * Path prefix.
47
- */
48
- baseURL: string;
49
47
  /**
50
48
  * Rendered content when there is no match.
51
49
  */
@@ -66,45 +64,42 @@ declare class Router<C = unknown> extends GlobalStyle {
66
64
  cache: boolean;
67
65
  set routes(value: (Record<string, any> & {
68
66
  path: string;
69
- component?: C;
67
+ render?: (ur: ReturnType<Router["useRouter"]>) => unknown;
68
+ component?: unknown;
70
69
  })[]);
71
70
  get routes(): (Record<string, any> & {
72
71
  path: string;
73
- component?: C;
72
+ render?: (ur: ReturnType<Router["useRouter"]>) => unknown;
73
+ component?: unknown;
74
74
  })[];
75
75
  clear(): void;
76
- protected render(): C | TemplateResult;
76
+ protected render(): unknown;
77
77
  connectedCallback(): void;
78
78
  disconnectedCallback(): void;
79
79
  useRouter(): {
80
80
  pathname: string;
81
81
  params: Record<string, string>;
82
82
  path: string;
83
- component: C | TemplateResult;
83
+ component: unknown;
84
84
  };
85
85
  /**
86
- * @param params value of useRouter()
87
- * @param first whether this path is loaded for the first time.
86
+ * Callback function when the route changes.
88
87
  */
89
88
  routeChangeCallback: (params: {
90
89
  pathname: string;
91
90
  params: Record<string, string>;
92
91
  path: string;
93
- component: C | TemplateResult;
92
+ component: unknown | TemplateResult;
94
93
  }, first: boolean) => void;
95
94
  protected updated(changedProperties: PropertyValueMap<this>): void;
96
95
  /**
97
- * Find components from {@linkcode __fieldRouteTree} matching query.
98
- * @param query Query string.
99
- * @returns Components or null.
96
+ * Get component from {@linkcode routes} by query.
100
97
  */
101
- fieldComponent(query?: string): C;
98
+ fieldComponent(query?: string): unknown;
102
99
  /**
103
- * Find components from {@linkcode __slottedRouteTree} matching query.
104
- * @param query Query string.
105
- * @returns Named slot element template result or null.
100
+ * Get component from slotted elements by query.
106
101
  */
107
- slottedComponent(usedRouteTemplate?: string): TemplateResult<1>;
102
+ slottedComponent(query?: string): TemplateResult<1>;
108
103
  /**
109
104
  * Reset the route tree, clear cache, collect routes from child elements.
110
105
  */
@@ -113,9 +108,10 @@ declare class Router<C = unknown> extends GlobalStyle {
113
108
  * Reset the route tree, clear cache, collect routes from value.
114
109
  */
115
110
  collectFieldRoutes(value: typeof this.routes): void;
116
- useWhich(path: string): string;
117
- parseParams(routeTemplate: string, path: string): Record<string, string>;
111
+ parseParams(routeTemplate: string, path?: string): Record<string, string>;
118
112
  static updateAll(): void;
113
+ handlePopstate: () => void;
119
114
  }
120
115
  export default Router;
116
+ export { Router };
121
117
  //# sourceMappingURL=router.d.ts.map
@@ -1 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gB,CAAC,IAAI,CAAC,GAAG,IAAI;IAalE;;OAEG;IACH,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAqBvC;;OAEG;IACH,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAiBnD;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAQ5B;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI;IAQnD,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,MAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxF,MAAM,CAAC,SAAS,IAAI,IAAI;IAMxB,cAAc,QAEF,IAAI,CAAC;CAClB;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,251 +1,2 @@
1
- import { __decorate } from 'tslib';
2
- import { godown } from '@godown/element/decorators/godown.js';
3
- import { styles } from '@godown/element/decorators/styles.js';
4
- import { htmlSlot } from '@godown/element/directives/html-slot.js';
5
- import { RouteTree } from '@godown/element/tools/route-tree.js';
6
- import { css } from 'lit';
7
- import { state, property } from 'lit/decorators.js';
8
- import { GlobalStyle } from '../core/global-style.js';
9
-
10
- var Router_1;
11
- const protoName = "router";
12
- /**
13
- * {@linkcode Router} has basic routing control.
14
- *
15
- * To switch routes, use `router-link component`.
16
- *
17
- * It has two methods to collect routes.
18
- *
19
- * 1. From field `routes`, an array, each elements require "path" and "component".
20
- * 2. From child elements, which have the slot attribute for matching routes.
21
- *
22
- * If only the method 1 is used, set `type` to `"field"`.
23
- *
24
- * If only the method 2 is used, set `type` to `"slotted"`.
25
- *
26
- * `type` defaults to `"united"`, which will try method 1, then method 2.
27
- *
28
- * If no routes are matched, the default value (no named slot) will be rendered.
29
- *
30
- * @category navigation
31
- */
32
- let Router = Router_1 = class Router extends GlobalStyle {
33
- constructor() {
34
- super(...arguments);
35
- this.__fieldRouteTree = new RouteTree();
36
- this.__slottedRouteTree = new RouteTree();
37
- this.__cacheRecord = new Map();
38
- /**
39
- * Render result.
40
- */
41
- this.component = null;
42
- /**
43
- * Dynamic parameters record.
44
- */
45
- this.params = {};
46
- /**
47
- * Current pathname (equals to location.pathname).
48
- */
49
- this.pathname = "";
50
- /**
51
- * Path prefix.
52
- */
53
- this.baseURL = "";
54
- /**
55
- * Rendered content when there is no match.
56
- */
57
- this.default = htmlSlot();
58
- /**
59
- * The type of routing sources.
60
- *
61
- * If field, it won't collect the slot attribute of the child elements.
62
- *
63
- * This property should not be changed after the rendering is complete.
64
- */
65
- this.type = "united";
66
- /**
67
- * Cache accessed records.
68
- *
69
- * Emptied at each re-collection.
70
- */
71
- this.cache = false;
72
- /**
73
- * @param params value of useRouter()
74
- * @param first whether this path is loaded for the first time.
75
- */
76
- this.routeChangeCallback = null;
77
- }
78
- set routes(value) {
79
- this.__routes = value;
80
- this.collectFieldRoutes(value);
81
- }
82
- get routes() {
83
- return this.__routes;
84
- }
85
- clear() {
86
- this.__cacheRecord.clear();
87
- }
88
- render() {
89
- this.params = {};
90
- if (this.cache) {
91
- const cached = this.__cacheRecord.get(this.pathname);
92
- if (cached) {
93
- Object.assign(this, cached);
94
- return this.component;
95
- }
96
- }
97
- switch (this.type) {
98
- case "field":
99
- this.component = this.fieldComponent();
100
- break;
101
- case "slotted":
102
- this.component = this.slottedComponent();
103
- break;
104
- default:
105
- this.component = this.fieldComponent() ?? this.slottedComponent();
106
- }
107
- return this.component ?? this.default ?? null;
108
- }
109
- connectedCallback() {
110
- super.connectedCallback();
111
- Router_1.routerInstances.add(this);
112
- this.pathname ??= location.pathname;
113
- if (this.type !== "field") {
114
- const mutationObserver = new MutationObserver(this.collectSlottedRoutes);
115
- mutationObserver.observe(this, {
116
- attributeFilter: ["slot"],
117
- attributes: true,
118
- subtree: true,
119
- });
120
- this.collectSlottedRoutes();
121
- }
122
- }
123
- disconnectedCallback() {
124
- super.disconnectedCallback();
125
- Router_1.routerInstances.delete(this);
126
- }
127
- useRouter() {
128
- return {
129
- pathname: this.pathname,
130
- params: this.params,
131
- path: this.path,
132
- component: this.component,
133
- };
134
- }
135
- updated(changedProperties) {
136
- const shouldDispatch = changedProperties.has("pathname") || changedProperties.has("path");
137
- if (shouldDispatch) {
138
- const ur = this.useRouter();
139
- const noRecord = !this.__cacheRecord.has(this.pathname);
140
- if (noRecord) {
141
- this.__cacheRecord.set(this.pathname, ur);
142
- }
143
- this.routeChangeCallback?.(ur, noRecord);
144
- this.dispatchEvent(new CustomEvent("change", { detail: ur }));
145
- }
146
- }
147
- /**
148
- * Find components from {@linkcode __fieldRouteTree} matching query.
149
- * @param query Query string.
150
- * @returns Components or null.
151
- */
152
- fieldComponent(query) {
153
- query ||= this.useWhich(this.pathname);
154
- this.path = query;
155
- if (!query) {
156
- return null;
157
- }
158
- this.params = this.parseParams(this.path, this.pathname);
159
- const route = this.routes.find((r) => r.path === query);
160
- if (!route) {
161
- return null;
162
- }
163
- return route.component;
164
- }
165
- /**
166
- * Find components from {@linkcode __slottedRouteTree} matching query.
167
- * @param query Query string.
168
- * @returns Named slot element template result or null.
169
- */
170
- slottedComponent(usedRouteTemplate) {
171
- const slottedPaths = this._slottedNames;
172
- usedRouteTemplate ||= this.__slottedRouteTree.useWhich(this.pathname);
173
- this.path = usedRouteTemplate;
174
- if (!usedRouteTemplate) {
175
- return null;
176
- }
177
- this.path = slottedPaths.find((s) => s === usedRouteTemplate);
178
- if (!this.path) {
179
- return null;
180
- }
181
- this.params = this.parseParams(usedRouteTemplate, this.pathname);
182
- return htmlSlot(this.path);
183
- }
184
- /**
185
- * Reset the route tree, clear cache, collect routes from child elements.
186
- */
187
- collectSlottedRoutes() {
188
- this.__slottedRouteTree = new RouteTree();
189
- this.clear();
190
- this._slottedNames.forEach(slotName => {
191
- this.__slottedRouteTree.insert(slotName);
192
- });
193
- }
194
- /**
195
- * Reset the route tree, clear cache, collect routes from value.
196
- */
197
- collectFieldRoutes(value) {
198
- this.__fieldRouteTree = new RouteTree();
199
- this.clear();
200
- value.forEach(({ path }) => {
201
- this.__fieldRouteTree.insert(path);
202
- });
203
- }
204
- useWhich(path) {
205
- return this.__fieldRouteTree.useWhich(this.baseURL + path);
206
- }
207
- parseParams(routeTemplate, path) {
208
- return this.__fieldRouteTree.parseParams(path, routeTemplate);
209
- }
210
- static updateAll() {
211
- this.routerInstances.forEach((i) => {
212
- i.pathname = window.location.pathname;
213
- });
214
- }
215
- };
216
- Router.routerInstances = new Set();
217
- __decorate([
218
- state()
219
- ], Router.prototype, "component", void 0);
220
- __decorate([
221
- state()
222
- ], Router.prototype, "params", void 0);
223
- __decorate([
224
- state()
225
- ], Router.prototype, "path", void 0);
226
- __decorate([
227
- property()
228
- ], Router.prototype, "pathname", void 0);
229
- __decorate([
230
- property()
231
- ], Router.prototype, "baseURL", void 0);
232
- __decorate([
233
- state()
234
- ], Router.prototype, "default", void 0);
235
- __decorate([
236
- property()
237
- ], Router.prototype, "type", void 0);
238
- __decorate([
239
- property({ type: Boolean })
240
- ], Router.prototype, "cache", void 0);
241
- __decorate([
242
- state()
243
- ], Router.prototype, "routes", null);
244
- Router = Router_1 = __decorate([
245
- godown(protoName),
246
- styles(css `:host{display:contents}`)
247
- ], Router);
248
- var Router$1 = Router;
249
-
250
- export { Router$1 as default };
1
+ import{__decorate as t}from"tslib";import{godown as e,styles as s,RouteTree as o,htmlSlot as a}from"@godown/element";import{css as h}from"lit";import{state as i,property as n}from"lit/decorators.js";import{GlobalStyle as r}from"../core/global-style.js";var p;let l=p=class Router extends r{constructor(){super(...arguments),this.__fieldRouteTree=new o,this.__slottedRouteTree=new o,this.__cacheRecord=new Map,this.component=null,this.params={},this.default=a(),this.type="united",this.cache=!1,this.routeChangeCallback=null,this.handlePopstate=this.events.add(window,"popstate",(()=>{this.pathname=location.pathname}))}set routes(t){this.__routes=t,this.collectFieldRoutes(t)}get routes(){return this.__routes}clear(){this.__cacheRecord.clear()}render(){if(this.params={},this.cache){const t=this.__cacheRecord.get(this.pathname);if(t)return Object.assign(this,t),this.component}switch(this.type){case"field":this.component=this.fieldComponent();break;case"slotted":this.component=this.slottedComponent();break;default:this.component=this.fieldComponent()??this.slottedComponent()}return this.component??this.default??null}connectedCallback(){if(super.connectedCallback(),p.routerInstances.add(this),this.pathname??=location.pathname,"field"!==this.type){new MutationObserver(this.collectSlottedRoutes).observe(this,{attributeFilter:["slot"],attributes:!0,subtree:!0}),this.collectSlottedRoutes()}}disconnectedCallback(){super.disconnectedCallback(),p.routerInstances.delete(this)}useRouter(){return{pathname:this.pathname,params:this.params,path:this.path,component:this.component}}updated(t){if(t.has("pathname")||t.has("path")){const t=this.useRouter(),e=!this.__cacheRecord.has(this.pathname);e&&this.__cacheRecord.set(this.pathname,t),this.routeChangeCallback?.(t,e),this.dispatchEvent(new CustomEvent("change",{detail:t}))}}fieldComponent(t){if(t||=this.__fieldRouteTree.search(this.pathname)?.pattern,this.path=t,!t)return null;this.params=this.parseParams(this.path,this.pathname);const e=this.routes.find((e=>e.path===t));return e?"render"in e?e.render?.(this.useRouter())||null:e.component:null}slottedComponent(t){const e=this._slottedNames;return t||=this.__slottedRouteTree.search(this.pathname)?.pattern,this.path=t,t?(this.path=e.find((e=>e===t)),this.path?(this.params=this.parseParams(t,this.pathname),a(this.path)):null):null}collectSlottedRoutes(){this.__slottedRouteTree=new o,this.clear(),this._slottedNames.forEach((t=>{this.__slottedRouteTree.insert(t)}))}collectFieldRoutes(t){this.__fieldRouteTree=new o,this.clear(),t.forEach((({path:t})=>{this.__fieldRouteTree.insert(t)}))}parseParams(t,e=this.pathname){return o.parseParams(e,t)}static updateAll(){this.routerInstances.forEach((t=>{t.handlePopstate()}))}};l.routerInstances=new Set,t([i()],l.prototype,"component",void 0),t([i()],l.prototype,"params",void 0),t([i()],l.prototype,"path",void 0),t([n()],l.prototype,"pathname",void 0),t([i()],l.prototype,"default",void 0),t([n()],l.prototype,"type",void 0),t([n({type:Boolean})],l.prototype,"cache",void 0),t([i()],l.prototype,"routes",null),l=p=t([e("router"),s(h`:host{display:contents}`)],l);var c=l;export{l as Router,c as default};
251
2
  //# sourceMappingURL=router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sources":["../src/components/router.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;AASA,MAAM,SAAS,GAAG,QAAQ;AAE1B;;;;;;;;;;;;;;;;;;;AAmBE;AAGF,IAAM,MAAM,GAAA,QAAA,GAAZ,MAAM,MAAoB,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;AAGU,QAAA,IAAA,CAAA,gBAAgB,GAAc,IAAI,SAAS,EAAE;AAC7C,QAAA,IAAA,CAAA,kBAAkB,GAAc,IAAI,SAAS,EAAE;AAC/C,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,GAAG,EAA6C;AAS5E;;AAEE;QAEF,IAAS,CAAA,SAAA,GAAuB,IAAI;AACpC;;AAEE;QAEF,IAAM,CAAA,MAAA,GAA2B,EAAE;AAMnC;;AAEE;QAEF,IAAQ,CAAA,QAAA,GAAG,EAAE;AACb;;AAEE;QAEF,IAAO,CAAA,OAAA,GAAG,EAAE;AACZ;;AAEE;QAEF,IAAO,CAAA,OAAA,GAAmB,QAAQ,EAAE;AACpC;;;;;;AAME;QAEF,IAAI,CAAA,IAAA,GAAmC,QAAQ;AAC/C;;;;AAIE;QAEF,IAAK,CAAA,KAAA,GAAG,KAAK;AAmEb;;;AAGE;QACF,IAAmB,CAAA,mBAAA,GAKU,IAAI;;IAzEjC,IAAI,MAAM,CAAC,KAAK,EAAA;AACd,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;AACrB,QAAA,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;;AAEhC,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,QAAQ;;IAGtB,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;;IAGlB,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AA,KAAA,CAAA,CAAA;AASpC,UAAA,CAAA;AADC,IAAA,QAAQ;AACsC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAO/C,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;AACd,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAGb,UAAA,CAAA;AADC,IAAA,KAAK;AAIN,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,QAAA,EAAA,IAAA,CAAA;AAjEI,MAAM,GAAA,QAAA,GAAA,UAAA,CAAA;IAFX,MAAM,CAAC,SAAS,CAAA;AAChB,IAAA,MAAM,CAAC,GAAG,CAAA,CAAA,uBAAA,CAAyB;AAC9B,CAAA,EAAA,MAAM,CAoOZ;AAEA,eAAe,MAAM;;;;"}
1
+ {"version":3,"file":"router.js","sources":["../src/components/router.ts"],"sourcesContent":null,"names":["Router","Router_1","GlobalStyle","constructor","this","__fieldRouteTree","RouteTree","__slottedRouteTree","__cacheRecord","Map","component","params","default","htmlSlot","type","cache","routeChangeCallback","handlePopstate","events","add","window","pathname","location","routes","value","__routes","collectFieldRoutes","clear","render","cached","get","Object","assign","fieldComponent","slottedComponent","connectedCallback","super","routerInstances","MutationObserver","collectSlottedRoutes","observe","attributeFilter","attributes","subtree","disconnectedCallback","delete","useRouter","path","updated","changedProperties","has","ur","noRecord","set","dispatchEvent","CustomEvent","detail","query","search","pattern","parseParams","route","find","r","slottedPaths","_slottedNames","s","forEach","slotName","insert","routeTemplate","updateAll","i","Set","__decorate","state","prototype","property","Boolean","godown","styles","css","Router$1"],"mappings":"mQAgCA,IAAMA,EAAMC,EAAZ,MAAMD,eAAeE,EAArB,WAAAC,uBAGUC,KAAAC,iBAA8B,IAAIC,EAClCF,KAAAG,mBAAgC,IAAID,EACpCF,KAAAI,cAAgB,IAAIC,IAa5BL,KAASM,UAA6B,KAMt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e3C,KAAKiB,UACrD,OAAOf,EAAUsD,YAAYb,EAAMuB,GAGrC,gBAAOC,GACLnE,KAAKiC,gBAAgB8B,SAASK,IAC5BA,EAAEvD,gBAAgB,MAvOfjB,EAAAqC,gBAA+B,IAAIoC,IAiB1CC,EAAA,CADCC,KACyC3E,EAAA4E,UAAA,iBAAA,GAM1CF,EAAA,CADCC,KACkC3E,EAAA4E,UAAA,cAAA,GAMnCF,EAAA,CADCC,KACW3E,EAAA4E,UAAA,YAAA,GAMZF,EAAA,CADCG,KACe7E,EAAA4E,UAAA,gBAAA,GAMhBF,EAAA,CADCC,KACmC3E,EAAA4E,UAAA,eAAA,GAUpCF,EAAA,CADCG,KAC8C7E,EAAA4E,UAAA,YAAA,GAQ/CF,EAAA,CADCG,EAAS,CAAE/D,KAAMgE,WACL9E,EAAA4E,UAAA,aAAA,GAGbF,EAAA,CADCC,KAID3E,EAAA4E,UAAA,SAAA,MAlEI5E,EAAMC,EAAAyE,EAAA,CAFXK,EAxBiB,UAyBjBC,EAAOC,CAAG,4BACLjF,GAiPN,IAAAkF,EAAelF"}
@@ -1,4 +1,5 @@
1
- import { HandlerEvent } from "@godown/element";
1
+ import { type HandlerEvent } from "@godown/element";
2
+ import { type TemplateResult } from "lit";
2
3
  import Input from "./input.js";
3
4
  /**
4
5
  * {@linkcode Select} is similar to `<select>`.
@@ -11,17 +12,19 @@ import Input from "./input.js";
11
12
  *
12
13
  * Input will filter the element.
13
14
  *
15
+ * @fires input - Fires when the input value changes.
16
+ * @fires change - Fires when the input value changes.
17
+ * @fires select - Fires when select an option.
14
18
  * @slot - Options.
15
19
  * @category input
16
20
  */
17
21
  declare class Select extends Input {
18
- _cache: WeakMap<HTMLElement, boolean>;
19
22
  value: string | string[];
20
23
  /**
21
24
  * Selected texts.
22
25
  */
23
26
  text: string;
24
- _content: HTMLElement;
27
+ protected _content: HTMLElement;
25
28
  direction: "top" | "bottom" | undefined;
26
29
  multiple: boolean;
27
30
  visible: boolean;
@@ -30,7 +33,7 @@ declare class Select extends Input {
30
33
  protected defaultText: string;
31
34
  protected defaultChecked: HTMLElement[];
32
35
  private _store;
33
- protected render(): import("lit").TemplateResult<1>;
36
+ protected render(): TemplateResult<1>;
34
37
  protected _handleFocus(): void;
35
38
  protected firstUpdated(): void;
36
39
  protected _connectedInit(): void;
@@ -44,4 +47,5 @@ declare class Select extends Input {
44
47
  optionValue(option: HTMLElement): string;
45
48
  }
46
49
  export default Select;
50
+ export { Select };
47
51
  //# sourceMappingURL=select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/components/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,OAAO,KAAK,MAAM,YAAY,CAAC;AAyB/B;;;;;;;;;;;;;GAaG;AACH,cAIM,MAAO,SAAQ,KAAK;IACxB,MAAM,gCAAuC;IAE7C,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzB;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,WAAW,CAAC;IAGtB,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IAGxC,QAAQ,EAAE,OAAO,CAAC;IAGlB,OAAO,EAAE,OAAO,CAAC;IAGjB,SAAS,CAAC,aAAa,EAAE,KAAK,GAAG,QAAQ,CAAY;IACrD,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC;IACxC,OAAO,CAAC,MAAM,CAA0C;IAExD,SAAS,CAAC,MAAM;IAShB,SAAS,CAAC,YAAY;IAYtB,SAAS,CAAC,YAAY;IA0BtB,SAAS,CAAC,cAAc;IAsBxB,KAAK,IAAI,IAAI;IAOb,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;I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