godown 2.7.4 → 2.7.6

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 +20 -25
  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,148 +1,78 @@
1
+ var Form_1;
1
2
  import { __decorate } from "tslib";
2
- import { css, html, property, query } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { htmlSlot } from "../../lib/templates.js";
5
- import { each } from "../../lib/utils.js";
6
- import { GodownElement } from "../../supers/root.js";
3
+ import { css, property } from "../../_deps.js";
4
+ import { godown } from "../../decorators/godown.js";
5
+ import { styles } from "../../decorators/styles.js";
6
+ import { htmlSlot } from "../../lib/directives.js";
7
+ import { GodownElement } from "../../proto/godown-element.js";
8
+ const protoName = "form";
7
9
  /**
8
- * {@linkcode Form} gets all the names and actual values of the child element.
10
+ * {@linkcode Form} Gets child element key-value object,
11
+ * which will be nested if the child element is the same as this element.
12
+ *
13
+ * @slot - Child elements.
9
14
  */
10
- let Form = class Form extends GodownElement {
15
+ let Form = Form_1 = class Form extends GodownElement {
11
16
  constructor() {
12
17
  super(...arguments);
13
18
  this.name = "";
14
- this.value = {};
15
- this.nameValue = () => this.namevalue();
16
- /**
17
- * Form enctype.
18
- */
19
- this.enctype = "multipart/form-data";
19
+ this.nameValue = this.namevalue;
20
+ }
21
+ get value() {
22
+ return Form_1.buildValue(this._slot.assignedElements());
20
23
  }
21
24
  render() {
22
- return html `<form enctype="${this.enctype}">
23
- ${htmlSlot("pre")}
24
- <main>${htmlSlot()}</main>
25
- ${htmlSlot("suf")}
26
- </form>`;
25
+ return htmlSlot();
27
26
  }
28
27
  reset() {
29
- each(this._form, (node) => {
30
- if (node.reset) {
31
- node.reset();
28
+ this.deepQuerySelectorAll("*").forEach((el) => {
29
+ if (el.tagName === this.tagName) {
30
+ return;
32
31
  }
33
- });
34
- const form = document.createElement("form");
35
- for (const slot of this.shadowRoot.querySelectorAll("slot")) {
36
- for (const i of slot.assignedNodes()) {
37
- if (i.reset) {
38
- i.reset();
39
- }
40
- form.appendChild(i.cloneNode(true));
32
+ if (el.reset) {
33
+ el.reset();
41
34
  }
42
- }
43
- form.reset();
44
- for (const slot of this.shadowRoot.querySelectorAll("slot")) {
45
- for (const i of slot.assignedNodes()) {
46
- if (i.name && form[i.name]) {
47
- i.value = form[i.name].value;
48
- }
49
- }
50
- }
51
- form.remove();
35
+ });
36
+ }
37
+ namevalue() {
38
+ return [this.name, this.value];
52
39
  }
53
- namevalue(enctype = this.enctype) {
40
+ static buildValue(elements) {
54
41
  const result = {};
55
- const tempForm = document.createElement("form");
56
- tempForm.enctype = enctype;
57
- for (const slot of this.shadowRoot.querySelectorAll("slot")) {
58
- for (const i of slot.assignedNodes()) {
59
- if (i.namevalue) {
60
- const [name, value] = i.namevalue();
61
- if (name) {
62
- result[name] = value;
63
- }
64
- }
65
- else {
66
- tempForm.appendChild(i.cloneNode(true));
67
- }
42
+ for (const el of elements) {
43
+ if (el.tagName === "FORM") {
44
+ Object.assign(result, Object.fromEntries(new FormData(el).entries()));
68
45
  }
69
- }
70
- const formData = new FormData(tempForm);
71
- for (const [key, value] of formData) {
72
- result[key] = value;
73
- }
74
- each(this._form, (node) => {
75
- if (node.namevalue) {
76
- const [name, value] = node.namevalue();
46
+ else if (el.namevalue) {
47
+ const [name, value] = el.namevalue();
77
48
  if (name) {
78
49
  result[name] = value;
79
50
  }
80
51
  }
81
- });
82
- tempForm.remove();
83
- return [this.name, result];
84
- }
85
- FormData() {
86
- const temp = {};
87
- const tempForm = document.createElement("form");
88
- tempForm.enctype = this.enctype;
89
- for (const slot of this._slots) {
90
- for (const i of slot.assignedNodes()) {
91
- if (i.FormData) {
92
- for (const [key, value] of i.FormData()) {
93
- temp[key] = value;
94
- }
95
- }
96
- else {
97
- tempForm.appendChild(i.cloneNode(true));
98
- }
52
+ else if (el.name && el.value !== undefined) {
53
+ result[el.name] = el.value;
99
54
  }
100
- }
101
- const formData = new FormData(tempForm);
102
- each(this._form, (node) => {
103
- if (node.namevalue) {
104
- const [name, value] = node.namevalue();
105
- if (name) {
106
- formData.append(name, value);
55
+ else if (el.shadowRoot) {
56
+ for (const slot of el.shadowRoot.querySelectorAll("slot")) {
57
+ Object.assign(result, this.buildValue(slot.assignedElements()));
107
58
  }
108
59
  }
109
- });
110
- for (const key in temp) {
111
- formData.append(key, temp[key]);
112
60
  }
113
- tempForm.remove();
114
- return formData;
61
+ return result;
115
62
  }
116
63
  };
117
- Form.styles = [
118
- css `
119
- form {
120
- display: flex;
121
- flex-direction: column;
122
- align-items: center;
123
- margin: 0;
124
- }
125
-
126
- main {
127
- display: flex;
128
- flex-direction: column;
129
- }
130
- `,
131
- ];
132
64
  __decorate([
133
65
  property()
134
66
  ], Form.prototype, "name", void 0);
135
- __decorate([
136
- property({ type: Object })
137
- ], Form.prototype, "value", void 0);
138
- __decorate([
139
- property()
140
- ], Form.prototype, "enctype", void 0);
141
- __decorate([
142
- query("form")
143
- ], Form.prototype, "_form", void 0);
144
- Form = __decorate([
145
- define("form")
67
+ Form = Form_1 = __decorate([
68
+ godown(protoName),
69
+ styles([
70
+ css `
71
+ :host {
72
+ display: block;
73
+ }
74
+ `,
75
+ ])
146
76
  ], Form);
147
77
  export { Form };
148
78
  export default Form;
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/form/form.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAgC,SAAQ,aAAa;IAA3D;;QACO,SAAI,GAAG,EAAE,CAAC;QACM,UAAK,GAAG,EAAO,CAAC;QAE5C,cAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnC;;WAEG;QACS,YAAO,GAA+E,qBAAqB,CAAC;IAoH1H,CAAC;IAhGW,MAAM;QACd,OAAO,IAAI,CAAA,kBAAkB,IAAI,CAAC,OAAO;QACrC,QAAQ,CAAC,KAAK,CAAC;cACT,QAAQ,EAA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AA/GM,WAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;KAYF;CACgB,AAdN,CAcO;AAzBR;IAAX,QAAQ,EAAE;kCAAW;AACM;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mCAAiB;AAMhC;IAAX,QAAQ,EAAE;qCAA6G;AAEzG;IAAd,KAAK,CAAC,MAAM,CAAC;mCAAwB;AAV3B,IAAI;IADhB,MAAM,CAAC,MAAM,CAAC;GACF,IAAI,CA4HhB;;AACD,eAAe,IAAI,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { each } from \"../../lib/utils.js\";\nimport { GodownElement } from \"../../supers/root.js\";\n\n/**\n * {@linkcode Form} gets all the names and actual values of the child element.\n */\n@define(\"form\")\nexport class Form<T extends object = object> extends GodownElement {\n @property() name = \"\";\n @property({ type: Object }) value = {} as T;\n\n nameValue = () => this.namevalue();\n /**\n * Form enctype.\n */\n @property() enctype: \"application/x-www-form-urlencoded\" | \"multipart/form-data\" | \"text/plain\" = \"multipart/form-data\";\n\n @query(\"form\") _form: HTMLFormElement;\n\n static styles = [\n css`\n form {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin: 0;\n }\n\n main {\n display: flex;\n flex-direction: column;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n return html`<form enctype=\"${this.enctype}\">\n ${htmlSlot(\"pre\")}\n <main>${htmlSlot()}</main>\n ${htmlSlot(\"suf\")}\n </form>`;\n }\n\n reset() {\n each(this._form, (node: HTMLFormElement | Form) => {\n if (node.reset) {\n node.reset();\n }\n });\n const form: any = document.createElement(\"form\");\n for (const slot of this.shadowRoot.querySelectorAll(\"slot\")) {\n for (const i of slot.assignedNodes() as any) {\n if (i.reset) {\n i.reset();\n }\n form.appendChild(i.cloneNode(true));\n }\n }\n form.reset();\n for (const slot of this.shadowRoot.querySelectorAll(\"slot\")) {\n for (const i of slot.assignedNodes() as any) {\n if (i.name && form[i.name]) {\n i.value = form[i.name].value;\n }\n }\n }\n form.remove();\n }\n\n namevalue(enctype = this.enctype): [string, Record<string, any>] {\n const result = {};\n const tempForm = document.createElement(\"form\");\n tempForm.enctype = enctype;\n for (const slot of this.shadowRoot.querySelectorAll(\"slot\")) {\n for (const i of slot.assignedNodes() as any) {\n if (i.namevalue) {\n const [name, value] = i.namevalue();\n if (name) {\n result[name] = value;\n }\n } else {\n tempForm.appendChild(i.cloneNode(true));\n }\n }\n }\n const formData = new FormData(tempForm);\n for (const [key, value] of formData) {\n result[key] = value;\n }\n each(this._form, (node: any) => {\n if (node.namevalue) {\n const [name, value] = node.namevalue();\n if (name) {\n result[name] = value;\n }\n }\n });\n tempForm.remove();\n return [this.name, result];\n }\n\n FormData(): FormData {\n const temp = {};\n const tempForm = document.createElement(\"form\");\n tempForm.enctype = this.enctype;\n for (const slot of this._slots) {\n for (const i of slot.assignedNodes() as any) {\n if (i.FormData) {\n for (const [key, value] of i.FormData()) {\n temp[key] = value;\n }\n } else {\n tempForm.appendChild(i.cloneNode(true));\n }\n }\n }\n const formData = new FormData(tempForm);\n each(this._form, (node: any) => {\n if (node.namevalue) {\n const [name, value] = node.namevalue();\n if (name) {\n formData.append(name, value);\n }\n }\n });\n for (const key in temp) {\n formData.append(key, temp[key]);\n }\n tempForm.remove();\n return formData;\n }\n}\nexport default Form;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-form\": Form;\n \"g-form\": Form;\n }\n}\n"]}
1
+ {"version":3,"file":"form.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/form/form.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM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AE,CAAC,SAAS,EAAE,CAAC;gBACxB,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;gBACrC,IAAI,IAAI,EAAE,CAAC;oBACT,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;gBACvB,CAAC;YACH,CAAC;iBAAM,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;YAC7B,CAAC;iBAAM,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;gBACzB,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AApDa;IAAX,QAAQ,EAAE;kCAAW;AADX,IAAI;IARhB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,GAAG,CAAA;;;;GAIF;KACF,CAAC;GACW,IAAI,CAqDhB;;AAED,eAAe,IAAI,CAAC","sourcesContent":["import { css, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\n\nconst protoName = \"form\";\n/**\n * {@linkcode Form} Gets child element key-value object,\n * which will be nested if the child element is the same as this element.\n *\n * @slot - Child elements.\n */\n@godown(protoName)\n@styles([\n css`\n :host {\n display: block;\n }\n `,\n])\nexport class Form<T = object> extends GodownElement {\n @property() name = \"\";\n get value(): T {\n return Form.buildValue(this._slot.assignedElements()) as T;\n }\n\n nameValue = this.namevalue;\n\n protected render() {\n return htmlSlot();\n }\n\n reset() {\n this.deepQuerySelectorAll<HTMLElement & { reset?: () => void }>(\"*\").forEach((el) => {\n if (el.tagName === this.tagName) {\n return;\n }\n if (el.reset) {\n el.reset();\n }\n });\n }\n\n namevalue(): [string, T] {\n return [this.name, this.value];\n }\n\n static buildValue(\n elements: (Element & {\n name?: string;\n value?: unknown;\n namevalue?: () => [string, unknown];\n })[],\n ): Record<string, any> {\n const result = {};\n for (const el of elements) {\n if (el.tagName === \"FORM\") {\n Object.assign(result, Object.fromEntries(new FormData(el as HTMLFormElement).entries()));\n } else if (el.namevalue) {\n const [name, value] = el.namevalue();\n if (name) {\n result[name] = value;\n }\n } else if (el.name && el.value !== undefined) {\n result[el.name] = el.value;\n } else if (el.shadowRoot) {\n for (const slot of el.shadowRoot.querySelectorAll(\"slot\")) {\n Object.assign(result, this.buildValue(slot.assignedElements()));\n }\n }\n }\n return result;\n }\n}\n\nexport default Form;\n"]}
@@ -1,14 +1,13 @@
1
- import { type CSSResultGroup } from "../../.deps.js";
2
- import { type HTMLTemplate } from "../../lib/templates.js";
3
- import { GodownInput } from "../../supers/input.js";
1
+ import GodownInput from "../../proto/super-input.js";
4
2
  /**
5
3
  * {@linkcode Input }.
6
4
  */
7
5
  export declare class Input extends GodownInput {
6
+ variant: "default" | "outline";
8
7
  /**
9
- * Input sccept.
8
+ * Input accept.
10
9
  */
11
- accept: any;
10
+ accept: string;
12
11
  /**
13
12
  * Value.
14
13
  */
@@ -29,22 +28,10 @@ export declare class Input extends GodownInput {
29
28
  * Input step.
30
29
  */
31
30
  step: number;
32
- _input: HTMLInputElement;
33
- _ranged: HTMLElement;
34
- static styles: CSSResultGroup;
35
- protected render(): HTMLTemplate;
31
+ protected render(): import("lit").TemplateResult<1>;
36
32
  connectedCallback(): void;
37
- protected firstUpdated(): void;
38
- protected _handleRange(e: any | Event): void;
39
33
  protected _handleFile(e: any | Event): void;
40
34
  reset(): void;
41
- protected _typeSwitcher(): HTMLTemplate;
42
35
  }
43
36
  export default Input;
44
- declare global {
45
- interface HTMLElementTagNameMap {
46
- "base-input": Input;
47
- "g-input": Input;
48
- }
49
- }
50
37
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAyB,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD;;GAEG;AACH,qBACa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACS,MAAM,MAAa;IAC/B;;OAEG;IACS,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAa;IACxD;;OAEG;IAC0B,IAAI,UAAS;IAC1C;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,GAAG,SAAO;IACtC;;OAEG;IACyB,IAAI,SAAK;IAEpB,MAAM,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IAExC,MAAM,CAAC,MAAM,iBA8GO;IAEpB,SAAS,CAAC,MAAM,IAAI,YAAY;IAahC,iBAAiB;IAejB,SAAS,CAAC,YAAY;IAOtB,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAMrC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAKpC,KAAK;IAeL,SAAS,CAAC,aAAa,IAAI,YAAY;CAYxC;AAED,eAAe,KAAK,CAAC;AAErB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,KAAK,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC;KAClB;CACF"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD;;GAEG;AACH,qBAyCa,KAAM,SAAQ,WAAW;IACxB,OAAO,EAAE,SAAS,GAAG,SAAS,CAAa;IACvD;;OAEG;IACS,MAAM,EAAE,MAAM,CAAa;IACvC;;OAEG;IACS,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAa;IACxD;;OAEG;IAC0B,IAAI,UAAS;IAC1C;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,GAAG,SAAO;IACtC;;OAEG;IACyB,IAAI,SAAK;IAErC,SAAS,CAAC,MAAM;IAkBhB,iBAAiB;IAajB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAKpC,KAAK;CAQN;AAED,eAAe,KAAK,CAAC"}
@@ -1,18 +1,21 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html, property, query } from "../../.deps.js";
3
- import { define } from "../../decorators/define.js";
4
- import { htmlSlot } from "../../lib/templates.js";
5
- import { GodownInput } from "../../supers/input.js";
6
- import { cssvar, cssvarValues } from "../../supers/root.js";
7
- const defineName = "input";
2
+ import { css, html, property } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { styles } from "../../decorators/styles.js";
5
+ import { combine } from "../../lib/directives.js";
6
+ import GodownInput from "../../proto/super-input.js";
7
+ import { cssGlobalVars } from "../../styles/global.js";
8
+ import { fieldStyle, inputStyle } from "../../styles/inputStyle.js";
9
+ const protoName = "input";
8
10
  /**
9
11
  * {@linkcode Input }.
10
12
  */
11
13
  let Input = class Input extends GodownInput {
12
14
  constructor() {
13
15
  super(...arguments);
16
+ this.variant = "default";
14
17
  /**
15
- * Input sccept.
18
+ * Input accept.
16
19
  */
17
20
  this.accept = undefined;
18
21
  /**
@@ -37,16 +40,21 @@ let Input = class Input extends GodownInput {
37
40
  this.step = 1;
38
41
  }
39
42
  render() {
40
- if (this.type === "range") {
41
- return html `<div class="range">
42
- <input id="input" type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._handleRange}" @change="${this._handleRange}" />
43
- <b></b>
44
- <b>
45
- <i></i>
46
- </b>
47
- </div>`;
48
- }
49
- return html `<label for="input"> ${htmlSlot("pre")} ${this._typeSwitcher()} ${htmlSlot("suf")} </label>`;
43
+ return html `<div part="root" class="${combine({ "input-field": true, outline: this.variant === "outline" })}">
44
+ <input
45
+ part="input"
46
+ class="input"
47
+ id=${this.makeId}
48
+ .value="${this.value}"
49
+ ?autofocus="${this.autofocus}"
50
+ type="${this.type}"
51
+ placeholder="${this.placeholder}"
52
+ min="${this.min}"
53
+ max="${this.max}"
54
+ @input="${this._handleInput}"
55
+ />
56
+ ${this._renderSuffix()}
57
+ </div>`;
50
58
  }
51
59
  connectedCallback() {
52
60
  super.connectedCallback();
@@ -54,25 +62,13 @@ let Input = class Input extends GodownInput {
54
62
  this.value = null;
55
63
  }
56
64
  else {
57
- if (!this.def) {
58
- this.def = this.value || "";
65
+ if (!this.default) {
66
+ this.default = this.value || "";
59
67
  }
60
68
  if (!this.value) {
61
- this.value = this.def;
69
+ this.value = this.default;
62
70
  }
63
71
  }
64
- this._initName();
65
- }
66
- firstUpdated() {
67
- super.firstUpdated();
68
- if (this.type === "range") {
69
- this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
70
- }
71
- }
72
- _handleRange(e) {
73
- this.value = e.target.value;
74
- this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + "%";
75
- this.dispatchEvent(new CustomEvent("input", { detail: this.value }));
76
72
  }
77
73
  _handleFile(e) {
78
74
  this.value = !this.only ? e.target.files : e.target.files[0];
@@ -83,138 +79,13 @@ let Input = class Input extends GodownInput {
83
79
  this.value = null;
84
80
  return;
85
81
  }
86
- if (this.type === "range") {
87
- this._input.value = this.def || ((this.max - this.min) / 2).toString();
88
- this.value = this._input.value;
89
- this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
90
- }
91
- else {
92
- this._input.value = this.def.toString();
93
- this.value = this.def;
94
- }
95
- }
96
- _typeSwitcher() {
97
- switch (this.type) {
98
- case "file":
99
- return html `<input id="input" class="input" type="file" accept="${this.accept}" ?multiple="${!this.only}" @change="${this._handleFile}" />${htmlSlot()}`;
100
- case "number":
101
- return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="number" placeholder="${this.pla}" min="${this.min}" max="${this.max}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
102
- default:
103
- return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="${this.type}" placeholder="${this.pla}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
104
- }
82
+ this._input.value = this.default.toString();
83
+ this.value = this.default;
105
84
  }
106
85
  };
107
- Input.styles = [
108
- GodownInput.styles,
109
- css `
110
- :host {
111
- width: var(${cssvarValues.input}--width);
112
- height: var(${cssvarValues.input}--height);
113
- background: var(${cssvarValues.input}--background);
114
- margin: var(${cssvarValues.input}--outline-width);
115
- outline: var(${cssvarValues.input}--outline);
116
- border-radius: var(${cssvarValues.input}--radius);
117
- }
118
-
119
- input[type="file"] {
120
- display: none;
121
- }
122
-
123
- label,
124
- div {
125
- width: 100%;
126
- display: flex;
127
- align-items: center;
128
- }
129
-
130
- * {
131
- border-radius: inherit;
132
- cursor: inherit;
133
- }
134
-
135
- input {
136
- box-sizing: border-box;
137
- height: 100%;
138
- width: 100%;
139
- margin: 0;
140
- color: inherit;
141
- background: transparent;
142
- padding: 0 0.25em;
143
- border-radius: 0.25em;
144
- }
145
- `,
146
- css `
147
- :host([type="range"]) {
148
- height: auto !important;
149
- margin: 0.3em 0;
150
- background: var(${cssvarValues.input}--false);
151
- border-radius: 2em;
152
- }
153
-
154
- .range b:nth-of-type(1) {
155
- width: 1em;
156
- left: 0;
157
- background: var(${cssvarValues.input}--true);
158
- border-top-right-radius: 0;
159
- border-bottom-right-radius: 0;
160
- }
161
-
162
- .range b {
163
- pointer-events: none;
164
- width: calc(100% - 1em);
165
- height: 100%;
166
- left: 1em;
167
- position: absolute;
168
- }
169
-
170
- .range {
171
- height: fit-content;
172
- position: relative;
173
- display: inline-flex;
174
- justify-content: center;
175
- align-items: center;
176
- }
177
-
178
- .range input {
179
- padding: 0;
180
- height: 0.6em;
181
- margin: 0px -0.5em;
182
- appearance: none;
183
- -webkit-appearance: none;
184
- outline: none;
185
- background: transparent;
186
- }
187
-
188
- .range i {
189
- position: absolute;
190
- left: 0;
191
- width: 50%;
192
- height: 100%;
193
- pointer-events: none;
194
- background: var(${cssvarValues.input}--true);
195
- border-top-left-radius: 0;
196
- border-bottom-left-radius: 0;
197
- }
198
-
199
- .range input::-webkit-slider-runnable-track {
200
- height: 0.6em;
201
- }
202
-
203
- .range input::-webkit-slider-thumb {
204
- z-index: 1;
205
- appearance: none;
206
- -webkit-appearance: none;
207
- position: relative;
208
- height: 1.2em;
209
- width: 1.2em;
210
- margin-top: -0.3em;
211
- background: var(${cssvarValues.input}--control);
212
- border-radius: 50%;
213
- border: solid 0.125em var(${cssvarValues.input}--control-edge);
214
- box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);
215
- }
216
- `,
217
- ];
86
+ __decorate([
87
+ property()
88
+ ], Input.prototype, "variant", void 0);
218
89
  __decorate([
219
90
  property()
220
91
  ], Input.prototype, "accept", void 0);
@@ -233,14 +104,48 @@ __decorate([
233
104
  __decorate([
234
105
  property({ type: Number })
235
106
  ], Input.prototype, "step", void 0);
236
- __decorate([
237
- query("#input")
238
- ], Input.prototype, "_input", void 0);
239
- __decorate([
240
- query(".range i")
241
- ], Input.prototype, "_ranged", void 0);
242
107
  Input = __decorate([
243
- define(defineName)
108
+ godown(protoName),
109
+ styles([
110
+ inputStyle,
111
+ fieldStyle,
112
+ css `
113
+ :host {
114
+ width: var(--${cssGlobalVars.input}--width);
115
+ height: var(--${cssGlobalVars.input}--height);
116
+ color: var(--${cssGlobalVars.foreground});
117
+ background: var(--${cssGlobalVars.input}--background);
118
+ margin: var(--${cssGlobalVars.input}--outline-width);
119
+ border-radius: var(--${cssGlobalVars.input}--radius);
120
+ display: block;
121
+ }
122
+
123
+ input[type="file"] {
124
+ display: none;
125
+ }
126
+
127
+ [part="root"] {
128
+ width: 100%;
129
+ display: flex;
130
+ align-items: center;
131
+ }
132
+
133
+ * {
134
+ border-radius: inherit;
135
+ cursor: inherit;
136
+ }
137
+
138
+ input {
139
+ box-sizing: border-box;
140
+ height: 100%;
141
+ width: 100%;
142
+ margin: 0;
143
+ color: inherit;
144
+ background: transparent;
145
+ border-radius: 0.25em;
146
+ }
147
+ `,
148
+ ])
244
149
  ], Input);
245
150
  export { Input };
246
151
  export default Input;
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,UAAU,GAAG,OAAO,CAAC;AAE3B;;GAEG;AAEI,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,WAAW;IAA/B;;QACL;;WAEG;QACS,WAAM,GAAG,SAAS,CAAC;QAC/B;;WAEG;QACS,UAAK,GAA6B,SAAS,CAAC;QACxD;;WAEG;QAC0B,SAAI,GAAG,KAAK,CAAC;QAC1C;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,GAAG,CAAC;Q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;;;;;KA6B1C;IACD,GAAG,CAAA;;;;0BAImB,YAAY,CAAC,KAAK;;;;;;;0BAOlB,YAAY,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAqClB,YAAY,CAAC,KAAK;;;;;;;;;;;;;;;;;0BAiBlB,YAAY,CAAC,KAAK;;oCAER,YAAY,CAAC,KAAK;wCACd,MAAM;;KAEzC;CACgB,AA9GN,CA8GO;AAvIR;IAAX,QAAQ,EAAE;qCAAoB;AAInB;IAAX,QAAQ,EAAE;oCAA6C;AAI3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mCAAc;AAId;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAAS;AAIR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mCAAU;AAEpB;IAAhB,KAAK,CAAC,QAAQ,CAAC;qCAA0B;AACvB;IAAlB,KAAK,CAAC,UAAU,CAAC;sCAAsB;AA3B7B,KAAK;IADjB,MAAM,CAAC,UAAU,CAAC;GACN,KAAK,CAsNjB;;AAED,eAAe,KAAK,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { GodownInput } from \"../../supers/input.js\";\nimport { cssvar, cssvarValues } from \"../../supers/root.js\";\n\nconst defineName = \"input\";\n\n/**\n * {@linkcode Input }.\n */\n@define(defineName)\nexport class Input extends GodownInput {\n /**\n * Input sccept.\n */\n @property() accept = undefined;\n /**\n * Value.\n */\n @property() value: string | File | FileList = undefined;\n /**\n * Only single files are allowed to be selected.\n */\n @property({ type: Boolean }) only = false;\n /**\n * Input min.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input max.\n */\n @property({ type: Number }) max = 100;\n /**\n * Input step.\n */\n @property({ type: Number }) step = 1;\n\n @query(\"#input\") _input: HTMLInputElement;\n @query(\".range i\") _ranged: HTMLElement;\n\n static styles = [\n GodownInput.styles,\n css`\n :host {\n width: var(${cssvarValues.input}--width);\n height: var(${cssvarValues.input}--height);\n background: var(${cssvarValues.input}--background);\n margin: var(${cssvarValues.input}--outline-width);\n outline: var(${cssvarValues.input}--outline);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n input[type=\"file\"] {\n display: none;\n }\n\n label,\n div {\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n * {\n border-radius: inherit;\n cursor: inherit;\n }\n\n input {\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n margin: 0;\n color: inherit;\n background: transparent;\n padding: 0 0.25em;\n border-radius: 0.25em;\n }\n `,\n css`\n :host([type=\"range\"]) {\n height: auto !important;\n margin: 0.3em 0;\n background: var(${cssvarValues.input}--false);\n border-radius: 2em;\n }\n\n .range b:nth-of-type(1) {\n width: 1em;\n left: 0;\n background: var(${cssvarValues.input}--true);\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .range b {\n pointer-events: none;\n width: calc(100% - 1em);\n height: 100%;\n left: 1em;\n position: absolute;\n }\n\n .range {\n height: fit-content;\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n\n .range input {\n padding: 0;\n height: 0.6em;\n margin: 0px -0.5em;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n }\n\n .range i {\n position: absolute;\n left: 0;\n width: 50%;\n height: 100%;\n pointer-events: none;\n background: var(${cssvarValues.input}--true);\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n .range input::-webkit-slider-runnable-track {\n height: 0.6em;\n }\n\n .range input::-webkit-slider-thumb {\n z-index: 1;\n appearance: none;\n -webkit-appearance: none;\n position: relative;\n height: 1.2em;\n width: 1.2em;\n margin-top: -0.3em;\n background: var(${cssvarValues.input}--control);\n border-radius: 50%;\n border: solid 0.125em var(${cssvarValues.input}--control-edge);\n box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n if (this.type === \"range\") {\n return html`<div class=\"range\">\n <input id=\"input\" type=\"range\" min=\"${this.min}\" max=\"${this.max}\" step=\"${this.step}\" @input=\"${this._handleRange}\" @change=\"${this._handleRange}\" />\n <b></b>\n <b>\n <i></i>\n </b>\n </div>`;\n }\n return html`<label for=\"input\"> ${htmlSlot(\"pre\")} ${this._typeSwitcher()} ${htmlSlot(\"suf\")} </label>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.type === \"file\") {\n this.value = null;\n } else {\n if (!this.def) {\n this.def = (this.value as string) || \"\";\n }\n if (!this.value) {\n this.value = this.def;\n }\n }\n this._initName();\n }\n\n protected firstUpdated() {\n super.firstUpdated();\n if (this.type === \"range\") {\n this._ranged.style.width = 100 * (parseInt(this.value as string) / (this.max - this.min)) + \"%\";\n }\n }\n\n protected _handleRange(e: any | Event) {\n this.value = e.target.value;\n this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + \"%\";\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value }));\n }\n\n protected _handleFile(e: any | Event) {\n this.value = !this.only ? e.target.files : e.target.files[0];\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n\n reset() {\n if (this.type === \"file\") {\n this.value = null;\n return;\n }\n if (this.type === \"range\") {\n this._input.value = this.def || ((this.max - this.min) / 2).toString();\n this.value = this._input.value;\n this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + \"%\";\n } else {\n this._input.value = this.def.toString();\n this.value = this.def;\n }\n }\n\n protected _typeSwitcher(): HTMLTemplate {\n switch (this.type) {\n case \"file\":\n return html`<input id=\"input\" class=\"input\" type=\"file\" accept=\"${this.accept}\" ?multiple=\"${!this.only}\" @change=\"${this._handleFile}\" />${htmlSlot()}`;\n\n case \"number\":\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"number\" placeholder=\"${this.pla}\" min=\"${this.min}\" max=\"${this.max}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n\n default:\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"${this.type}\" placeholder=\"${this.pla}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n }\n }\n}\n\nexport default Input;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-input\": Input;\n \"g-input\": Input;\n }\n}\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.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,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B;;GAEG;AA0CI,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,WAAW;IAA/B;;QACO,YAAO,GAA0B,SAAS,CAAC;QACvD;;WAEG;QACS,WAAM,GAAW,SAAS,CAAC;QACvC;;WAEG;QACS,UAAK,GAA6B,SAAS,CAAC;QACxD;;WAEG;QAC0B,SAAI,GAAG,KAAK,CAAC;QAC1C;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,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C;IAED,KAAK;QACH,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC;IAC5B,CAAC;CACF,CAAA;AAtEa;IAAX,QAAQ,EAAE;sCAA4C;AAI3C;IAAX,QAAQ,EAAE;qCAA4B;AAI3B;IAAX,QAAQ,EAAE;oCAA6C;AAI3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mCAAc;AAId;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAAS;AAIR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mCAAU;AAzB1B,KAAK;IAzCjB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,UAAU;QACV,UAAU;QACV,GAAG,CAAA;;qBAEgB,aAAa,CAAC,KAAK;sBAClB,aAAa,CAAC,KAAK;qBACpB,aAAa,CAAC,UAAU;0BACnB,aAAa,CAAC,KAAK;sBACvB,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4B7C;KACF,CAAC;GACW,KAAK,CAuEjB;;AAED,eAAe,KAAK,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { combine } from \"../../lib/directives.js\";\nimport GodownInput from \"../../proto/super-input.js\";\nimport { cssGlobalVars } from \"../../styles/global.js\";\nimport { fieldStyle, inputStyle } from \"../../styles/inputStyle.js\";\n\nconst protoName = \"input\";\n\n/**\n * {@linkcode Input }.\n */\n@godown(protoName)\n@styles([\n inputStyle,\n fieldStyle,\n css`\n :host {\n width: var(--${cssGlobalVars.input}--width);\n height: var(--${cssGlobalVars.input}--height);\n color: var(--${cssGlobalVars.foreground});\n background: var(--${cssGlobalVars.input}--background);\n margin: var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n display: block;\n }\n\n input[type=\"file\"] {\n display: none;\n }\n\n [part=\"root\"] {\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n * {\n border-radius: inherit;\n cursor: inherit;\n }\n\n input {\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n margin: 0;\n color: inherit;\n background: transparent;\n border-radius: 0.25em;\n }\n `,\n])\nexport class Input extends GodownInput {\n @property() variant: \"default\" | \"outline\" = \"default\";\n /**\n * Input accept.\n */\n @property() accept: string = undefined;\n /**\n * Value.\n */\n @property() value: string | File | FileList = undefined;\n /**\n * Only single files are allowed to be selected.\n */\n @property({ type: Boolean }) only = false;\n /**\n * Input min.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input max.\n */\n @property({ type: Number }) max = 100;\n /**\n * Input step.\n */\n @property({ type: Number }) step = 1;\n\n protected render() {\n return html`<div part=\"root\" class=\"${combine({ \"input-field\": true, outline: this.variant === \"outline\" })}\">\n <input\n part=\"input\"\n class=\"input\"\n id=${this.makeId}\n .value=\"${this.value as string}\"\n ?autofocus=\"${this.autofocus}\"\n type=\"${this.type}\"\n placeholder=\"${this.placeholder}\"\n min=\"${this.min}\"\n max=\"${this.max}\"\n @input=\"${this._handleInput}\"\n />\n ${this._renderSuffix()}\n </div>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.type === \"file\") {\n this.value = null;\n } else {\n if (!this.default) {\n this.default = (this.value as string) || \"\";\n }\n if (!this.value) {\n this.value = this.default;\n }\n }\n }\n protected _handleFile(e: any | Event) {\n this.value = !this.only ? e.target.files : e.target.files[0];\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n\n reset() {\n if (this.type === \"file\") {\n this.value = null;\n return;\n }\n this._input.value = this.default.toString();\n this.value = this.default;\n }\n}\n\nexport default Input;\n"]}
@@ -1,29 +1,15 @@
1
- import { type CSSResultGroup } from "../../.deps.js";
2
- import { type HTMLTemplate } from "../../lib/templates.js";
3
- import { GodownInput } from "../../supers/input.js";
1
+ import GodownInput from "../../proto/super-input.js";
4
2
  /**
5
3
  * {@linkcode LabelInput } renders label and input.
6
4
  *
7
5
  * When there is a label, the layout will be adjusted according to the width of the screen.
8
6
  *
9
- * Otherwise it behaves similarly to the `BaseInput`.
7
+ * Otherwise it behaves similarly to the `Input`.
8
+ *
10
9
  */
11
10
  export declare class LabelInput extends GodownInput {
12
- /**
13
- * Conditions for adjust layout.
14
- */
15
- mobile: string;
16
- _input: HTMLInputElement;
17
- static styles: CSSResultGroup;
18
- protected render(): HTMLTemplate[];
19
- private renderSuf;
20
- protected _passwordSwitcher(): void;
11
+ variant: "default" | "outline";
12
+ protected render(): import("lit").TemplateResult<1>;
21
13
  }
22
14
  export default LabelInput;
23
- declare global {
24
- interface HTMLElementTagNameMap {
25
- "label-input": LabelInput;
26
- "g-label-input": LabelInput;
27
- }
28
- }
29
15
  //# sourceMappingURL=label-input.d.ts.map