godown 2.7.5 → 2.7.7

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 (463) hide show
  1. package/README.md +18 -45
  2. package/{.deps.d.ts → _deps.d.ts} +1 -2
  3. package/{.deps.d.ts.map → _deps.d.ts.map} +1 -1
  4. package/{.deps.js → _deps.js} +1 -2
  5. package/_deps.js.map +1 -0
  6. package/alert.d.ts +8 -1
  7. package/alert.d.ts.map +1 -1
  8. package/alert.js +4 -1
  9. package/alert.js.map +1 -1
  10. package/avatar-group.d.ts +8 -1
  11. package/avatar-group.d.ts.map +1 -1
  12. package/avatar-group.js +4 -1
  13. package/avatar-group.js.map +1 -1
  14. package/avatar.d.ts +8 -1
  15. package/avatar.d.ts.map +1 -1
  16. package/avatar.js +4 -1
  17. package/avatar.js.map +1 -1
  18. package/button.d.ts +8 -1
  19. package/button.d.ts.map +1 -1
  20. package/button.js +4 -1
  21. package/button.js.map +1 -1
  22. package/card.d.ts +8 -1
  23. package/card.d.ts.map +1 -1
  24. package/card.js +4 -1
  25. package/card.js.map +1 -1
  26. package/carousel.d.ts +8 -1
  27. package/carousel.d.ts.map +1 -1
  28. package/carousel.js +4 -1
  29. package/carousel.js.map +1 -1
  30. package/components.json +194 -0
  31. package/conf.d.ts +6 -75
  32. package/conf.d.ts.map +1 -1
  33. package/conf.js +8 -34
  34. package/conf.js.map +1 -1
  35. package/decorators/godown.d.ts +4 -0
  36. package/decorators/godown.d.ts.map +1 -0
  37. package/decorators/godown.js +9 -0
  38. package/decorators/godown.js.map +1 -0
  39. package/decorators/part.d.ts +7 -0
  40. package/decorators/part.d.ts.map +1 -0
  41. package/decorators/part.js +8 -0
  42. package/decorators/part.js.map +1 -0
  43. package/decorators/styles.d.ts +3 -0
  44. package/decorators/styles.d.ts.map +1 -0
  45. package/decorators/styles.js +8 -0
  46. package/decorators/styles.js.map +1 -0
  47. package/details.d.ts +8 -1
  48. package/details.d.ts.map +1 -1
  49. package/details.js +4 -1
  50. package/details.js.map +1 -1
  51. package/dialog.d.ts +8 -1
  52. package/dialog.d.ts.map +1 -1
  53. package/dialog.js +4 -1
  54. package/dialog.js.map +1 -1
  55. package/divider.d.ts +8 -1
  56. package/divider.d.ts.map +1 -1
  57. package/divider.js +4 -1
  58. package/divider.js.map +1 -1
  59. package/dragbox.d.ts +8 -1
  60. package/dragbox.d.ts.map +1 -1
  61. package/dragbox.js +4 -1
  62. package/dragbox.js.map +1 -1
  63. package/flex-flow.d.ts +8 -1
  64. package/flex-flow.d.ts.map +1 -1
  65. package/flex-flow.js +4 -1
  66. package/flex-flow.js.map +1 -1
  67. package/form.d.ts +8 -1
  68. package/form.d.ts.map +1 -1
  69. package/form.js +4 -1
  70. package/form.js.map +1 -1
  71. package/grid-flow.d.ts +9 -0
  72. package/grid-flow.d.ts.map +1 -0
  73. package/grid-flow.js +5 -0
  74. package/grid-flow.js.map +1 -0
  75. package/index.d.ts +32 -3
  76. package/index.d.ts.map +1 -1
  77. package/index.js +32 -3
  78. package/index.js.map +1 -1
  79. package/input.d.ts +8 -1
  80. package/input.d.ts.map +1 -1
  81. package/input.js +4 -1
  82. package/input.js.map +1 -1
  83. package/label-input.d.ts +8 -1
  84. package/label-input.d.ts.map +1 -1
  85. package/label-input.js +4 -1
  86. package/label-input.js.map +1 -1
  87. package/layout.d.ts +9 -0
  88. package/layout.d.ts.map +1 -0
  89. package/layout.js +5 -0
  90. package/layout.js.map +1 -0
  91. package/lib/css.d.ts +13 -0
  92. package/lib/css.d.ts.map +1 -0
  93. package/lib/css.js +29 -0
  94. package/lib/css.js.map +1 -0
  95. package/lib/directives.d.ts +16 -20
  96. package/lib/directives.d.ts.map +1 -1
  97. package/lib/directives.js +33 -31
  98. package/lib/directives.js.map +1 -1
  99. package/lib/event-coll.d.ts +13 -0
  100. package/lib/event-coll.d.ts.map +1 -0
  101. package/lib/event-coll.js +45 -0
  102. package/lib/event-coll.js.map +1 -0
  103. package/lib/{templates.d.ts → icons.d.ts} +1 -17
  104. package/lib/icons.d.ts.map +1 -0
  105. package/lib/icons.js +73 -0
  106. package/lib/icons.js.map +1 -0
  107. package/lib/jsx.d.ts +4 -0
  108. package/lib/jsx.d.ts.map +1 -0
  109. package/lib/jsx.js +52 -0
  110. package/lib/jsx.js.map +1 -0
  111. package/lib/route-tree.d.ts +5 -5
  112. package/lib/route-tree.js +5 -5
  113. package/lib/route-tree.js.map +1 -1
  114. package/lib/utils.d.ts +6 -46
  115. package/lib/utils.d.ts.map +1 -1
  116. package/lib/utils.js +25 -110
  117. package/lib/utils.js.map +1 -1
  118. package/link.d.ts +9 -0
  119. package/link.d.ts.map +1 -0
  120. package/link.js +5 -0
  121. package/link.js.map +1 -0
  122. package/overbreath.d.ts +8 -1
  123. package/overbreath.d.ts.map +1 -1
  124. package/overbreath.js +4 -1
  125. package/overbreath.js.map +1 -1
  126. package/package.json +18 -23
  127. package/progress.d.ts +8 -1
  128. package/progress.d.ts.map +1 -1
  129. package/progress.js +4 -1
  130. package/progress.js.map +1 -1
  131. package/proto/godown-config.d.ts +41 -0
  132. package/proto/godown-config.d.ts.map +1 -0
  133. package/proto/godown-config.js +27 -0
  134. package/proto/godown-config.js.map +1 -0
  135. package/{godown-element.d.ts → proto/godown-element.d.ts} +48 -16
  136. package/proto/godown-element.d.ts.map +1 -0
  137. package/{godown-element.js → proto/godown-element.js} +82 -26
  138. package/proto/godown-element.js.map +1 -0
  139. package/proto/super-a.d.ts +30 -0
  140. package/proto/super-a.d.ts.map +1 -0
  141. package/proto/super-a.js +141 -0
  142. package/proto/super-a.js.map +1 -0
  143. package/proto/super-input.d.ts +44 -0
  144. package/proto/super-input.d.ts.map +1 -0
  145. package/proto/super-input.js +119 -0
  146. package/proto/super-input.js.map +1 -0
  147. package/proto/super-openable.d.ts +23 -0
  148. package/proto/super-openable.d.ts.map +1 -0
  149. package/proto/super-openable.js +43 -0
  150. package/proto/super-openable.js.map +1 -0
  151. package/range-input.d.ts +9 -0
  152. package/range-input.d.ts.map +1 -0
  153. package/range-input.js +5 -0
  154. package/range-input.js.map +1 -0
  155. package/react/create.d.ts.map +1 -1
  156. package/react/create.js +4 -1
  157. package/react/create.js.map +1 -1
  158. package/react/index.d.ts +64 -34
  159. package/react/index.d.ts.map +1 -1
  160. package/react/index.js +78 -51
  161. package/react/index.js.map +1 -1
  162. package/rotate.d.ts +9 -0
  163. package/rotate.d.ts.map +1 -0
  164. package/rotate.js +5 -0
  165. package/rotate.js.map +1 -0
  166. package/router-link.d.ts +9 -0
  167. package/router-link.d.ts.map +1 -0
  168. package/router-link.js +5 -0
  169. package/router-link.js.map +1 -0
  170. package/router.d.ts +8 -1
  171. package/router.d.ts.map +1 -1
  172. package/router.js +4 -1
  173. package/router.js.map +1 -1
  174. package/search-input.d.ts +8 -1
  175. package/search-input.d.ts.map +1 -1
  176. package/search-input.js +4 -1
  177. package/search-input.js.map +1 -1
  178. package/select-input.d.ts +8 -1
  179. package/select-input.d.ts.map +1 -1
  180. package/select-input.js +4 -1
  181. package/select-input.js.map +1 -1
  182. package/skeleton.d.ts +8 -1
  183. package/skeleton.d.ts.map +1 -1
  184. package/skeleton.js +4 -1
  185. package/skeleton.js.map +1 -1
  186. package/split-input.d.ts +8 -1
  187. package/split-input.d.ts.map +1 -1
  188. package/split-input.js +4 -1
  189. package/split-input.js.map +1 -1
  190. package/styles/colors/presets.d.ts +13 -0
  191. package/styles/colors/presets.d.ts.map +1 -0
  192. package/styles/colors/presets.js +6 -0
  193. package/styles/colors/presets.js.map +1 -0
  194. package/styles/colors/presetsRGB.d.ts +16 -0
  195. package/styles/colors/presetsRGB.d.ts.map +1 -0
  196. package/styles/colors/presetsRGB.js +134 -0
  197. package/styles/colors/presetsRGB.js.map +1 -0
  198. package/styles/global.d.ts +18 -0
  199. package/styles/global.d.ts.map +1 -0
  200. package/styles/global.js +78 -0
  201. package/styles/global.js.map +1 -0
  202. package/styles/inputStyle.d.ts +3 -0
  203. package/styles/inputStyle.d.ts.map +1 -0
  204. package/styles/inputStyle.js +59 -0
  205. package/styles/inputStyle.js.map +1 -0
  206. package/switch-input.d.ts +8 -1
  207. package/switch-input.d.ts.map +1 -1
  208. package/switch-input.js +4 -1
  209. package/switch-input.js.map +1 -1
  210. package/text.d.ts +8 -1
  211. package/text.d.ts.map +1 -1
  212. package/text.js +4 -1
  213. package/text.js.map +1 -1
  214. package/time.d.ts +8 -1
  215. package/time.d.ts.map +1 -1
  216. package/time.js +4 -1
  217. package/time.js.map +1 -1
  218. package/tooltip.d.ts +8 -1
  219. package/tooltip.d.ts.map +1 -1
  220. package/tooltip.js +4 -1
  221. package/tooltip.js.map +1 -1
  222. package/typewriter.d.ts +8 -1
  223. package/typewriter.d.ts.map +1 -1
  224. package/typewriter.js +4 -1
  225. package/typewriter.js.map +1 -1
  226. package/web-components/alert/alert.d.ts +2 -10
  227. package/web-components/alert/alert.d.ts.map +1 -1
  228. package/web-components/alert/alert.js +93 -91
  229. package/web-components/alert/alert.js.map +1 -1
  230. package/web-components/avatar/avatar-group.d.ts +21 -0
  231. package/web-components/avatar/avatar-group.d.ts.map +1 -0
  232. package/web-components/avatar/avatar-group.js +86 -0
  233. package/web-components/avatar/avatar-group.js.map +1 -0
  234. package/web-components/avatar/avatar.d.ts +5 -18
  235. package/web-components/avatar/avatar.d.ts.map +1 -1
  236. package/web-components/avatar/avatar.js +70 -85
  237. package/web-components/avatar/avatar.js.map +1 -1
  238. package/web-components/button/button.d.ts +10 -43
  239. package/web-components/button/button.d.ts.map +1 -1
  240. package/web-components/button/button.js +183 -226
  241. package/web-components/button/button.js.map +1 -1
  242. package/web-components/card/card.d.ts +2 -27
  243. package/web-components/card/card.d.ts.map +1 -1
  244. package/web-components/card/card.js +57 -132
  245. package/web-components/card/card.js.map +1 -1
  246. package/web-components/carousel/carousel.d.ts +5 -16
  247. package/web-components/carousel/carousel.d.ts.map +1 -1
  248. package/web-components/carousel/carousel.js +102 -106
  249. package/web-components/carousel/carousel.js.map +1 -1
  250. package/web-components/details/details.d.ts +4 -15
  251. package/web-components/details/details.d.ts.map +1 -1
  252. package/web-components/details/details.js +91 -97
  253. package/web-components/details/details.js.map +1 -1
  254. package/web-components/dialog/dialog.d.ts +6 -17
  255. package/web-components/dialog/dialog.d.ts.map +1 -1
  256. package/web-components/dialog/dialog.js +87 -137
  257. package/web-components/dialog/dialog.js.map +1 -1
  258. package/web-components/divider/divider.d.ts +13 -0
  259. package/web-components/divider/divider.d.ts.map +1 -0
  260. package/web-components/divider/divider.js +95 -0
  261. package/web-components/divider/divider.js.map +1 -0
  262. package/web-components/form/form.d.ts +15 -22
  263. package/web-components/form/form.d.ts.map +1 -1
  264. package/web-components/form/form.js +47 -117
  265. package/web-components/form/form.js.map +1 -1
  266. package/web-components/input/input.d.ts +5 -18
  267. package/web-components/input/input.d.ts.map +1 -1
  268. package/web-components/input/input.js +74 -169
  269. package/web-components/input/input.js.map +1 -1
  270. package/web-components/input/label-input.d.ts +5 -19
  271. package/web-components/input/label-input.d.ts.map +1 -1
  272. package/web-components/input/label-input.js +74 -141
  273. package/web-components/input/label-input.js.map +1 -1
  274. package/web-components/input/range-input.d.ts +53 -0
  275. package/web-components/input/range-input.d.ts.map +1 -0
  276. package/web-components/input/range-input.js +316 -0
  277. package/web-components/input/range-input.js.map +1 -0
  278. package/web-components/input/search-input.d.ts +4 -12
  279. package/web-components/input/search-input.d.ts.map +1 -1
  280. package/web-components/input/search-input.js +118 -113
  281. package/web-components/input/search-input.js.map +1 -1
  282. package/web-components/input/select-input.d.ts +17 -32
  283. package/web-components/input/select-input.d.ts.map +1 -1
  284. package/web-components/input/select-input.js +154 -286
  285. package/web-components/input/select-input.js.map +1 -1
  286. package/web-components/input/split-input.d.ts +8 -15
  287. package/web-components/input/split-input.d.ts.map +1 -1
  288. package/web-components/input/split-input.js +82 -72
  289. package/web-components/input/split-input.js.map +1 -1
  290. package/web-components/input/switch-input.d.ts +8 -17
  291. package/web-components/input/switch-input.d.ts.map +1 -1
  292. package/web-components/input/switch-input.js +122 -158
  293. package/web-components/input/switch-input.js.map +1 -1
  294. package/web-components/layout/flex-flow.d.ts +11 -19
  295. package/web-components/layout/flex-flow.d.ts.map +1 -1
  296. package/web-components/layout/flex-flow.js +57 -35
  297. package/web-components/layout/flex-flow.js.map +1 -1
  298. package/web-components/layout/grid-flow.d.ts +14 -0
  299. package/web-components/layout/grid-flow.d.ts.map +1 -0
  300. package/web-components/layout/grid-flow.js +56 -0
  301. package/web-components/layout/grid-flow.js.map +1 -0
  302. package/web-components/layout/layout.d.ts +18 -0
  303. package/web-components/layout/layout.d.ts.map +1 -0
  304. package/web-components/layout/layout.js +76 -0
  305. package/web-components/layout/layout.js.map +1 -0
  306. package/web-components/link/link.d.ts +10 -0
  307. package/web-components/link/link.d.ts.map +1 -0
  308. package/web-components/link/link.js +17 -0
  309. package/web-components/link/link.js.map +1 -0
  310. package/web-components/link/router-link.d.ts +19 -0
  311. package/web-components/link/router-link.d.ts.map +1 -0
  312. package/web-components/link/router-link.js +60 -0
  313. package/web-components/link/router-link.js.map +1 -0
  314. package/web-components/progress/progress.d.ts +2 -12
  315. package/web-components/progress/progress.d.ts.map +1 -1
  316. package/web-components/progress/progress.js +52 -48
  317. package/web-components/progress/progress.js.map +1 -1
  318. package/web-components/router/router.d.ts +15 -21
  319. package/web-components/router/router.d.ts.map +1 -1
  320. package/web-components/router/router.js +35 -37
  321. package/web-components/router/router.js.map +1 -1
  322. package/web-components/skeleton/skeleton.d.ts +5 -12
  323. package/web-components/skeleton/skeleton.d.ts.map +1 -1
  324. package/web-components/skeleton/skeleton.js +90 -98
  325. package/web-components/skeleton/skeleton.js.map +1 -1
  326. package/web-components/text/overbreath.d.ts +15 -20
  327. package/web-components/text/overbreath.d.ts.map +1 -1
  328. package/web-components/text/overbreath.js +108 -202
  329. package/web-components/text/overbreath.js.map +1 -1
  330. package/web-components/text/text.d.ts +5 -18
  331. package/web-components/text/text.d.ts.map +1 -1
  332. package/web-components/text/text.js +70 -80
  333. package/web-components/text/text.js.map +1 -1
  334. package/web-components/text/time.d.ts +5 -14
  335. package/web-components/text/time.d.ts.map +1 -1
  336. package/web-components/text/time.js +32 -31
  337. package/web-components/text/time.js.map +1 -1
  338. package/web-components/text/typewriter.d.ts +3 -11
  339. package/web-components/text/typewriter.d.ts.map +1 -1
  340. package/web-components/text/typewriter.js +42 -40
  341. package/web-components/text/typewriter.js.map +1 -1
  342. package/web-components/tooltip/tooltip.d.ts +21 -17
  343. package/web-components/tooltip/tooltip.d.ts.map +1 -1
  344. package/web-components/tooltip/tooltip.js +98 -60
  345. package/web-components/tooltip/tooltip.js.map +1 -1
  346. package/web-components/wrapper/dragbox.d.ts +5 -10
  347. package/web-components/wrapper/dragbox.d.ts.map +1 -1
  348. package/web-components/wrapper/dragbox.js +40 -31
  349. package/web-components/wrapper/dragbox.js.map +1 -1
  350. package/web-components/wrapper/rotate.d.ts +30 -0
  351. package/web-components/wrapper/rotate.d.ts.map +1 -0
  352. package/web-components/wrapper/rotate.js +92 -0
  353. package/web-components/wrapper/rotate.js.map +1 -0
  354. package/.deps.js.map +0 -1
  355. package/a.d.ts +0 -2
  356. package/a.d.ts.map +0 -1
  357. package/a.js +0 -2
  358. package/a.js.map +0 -1
  359. package/clip.d.ts +0 -2
  360. package/clip.d.ts.map +0 -1
  361. package/clip.js +0 -2
  362. package/clip.js.map +0 -1
  363. package/decorators/define.d.ts +0 -7
  364. package/decorators/define.d.ts.map +0 -1
  365. package/decorators/define.js +0 -11
  366. package/decorators/define.js.map +0 -1
  367. package/details-group.d.ts +0 -2
  368. package/details-group.d.ts.map +0 -1
  369. package/details-group.js +0 -2
  370. package/details-group.js.map +0 -1
  371. package/godown-element.d.ts.map +0 -1
  372. package/godown-element.js.map +0 -1
  373. package/lib/event-collection.d.ts +0 -14
  374. package/lib/event-collection.d.ts.map +0 -1
  375. package/lib/event-collection.js +0 -71
  376. package/lib/event-collection.js.map +0 -1
  377. package/lib/templates.d.ts.map +0 -1
  378. package/lib/templates.js +0 -76
  379. package/lib/templates.js.map +0 -1
  380. package/naming.d.ts +0 -91
  381. package/naming.d.ts.map +0 -1
  382. package/naming.js +0 -67
  383. package/naming.js.map +0 -1
  384. package/nav-layout.d.ts +0 -2
  385. package/nav-layout.d.ts.map +0 -1
  386. package/nav-layout.js +0 -2
  387. package/nav-layout.js.map +0 -1
  388. package/open-offset.d.ts +0 -2
  389. package/open-offset.d.ts.map +0 -1
  390. package/open-offset.js +0 -2
  391. package/open-offset.js.map +0 -1
  392. package/router-a.d.ts +0 -2
  393. package/router-a.d.ts.map +0 -1
  394. package/router-a.js +0 -2
  395. package/router-a.js.map +0 -1
  396. package/supers/anchor.d.ts +0 -26
  397. package/supers/anchor.d.ts.map +0 -1
  398. package/supers/anchor.js +0 -124
  399. package/supers/anchor.js.map +0 -1
  400. package/supers/input.d.ts +0 -28
  401. package/supers/input.d.ts.map +0 -1
  402. package/supers/input.js +0 -117
  403. package/supers/input.js.map +0 -1
  404. package/supers/openable.d.ts +0 -38
  405. package/supers/openable.d.ts.map +0 -1
  406. package/supers/openable.js +0 -77
  407. package/supers/openable.js.map +0 -1
  408. package/supers/root.d.ts +0 -18
  409. package/supers/root.d.ts.map +0 -1
  410. package/supers/root.js +0 -76
  411. package/supers/root.js.map +0 -1
  412. package/tabs.d.ts +0 -2
  413. package/tabs.d.ts.map +0 -1
  414. package/tabs.js +0 -2
  415. package/tabs.js.map +0 -1
  416. package/web-components/a/a.d.ts +0 -16
  417. package/web-components/a/a.d.ts.map +0 -1
  418. package/web-components/a/a.js +0 -17
  419. package/web-components/a/a.js.map +0 -1
  420. package/web-components/group/avatar-group.d.ts +0 -29
  421. package/web-components/group/avatar-group.d.ts.map +0 -1
  422. package/web-components/group/avatar-group.js +0 -88
  423. package/web-components/group/avatar-group.js.map +0 -1
  424. package/web-components/group/details-group.d.ts +0 -28
  425. package/web-components/group/details-group.d.ts.map +0 -1
  426. package/web-components/group/details-group.js +0 -59
  427. package/web-components/group/details-group.js.map +0 -1
  428. package/web-components/index.d.ts +0 -35
  429. package/web-components/index.d.ts.map +0 -1
  430. package/web-components/index.js +0 -35
  431. package/web-components/index.js.map +0 -1
  432. package/web-components/layout/divider.d.ts +0 -22
  433. package/web-components/layout/divider.d.ts.map +0 -1
  434. package/web-components/layout/divider.js +0 -85
  435. package/web-components/layout/divider.js.map +0 -1
  436. package/web-components/layout/nav-layout.d.ts +0 -38
  437. package/web-components/layout/nav-layout.d.ts.map +0 -1
  438. package/web-components/layout/nav-layout.js +0 -69
  439. package/web-components/layout/nav-layout.js.map +0 -1
  440. package/web-components/offset/open-offset.d.ts +0 -27
  441. package/web-components/offset/open-offset.d.ts.map +0 -1
  442. package/web-components/offset/open-offset.js +0 -130
  443. package/web-components/offset/open-offset.js.map +0 -1
  444. package/web-components/router/router-a.d.ts +0 -25
  445. package/web-components/router/router-a.d.ts.map +0 -1
  446. package/web-components/router/router-a.js +0 -70
  447. package/web-components/router/router-a.js.map +0 -1
  448. package/web-components/tabs/tabs.d.ts +0 -52
  449. package/web-components/tabs/tabs.d.ts.map +0 -1
  450. package/web-components/tabs/tabs.js +0 -165
  451. package/web-components/tabs/tabs.js.map +0 -1
  452. package/web-components/text/clip.d.ts +0 -22
  453. package/web-components/text/clip.d.ts.map +0 -1
  454. package/web-components/text/clip.js +0 -45
  455. package/web-components/text/clip.js.map +0 -1
  456. package/web-components/wrapper/wrapper.d.ts +0 -27
  457. package/web-components/wrapper/wrapper.d.ts.map +0 -1
  458. package/web-components/wrapper/wrapper.js +0 -95
  459. package/web-components/wrapper/wrapper.js.map +0 -1
  460. package/wrapper.d.ts +0 -2
  461. package/wrapper.d.ts.map +0 -1
  462. package/wrapper.js +0 -2
  463. package/wrapper.js.map +0 -1
@@ -1,8 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, property } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { cssvarValues, GodownElement } from "../../supers/root.js";
5
- const defineName = "progress";
2
+ import { css, html, property } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { styles } from "../../decorators/styles.js";
5
+ import { GodownElement } from "../../proto/godown-element.js";
6
+ import { cssGlobalVars } from "../../styles/global.js";
7
+ const protoName = "progress";
6
8
  /**
7
9
  * {@linkcode Progress} similar to progress.
8
10
  */
@@ -27,10 +29,10 @@ let Progress = class Progress extends GodownElement {
27
29
  let className;
28
30
  if (this.value !== null) {
29
31
  width = this.parsePercent(this.value);
30
- className = "v";
32
+ className = "static";
31
33
  }
32
- return html `<div class="${className}">
33
- <i style="width:${width}%;"></i>
34
+ return html `<div part="root" class="${className}">
35
+ <i part="value" style="width:${width}%;"></i>
34
36
  </div>`;
35
37
  }
36
38
  /**
@@ -46,46 +48,6 @@ let Progress = class Progress extends GodownElement {
46
48
  return (parseFloat(String(s)) / (this.max - this.min)) * 100;
47
49
  }
48
50
  };
49
- Progress.styles = [
50
- GodownElement.styles,
51
- css `
52
- :host,
53
- div {
54
- display: inline-flex;
55
- position: relative;
56
- width: 10em;
57
- height: 0.5em;
58
- border-radius: 0.25em;
59
- background: var(${cssvarValues.input}--false);
60
- z-index: 1;
61
- }
62
-
63
- div i {
64
- position: absolute;
65
- border-radius: inherit;
66
- top: 0;
67
- left: 0;
68
- height: 100%;
69
- background: var(${cssvarValues.cssvar}--accept);
70
- z-index: 2;
71
- transition: all 0.3s;
72
- animation: progress 1.5s ease-in-out infinite alternate;
73
- }
74
-
75
- @keyframes progress {
76
- from {
77
- left: 0;
78
- }
79
- to {
80
- left: 80%;
81
- }
82
- }
83
-
84
- div.v i {
85
- animation: none;
86
- }
87
- `,
88
- ];
89
51
  __decorate([
90
52
  property({ type: Number })
91
53
  ], Progress.prototype, "max", void 0);
@@ -96,7 +58,49 @@ __decorate([
96
58
  property({ type: Number, reflect: true })
97
59
  ], Progress.prototype, "value", void 0);
98
60
  Progress = __decorate([
99
- define(defineName)
61
+ godown(protoName),
62
+ styles(css `
63
+ :host {
64
+ width: 100%;
65
+ height: 0.5em;
66
+ display: inline-block;
67
+ border-radius: 0.25em;
68
+ background: var(--${cssGlobalVars.passive});
69
+ color: var(--${cssGlobalVars.active});
70
+ }
71
+
72
+ [part="root"] {
73
+ height: inherit;
74
+ z-index: 1;
75
+ position: relative;
76
+ border-radius: inherit;
77
+ }
78
+
79
+ [part="value"] {
80
+ position: absolute;
81
+ z-index: 2;
82
+ top: 0;
83
+ left: 0;
84
+ height: 100%;
85
+ border-radius: inherit;
86
+ transition: all 0.3s;
87
+ animation: progress 1.5s ease-in-out infinite alternate;
88
+ background: currentColor;
89
+ }
90
+
91
+ @keyframes progress {
92
+ from {
93
+ left: 0;
94
+ }
95
+ to {
96
+ left: 80%;
97
+ }
98
+ }
99
+
100
+ .static [part="value"] {
101
+ animation: none;
102
+ }
103
+ `)
100
104
  ], Progress);
101
105
  export { Progress };
102
106
  export default Progress;
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/progress/progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B;;GAEG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,aAAa;IAApC;;QACL;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACwC,UAAK,GAAG,IAAI,CAAC;IAmE1D,CAAC;IAxBW,MAAM;QACd,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,SAAiB,CAAC;QACtB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxB,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,SAAS,GAAG,GAAG,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAA,eAAe,SAAS;wBACf,KAAK;WAClB,CAAC;IACV,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAqB,GAAG;QACnC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC/D,CAAC;;AAhEM,eAAM,GAAG;IACd,aAAa,CAAC,MAAM;IACpB,GAAG,CAAA;;;;;;;;0BAQmB,YAAY,CAAC,KAAK;;;;;;;;;;0BAUlB,YAAY,CAAC,MAAM;;;;;;;;;;;;;;;;;;KAkBxC;CACgB,AAvCN,CAuCO;AAjDQ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCAAS;AAIR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCAAS;AAIO;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAc;AAZ7C,QAAQ;IADpB,MAAM,CAAC,UAAU,CAAC;GACN,QAAQ,CA+EpB;;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { type HTMLTemplate } from \"../../lib/templates.js\";\nimport { cssvarValues, GodownElement } from \"../../supers/root.js\";\n\nconst defineName = \"progress\";\n\n/**\n * {@linkcode Progress} similar to progress.\n */\n@define(defineName)\nexport class Progress extends GodownElement {\n /**\n * Maximum.\n */\n @property({ type: Number }) max = 1;\n /**\n * Minimum.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input value.\n */\n @property({ type: Number, reflect: true }) value = null;\n\n static styles = [\n GodownElement.styles,\n css`\n :host,\n div {\n display: inline-flex;\n position: relative;\n width: 10em;\n height: 0.5em;\n border-radius: 0.25em;\n background: var(${cssvarValues.input}--false);\n z-index: 1;\n }\n\n div i {\n position: absolute;\n border-radius: inherit;\n top: 0;\n left: 0;\n height: 100%;\n background: var(${cssvarValues.cssvar}--accept);\n z-index: 2;\n transition: all 0.3s;\n animation: progress 1.5s ease-in-out infinite alternate;\n }\n\n @keyframes progress {\n from {\n left: 0;\n }\n to {\n left: 80%;\n }\n }\n\n div.v i {\n animation: none;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n let width = 20;\n let className: string;\n if (this.value !== null) {\n width = this.parsePercent(this.value);\n className = \"v\";\n }\n return html`<div class=\"${className}\">\n <i style=\"width:${width}%;\"></i>\n </div>`;\n }\n\n /**\n * Convert s to a percentage without a percent sign.\n *\n * @param s String or number to convert.\n * @returns Percentage without a percent sign.\n */\n parsePercent(s: string | number = \"0\"): number {\n if (String(s).includes(\"%\")) {\n return parseFloat(String(s));\n }\n return (parseFloat(String(s)) / (this.max - this.min)) * 100;\n }\n}\n\nexport default Progress;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"loading-progress\": Progress;\n \"load-track\": Progress;\n \"g-progress\": Progress;\n }\n}\n"]}
1
+ {"version":3,"file":"progress.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/progress/progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa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EAAE,CAAC;uCAAc;AAZ7C,QAAQ;IA3CpB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC,GAAG,CAAA;;;;;;wBAMa,aAAa,CAAC,OAAO;mBAC1B,aAAa,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCtC,CAAC;GACW,QAAQ,CAsCpB;;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\nimport { cssGlobalVars } from \"../../styles/global.js\";\n\nconst protoName = \"progress\";\n\n/**\n * {@linkcode Progress} similar to progress.\n */\n@godown(protoName)\n@styles(css`\n :host {\n width: 100%;\n height: 0.5em;\n display: inline-block;\n border-radius: 0.25em;\n background: var(--${cssGlobalVars.passive});\n color: var(--${cssGlobalVars.active});\n }\n\n [part=\"root\"] {\n height: inherit;\n z-index: 1;\n position: relative;\n border-radius: inherit;\n }\n\n [part=\"value\"] {\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: inherit;\n transition: all 0.3s;\n animation: progress 1.5s ease-in-out infinite alternate;\n background: currentColor;\n }\n\n @keyframes progress {\n from {\n left: 0;\n }\n to {\n left: 80%;\n }\n }\n\n .static [part=\"value\"] {\n animation: none;\n }\n`)\nexport class Progress extends GodownElement {\n /**\n * Maximum.\n */\n @property({ type: Number }) max = 1;\n /**\n * Minimum.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input value.\n */\n @property({ type: Number, reflect: true }) value = null;\n\n protected render() {\n let width = 20;\n let className: string;\n if (this.value !== null) {\n width = this.parsePercent(this.value);\n className = \"static\";\n }\n return html`<div part=\"root\" class=\"${className}\">\n <i part=\"value\" style=\"width:${width}%;\"></i>\n </div>`;\n }\n\n /**\n * Convert s to a percentage without a percent sign.\n *\n * @param s String or number to convert.\n * @returns Percentage without a percent sign.\n */\n parsePercent(s: string | number = \"0\"): number {\n if (String(s).includes(\"%\")) {\n return parseFloat(String(s));\n }\n return (parseFloat(String(s)) / (this.max - this.min)) * 100;\n }\n}\n\nexport default Progress;\n"]}
@@ -1,9 +1,10 @@
1
- import { type PropertyValueMap } from "../../.deps.js";
2
- import RouteTree from "../../lib/route-tree.js";
3
- import { type HTMLTemplate } from "../../lib/templates.js";
4
- import { GodownElement } from "../../supers/root.js";
1
+ import { type PropertyValueMap } from "../../_deps.js";
2
+ import { type HTMLTemplate } from "../../lib/directives.js";
3
+ import { GodownElement } from "../../proto/godown-element.js";
5
4
  /**
6
5
  * {@linkcode Router} has basic routing control.
6
+ *
7
+ * To switch routes, use history api or router-link.
7
8
  */
8
9
  export declare class Router<T = unknown> extends GodownElement {
9
10
  private _routes;
@@ -31,11 +32,11 @@ export declare class Router<T = unknown> extends GodownElement {
31
32
  /**
32
33
  * Rendered content when there is no match.
33
34
  */
34
- def: import("lit").TemplateResult<1>;
35
+ default: HTMLTemplate;
35
36
  /**
36
37
  * The type of routing query.
37
38
  */
38
- type: "united" | "child" | "slotted" | "field";
39
+ type: "united" | "slotted" | "field";
39
40
  /**
40
41
  * Rewrite history.
41
42
  */
@@ -48,10 +49,10 @@ export declare class Router<T = unknown> extends GodownElement {
48
49
  * Cache record.
49
50
  */
50
51
  record: Map<string, {
51
- pathname: string;
52
- params: Record<string, string>;
53
52
  path: string;
54
- component: T | import("lit").TemplateResult<1>;
53
+ component: HTMLTemplate | T;
54
+ params: Record<string, string>;
55
+ pathname: string;
55
56
  }>;
56
57
  set routes(v: (Record<string, any> & Record<"path", string> & {
57
58
  component?: T;
@@ -59,14 +60,13 @@ export declare class Router<T = unknown> extends GodownElement {
59
60
  get routes(): (Record<string, any> & Record<"path", string> & {
60
61
  component?: T;
61
62
  })[];
62
- static styles: import("lit").CSSResult[];
63
63
  reset(): void;
64
64
  protected render(): T | HTMLTemplate;
65
65
  useRouter(): {
66
- pathname: string;
67
- params: Record<string, string>;
68
66
  path: string;
69
- component: T | import("lit").TemplateResult<1>;
67
+ component: HTMLTemplate | T;
68
+ params: Record<string, string>;
69
+ pathname: string;
70
70
  };
71
71
  connectedCallback(): void;
72
72
  /**
@@ -78,15 +78,9 @@ export declare class Router<T = unknown> extends GodownElement {
78
78
  protected updated(changedProperties: PropertyValueMap<this>): void;
79
79
  fieldComponent(usedRouteTemplate?: string): null | T;
80
80
  slottedComponent(usedRouteTemplate?: string): null | HTMLTemplate;
81
- useWhichRoute(path: string, baseURL?: string, appl?: RouteTree): string | null;
82
- parseRouterParams(routeTemplate: string, originpath: string, appl?: RouteTree): Record<string, string>;
81
+ useWhichRoute(path: string): string | null;
82
+ parseRouterParams(routeTemplate: string, path: string): Record<string, string>;
83
83
  static updateAll(): void;
84
84
  }
85
85
  export default Router;
86
- declare global {
87
- interface HTMLElementTagNameMap {
88
- "route-view": Router;
89
- "g-router": Router;
90
- }
91
- }
92
86
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/router/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,gBAAgB,EAAS,MAAM,gBAAgB,CAAC;AAG7E,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD;;GAEG;AACH,qBACa,MAAM,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,aAAa;IACpD,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,UAAU,CAA8B;IAEhD;;OAEG;IACM,SAAS,EAAE,CAAC,GAAG,YAAY,CAAQ;IAC5C;;OAEG;IACM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAC7C;;OAEG;IACM,IAAI,EAAE,MAAM,CAAQ;I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B;CACF"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/router/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,gBAAgB,EAAS,MAAM,gBAAgB,CAAC;AAI7E,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D;;;;GAIG;AACH,qBAMa,MAAM,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,aAAa;IACpD,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,UAAU,CAA8B;IAEhD;;OAEG;IACM,SAAS,EAAE,CAAC,GAAG,YAAY,CAAQ;IAC5C;;OAEG;IACM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAC7C;;OAEG;IACM,IAAI,EAAE,MAAM,CAAQ;IAC7B;;OAEG;IACS,QAAQ,SAAM;IAC1B;;OAEG;IACS,OAAO,SAAM;IACzB;;OAEG;IACM,OAAO,EAAE,YAAY,CAAc;IAC5C;;OAEG;IACS,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAY;IAC5D;;OAEG;IACM,QAAQ,UAAQ;IACzB;;OAEG;IAC0B,KAAK,UAAS;IAE3C;;OAEG;IACH,MAAM;cA2Ce,MAAM;mBAAa,YAAY,GAAG,CAAC;gBAAU,OAAO,MAAM,EAAE,MAAM,CAAC;kBAAY,MAAM;OA3C5C;IAE9D,IAAI,MAAM,CAAC,CAAC;;QAAA,EAOX;IAED,IAAI,MAAM;;SAET;IAED,KAAK;IAKL,SAAS,CAAC,MAAM,IAAI,CAAC,GAAG,YAAY;IAuBpC,SAAS,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,YAAY,GAAG,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAS5G,iBAAiB;IA2BjB;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAQ;IAE5F,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAa3D,cAAc,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC;IAgBpD,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY;IA6BjE,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAI1C,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI9E,MAAM,CAAC,SAAS;CAQjB;AAED,eAAe,MAAM,CAAC"}
@@ -1,16 +1,20 @@
1
+ var Router_1;
1
2
  import { __decorate } from "tslib";
2
- import { css, property, state } from "../../.deps.js";
3
- import { conf } from "../../conf.js";
4
- import { define } from "../../decorators/define.js";
3
+ import { css, property, state } from "../../_deps.js";
4
+ import conf from "../../conf.js";
5
+ import { godown } from "../../decorators/godown.js";
6
+ import { styles } from "../../decorators/styles.js";
7
+ import { htmlSlot } from "../../lib/directives.js";
5
8
  import RouteTree from "../../lib/route-tree.js";
6
- import { htmlSlot } from "../../lib/templates.js";
7
9
  import { deepQuerySelectorAll } from "../../lib/utils.js";
8
- import { GodownElement } from "../../supers/root.js";
9
- const defineName = "router";
10
+ import { GodownElement } from "../../proto/godown-element.js";
11
+ const protoName = "router";
10
12
  /**
11
13
  * {@linkcode Router} has basic routing control.
14
+ *
15
+ * To switch routes, use history api or router-link.
12
16
  */
13
- let Router = class Router extends GodownElement {
17
+ let Router = Router_1 = class Router extends GodownElement {
14
18
  constructor() {
15
19
  super(...arguments);
16
20
  this._routes = [];
@@ -38,7 +42,7 @@ let Router = class Router extends GodownElement {
38
42
  /**
39
43
  * Rendered content when there is no match.
40
44
  */
41
- this.def = htmlSlot();
45
+ this.default = htmlSlot();
42
46
  /**
43
47
  * The type of routing query.
44
48
  */
@@ -63,9 +67,6 @@ let Router = class Router extends GodownElement {
63
67
  this.routeChangeCallback = null;
64
68
  }
65
69
  set routes(v) {
66
- if (Object.prototype.toString.call(v) !== "[object Array]") {
67
- return;
68
- }
69
70
  this._routes = v;
70
71
  this.reset();
71
72
  for (const route of v) {
@@ -81,6 +82,7 @@ let Router = class Router extends GodownElement {
81
82
  this.record.clear();
82
83
  }
83
84
  render() {
85
+ this.params = {};
84
86
  if (this.cache) {
85
87
  const cached = this.record.get(this.pathname);
86
88
  if (cached) {
@@ -88,12 +90,10 @@ let Router = class Router extends GodownElement {
88
90
  return this.component;
89
91
  }
90
92
  }
91
- this.params = {};
92
93
  switch (this.type) {
93
94
  case "field":
94
95
  this.component = this.fieldComponent();
95
96
  break;
96
- case "child":
97
97
  case "slotted":
98
98
  this.component = this.slottedComponent();
99
99
  break;
@@ -101,7 +101,7 @@ let Router = class Router extends GodownElement {
101
101
  this.component = this.fieldComponent() ?? this.slottedComponent();
102
102
  break;
103
103
  }
104
- return this.component ?? this.def;
104
+ return this.component ?? this.default;
105
105
  }
106
106
  useRouter() {
107
107
  return {
@@ -122,6 +122,10 @@ let Router = class Router extends GodownElement {
122
122
  });
123
123
  const self = this;
124
124
  const pushHistory = history.pushState;
125
+ const { override } = conf;
126
+ if (!override.pushState) {
127
+ override.pushState = pushHistory;
128
+ }
125
129
  history.pushState = function () {
126
130
  pushHistory.apply(this, arguments);
127
131
  self.pathname = window.location.pathname;
@@ -160,14 +164,14 @@ let Router = class Router extends GodownElement {
160
164
  return route.component;
161
165
  }
162
166
  slottedComponent(usedRouteTemplate) {
163
- const childNodes = this.querySelectorAll(":scope > *[slot]");
167
+ const childNodes = this.slottedChildren;
164
168
  if (!childNodes.length) {
165
169
  return null;
166
170
  }
167
171
  const slottedPaths = Array.from(childNodes).map((node) => {
168
- const slotname = node.getAttribute("slot");
172
+ const slotName = node.getAttribute("slot");
169
173
  return {
170
- path: slotname,
174
+ path: slotName,
171
175
  };
172
176
  });
173
177
  const tempRouteTree = new RouteTree();
@@ -175,7 +179,7 @@ let Router = class Router extends GodownElement {
175
179
  tempRouteTree.insert(withPath.path);
176
180
  }
177
181
  if (!usedRouteTemplate) {
178
- usedRouteTemplate = this.useWhichRoute(this.pathname, undefined, tempRouteTree);
182
+ usedRouteTemplate = tempRouteTree.useWhich(this.pathname);
179
183
  if (!usedRouteTemplate) {
180
184
  return null;
181
185
  }
@@ -187,18 +191,14 @@ let Router = class Router extends GodownElement {
187
191
  this.params = this.parseRouterParams(usedRouteTemplate, this.pathname);
188
192
  return htmlSlot(slotElement.path);
189
193
  }
190
- useWhichRoute(path, baseURL = this.baseURL, appl = this._routeTree) {
191
- return appl.useWhich(baseURL + path);
194
+ useWhichRoute(path) {
195
+ return this._routeTree.useWhich(this.baseURL + path);
192
196
  }
193
- parseRouterParams(routeTemplate, originpath, appl = this._routeTree) {
194
- return appl.parseParams(originpath, routeTemplate);
197
+ parseRouterParams(routeTemplate, path) {
198
+ return this._routeTree.parseParams(path, routeTemplate);
195
199
  }
196
200
  static updateAll() {
197
- const routeViewTagName = conf.nameMap.get("route-view");
198
- if (!routeViewTagName) {
199
- return;
200
- }
201
- const routeViewArray = deepQuerySelectorAll(routeViewTagName, document.body);
201
+ const routeViewArray = deepQuerySelectorAll(Router_1.elementTagName, document.body);
202
202
  routeViewArray.forEach((ArrayItem) => {
203
203
  if (!ArrayItem.override) {
204
204
  ArrayItem.pathname = window.location.pathname;
@@ -206,13 +206,6 @@ let Router = class Router extends GodownElement {
206
206
  });
207
207
  }
208
208
  };
209
- Router.styles = [
210
- css `
211
- :host {
212
- display: contents;
213
- }
214
- `,
215
- ];
216
209
  __decorate([
217
210
  state()
218
211
  ], Router.prototype, "component", void 0);
@@ -230,7 +223,7 @@ __decorate([
230
223
  ], Router.prototype, "baseURL", void 0);
231
224
  __decorate([
232
225
  state()
233
- ], Router.prototype, "def", void 0);
226
+ ], Router.prototype, "default", void 0);
234
227
  __decorate([
235
228
  property()
236
229
  ], Router.prototype, "type", void 0);
@@ -240,8 +233,13 @@ __decorate([
240
233
  __decorate([
241
234
  property({ type: Boolean })
242
235
  ], Router.prototype, "cache", void 0);
243
- Router = __decorate([
244
- define(defineName)
236
+ Router = Router_1 = __decorate([
237
+ godown(protoName),
238
+ styles(css `
239
+ :host {
240
+ display: contents;
241
+ }
242
+ `)
245
243
  ], Router);
246
244
  export { Router };
247
245
  export default Router;
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/router/router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B;;GAEG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAoB,SAAQ,aAAa;IAA/C;;QACG,YAAO,GAA+C,EAAE,CAAC;QACzD,eAAU,GAAc,IAAI,SAAS,EAAE,CAAC;QAEhD;;WAEG;QACM,cAAS,GAAqB,IAAI,CAAC;QAC5C;;WAEG;QACM,WAAM,GAA2B,EAAE,CAAC;QAC7C;;WAEG;QACM,SAAI,GAAW,IAAI,CAAC;QAC7B;;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E;yCAAoC;AAInC;IAAR,KAAK,EAAE;sCAAqC;AAIpC;IAAR,KAAK,EAAE;oCAAqB;AAIjB;IAAX,QAAQ,EAAE;wCAAe;AAId;IAAX,QAAQ,EAAE;uCAAc;AAIhB;IAAR,KAAK,EAAE;mCAAkB;AAId;IAAX,QAAQ,EAAE;oCAA2D;AAI7D;IAAR,KAAK,EAAE;wCAAiB;AAII;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCAAe;AAvChC,MAAM;IADlB,MAAM,CAAC,UAAU,CAAC;GACN,MAAM,CAuNlB;;AAED,eAAe,MAAM,CAAC","sourcesContent":["import { css, property, type PropertyValueMap, state } from \"../../.deps.js\";\nimport { conf } from \"../../conf.js\";\nimport { define } from \"../../decorators/define.js\";\nimport RouteTree from \"../../lib/route-tree.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { deepQuerySelectorAll } from \"../../lib/utils.js\";\nimport { GodownElement } from \"../../supers/root.js\";\n\ntype WithRecord<T extends string> = Record<string, any> & Record<T, string>;\n\nconst defineName = \"router\";\n\n/**\n * {@linkcode Router} has basic routing control.\n */\n@define(defineName)\nexport class Router<T = unknown> extends GodownElement {\n private _routes: (WithRecord<\"path\"> & { component?: T })[] = [];\n private _routeTree: RouteTree = new RouteTree();\n\n /**\n * Component will render.\n */\n @state() component: T | HTMLTemplate = null;\n /**\n * Dynamic parameters record.\n */\n @state() params: Record<string, string> = {};\n /**\n * Value of matched path in routes, or null.\n */\n @state() path: string = null;\n /**\n * Current pathname (location.pathname).\n */\n @property() pathname = \"\";\n /**\n * Path prefix.\n */\n @property() baseURL = \"\";\n /**\n * Rendered content when there is no match.\n */\n @state() def = htmlSlot();\n /**\n * The type of routing query.\n */\n @property() type: \"united\" | \"child\" | \"slotted\" | \"field\" = \"united\";\n /**\n * Rewrite history.\n */\n @state() override = true;\n /**\n * Cache accessed.\n */\n @property({ type: Boolean }) cache = false;\n\n /**\n * Cache record.\n */\n record = new Map<string, ReturnType<typeof this.useRouter>>();\n\n set routes(v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n return;\n }\n this._routes = v;\n this.reset();\n for (const route of v) {\n this._routeTree.insert(route.path);\n }\n this.requestUpdate();\n }\n\n get routes() {\n return this._routes;\n }\n\n static styles = [\n css`\n :host {\n display: contents;\n }\n `,\n ];\n\n reset() {\n this._routeTree = new RouteTree();\n this.record.clear();\n }\n\n protected render(): T | HTMLTemplate {\n if (this.cache) {\n const cached = this.record.get(this.pathname);\n if (cached) {\n Object.assign(this, cached);\n return this.component;\n }\n }\n this.params = {};\n switch (this.type) {\n case \"field\":\n this.component = this.fieldComponent();\n break;\n case \"child\":\n case \"slotted\":\n this.component = this.slottedComponent();\n break;\n case \"united\":\n this.component = this.fieldComponent() ?? this.slottedComponent();\n break;\n }\n return this.component ?? this.def;\n }\n\n useRouter() {\n return {\n pathname: this.pathname,\n params: this.params,\n path: this.path,\n component: this.component,\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.pathname = window.location.pathname;\n if (!this.override) {\n return;\n }\n this.addEvent(window, \"popstate\", () => {\n this.pathname = window.location.pathname;\n });\n const self = this;\n const pushHistory = history.pushState;\n history.pushState = function () {\n pushHistory.apply(this, arguments);\n self.pathname = window.location.pathname;\n };\n const replaceHistory = history.replaceState;\n history.replaceState = function () {\n replaceHistory.apply(this, arguments);\n self.pathname = window.location.pathname;\n };\n }\n\n /**\n *\n * @param ur value of useRouter()\n * @param first whether this path is loaded for the first time\n */\n routeChangeCallback: (ur: ReturnType<typeof this.useRouter>, first: boolean) => void = null;\n\n protected updated(changedProperties: PropertyValueMap<this>) {\n const shouldDispatch = changedProperties.has(\"pathname\") || changedProperties.has(\"path\");\n if (shouldDispatch) {\n const ur = this.useRouter();\n const noRecord = !this.record.has(this.pathname);\n if (noRecord) {\n this.record.set(this.pathname, ur);\n }\n this.routeChangeCallback?.(ur, noRecord);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: ur }));\n }\n }\n\n fieldComponent(usedRouteTemplate?: string): null | T {\n if (!usedRouteTemplate) {\n usedRouteTemplate = this.useWhichRoute(this.pathname);\n }\n this.path = usedRouteTemplate;\n if (!usedRouteTemplate) {\n return null;\n }\n this.params = this.parseRouterParams(this.path, this.pathname);\n const route = this.routes.find((r) => r.path === usedRouteTemplate);\n if (!route) {\n return null;\n }\n return route.component;\n }\n\n slottedComponent(usedRouteTemplate?: string): null | HTMLTemplate {\n const childNodes = this.querySelectorAll(\":scope > *[slot]\");\n if (!childNodes.length) {\n return null;\n }\n const slottedPaths = Array.from(childNodes).map((node) => {\n const slotname = node.getAttribute(\"slot\");\n return {\n path: slotname,\n };\n });\n const tempRouteTree = new RouteTree();\n for (const withPath of slottedPaths) {\n tempRouteTree.insert(withPath.path);\n }\n if (!usedRouteTemplate) {\n usedRouteTemplate = this.useWhichRoute(this.pathname, undefined, tempRouteTree);\n if (!usedRouteTemplate) {\n return null;\n }\n }\n const slotElement = slottedPaths.find((s) => s.path === usedRouteTemplate);\n if (!slotElement) {\n return null;\n }\n this.params = this.parseRouterParams(usedRouteTemplate, this.pathname);\n return htmlSlot(slotElement.path);\n }\n\n useWhichRoute(path: string, baseURL = this.baseURL, appl: RouteTree = this._routeTree): string | null {\n return appl.useWhich(baseURL + path);\n }\n\n parseRouterParams(routeTemplate: string, originpath: string, appl: RouteTree = this._routeTree): Record<string, string> {\n return appl.parseParams(originpath, routeTemplate);\n }\n\n static updateAll() {\n const routeViewTagName = conf.nameMap.get(\"route-view\");\n if (!routeViewTagName) {\n return;\n }\n const routeViewArray = deepQuerySelectorAll<Router>(routeViewTagName, document.body);\n routeViewArray.forEach((ArrayItem) => {\n if (!ArrayItem.override) {\n ArrayItem.pathname = window.location.pathname;\n }\n });\n }\n}\n\nexport default Router;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"route-view\": Router;\n \"g-router\": Router;\n }\n}\n"]}
1
+ {"version":3,"file":"router.js","sourceRoot":"https://github.com/start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vD,CAAC;IAED,iBAAiB,CAAC,aAAqB,EAAE,IAAY;QACnD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,SAAS;QACd,MAAM,cAAc,GAAG,oBAAoB,CAAS,QAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1F,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACnC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACxB,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAChD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AArMU;IAAR,KAAK,EAAE;yCAAoC;AAInC;IAAR,KAAK,EAAE;sCAAqC;AAIpC;IAAR,KAAK,EAAE;oCAAqB;AAIjB;IAAX,QAAQ,EAAE;wCAAe;AAId;IAAX,QAAQ,EAAE;uCAAc;AAIhB;IAAR,KAAK,EAAE;uCAAoC;AAIhC;IAAX,QAAQ,EAAE;oCAAiD;AAInD;IAAR,KAAK,EAAE;wCAAiB;AAII;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCAAe;AAvChC,MAAM;IANlB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC,GAAG,CAAA;;;;CAIV,CAAC;GACW,MAAM,CA4MlB;;AAED,eAAe,MAAM,CAAC","sourcesContent":["import { css, property, type PropertyValueMap, state } from \"../../_deps.js\";\nimport conf from \"../../conf.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/directives.js\";\nimport RouteTree from \"../../lib/route-tree.js\";\nimport { deepQuerySelectorAll } from \"../../lib/utils.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\n\ntype WithRecord<T extends string> = Record<string, any> & Record<T, string>;\n\nconst protoName = \"router\";\n\n/**\n * {@linkcode Router} has basic routing control.\n *\n * To switch routes, use history api or router-link.\n */\n@godown(protoName)\n@styles(css`\n :host {\n display: contents;\n }\n`)\nexport class Router<T = unknown> extends GodownElement {\n private _routes: (WithRecord<\"path\"> & { component?: T })[] = [];\n private _routeTree: RouteTree = new RouteTree();\n\n /**\n * Component will render.\n */\n @state() component: T | HTMLTemplate = null;\n /**\n * Dynamic parameters record.\n */\n @state() params: Record<string, string> = {};\n /**\n * Value of matched path in routes, or null.\n */\n @state() path: string = null;\n /**\n * Current pathname (location.pathname).\n */\n @property() pathname = \"\";\n /**\n * Path prefix.\n */\n @property() baseURL = \"\";\n /**\n * Rendered content when there is no match.\n */\n @state() default: HTMLTemplate = htmlSlot();\n /**\n * The type of routing query.\n */\n @property() type: \"united\" | \"slotted\" | \"field\" = \"united\";\n /**\n * Rewrite history.\n */\n @state() override = true;\n /**\n * Cache accessed.\n */\n @property({ type: Boolean }) cache = false;\n\n /**\n * Cache record.\n */\n record = new Map<string, ReturnType<typeof this.useRouter>>();\n\n set routes(v) {\n this._routes = v;\n this.reset();\n for (const route of v) {\n this._routeTree.insert(route.path);\n }\n this.requestUpdate();\n }\n\n get routes() {\n return this._routes;\n }\n\n reset() {\n this._routeTree = new RouteTree();\n this.record.clear();\n }\n\n protected render(): T | HTMLTemplate {\n this.params = {};\n if (this.cache) {\n const cached = this.record.get(this.pathname);\n if (cached) {\n Object.assign(this, cached);\n return this.component;\n }\n }\n switch (this.type) {\n case \"field\":\n this.component = this.fieldComponent();\n break;\n case \"slotted\":\n this.component = this.slottedComponent();\n break;\n case \"united\":\n this.component = this.fieldComponent() ?? this.slottedComponent();\n break;\n }\n return this.component ?? this.default;\n }\n\n useRouter(): { path: string; component: HTMLTemplate | T; params: Record<string, string>; pathname: string } {\n return {\n pathname: this.pathname,\n params: this.params,\n path: this.path,\n component: this.component,\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.pathname = window.location.pathname;\n if (!this.override) {\n return;\n }\n this.addEvent(window, \"popstate\", () => {\n this.pathname = window.location.pathname;\n });\n const self = this;\n const pushHistory = history.pushState;\n\n const { override } = conf;\n if (!override.pushState) {\n override.pushState = pushHistory;\n }\n history.pushState = function () {\n pushHistory.apply(this, arguments);\n self.pathname = window.location.pathname;\n };\n const replaceHistory = history.replaceState;\n history.replaceState = function () {\n replaceHistory.apply(this, arguments);\n self.pathname = window.location.pathname;\n };\n }\n\n /**\n *\n * @param ur value of useRouter()\n * @param first whether this path is loaded for the first time\n */\n routeChangeCallback: (ur: ReturnType<typeof this.useRouter>, first: boolean) => void = null;\n\n protected updated(changedProperties: PropertyValueMap<this>) {\n const shouldDispatch = changedProperties.has(\"pathname\") || changedProperties.has(\"path\");\n if (shouldDispatch) {\n const ur = this.useRouter();\n const noRecord = !this.record.has(this.pathname);\n if (noRecord) {\n this.record.set(this.pathname, ur);\n }\n this.routeChangeCallback?.(ur, noRecord);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: ur }));\n }\n }\n\n fieldComponent(usedRouteTemplate?: string): null | T {\n if (!usedRouteTemplate) {\n usedRouteTemplate = this.useWhichRoute(this.pathname);\n }\n this.path = usedRouteTemplate;\n if (!usedRouteTemplate) {\n return null;\n }\n this.params = this.parseRouterParams(this.path, this.pathname);\n const route = this.routes.find((r) => r.path === usedRouteTemplate);\n if (!route) {\n return null;\n }\n return route.component;\n }\n\n slottedComponent(usedRouteTemplate?: string): null | HTMLTemplate {\n const childNodes = this.slottedChildren;\n if (!childNodes.length) {\n return null;\n }\n const slottedPaths = Array.from(childNodes).map((node) => {\n const slotName = node.getAttribute(\"slot\");\n return {\n path: slotName,\n };\n });\n const tempRouteTree = new RouteTree();\n for (const withPath of slottedPaths) {\n tempRouteTree.insert(withPath.path);\n }\n if (!usedRouteTemplate) {\n usedRouteTemplate = tempRouteTree.useWhich(this.pathname);\n if (!usedRouteTemplate) {\n return null;\n }\n }\n const slotElement = slottedPaths.find((s) => s.path === usedRouteTemplate);\n if (!slotElement) {\n return null;\n }\n this.params = this.parseRouterParams(usedRouteTemplate, this.pathname);\n return htmlSlot(slotElement.path);\n }\n\n useWhichRoute(path: string): string | null {\n return this._routeTree.useWhich(this.baseURL + path);\n }\n\n parseRouterParams(routeTemplate: string, path: string): Record<string, string> {\n return this._routeTree.parseParams(path, routeTemplate);\n }\n\n static updateAll() {\n const routeViewArray = deepQuerySelectorAll<Router>(Router.elementTagName, document.body);\n routeViewArray.forEach((ArrayItem) => {\n if (!ArrayItem.override) {\n ArrayItem.pathname = window.location.pathname;\n }\n });\n }\n}\n\nexport default Router;\n"]}
@@ -1,10 +1,11 @@
1
- import { type CSSResultGroup } from "../../.deps.js";
2
- import { type HTMLTemplate } from "../../lib/templates.js";
3
- import { GodownElement } from "../../supers/root.js";
1
+ import { GodownElement } from "../../proto/godown-element.js";
4
2
  /**
5
3
  * {@linkcode Skeleton} renders a skeleton screen.
6
4
  *
7
5
  * Inspired by Ant-design.
6
+ *
7
+ * @slot loading - The content if loading is true.
8
+ * @slot - The content if loading is false.
8
9
  */
9
10
  export declare class Skeleton extends GodownElement {
10
11
  /**
@@ -19,15 +20,7 @@ export declare class Skeleton extends GodownElement {
19
20
  * If false, hidden.
20
21
  */
21
22
  loading: boolean;
22
- static styles: CSSResultGroup;
23
- protected render(): HTMLTemplate;
24
- private renderIcon;
23
+ protected render(): import("lit").TemplateResult<1>;
25
24
  }
26
25
  export default Skeleton;
27
- declare global {
28
- interface HTMLElementTagNameMap {
29
- "skeleton-screen": Skeleton;
30
- "g-skeleton": Skeleton;
31
- }
32
- }
33
26
  //# sourceMappingURL=skeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/skeleton/skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAyB,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAY,KAAK,YAAY,EAAY,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAA6B,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAKhF;;;;GAIG;AACH,qBACa,QAAS,SAAQ,aAAa;IACzC;;OAEG;IACS,IAAI,EAAE,MAAM,GAAG,OAAO,CAAU;IAC5C;;OAEG;IACS,SAAS,EAAE,UAAU,GAAG,SAAS,CAAc;IAC3D;;OAEG;IACM,OAAO,UAAQ;IAExB,MAAM,CAAC,MAAM,iBA+EO;IAEpB,SAAS,CAAC,MAAM,IAAI,YAAY;IAOhC,OAAO,CAAC,UAAU;CAQnB;AAED,eAAe,QAAQ,CAAC;AAExB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,QAAQ,CAAC;QAC5B,YAAY,EAAE,QAAQ,CAAC;KACxB;CACF"}
1
+ {"version":3,"file":"skeleton.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/skeleton/skeleton.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D;;;;;;;GAOG;AACH,qBAwEa,QAAS,SAAQ,aAAa;IACzC;;OAEG;IACS,IAAI,EAAE,MAAM,GAAG,OAAO,CAAU;IAC5C;;OAEG;IACS,SAAS,EAAE,UAAU,GAAG,SAAS,CAAc;IAC3D;;OAEG;IACM,OAAO,UAAQ;IAExB,SAAS,CAAC,MAAM;CAQjB;AAED,eAAe,QAAQ,CAAC"}