godown 3.13.1 → 3.13.2

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 (427) hide show
  1. package/alert.d.ts +0 -1
  2. package/alert.d.ts.map +1 -1
  3. package/alert.js.map +1 -1
  4. package/avatar.d.ts +0 -1
  5. package/avatar.d.ts.map +1 -1
  6. package/avatar.js.map +1 -1
  7. package/badge.d.ts +0 -1
  8. package/badge.d.ts.map +1 -1
  9. package/badge.js.map +1 -1
  10. package/breath.d.ts +0 -1
  11. package/breath.d.ts.map +1 -1
  12. package/breath.js.map +1 -1
  13. package/build/godown+lit.iife.js +16 -57
  14. package/build/godown+lit.iife.js.map +1 -1
  15. package/build/godown+lit.js +16 -57
  16. package/build/godown+lit.js.map +1 -1
  17. package/build/godown+lit.umd.js +16 -57
  18. package/build/godown+lit.umd.js.map +1 -1
  19. package/build/godown.iife.js +15 -47
  20. package/build/godown.iife.js.map +1 -1
  21. package/build/godown.js +15 -47
  22. package/build/godown.js.map +1 -1
  23. package/build/godown.umd.js +15 -47
  24. package/build/godown.umd.js.map +1 -1
  25. package/button.d.ts +0 -1
  26. package/button.d.ts.map +1 -1
  27. package/button.js.map +1 -1
  28. package/card.d.ts +0 -1
  29. package/card.d.ts.map +1 -1
  30. package/card.js.map +1 -1
  31. package/carousel.d.ts +0 -1
  32. package/carousel.d.ts.map +1 -1
  33. package/carousel.js.map +1 -1
  34. package/chip.d.ts +0 -1
  35. package/chip.d.ts.map +1 -1
  36. package/chip.js.map +1 -1
  37. package/custom-elements.json +1 -1
  38. package/details.d.ts +0 -1
  39. package/details.d.ts.map +1 -1
  40. package/details.js.map +1 -1
  41. package/dialog.d.ts +0 -1
  42. package/dialog.d.ts.map +1 -1
  43. package/dialog.js.map +1 -1
  44. package/divider.d.ts +0 -1
  45. package/divider.d.ts.map +1 -1
  46. package/divider.js.map +1 -1
  47. package/dragbox.d.ts +0 -1
  48. package/dragbox.d.ts.map +1 -1
  49. package/dragbox.js.map +1 -1
  50. package/flex.d.ts +0 -1
  51. package/flex.d.ts.map +1 -1
  52. package/flex.js.map +1 -1
  53. package/form.d.ts +0 -1
  54. package/form.d.ts.map +1 -1
  55. package/form.js.map +1 -1
  56. package/grid.d.ts +0 -1
  57. package/grid.d.ts.map +1 -1
  58. package/grid.js.map +1 -1
  59. package/heading.d.ts +0 -1
  60. package/heading.d.ts.map +1 -1
  61. package/heading.js.map +1 -1
  62. package/index.d.ts +0 -1
  63. package/index.d.ts.map +1 -1
  64. package/index.js.map +1 -1
  65. package/input.d.ts +0 -1
  66. package/input.d.ts.map +1 -1
  67. package/input.js.map +1 -1
  68. package/internal/global-style.d.ts +13 -15
  69. package/internal/global-style.d.ts.map +1 -1
  70. package/internal/global-style.js +1 -1
  71. package/internal/global-style.js.map +1 -1
  72. package/internal/icons/caret-down.d.ts +0 -1
  73. package/internal/icons/caret-down.d.ts.map +1 -1
  74. package/internal/icons/caret-down.js +1 -1
  75. package/internal/icons/caret-down.js.map +1 -1
  76. package/internal/icons/caret-left.d.ts +0 -1
  77. package/internal/icons/caret-left.d.ts.map +1 -1
  78. package/internal/icons/caret-left.js +1 -1
  79. package/internal/icons/caret-left.js.map +1 -1
  80. package/internal/icons/caret-right.d.ts +0 -1
  81. package/internal/icons/caret-right.d.ts.map +1 -1
  82. package/internal/icons/caret-right.js +1 -1
  83. package/internal/icons/caret-right.js.map +1 -1
  84. package/internal/icons/eye-slash.d.ts +0 -1
  85. package/internal/icons/eye-slash.d.ts.map +1 -1
  86. package/internal/icons/eye-slash.js +1 -1
  87. package/internal/icons/eye-slash.js.map +1 -1
  88. package/internal/popover.d.ts +0 -1
  89. package/internal/popover.d.ts.map +1 -1
  90. package/internal/popover.js +1 -1
  91. package/internal/popover.js.map +1 -1
  92. package/internal/reset-style.d.ts +0 -1
  93. package/internal/reset-style.d.ts.map +1 -1
  94. package/internal/reset-style.js +2 -1
  95. package/internal/reset-style.js.map +1 -1
  96. package/internal/ring.d.ts +9 -10
  97. package/internal/ring.d.ts.map +1 -1
  98. package/internal/ring.js +1 -1
  99. package/internal/ring.js.map +1 -1
  100. package/internal/super-input.d.ts +32 -33
  101. package/internal/super-input.d.ts.map +1 -1
  102. package/internal/super-input.js +2 -1
  103. package/internal/super-input.js.map +1 -1
  104. package/internal/utils.d.ts +0 -1
  105. package/internal/utils.d.ts.map +1 -1
  106. package/internal/utils.js +1 -1
  107. package/internal/utils.js.map +1 -1
  108. package/layout.d.ts +0 -1
  109. package/layout.d.ts.map +1 -1
  110. package/layout.js.map +1 -1
  111. package/link.d.ts +0 -1
  112. package/link.d.ts.map +1 -1
  113. package/link.js.map +1 -1
  114. package/package.json +5 -5
  115. package/popover.d.ts +0 -1
  116. package/popover.d.ts.map +1 -1
  117. package/popover.js.map +1 -1
  118. package/progress.d.ts +0 -1
  119. package/progress.d.ts.map +1 -1
  120. package/progress.js.map +1 -1
  121. package/range.d.ts +0 -1
  122. package/range.d.ts.map +1 -1
  123. package/range.js.map +1 -1
  124. package/rotate.d.ts +0 -1
  125. package/rotate.d.ts.map +1 -1
  126. package/rotate.js.map +1 -1
  127. package/router.d.ts +0 -1
  128. package/router.d.ts.map +1 -1
  129. package/router.js.map +1 -1
  130. package/select.d.ts +0 -1
  131. package/select.d.ts.map +1 -1
  132. package/select.js.map +1 -1
  133. package/skeleton.d.ts +0 -1
  134. package/skeleton.d.ts.map +1 -1
  135. package/skeleton.js.map +1 -1
  136. package/split.d.ts +0 -1
  137. package/split.d.ts.map +1 -1
  138. package/split.js.map +1 -1
  139. package/src/internal/popover.ts +1 -1
  140. package/src/web-components/alert/component.ts +1 -1
  141. package/src/web-components/breath/component.ts +1 -1
  142. package/src/web-components/router/component.ts +12 -12
  143. package/src/web-components/skeleton/component.ts +2 -2
  144. package/src/web-components/time/component.ts +1 -1
  145. package/switch.d.ts +0 -1
  146. package/switch.d.ts.map +1 -1
  147. package/switch.js.map +1 -1
  148. package/tabs.d.ts +0 -1
  149. package/tabs.d.ts.map +1 -1
  150. package/tabs.js.map +1 -1
  151. package/text.d.ts +0 -1
  152. package/text.d.ts.map +1 -1
  153. package/text.js.map +1 -1
  154. package/time.d.ts +0 -1
  155. package/time.d.ts.map +1 -1
  156. package/time.js.map +1 -1
  157. package/tooltip.d.ts +0 -1
  158. package/tooltip.d.ts.map +1 -1
  159. package/tooltip.js.map +1 -1
  160. package/typewriter.d.ts +0 -1
  161. package/typewriter.d.ts.map +1 -1
  162. package/typewriter.js.map +1 -1
  163. package/web-components/alert/component.d.ts +20 -21
  164. package/web-components/alert/component.d.ts.map +1 -1
  165. package/web-components/alert/component.js +1 -1
  166. package/web-components/alert/component.js.map +1 -1
  167. package/web-components/alert/definition.d.ts +3 -4
  168. package/web-components/alert/definition.d.ts.map +1 -1
  169. package/web-components/alert/definition.js +1 -1
  170. package/web-components/alert/definition.js.map +1 -1
  171. package/web-components/avatar/component.d.ts +25 -26
  172. package/web-components/avatar/component.d.ts.map +1 -1
  173. package/web-components/avatar/component.js +1 -1
  174. package/web-components/avatar/component.js.map +1 -1
  175. package/web-components/avatar/definition.d.ts +3 -4
  176. package/web-components/avatar/definition.d.ts.map +1 -1
  177. package/web-components/avatar/definition.js +1 -1
  178. package/web-components/avatar/definition.js.map +1 -1
  179. package/web-components/badge/component.d.ts +7 -8
  180. package/web-components/badge/component.d.ts.map +1 -1
  181. package/web-components/badge/component.js +2 -1
  182. package/web-components/badge/component.js.map +1 -1
  183. package/web-components/badge/definition.d.ts +3 -4
  184. package/web-components/badge/definition.d.ts.map +1 -1
  185. package/web-components/badge/definition.js +1 -1
  186. package/web-components/badge/definition.js.map +1 -1
  187. package/web-components/breath/component.d.ts +28 -29
  188. package/web-components/breath/component.d.ts.map +1 -1
  189. package/web-components/breath/component.js +1 -1
  190. package/web-components/breath/component.js.map +1 -1
  191. package/web-components/breath/definition.d.ts +3 -4
  192. package/web-components/breath/definition.d.ts.map +1 -1
  193. package/web-components/breath/definition.js +1 -1
  194. package/web-components/breath/definition.js.map +1 -1
  195. package/web-components/button/component.d.ts +35 -36
  196. package/web-components/button/component.d.ts.map +1 -1
  197. package/web-components/button/component.js +1 -1
  198. package/web-components/button/component.js.map +1 -1
  199. package/web-components/button/definition.d.ts +3 -4
  200. package/web-components/button/definition.d.ts.map +1 -1
  201. package/web-components/button/definition.js +1 -1
  202. package/web-components/button/definition.js.map +1 -1
  203. package/web-components/card/component.d.ts +21 -22
  204. package/web-components/card/component.d.ts.map +1 -1
  205. package/web-components/card/component.js +1 -1
  206. package/web-components/card/component.js.map +1 -1
  207. package/web-components/card/definition.d.ts +3 -4
  208. package/web-components/card/definition.d.ts.map +1 -1
  209. package/web-components/card/definition.js +1 -1
  210. package/web-components/card/definition.js.map +1 -1
  211. package/web-components/carousel/component.d.ts +32 -33
  212. package/web-components/carousel/component.d.ts.map +1 -1
  213. package/web-components/carousel/component.js +2 -1
  214. package/web-components/carousel/component.js.map +1 -1
  215. package/web-components/carousel/definition.d.ts +3 -4
  216. package/web-components/carousel/definition.d.ts.map +1 -1
  217. package/web-components/carousel/definition.js +1 -1
  218. package/web-components/carousel/definition.js.map +1 -1
  219. package/web-components/chip/component.d.ts +21 -22
  220. package/web-components/chip/component.d.ts.map +1 -1
  221. package/web-components/chip/component.js +1 -1
  222. package/web-components/chip/component.js.map +1 -1
  223. package/web-components/chip/definition.d.ts +3 -4
  224. package/web-components/chip/definition.d.ts.map +1 -1
  225. package/web-components/chip/definition.js +1 -1
  226. package/web-components/chip/definition.js.map +1 -1
  227. package/web-components/details/component.d.ts +16 -17
  228. package/web-components/details/component.d.ts.map +1 -1
  229. package/web-components/details/component.js +1 -1
  230. package/web-components/details/component.js.map +1 -1
  231. package/web-components/details/definition.d.ts +3 -4
  232. package/web-components/details/definition.d.ts.map +1 -1
  233. package/web-components/details/definition.js +1 -1
  234. package/web-components/details/definition.js.map +1 -1
  235. package/web-components/dialog/component.d.ts +30 -31
  236. package/web-components/dialog/component.d.ts.map +1 -1
  237. package/web-components/dialog/component.js +1 -1
  238. package/web-components/dialog/component.js.map +1 -1
  239. package/web-components/dialog/definition.d.ts +3 -4
  240. package/web-components/dialog/definition.d.ts.map +1 -1
  241. package/web-components/dialog/definition.js +1 -1
  242. package/web-components/dialog/definition.js.map +1 -1
  243. package/web-components/divider/component.d.ts +9 -10
  244. package/web-components/divider/component.d.ts.map +1 -1
  245. package/web-components/divider/component.js +1 -1
  246. package/web-components/divider/component.js.map +1 -1
  247. package/web-components/divider/definition.d.ts +3 -4
  248. package/web-components/divider/definition.d.ts.map +1 -1
  249. package/web-components/divider/definition.js +1 -1
  250. package/web-components/divider/definition.js.map +1 -1
  251. package/web-components/dragbox/component.d.ts +31 -32
  252. package/web-components/dragbox/component.d.ts.map +1 -1
  253. package/web-components/dragbox/component.js +2 -1
  254. package/web-components/dragbox/component.js.map +1 -1
  255. package/web-components/dragbox/definition.d.ts +3 -4
  256. package/web-components/dragbox/definition.d.ts.map +1 -1
  257. package/web-components/dragbox/definition.js +1 -1
  258. package/web-components/dragbox/definition.js.map +1 -1
  259. package/web-components/flex/component.d.ts +26 -27
  260. package/web-components/flex/component.d.ts.map +1 -1
  261. package/web-components/flex/component.js +2 -1
  262. package/web-components/flex/component.js.map +1 -1
  263. package/web-components/flex/definition.d.ts +3 -4
  264. package/web-components/flex/definition.d.ts.map +1 -1
  265. package/web-components/flex/definition.js +1 -1
  266. package/web-components/flex/definition.js.map +1 -1
  267. package/web-components/form/component.d.ts +16 -17
  268. package/web-components/form/component.d.ts.map +1 -1
  269. package/web-components/form/component.js +2 -1
  270. package/web-components/form/component.js.map +1 -1
  271. package/web-components/form/definition.d.ts +3 -4
  272. package/web-components/form/definition.d.ts.map +1 -1
  273. package/web-components/form/definition.js +1 -1
  274. package/web-components/form/definition.js.map +1 -1
  275. package/web-components/grid/component.d.ts +30 -31
  276. package/web-components/grid/component.d.ts.map +1 -1
  277. package/web-components/grid/component.js +2 -1
  278. package/web-components/grid/component.js.map +1 -1
  279. package/web-components/grid/definition.d.ts +3 -4
  280. package/web-components/grid/definition.d.ts.map +1 -1
  281. package/web-components/grid/definition.js +1 -1
  282. package/web-components/grid/definition.js.map +1 -1
  283. package/web-components/heading/component.d.ts +23 -24
  284. package/web-components/heading/component.d.ts.map +1 -1
  285. package/web-components/heading/component.js +2 -1
  286. package/web-components/heading/component.js.map +1 -1
  287. package/web-components/heading/definition.d.ts +3 -4
  288. package/web-components/heading/definition.d.ts.map +1 -1
  289. package/web-components/heading/definition.js +1 -1
  290. package/web-components/heading/definition.js.map +1 -1
  291. package/web-components/input/component.d.ts +17 -18
  292. package/web-components/input/component.d.ts.map +1 -1
  293. package/web-components/input/component.js +1 -1
  294. package/web-components/input/component.js.map +1 -1
  295. package/web-components/input/definition.d.ts +3 -4
  296. package/web-components/input/definition.d.ts.map +1 -1
  297. package/web-components/input/definition.js +1 -1
  298. package/web-components/input/definition.js.map +1 -1
  299. package/web-components/layout/component.d.ts +18 -19
  300. package/web-components/layout/component.d.ts.map +1 -1
  301. package/web-components/layout/component.js +2 -1
  302. package/web-components/layout/component.js.map +1 -1
  303. package/web-components/layout/definition.d.ts +3 -4
  304. package/web-components/layout/definition.d.ts.map +1 -1
  305. package/web-components/layout/definition.js +1 -1
  306. package/web-components/layout/definition.js.map +1 -1
  307. package/web-components/link/component.d.ts +54 -55
  308. package/web-components/link/component.d.ts.map +1 -1
  309. package/web-components/link/component.js +2 -1
  310. package/web-components/link/component.js.map +1 -1
  311. package/web-components/link/definition.d.ts +3 -4
  312. package/web-components/link/definition.d.ts.map +1 -1
  313. package/web-components/link/definition.js +1 -1
  314. package/web-components/link/definition.js.map +1 -1
  315. package/web-components/popover/component.d.ts +28 -29
  316. package/web-components/popover/component.d.ts.map +1 -1
  317. package/web-components/popover/component.js +2 -1
  318. package/web-components/popover/component.js.map +1 -1
  319. package/web-components/popover/definition.d.ts +3 -4
  320. package/web-components/popover/definition.d.ts.map +1 -1
  321. package/web-components/popover/definition.js +1 -1
  322. package/web-components/popover/definition.js.map +1 -1
  323. package/web-components/progress/component.d.ts +8 -9
  324. package/web-components/progress/component.d.ts.map +1 -1
  325. package/web-components/progress/component.js +1 -1
  326. package/web-components/progress/component.js.map +1 -1
  327. package/web-components/progress/definition.d.ts +3 -4
  328. package/web-components/progress/definition.d.ts.map +1 -1
  329. package/web-components/progress/definition.js +1 -1
  330. package/web-components/progress/definition.js.map +1 -1
  331. package/web-components/range/component.d.ts +108 -109
  332. package/web-components/range/component.d.ts.map +1 -1
  333. package/web-components/range/component.js +1 -1
  334. package/web-components/range/component.js.map +1 -1
  335. package/web-components/range/definition.d.ts +3 -4
  336. package/web-components/range/definition.d.ts.map +1 -1
  337. package/web-components/range/definition.js +1 -1
  338. package/web-components/range/definition.js.map +1 -1
  339. package/web-components/rotate/component.d.ts +22 -23
  340. package/web-components/rotate/component.d.ts.map +1 -1
  341. package/web-components/rotate/component.js +1 -1
  342. package/web-components/rotate/component.js.map +1 -1
  343. package/web-components/rotate/definition.d.ts +3 -4
  344. package/web-components/rotate/definition.d.ts.map +1 -1
  345. package/web-components/rotate/definition.js +1 -1
  346. package/web-components/rotate/definition.js.map +1 -1
  347. package/web-components/router/component.d.ts +99 -100
  348. package/web-components/router/component.d.ts.map +1 -1
  349. package/web-components/router/component.js +2 -1
  350. package/web-components/router/component.js.map +1 -1
  351. package/web-components/router/definition.d.ts +3 -4
  352. package/web-components/router/definition.d.ts.map +1 -1
  353. package/web-components/router/definition.js +1 -1
  354. package/web-components/router/definition.js.map +1 -1
  355. package/web-components/select/component.d.ts +30 -31
  356. package/web-components/select/component.d.ts.map +1 -1
  357. package/web-components/select/component.js +2 -1
  358. package/web-components/select/component.js.map +1 -1
  359. package/web-components/select/definition.d.ts +3 -4
  360. package/web-components/select/definition.d.ts.map +1 -1
  361. package/web-components/select/definition.js +1 -1
  362. package/web-components/select/definition.js.map +1 -1
  363. package/web-components/skeleton/component.d.ts +11 -12
  364. package/web-components/skeleton/component.d.ts.map +1 -1
  365. package/web-components/skeleton/component.js +1 -1
  366. package/web-components/skeleton/component.js.map +1 -1
  367. package/web-components/skeleton/definition.d.ts +3 -4
  368. package/web-components/skeleton/definition.d.ts.map +1 -1
  369. package/web-components/skeleton/definition.js +1 -1
  370. package/web-components/skeleton/definition.js.map +1 -1
  371. package/web-components/split/component.d.ts +48 -49
  372. package/web-components/split/component.d.ts.map +1 -1
  373. package/web-components/split/component.js +1 -1
  374. package/web-components/split/component.js.map +1 -1
  375. package/web-components/split/definition.d.ts +3 -4
  376. package/web-components/split/definition.d.ts.map +1 -1
  377. package/web-components/split/definition.js +1 -1
  378. package/web-components/split/definition.js.map +1 -1
  379. package/web-components/switch/component.d.ts +20 -21
  380. package/web-components/switch/component.d.ts.map +1 -1
  381. package/web-components/switch/component.js +1 -1
  382. package/web-components/switch/component.js.map +1 -1
  383. package/web-components/switch/definition.d.ts +3 -4
  384. package/web-components/switch/definition.d.ts.map +1 -1
  385. package/web-components/switch/definition.js +1 -1
  386. package/web-components/switch/definition.js.map +1 -1
  387. package/web-components/tabs/component.d.ts +39 -40
  388. package/web-components/tabs/component.d.ts.map +1 -1
  389. package/web-components/tabs/component.js +1 -1
  390. package/web-components/tabs/component.js.map +1 -1
  391. package/web-components/tabs/definition.d.ts +3 -4
  392. package/web-components/tabs/definition.d.ts.map +1 -1
  393. package/web-components/tabs/definition.js +1 -1
  394. package/web-components/tabs/definition.js.map +1 -1
  395. package/web-components/text/component.d.ts +10 -11
  396. package/web-components/text/component.d.ts.map +1 -1
  397. package/web-components/text/component.js +1 -1
  398. package/web-components/text/component.js.map +1 -1
  399. package/web-components/text/definition.d.ts +3 -4
  400. package/web-components/text/definition.d.ts.map +1 -1
  401. package/web-components/text/definition.js +1 -1
  402. package/web-components/text/definition.js.map +1 -1
  403. package/web-components/time/component.d.ts +28 -29
  404. package/web-components/time/component.d.ts.map +1 -1
  405. package/web-components/time/component.js +1 -1
  406. package/web-components/time/component.js.map +1 -1
  407. package/web-components/time/definition.d.ts +3 -4
  408. package/web-components/time/definition.d.ts.map +1 -1
  409. package/web-components/time/definition.js +1 -1
  410. package/web-components/time/definition.js.map +1 -1
  411. package/web-components/tooltip/component.d.ts +19 -20
  412. package/web-components/tooltip/component.d.ts.map +1 -1
  413. package/web-components/tooltip/component.js +1 -1
  414. package/web-components/tooltip/component.js.map +1 -1
  415. package/web-components/tooltip/definition.d.ts +3 -4
  416. package/web-components/tooltip/definition.d.ts.map +1 -1
  417. package/web-components/tooltip/definition.js +1 -1
  418. package/web-components/tooltip/definition.js.map +1 -1
  419. package/web-components/typewriter/component.d.ts +43 -44
  420. package/web-components/typewriter/component.d.ts.map +1 -1
  421. package/web-components/typewriter/component.js +1 -1
  422. package/web-components/typewriter/component.js.map +1 -1
  423. package/web-components/typewriter/definition.d.ts +3 -4
  424. package/web-components/typewriter/definition.d.ts.map +1 -1
  425. package/web-components/typewriter/definition.js +1 -1
  426. package/web-components/typewriter/definition.js.map +1 -1
  427. package/web-types.json +1 -1
@@ -1,16 +1,15 @@
1
1
  import { type TemplateResult } from "lit";
2
2
  import { GlobalStyle } from "../../internal/global-style.js";
3
3
  /**
4
- * {@linkcode Progress} similar to `<progress>`.
5
- *
6
- * @category feedback
7
- */
4
+ * {@linkcode Progress} similar to `<progress>`.
5
+ *
6
+ * @category feedback
7
+ */
8
8
  declare class Progress extends GlobalStyle {
9
- max: number;
10
- min: number;
11
- value: number;
12
- protected render(): TemplateResult<1>;
9
+ max: number;
10
+ min: number;
11
+ value: number;
12
+ protected render(): TemplateResult<1>;
13
13
  }
14
14
  export default Progress;
15
15
  export { Progress };
16
- //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/progress/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAiB,MAAM,gCAAgC,CAAC;AAI5E;;;;GAIG;AACH,cA+CM,QAAS,SAAQ,WAAW;IAEhC,GAAG,SAAK;IAGR,GAAG,SAAK;IAGR,KAAK,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAsBtC;AAED,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"mappings":"AACA,cAAc,sBAAiC,KAAM;AAGrD,SAAS,mBAAkC,gCAAiC;;;;;;AAS5E,cA+CM,iBAAiB,YAAY;CACjC,AACA;CAEA,AACA;CAEA,AACA;CAEA,UAAU,UAAU,eAAe;AAsBpC;AAED,eAAe;AACf,SAAS","names":[],"sources":["../../../src/web-components/progress/component.ts"],"sourcesContent":["import { attr, godown, isNullable, Ranger, styles } from \"@godown/element\";\nimport { type TemplateResult, css, html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n\nimport { GlobalStyle, cssGlobalVars } from \"../../internal/global-style.js\";\n\nconst protoName = \"progress\";\n\n/**\n * {@linkcode Progress} similar to `<progress>`.\n *\n * @category feedback\n */\n@godown(protoName)\n@styles(css`\n :host {\n width: 100%;\n height: 0.5em;\n border-radius: 0.25em;\n background: var(${cssGlobalVars.passive});\n color: var(${cssGlobalVars.active});\n }\n\n :host,\n [part=\"root\"] {\n display: block;\n }\n\n [part=\"root\"] {\n z-index: 1;\n position: relative;\n border-radius: inherit;\n overflow: hidden;\n }\n\n [part=\"value\"] {\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: inherit;\n transition: all 0.3s;\n animation: progress 1.8s ease-in-out infinite alternate;\n background: currentColor;\n }\n\n @keyframes progress {\n from {\n left: 0;\n }\n to {\n left: 80%;\n }\n }\n\n .static [part=\"value\"] {\n animation: none;\n }\n`)\nclass Progress extends GlobalStyle {\n @property({ type: Number })\n max = 1;\n\n @property({ type: Number })\n min = 0;\n\n @property({ type: Number })\n value: number;\n\n protected render(): TemplateResult<1> {\n let width = 20;\n let className: string;\n if (!isNullable(this.value)) {\n const ranger = new Ranger(this.min, this.max);\n const value = +this.value - this.min;\n width = (value / ranger.diff) * 100;\n className = \"static\";\n }\n return html`\n <div\n part=\"root\"\n ${attr(this.observedRecord)}\n class=\"${className}\"\n >\n <i\n part=\"value\"\n style=\"width:${width}%;\"\n ></i>\n </div>\n `;\n }\n}\n\nexport default Progress;\nexport { Progress };\n"],"version":3,"file":"component.d.ts"}
@@ -1,2 +1,2 @@
1
- import{__decorate as t}from"tslib";import{godown as r,styles as e,isNullable as o,Ranger as i,attr as s}from"@godown/element";import{css as a,html as n}from"lit";import{property as l}from"lit/decorators.js";import{cssGlobalVars as p,GlobalStyle as d}from"../../internal/global-style.js";let m=class Progress extends d{constructor(){super(...arguments),this.max=1,this.min=0}render(){let t,r=20;if(!o(this.value)){const e=new i(this.min,this.max);r=(+this.value-this.min)/e.diff*100,t="static"}return n`<div part="root" ${s(this.observedRecord)} class="${t}"> <i part="value" style="width:${r}%;"></i> </div>`}};t([l({type:Number})],m.prototype,"max",void 0),t([l({type:Number})],m.prototype,"min",void 0),t([l({type:Number})],m.prototype,"value",void 0),m=t([r("progress"),e(a`:host{background:var(${p.passive});border-radius:.25em;color:var(${p.active});height:.5em;width:100%}:host,[part=root]{display:block}[part=root]{border-radius:inherit;overflow:hidden;position:relative;z-index:1}[part=value]{animation:progress 1.8s ease-in-out infinite alternate;background:currentColor;border-radius:inherit;height:100%;left:0;position:absolute;top:0;transition:all .3s;z-index:2}@keyframes progress{0%{left:0}to{left:80%}}.static [part=value]{animation:none}`)],m);var u=m;export{m as Progress,u as default};
1
+ import{godown,styles,isNullable,Ranger,attr}from"@godown/element";import{css,html}from"lit";import{property}from"lit/decorators.js";import{cssGlobalVars,GlobalStyle}from"../../internal/global-style.js";import _decorate from"@oxc-project/runtime/helpers/decorate";const protoName=`progress`;let Progress=class e extends GlobalStyle{constructor(...e){super(...e),this.max=1,this.min=0}render(){let e=20,d;if(!isNullable(this.value)){let f=new Ranger(this.min,this.max),p=+this.value-this.min;e=p/f.diff*100,d=`static`}return html`<div part="root" ${attr(this.observedRecord)} class="${d}"> <i part="value" style="width:${e}%;"></i> </div>`}};_decorate([property({type:Number})],Progress.prototype,`max`,void 0),_decorate([property({type:Number})],Progress.prototype,`min`,void 0),_decorate([property({type:Number})],Progress.prototype,`value`,void 0),Progress=_decorate([godown(protoName),styles(css`:host{width:100%;height:.5em;border-radius:.25em;background:var(${cssGlobalVars.passive});color:var(${cssGlobalVars.active})}:host,[part=root]{display:block}[part=root]{z-index:1;position:relative;border-radius:inherit;overflow:hidden}[part=value]{position:absolute;z-index:2;top:0;left:0;height:100%;border-radius:inherit;transition:all .3s;animation:progress 1.8s ease-in-out infinite alternate;background:currentColor}@keyframes progress{0%{left:0}to{left:80%}}.static [part=value]{animation:none}`)],Progress);var Progress$1=Progress;export{Progress,Progress$1 as default};
2
2
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../src/web-components/progress/component.ts"],"sourcesContent":null,"names":["Progress","GlobalStyle","constructor","this","max","min","render","className","width","isNullable","value","ranger","Ranger","diff","html","attr","observedRecord","__decorate","Number","prototype","godown","styles","css","cssGlobalVars","passive","active","Progress$1"],"mappings":"+RA4DA,IAAMA,EAAN,MAAMA,iBAAiBC,EAAvB,WAAAC,uBAEEC,KAAGC,IAAG,EAGND,KAAGE,IAAG,EAKI,MAAAC,GACR,IACIC,EADAC,EAAQ,GAEZ,IAAKC,EAAWN,KAAKO,OAAQ,CAC3B,MAAMC,EAAS,IAAIC,EAAOT,KAAKE,IAAKF,KAAKC,KAEzCI,IADeL,KAAKO,MAAQP,KAAKE,KAChBM,EAAOE,KAAQ,IAChCN,EAAY,SAEd,OAAOO,CAAI,oBAAAC,EAAAZ,KAAAa,0BAAAT,oCAAAC,qBAGLS,EAAA,SACgBC,gFAII,0BAGzBC,UAAA,aAAA,KACHF,EAAA,CACDG,EAtFiB,YAwDhBC,EAAAC,CAAA,wBAAAC,EAAAC,0CAAAD,EAAAE,2ZADCzB,GACO,IAAA0B,EAAA1B"}
1
+ {"version":3,"file":"component.js","sources":["../../src/web-components/progress/component.ts"],"sourcesContent":["import { attr, godown, isNullable, Ranger, styles } from \"@godown/element\";\nimport { type TemplateResult, css, html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n\nimport { GlobalStyle, cssGlobalVars } from \"../../internal/global-style.js\";\n\nconst protoName = \"progress\";\n\n/**\n * {@linkcode Progress} similar to `<progress>`.\n *\n * @category feedback\n */\n@godown(protoName)\n@styles(css`\n :host {\n width: 100%;\n height: 0.5em;\n border-radius: 0.25em;\n background: var(${cssGlobalVars.passive});\n color: var(${cssGlobalVars.active});\n }\n\n :host,\n [part=\"root\"] {\n display: block;\n }\n\n [part=\"root\"] {\n z-index: 1;\n position: relative;\n border-radius: inherit;\n overflow: hidden;\n }\n\n [part=\"value\"] {\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: inherit;\n transition: all 0.3s;\n animation: progress 1.8s ease-in-out infinite alternate;\n background: currentColor;\n }\n\n @keyframes progress {\n from {\n left: 0;\n }\n to {\n left: 80%;\n }\n }\n\n .static [part=\"value\"] {\n animation: none;\n }\n`)\nclass Progress extends GlobalStyle {\n @property({ type: Number })\n max = 1;\n\n @property({ type: Number })\n min = 0;\n\n @property({ type: Number })\n value: number;\n\n protected render(): TemplateResult<1> {\n let width = 20;\n let className: string;\n if (!isNullable(this.value)) {\n const ranger = new Ranger(this.min, this.max);\n const value = +this.value - this.min;\n width = (value / ranger.diff) * 100;\n className = \"static\";\n }\n return html`\n <div\n part=\"root\"\n ${attr(this.observedRecord)}\n class=\"${className}\"\n >\n <i\n part=\"value\"\n style=\"width:${width}%;\"\n ></i>\n </div>\n `;\n }\n}\n\nexport default Progress;\nexport { Progress };\n"],"names":["Progress","width","className: string","ranger","value","className"],"mappings":"uQAMA,MAAM,UAAY,WAOlB,IAAA,SAAA,MA+CMA,UAAiB,WAAY,oCAEjC,IAAM,OAGN,IAAM,EAKI,QAA4B,CACpC,IAAIC,EAAQ,GACRC,EACJ,IAAK,WAAW,KAAK,MAAM,CAAE,CAC3B,IAAMC,EAAS,IAAI,OAAO,KAAK,IAAK,KAAK,KACnCC,GAAS,KAAK,MAAQ,KAAK,IAEjC,AADAH,EAASG,EAAQD,EAAO,KAAQ,IAChCE,EAAY,QACb,CACD,MAAO,KAAI,CAAA,iBAGP,EAAE,KAAK,KAAK,eAAe,CAAA,QACpB,EAAEA,EAAU,gCAIJ,EAAEJ,EAAM,eAG3B,CAAC,AACF,CACF,EA/EA,WAgDE,SAAS,CAAE,KAAM,MAAQ,EAAC,AAAA,EAAA,SAAA,UAAA,aAAA,YAG1B,SAAS,CAAE,KAAM,MAAQ,EAAC,AAAA,EAAA,SAAA,UAAA,aAAA,YAG1B,SAAS,CAAE,KAAM,MAAQ,EAAC,AAAA,EAAA,SAAA,UAAA,eAAA,CAtD5B,SAAA,UAAA,CAAA,OAAO,UAAU,CACjB,OAAO,GAAG,CAAC,gEAKQ,EAAE,cAAc,QAAQ,YAC7B,EAAE,cAAc,OAAO,yXAuCtC,CAAC,CAAC,AAAA,EAAA,SAAA,CAmCF,IAAA,WAAe"}
@@ -1,8 +1,7 @@
1
1
  import Progress from "./component.js";
2
2
  export default Progress;
3
3
  declare global {
4
- interface HTMLElementTagNameMap {
5
- "godown-progress": Progress;
6
- }
4
+ interface HTMLElementTagNameMap {
5
+ "godown-progress": Progress;
6
+ }
7
7
  }
8
- //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"__source__/","sources":["web-components/progress/definition.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAItC,eAAe,QAAQ,CAAC;AAExB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,QAAQ,CAAC;KAC7B;CACF"}
1
+ {"mappings":"AAAA,OAAO,cAAc,gBAAiB;AAItC,eAAe;eAEA;WACH,sBAAsB;EAC9B,mBAAmB;CACpB;AACF","names":[],"sources":["../../../src/web-components/progress/definition.ts"],"sourcesContent":["import Progress from \"./component.js\";\n\nProgress.define();\n\nexport default Progress;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"godown-progress\": Progress;\n }\n}\n"],"version":3,"file":"definition.d.ts"}
@@ -1,2 +1,2 @@
1
- import e from"./component.js";e.define();export{e as default};
1
+ import Progress from"./component.js";Progress.define();export{Progress as default};
2
2
  //# sourceMappingURL=definition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sources":["../../src/web-components/progress/definition.ts"],"sourcesContent":null,"names":["Progress","define"],"mappings":"8BAEAA,EAASC"}
1
+ {"version":3,"file":"definition.js","sources":["../../src/web-components/progress/definition.ts"],"sourcesContent":["import Progress from \"./component.js\";\n\nProgress.define();\n\nexport default Progress;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"godown-progress\": Progress;\n }\n}\n"],"names":[],"mappings":"qCAEA,SAAS,QAAQ"}
@@ -3,116 +3,115 @@ import { type TemplateResult } from "lit";
3
3
  import { SuperInput } from "../../internal/super-input.js";
4
4
  type RangeValue = number | number[];
5
5
  /**
6
- * {@linkcode Range} is similar to `<input type="range">`.
7
- *
8
- * Value accepts number, or array.
9
- *
10
- * Number has 1 handle, the array has the number of its elements.
11
- *
12
- * @fires range - Fires when the value changes.
13
- * @category input
14
- */
6
+ * {@linkcode Range} is similar to `<input type="range">`.
7
+ *
8
+ * Value accepts number, or array.
9
+ *
10
+ * Number has 1 handle, the array has the number of its elements.
11
+ *
12
+ * @fires range - Fires when the value changes.
13
+ * @category input
14
+ */
15
15
  declare class Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {
16
- /**
17
- * Minimum value.
18
- */
19
- min: number;
20
- /**
21
- * Maximum value.
22
- */
23
- max: number;
24
- /**
25
- * Sliding step length.
26
- */
27
- step: number;
28
- /**
29
- * Whether to display the range vertically.
30
- */
31
- vertical: boolean;
32
- /**
33
- * Value, or each of values, will render a handle.
34
- *
35
- * Accepts number or array of numbers.
36
- */
37
- value: V;
38
- /**
39
- * The default of `{@linkcode this.value}`.
40
- */
41
- default: V;
42
- protected _root: HTMLElement;
43
- protected _handles: NodeListOf<HTMLElement>;
44
- lastFocus?: number;
45
- protected _ranger: Ranger;
46
- private __focusStack;
47
- get range(): V extends number ? false : true;
48
- /**
49
- * Return values in the form of an array.
50
- */
51
- get rangeValue(): number[];
52
- /**
53
- * Pad the value to the specified length.
54
- */
55
- padValue(len: number, value?: number): number[];
56
- attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
57
- get observedRecord(): Record<string, any>;
58
- protected render(): TemplateResult<1>;
59
- protected _renderHandle(index: number): TemplateResult<1>;
60
- private __keydownEvent;
61
- /**
62
- * Focuses the handle at the given index, updates the focus stack.
63
- * @param index - The index of the handle to focus.
64
- */
65
- focusHandle(index: number): void;
66
- /**
67
- * Removes the focus from the currently focused handle.
68
- */
69
- blurHandle(): void;
70
- /**
71
- * Creates a keydown event handler that updates the value of the range based on arrow key presses.
72
- * @param index - The index of the handle to update.
73
- * @returns A function that handles the keydown event and updates the range value.
74
- */
75
- protected createKeydownEvent(index: number): (e: KeyboardEvent) => void;
76
- /**
77
- * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
78
- * @param index - The index of the handle to focus.
79
- * @returns A function that handles the mouse down event and updates the range value.
80
- */
81
- protected createMouseDown(index: number): (e: MouseEvent) => void;
82
- /**
83
- * Creates a function that sets the value of the range at the given index.
84
- * @param index - The index of the value to set.
85
- * @returns A function that sets the value of the range.
86
- */
87
- protected createSetValue(index: number): (value: number) => void;
88
- /**
89
- * Compute value from event.
90
- * @returns The value closest to the event client position.
91
- */
92
- protected _computeValue({ clientX, clientY }: MouseEvent): number;
93
- /**
94
- * Handles the mouse down event on the root element of the range component.
95
- * Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle.
96
- * @param e - The mouse down event object.
97
- */
98
- protected _handleMousedownRoot(e: MouseEvent): void;
99
- /**
100
- * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
101
- * @param index - The index of the handle to focus.
102
- * @returns A function that handles the mouse down event and updates the range value.
103
- */
104
- protected createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void;
105
- /**
106
- * Creates a mouse move event handler that updates the range value based on the mouse position.
107
- * @param callback - A function to call with the new value when the mouse is moved.
108
- * @returns A function that handles the mouse move event and updates the range value.
109
- */
110
- protected createMousemoveListener(callback: (newValue: number) => void): (e: MouseEvent) => void;
111
- protected _connectedInit(): void;
112
- reset(): void;
113
- sort(): V;
114
- toSorted(): V;
16
+ /**
17
+ * Minimum value.
18
+ */
19
+ min: number;
20
+ /**
21
+ * Maximum value.
22
+ */
23
+ max: number;
24
+ /**
25
+ * Sliding step length.
26
+ */
27
+ step: number;
28
+ /**
29
+ * Whether to display the range vertically.
30
+ */
31
+ vertical: boolean;
32
+ /**
33
+ * Value, or each of values, will render a handle.
34
+ *
35
+ * Accepts number or array of numbers.
36
+ */
37
+ value: V;
38
+ /**
39
+ * The default of `{@linkcode this.value}`.
40
+ */
41
+ default: V;
42
+ protected _root: HTMLElement;
43
+ protected _handles: NodeListOf<HTMLElement>;
44
+ lastFocus?: number;
45
+ protected _ranger: Ranger;
46
+ private __focusStack;
47
+ get range(): V extends number ? false : true;
48
+ /**
49
+ * Return values in the form of an array.
50
+ */
51
+ get rangeValue(): number[];
52
+ /**
53
+ * Pad the value to the specified length.
54
+ */
55
+ padValue(len: number, value?: number): number[];
56
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
57
+ get observedRecord(): Record<string, any>;
58
+ protected render(): TemplateResult<1>;
59
+ protected _renderHandle(index: number): TemplateResult<1>;
60
+ private __keydownEvent;
61
+ /**
62
+ * Focuses the handle at the given index, updates the focus stack.
63
+ * @param index - The index of the handle to focus.
64
+ */
65
+ focusHandle(index: number): void;
66
+ /**
67
+ * Removes the focus from the currently focused handle.
68
+ */
69
+ blurHandle(): void;
70
+ /**
71
+ * Creates a keydown event handler that updates the value of the range based on arrow key presses.
72
+ * @param index - The index of the handle to update.
73
+ * @returns A function that handles the keydown event and updates the range value.
74
+ */
75
+ protected createKeydownEvent(index: number): (e: KeyboardEvent) => void;
76
+ /**
77
+ * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
78
+ * @param index - The index of the handle to focus.
79
+ * @returns A function that handles the mouse down event and updates the range value.
80
+ */
81
+ protected createMouseDown(index: number): (e: MouseEvent) => void;
82
+ /**
83
+ * Creates a function that sets the value of the range at the given index.
84
+ * @param index - The index of the value to set.
85
+ * @returns A function that sets the value of the range.
86
+ */
87
+ protected createSetValue(index: number): (value: number) => void;
88
+ /**
89
+ * Compute value from event.
90
+ * @returns The value closest to the event client position.
91
+ */
92
+ protected _computeValue({ clientX, clientY }: MouseEvent): number;
93
+ /**
94
+ * Handles the mouse down event on the root element of the range component.
95
+ * Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle.
96
+ * @param e - The mouse down event object.
97
+ */
98
+ protected _handleMousedownRoot(e: MouseEvent): void;
99
+ /**
100
+ * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
101
+ * @param index - The index of the handle to focus.
102
+ * @returns A function that handles the mouse down event and updates the range value.
103
+ */
104
+ protected createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void;
105
+ /**
106
+ * Creates a mouse move event handler that updates the range value based on the mouse position.
107
+ * @param callback - A function to call with the new value when the mouse is moved.
108
+ * @returns A function that handles the mouse move event and updates the range value.
109
+ */
110
+ protected createMousemoveListener(callback: (newValue: number) => void): (e: MouseEvent) => void;
111
+ protected _connectedInit(): void;
112
+ reset(): void;
113
+ sort(): V;
114
+ toSorted(): V;
115
115
  }
116
116
  export default Range;
117
117
  export { Range };
118
- //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/range/component.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,MAAM,EAEP,MAAM,iBAAiB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;;CAKA,AACA;;;;CAKA,AACA;;;;;;CAOA,AACA,OAAO;;;;CAKP,AACA,SAAS;CAET,UACU,OAAO;CAEjB,UACU,UAAU,WAAW;CAE/B,AACA;CAEA,UAAU,SAAS;CACnB,QAAQ;CAER,IAAI,SAAS,mBAAmB,QAAQ;;;;CAOxC,IAAI;;;;CAOJ,SAASA,aAAa;CAStB,yBAAyBC,cAAcC,qBAAqBC;CAO5D,IAAI,kBAAkB;CAItB,UAAU,UAAU,eAAe;CAyBnC,UAAU,cAAcC,gBAAgB,eAAe;CAkBvD,QAAQ;;;;;CAMR,YAAYA;;;;CAiBZ;;;;;;CAUA,UAAU,mBAAmBA,iBACnBC,GAAG;;;;;;CAqBb,UAAU,gBAAgBD,iBAChBE,GAAG;;;;;;CAWb,UAAU,eAAeF,iBACfG;;;;;CAgBV,UAAU,cAAc,EAAE,SAAS,SAAqB,EAAV;;;;;;CAU9C,UAAU,qBAAqBD,GAAG;;;;;;CAoBlC,UAAU,wBAAwBE,oBAAoBC,yBAC5CH,GAAG;;;;;;CAkBb,UAAU,wBAAwBI,WAAWC,6BACnCL,GAAG;CASb,UAAU;CAcV;CAIA,QAAQ;CAIR,YAAY;AAMb;AAED,eAAe;AACf,SAAS","names":["len: number","name: string","_old: string | null","value: string | null","index: number","e: KeyboardEvent","e: MouseEvent","value: number","mouseMoveCallback: (arg0: number) => void","arg0: number","callback: (newValue: number) => void","newValue: number"],"sources":["../../../src/web-components/range/component.ts"],"sourcesContent":["import {\n attr,\n tokenList,\n godown,\n isNullable,\n joinDeclarations,\n loop,\n queryPart,\n styles,\n Ranger,\n omit,\n} from \"@godown/element\";\nimport { type TemplateResult, css, html } from \"lit\";\nimport { property, queryAll, state } from \"lit/decorators.js\";\n\nimport { cssGlobalVars, scopePrefix } from \"../../internal/global-style.js\";\nimport { SuperInput } from \"../../internal/super-input.js\";\nimport { ringTypeAttribute } from \"../../internal/ring.js\";\n\nconst protoName = \"range\";\nconst cssScope = scopePrefix(protoName);\n\ntype RangeValue = number | number[];\n\n/**\n * {@linkcode Range} is similar to `<input type=\"range\">`.\n *\n * Value accepts number, or array.\n *\n * Number has 1 handle, the array has the number of its elements.\n *\n * @fires range - Fires when the value changes.\n * @category input\n */\n@godown(protoName)\n@styles(\n css`\n :host {\n ${cssScope}--track-width: .5em;\n ${cssScope}--handle-scale: 1;\n ${cssScope}--track-background: var(${cssGlobalVars.active});\n background: var(${cssGlobalVars.passive});\n width: 100%;\n display: block;\n height: var(${cssScope}--track-width);\n }\n\n :host([contents]) [part=\"root\"] {\n width: inherit;\n }\n\n :host([vertical]) {\n height: 100%;\n width: fit-content;\n }\n\n [part=\"root\"] {\n min-height: inherit;\n position: relative;\n border-radius: inherit;\n --from: 0%;\n --to: 50%;\n }\n\n [part=\"track\"] {\n height: 100%;\n min-height: inherit;\n display: flex;\n position: absolute;\n pointer-events: none;\n border-radius: inherit;\n justify-content: space-between;\n left: min(var(--from), var(--to));\n background: var(${cssScope}--track-background);\n width: max(calc(var(--to) - var(--from)), calc(var(--from) - var(--to)));\n }\n\n [part~=\"handle\"] {\n width: 1em;\n height: 1em;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n position: absolute;\n border-radius: 50%;\n transform-origin: 0% 25%;\n outline: 0;\n border-style: solid;\n border-width: 0.1em;\n transform: scale(var(${cssScope}--handle-scale)) translate(-50%, -25%);\n background: var(${cssGlobalVars.background});\n border-color: currentColor;\n }\n `,\n css`\n [vertical] {\n height: inherit;\n width: var(${cssScope}--track-width);\n }\n\n [vertical] i {\n transform: translate(-25%, -50%);\n }\n\n [vertical] [part=\"track\"] {\n width: 100%;\n height: max(calc(var(--to) - var(--from)), calc(var(--from) - var(--to)));\n top: min(var(--from), var(--to));\n left: 0;\n }\n `,\n css`\n [part~=\"handle\"] {\n left: var(--handle);\n top: 0;\n }\n\n [vertical] [part~=\"handle\"] {\n top: var(--handle);\n left: 0;\n }\n `,\n)\nclass Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {\n /**\n * Minimum value.\n */\n @property({ type: Number })\n min = 0;\n\n /**\n * Maximum value.\n */\n @property({ type: Number })\n max = 100;\n\n /**\n * Sliding step length.\n */\n @property({ type: Number })\n step: number;\n\n /**\n * Whether to display the range vertically.\n */\n @property({ type: Boolean, reflect: true })\n vertical = false;\n\n /**\n * Value, or each of values, will render a handle.\n *\n * Accepts number or array of numbers.\n */\n @property({ type: Array })\n value: V;\n\n /**\n * The default of `{@linkcode this.value}`.\n */\n @property({ type: Array })\n default: V;\n\n @queryPart(\"root\")\n protected _root: HTMLElement;\n\n @queryAll(\"[part=handle]\")\n protected _handles: NodeListOf<HTMLElement>;\n\n @state()\n lastFocus?: number;\n\n protected _ranger: Ranger;\n private __focusStack: number[] = [];\n\n get range(): V extends number ? false : true {\n return Array.isArray(this.value) as any;\n }\n\n /**\n * Return values in the form of an array.\n */\n get rangeValue(): number[] {\n return (this.range ? this.value : [this.value]) as number[];\n }\n\n /**\n * Pad the value to the specified length.\n */\n padValue(len: number, value = 0): number[] {\n const { rangeValue } = this;\n const miss = len - rangeValue.length;\n if (miss > 0) {\n return new Array(miss).fill(value).concat(rangeValue);\n }\n return rangeValue;\n }\n\n attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n super.attributeChangedCallback(name, _old, value);\n if (name === \"max\" || name === \"min\" || name === \"step\") {\n this._ranger = new Ranger(this.min, this.max, this.step);\n }\n }\n\n get observedRecord(): Record<string, any> {\n return omit(super.observedRecord, ringTypeAttribute);\n }\n\n protected render(): TemplateResult<1> {\n const rangeValue = this.padValue(2);\n const from = Math.min(...rangeValue);\n const to = Math.max(...rangeValue);\n const gap = this._ranger.diff;\n\n return html`\n <div\n part=\"root\"\n ${attr(this.observedRecord)}\n @mousedown=\"${this.disabled ? null : this._handleMousedownRoot}\"\n style=\"${joinDeclarations([\n [\"--from\", `${((from - this.min) / gap) * 100}%`],\n [\"--to\", `${((to - this.min) / gap) * 100}%`],\n ...rangeValue.map(\n (value, index) => [`--handle-${index}`, `${((value - this.min) / gap) * 100}%`] as [string, string],\n ),\n ])}\"\n >\n <div part=\"track\"></div>\n ${loop(this.rangeValue.length, (index) => this._renderHandle(index))}\n </div>\n `;\n }\n\n protected _renderHandle(index: number): TemplateResult<1> {\n const { disabled, range, rangeValue } = this;\n\n // in single-handle mod (value is a number or an array with length 1),\n const end = !range || (range && index === rangeValue.length - 1 && rangeValue.length === 1);\n return html`\n <i\n tabindex=\"0\"\n part=\"${tokenList(\"handle\", `handle-${index}`)}\"\n @mousedown=\"${disabled ? null : this.createMouseDown(index)}\"\n style=\"${joinDeclarations({\n \"z-index\": this.__focusStack.indexOf(index) + 1,\n \"--handle\": `var(--${end ? \"to\" : `handle-${index}`})`,\n })}\"\n ></i>\n `;\n }\n\n private __keydownEvent: EventListenerOrEventListenerObject;\n\n /**\n * Focuses the handle at the given index, updates the focus stack.\n * @param index - The index of the handle to focus.\n */\n focusHandle(index: number): void {\n this.lastFocus = index;\n const indexOfFocusStack = this.__focusStack.indexOf(index);\n if (indexOfFocusStack !== -1) {\n this.__focusStack.splice(indexOfFocusStack, 1);\n }\n this.__focusStack.push(index);\n const handleItem = this._handles.item(index);\n handleItem?.focus();\n if (!this.__keydownEvent) {\n this.__keydownEvent = this.events.add(document, \"keydown\", this.createKeydownEvent(index));\n }\n }\n\n /**\n * Removes the focus from the currently focused handle.\n */\n blurHandle(): void {\n this.lastFocus = undefined;\n this.__keydownEvent = this.events.remove(document, \"keydown\", this.__keydownEvent);\n }\n\n /**\n * Creates a keydown event handler that updates the value of the range based on arrow key presses.\n * @param index - The index of the handle to update.\n * @returns A function that handles the keydown event and updates the range value.\n */\n protected createKeydownEvent(index: number) {\n return (e: KeyboardEvent): void => {\n const { rangeValue, step } = this;\n if (rangeValue.length < 2) {\n index = 0;\n }\n const old = rangeValue[index];\n if (e.key === \"ArrowLeft\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n this.createSetValue(index)(old - step);\n } else if (e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.createSetValue(index)(old + step);\n }\n };\n }\n\n /**\n * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.\n * @param index - The index of the handle to focus.\n * @returns A function that handles the mouse down event and updates the range value.\n */\n protected createMouseDown(index: number) {\n return (e: MouseEvent): void => {\n this.focusHandle(index);\n this.createMousedownListener(this.createSetValue(index))(e);\n };\n }\n\n /**\n * Creates a function that sets the value of the range at the given index.\n * @param index - The index of the value to set.\n * @returns A function that sets the value of the range.\n */\n protected createSetValue(index: number) {\n return (value: number): void => {\n const normalizeValue = this._ranger.normalize(value);\n let newValue: RangeValue = normalizeValue;\n if (this.range) {\n newValue = [...(this.value as number[])];\n newValue[index] = normalizeValue;\n }\n this.value = newValue as V;\n this.dispatchCustomEvent(\"change\", this.value);\n };\n }\n\n /**\n * Compute value from event.\n * @returns The value closest to the event client position.\n */\n protected _computeValue({ clientX, clientY }: MouseEvent): number {\n const { top, left, height, width } = this._root.getBoundingClientRect();\n return this._ranger.present(this.vertical ? (clientY - top) / height : (clientX - left) / width);\n }\n\n /**\n * Handles the mouse down event on the root element of the range component.\n * Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle.\n * @param e - The mouse down event object.\n */\n protected _handleMousedownRoot(e: MouseEvent): void {\n const value = this._computeValue(e);\n const index = this.range\n ? this.rangeValue.reduce((acc, item, index) => {\n const diff = Math.abs(value - item);\n const prevDiff = Math.abs(value - this.rangeValue[acc]);\n return diff < prevDiff ? index : acc;\n }, 0)\n : 0;\n\n const set = this.createSetValue(index);\n set(value);\n this.createMousedownListener(set)(e);\n this.focusHandle(index);\n }\n /**\n * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.\n * @param index - The index of the handle to focus.\n * @returns A function that handles the mouse down event and updates the range value.\n */\n protected createMousedownListener(mouseMoveCallback: (arg0: number) => void) {\n return (e: MouseEvent): void => {\n e.preventDefault();\n e.stopPropagation();\n const move = this.createMousemoveListener(mouseMoveCallback);\n this.events.add(document, \"mousemove\", move);\n const stop = () => {\n this.events.remove(document, \"mousemove\", move);\n this.events.remove(document, \"mouseup\", stop);\n };\n this.events.add(document, \"mouseup\", stop);\n };\n }\n\n /**\n * Creates a mouse move event handler that updates the range value based on the mouse position.\n * @param callback - A function to call with the new value when the mouse is moved.\n * @returns A function that handles the mouse move event and updates the range value.\n */\n protected createMousemoveListener(callback: (newValue: number) => void) {\n return (e: MouseEvent): void => {\n const value = this._computeValue(e);\n if (value !== this._ranger.restrict(value)) {\n return;\n }\n callback?.call(this, value);\n };\n }\n\n protected _connectedInit(): void {\n this._ranger = new Ranger(this.min, this.max, this.step);\n const gap = this._ranger.diff;\n this.step ||= gap / 100;\n if (isNullable(this.value)) {\n if (!isNullable(this.default)) {\n this.value = this.default;\n } else {\n (this.value as number) = Math.round(gap / 2 / this.step) * this.step;\n }\n }\n this.default ??= this.value;\n }\n\n reset(): void {\n this.value = this.default;\n }\n\n sort(): V {\n return (this.value = this.toSorted());\n }\n\n toSorted(): V {\n if (this.range) {\n return [...(this.value as number[])].sort((a, b) => a - b) as V;\n }\n return this.value;\n }\n}\n\nexport default Range;\nexport { Range };\n"],"version":3,"file":"component.d.ts"}
@@ -1,2 +1,2 @@
1
- import{__decorate as t}from"tslib";import{queryPart as e,godown as r,styles as a,Ranger as o,omit as s,attr as i,joinDeclarations as n,loop as h,tokenList as l,isNullable as d}from"@godown/element";import{css as u,html as c}from"lit";import{property as v,queryAll as p,state as m}from"lit/decorators.js";import{scopePrefix as g,cssGlobalVars as f}from"../../internal/global-style.js";import{SuperInput as w}from"../../internal/super-input.js";import{ringTypeAttribute as y}from"../../internal/ring.js";const _="range",k=g(_);let b=class Range extends w{constructor(){super(...arguments),this.min=0,this.max=100,this.vertical=!1,this.__focusStack=[]}get range(){return Array.isArray(this.value)}get rangeValue(){return this.range?this.value:[this.value]}padValue(t,e=0){const{rangeValue:r}=this,a=t-r.length;return a>0?new Array(a).fill(e).concat(r):r}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r),"max"!==t&&"min"!==t&&"step"!==t||(this._ranger=new o(this.min,this.max,this.step))}get observedRecord(){return s(super.observedRecord,y)}render(){const t=this.padValue(2),e=Math.min(...t),r=Math.max(...t),a=this._ranger.diff;return c`<div part="root" ${i(this.observedRecord)} @mousedown="${this.disabled?null:this._handleMousedownRoot}" style="${n([["--from",(e-this.min)/a*100+"%"],["--to",(r-this.min)/a*100+"%"],...t.map(((t,e)=>[`--handle-${e}`,(t-this.min)/a*100+"%"]))])}"> <div part="track"></div> ${h(this.rangeValue.length,(t=>this._renderHandle(t)))} </div>`}_renderHandle(t){const{disabled:e,range:r,rangeValue:a}=this,o=!r||r&&t===a.length-1&&1===a.length;return c`<i tabindex="0" part="${l("handle",`handle-${t}`)}" @mousedown="${e?null:this.createMouseDown(t)}" style="${n({"z-index":this.__focusStack.indexOf(t)+1,"--handle":`var(--${o?"to":`handle-${t}`})`})}"></i>`}focusHandle(t){this.lastFocus=t;const e=this.__focusStack.indexOf(t);-1!==e&&this.__focusStack.splice(e,1),this.__focusStack.push(t);const r=this._handles.item(t);r?.focus(),this.__keydownEvent||(this.__keydownEvent=this.events.add(document,"keydown",this.createKeydownEvent(t)))}blurHandle(){this.lastFocus=void 0,this.__keydownEvent=this.events.remove(document,"keydown",this.__keydownEvent)}createKeydownEvent(t){return e=>{const{rangeValue:r,step:a}=this;r.length<2&&(t=0);const o=r[t];"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),this.createSetValue(t)(o-a)):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),this.createSetValue(t)(o+a))}}createMouseDown(t){return e=>{this.focusHandle(t),this.createMousedownListener(this.createSetValue(t))(e)}}createSetValue(t){return e=>{const r=this._ranger.normalize(e);let a=r;this.range&&(a=[...this.value],a[t]=r),this.value=a,this.dispatchCustomEvent("change",this.value)}}_computeValue({clientX:t,clientY:e}){const{top:r,left:a,height:o,width:s}=this._root.getBoundingClientRect();return this._ranger.present(this.vertical?(e-r)/o:(t-a)/s)}_handleMousedownRoot(t){const e=this._computeValue(t),r=this.range?this.rangeValue.reduce(((t,r,a)=>Math.abs(e-r)<Math.abs(e-this.rangeValue[t])?a:t),0):0,a=this.createSetValue(r);a(e),this.createMousedownListener(a)(t),this.focusHandle(r)}createMousedownListener(t){return e=>{e.preventDefault(),e.stopPropagation();const r=this.createMousemoveListener(t);this.events.add(document,"mousemove",r);const a=()=>{this.events.remove(document,"mousemove",r),this.events.remove(document,"mouseup",a)};this.events.add(document,"mouseup",a)}}createMousemoveListener(t){return e=>{const r=this._computeValue(e);r===this._ranger.restrict(r)&&t?.call(this,r)}}_connectedInit(){this._ranger=new o(this.min,this.max,this.step);const t=this._ranger.diff;this.step||=t/100,d(this.value)&&(d(this.default)?this.value=Math.round(t/2/this.step)*this.step:this.value=this.default),this.default??=this.value}reset(){this.value=this.default}sort(){return this.value=this.toSorted()}toSorted(){return this.range?[...this.value].sort(((t,e)=>t-e)):this.value}};t([v({type:Number})],b.prototype,"min",void 0),t([v({type:Number})],b.prototype,"max",void 0),t([v({type:Number})],b.prototype,"step",void 0),t([v({type:Boolean,reflect:!0})],b.prototype,"vertical",void 0),t([v({type:Array})],b.prototype,"value",void 0),t([v({type:Array})],b.prototype,"default",void 0),t([e("root")],b.prototype,"_root",void 0),t([p("[part=handle]")],b.prototype,"_handles",void 0),t([m()],b.prototype,"lastFocus",void 0),b=t([r(_),a(u`:host{${k}--track-width:.5em;${k}--handle-scale:1;${k}--track-background:var(${f.active});background:var(${f.passive});display:block;height:var(${k}--track-width);width:100%}:host([contents]) [part=root]{width:inherit}:host([vertical]){height:100%;width:-moz-fit-content;width:fit-content}[part=root]{position:relative;--from:0%;--to:50%}[part=root],[part=track]{border-radius:inherit;min-height:inherit}[part=track]{background:var(${k}--track-background);height:100%;justify-content:space-between;left:min(var(--from),var(--to));pointer-events:none;width:max(calc(var(--to) - var(--from)),calc(var(--from) - var(--to)))}[part=track],[part~=handle]{display:flex;position:absolute}[part~=handle]{align-items:center;background:var(${f.background});border:.1em solid;border-radius:50%;height:1em;justify-content:center;outline:0;transform:scale(var(${k}--handle-scale)) translate(-50%,-25%);transform-origin:0 25%;-webkit-user-select:none;user-select:none;width:1em}`,u`[vertical]{height:inherit;width:var(${k}--track-width)}[vertical] i{transform:translate(-25%,-50%)}[vertical] [part=track]{height:max(calc(var(--to) - var(--from)),calc(var(--from) - var(--to)));left:0;top:min(var(--from),var(--to));width:100%}`,u`[part~=handle]{left:var(--handle);top:0}[vertical] [part~=handle]{left:0;top:var(--handle)}`)],b);var $=b;export{b as Range,$ as default};
1
+ import{queryPart,godown,styles,Ranger,omit,attr,joinDeclarations,loop,tokenList,isNullable}from"@godown/element";import{css,html}from"lit";import{property,queryAll,state}from"lit/decorators.js";import{scopePrefix,cssGlobalVars}from"../../internal/global-style.js";import{SuperInput}from"../../internal/super-input.js";import{ringTypeAttribute}from"../../internal/ring.js";import _decorate from"@oxc-project/runtime/helpers/decorate";const protoName=`range`,cssScope=scopePrefix(protoName);let Range=class e extends SuperInput{constructor(...e){super(...e),this.min=0,this.max=100,this.vertical=!1,this.__focusStack=[]}get range(){return Array.isArray(this.value)}get rangeValue(){return this.range?this.value:[this.value]}padValue(e,y=0){let{rangeValue:b}=this,x=e-b.length;return x>0?Array(x).fill(y).concat(b):b}attributeChangedCallback(e,y,b){super.attributeChangedCallback(e,y,b),(e===`max`||e===`min`||e===`step`)&&(this._ranger=new Ranger(this.min,this.max,this.step))}get observedRecord(){return omit(super.observedRecord,ringTypeAttribute)}render(){let e=this.padValue(2),y=Math.min(...e),b=Math.max(...e),x=this._ranger.diff;return html`<div part="root" ${attr(this.observedRecord)} @mousedown="${this.disabled?null:this._handleMousedownRoot}" style="${joinDeclarations([[`--from`,`${(y-this.min)/x*100}%`],[`--to`,`${(b-this.min)/x*100}%`],...e.map((e,y)=>[`--handle-${y}`,`${(e-this.min)/x*100}%`])])}"> <div part="track"></div> ${loop(this.rangeValue.length,e=>this._renderHandle(e))} </div>`}_renderHandle(e){let{disabled:y,range:b,rangeValue:x}=this,S=!b||b&&e===x.length-1&&x.length===1;return html`<i tabindex="0" part="${tokenList(`handle`,`handle-${e}`)}" @mousedown="${y?null:this.createMouseDown(e)}" style="${joinDeclarations({"z-index":this.__focusStack.indexOf(e)+1,"--handle":`var(--${S?`to`:`handle-${e}`})`})}"></i>`}focusHandle(e){this.lastFocus=e;let y=this.__focusStack.indexOf(e);y!==-1&&this.__focusStack.splice(y,1),this.__focusStack.push(e);let b=this._handles.item(e);b?.focus(),this.__keydownEvent||=this.events.add(document,`keydown`,this.createKeydownEvent(e))}blurHandle(){this.lastFocus=void 0,this.__keydownEvent=this.events.remove(document,`keydown`,this.__keydownEvent)}createKeydownEvent(e){return y=>{let{rangeValue:b,step:x}=this;b.length<2&&(e=0);let S=b[e];y.key===`ArrowLeft`||y.key===`ArrowDown`?(y.preventDefault(),this.createSetValue(e)(S-x)):(y.key===`ArrowRight`||y.key===`ArrowUp`)&&(y.preventDefault(),this.createSetValue(e)(S+x))}}createMouseDown(e){return y=>{this.focusHandle(e),this.createMousedownListener(this.createSetValue(e))(y)}}createSetValue(e){return y=>{let b=this._ranger.normalize(y),x=b;this.range&&(x=[...this.value],x[e]=b),this.value=x,this.dispatchCustomEvent(`change`,this.value)}}_computeValue({clientX:e,clientY:y}){let{top:b,left:x,height:S,width:C}=this._root.getBoundingClientRect();return this._ranger.present(this.vertical?(y-b)/S:(e-x)/C)}_handleMousedownRoot(e){let y=this._computeValue(e),b=this.range?this.rangeValue.reduce((e,b,x)=>{let S=Math.abs(y-b),C=Math.abs(y-this.rangeValue[e]);return S<C?x:e},0):0,x=this.createSetValue(b);x(y),this.createMousedownListener(x)(e),this.focusHandle(b)}createMousedownListener(e){return y=>{y.preventDefault(),y.stopPropagation();let b=this.createMousemoveListener(e);this.events.add(document,`mousemove`,b);let x=()=>{this.events.remove(document,`mousemove`,b),this.events.remove(document,`mouseup`,x)};this.events.add(document,`mouseup`,x)}}createMousemoveListener(e){return y=>{let b=this._computeValue(y);b===this._ranger.restrict(b)&&e?.call(this,b)}}_connectedInit(){this._ranger=new Ranger(this.min,this.max,this.step);let e=this._ranger.diff;this.step||=e/100,isNullable(this.value)&&(isNullable(this.default)?this.value=Math.round(e/2/this.step)*this.step:this.value=this.default),this.default??=this.value}reset(){this.value=this.default}sort(){return this.value=this.toSorted()}toSorted(){return this.range?[...this.value].sort((e,y)=>e-y):this.value}};_decorate([property({type:Number})],Range.prototype,`min`,void 0),_decorate([property({type:Number})],Range.prototype,`max`,void 0),_decorate([property({type:Number})],Range.prototype,`step`,void 0),_decorate([property({type:Boolean,reflect:!0})],Range.prototype,`vertical`,void 0),_decorate([property({type:Array})],Range.prototype,`value`,void 0),_decorate([property({type:Array})],Range.prototype,`default`,void 0),_decorate([queryPart(`root`)],Range.prototype,`_root`,void 0),_decorate([queryAll(`[part=handle]`)],Range.prototype,`_handles`,void 0),_decorate([state()],Range.prototype,`lastFocus`,void 0),Range=_decorate([godown(protoName),styles(css`:host{${cssScope}--track-width:.5em;${cssScope}--handle-scale:1;${cssScope}--track-background:var(${cssGlobalVars.active});background:var(${cssGlobalVars.passive});width:100%;display:block;height:var(${cssScope}--track-width)}:host([contents]) [part=root]{width:inherit}:host([vertical]){height:100%;width:-moz-fit-content;width:fit-content}[part=root]{min-height:inherit;position:relative;border-radius:inherit;--from:0%;--to:50%}[part=track]{height:100%;min-height:inherit;display:flex;position:absolute;pointer-events:none;border-radius:inherit;justify-content:space-between;left:min(var(--from),var(--to));background:var(${cssScope}--track-background);width:max(calc(var(--to) - var(--from)),calc(var(--from) - var(--to)))}[part~=handle]{width:1em;height:1em;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;position:absolute;border-radius:50%;transform-origin:0 25%;outline:0;border-style:solid;border-width:.1em;transform:scale(var(${cssScope}--handle-scale)) translate(-50%,-25%);background:var(${cssGlobalVars.background});border-color:currentColor}`,css`[vertical]{height:inherit;width:var(${cssScope}--track-width)}[vertical] i{transform:translate(-25%,-50%)}[vertical] [part=track]{width:100%;height:max(calc(var(--to) - var(--from)),calc(var(--from) - var(--to)));top:min(var(--from),var(--to));left:0}`,css`[part~=handle]{left:var(--handle);top:0}[vertical] [part~=handle]{top:var(--handle);left:0} `)],Range);var Range$1=Range;export{Range,Range$1 as default};
2
2
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../src/web-components/range/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Range","SuperInput","constructor","this","min","max","vertical","__focusStack","range","Array","isArray","value","rangeValue","padValue","len","miss","length","fill","concat","attributeChangedCallback","name","_old","super","_ranger","Ranger","step","observedRecord","omit","ringTypeAttribute","render","from","Math","to","gap","diff","html","attr","disabled","_handleMousedownRoot","joinDeclarations","map","index","loop","_renderHandle","end","lastFocus","splice","indexOfFocusStack","push","handleItem","_handles","item","focus","__keydownEvent","blurHandle","undefined","events","remove","document","e","key","preventDefault","createSetValue","old","focusHandle","createMousedownListener","newValue","normalizeValue","dispatchCustomEvent","_computeValue","clientX","clientY","top","left","height","width","_root","getBoundingClientRect","present","reduce","acc","abs","set","mouseMoveCallback","stopPropagation","move","createMousemoveListener","add","stop","callback","call","round","reset","default","sort","toSorted","a","b","type","Number","prototype","property","Boolean","reflect","__decorate","queryPart","queryAll","state","godown","styles","css","cssGlobalVars","active","passive","background","Range$1"],"mappings":"sfAmBA,MAAMA,EAAY,QACZC,EAAWC,EAAYF,GAwG7B,IAAMG,EAAN,MAAMA,cAAiDC,EAAvD,WAAAC,uBAKEC,KAAGC,IAAG,EAMND,KAAGE,IAAG,IAYNF,KAAQG,UAAG,EA0BHH,KAAYI,aAAa,GAEjC,SAAIC,GACF,OAAOC,MAAMC,QAAQP,KAAKQ,OAM5B,cAAIC,GACF,OAAQT,KAAKK,MAAQL,KAAKQ,MAAQ,CAACR,KAAKQ,OAM1C,QAAAE,CAASC,EAAaH,EAAQ,GAC5B,MAAMC,WAAEA,GAAeT,KACjBY,E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AAAG,mHAAApH,qHAAAgH,CAAA,uCAAAhH,gNAAAgH,CAAA,gGADC9G,GACQ,IAAAmH,EAAAnH"}
1
+ {"version":3,"file":"component.js","sources":["../../src/web-components/range/component.ts"],"sourcesContent":["import {\n attr,\n tokenList,\n godown,\n isNullable,\n joinDeclarations,\n loop,\n queryPart,\n styles,\n Ranger,\n omit,\n} from \"@godown/element\";\nimport { type TemplateResult, css, html } from \"lit\";\nimport { property, queryAll, state } from \"lit/decorators.js\";\n\nimport { cssGlobalVars, scopePrefix } from \"../../internal/global-style.js\";\nimport { SuperInput } from \"../../internal/super-input.js\";\nimport { ringTypeAttribute } from \"../../internal/ring.js\";\n\nconst protoName = \"range\";\nconst cssScope = scopePrefix(protoName);\n\ntype RangeValue = number | number[];\n\n/**\n * {@linkcode Range} is similar to `<input type=\"range\">`.\n *\n * Value accepts number, or array.\n *\n * Number has 1 handle, the array has the number of its elements.\n *\n * @fires range - Fires when the value changes.\n * @category input\n */\n@godown(protoName)\n@styles(\n css`\n :host {\n ${cssScope}--track-width: .5em;\n ${cssScope}--handle-scale: 1;\n ${cssScope}--track-background: var(${cssGlobalVars.active});\n background: var(${cssGlobalVars.passive});\n width: 100%;\n display: block;\n height: var(${cssScope}--track-width);\n }\n\n :host([contents]) [part=\"root\"] {\n width: inherit;\n }\n\n :host([vertical]) {\n height: 100%;\n width: fit-content;\n }\n\n [part=\"root\"] {\n min-height: inherit;\n position: relative;\n border-radius: inherit;\n --from: 0%;\n --to: 50%;\n }\n\n [part=\"track\"] {\n height: 100%;\n min-height: inherit;\n display: flex;\n position: absolute;\n pointer-events: none;\n border-radius: inherit;\n justify-content: space-between;\n left: min(var(--from), var(--to));\n background: var(${cssScope}--track-background);\n width: max(calc(var(--to) - var(--from)), calc(var(--from) - var(--to)));\n }\n\n [part~=\"handle\"] {\n width: 1em;\n height: 1em;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n position: absolute;\n border-radius: 50%;\n transform-origin: 0% 25%;\n outline: 0;\n border-style: solid;\n border-width: 0.1em;\n transform: scale(var(${cssScope}--handle-scale)) translate(-50%, -25%);\n background: var(${cssGlobalVars.background});\n border-color: currentColor;\n }\n `,\n css`\n [vertical] {\n height: inherit;\n width: var(${cssScope}--track-width);\n }\n\n [vertical] i {\n transform: translate(-25%, -50%);\n }\n\n [vertical] [part=\"track\"] {\n width: 100%;\n height: max(calc(var(--to) - var(--from)), calc(var(--from) - var(--to)));\n top: min(var(--from), var(--to));\n left: 0;\n }\n `,\n css`\n [part~=\"handle\"] {\n left: var(--handle);\n top: 0;\n }\n\n [vertical] [part~=\"handle\"] {\n top: var(--handle);\n left: 0;\n }\n `,\n)\nclass Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {\n /**\n * Minimum value.\n */\n @property({ type: Number })\n min = 0;\n\n /**\n * Maximum value.\n */\n @property({ type: Number })\n max = 100;\n\n /**\n * Sliding step length.\n */\n @property({ type: Number })\n step: number;\n\n /**\n * Whether to display the range vertically.\n */\n @property({ type: Boolean, reflect: true })\n vertical = false;\n\n /**\n * Value, or each of values, will render a handle.\n *\n * Accepts number or array of numbers.\n */\n @property({ type: Array })\n value: V;\n\n /**\n * The default of `{@linkcode this.value}`.\n */\n @property({ type: Array })\n default: V;\n\n @queryPart(\"root\")\n protected _root: HTMLElement;\n\n @queryAll(\"[part=handle]\")\n protected _handles: NodeListOf<HTMLElement>;\n\n @state()\n lastFocus?: number;\n\n protected _ranger: Ranger;\n private __focusStack: number[] = [];\n\n get range(): V extends number ? false : true {\n return Array.isArray(this.value) as any;\n }\n\n /**\n * Return values in the form of an array.\n */\n get rangeValue(): number[] {\n return (this.range ? this.value : [this.value]) as number[];\n }\n\n /**\n * Pad the value to the specified length.\n */\n padValue(len: number, value = 0): number[] {\n const { rangeValue } = this;\n const miss = len - rangeValue.length;\n if (miss > 0) {\n return new Array(miss).fill(value).concat(rangeValue);\n }\n return rangeValue;\n }\n\n attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n super.attributeChangedCallback(name, _old, value);\n if (name === \"max\" || name === \"min\" || name === \"step\") {\n this._ranger = new Ranger(this.min, this.max, this.step);\n }\n }\n\n get observedRecord(): Record<string, any> {\n return omit(super.observedRecord, ringTypeAttribute);\n }\n\n protected render(): TemplateResult<1> {\n const rangeValue = this.padValue(2);\n const from = Math.min(...rangeValue);\n const to = Math.max(...rangeValue);\n const gap = this._ranger.diff;\n\n return html`\n <div\n part=\"root\"\n ${attr(this.observedRecord)}\n @mousedown=\"${this.disabled ? null : this._handleMousedownRoot}\"\n style=\"${joinDeclarations([\n [\"--from\", `${((from - this.min) / gap) * 100}%`],\n [\"--to\", `${((to - this.min) / gap) * 100}%`],\n ...rangeValue.map(\n (value, index) => [`--handle-${index}`, `${((value - this.min) / gap) * 100}%`] as [string, string],\n ),\n ])}\"\n >\n <div part=\"track\"></div>\n ${loop(this.rangeValue.length, (index) => this._renderHandle(index))}\n </div>\n `;\n }\n\n protected _renderHandle(index: number): TemplateResult<1> {\n const { disabled, range, rangeValue } = this;\n\n // in single-handle mod (value is a number or an array with length 1),\n const end = !range || (range && index === rangeValue.length - 1 && rangeValue.length === 1);\n return html`\n <i\n tabindex=\"0\"\n part=\"${tokenList(\"handle\", `handle-${index}`)}\"\n @mousedown=\"${disabled ? null : this.createMouseDown(index)}\"\n style=\"${joinDeclarations({\n \"z-index\": this.__focusStack.indexOf(index) + 1,\n \"--handle\": `var(--${end ? \"to\" : `handle-${index}`})`,\n })}\"\n ></i>\n `;\n }\n\n private __keydownEvent: EventListenerOrEventListenerObject;\n\n /**\n * Focuses the handle at the given index, updates the focus stack.\n * @param index - The index of the handle to focus.\n */\n focusHandle(index: number): void {\n this.lastFocus = index;\n const indexOfFocusStack = this.__focusStack.indexOf(index);\n if (indexOfFocusStack !== -1) {\n this.__focusStack.splice(indexOfFocusStack, 1);\n }\n this.__focusStack.push(index);\n const handleItem = this._handles.item(index);\n handleItem?.focus();\n if (!this.__keydownEvent) {\n this.__keydownEvent = this.events.add(document, \"keydown\", this.createKeydownEvent(index));\n }\n }\n\n /**\n * Removes the focus from the currently focused handle.\n */\n blurHandle(): void {\n this.lastFocus = undefined;\n this.__keydownEvent = this.events.remove(document, \"keydown\", this.__keydownEvent);\n }\n\n /**\n * Creates a keydown event handler that updates the value of the range based on arrow key presses.\n * @param index - The index of the handle to update.\n * @returns A function that handles the keydown event and updates the range value.\n */\n protected createKeydownEvent(index: number) {\n return (e: KeyboardEvent): void => {\n const { rangeValue, step } = this;\n if (rangeValue.length < 2) {\n index = 0;\n }\n const old = rangeValue[index];\n if (e.key === \"ArrowLeft\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n this.createSetValue(index)(old - step);\n } else if (e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.createSetValue(index)(old + step);\n }\n };\n }\n\n /**\n * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.\n * @param index - The index of the handle to focus.\n * @returns A function that handles the mouse down event and updates the range value.\n */\n protected createMouseDown(index: number) {\n return (e: MouseEvent): void => {\n this.focusHandle(index);\n this.createMousedownListener(this.createSetValue(index))(e);\n };\n }\n\n /**\n * Creates a function that sets the value of the range at the given index.\n * @param index - The index of the value to set.\n * @returns A function that sets the value of the range.\n */\n protected createSetValue(index: number) {\n return (value: number): void => {\n const normalizeValue = this._ranger.normalize(value);\n let newValue: RangeValue = normalizeValue;\n if (this.range) {\n newValue = [...(this.value as number[])];\n newValue[index] = normalizeValue;\n }\n this.value = newValue as V;\n this.dispatchCustomEvent(\"change\", this.value);\n };\n }\n\n /**\n * Compute value from event.\n * @returns The value closest to the event client position.\n */\n protected _computeValue({ clientX, clientY }: MouseEvent): number {\n const { top, left, height, width } = this._root.getBoundingClientRect();\n return this._ranger.present(this.vertical ? (clientY - top) / height : (clientX - left) / width);\n }\n\n /**\n * Handles the mouse down event on the root element of the range component.\n * Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle.\n * @param e - The mouse down event object.\n */\n protected _handleMousedownRoot(e: MouseEvent): void {\n const value = this._computeValue(e);\n const index = this.range\n ? this.rangeValue.reduce((acc, item, index) => {\n const diff = Math.abs(value - item);\n const prevDiff = Math.abs(value - this.rangeValue[acc]);\n return diff < prevDiff ? index : acc;\n }, 0)\n : 0;\n\n const set = this.createSetValue(index);\n set(value);\n this.createMousedownListener(set)(e);\n this.focusHandle(index);\n }\n /**\n * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.\n * @param index - The index of the handle to focus.\n * @returns A function that handles the mouse down event and updates the range value.\n */\n protected createMousedownListener(mouseMoveCallback: (arg0: number) => void) {\n return (e: MouseEvent): void => {\n e.preventDefault();\n e.stopPropagation();\n const move = this.createMousemoveListener(mouseMoveCallback);\n this.events.add(document, \"mousemove\", move);\n const stop = () => {\n this.events.remove(document, \"mousemove\", move);\n this.events.remove(document, \"mouseup\", stop);\n };\n this.events.add(document, \"mouseup\", stop);\n };\n }\n\n /**\n * Creates a mouse move event handler that updates the range value based on the mouse position.\n * @param callback - A function to call with the new value when the mouse is moved.\n * @returns A function that handles the mouse move event and updates the range value.\n */\n protected createMousemoveListener(callback: (newValue: number) => void) {\n return (e: MouseEvent): void => {\n const value = this._computeValue(e);\n if (value !== this._ranger.restrict(value)) {\n return;\n }\n callback?.call(this, value);\n };\n }\n\n protected _connectedInit(): void {\n this._ranger = new Ranger(this.min, this.max, this.step);\n const gap = this._ranger.diff;\n this.step ||= gap / 100;\n if (isNullable(this.value)) {\n if (!isNullable(this.default)) {\n this.value = this.default;\n } else {\n (this.value as number) = Math.round(gap / 2 / this.step) * this.step;\n }\n }\n this.default ??= this.value;\n }\n\n reset(): void {\n this.value = this.default;\n }\n\n sort(): V {\n return (this.value = this.toSorted());\n }\n\n toSorted(): V {\n if (this.range) {\n return [...(this.value as number[])].sort((a, b) => a - b) as V;\n }\n return this.value;\n }\n}\n\nexport default Range;\nexport { Range };\n"],"names":["Range","len: number","value","miss","len","rangeValue","name: string","_old: string | null","value: string | null","name","_old","from","to","gap","index","index: number","end","range","disabled","indexOfFocusStack","handleItem","e: KeyboardEvent","old","e","step","e: MouseEvent","value: number","normalizeValue","newValue: RangeValue","newValue","clientY","top","height","clientX","left","width","acc","item","diff","prevDiff","set","mouseMoveCallback: (arg0: number) => void","move","mouseMoveCallback","stop","callback: (newValue: number) => void","a","b"],"mappings":"ibAmBA,MAAM,UAAY,QACZ,SAAW,YAAY,UAAU,CAcvC,IAAA,MAAA,MA0FMA,UAAiD,UAAuB,mBAiDpE,iBA5CR,IAAM,OAMN,IAAM,SAYN,UAAW,EA0BH,KAAA,aAAyB,CAAE,EAEnC,IAAI,OAAyC,CAC3C,MAAO,OAAM,QAAQ,KAAK,MAAM,AACjC,CAKD,IAAI,YAAuB,CACzB,OAAQ,KAAK,MAAQ,KAAK,MAAQ,CAAC,KAAK,KAAM,CAC/C,CAKD,SAASC,EAAaC,EAAQ,EAAa,CACzC,GAAM,CAAE,aAAY,CAAG,KACjBC,EAAOC,EAAMC,EAAW,OAI9B,OAHIF,EAAO,EACF,MAAUA,EAAA,CAAM,KAAKD,EAAM,CAAC,OAAOG,EAAW,CAEhDA,CACR,CAED,yBAAyBC,EAAcC,EAAqBC,EAA4B,CAEtF,AADA,MAAM,yBAAyBC,EAAMC,EAAMR,EAAM,EAC7CO,IAAS,OAASA,IAAS,OAASA,IAAS,UAC/C,KAAK,QAAU,IAAI,OAAO,KAAK,IAAK,KAAK,IAAK,KAAK,MAEtD,CAED,IAAI,gBAAsC,CACxC,MAAO,MAAK,MAAM,eAAgB,kBAAkB,AACrD,CAES,QAA4B,CACpC,IAAMJ,EAAa,KAAK,SAAS,EAAE,CAC7BM,EAAO,KAAK,IAAI,GAAGN,EAAW,CAC9BO,EAAK,KAAK,IAAI,GAAGP,EAAW,CAC5BQ,EAAM,KAAK,QAAQ,KAEzB,MAAO,KAAI,CAAA,iBAGP,EAAE,KAAK,KAAK,eAAe,CAAA,aACf,EAAE,KAAK,SAAW,KAAO,KAAK,qBAAqB,SACxD,EAAE,iBAAiB,CAC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HI,KAAK,MACA,CAAC,GAAI,KAAK,KAAmB,EAAC,KAAK,CAACiC,EAAGC,IAAMD,EAAIC,EAAE,CAErD,KAAK,KACb,CACF,EArYA,WA8FE,SAAS,CAAE,KAAM,MAAQ,EAAC,AAAA,EAAA,MAAA,UAAA,aAAA,YAM1B,SAAS,CAAE,KAAM,MAAQ,EAAC,AAAA,EAAA,MAAA,UAAA,aAAA,YAM1B,SAAS,CAAE,KAAM,MAAQ,EAAC,AAAA,EAAA,MAAA,UAAA,cAAA,YAM1B,SAAS,CAAE,KAAM,QAAS,SAAS,CAAM,EAAC,AAAA,EAAA,MAAA,UAAA,eAAA,GAAA,YAQ1C,SAAS,CAAE,KAAM,KAAO,EAAC,AAAA,EAAA,MAAA,UAAA,eAAA,YAMzB,SAAS,CAAE,KAAM,KAAO,EAAC,AAAA,EAAA,MAAA,UAAA,iBAAA,CAGzB,UAAA,CAAA,UAAU,OAAO,AAAA,EAAA,MAAA,UAAA,eAAA,CAGjB,UAAA,CAAA,SAAS,gBAAgB,AAAA,EAAA,MAAA,UAAA,kBAAA,YAGzB,OAAO,AAAA,EAAA,MAAA,UAAA,mBAAA,CAvIT,MAAA,UAAA,CAAA,OAAO,UAAU,CACjB,OACC,GAAG,CAAC,MAEA,EAAE,SAAS,mBACX,EAAE,SAAS,iBACX,EAAE,SAAS,uBAAwB,EAAE,cAAc,OAAO,iBAC1C,EAAE,cAAc,QAAQ,sCAG5B,EAAE,SAAS,8ZA6BP,EAAE,SAAS,8VAiBN,EAAE,SAAS,qDAChB,EAAE,cAAc,WAAW,4BAG/C,CAAC,CACD,GAAG,CAAC,oCAGW,EAAE,SAAS,4MAa1B,CAAC,CACD,GAAG,CAAC,4FAUJ,CAAC,CACF,AAAA,EAAA,MAAA,CA8SD,IAAA,QAAe"}
@@ -1,8 +1,7 @@
1
1
  import Range from "./component.js";
2
2
  export default Range;
3
3
  declare global {
4
- interface HTMLElementTagNameMap {
5
- "godown-range": Range;
6
- }
4
+ interface HTMLElementTagNameMap {
5
+ "godown-range": Range;
6
+ }
7
7
  }
8
- //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"__source__/","sources":["web-components/range/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AAInC,eAAe,KAAK,CAAC;AAErB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,KAAK,CAAC;KACvB;CACF"}
1
+ {"mappings":"AAAA,OAAO,WAAW,gBAAiB;AAInC,eAAe;eAEA;WACH,sBAAsB;EAC9B,gBAAgB;CACjB;AACF","names":[],"sources":["../../../src/web-components/range/definition.ts"],"sourcesContent":["import Range from \"./component.js\";\n\nRange.define();\n\nexport default Range;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"godown-range\": Range;\n }\n}\n"],"version":3,"file":"definition.d.ts"}
@@ -1,2 +1,2 @@
1
- import e from"./component.js";e.define();export{e as default};
1
+ import Range from"./component.js";Range.define();export{Range as default};
2
2
  //# sourceMappingURL=definition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sources":["../../src/web-components/range/definition.ts"],"sourcesContent":null,"names":["Range","define"],"mappings":"8BAEAA,EAAMC"}
1
+ {"version":3,"file":"definition.js","sources":["../../src/web-components/range/definition.ts"],"sourcesContent":["import Range from \"./component.js\";\n\nRange.define();\n\nexport default Range;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"godown-range\": Range;\n }\n}\n"],"names":[],"mappings":"kCAEA,MAAM,QAAQ"}
@@ -1,30 +1,29 @@
1
1
  import { type TemplateResult } from "lit";
2
2
  import { GlobalStyle } from "../../internal/global-style.js";
3
3
  /**
4
- * {@linkcode Rotate} Make child elements rotate.
5
- *
6
- * @category wrapper
7
- */
4
+ * {@linkcode Rotate} Make child elements rotate.
5
+ *
6
+ * @category wrapper
7
+ */
8
8
  declare class Rotate extends GlobalStyle {
9
- protected _root: HTMLElement;
10
- protected render(): TemplateResult<1>;
11
- reset(): void;
12
- protected _handleRotate(e: MouseEvent): void;
13
- /**
14
- * Compute offset.
15
- *
16
- * @returns rotateX, rotateY
17
- * @example
18
- * ```ts
19
- * const { rotateX, rotateY } = this._computeOffset(e);
20
- * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`;
21
- * ```
22
- */
23
- protected _computeOffset(e: MouseEvent): {
24
- rotateX: number;
25
- rotateY: number;
26
- };
9
+ protected _root: HTMLElement;
10
+ protected render(): TemplateResult<1>;
11
+ reset(): void;
12
+ protected _handleRotate(e: MouseEvent): void;
13
+ /**
14
+ * Compute offset.
15
+ *
16
+ * @returns rotateX, rotateY
17
+ * @example
18
+ * ```ts
19
+ * const { rotateX, rotateY } = this._computeOffset(e);
20
+ * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`;
21
+ * ```
22
+ */
23
+ protected _computeOffset(e: MouseEvent): {
24
+ rotateX: number;
25
+ rotateY: number;
26
+ };
27
27
  }
28
28
  export default Rotate;
29
29
  export { Rotate };
30
- //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/rotate/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,WAAW,EAAe,MAAM,gCAAgC,CAAC;AAK1E;;;;GAIG;AACH,cA6BM,MAAO,SAAQ,WAAW;IAE9B,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAcrC,KAAK,IAAI,IAAI;IAKb,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAM5C;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU,GAAG;QACvC,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB;CAUF;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"mappings":"AACA,cAAc,sBAAiC,KAAM;AAErD,SAAS,mBAAgC,gCAAiC;;;;;;AAU1E,cA6BM,eAAe,YAAY;CAC/B,UACU,OAAO;CAEjB,UAAU,UAAU,eAAe;CAcnC;CAKA,UAAU,cAAcA,GAAG;;;;;;;;;;;CAgB3B,UAAU,eAAeA,GAAG,aAAa;EACvC;EACA;CACD;AAUF;AAED,eAAe;AACf,SAAS","names":["e: MouseEvent"],"sources":["../../../src/web-components/rotate/component.ts"],"sourcesContent":["import { godown, htmlSlot, queryPart, styles } from \"@godown/element\";\nimport { type TemplateResult, css, html } from \"lit\";\n\nimport { GlobalStyle, scopePrefix } from \"../../internal/global-style.js\";\n\nconst protoName = \"rotate\";\nconst cssScope = scopePrefix(protoName);\n\n/**\n * {@linkcode Rotate} Make child elements rotate.\n *\n * @category wrapper\n */\n@godown(protoName)\n@styles(css`\n :host {\n display: block;\n width: fit-content;\n transition: all 0.5s ease-in-out;\n ${cssScope}--offset: .5em;\n }\n\n div {\n position: relative;\n transition: inherit;\n transition-property: transform;\n }\n\n i {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n box-sizing: content-box;\n padding: var(${cssScope}--offset);\n margin: calc(-1 * var(${cssScope}--offset));\n }\n\n [part=\"slot\"] {\n z-index: 2;\n }\n`)\nclass Rotate extends GlobalStyle {\n @queryPart(\"root\")\n protected _root: HTMLElement;\n\n protected render(): TemplateResult<1> {\n return html`\n <div part=\"root\">\n <div\n part=\"slot\"\n @mousemove=\"${this._handleRotate}\"\n >\n ${htmlSlot()}\n </div>\n <i @mouseleave=\"${this.reset}\"></i>\n </div>\n `;\n }\n\n reset(): void {\n this._root.style.removeProperty(\"transform\");\n this._root.style.removeProperty(\"transition\");\n }\n\n protected _handleRotate(e: MouseEvent): void {\n const { rotateX, rotateY } = this._computeOffset(e);\n this._root.style.setProperty(\"transform\", `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`);\n this._root.style.setProperty(\"transition\", \"0s\");\n }\n\n /**\n * Compute offset.\n *\n * @returns rotateX, rotateY\n * @example\n * ```ts\n * const { rotateX, rotateY } = this._computeOffset(e);\n * `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`;\n * ```\n */\n protected _computeOffset(e: MouseEvent): {\n rotateX: number;\n rotateY: number;\n } {\n const { left, top, width, height } = this._root.getBoundingClientRect();\n const { clientX, clientY } = e;\n const offsetX = clientX - left;\n const offsetY = clientY - top;\n\n const rotateX = -(offsetY - height / 2) / height / 2;\n const rotateY = (offsetX - width / 2) / width / 2;\n return { rotateX, rotateY };\n }\n}\n\nexport default Rotate;\nexport { Rotate };\n"],"version":3,"file":"component.d.ts"}
@@ -1,2 +1,2 @@
1
- import{__decorate as t}from"tslib";import{queryPart as o,godown as e,styles as r,htmlSlot as i}from"@godown/element";import{css as s,html as n}from"lit";import{scopePrefix as a,GlobalStyle as l}from"../../internal/global-style.js";const p="rotate",d=a(p);let m=class Rotate extends l{render(){return n`<div part="root"> <div part="slot" @mousemove="${this._handleRotate}"> ${i()} </div> <i @mouseleave="${this.reset}"></i> </div>`}reset(){this._root.style.removeProperty("transform"),this._root.style.removeProperty("transition")}_handleRotate(t){const{rotateX:o,rotateY:e}=this._computeOffset(t);this._root.style.setProperty("transform",`rotateX(${o}rad) rotateY(${e}rad)`),this._root.style.setProperty("transition","0s")}_computeOffset(t){const{left:o,top:e,width:r,height:i}=this._root.getBoundingClientRect(),{clientX:s,clientY:n}=t;return{rotateX:-(n-e-i/2)/i/2,rotateY:(s-o-r/2)/r/2}}};t([o("root")],m.prototype,"_root",void 0),m=t([e(p),r(s`:host{display:block;transition:all .5s ease-in-out;width:-moz-fit-content;width:fit-content;${d}--offset:.5em}div{position:relative;transition:inherit;transition-property:transform}i{box-sizing:content-box;height:100%;margin:calc(var(${d}--offset)*-1);padding:var(${d}--offset);position:absolute;top:0;width:100%}[part=slot]{z-index:2}`)],m);var f=m;export{m as Rotate,f as default};
1
+ import{queryPart,godown,styles,htmlSlot}from"@godown/element";import{css,html}from"lit";import{scopePrefix,GlobalStyle}from"../../internal/global-style.js";import _decorate from"@oxc-project/runtime/helpers/decorate";const protoName=`rotate`,cssScope=scopePrefix(protoName);let Rotate=class e extends GlobalStyle{render(){return html`<div part="root"> <div part="slot" @mousemove="${this._handleRotate}"> ${htmlSlot()} </div> <i @mouseleave="${this.reset}"></i> </div>`}reset(){this._root.style.removeProperty(`transform`),this._root.style.removeProperty(`transition`)}_handleRotate(e){let{rotateX:r,rotateY:i}=this._computeOffset(e);this._root.style.setProperty(`transform`,`rotateX(${r}rad) rotateY(${i}rad)`),this._root.style.setProperty(`transition`,`0s`)}_computeOffset(e){let{left:r,top:i,width:a,height:o}=this._root.getBoundingClientRect(),{clientX:s,clientY:c}=e,l=s-r,u=c-i,d=-(u-o/2)/o/2,f=(l-a/2)/a/2;return{rotateX:d,rotateY:f}}};_decorate([queryPart(`root`)],Rotate.prototype,`_root`,void 0),Rotate=_decorate([godown(protoName),styles(css`:host{display:block;width:-moz-fit-content;width:fit-content;transition:all .5s ease-in-out;${cssScope}--offset:.5em}div{position:relative;transition:inherit;transition-property:transform}i{width:100%;height:100%;position:absolute;top:0;box-sizing:content-box;padding:var(${cssScope}--offset);margin:calc(-1*var(${cssScope}--offset))}[part=slot]{z-index:2}`)],Rotate);var Rotate$1=Rotate;export{Rotate,Rotate$1 as default};
2
2
  //# sourceMappingURL=component.js.map