godown 2.7.5 → 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 +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 +1 @@
1
- {"version":3,"file":"label-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAyB,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAuB,KAAK,YAAY,EAAU,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAgCpD;;;;;;GAMG;AACH,qBACa,UAAW,SAAQ,WAAW;IACzC;;OAEG;IACS,MAAM,SAAW;IAEb,MAAM,EAAE,gBAAgB,CAAC;IAEzC,MAAM,CAAC,MAAM,iBA4DO;IAEpB,SAAS,CAAC,MAAM,IAAI,YAAY,EAAE;IAmBlC,OAAO,CAAC,SAAS;IAkBjB,SAAS,CAAC,iBAAiB;CAO5B;AAED,eAAe,UAAU,CAAC;AAE1B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;QAC1B,eAAe,EAAE,UAAU,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"label-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD;;;;;;;GAOG;AACH,qBA+Ca,UAAW,SAAQ,WAAW;IAC7B,OAAO,EAAE,SAAS,GAAG,SAAS,CAAa;IAEvD,SAAS,CAAC,MAAM;CAkBjB;AAED,eAAe,UAAU,CAAC"}
@@ -1,162 +1,95 @@
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, htmlStyle, svgEye } from "../../lib/templates.js";
5
- import { GodownInput } from "../../supers/input.js";
6
- import { cssvarValues } from "../../supers/root.js";
7
- const PASSWORD = "password";
8
- const styleInMedia = css `
9
- label[for] {
10
- justify-content: flex-start;
11
- flex-direction: column;
12
- align-items: inherit;
13
- width: fit-content;
14
- }
15
- :host {
16
- width: var(${cssvarValues.input}--width);
17
- margin: auto;
18
- }
19
- `;
20
- const styleNoLabel = css `
21
- :host {
22
- width: var(${cssvarValues.input}--width);
23
- }
24
- `;
25
- const styleWithLabel = css `
26
- :host {
27
- width: calc(var(${cssvarValues.input}--width) * 2);
28
- }
29
- `;
30
- const defineName = "label-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, htmlSlot } 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 = "label-input";
31
10
  /**
32
11
  * {@linkcode LabelInput } renders label and input.
33
12
  *
34
13
  * When there is a label, the layout will be adjusted according to the width of the screen.
35
14
  *
36
- * Otherwise it behaves similarly to the `BaseInput`.
15
+ * Otherwise it behaves similarly to the `Input`.
16
+ *
37
17
  */
38
18
  let LabelInput = class LabelInput extends GodownInput {
39
19
  constructor() {
40
20
  super(...arguments);
41
- /**
42
- * Conditions for adjust layout.
43
- */
44
- this.mobile = "540px";
21
+ this.variant = "default";
45
22
  }
46
23
  render() {
47
- const result = html `<fieldset>
48
- <i>${htmlSlot("pre")}</i>
49
- <input .value="${this.value}" ?autofocus="${this.autofocus}" id="${this.name}" type="${this.type}" placeholder="${this.pla}" class="${this.type}" @input="${this._handleInput}" @change="${this._handleChange}" />
50
- ${this.renderSuf()}
51
- </fieldset>`;
52
- if (this.label) {
53
- const style = this.mobile && `${styleWithLabel}@media (max-width: ${this.mobile}){${styleInMedia}}`;
54
- return [
55
- html `<label for="${this.name}">
56
- <span>${this.label}${htmlSlot()}</span>
57
- ${result}
58
- </label>`,
59
- htmlStyle(style),
60
- ];
61
- }
62
- return [result, htmlStyle(styleNoLabel.toString())];
63
- }
64
- renderSuf() {
65
- if (this.type === PASSWORD) {
66
- return html `<i
67
- @mousedown="${this._passwordSwitcher}"
68
- @mouseup="${() => {
69
- this._changeInputType(PASSWORD);
70
- }}"
71
- @mouseleave="${() => {
72
- this._changeInputType(PASSWORD);
73
- }}"
74
- >
75
- ${htmlSlot("suf", svgEye(), this)}
76
- </i>`;
77
- }
78
- else {
79
- return html `<i>${htmlSlot("suf")}</i>`;
80
- }
81
- }
82
- _passwordSwitcher() {
83
- if (this._input.type === PASSWORD) {
84
- this._changeInputType("text");
85
- }
86
- else {
87
- this._changeInputType(PASSWORD);
88
- }
24
+ const { makeId: htmlFor } = this;
25
+ return html `<label for="${htmlFor}" part="label">
26
+ <span part="label">${this.label}${htmlSlot()}</span>
27
+ <div class="${combine({ "input-field": true, outline: this.variant === "outline" })}">
28
+ <input
29
+ part="input"
30
+ id="${htmlFor}"
31
+ type="${this.type}"
32
+ ?autofocus="${this.autofocus}"
33
+ placeholder="${this.placeholder}"
34
+ class="${this.type}"
35
+ @input="${this._handleInput}"
36
+ />
37
+ ${this._renderSuffix()}
38
+ </div>
39
+ </label>`;
89
40
  }
90
41
  };
91
- LabelInput.styles = [
92
- GodownInput.styles,
93
- css `
94
- :host {
95
- margin: var(${cssvarValues.input}--outline-width);
96
- border-radius: var(${cssvarValues.input}--radius);
97
- }
98
-
99
- label {
100
- width: 100%;
101
- margin: auto;
102
- box-sizing: border-box;
103
- height: fit-content;
104
- display: flex;
105
- justify-content: space-between;
106
- align-items: center;
107
- border-radius: inherit;
108
- }
109
-
110
- span {
111
- white-space: nowrap;
112
- }
113
-
114
- input {
115
- padding: 0 0.25em;
116
- background-color: transparent;
117
- border-radius: inherit;
118
- flex: 1;
119
- width: 100%;
120
- height: inherit;
121
- }
42
+ __decorate([
43
+ property()
44
+ ], LabelInput.prototype, "variant", void 0);
45
+ LabelInput = __decorate([
46
+ godown(protoName),
47
+ styles([
48
+ inputStyle,
49
+ fieldStyle,
50
+ css `
51
+ :host {
52
+ --${cssGlobalVars.input}--label-width: var(--${cssGlobalVars.input}--width);
53
+ width: calc(var(--${cssGlobalVars.input}--width) + var(--${cssGlobalVars.input}--label-width));
54
+ height: var(--${cssGlobalVars.input}--height);
55
+ margin: var(--${cssGlobalVars.input}--outline-width);
56
+ border-radius: var(--${cssGlobalVars.input}--radius);
57
+ margin: var(--${cssGlobalVars.input}--outline-width);
58
+ border-radius: var(--${cssGlobalVars.input}--radius);
59
+ justify-content: space-between;
60
+ display: flex;
61
+ }
122
62
 
123
- fieldset:focus-within {
124
- outline: var(${cssvarValues.input}--outline);
125
- }
63
+ div {
64
+ height: inherit;
65
+ width: var(--${cssGlobalVars.input}--width);
66
+ }
126
67
 
127
- i {
128
- margin: auto;
129
- display: flex;
130
- align-items: center;
131
- justify-content: center;
132
- }
68
+ label {
69
+ display: contents;
70
+ border-radius: inherit;
71
+ height: inherit;
72
+ }
133
73
 
134
- i > svg {
135
- height: 1em;
136
- width: 1em;
137
- margin: 0.25em;
138
- }
74
+ span {
75
+ flex: 1;
76
+ white-space: nowrap;
77
+ width: var(--${cssGlobalVars.input}--width);
78
+ }
139
79
 
140
- fieldset {
141
- position: relative;
142
- background-color: var(${cssvarValues.input}--background);
143
- display: flex;
144
- align-items: center;
145
- border-radius: inherit;
146
- height: var(${cssvarValues.input}--height);
147
- width: var(${cssvarValues.input}--width);
148
- min-width: var(${cssvarValues.input}--width);
149
- }
150
- `,
151
- ];
152
- __decorate([
153
- property()
154
- ], LabelInput.prototype, "mobile", void 0);
155
- __decorate([
156
- query("input")
157
- ], LabelInput.prototype, "_input", void 0);
158
- LabelInput = __decorate([
159
- define(defineName)
80
+ input {
81
+ flex: 1;
82
+ width: 100%;
83
+ height: inherit;
84
+ background: transparent;
85
+ border-radius: inherit;
86
+ color: var(--${cssGlobalVars.foreground});
87
+ }
88
+ .input-field {
89
+ background: var(--${cssGlobalVars.input}--background);
90
+ }
91
+ `,
92
+ ])
160
93
  ], LabelInput);
161
94
  export { LabelInput };
162
95
  export default LabelInput;
@@ -1 +1 @@
1
- {"version":3,"file":"label-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MA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hER;IAAX,QAAQ,EAAE;0CAAkB;AAEb;IAAf,KAAK,CAAC,OAAO,CAAC;0CAA0B;AAN9B,UAAU;IADtB,MAAM,CAAC,UAAU,CAAC;GACN,UAAU,CAkHtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, htmlStyle, type HTMLTemplate, svgEye } from \"../../lib/templates.js\";\nimport { GodownInput } from \"../../supers/input.js\";\nimport { cssvarValues } from \"../../supers/root.js\";\n\nconst PASSWORD = \"password\";\n\nconst styleInMedia = css`\n label[for] {\n justify-content: flex-start;\n flex-direction: column;\n align-items: inherit;\n width: fit-content;\n }\n :host {\n width: var(${cssvarValues.input}--width);\n margin: auto;\n }\n`;\n\nconst styleNoLabel = css`\n :host {\n width: var(${cssvarValues.input}--width);\n }\n`;\n\nconst styleWithLabel = css`\n :host {\n width: calc(var(${cssvarValues.input}--width) * 2);\n }\n`;\n\nconst defineName = \"label-input\";\n\n/**\n * {@linkcode LabelInput } renders label and input.\n *\n * When there is a label, the layout will be adjusted according to the width of the screen.\n *\n * Otherwise it behaves similarly to the `BaseInput`.\n */\n@define(defineName)\nexport class LabelInput extends GodownInput {\n /**\n * Conditions for adjust layout.\n */\n @property() mobile = \"540px\";\n\n @query(\"input\") _input: HTMLInputElement;\n\n static styles = [\n GodownInput.styles,\n css`\n :host {\n margin: var(${cssvarValues.input}--outline-width);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n label {\n width: 100%;\n margin: auto;\n box-sizing: border-box;\n height: fit-content;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-radius: inherit;\n }\n\n span {\n white-space: nowrap;\n }\n\n input {\n padding: 0 0.25em;\n background-color: transparent;\n border-radius: inherit;\n flex: 1;\n width: 100%;\n height: inherit;\n }\n\n fieldset:focus-within {\n outline: var(${cssvarValues.input}--outline);\n }\n\n i {\n margin: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n i > svg {\n height: 1em;\n width: 1em;\n margin: 0.25em;\n }\n\n fieldset {\n position: relative;\n background-color: var(${cssvarValues.input}--background);\n display: flex;\n align-items: center;\n border-radius: inherit;\n height: var(${cssvarValues.input}--height);\n width: var(${cssvarValues.input}--width);\n min-width: var(${cssvarValues.input}--width);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate[] {\n const result = html`<fieldset>\n <i>${htmlSlot(\"pre\")}</i>\n <input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"${this.name}\" type=\"${this.type}\" placeholder=\"${this.pla}\" class=\"${this.type}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />\n ${this.renderSuf()}\n </fieldset>`;\n if (this.label) {\n const style = this.mobile && `${styleWithLabel}@media (max-width: ${this.mobile}){${styleInMedia}}`;\n return [\n html`<label for=\"${this.name}\">\n <span>${this.label}${htmlSlot()}</span>\n ${result}\n </label>`,\n htmlStyle(style),\n ];\n }\n return [result, htmlStyle(styleNoLabel.toString())];\n }\n\n private renderSuf(): HTMLTemplate {\n if (this.type === PASSWORD) {\n return html`<i\n @mousedown=\"${this._passwordSwitcher}\"\n @mouseup=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n @mouseleave=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n >\n ${htmlSlot(\"suf\", svgEye(), this)}\n </i>`;\n } else {\n return html`<i>${htmlSlot(\"suf\")}</i>`;\n }\n }\n\n protected _passwordSwitcher() {\n if (this._input.type === PASSWORD) {\n this._changeInputType(\"text\");\n } else {\n this._changeInputType(PASSWORD);\n }\n }\n}\n\nexport default LabelInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"label-input\": LabelInput;\n \"g-label-input\": LabelInput;\n }\n}\n"]}
1
+ {"version":3,"file":"label-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GA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,KAAK;sBAC9D,aAAa,CAAC,KAAK;sBACnB,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;sBAC1B,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;;;;;;;qBAO3B,aAAa,CAAC,KAAK;;;;;;;;;;;;qBAYnB,aAAa,CAAC,KAAK;;;;;;;;;qBASnB,aAAa,CAAC,UAAU;;;0BAGnB,aAAa,CAAC,KAAK;;GAE1C;KACF,CAAC;GACW,UAAU,CAqBtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { combine, htmlSlot } 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 = \"label-input\";\n\n/**\n * {@linkcode LabelInput } renders label and input.\n *\n * When there is a label, the layout will be adjusted according to the width of the screen.\n *\n * Otherwise it behaves similarly to the `Input`.\n *\n */\n@godown(protoName)\n@styles([\n inputStyle,\n fieldStyle,\n css`\n :host {\n --${cssGlobalVars.input}--label-width: var(--${cssGlobalVars.input}--width);\n width: calc(var(--${cssGlobalVars.input}--width) + var(--${cssGlobalVars.input}--label-width));\n height: var(--${cssGlobalVars.input}--height);\n margin: var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n margin: var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n justify-content: space-between;\n display: flex;\n }\n\n div {\n height: inherit;\n width: var(--${cssGlobalVars.input}--width);\n }\n\n label {\n display: contents;\n border-radius: inherit;\n height: inherit;\n }\n\n span {\n flex: 1;\n white-space: nowrap;\n width: var(--${cssGlobalVars.input}--width);\n }\n\n input {\n flex: 1;\n width: 100%;\n height: inherit;\n background: transparent;\n border-radius: inherit;\n color: var(--${cssGlobalVars.foreground});\n }\n .input-field {\n background: var(--${cssGlobalVars.input}--background);\n }\n `,\n])\nexport class LabelInput extends GodownInput {\n @property() variant: \"default\" | \"outline\" = \"default\";\n\n protected render() {\n const { makeId: htmlFor } = this;\n return html`<label for=\"${htmlFor}\" part=\"label\">\n <span part=\"label\">${this.label}${htmlSlot()}</span>\n <div class=\"${combine({ \"input-field\": true, outline: this.variant === \"outline\" })}\">\n <input\n part=\"input\"\n id=\"${htmlFor}\"\n type=\"${this.type}\"\n ?autofocus=\"${this.autofocus}\"\n placeholder=\"${this.placeholder}\"\n class=\"${this.type}\"\n @input=\"${this._handleInput}\"\n />\n ${this._renderSuffix()}\n </div>\n </label>`;\n }\n}\n\nexport default LabelInput;\n"]}
@@ -0,0 +1,53 @@
1
+ import GodownInput from "../../proto/super-input.js";
2
+ /**
3
+ * {@linkcode RangeInput }.
4
+ */
5
+ export declare class RangeInput extends GodownInput {
6
+ /**
7
+ * Minimum value.
8
+ */
9
+ min: number;
10
+ /**
11
+ * Maximum value.
12
+ */
13
+ max: number;
14
+ /**
15
+ * Sliding step length.
16
+ */
17
+ step: number;
18
+ /**
19
+ * Enable range sliding.
20
+ */
21
+ range: boolean;
22
+ vertical: boolean;
23
+ /**
24
+ * When `this.range` is true, it should be [number, number], otherwise number.
25
+ */
26
+ value: number | [number, number];
27
+ /**
28
+ * The default of `this.value`.
29
+ */
30
+ default: number | [number, number];
31
+ _root: HTMLElement;
32
+ lastFocus: undefined | 1 | 2;
33
+ /**
34
+ * Returns true when the second number is greater than the first number
35
+ */
36
+ get reverse(): boolean;
37
+ render(): import("lit").TemplateResult<1>;
38
+ _handleMousedownStart(e: MouseEvent): void;
39
+ _handleMousedownEnd(e: MouseEvent): void;
40
+ setStart(value: number): void;
41
+ setEnd(value: number): void;
42
+ _computeValue(e: MouseEvent): number;
43
+ _handleMousedownRoot(e: MouseEvent): void;
44
+ createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void;
45
+ createMousemoveListener(callback: (arg0: number) => void): (e: MouseEvent) => void;
46
+ _connectedInit(): void;
47
+ reset(): void;
48
+ swap(): void;
49
+ sort(): void;
50
+ toSorted(): number | [number, number];
51
+ }
52
+ export default RangeInput;
53
+ //# sourceMappingURL=range-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"range-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/range-input.ts"],"names":[],"mappings":"AAMA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAOrD;;GAEG;AACH,qBAoHa,UAAW,SAAQ,WAAW;IACzC;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,GAAG,SAAO;IACtC;;OAEG;IACyB,IAAI,SAAK;IACrC;;OAEG;IACyC,KAAK,EAAE,OAAO,CAAC;IAEf,QAAQ,EAAE,OAAO,CAAC;IAE9D;;OAEG;IACwB,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5D;;OAEG;IACwB,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhD,KAAK,EAAE,WAAW,CAAC;IAEjC,SAAS,EAAE,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;IAE7B;;OAEG;IACH,IAAI,OAAO,YAEV;IAED,MAAM;IA6CN,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAGnC,mBAAmB,CAAC,CAAC,EAAE,UAAU;IAIjC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAMtB,MAAM,CAAC,KAAK,EAAE,MAAM;IAMpB,aAAa,CAAC,CAAC,EAAE,UAAU;IAY3B,oBAAoB,CAAC,CAAC,EAAE,UAAU;IAWlC,uBAAuB,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,OACpD,UAAU;IAavB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,OAC3C,UAAU;IASvB,cAAc;IAcd,KAAK;IAIL,IAAI;IAOJ,IAAI;IAIJ,QAAQ,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAOtC;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,316 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, property } from "../../_deps.js";
3
+ import { godown } from "../../decorators/godown.js";
4
+ import { part } from "../../decorators/part.js";
5
+ import { styles } from "../../decorators/styles.js";
6
+ import { combine, htmlSlot } from "../../lib/directives.js";
7
+ import { isNil, joinProperties, notNil } from "../../lib/utils.js";
8
+ import GodownInput from "../../proto/super-input.js";
9
+ import { createScope, cssGlobalVars } from "../../styles/global.js";
10
+ import { inputStyle } from "../../styles/inputStyle.js";
11
+ const protoName = "range-input";
12
+ const cssScope = createScope(protoName);
13
+ /**
14
+ * {@linkcode RangeInput }.
15
+ */
16
+ let RangeInput = class RangeInput extends GodownInput {
17
+ constructor() {
18
+ super(...arguments);
19
+ /**
20
+ * Minimum value.
21
+ */
22
+ this.min = 0;
23
+ /**
24
+ * Maximum value.
25
+ */
26
+ this.max = 100;
27
+ /**
28
+ * Sliding step length.
29
+ */
30
+ this.step = 1;
31
+ }
32
+ /**
33
+ * Returns true when the second number is greater than the first number
34
+ */
35
+ get reverse() {
36
+ return this.range ? this.value[0] > this.value[1] : false;
37
+ }
38
+ render() {
39
+ const [from, to] = (this.range ? this.value : [0, this.value]);
40
+ const gap = this.max - this.min;
41
+ const style = joinProperties({
42
+ "--start": `${((from - this.min) / gap) * 100}%`,
43
+ "--end": `${((to - this.min) / gap) * 100}%`,
44
+ });
45
+ return html `<div
46
+ part="root"
47
+ class="${combine({
48
+ vertical: this.vertical,
49
+ range: this.range,
50
+ reverse: this.reverse,
51
+ })}"
52
+ @mousedown="${this._handleMousedownRoot}"
53
+ style="${style}"
54
+ >
55
+ <div part="track"></div>
56
+ <i
57
+ part="handle"
58
+ class="${combine({
59
+ "last-focus": this.lastFocus === 1,
60
+ }, "start")}"
61
+ @mousedown="${this._handleMousedownStart}"
62
+ >
63
+ ${htmlSlot("start")}
64
+ </i>
65
+ <i
66
+ part="handle"
67
+ class="${combine({
68
+ "last-focus": this.lastFocus === 2,
69
+ }, "end")}"
70
+ @mousedown="${this._handleMousedownEnd}"
71
+ >
72
+ ${htmlSlot("end")}
73
+ </i>
74
+ </div>`;
75
+ }
76
+ _handleMousedownStart(e) {
77
+ this.createMousedownListener(this.setStart)(e);
78
+ }
79
+ _handleMousedownEnd(e) {
80
+ this.createMousedownListener(this.setEnd)(e);
81
+ }
82
+ setStart(value) {
83
+ this.lastFocus = 1;
84
+ const i = this.value[1];
85
+ this.value = this.range ? [value, i] : value;
86
+ }
87
+ setEnd(value) {
88
+ this.lastFocus = 2;
89
+ const i = this.value[0];
90
+ this.value = this.range ? [i, value] : value;
91
+ }
92
+ _computeValue(e) {
93
+ const rect = this._root.getBoundingClientRect();
94
+ const div = this.vertical ? (e.clientY - rect.top) / rect.height : (e.clientX - rect.left) / rect.width;
95
+ let value = Math.round((div * (this.max - this.min)) / this.step) * this.step;
96
+ if (value > this.max) {
97
+ value -= this.step;
98
+ }
99
+ else if (value < this.min) {
100
+ value += this.step;
101
+ }
102
+ return value;
103
+ }
104
+ _handleMousedownRoot(e) {
105
+ const value = this._computeValue(e);
106
+ if (!this.range || Math.abs(value - this.value[0]) > Math.abs(value - this.value[1])) {
107
+ this.setEnd(value);
108
+ this._handleMousedownEnd(e);
109
+ }
110
+ else {
111
+ this.setStart(value);
112
+ this._handleMousedownStart(e);
113
+ }
114
+ }
115
+ createMousedownListener(mouseMoveCallback) {
116
+ return (e) => {
117
+ e.preventDefault();
118
+ e.stopPropagation();
119
+ const move = this.createMousemoveListener(mouseMoveCallback);
120
+ document.addEventListener("mousemove", move);
121
+ const stop = () => {
122
+ document.removeEventListener("mousemove", move);
123
+ document.removeEventListener("mouseup", stop);
124
+ };
125
+ document.addEventListener("mouseup", stop);
126
+ };
127
+ }
128
+ createMousemoveListener(callback) {
129
+ return (e) => {
130
+ const value = this._computeValue(e);
131
+ if (value > this.max || value < this.min) {
132
+ return;
133
+ }
134
+ callback?.call(this, value);
135
+ };
136
+ }
137
+ _connectedInit() {
138
+ const gap = this.max - this.min;
139
+ this.step ||= gap / 100;
140
+ if (notNil(this.default) && isNil(this.value)) {
141
+ this.value = this.default;
142
+ }
143
+ else if (isNil(this.default) && notNil(this.value)) {
144
+ this.default = this.value;
145
+ }
146
+ else {
147
+ const mid = Math.round(gap / 2 / this.step) * this.step;
148
+ this.default = this.range ? [0, mid] : mid;
149
+ this.value = this.default;
150
+ }
151
+ }
152
+ reset() {
153
+ this.value = this.default;
154
+ }
155
+ swap() {
156
+ if (this.range) {
157
+ const [a, b] = this.value;
158
+ this.value = [b, a];
159
+ }
160
+ }
161
+ sort() {
162
+ this.value = this.toSorted();
163
+ }
164
+ toSorted() {
165
+ if (this.range) {
166
+ const [a, b] = this.value;
167
+ return a > b ? [b, a] : [a, b];
168
+ }
169
+ return this.value;
170
+ }
171
+ };
172
+ __decorate([
173
+ property({ type: Number })
174
+ ], RangeInput.prototype, "min", void 0);
175
+ __decorate([
176
+ property({ type: Number })
177
+ ], RangeInput.prototype, "max", void 0);
178
+ __decorate([
179
+ property({ type: Number })
180
+ ], RangeInput.prototype, "step", void 0);
181
+ __decorate([
182
+ property({ type: Boolean, reflect: true })
183
+ ], RangeInput.prototype, "range", void 0);
184
+ __decorate([
185
+ property({ type: Boolean, reflect: true })
186
+ ], RangeInput.prototype, "vertical", void 0);
187
+ __decorate([
188
+ property({ type: Array })
189
+ ], RangeInput.prototype, "value", void 0);
190
+ __decorate([
191
+ property({ type: Array })
192
+ ], RangeInput.prototype, "default", void 0);
193
+ __decorate([
194
+ part("root")
195
+ ], RangeInput.prototype, "_root", void 0);
196
+ RangeInput = __decorate([
197
+ godown(protoName),
198
+ styles([
199
+ inputStyle,
200
+ css `
201
+ :host {
202
+ background: var(--${cssGlobalVars.input}--background);
203
+ margin: 0.25em var(--${cssGlobalVars.input}--outline-width);
204
+ border-radius: var(--${cssGlobalVars.input}--radius);
205
+ border-radius: var(--${cssGlobalVars.input}--radius);
206
+ --${cssScope}--handle-active: rgb(0 118 200);
207
+ --${cssScope}--track-width: .5em;
208
+ display: inline-block;
209
+ width: var(--${cssGlobalVars.input}--width);
210
+ }
211
+
212
+ :host([vertical]) {
213
+ height: var(--${cssGlobalVars.input}--width);
214
+ width: -moz-fit-content;
215
+ width: fit-content;
216
+ }
217
+
218
+ i:hover {
219
+ --${cssScope}--handle-scale:1.08;
220
+ }
221
+
222
+ i:active {
223
+ --${cssScope}--handle-scale:1.05;
224
+ background: var(--${cssScope}--handle-active);
225
+ }
226
+
227
+ .last-focus {
228
+ z-index: 2;
229
+ }
230
+
231
+ [part="root"] {
232
+ min-height:inherit;
233
+ position: relative;
234
+ border-radius: inherit;
235
+ width: 100%;
236
+ --start: 0%;
237
+ --end: 50%;
238
+ height: var(--${cssScope}--track-width);
239
+ }
240
+
241
+ [part="track"] {
242
+ min-height:inherit;
243
+ display: flex;
244
+ position: absolute;
245
+ pointer-events: none;
246
+ border-radius: inherit;
247
+ justify-content: space-between;
248
+ left: min(var(--start), var(--end));
249
+ background: var(--${cssGlobalVars.input}--true);
250
+ width: max(calc(var(--end) - var(--start)), calc(var(--start) - var(--end)));
251
+ }
252
+
253
+ [part=handle] {
254
+ width: 1em;
255
+ height: 1em;
256
+ display: flex;
257
+ align-items: center;
258
+ justify-content: center;
259
+ -webkit-user-select: none;
260
+ user-select: none;
261
+ position: absolute;
262
+ border: 0.1em solid;
263
+ border-radius: 50%;
264
+ transform-origin: 0% 25%;
265
+ transform: scale(var(--${cssScope}--handle-scale, 1)) translate(-50%, -25%);
266
+ background: var(--${cssGlobalVars.input}--true);
267
+ border-color: var(--${cssGlobalVars.input}--control);
268
+ }
269
+ `,
270
+ css `
271
+ .vertical {
272
+ height: 100%;
273
+ width: var(--${cssScope}--track-width);
274
+ }
275
+
276
+ .vertical i {
277
+ transform: translate(-25%, -50%);
278
+ }
279
+
280
+ .vertical [part="track"] {
281
+ width: 100%;
282
+ height: max(calc(var(--end) - var(--start)), calc(var(--start) - var(--end)));
283
+ top: min(var(--start), var(--end));
284
+ left: 0;
285
+ }
286
+ `,
287
+ css `
288
+ :host(:not([range])) .start {
289
+ visibility: hidden;
290
+ }
291
+
292
+ .start {
293
+ left: var(--start);
294
+ top: 0;
295
+ }
296
+
297
+ .end {
298
+ left: var(--end);
299
+ top: 0;
300
+ }
301
+
302
+ .vertical .start {
303
+ top: var(--start);
304
+ left: 0;
305
+ }
306
+
307
+ .vertical .end {
308
+ top: var(--end);
309
+ left: 0;
310
+ }
311
+ `,
312
+ ])
313
+ ], RangeInput);
314
+ export { RangeInput };
315
+ export default RangeInput;
316
+ //# sourceMappingURL=range-input.js.map